Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jcorporate.expresso.core.controller
Class Input  view Input download Input.java

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.ControllerElement
      extended bycom.jcorporate.expresso.core.controller.Input
All Implemented Interfaces:
com.jcorporate.expresso.core.cache.Cacheable, java.lang.Cloneable, java.io.Serializable

public class Input
extends ControllerElement
implements java.lang.Cloneable, com.jcorporate.expresso.core.cache.Cacheable

An Input object is one of the three types of objects generated by a Controller when it transitions from one state to another. The other two are Actions and Outputs.
An Input is a request for information from the user. It may or may not have a default value, a list of valid values, and other attributes - any or all of which can be used by the user interface, which can be a JSP, Servlet, application, or even an applet.

Recognized Types:

The following types are recognized by the expresso framework and automatically rendered: You may add your own types or ignore them if you are doing your own page rendering.

checkbox: Renders as a checkbox. If multivalued=true then will render the options as a list of checkboxes.

radio: If multivalued, will render all options as a list of radio buttons

checkbox-vertical: Only relevent for multivalues, renders the checkbox style as vertical


Field Summary
static java.lang.String ATTRIBUTE_CHECKBOX
          The Input is intended to be rendered as a check box
static java.lang.String ATTRIBUTE_CHECKBOX_VERTICAL
          The Input is intended to be rendered as a vertically aligned checkbox
static java.lang.String ATTRIBUTE_CSS_STYLE
          Defines the CSS style to use when rendering the input.
static java.lang.String ATTRIBUTE_DROPDOWN
          The Input is intended to be rendered as a drop down box
static java.lang.String ATTRIBUTE_FILE
          The Input is indended to be a file upload box.
static java.lang.String ATTRIBUTE_HIDDEN
          The Input is intended to be rendered as a Hidden Field
static java.lang.String ATTRIBUTE_LISTBOX
          The Input is intended to be rendered as a List Box
static java.lang.String ATTRIBUTE_MULTIVALUED
          Means that the Input will be some sort of multi-valued field and has valid values associated with it.
static java.lang.String ATTRIBUTE_ORIGINAL_VALUE
          Attribute that contains the original value of this input.
static java.lang.String ATTRIBUTE_PASSWORD
          Attribute for password boxes.
static java.lang.String ATTRIBUTE_RADIO
          The Input is intended to be rendered as a Radio Button
static java.lang.String ATTRIBUTE_RADIO_VERTICAL
          The Input is intended to be rendered as a Vertically Aligned Radio Button
static java.lang.String ATTRIBUTE_READONLY
          The Input is intended to be read only.
static java.lang.String ATTRIBUTE_TEXTAREA
          The Input is intended to be rendered as a Text Area
static java.lang.String ATTRIBUTE_TEXTLINE
          text input, single line (as opposed to text area)
static java.lang.String ATTRIBUTE_TYPE
          Attribute defines the HTML Type that will be used with the Input
private  java.util.ArrayList defaultValue
          Default value(s) for the item (optional)
private  java.lang.String key
          Key used when this input is used as a Cacheable object
private  java.lang.String lookup
          Object name that can be used to look up valid values for this item
private  int maxLength
          Max length of the input field
private  java.lang.String multiple
          Multiple select true or false
static java.lang.String SELECTED
          constant for JSTL attribute for 'selectness' of a given input
private  java.util.Vector validValues
          Vector of value/description pairs that are valid for this item
 
Fields inherited from class com.jcorporate.expresso.core.controller.ControllerElement
 
Constructor Summary
Input()
          Default constructor
Input(java.lang.String newName)
          Convenience constructor - to make a new Input object with a specific name
Input(java.lang.String newName, java.lang.String newLabel)
          Constructor that sets the name and the label of the input
 
Method Summary
 void addDefaultValue(java.lang.String newValue)
          supply another default value for this Input object; appropriate for multiple selection items
 void addValidValue(java.lang.String value, java.lang.String descrip)
          Add a valid value to the Input's dropdown
 java.lang.Object clone()
          Clones the input as per standard java.lang.Object specifications
