Class WDropdown
-
- All Implemented Interfaces:
AjaxTarget,AjaxTrigger,Autocompleteable,AutocompleteableDate,AutocompleteableEmail,AutocompleteableNumeric,AutocompleteablePassword,AutocompleteablePhone,AutocompleteableText,AutocompleteableURL,BeanAware,BeanBound,BeanProviderBound,DataBound,Diagnosable,Disableable,Input,Labelable,Mandatable,SubordinateTarget,SubordinateTrigger,WComponent,WebComponent,Serializable
public class WDropdown extends AbstractWSingleSelectList implements AjaxTrigger, AjaxTarget, SubordinateTrigger, SubordinateTarget, AutocompleteableText
The WDropdown component is used to let the user select a single option from a drop-down list. The list of options that can be selected are supplied at construction time as a parameter in the constructor or via the
AbstractWSelectList.setOptions(List)method. The list of options are java objects that are rendered using their toString() by default.Use the
getSelectedmethod to determine which of the list of options was chosen by the user. Note that getSelected returns one of the object instances supplied in the original list of options.The WDropdown component supports extensions using the
setType(DropdownType)method. The"combo"drop-down extension allows the user to enter in a value which was not present in the original list.- Since:
- 1.0.0
- Author:
- James Gifford, Jonathan Austin, Mark Reeves
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWDropdown.DropdownModelHolds the extrinsic state information of the drop down.static classWDropdown.DropdownTypeDeprecated.COMBO no longer required.-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWSelectList
AbstractWSelectList.SelectionModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractInput
AbstractInput.InputModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWComponent
AbstractWComponent.WComponentRef
-
-
Field Summary
-
Fields inherited from class com.github.bordertech.wcomponents.AbstractWSingleSelectList
EMPTY
-
Fields inherited from interface com.github.bordertech.wcomponents.WComponent
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
-
-
Constructor Summary
Constructors Constructor Description WDropdown()Creates an empty WDropdown.WDropdown(Object table)Creates a WDropdown with the options provided by the given table.WDropdown(Object[] options)Creates a WDropdown with the specified options.WDropdown(List options)Creates a WDropdown with the specified options.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAutocompleteSection(String sectionName)Pre-pend anautocompletesection to the value of anautocompleteattribute for the current field.voidclearAutocomplete()Clear theautocompleteattribute.StringgetAutocomplete()protected WDropdown.DropdownModelgetComponentModel()Returns the effective component model for this component.intgetOptionWidth()Get the width of the selectable options when rendered to screen.protected WDropdown.DropdownModelgetOrCreateComponentModel()Retrieves the model for this component so that it can be modified.WDropdown.DropdownTypegetType()Deprecated.No longer required as COMBO will be dropped.booleanisEditable()Deprecated.editable no longer required.protected WDropdown.DropdownModelnewComponentModel()Creates a new DropdownModel which holds Extrinsic state management of the drop down.voidsetAddressAutocomplete(AddressType addressType, AddressPart addressPart)Set values for theautocompleteattribute applicable to an address or part thereof.voidsetAutocomplete(AutocompleteSegment value)Setautocompleteattribute value for a field based on a segment name.voidsetAutocomplete(DateType value)Set theautocompletes attribute for a type of date input.voidsetAutocomplete(Email value)Set theautocompleteattribute to a specific "email" value.voidsetAutocomplete(Numeric value)Set the autocomplete attribute for a number field for a given numeric auto-fill value.voidsetAutocomplete(Password value)Set theautocompleteattribute of a password field to a given password auto-fill hint type.voidsetAutocomplete(Telephone phone, PhoneFormat phoneType)Set theautocompleteattribute to an appropriate value for a particular type of phone number, in either of a full or local format.voidsetAutocomplete(Url value)Set theautocompleteattribute to a specific URL auto-fill type: "url", "impp" or "photo".voidsetAutocompleteOff()Turnautocompleteoff for the current field.voidsetEditable(boolean editable)Deprecated.editable no longer required.voidsetOptionWidth(int optionWidth)Deprecated.as DropdownType.COMBO is deprecated.voidsetPhoneSegmentAutocomplete(PhoneFormat phoneType, PhonePart phoneSegment)Set theautocompleteattribute value relevant for a specified telephone number type and segment.voidsetType(WDropdown.DropdownType type)Deprecated.No longer required as COMBO will be dropped.-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWSingleSelectList
doHandleInvalidOption, doHandleRequest, getData, getNewSelection, getRequestValue, getSelected, getValue, hasSelection, preparePaintComponent, setData, setSelected
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWSelectList
getAjaxTarget, getCode, getDesc, getDescEncode, getListCacheKey, getLookupTable, getOptionIndex, getOptions, isAjax, isAllowNoSelection, isPresent, isSelectionOrderable, isSubmitOnChange, optionToCode, optionToCode, optionToString, setAjaxTarget, setDescEncode, setLookupTable, setOptions, setOptions, setSubmitOnChange
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractInput
addValidator, beforeHandleRequest, createMandatoryDiagnostic, doHandleChanged, getActionCommand, getActionObject, getActionOnChange, getDefaultSubmitButton, getDiagnostics, getValidators, getValueAsString, handleRequest, isChangedInLastRequest, isCurrentAjaxTrigger, isDisabled, isEmpty, isMandatory, isReadOnly, setActionObject, setActionOnChange, setChangedInLastRequest, setDefaultSubmitButton, setDisabled, setMandatory, setMandatory, setReadOnly, showErrorIndicatorsForComponent, showIndicatorsForComponent, showWarningIndicatorsForComponent, toString, validateComponent
-
Methods inherited from class com.github.bordertech.wcomponents.WBeanComponent
addBeanToScratchMap, doUpdateBeanValue, getBean, getBeanFromScratchMap, getBeanId, getBeanProperty, getBeanProvider, getBeanScratchMap, getBeanValue, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, removeBeanFromScratchMap, resetData, setBean, setBeanId, setBeanProperty, setBeanProvider, setSearchAncestors, updateBeanValue
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWComponent
addHtmlClass, addHtmlClass, addNotify, afterPaint, assertAddSupported, beforePaint, createErrorDiagnostic, createErrorDiagnostic, forward, getAccessibleText, getAttribute, getBaseUrl, getDefaultModel, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getScratchMap, getTabIndex, getTag, getTemplate, getTemplateMarkUp, getToolTip, hasNoComponentModel, hasTabIndex, initialiseComponentModel, invokeLater, invokeLaters, isDebugStructure, isDefaultState, isFlagSet, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, paintComponent, preparePaint, removeAttribute, removeComponentModel, removeHtmlClass, removeHtmlClass, removeNotify, replaceWComponent, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFlag, setFocussed, setHidden, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContext, tidyUpUIContextForTree, validate, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.Autocompleteable
isAutocompleteOff
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableDate
setBirthdayAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableEmail
setEmailAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteablePhone
setFullPhoneAutocomplete, setFullPhoneAutocomplete, setLocalPhoneAutocomplete, setLocalPhoneAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableURL
setUrlAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanAware
getBean, getBeanProperty, getBeanValue, setBeanProperty
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanBound
isSearchAncestors, setBean
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanProviderBound
getBeanId, setBeanId, setBeanProvider
-
Methods inherited from interface com.github.bordertech.wcomponents.WComponent
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, handleRequest, hasTabIndex, invokeLater, isDefaultState, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, preparePaint, removeAttribute, removeHtmlClass, removeHtmlClass, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFocussed, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContextForTree, validate
-
-
-
-
Constructor Detail
-
WDropdown
public WDropdown()
Creates an empty WDropdown.
-
WDropdown
public WDropdown(Object[] options)
Creates a WDropdown with the specified options.- Parameters:
options- the drop down options.
-
WDropdown
public WDropdown(List options)
Creates a WDropdown with the specified options.- Parameters:
options- the drop down options.
-
WDropdown
public WDropdown(Object table)
Creates a WDropdown with the options provided by the given table.- Parameters:
table- the table to obtain the dropdown's options from.
-
-
Method Detail
-
getAutocomplete
public String getAutocomplete()
- Specified by:
getAutocompletein interfaceAutocompleteable- Returns:
- the value of the
autocompleteattribute applied to the current field.
-
setAutocompleteOff
public void setAutocompleteOff()
Description copied from interface:AutocompleteableTurnautocompleteoff for the current field.- Specified by:
setAutocompleteOffin interfaceAutocompleteable
-
addAutocompleteSection
public void addAutocompleteSection(String sectionName)
Description copied from interface:AutocompleteablePre-pend anautocompletesection to the value of anautocompleteattribute for the current field.- Specified by:
addAutocompleteSectionin interfaceAutocompleteable- Parameters:
sectionName- the name of the section being the part which would replace the asterisk in the formsection-*
-
clearAutocomplete
public void clearAutocomplete()
Description copied from interface:AutocompleteableClear theautocompleteattribute.- Specified by:
clearAutocompletein interfaceAutocompleteable
-
setAutocomplete
public void setAutocomplete(DateType value)
Description copied from interface:AutocompleteableDateSet theautocompletes attribute for a type of date input.- Specified by:
setAutocompletein interfaceAutocompleteableDate- Parameters:
value- the type of date to auto-fill, currently only "bday" is supported.
-
setAutocomplete
public void setAutocomplete(Email value)
Description copied from interface:AutocompleteableEmailSet theautocompleteattribute to a specific "email" value. Currently only value "email" is supported.- Specified by:
setAutocompletein interfaceAutocompleteableEmail- Parameters:
value- the auto-fill hint value
-
setAutocomplete
public void setAutocomplete(Numeric value)
Description copied from interface:AutocompleteableNumericSet the autocomplete attribute for a number field for a given numeric auto-fill value.- Specified by:
setAutocompletein interfaceAutocompleteableNumeric- Parameters:
value- the type of number for auto-fill
-
setAutocomplete
public void setAutocomplete(Password value)
Description copied from interface:AutocompleteablePasswordSet theautocompleteattribute of a password field to a given password auto-fill hint type.- Specified by:
setAutocompletein interfaceAutocompleteablePassword- Parameters:
value- the type of password field to auto-fill
-
setAutocomplete
public void setAutocomplete(Url value)
Description copied from interface:AutocompleteableURLSet theautocompleteattribute to a specific URL auto-fill type: "url", "impp" or "photo".- Specified by:
setAutocompletein interfaceAutocompleteableURL- Parameters:
value- the auto-fill hint value
-
setAutocomplete
public void setAutocomplete(AutocompleteSegment value)
Description copied from interface:AutocompleteableTextSetautocompleteattribute value for a field based on a segment name.- Specified by:
setAutocompletein interfaceAutocompleteableText- Parameters:
value- the auto-fill mnemonic
-
setAutocomplete
public void setAutocomplete(Telephone phone, PhoneFormat phoneType)
Description copied from interface:AutocompleteablePhoneSet theautocompleteattribute to an appropriate value for a particular type of phone number, in either of a full or local format.- Specified by:
setAutocompletein interfaceAutocompleteablePhone- Parameters:
phone- the telephone auto-fill variant, being full (including international prefix) or local (without international prefix)phoneType- the type of phone to which the number belongs, for example "mobile" or "fax"
-
setPhoneSegmentAutocomplete
public void setPhoneSegmentAutocomplete(PhoneFormat phoneType, PhonePart phoneSegment)
Description copied from interface:AutocompleteableTextSet theautocompleteattribute value relevant for a specified telephone number type and segment.- Specified by:
setPhoneSegmentAutocompletein interfaceAutocompleteableText- Parameters:
phoneType- the type of phone numberphoneSegment- the phone number segment
-
setAddressAutocomplete
public void setAddressAutocomplete(AddressType addressType, AddressPart addressPart)
Description copied from interface:AutocompleteableTextSet values for theautocompleteattribute applicable to an address or part thereof.- Specified by:
setAddressAutocompletein interfaceAutocompleteableText- Parameters:
addressType- the type of address being auto-filledaddressPart- the address segment for the field
-
setEditable
@Deprecated public void setEditable(boolean editable)
Deprecated.editable no longer required. WSuggestions and a WTextfield should be used insteadSets whether the users are able to enter in an arbitrary value, rather than having to pick one from the drop-down list.- Overrides:
setEditablein classAbstractWSelectList- Parameters:
editable- true for editable, false for fixed.
-
isEditable
@Deprecated public boolean isEditable()
Deprecated.editable no longer required. WSuggestions and a WTextfield should be used insteadIndicates whether users are able to enter in an arbitrary value, rather than having to pick one from the drop-down list.- Overrides:
isEditablein classAbstractWSelectList- Returns:
- true if the user can enter arbitrary values, false if not.
-
setType
@Deprecated public void setType(WDropdown.DropdownType type)
Deprecated.No longer required as COMBO will be dropped. WSuggestions and a WTextfield should be used insteadSets the type of this drop down. If un-set, reverts to the un-editable/native type.- Parameters:
type- one of native or combo.
-
getType
@Deprecated public WDropdown.DropdownType getType()
Deprecated.No longer required as COMBO will be dropped. WSuggestions and a WTextfield should be used insteadIndicates the type of this drop down.- Returns:
- the drop down type, one of native or combo.
-
setOptionWidth
@Deprecated public void setOptionWidth(int optionWidth)
Deprecated.as DropdownType.COMBO is deprecated.Set the width of the selectable options in a COMBO when rendered to screen. Has no effect with a native drop down.- Parameters:
optionWidth- the option width.
-
getOptionWidth
public int getOptionWidth()
Get the width of the selectable options when rendered to screen. Has no effect with a native drop down.- Returns:
- the option width.
-
newComponentModel
protected WDropdown.DropdownModel newComponentModel()
Creates a new DropdownModel which holds Extrinsic state management of the drop down.- Overrides:
newComponentModelin classAbstractWSelectList- Returns:
- a new DropdownModel.
-
getComponentModel
protected WDropdown.DropdownModel getComponentModel()
Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.- Overrides:
getComponentModelin classAbstractWSelectList- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WDropdown.DropdownModel getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.- Overrides:
getOrCreateComponentModelin classAbstractWSelectList- Returns:
- the model for this component
-
-