ilog.views.util.styling
Class IlvCSSFunction

java.lang.Object
  extended by ilog.views.util.styling.IlvCSSFunction
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IlvSDMCSSFunction

public abstract class IlvCSSFunction
extends Object
implements Serializable

The abstract base class that defines functions in CSS expressions so that they can be called from a style sheet. An implementation must be registered 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);
 }
 

Since:
JViews 6.0
See Also:
IlvAcceptFunctions.registerFunction(ilog.views.util.styling.IlvCSSFunction), Serialized Form

Constructor Summary
protected IlvCSSFunction()
          Creates a new IlvCSSFunction.
 
Method Summary
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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvCSSFunction

protected IlvCSSFunction()
Creates a new IlvCSSFunction.

Method Detail

getName

public abstract String getName()
Returns the name of the function that will be known in the style sheet.


getDelimiters

public String getDelimiters()
Returns the delimiters of the function parameters. It is strongly recommended to return at least the comma (","). The default implementation returns ",".

Returns:
A string containing all the accepted delimiters. A null or empty return value means there is no delimiter, so all the parameters are returned as a single token.

returnDelimitersAsToken

public boolean returnDelimitersAsToken()
Returns whether the delimiters are also returned as tokens.

Returns:
true means the delimiters are returned as tokens, false means the delimiters are discarded (default).

call

public abstract Object call(Object[] args,
                            Class type,
                            ilog.views.util.css.IlvCSSModel model,
                            Object node,
                            Object target,
                            Object closure)
Calls the function.

Parameters:
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)
Returns:
The value computed by this function.

getShortDescription

public String getShortDescription()
Returns a short description of the function. This description is used for instance in the expression editor of the customizers, to describe the function proposed to the user.

Since:
JViews 7.5

getImportance

public float getImportance()
Returns the importance of the function. The importance helps an editor to sort the functions according to their importance. 0 means the function is not important and should be hidden, 1 means it is very important. Default value is 0.7f. Built-in functions are between 0.6 and 0.7.
By convention, designers show only functions with importance >= .5
Note that the importance doesn't affect the function itself. 0-importance functions work as well as 1.0 ones.

Returns:
function importance value, a float between 0.0 and 1.0.
Since:
JViews 7.5


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.