Class Options
- java.lang.Object
-
- org.wicketstuff.wiquery.core.options.Options
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.wicket.model.IDetachable,org.apache.wicket.model.IModel<Options>,org.apache.wicket.util.io.IClusterable
public class Options extends java.lang.Object implements org.apache.wicket.model.IModel<Options>
$Id: Options.java 1714M 2012-01-17 08:38:19Z (local) $Wraps a set of options possibly defined for a WiQuery
Component.By default, Options are rendered as a JavaScript object like this:
{ option1: 'value1', option2: 'value2 }This rendering can be customized by creating aIOptionsRenderer.- Since:
- 0.5
- Author:
- Lionel Armanet, Hielke Hoeve, Ernesto Reinaldo Barreiro
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.Object key)Returns if the given option is defined or not.voiddetach()java.lang.Stringget(java.lang.String key)Returns the given option value as a String.java.lang.BooleangetBoolean(java.lang.String key)Returns the given option value.ICollectionItemOptionsgetCollectionItemOptions(java.lang.String key)Returns the given option value.IComplexOptiongetComplexOption(java.lang.String key)Returns the given option value.java.lang.DoublegetDouble(java.lang.String key)Returns the given option value.java.lang.FloatgetFloat(java.lang.String key)Returns the given option value.java.lang.IntegergetInt(java.lang.String key)Returns the given option value.java.lang.CharSequencegetJavaScriptOptions()Returns the JavaScript statement corresponding to options.JsScopegetJsScope(java.lang.String key)Returns the given option value.java.lang.StringgetLiteral(java.lang.String key)Returns the given option value.OptionsgetObject()java.lang.ShortgetShort(java.lang.String key)Returns the given option value.booleanisEmpty()Optionsput(java.lang.String key, boolean value)Put an boolean value for the given option name.Optionsput(java.lang.String key, double value)Puts an double value for the given option name.Optionsput(java.lang.String key, float value)Puts an float value for the given option name.Optionsput(java.lang.String key, int value)Puts an int value for the given option name.Optionsput(java.lang.String key, long value)Puts aLongvalue for the given option name.Optionsput(java.lang.String key, short value)Puts an short value for the given option name.Optionsput(java.lang.String key, java.lang.String value)Puts aStringvalue for the given option name.Optionsput(java.lang.String key, JsScope value)Puts aJsScopevalue for the given option name.Optionsput(java.lang.String key, ICollectionItemOptions value)Puts a list of IListItemOption value for the given option name.Optionsput(java.lang.String key, IComplexOption value)Puts a complex option value for the given option name.OptionsputBoolean(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Boolean> value)Put an boolean value for the given option name.OptionsputDouble(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Double> value)Puts an IModel <Double> value for the given option name.OptionsputFloat(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Float> value)Puts an IModel <Double> value for the given option name.OptionsputInteger(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Integer> value)Puts an int value for the given option name.OptionsputLiteral(java.lang.String key, java.lang.String value)Puts aStringvalue as a JavaScript literal for the given name.OptionsputLiteral(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)Puts aStringvalue as a JavaScript literal for the given name.OptionsputLong(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Long> value)Puts aLongvalue for the given option name.OptionsputShort(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Short> value)Puts an short value for the given option name.OptionsputString(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)Puts aStringvalue for the given option name.voidremoveOption(java.lang.String key)Removes an option for a given name.voidsetObject(Options object)voidsetOwner(org.apache.wicket.Component owner)voidsetRenderer(IOptionsRenderer optionsRenderer)Sets the renderer to use.
-
-
-
Constructor Detail
-
Options
public Options()
Build a new emptyOptionsinstance that does not bind to a component. This does not allow the usage of IComponentAssignedModels as option values.
-
Options
public Options(org.apache.wicket.Component owner)
Build a new emptyOptionsinstance that binds to a component
-
-
Method Detail
-
setOwner
public void setOwner(org.apache.wicket.Component owner)
-
containsKey
public boolean containsKey(java.lang.Object key)
Returns if the given option is defined or not.
- Parameters:
key- the option name.
-
get
public java.lang.String get(java.lang.String key)
Returns the given option value as a String.
- Parameters:
key- the option name.
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getJsScope
public JsScope getJsScope(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getComplexOption
public IComplexOption getComplexOption(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.- Returns:
- the complex option
-
getDouble
public java.lang.Double getDouble(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getFloat
public java.lang.Float getFloat(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getInt
public java.lang.Integer getInt(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getJavaScriptOptions
public java.lang.CharSequence getJavaScriptOptions()
Returns the JavaScript statement corresponding to options.
-
getCollectionItemOptions
public ICollectionItemOptions getCollectionItemOptions(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.- Returns:
- the list
-
getLiteral
public java.lang.String getLiteral(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
getShort
public java.lang.Short getShort(java.lang.String key)
Returns the given option value.
- Parameters:
key- the option name.
-
isEmpty
public boolean isEmpty()
- Returns:
- true if no options are defined, false otherwise.
-
put
public Options put(java.lang.String key, boolean value)
Put an boolean value for the given option name.
- Parameters:
key- the option name.value- the boolean value.
-
putBoolean
public Options putBoolean(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Boolean> value)
Put an boolean value for the given option name.
- Parameters:
key- the option name.value- the boolean value.
-
put
public Options put(java.lang.String key, double value)
Puts an double value for the given option name.
- Parameters:
key- the option name.value- the float double.
-
putDouble
public Options putDouble(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Double> value)
Puts an IModel <Double> value for the given option name.
- Parameters:
key- the option name.value- the float value.
-
put
public Options put(java.lang.String key, float value)
Puts an float value for the given option name.
- Parameters:
key- the option namevalue- The float value
-
putFloat
public Options putFloat(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Float> value)
Puts an IModel <Double> value for the given option name.
- Parameters:
key- the option name.value- the float double.
-
put
public Options put(java.lang.String key, ICollectionItemOptions value)
Puts a list of IListItemOption value for the given option name.
- Parameters:
key- the option name.value- the IListItemOption list.
-
put
public Options put(java.lang.String key, IComplexOption value)
Puts a complex option value for the given option name.
- Parameters:
key- the option name.value- the IComplexOption.
-
put
public Options put(java.lang.String key, int value)
Puts an int value for the given option name.
- Parameters:
key- the option name.value- the int value.
-
putInteger
public Options putInteger(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Integer> value)
Puts an int value for the given option name.
- Parameters:
key- the option name.value- the int value.
-
put
public Options put(java.lang.String key, JsScope value)
Puts a
JsScopevalue for the given option name.- Parameters:
key- the option name.value- theJsScopevalue.
-
put
public Options put(java.lang.String key, short value)
Puts an short value for the given option name.
- Parameters:
key- the option name.value- the short value.
-
putShort
public Options putShort(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Short> value)
Puts an short value for the given option name.
- Parameters:
key- the option name.value- the short value.
-
put
public Options put(java.lang.String key, java.lang.String value)
Puts a
Stringvalue for the given option name.- Parameters:
key- the option name.value- theStringvalue.
-
putString
public Options putString(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)
Puts a
Stringvalue for the given option name.- Parameters:
key- the option name.value- theStringvalue.
-
put
public Options put(java.lang.String key, long value)
Puts a
Longvalue for the given option name.- Parameters:
key- the option name.value- theLongvalue.
-
putLong
public Options putLong(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Long> value)
Puts a
Longvalue for the given option name.- Parameters:
key- the option name.value- theLongvalue.
-
putLiteral
public Options putLiteral(java.lang.String key, java.lang.String value)
Puts a
Stringvalue as a JavaScript literal for the given name.Note that the JavaScript resulting from this options will be
'value'- Parameters:
key- the option name.value- theLiteralOptionvalue.
-
putLiteral
public Options putLiteral(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)
Puts a
Stringvalue as a JavaScript literal for the given name.Note that the JavaScript resulting from this options will be
'value'- Parameters:
key- the option name.value- theLiteralOptionvalue.
-
removeOption
public void removeOption(java.lang.String key)
Removes an option for a given name.
- Parameters:
key- the option's key to remove.
-
setRenderer
public void setRenderer(IOptionsRenderer optionsRenderer)
Sets the renderer to use.
-
getObject
public Options getObject()
- Specified by:
getObjectin interfaceorg.apache.wicket.model.IModel<Options>
-
setObject
public void setObject(Options object)
- Specified by:
setObjectin interfaceorg.apache.wicket.model.IModel<Options>
-
detach
public void detach()
- Specified by:
detachin interfaceorg.apache.wicket.model.IDetachable- Specified by:
detachin interfaceorg.apache.wicket.model.IModel<Options>
-
-