de.agilecoders.wicket.jquery.function
Class AbstractFunction

java.lang.Object
  extended by de.agilecoders.wicket.jquery.function.AbstractFunction
All Implemented Interfaces:
IFunction, Serializable, org.apache.wicket.util.io.IClusterable
Direct Known Subclasses:
Function, JavaScriptInlineFunction, OnJqueryFunction, SimpleFunction

public abstract class AbstractFunction
extends Object
implements IFunction

A simple implementation of IFunction that allows you to chain function parameters in a javascript safe way.

See Also:
Serialized Form

Constructor Summary
protected AbstractFunction(CharSequence functionName)
          Construct.
protected AbstractFunction(CharSequence functionName, List<CharSequence> parameters)
          Construct.
 
Method Summary
protected  void addParameter(CharSequence parameter)
          adds a new parameter to parameter list
 String build()
           
protected  String buildParameters()
           
 List<CharSequence> getParameters()
           
protected  char getSeparator()
           
protected  CharSequence toParameterValue(Boolean value)
          transform given value to a javascript parameter value
protected  CharSequence toParameterValue(Float value)
          transform given value to a javascript parameter value
protected  CharSequence toParameterValue(Integer value)
          transform given value to a javascript parameter value
protected  CharSequence toParameterValue(JavaScriptInlineFunction value)
          transform given value to a javascript parameter value
protected  CharSequence toParameterValue(Long value)
          transform given value to a javascript parameter value
protected  CharSequence toParameterValue(Object value)
          transform given value to a javascript parameter value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFunction

protected AbstractFunction(CharSequence functionName)
Construct.

Parameters:
functionName - The function name of this IFunction implementation

AbstractFunction

protected AbstractFunction(CharSequence functionName,
                           List<CharSequence> parameters)
Construct.

Parameters:
functionName - The function name of this IFunction implementation
Method Detail

build

public String build()
Specified by:
build in interface IFunction
Returns:
the function as javascript string.

getSeparator

protected final char getSeparator()
Returns:
the separator

buildParameters

protected String buildParameters()
Returns:
a joined list of parameters as string

addParameter

protected void addParameter(CharSequence parameter)
adds a new parameter to parameter list

Parameters:
parameter - The parameter to add

toParameterValue

protected CharSequence toParameterValue(Object value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

toParameterValue

protected CharSequence toParameterValue(JavaScriptInlineFunction value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

toParameterValue

protected CharSequence toParameterValue(Long value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

toParameterValue

protected CharSequence toParameterValue(Integer value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

toParameterValue

protected CharSequence toParameterValue(Float value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

toParameterValue

protected CharSequence toParameterValue(Boolean value)
transform given value to a javascript parameter value

Parameters:
value - The value to transform
Returns:
value as string

getParameters

public List<CharSequence> getParameters()


Copyright © 2017. All Rights Reserved.