jet.html.impl
Class JetSelection

java.lang.Object
  extended by jet.html.core.JetComponent
      extended by jet.html.core.JetChildComponent
          extended by jet.html.impl.JetSelection
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Decodeable, JetChildComponent, JetComponent, JetInputComponent, JetSelection, Identifiable, Resetable, ValidationComponent

public class JetSelection
extends JetChildComponent
implements JetSelection

This class renders a selection box

Author:
Markus.Meisters@web.de
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface jet.html.JetChildComponent
JetChildComponent.HasNoParent
 
Field Summary
private  java.util.List<JetOption> defaultOptions
          holds the available default not resetable options
private  java.util.List<HTMLElementEvent> events
          events
private  boolean multiple
          indicates if the selection is multiple
private  java.util.List<JetOption> options
          holds the available options
private  java.lang.String sevents
          Holds the events already in rendered state
private  java.util.List<ValidationRule> validations
          validation rules
private  java.lang.String[] values
          holds the values
 
Fields inherited from class jet.html.core.JetComponent
eventSupport
 
Constructor Summary
JetSelection(java.lang.String identifier)
          Creates new Component - name and styleclass would be the same as identifier
JetSelection(java.lang.String identifier, java.lang.String styleclass)
          Creates new Component
JetSelection(java.lang.String identifier, java.lang.String name, java.lang.String styleclass)
          Creates new Component
 
Method Summary
 void addDefaultOption(JetOption option)
          adds a default option
 void addEvent(HTMLElementEvent event)
          Method to add event
 void addOption(JetOption option)
          adds a option
 void addValidationRule(ValidationRule rule)
          Method to add validation rules
 java.lang.Object clone()
          This method retruns a clone from the component
 void decodeForm(java.lang.StringBuilder builder, JetContext jetContext)
          This method decodes the form to the given buffer
 java.lang.String decodeGetString(JetContext jetContext)
          decodes the component to URL-STRING
 void encode(java.util.Map requestParameters)
          Encodes the needed parameteters
 java.util.List<JetOption> getDefaultOptions()
          Returns the default options
 java.lang.String getDisplayValue(java.lang.String encoding)
           
 java.util.List getEvents()
          Method to get events
 java.lang.String getFormDisplayValue()
           
protected  java.lang.String getGetDisplayValue(JetContext jetContext)
          Returns the value encoded for GET String
 boolean getMultiple()
          Returns if the selection is multiple selectable
 java.util.List<JetOption> getOptions()
          Returns a list of available the options
 java.util.List getValidationRules()
          Returns only a cloned list - not the real one
 java.lang.String getValue()
          Returns the first value!
 java.lang.String[] getValues()
          Returns a cloned arraycontaining all values selected
 boolean hasEvent(HTMLElementEvent event)
          Method to indicate if aspecial event exist
 boolean hasEvents()
          Method to indicate if events exists
 boolean hasValidationRules()
          Method to indicate if validation exists
 boolean hasValue()
           
 void reset()
          This method resets the object for reuse
 void setDefaultOptions(java.util.List<JetOption> defaultOptions)
          Set the default options which can be selected
 void setHidden(boolean hidden)
           
 void setMultiple(java.lang.String multiple)
          Set if the option supports multiple selections
 void setOptions(java.util.List<JetOption> options)
          Set the options which can be selected
 void setValue(java.lang.String value)
          Set the first value
 void setValues(java.lang.String[] values)
          Set the values selected
 
Methods inherited from class jet.html.core.JetChildComponent
getForm, getParent, isHidden, setParent, toggleHidden
 
Methods inherited from class jet.html.core.JetComponent
addListener, addListener, componentChanged, findComponent, findComponents, getGeneratedComponentIdentifier, getIdentifier, getName, getNewIdentifier, getStyleclass, incrementIdentifier, removeListener, removeListener, setComponentChanged, setContinueIdentifier, setIdentifier, setName, setStyleclass
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jet.html.JetChildComponent
getForm, getParent, isHidden, setParent, toggleHidden
 