static ControllerElement fromXML(org.w3c.dom.Node n)
          Return a controller element based upon the xml fragment [Factory Method]
 java.lang.String getContent()
          (Convenience for JSTL access, to be parallel with Output) Return a single default value supplied by the Controller for this Input object; returns the 0th item in list (we expect this function to be used only for single selection items)
 java.lang.String getDefaultValue()
          Return a single default value supplied by the Controller for this Input object; returns the 0th item in list (we expect this function to be used only for single selection items)
 java.util.ArrayList getDefaultValueList()
          Return a list of default values supplied by the Controller for this Input object; appropriate for multiple selection items
 java.lang.String getKey()
          Retrieve the key for the input.
 java.lang.String getLookup()
          Returns the class name of a database object that can be used to look up valid values for this Input item, if there is one.
 int getMaxLength()
          Return the maximum recommended length of the value for this Input object.
 java.lang.String getMultiple()
          Retrieve the multi select status.
 java.lang.String getSelectedDisplay()
          get the display string associated with the currently-selected (default).
 java.util.Vector getValidValues()
          Return the list of Valid Values that are allowed for this Input item.
 void setDefaultValue(ControllerResponse response)
          Convenience method to quickly set the default value from the form cache.
 void setDefaultValue(java.util.List list)
          supply a list of default values for this Input object; appropriate for multiple selection items
 void setDefaultValue(java.lang.String newValue)
          supply a default value for this Input object; appropriate for single selection items; sets the 0th item in underlying list
 void setKey(java.lang.String newKey)
          The Key of the Input
 void setLookup(java.lang.String s)
          Set the name of the "lookup object" - the database object that the client can use to look up valid values for this Input item.
 void setMaxLength(int newMaxLength)
          Set the maximum recommended length of the Input object
 void setMultiple(java.lang.String newMultiple)
          Set the the Input object allow multiple selections
 void setName(java.lang.String newName)
          Sets the inputs name.
 void setType(java.lang.String newType)
          Sets the input type
 void setValidValues(java.util.Vector v)
          Method for the Controller to specify the valid values for this Input item
 com.jcorporate.expresso.kernel.util.FastStringBuffer toXML(com.jcorporate.expresso.kernel.util.FastStringBuffer stream)
          Concert the object to an xml fragment.
 
Methods inherited from class com.jcorporate.expresso.core.controller.ControllerElement
addNested, allNested, fromXML, getAttribute, getAttributes, getAttributesOrNull, getContent, getContents, getControllerResponse, getDescription, getDisplayLength, getLabel, getLines, getName, getNested, getNested, getNestedCount, getNestedIterator, getNestedMap, getNestedOrNull, getParent, getTitle, getType, remove, removeNested, setAttribute, setControllerResponse, setDescription, setDisplayLength, setLabel, setLines, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTED

public static final java.lang.String SELECTED
constant for JSTL attribute for 'selectness' of a given input

See Also:
Constant Field Values

defaultValue

private java.util.ArrayList defaultValue
Default value(s) for the item (optional)


validValues

private java.util.Vector validValues
Vector of value/description pairs that are valid for this item


lookup

private java.lang.String lookup
Object name that can be used to look up valid values for this item


maxLength

private int maxLength
Max length of the input field


multiple

private java.lang.String multiple
Multiple select true or false


key

private java.lang.String key
Key used when this input is used as a Cacheable object


ATTRIBUTE_LISTBOX

public static final java.lang.String ATTRIBUTE_LISTBOX
The Input is intended to be rendered as a List Box

See Also:
Constant Field Values

ATTRIBUTE_DROPDOWN

public static final java.lang.String ATTRIBUTE_DROPDOWN
The Input is intended to be rendered as a drop down box

See Also:
Constant Field Values

ATTRIBUTE_CHECKBOX

public static final java.lang.String ATTRIBUTE_CHECKBOX
The Input is intended to be rendered as a check box

See Also:
Constant Field Values

ATTRIBUTE_CHECKBOX_VERTICAL

public static final java.lang.String ATTRIBUTE_CHECKBOX_VERTICAL
The Input is intended to be rendered as a vertically aligned checkbox

See Also:
Constant Field Values

ATTRIBUTE_RADIO

public static final java.lang.String ATTRIBUTE_RADIO
The Input is intended to be rendered as a Radio Button

See Also:
Constant Field Values

ATTRIBUTE_RADIO_VERTICAL

public static final java.lang.String ATTRIBUTE_RADIO_VERTICAL
The Input is intended to be rendered as a Vertically Aligned Radio Button

See Also:
Constant Field Values

ATTRIBUTE_TEXTAREA

public static final java.lang.String ATTRIBUTE_TEXTAREA
The Input is intended to be rendered as a Text Area

See Also:
Constant Field Values

ATTRIBUTE_HIDDEN

public static final java.lang.String ATTRIBUTE_HIDDEN
The Input is intended to be rendered as a Hidden Field

See Also:
Constant Field Values

ATTRIBUTE_READONLY

public static final java.lang.String ATTRIBUTE_READONLY
The Input is intended to be read only.

See Also:
Constant Field Values

ATTRIBUTE_FILE

public static final java.lang.String ATTRIBUTE_FILE
The Input is indended to be a file upload box.

See Also:
Constant Field Values

