public abstract class IlvCSSFunction extends Object implements Serializable
IlvAcceptFunctions.registerFunction(ilog.views.util.styling.IlvCSSFunction)
before being usable. See the User Manual for more details.
The following functions are registered by default: concat
,
id
, type
.
int
, long
, float
,
double
,
The first one concatenates strings, the next two returns current node ID and
type respectively, the others
compute an arithmetic function of the suggested type. Example:
foo[speed] { mph = @|float(@speed*1.6); }
IlvAcceptFunctions.registerFunction(ilog.views.util.styling.IlvCSSFunction)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
ANY
This placeholder can be used in dependencies sets, and can be returned
from the
getDependencies(String[]) method, indicating anything:
all possible properties, all possible pseudoclasses, and even influenced
from outside (such as state contained in the closure, or random
numbers). |
static String |
ANY_PROPERTIES
This placeholder can be used in dependencies sets, and can be returned
from the
getDependencies(String[]) method, indicating all
possible model properties. |
static String |
ANY_PSEUDOCLASSES
This placeholder can be used in dependencies sets, and can be returned
from the
getDependencies(String[]) method, indicating all
possible pseudoclasses. |
Modifier | Constructor and Description |
---|---|
protected |
IlvCSSFunction()
Creates a new
IlvCSSFunction . |
Modifier and Type | Method and Description |
---|---|
abstract Object |
call(Object[] args,
Class<?> type,
ilog.views.util.css.IlvCSSModel model,
Object node,
Object target,
Object closure)
Calls the function.
|
String |
getDelimiters()
Returns the delimiters of the function parameters.
|
Collection<String> |
getDependencies(String[] args)
Returns the dependencies of this function.
|
float |
getImportance()
Returns the importance of the function.
|
abstract String |
getName()
Returns the name of the function that will be known in the
style sheet.
|
String |
getShortDescription()
Returns a short description of the function.
|
boolean |
returnDelimitersAsToken()
Returns whether the delimiters are also returned as tokens.
|
public static final String ANY_PROPERTIES
getDependencies(String[])
method, indicating all
possible model properties.public static final String ANY_PSEUDOCLASSES
getDependencies(String[])
method, indicating all
possible pseudoclasses.public static final String ANY
getDependencies(String[])
method, indicating anything:
all possible properties, all possible pseudoclasses, and even influenced
from outside (such as state contained in the closure, or random
numbers).public abstract String getName()
public String getDelimiters()
Warning: css functions are processed inside an expression module which evaluates arithmetic operations before breaking the argument according to the delimiters. For example if "+" is a delimiter, the argument "3+1" will be evaluated to "4" instead of two arguments (3,1).
null
or empty return value means there is no delimiter, so all the
parameters are returned as a single token.public boolean returnDelimitersAsToken()
true
means the delimiters are returned as tokens,
false
means the delimiters are discarded (default).public abstract Object call(Object[] args, Class<?> type, ilog.views.util.css.IlvCSSModel model, Object node, Object target, Object closure)
args
- The parameters of the function.type
- The expected returned type, which may be null
.
It is wise
to return an object compatible with the expected type, or a
String.model
- The current model. Usually the model comes from
the engine, but there are some situations where it is a
new model.node
- The current node. This is the current model object
being called on. Inside a @# construct, node represents the
parent of the fake node indeed used to process the @#
construct, i.e. the real node of interest.target
- The current rendered object being called on.closure
- An object set by
IlvCSSBeans.setFunctionClosure(java.lang.Object)
public Collection<String> getDependencies(String[] args)
call(java.lang.Object[], java.lang.Class<?>, ilog.views.util.css.IlvCSSModel, java.lang.Object, java.lang.Object, java.lang.Object)
method, called with the same arguments, to return a
different value. Possible elements are:
model.getValue(node, property
or
model.getValueAsObject(node, property
.ANY_PROPERTIES
Any unknown set of properties.ANY_PSEUDOCLASSES
Any unknown set of pseudoclasses.ANY
Any other dependencies, such as state contained in the
closure, or random numbers. Returned when the call's result
must not be cached.args
- The simple identifier arguments of a call to this function.
This is an array that contains, for every argument expression,
the argument expression if it is a simple identifier, or
null
if it is a string literal, number literal,
boolean literal, or any other kind of expression.public String getShortDescription()
IlvLocaleUtil.getCurrentLocale()
.public float getImportance()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.