public class SelectList extends AbstractComponent
Modifier and Type | Field and Description |
---|---|
static String |
MULTIPLE |
static String |
OPTION |
static String |
SELECT |
static String |
SELECTED |
static String |
SELECTLIST |
static String |
SIZE |
static String |
VALUE |
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, parent, parentElem, READONLY, root, viewMode
LABELLEDBY
Constructor and Description |
---|
SelectList()
Constructs a new empty dropdown list component.
|
SelectList(String name,
Collection<?> list,
int size)
Constructor with name and content list.
|
SelectList(String name,
Collection<?> list,
int size,
boolean showNull)
Constructor with name and content list.
|
SelectList(String name,
Collection<?> list,
int size,
boolean showNull,
String selected)
Constructor with name and content list.
|
SelectList(String name,
Collection<?> list,
int size,
boolean showNull,
String selected,
String styleClass)
Constructor with name and content list.
|
SelectList(String name,
int size)
Constructor with name.
|
Modifier and Type | Method and Description |
---|---|
void |
addOption(Element option)
adds a new option at the end to the dropdownlist
|
void |
addOption(int i,
Element option)
adds a new option at the passed position within the dropdownlist
|
void |
addOption(int i,
String value,
String text) |
void |
addOption(KeyValuePair<?,?> p)
Adds a new option at the end to the dropdownlist
|
void |
addOption(String value,
String text)
adds a new option at the end to the dropdownlist
|
Element |
addOption(String value,
String text,
Element rt) |
void |
addOptions(Collection<? extends KeyValuePair<?,?>> 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(String value)
Removes the specified option, if it can be identified, from the dropdownlist.
|
void |
deleteOption(String value,
String text)
Deprecated.
use method with one argument
|
Object |
getContent()
Get the list of options.
|
Element |
getOption(int index) |
int |
getOptionIndex(String value,
String text)
returns the index of the specified option (identified by value-text-pair
|
String |
getOptionText(int index)
Returns the displayed text of the specified option.
|
List<String> |
getOptionTexts()
Returns a vector with the displayed text of every option.
|
String |
getOptionValue(int index)
Returns the value of the specified option.
|
List<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(Object o)
Sets the list of options.
|
void |
setContent(Object o,
boolean showNull)
Sets the list of options.
|
void |
setContent(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(String value)
Adds the attribute SELECTED to the specified option.
|
void |
setSelectedOptions(List<String> vals) |
String |
showOptions()
Show the options text.
|
addClass, clone, create, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getRootName, getStyle, getViewMode, init, init, init, removeAttribute, removeClass, setActionListener, setAttribute, setBrowserMode, setClass, setEncoding, setExpandEmptyElements, setId, setIndenting, setLabel, setName, setNewLines, setParent, setParentElement, setRootName, setStyle, setViewMode, show, show, toggleClass, toString
public static final String OPTION
public static final String VALUE
public static final String SELECT
public static final String SIZE
public static final String MULTIPLE
public static final String SELECTED
public static final String SELECTLIST
public SelectList()
public SelectList(String name, int size)
name
- the name of the form elementpublic SelectList(String name, Collection<?> list, int size)
name
- the name of the form elementlist
- the content listsize
- the number of visible linespublic SelectList(String name, Collection<?> list, int size, boolean showNull)
name
- the name of the form elementlist
- the content listsize
- the number of visible linesshowNull
- if true, add the option with value and display string empty to the begin of the listpublic SelectList(String name, Collection<?> list, int size, boolean showNull, String selected)
name
- the name of the form elementlist
- the content listsize
- the number of visible linesshowNull
- if true, add the option with value and display string empty
to the begin of the listselected
- the option where the value equals this argument is selectedpublic SelectList(String name, Collection<?> list, int size, boolean showNull, String selected, String styleClass)
name
- the name of the form elementlist
- the content listsize
- the number of visible linesshowNull
- if true, add the option with value and display string empty
to the begin of the listselected
- the option where the value equals this argument is selectedstyleClass
- the name of a CSS classpublic void setMultiple(boolean yesno)
public void addOption(String value, String text)
value
- the value of the new optiontext
- the displayed text of the new optionpublic void addOption(Element option)
option
- an Element describing the option to addpublic void addOption(int i, Element option)
i
- the index where to add the optionoption
- an Element describing the option to addpublic void addOption(KeyValuePair<?,?> p)
p
- the new optionpublic void addOptions(Collection<? extends KeyValuePair<?,?>> options)
options
- the options@Deprecated public void deleteOption(String value, String text)
value
- the value of the specified optiontext
- the displayed text of the new optionpublic void deleteOption(String value)
value
- the value of the specified optionpublic void deleteOption(int index)
index
- the position of the specified option in the dropdownlistpublic String getOptionText(int index)
index
- the position of the specified option in the dropdownlistpublic Element getOption(int index)
public String getOptionValue(int index)
index
- the position of the specified option in the dropdownlistpublic int getSelectedOption()
public void setSelectedOption(int index)
index
- the option which is selectedpublic void setSelectedOption(String value)
value
- the option value which is selectedpublic void removeSelection()
public boolean isSelected(int index)
index
- the index of the specified optionpublic List<String> getOptionValues()
public List<String> getOptionTexts()
public int getSize()
public void setContent(Object o)
setContent
in interface Component
setContent
in class AbstractComponent
o
- must be a collectionpublic void setContent(Object o, boolean showNull)
o
- a collection of objects for the optionsshowNull
- if true, add the option with value and display string empty to the begin of the listpublic void setContent(Object o, KeyValuePair<?,?> val)
o
- a collection of objects for the optionsval
- a pair where the key equals one of the keys of the content parameterpublic Object getContent()
getContent
in interface Component
getContent
in class AbstractComponent
public String showOptions()
public int[] getSelections()
public void removeSelections()
public void setDisplayedSize(int size)
size
- the sizepublic int getOptionIndex(String value, String text)
value
- the value of the specified optiontext
- the displayed text of the specified optionpublic void clear()
@enterprise 10.0.38798 Copyright © 2001-2024 Groiss Informatics GmbH. All Rights Reserved.