public class Options extends java.lang.Object implements org.apache.wicket.model.IModel<Options>
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 a IOptionsRenderer.
| Constructor and Description |
|---|
Options()
Build a new empty
Options instance that does not bind to a component. |
Options(org.apache.wicket.Component owner)
Build a new empty
Options instance that binds to a component |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(java.lang.Object key)
Returns if the given option is defined or not.
|
void |
detach() |
java.lang.String |
get(java.lang.String key)
Returns the given option value as a String.
|
java.lang.Boolean |
getBoolean(java.lang.String key)
Returns the given option value.
|
ICollectionItemOptions |
getCollectionItemOptions(java.lang.String key)
Returns the given option value.
|
IComplexOption |
getComplexOption(java.lang.String key)
Returns the given option value.
|
java.lang.Double |
getDouble(java.lang.String key)
Returns the given option value.
|
java.lang.Float |
getFloat(java.lang.String key)
Returns the given option value.
|
java.lang.Integer |
getInt(java.lang.String key)
Returns the given option value.
|
java.lang.CharSequence |
getJavaScriptOptions()
Returns the JavaScript statement corresponding to options.
|
JsScope |
getJsScope(java.lang.String key)
Returns the given option value.
|
java.lang.String |
getLiteral(java.lang.String key)
Returns the given option value.
|
Options |
getObject() |
java.lang.Short |
getShort(java.lang.String key)
Returns the given option value.
|
boolean |
isEmpty() |
Options |
put(java.lang.String key,
boolean value)
Put an boolean value for the given option name.
|
Options |
put(java.lang.String key,
double value)
Puts an double value for the given option name.
|
Options |
put(java.lang.String key,
float value)
Puts an float value for the given option name.
|
Options |
put(java.lang.String key,
ICollectionItemOptions value)
Puts a list of IListItemOption value for the given option name.
|
Options |
put(java.lang.String key,
IComplexOption value)
Puts a complex option value for the given option name.
|
Options |
put(java.lang.String key,
int value)
Puts an int value for the given option name.
|
Options |
put(java.lang.String key,
JsScope value)
Puts a
JsScope value for the given option name. |
Options |
put(java.lang.String key,
long value)
Puts a
Long value for the given option name. |
Options |
put(java.lang.String key,
short value)
Puts an short value for the given option name.
|
Options |
put(java.lang.String key,
java.lang.String value)
Puts a
String value for the given option name. |
Options |
putBoolean(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.Boolean> value)
Put an boolean value for the given option name.
|
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.
|
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.
|
Options |
putInteger(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.Integer> value)
Puts an int value for the given option name.
|
Options |
putLiteral(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.String> value)
Puts a
String value as a JavaScript literal for the given name. |
Options |
putLiteral(java.lang.String key,
java.lang.String value)
Puts a
String value as a JavaScript literal for the given name. |
Options |
putLong(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.Long> value)
Puts a
Long value for the given option name. |
Options |
putShort(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.Short> value)
Puts an short value for the given option name.
|
Options |
putString(java.lang.String key,
org.apache.wicket.model.IModel<java.lang.String> value)
Puts a
String value for the given option name. |
void |
removeOption(java.lang.String key)
Removes an option for a given name.
|
void |
setObject(Options object) |
void |
setOwner(org.apache.wicket.Component owner) |
void |
setRenderer(IOptionsRenderer optionsRenderer)
Sets the renderer to use.
|
public Options()
Options instance that does not bind to a component. This does not
allow the usage of IComponentAssignedModels as option values.public Options(org.apache.wicket.Component owner)
Options instance that binds to a componentpublic void setOwner(org.apache.wicket.Component owner)
public boolean containsKey(java.lang.Object key)
Returns if the given option is defined or not.
key - the option name.public java.lang.String get(java.lang.String key)
Returns the given option value as a String.
key - the option name.public java.lang.Boolean getBoolean(java.lang.String key)
Returns the given option value.
key - the option name.public JsScope getJsScope(java.lang.String key)
Returns the given option value.
key - the option name.public IComplexOption getComplexOption(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.Double getDouble(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.Float getFloat(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.Integer getInt(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.CharSequence getJavaScriptOptions()
public ICollectionItemOptions getCollectionItemOptions(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.String getLiteral(java.lang.String key)
Returns the given option value.
key - the option name.public java.lang.Short getShort(java.lang.String key)
Returns the given option value.
key - the option name.public boolean isEmpty()
public Options put(java.lang.String key, boolean value)
Put an boolean value for the given option name.
key - the option name.value - the boolean value.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.
key - the option name.value - the boolean value.public Options put(java.lang.String key, double value)
Puts an double value for the given option name.
key - the option name.value - the float double.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.
key - the option name.value - the float value.public Options put(java.lang.String key, float value)
Puts an float value for the given option name.
key - the option namevalue - The float valuepublic 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.
key - the option name.value - the float double.public Options put(java.lang.String key, ICollectionItemOptions value)
Puts a list of IListItemOption value for the given option name.
key - the option name.value - the IListItemOption list.public Options put(java.lang.String key, IComplexOption value)
Puts a complex option value for the given option name.
key - the option name.value - the IComplexOption.public Options put(java.lang.String key, int value)
Puts an int value for the given option name.
key - the option name.value - the int value.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.
key - the option name.value - the int value.public Options put(java.lang.String key, JsScope value)
Puts a JsScope value for the given option name.
key - the option name.value - the JsScope value.public Options put(java.lang.String key, short value)
Puts an short value for the given option name.
key - the option name.value - the short value.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.
key - the option name.value - the short value.public Options put(java.lang.String key, java.lang.String value)
Puts a String value for the given option name.
key - the option name.value - the String value.public Options putString(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)
Puts a String value for the given option name.
key - the option name.value - the String value.public Options put(java.lang.String key, long value)
Puts a Long value for the given option name.
key - the option name.value - the Long value.public Options putLong(java.lang.String key, org.apache.wicket.model.IModel<java.lang.Long> value)
Puts a Long value for the given option name.
key - the option name.value - the Long value.public Options putLiteral(java.lang.String key, java.lang.String value)
Puts a String value as a JavaScript literal for the given name.
Note that the JavaScript resulting from this options will be 'value'
key - the option name.value - the LiteralOption value.public Options putLiteral(java.lang.String key, org.apache.wicket.model.IModel<java.lang.String> value)
Puts a String value as a JavaScript literal for the given name.
Note that the JavaScript resulting from this options will be 'value'
key - the option name.value - the LiteralOption value.public void removeOption(java.lang.String key)
Removes an option for a given name.
key - the option's key to remove.public void setRenderer(IOptionsRenderer optionsRenderer)
public Options getObject()
getObject in interface org.apache.wicket.model.IModel<Options>public void setObject(Options object)
setObject in interface org.apache.wicket.model.IModel<Options>public void detach()
detach in interface org.apache.wicket.model.IDetachabledetach in interface org.apache.wicket.model.IModel<Options>Copyright © 2018. All Rights Reserved.