Methods inherited from interface jet.html.JetComponent
addListener, addListener, componentChanged, findComponent, findComponents, getIdentifier, getName, getStyleclass, incrementIdentifier, removeListener, removeListener, setComponentChanged, setContinueIdentifier, setIdentifier, setName, setStyleclass
 
Methods inherited from interface jet.pool.Identifiable
getIdentifier
 

Field Detail

validations

private java.util.List<ValidationRule> validations
validation rules


events

private java.util.List<HTMLElementEvent> events
events


sevents

private java.lang.String sevents
Holds the events already in rendered state


values

private java.lang.String[] values
holds the values


multiple

private boolean multiple
indicates if the selection is multiple


options

private java.util.List<JetOption> options
holds the available options


defaultOptions

private java.util.List<JetOption> defaultOptions
holds the available default not resetable options

Constructor Detail

JetSelection

public JetSelection(java.lang.String identifier)
Creates new Component - name and styleclass would be the same as identifier

Parameters:
identifier - the identifier

JetSelection

public JetSelection(java.lang.String identifier,
                    java.lang.String styleclass)
Creates new Component

Parameters:
identifier - the identifier
styleclass - the css style class

JetSelection

public JetSelection(java.lang.String identifier,
                    java.lang.String name,
                    java.lang.String styleclass)
Creates new Component

Parameters:
identifier - the identifier
name - the name of the component if different to identifier
styleclass - the css style class
Method Detail

encode

public void encode(java.util.Map requestParameters)
Encodes the needed parameteters

Specified by:
encode in interface JetInputComponent
Specified by:
encode in interface JetSelection
Parameters:
requestParameters - request parameters

decodeGetString

public java.lang.String decodeGetString(JetContext jetContext)
                                 throws java.io.UnsupportedEncodingException
decodes the component to URL-STRING

Specified by:
decodeGetString in interface JetInputComponent
Specified by:
decodeGetString in interface JetSelection
Throws:
java.io.UnsupportedEncodingException

decodeForm

public void decodeForm(java.lang.StringBuilder builder,
                       JetContext jetContext)
This method decodes the form to the given buffer

Specified by:
decodeForm in interface Decodeable
Specified by:
decodeForm in interface JetComponent
Specified by:
decodeForm in interface JetSelection
Specified by:
decodeForm in class JetComponent
Parameters:
builder - builder to use

getValue

public java.lang.String getValue()
Returns the first value! ther ecould be more!

Specified by:
getValue in interface JetInputComponent
Specified by:
getValue in interface JetSelection
Returns:
the first value

getGetDisplayValue

protected java.lang.String getGetDisplayValue(JetContext jetContext)
                                       throws java.io.UnsupportedEncodingException
Returns the value encoded for GET String

Throws:
java.io.UnsupportedEncodingException

getValues

public java.lang.String[] getValues()
Returns a cloned arraycontaining all values selected

Specified by:
getValues in interface JetSelection
Returns:
String[] the values

setValue

public void setValue(java.lang.String value)
Set the first value

Specified by:
setValue in interface JetInputComponent
Specified by:
setValue in interface JetSelection
Parameters:
value - the value

setValues

public void setValues(java.lang.String[] values)
Set the values selected

Specified by:
setValues in interface JetSelection
Parameters:
values - the values selected

reset

public void reset()
This method resets the object for reuse

Specified by:
reset in interface JetInputComponent
Specified by:
reset in interface JetSelection
Specified by:
reset in interface Resetable

clone

public java.lang.Object clone()
This method retruns a clone from the component

Specified by:
clone in interface JetComponent
Specified by:
clone in interface JetSelection
Specified by:
clone in class JetComponent
Returns:
the cloned object

getOptions

public java.util.List<JetOption> getOptions()
Returns a list of available the options

Specified by:
getOptions in interface JetSelection
Returns:
List the options of this selection

