Package org.zkoss.chart.util
Class JSFunction
- java.lang.Object
-
- org.zkoss.chart.util.JSFunction
-
- All Implemented Interfaces:
org.zkoss.json.JSONAware
public class JSFunction extends Object implements org.zkoss.json.JSONAware
A Javascript function wrap to generate as a formal Javascript code. Used for the implementation of Highcharts' dynamical attributes.- Author:
- jumperchen
-
-
Constructor Summary
Constructors Constructor Description JSFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSFunction
callArray(String attribute, int index)
Calls a array with the given index.JSFunction
callFunction(String funcName)
Calls a Javascript Function without any arguments.JSFunction
callFunction(String funcName, Object... arguments)
Calls a Javascript Function with any arguments.void
empty()
JSFunction
evalAttribute(String attribute)
Evaluates an attribute of Javascript Object.JSFunction
evalJavascript(String javascript)
Evaluates a Javascript code with parentheses, if any.boolean
isEmpty()
JSFunction
reverse()
Sets the Javascript calls in a reverse ordering.String
toExecFunction()
Returns the string in a executable Javascript function.String
toJSONString()
String
toReturnFunction()
Returns the string in a return value of Javascript function.String
toString()
String
toWrapFunction()
Returns the string in a wrap Javascript function.
-
-
-
Method Detail
-
evalAttribute
public JSFunction evalAttribute(String attribute)
Evaluates an attribute of Javascript Object.- Parameters:
attribute
- the name of the attribute
-
evalJavascript
public JSFunction evalJavascript(String javascript)
Evaluates a Javascript code with parentheses, if any.- Parameters:
javascript
- the formal Javascript code- See Also:
toExecFunction()
-
callFunction
public JSFunction callFunction(String funcName)
Calls a Javascript Function without any arguments.- Parameters:
funcName
- the name of the Javascript function without parentheses.
-
callFunction
public JSFunction callFunction(String funcName, Object... arguments)
Calls a Javascript Function with any arguments.- Parameters:
funcName
- the name of the Javascript function without parentheses.arguments
- the arguments in ordering.
-
empty
public void empty()
-
callArray
public JSFunction callArray(String attribute, int index)
Calls a array with the given index.- Parameters:
attribute
- the name of the arrayindex
- the index of the array.
-
reverse
public JSFunction reverse()
Sets the Javascript calls in a reverse ordering.
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfaceorg.zkoss.json.JSONAware
-
isEmpty
public boolean isEmpty()
-
toWrapFunction
public String toWrapFunction()
Returns the string in a wrap Javascript function.For example,
function () { this.YourCodesHere;}
-
toExecFunction
public String toExecFunction()
Returns the string in a executable Javascript function.For example,
function () { YourCodesHere;}
-
toReturnFunction
public String toReturnFunction()
Returns the string in a return value of Javascript function.For example,
function () { return this.YourCodesHere;}
-
-