com.groiss.gui.component
Class SelectList

java.lang.Object
  extended by com.groiss.gui.AbstractComponent
      extended by com.groiss.gui.component.SelectList
All Implemented Interfaces:
Component, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DropdownList

public class SelectList
extends AbstractComponent

A HTML select list with size >1.

See Also:
Serialized Form

Field Summary
static java.lang.String MULTIPLE
           
static java.lang.String OPTION
           
static java.lang.String SELECT
           
static java.lang.String SELECTED
           
static java.lang.String SELECTLIST
           
static java.lang.String SIZE
           
static java.lang.String VALUE
           
 
Fields inherited from class com.groiss.gui.AbstractComponent
actions, ACTIVE, browserMode, DEFAULT, ID, IE, INVISIBLE, isSensitive, label, NS, ON_BLUR, ON_CHANGE, ON_CLICK, ON_DBLCLICK, ON_FOCUS, ON_KEY_DOWN, ON_KEY_PRESS, ON_KEY_UP, ON_LOAD, ON_MOUSE_DOWN, ON_MOUSE_MOVE, ON_MOUSE_OUT, ON_MOUSE_UP, ON_RESET, ON_SELECT, ON_SUBMIT, ON_UNLOAD, outputter, parent, parentElem, READONLY, root, viewMode
 
Constructor Summary
SelectList()
          Constructs a new empty dropdown list component.
SelectList(java.lang.String name, java.util.Collection list, int size)
          Constructor with name and content list.
SelectList(java.lang.String name, java.util.Collection list, int size, boolean showNull)
          Constructor with name and content list.
SelectList(java.lang.String name, java.util.Collection list, int size, boolean showNull, java.lang.String selected)
          Constructor with name and content list.
SelectList(java.lang.String name, java.util.Collection list, int size, boolean showNull, java.lang.String selected, java.lang.String styleClass)
          Constructor with name and content list.
SelectList(java.lang.String name, int size)
          Constructor with name.
 