setOptions

public void setOptions(java.util.List<JetOption> options)
Set the options which can be selected

Specified by:
setOptions in interface JetSelection

getDefaultOptions

public java.util.List<JetOption> getDefaultOptions()
Returns the default options

Specified by:
getDefaultOptions in interface JetSelection
Returns:
List the options of this selection

setDefaultOptions

public void setDefaultOptions(java.util.List<JetOption> defaultOptions)
Set the default options which can be selected

Specified by:
setDefaultOptions in interface JetSelection

addOption

public void addOption(JetOption option)
adds a option

Specified by:
addOption in interface JetSelection
Parameters:
option - to add

addDefaultOption

public void addDefaultOption(JetOption option)
adds a default option

Specified by:
addDefaultOption in interface JetSelection
Parameters:
option - to add

getMultiple

public boolean getMultiple()
Returns if the selection is multiple selectable

Specified by:
getMultiple in interface JetSelection

setMultiple

public void setMultiple(java.lang.String multiple)
Set if the option supports multiple selections

Specified by:
setMultiple in interface JetSelection

addValidationRule

public void addValidationRule(ValidationRule rule)
Description copied from interface: ValidationComponent
Method to add validation rules

Specified by:
addValidationRule in interface JetSelection
Specified by:
addValidationRule in interface ValidationComponent
Parameters:
rule - ValidationRule
See Also:
ValidationComponent.addValidationRule( ValidationRule )

hasValidationRules

public boolean hasValidationRules()
Description copied from interface: ValidationComponent
Method to indicate if validation exists

Specified by:
hasValidationRules in interface JetSelection
Specified by:
hasValidationRules in interface ValidationComponent
See Also:
ValidationComponent.hasValidationRules( )

getValidationRules

public java.util.List getValidationRules()
Returns only a cloned list - not the real one

Specified by:
getValidationRules in interface JetSelection
Specified by:
getValidationRules in interface ValidationComponent
Returns:
List ValidationRules
See Also:
ValidationComponent.getValidationRules( )

addEvent

public void addEvent(HTMLElementEvent event)
Description copied from interface: JetInputComponent
Method to add event

Specified by:
addEvent in interface JetInputComponent
Specified by:
addEvent in interface JetSelection
Parameters:
event - event
See Also:
JetInputComponent.addEvent( jet.html.core.HTMLElementEvent )

hasEvents

public boolean hasEvents()
Description copied from interface: JetInputComponent
Method to indicate if events exists

Specified by:
hasEvents in interface JetInputComponent
Specified by:
hasEvents in interface JetSelection
See Also:
JetInputComponent.hasEvents()

hasEvent

public boolean hasEvent(HTMLElementEvent event)
Description copied from interface: JetInputComponent
Method to indicate if aspecial event exist

Specified by:
hasEvent in interface JetInputComponent
Specified by:
hasEvent in interface JetSelection
See Also:
JetInputComponent.hasEvent( jet.html.core.HTMLElementEvent )

getEvents

public java.util.List getEvents()
Description copied from interface: JetInputComponent
Method to get events

Specified by:
getEvents in interface JetInputComponent
Specified by:
getEvents in interface JetSelection
Returns:
List HTMLElementEvent
See Also:
JetInputComponent.getEvents()

hasValue

public boolean hasValue()
Specified by:
hasValue in interface JetInputComponent
Specified by:
hasValue in interface JetSelection
See Also:
JetInputComponent.hasValue()

getFormDisplayValue

public java.lang.String getFormDisplayValue()
Specified by:
getFormDisplayValue in interface JetInputComponent

getDisplayValue

public java.lang.String getDisplayValue(java.lang.String encoding)
                                 throws java.io.UnsupportedEncodingException
Specified by:
getDisplayValue in interface JetInputComponent
Throws:
java.io.UnsupportedEncodingException

setHidden

public void setHidden(boolean hidden)
Specified by:
setHidden in interface JetInputComponent