public abstract class IlvSDMCSSFunction extends IlvCSSFunction implements Serializable
IlvStyleSheetRenderer
, so x
they can be called from a style sheet. An implementation must be
registered before being usable, either directly in Java or
through the style sheet itself. See the User Manual for more
details.
Note that this class inherits from class IlvCSSFunction to ease compatibility with other JViews modules. However all methods are overloaded here.
IlvStyleSheetRenderer.registerFunction(ilog.views.sdm.renderer.IlvSDMCSSFunction)
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvSDMCSSFunction.Feedback
A placeholder which contains a String and an object.
|
static class |
IlvSDMCSSFunction.NumericSymbolInteractor
SymbolInteractor subclass to handle numerical values.
|
static class |
IlvSDMCSSFunction.StateSymbolInteractor
SymbolInteractor subclass to handle String values.
|
static class |
IlvSDMCSSFunction.SymbolInteractor
CSS function to handle symbol interactions in a cleaner way.
|
static class |
IlvSDMCSSFunction.Test
Test function.
|
ANY, ANY_PROPERTIES, ANY_PSEUDOCLASSES
Constructor and Description |
---|
IlvSDMCSSFunction()
Constructor for IlvSDMCSSFunction.
|
Modifier and Type | Method and Description |
---|---|
Object |
call(Object[] args,
Class<?> type,
ilog.views.util.css.IlvCSSModel model,
Object node,
Object target,
Object closure)
This method comes from the superclass and isn't used inside SDM scope.
|
abstract Object |
call(Object[] args,
Class<?> type,
IlvSDMEngine engine,
Object node,
Object target)
Calls the function.
|
String |
getDelimiters()
Returns the delimiters of the function parameters.
|
Collection<String> |
getDependencies(String[] args)
Returns the dependencies of this function.
|
abstract String |
getName()
Returns the name of the function that will be known in the
style sheet.
|
IlvSDMCSSFunction.Feedback[] |
invert(Object[] args,
Object value,
IlvSDMEngine engine,
Object target)
This method is called from the style sheet renderer to
update a model object property.
|
boolean |
returnDelimitersAsToken()
Returns whether the delimiters are also returned as tokens.
|
getImportance, getShortDescription
public abstract String getName()
getName
in class IlvCSSFunction
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).
getDelimiters
in class IlvCSSFunction
null
or empty return value means there is no delimiter, so all the
parameters are returned as a single token.public boolean returnDelimitersAsToken()
returnDelimitersAsToken
in class IlvCSSFunction
true
means the delimiters are returned as tokens,
false
means the delimiters are discarded (default).public final Object call(Object[] args, Class<?> type, ilog.views.util.css.IlvCSSModel model, Object node, Object target, Object closure)
call
in class IlvCSSFunction
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)
call(Object[], Class, ilog.views.sdm.IlvSDMEngine, Object, Object)
public abstract Object call(Object[] args, Class<?> type, IlvSDMEngine engine, Object node, Object target)
args
- The parameters of the function.type
- The expected return type, which may be null
. It
is wise to return an object compatible with the expected type, or a
String.engine
- The current engine. It may be null
if the
IlvStyleSheetRenderer
is disconnected from an engine.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. Note that the
model object can easily be found if args
contains the
parameter id.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:
engine.getModel().getObjectProperty(node, property
.IlvCSSFunction.ANY_PROPERTIES
Any unknown set of properties.IlvCSSFunction.ANY_PSEUDOCLASSES
Any unknown set of pseudoclasses.IlvCSSFunction.ANY
Any other dependencies, such as state contained in
global variables, or random numbers. Returned when the call's result
must not be cached.This implementation returns [ ANY ].
getDependencies
in class IlvCSSFunction
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 IlvSDMCSSFunction.Feedback[] invert(Object[] args, Object value, IlvSDMEngine engine, Object target)
NOTE: inverting a function is not always possible. This method can return null to indicate the inversion fails.
args
- The parameters of the functions, as they come from
the style sheet.value
- The value coming from the graphic objects.engine
- The current engine.target
- The model object.IllegalArgumentException
if the
function is not able to compute back the result, or null
if
"don't care." The default implementation returns null
.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.