ATTRIBUTE_PASSWORD

public static final java.lang.String ATTRIBUTE_PASSWORD
Attribute for password boxes.

See Also:
Constant Field Values

ATTRIBUTE_ORIGINAL_VALUE

public static final java.lang.String ATTRIBUTE_ORIGINAL_VALUE
Attribute that contains the original value of this input. Usually set for read only inputs.

See Also:
Constant Field Values

ATTRIBUTE_CSS_STYLE

public static final java.lang.String ATTRIBUTE_CSS_STYLE
Defines the CSS style to use when rendering the input.

See Also:
Constant Field Values

ATTRIBUTE_MULTIVALUED

public static final java.lang.String ATTRIBUTE_MULTIVALUED
Means that the Input will be some sort of multi-valued field and has valid values associated with it.

See Also:
Constant Field Values

ATTRIBUTE_TEXTLINE

public static final java.lang.String ATTRIBUTE_TEXTLINE
text input, single line (as opposed to text area)

See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final java.lang.String ATTRIBUTE_TYPE
Attribute defines the HTML Type that will be used with the Input

See Also:
Constant Field Values
Constructor Detail

Input

public Input()
Default constructor


Input

public Input(java.lang.String newName)
Convenience constructor - to make a new Input object with a specific name


Input

public Input(java.lang.String newName,
             java.lang.String newLabel)
Constructor that sets the name and the label of the input

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the input as per standard java.lang.Object specifications

Overrides:
clone in class ControllerElement

getDefaultValue

public java.lang.String getDefaultValue()
Return a single default value supplied by the Controller for this Input object; returns the 0th item in list (we expect this function to be used only for single selection items)


getContent

public java.lang.String getContent()
(Convenience for JSTL access, to be parallel with Output) Return a single default value supplied by the Controller for this Input object; returns the 0th item in list (we expect this function to be used only for single selection items)


getDefaultValueList

public java.util.ArrayList getDefaultValueList()
Return a list of default values supplied by the Controller for this Input object; appropriate for multiple selection items


getLookup

public java.lang.String getLookup()
Returns the class name of a database object that can be used to look up valid values for this Input item, if there is one.


getMaxLength

public int getMaxLength()
Return the maximum recommended length of the value for this Input object.


toXML

public com.jcorporate.expresso.kernel.util.FastStringBuffer toXML(com.jcorporate.expresso.kernel.util.FastStringBuffer stream)
Concert the object to an xml fragment.

Overrides:
toXML in class ControllerElement

fromXML

public static ControllerElement fromXML(org.w3c.dom.Node n)
                                 throws ControllerException
Return a controller element based upon the xml fragment [Factory Method]


getValidValues

public java.util.Vector getValidValues()
Return the list of Valid Values that are allowed for this Input item.


setDefaultValue

public void setDefaultValue(java.lang.String newValue)
supply a default value for this Input object; appropriate for single selection items; sets the 0th item in underlying list


setDefaultValue

public void setDefaultValue(java.util.List list)
supply a list of default values for this Input object; appropriate for multiple selection items


addDefaultValue

public void addDefaultValue(java.lang.String newValue)
supply another default value for this Input object; appropriate for multiple selection items


setDefaultValue

public void setDefaultValue(ControllerResponse response)
                     throws ControllerException
Convenience method to quickly set the default value from the form cache.


setLookup

public void setLookup(java.lang.String s)
Set the name of the "lookup object" - the database object that the client can use to look up valid values for this Input item.


setMaxLength

public void setMaxLength(int newMaxLength)
Set the maximum recommended length of the Input object


setName

public void setName(java.lang.String newName)
Sets the inputs name. Also checks against reserved words

Overrides:
setName in class ControllerElement

addValidValue

public void addValidValue(java.lang.String value,
                          java.lang.String descrip)
Add a valid value to the Input's dropdown


setType

public void setType(java.lang.String newType)
Sets the input type

Overrides:
setType in class ControllerElement

setValidValues

public void setValidValues(java.util.Vector v)
Method for the Controller to specify the valid values for this Input item


setKey

public void setKey(java.lang.String newKey)
The Key of the Input


getKey

public java.lang.String getKey()
Retrieve the key for the input.

Specified by:
getKey in interface com.jcorporate.expresso.core.cache.Cacheable

setMultiple

public void setMultiple(java.lang.String newMultiple)
Set the the Input object allow multiple selections


getMultiple

public java.lang.String getMultiple()
Retrieve the multi select status.


getSelectedDisplay

public java.lang.String getSelectedDisplay()
get the display string associated with the currently-selected (default). useful for a JSTL reuse of Input for output purposes, when the default value is an ID, while its partner ValidValue pairing is the display string.