water.api
Class RequestArguments.InputCheckBox

java.lang.Object
  extended by water.Iced
      extended by water.api.RequestArguments.Argument<java.lang.Boolean>
          extended by water.api.RequestArguments.InputCheckBox
All Implemented Interfaces:
java.lang.Cloneable, Request.Filter, Freezable
Direct Known Subclasses:
RequestArguments.Bool
Enclosing class:
RequestArguments

public abstract class RequestArguments.InputCheckBox
extends RequestArguments.Argument<java.lang.Boolean>

A boolean argument that is represented as the checkbox. The only allowed values for a boolean checkbox are "0" for false, "1" for true. If the argument is not required, then default value will be used. Please note that due to the nature of a checkbox, the html query will always specify this argument to its default value, or to false if the user did not specify it explicitly.


Field Summary
 java.lang.Boolean _defaultValue
          Default value.
 
Fields inherited from class water.api.RequestArguments.Argument
_displayName, _field, _hideInQuery, _name, _prerequisites, _readOnly, _requestHelp, _required
 
Constructor Summary
RequestArguments.InputCheckBox(java.lang.String name)
          Creates the argument as required one.
RequestArguments.InputCheckBox(java.lang.String name, boolean defaultValue)
          Creates the argument with specified default value.
 
Method Summary
protected  java.lang.Boolean defaultValue()
          Returns the default value.
protected  java.lang.String jsRefresh(java.lang.String callbackName)
          Refresh only taps to jQuery change event.
protected  java.lang.String jsValue()
          Returns 1 if the checkbox is checked and 0 otherwise.
 java.lang.Boolean parse(java.lang.String input)
          Parses the value.
protected  java.lang.String queryElement()
          Displays the query element.
 
Methods inherited from class water.api.RequestArguments.Argument
addPrerequisite, check, disable, disable, disabled, errors, jsAddons, originalValue, query, queryAddons, queryComment, queryDescription, record, refreshOnChange, requestHelp, reset, run, setRefreshOnChange, specified, valid, value
 
Methods inherited from class water.Iced
clone, frozenType, init, newInstance, read, toDocField, write, writeJSON, writeJSONFields
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_defaultValue

public final transient java.lang.Boolean _defaultValue
Default value.

Constructor Detail

RequestArguments.InputCheckBox

public RequestArguments.InputCheckBox(java.lang.String name,
                                      boolean defaultValue)
Creates the argument with specified default value.


RequestArguments.InputCheckBox

public RequestArguments.InputCheckBox(java.lang.String name)
Creates the argument as required one. This has only effect on JSON, for HTML it means the default value is false effectively.

Method Detail

parse

public java.lang.Boolean parse(java.lang.String input)
Parses the value. 1 to true and 0 to false. Anything else is an error.

Specified by:
parse in class RequestArguments.Argument<java.lang.Boolean>

queryElement

protected java.lang.String queryElement()
Displays the query element. This is just the checkbox followed by the description.

Specified by:
queryElement in class RequestArguments.Argument<java.lang.Boolean>

jsRefresh

protected java.lang.String jsRefresh(java.lang.String callbackName)
Refresh only taps to jQuery change event.

Specified by:
jsRefresh in class RequestArguments.Argument<java.lang.Boolean>

jsValue

protected java.lang.String jsValue()
Returns 1 if the checkbox is checked and 0 otherwise.

Specified by:
jsValue in class RequestArguments.Argument<java.lang.Boolean>

defaultValue

protected java.lang.Boolean defaultValue()
Returns the default value.

Specified by:
defaultValue in class RequestArguments.Argument<java.lang.Boolean>