Class Options

java.lang.Object
org.wicketstuff.wiquery.core.options.Options
All Implemented Interfaces:
Serializable, org.apache.wicket.model.IDetachable, org.apache.wicket.model.IModel<Options>, org.apache.wicket.util.io.IClusterable

public class Options extends 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 a IOptionsRenderer.

Since:
0.5
Author:
Lionel Armanet, Hielke Hoeve, Ernesto Reinaldo Barreiro
See Also:
  • Constructor Details

    • Options

      public Options()
      Build a new empty Options instance 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 empty Options instance that binds to a component
  • Method Details

    • setOwner

      public void setOwner(org.apache.wicket.Component owner)
    • containsKey

      public boolean containsKey(Object key)

      Returns if the given option is defined or not.

      Parameters:
      key - the option name.
    • get

      public String get(String key)

      Returns the given option value as a String.

      Parameters:
      key - the option name.
    • getBoolean

      public Boolean getBoolean(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getJsScope

      public JsScope getJsScope(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getComplexOption

      public IComplexOption getComplexOption(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
      Returns:
      the complex option
    • getDouble

      public Double getDouble(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getFloat

      public Float getFloat(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getInt

      public Integer getInt(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getJavaScriptOptions

      public CharSequence getJavaScriptOptions()
      Returns the JavaScript statement corresponding to options.
    • getCollectionItemOptions

      public ICollectionItemOptions getCollectionItemOptions(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
      Returns:
      the list
    • getLiteral

      public String getLiteral(String key)

      Returns the given option value.

      Parameters:
      key - the option name.
    • getShort

      public Short getShort(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(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(String key, org.apache.wicket.model.IModel<Boolean> value)

      Put an boolean value for the given option name.

      Parameters:
      key - the option name.
      value - the boolean value.
    • put

      public Options put(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(String key, org.apache.wicket.model.IModel<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(String key, float value)

      Puts an float value for the given option name.

      Parameters:
      key - the option name
      value - The float value
    • putFloat

      public Options putFloat(String key, org.apache.wicket.model.IModel<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(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(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(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(String key, org.apache.wicket.model.IModel<Integer> value)

      Puts an int value for the given option name.

      Parameters:
      key - the option name.
      value - the int value.
    • put

      public Options put(String key, JsScope value)

      Puts a JsScope value for the given option name.

      Parameters:
      key - the option name.
      value - the JsScope value.
    • put

      public Options put(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(String key, org.apache.wicket.model.IModel<Short> value)

      Puts an short value for the given option name.

      Parameters:
      key - the option name.
      value - the short value.
    • put

      public Options put(String key, String value)

      Puts a String value for the given option name.

      Parameters:
      key - the option name.
      value - the String value.
    • putString

      public Options putString(String key, org.apache.wicket.model.IModel<String> value)

      Puts a String value for the given option name.

      Parameters:
      key - the option name.
      value - the String value.
    • put

      public Options put(String key, long value)

      Puts a Long value for the given option name.

      Parameters:
      key - the option name.
      value - the Long value.
    • putLong

      public Options putLong(String key, org.apache.wicket.model.IModel<Long> value)

      Puts a Long value for the given option name.

      Parameters:
      key - the option name.
      value - the Long value.
    • putLiteral

      public Options putLiteral(String key, 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'

      Parameters:
      key - the option name.
      value - the LiteralOption value.
    • putLiteral

      public Options putLiteral(String key, org.apache.wicket.model.IModel<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'

      Parameters:
      key - the option name.
      value - the LiteralOption value.
    • removeOption

      public void removeOption(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:
      getObject in interface org.apache.wicket.model.IModel<Options>
    • setObject

      public void setObject(Options object)
      Specified by:
      setObject in interface org.apache.wicket.model.IModel<Options>
    • detach

      public void detach()
      Specified by:
      detach in interface org.apache.wicket.model.IDetachable
      Specified by:
      detach in interface org.apache.wicket.model.IModel<Options>