Method Summary
 void addOption(org.jdom.Element option)
          adds a new option at the end to the dropdownlist
 void addOption(int i, org.jdom.Element option)
          adds a new option at the passed position within the dropdownlist
 void addOption(int i, java.lang.String value, java.lang.String text)
           
 void addOption(KeyValuePair p)
          Adds a new option at the end to the dropdownlist
 void addOption(java.lang.String value, java.lang.String text)
          adds a new option at the end to the dropdownlist
 void addOption(java.lang.String value, java.lang.String text, org.jdom.Element rt)
           
 void addOptions(java.util.Collection<? extends KeyValuePair<java.lang.String,java.lang.String>> options)
          Adds all options at the end of the dropdownlist
 void clear()
          removes all options from this selectlist
 void deleteOption(int index)
          Removes the specified option, if it can be identified, from the dropdownlist.
 void deleteOption(java.lang.String value)
          Removes the specified option, if it can be identified, from the dropdownlist.
 void deleteOption(java.lang.String value, java.lang.String text)
          Deprecated. use method with one argument
 java.lang.Object getContent()
          Get the list of options.
 org.jdom.Element getOption(int index)
           
 int getOptionIndex(java.lang.String value, java.lang.String text)
          returns the index of the specified option (identified by value-text-pair
 java.lang.String getOptionText(int index)
          Returns the displayed text of the specified option.
 java.util.List<java.lang.String> getOptionTexts()
          Returns a vector with the displayed text of every option.
 java.lang.String getOptionValue(int index)
          Returns the value of the specified option.
 java.util.List<java.lang.String> getOptionValues()
          Returns a vector with the value of every options.
 int getSelectedOption()
          Returns the index of the selected option.
 int[] getSelections()
          returns a array of all selected options
 int getSize()
          returns the number of nested options in the dropdownlist - the size
 boolean isSelected(int index)
          Returns whether the specified option has the attribute SELECTED, or not
 void removeSelection()
          Removes the attribute SELECTED from the selected option.
 void removeSelections()
          removes the attribute SELECTED from the selected options
 void setContent(java.lang.Object o)
          Sets the list of options.
 void setContent(java.lang.Object o, boolean showNull)
          Sets the list of options.
 void setContent(java.lang.Object o, KeyValuePair val)
          Sets the list of options.
 void setDisplayedSize(int size)
          sets the displayed list size
 void setMultiple(boolean yesno)
           
 void setSelectedOption(int index)
          Adds the attribute SELECTED to the specified option.
 void setSelectedOption(java.lang.String value)
          Adds the attribute SELECTED to the specified option.
 void setSelectedOptions(java.util.List vals)
           
 java.lang.String showOptions()
          Show the options text.
 
Methods inherited from class com.groiss.gui.AbstractComponent
clone, create, getActionListener, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getRootName, getStyle, getViewMode, init, init, init, removeAttribute, setActionListener, setAttribute, setBrowserMode, setEncoding, setExpandEmptyElements, setId, setIndenting, setLabel, setName, setNewLines, setParent, setParentElement, setRootName, setStyle, setViewMode, show, show, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPTION

public static final java.lang.String OPTION
See Also:
Constant Field Values

VALUE

public static final java.lang.String VALUE
See Also:
Constant Field Values

SELECT

public static final java.lang.String SELECT
See Also:
Constant Field Values

SIZE

public static final java.lang.String SIZE
See Also:
Constant Field Values

MULTIPLE

public static final java.lang.String MULTIPLE
See Also:
Constant Field Values

SELECTED

public static final java.lang.String SELECTED
See Also:
Constant Field Values

SELECTLIST

public static final java.lang.String SELECTLIST
See Also:
Constant Field Values
Constructor Detail

SelectList

public SelectList()
Constructs a new empty dropdown list component.


SelectList

public SelectList(java.lang.String name,
                  int size)
Constructor with name.

Parameters:
name - the name of the form element

SelectList

public SelectList(java.lang.String name,
                  java.util.Collection list,
                  int size)
Constructor with name and content list.

Parameters:
name - the name of the form element
list - the content list
size - the number of visible lines

SelectList

public SelectList(java.lang.String name,
                  java.util.Collection list,
                  int size,
                  boolean showNull)
Constructor with name and content list.

Parameters:
name - the name of the form element
list - the content list
size - the number of visible lines
showNull - if true, add the option with value and display string empty to the begin of the list

SelectList

public SelectList(java.lang.String name,
                  java.util.Collection list,
                  int size,
                  boolean showNull,
                  java.lang.String selected)
Constructor with name and content list.

Parameters:
name - the name of the form element
list - the content list
size - the number of visible lines
showNull - if true, add the option with value and display string empty to the begin of the list
selected - the option where the value equals this argument is selected

SelectList

public SelectList(java.lang.String name,
                  java.util.Collection list,
                  int size,
                  boolean showNull,
                  java.lang.String selected,
                  java.lang.String styleClass)
Constructor with name and content list.

Parameters:
name - the name of the form element
list - the content list
size - the number of visible lines
showNull - if true, add the option with value and display string empty to the begin of the list
selected - the option where the value equals this argument is selected
styleClass - the name of a CSS class
Method Detail

setMultiple

public void setMultiple(boolean yesno)

addOption

public void addOption(java.lang.String value,
                      java.lang.String text)
adds a new option at the end to the dropdownlist

Parameters:
value - the value of the new option
text - the displayed text of the new option

addOption

public void addOption(java.lang.String value,
                      java.lang.String text,
                      org.jdom.Element rt)

addOption

public void addOption(int i,
                      java.lang.String value,
                      java.lang.String text)

addOption

public void addOption(org.jdom.Element option)
adds a new option at the end to the dropdownlist

Parameters:
option - an Element describing the option to add

addOption

public void addOption(int i,
                      org.jdom.Element option)
adds a new option at the passed position within the dropdownlist

Parameters:
i - the index where to add the option
option - an Element describing the option to add

addOption

public void addOption(KeyValuePair p)
Adds a new option at the end to the dropdownlist

Parameters:
p - the new option

addOptions

public void addOptions(java.util.Collection<? extends KeyValuePair<java.lang.String,java.lang.String>> options)
Adds all options at the end of the dropdownlist

Parameters:
options - the options

deleteOption

@Deprecated
public void deleteOption(java.lang.String value,
                                    java.lang.String text)
Deprecated. use method with one argument

Removes the specified option, if it can be identified, from the dropdownlist.

Parameters:
value - the value of the specified option
text - the displayed text of the new option

deleteOption

public void deleteOption(java.lang.String value)
Removes the specified option, if it can be identified, from the dropdownlist.

Parameters:
value - the value of the specified option

deleteOption

public void deleteOption(int index)
Removes the specified option, if it can be identified, from the dropdownlist.

Parameters:
index - the position of the specified option in the dropdownlist

getOptionText

public java.lang.String getOptionText(int index)
Returns the displayed text of the specified option.

Parameters:
index - the position of the specified option in the dropdownlist
Returns:
the displayed text

getOption

public org.jdom.Element getOption(int index)

getOptionValue

public java.lang.String getOptionValue(int index)
Returns the value of the specified option.

Parameters:
index - the position of the specified option in the dropdownlist
Returns:
the value

getSelectedOption

public int getSelectedOption()
Returns the index of the selected option.

Returns:
the index; if no option is selected "-1"

setSelectedOption

public void setSelectedOption(int index)
Adds the attribute SELECTED to the specified option.

Parameters:
index - the option which is selected

setSelectedOption

public void setSelectedOption(java.lang.String value)
Adds the attribute SELECTED to the specified option.

Parameters:
value - the option value which is selected

removeSelection

public void removeSelection()
Removes the attribute SELECTED from the selected option.


isSelected

public boolean isSelected(int index)
Returns whether the specified option has the attribute SELECTED, or not

Parameters:
index - the index of the specified option
Returns:
true if the option is selected

getOptionValues

public java.util.List<java.lang.String> getOptionValues()
Returns a vector with the value of every options.

Returns:
the Vector

getOptionTexts

public java.util.List<java.lang.String> getOptionTexts()
Returns a vector with the displayed text of every option.

Returns:
the Vector

getSize

public int getSize()
returns the number of nested options in the dropdownlist - the size

Returns:
the size

setContent

public void setContent(java.lang.Object o)
Sets the list of options.

Specified by:
setContent in interface Component
Overrides:
setContent in class AbstractComponent
Parameters:
o - must be a collection

setContent

public void setContent(java.lang.Object o,
                       boolean showNull)
Sets the list of options.

Parameters:
o - a collection of objects for the options
showNull - if true, add the option with value and display string empty to the begin of the list

setContent

public void setContent(java.lang.Object o,
                       KeyValuePair val)
Sets the list of options.

Parameters:
o - a collection of objects for the options
val - a pair where the key equals one of the keys of the content parameter

getContent

public java.lang.Object getContent()
Get the list of options.

Specified by:
getContent in interface Component
Overrides:
getContent in class AbstractComponent
Returns:
a list of pairs of value and text strings

showOptions

public java.lang.String showOptions()
Show the options text.

Returns:
the content object of the component

setSelectedOptions

public void setSelectedOptions(java.util.List vals)

getSelections

public int[] getSelections()
returns a array of all selected options

Returns:
the indeces of the selected options

removeSelections

public void removeSelections()
removes the attribute SELECTED from the selected options


setDisplayedSize

public void setDisplayedSize(int size)
sets the displayed list size

Parameters:
size - the size

getOptionIndex

public int getOptionIndex(java.lang.String value,
                          java.lang.String text)
returns the index of the specified option (identified by value-text-pair

Parameters:
value - the value of the specified option
text - the displayed text of the specified option
Returns:
the index of the specified option

clear

public void clear()
removes all options from this selectlist



@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.