Class 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 a IOptionsRenderer.

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

      Constructors 
      Constructor 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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, int value)
      Puts an int 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 put​(java.lang.String key, JsScope value)
      Puts a JsScope 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 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, java.lang.String value)
      Puts a String value as a JavaScript literal for the given 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 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.wicket.model.IModel

        combineWith, filter, flatMap, isPresent, map, orElse, orElseGet
    • Constructor Detail

      • 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 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 name
        value - 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 JsScope value for the given option name.

        Parameters:
        key - the option name.
        value - the JsScope value.
      • 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 String value for the given option name.

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

        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.

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

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

        Puts a Long value for the given option name.

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

        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'

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

        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'

        Parameters:
        key - the option name.
        value - the LiteralOption value.
      • 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:
        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>