|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnextapp.echo.AbstractComponent
net.sf.jzeno.echo.components.CustomComponent
net.sf.jzeno.echo.databinding.DynaListBox
public class DynaListBox
Allows the user to select one or more items from a list of possible items.
This list is shown in a list box. The items being displayed are a list of
java beans (setList(List)
). Of those java beans you can specify a
property that is shown to the user on the screen
setLabelProperty(String)
). When the users has selected one or more
from the possible options, the java beans from the original list that were
selected will be written to the data binding target of this component.
You can configure this component to allow only a single selection, or to
allow multiple selections (setMultiSelect(boolean)
- by default
false ).
If you allow only one item to be selected, you should bind this component to a property of the type corresponding to the type of the java beans in the list of all possible items.
If on the other hand you do allow multiple selection, than this component should be bound to a property of type java.util.Collection .
Nested Class Summary | |
---|---|
class |
DynaListBox.DefaultValidator
|
Field Summary | |
---|---|
java.lang.String |
cssClass
|
static int |
PERCENT_UNITS
|
static int |
PIXEL_UNITS
|
Constructor Summary | |
---|---|
DynaListBox()
Creates an unbound component. |
|
DynaListBox(java.lang.Class beanClass,
java.lang.String propertyName,
java.lang.String constructionHints)
Creates a databound listbox. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Gets the dynamic event handler that will be triggered when a selection is made in the listbox. |
void |
applyContext()
|
void |
changed(java.util.Collection collection)
|
void |
clearSelection()
Clears any selection on the component. |
void |
contentsChanged(ListDataEvent arg0)
Used internally. |
java.lang.String |
getActionCommand()
|
Color |
getBackground()
Gets the background color of this listbox. |
java.util.Comparator |
getComparator()
|
java.lang.String |
getCssClass()
|
Decorator |
getDecorator()
Implementation of RebindableComponent |
Font |
getFont()
Returns the font. |
Color |
getForeground()
Gets the foregound color (text in the listbox) of this listbox. |
java.lang.String |
getInvalidMessage()
Gets the message key that is added to the screen, when the component is marked as invalid. |
java.lang.String |
getInvalidMessageKey()
Deprecated. |
java.lang.String |
getLabelProperty()
Gets the property (path), used to show the java beans in the list, on the screen. |
java.util.List |
getList()
Gets the list of java beans the user can select from. |
ListModel |
getModel()
Gets the model that is used by this listbox. |
java.lang.String |
getNullLabel()
Gets the label, corresponding to the data binding target value null . |
int |
getSelectedIndex()
Gets the index that is selected. |
java.lang.Object |
getSelectedItem()
|
java.lang.String |
getSelectedLabels()
Returns the label that the user selected. |
java.lang.Object |
getSelectedValue()
Deprecated. |
java.lang.String |
getToolTipProperty()
Gets the tooltip indirectly by specifying a property path. |
java.lang.String |
getToolTipText()
Gets the tooltip that appears when the user hoovers over this component. |
int |
getVisibleRowCount()
Gets the number of items that are shown in the listbox at once. |
int |
getWidth()
|
int |
getWidthUnits()
|
void |
intervalAdded(ListDataEvent arg0)
Used internally. |
void |
intervalRemoved(ListDataEvent arg0)
Used internally. |
boolean |
isAsync()
|
boolean |
isDoubleClickActionCommand()
|
boolean |
isMultiSelect()
Gets whether or not the listbox allows multiple items to be selected. |
boolean |
isReadOnly()
|
void |
rebind()
This operation causes the component to reset it's content to that of the domain model. |
void |
setActionCommand(java.lang.String command)
Sets the dynamic event handler that will be triggered when a selection is made in the listbox. |
void |
setAsync(boolean async)
|
void |
setBackground(Color background)
Sets the background color of this listbox. |
void |
setComparator(java.util.Comparator comparator)
|
void |
setCssClass(java.lang.String newValue)
|
void |
setDecorator(Decorator decorator)
Sets the decorator. |
void |
setDoubleClickActionCommand(boolean b)
|
void |
setFocused(boolean focused)
Sets the input focus to this component. |
void |
setFont(Font newValue)
Sets the font of the component. |
void |
setForeground(Color foreground)
Sets the foregound color (text in the listbox) of this listbox. |
void |
setInvalidMessage(java.lang.String invalidMessage)
Sets the message key that is shown when the component is marked as invalid. |
void |
setInvalidMessageKey(java.lang.String s)
Deprecated. |
void |
setLabelProperty(java.lang.String labelProperty)
Sets the property (path), relative to the individual beans in the list ( setList(List) ) that is shown to the user in the listbox. |
void |
setList(java.util.List list)
Sets the list of java beans the user can select from. |
void |
setMultiSelect(boolean allowMultiSelect)
Sets whether or not the listbox allows multiple items to be selected. |
void |
setNullLabel(java.lang.String nullLabel)
Sets the label, corresponding to the data binding target value null . |
void |
setReadOnly(boolean readOnly)
Mark this component as read-only. |
void |
setRequired(boolean required)
Determine if the editor is required to be filled in. |
void |
setSelectedIndex(int i)
Sets the index that is selected. |
void |
setSelectedLabels(java.lang.String labels)
|
void |
setToolTipProperty(java.lang.String toolTipProperty)
Sets the tooltip indirectly by specifying a property path. |
void |
setToolTipText(java.lang.String text)
Sets the tooltip that appears when the user hoovers over this component. |
void |
setVisibleRowCount(int i)
Sets the number of items that are shown in the listbox at once. |
void |
setWidth(int width)
|
void |
setWidthUnits(int widthUnits)
|
void |
valueChanged(ListSelectionEvent arg0)
Used internally. |
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent |
---|
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getBean, getBeanClass, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isRequired, isValid, markInvalid, markValid, preRender, removeValidator, setBean, setBeanClass, setNullObject, setProperty, setValue, traceValue, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.jzeno.echo.databinding.PropertyComponent |
---|
addValidator, getBean, getBeanClass, getProperty, getValidationErrors, getValidators, getValue, isMarkedInvalid, isRequired, isValid, markInvalid, markValid, preRender, removeValidator, setBean, setBeanClass, setProperty, setValue |
Field Detail |
---|
public static final int PIXEL_UNITS
public static final int PERCENT_UNITS
public java.lang.String cssClass
Constructor Detail |
---|
public DynaListBox()
Creates an unbound component.
public DynaListBox(java.lang.Class beanClass, java.lang.String propertyName, java.lang.String constructionHints)
Creates a databound listbox. For the type of property you should bind to
see the class documentation above. (DynaListBox
)
Method Detail |
---|
public void valueChanged(ListSelectionEvent arg0)
Used internally.
valueChanged
in interface ListSelectionListener
arg0
- An event describing the change.public void rebind()
RebindableComponent
This operation causes the component to reset it's content to that of the domain model.
rebind
in interface RebindableComponent
rebind
in class CustomComponent
public java.util.List getList()
Gets the list of java beans the user can select from.
getList
in interface ListBoxInterface
public void setList(java.util.List list)
Sets the list of java beans the user can select from.
setList
in interface ListBoxInterface
public java.lang.String getLabelProperty()
Gets the property (path), used to show the java beans in the list, on the
screen. Also see setLabelProperty(String)
.
public void setLabelProperty(java.lang.String labelProperty)
Sets the property (path), relative to the individual beans in the list (
setList(List)
) that is shown to the user in the listbox.
public java.lang.String getNullLabel()
Gets the label, corresponding to the data binding target value
null
. Also see setNullLabel(String)
.
public void setNullLabel(java.lang.String nullLabel)
Sets the label, corresponding to the data binding target value
null
. If the user selects this label (which will appear
at the top of the list), the value null
will be written to
the data binding target. If the data binding target is null
this label will be selected on the screen. If you don't want a selection
corresponding to null
, set this property to
null
(this is also the default).
public java.lang.String getToolTipProperty()
Gets the tooltip indirectly by specifying a property path.
public void setToolTipProperty(java.lang.String toolTipProperty)
Sets the tooltip indirectly by specifying a property path.
public java.lang.Object getSelectedItem()
public Decorator getDecorator()
CustomComponent
getDecorator
in interface ListBoxInterface
getDecorator
in interface PropertyComponent
getDecorator
in class CustomComponent
public void setDecorator(Decorator decorator)
PropertyComponent
Sets the decorator.
setDecorator
in interface ListBoxInterface
setDecorator
in interface PropertyComponent
setDecorator
in class CustomComponent
public java.lang.String getInvalidMessage()
Gets the message key that is added to the screen, when the component is
marked as invalid. Also see setInvalidMessage(String)
.
getInvalidMessage
in interface ListBoxInterface
public java.lang.String getInvalidMessageKey()
public void setInvalidMessage(java.lang.String invalidMessage)
Sets the message key that is shown when the component is marked as
invalid. Typically the component is marked invalid when you call
in
your code. The value specified for this property is translated through
the i18n support in jZeno (EchoSupport.doValidationRecursively(Component)
i18n.properties
).
setInvalidMessage
in interface ListBoxInterface
public void setInvalidMessageKey(java.lang.String s)
public boolean isReadOnly()
isReadOnly
in interface PropertyComponent
isReadOnly
in class CustomComponent
public void setReadOnly(boolean readOnly)
PropertyComponent
Mark this component as read-only.
setReadOnly
in interface PropertyComponent
setReadOnly
in class CustomComponent
public void contentsChanged(ListDataEvent arg0)
Used internally.
contentsChanged
in interface ListDataListener
arg0
- The ListDataEvent describing the update.public void intervalAdded(ListDataEvent arg0)
Used internally.
intervalAdded
in interface ListDataListener
arg0
- The ListDataEvent describing the update.public void intervalRemoved(ListDataEvent arg0)
Used internally.
intervalRemoved
in interface ListDataListener
arg0
- The ListDataEvent describing the update.public boolean isMultiSelect()
Gets whether or not the listbox allows multiple items to be selected.
isMultiSelect
in interface ListBoxInterface
public void setMultiSelect(boolean allowMultiSelect)
Sets whether or not the listbox allows multiple items to be selected.
setMultiSelect
in interface ListBoxInterface
public void setVisibleRowCount(int i)
Sets the number of items that are shown in the listbox at once. If there are more items in the list of java beans than this property, the user will have to use the scroll bars to view the extra items.
public int getVisibleRowCount()
Gets the number of items that are shown in the listbox at once. See also
setVisibleRowCount(int)
.
public ListModel getModel()
Gets the model that is used by this listbox. This will be an instance of
type BoundListModel
.
public void setSelectedIndex(int i)
Sets the index that is selected. Useful if you are using the listbox without data binding. Otherwise you could just modify the data binding target property.
public int getSelectedIndex()
Gets the index that is selected.
public void setToolTipText(java.lang.String text)
Sets the tooltip that appears when the user hoovers over this component.
public java.lang.String getToolTipText()
Gets the tooltip that appears when the user hoovers over this component.
public void clearSelection()
Clears any selection on the component.
clearSelection
in interface ListBoxInterface
public java.lang.Object getSelectedValue()
Gets the javabean that is currently selected.
public void setActionCommand(java.lang.String command)
Sets the dynamic event handler that will be triggered when a
selection is made in the listbox. If you don't want a roundtrip when a
selection is made, set this property to null
(this is also
the default).
setActionCommand
in interface EventSource
setActionCommand
in class CustomComponent
public java.lang.String getActionCommand()
getActionCommand
in interface EventSource
getActionCommand
in class CustomComponent
public void actionPerformed(ActionEvent e)
Gets the dynamic event handler that will be triggered when a selection is made in the listbox.
actionPerformed
in interface ActionListener
e
- The event describing the action.public Color getBackground()
Gets the background color of this listbox.
getBackground
in interface Component
getBackground
in class AbstractComponent
public void setBackground(Color background)
Sets the background color of this listbox.
setBackground
in interface Component
setBackground
in class AbstractComponent
background
- The new background color of the component.public Color getForeground()
Gets the foregound color (text in the listbox) of this listbox.
getForeground
in interface Component
getForeground
in class AbstractComponent
public void setForeground(Color foreground)
Sets the foregound color (text in the listbox) of this listbox.
setForeground
in interface Component
setForeground
in class AbstractComponent
foreground
- The new foreground color of the component.public void setRequired(boolean required)
PropertyComponent
Determine if the editor is required to be filled in.
setRequired
in interface PropertyComponent
setRequired
in class CustomComponent
public void setFocused(boolean focused)
Sets the input focus to this component.
setFocused
in interface ListBoxInterface
setFocused
in interface Component
setFocused
in class AbstractComponent
focused
- True if the component is to be focused.public void setComparator(java.util.Comparator comparator)
setComparator
in interface ListBoxInterface
public java.util.Comparator getComparator()
getComparator
in interface ListBoxInterface
public void setWidth(int width)
setWidth
in interface ListBoxInterface
public int getWidth()
getWidth
in interface ListBoxInterface
public void setWidthUnits(int widthUnits)
setWidthUnits
in interface ListBoxInterface
public int getWidthUnits()
getWidthUnits
in interface ListBoxInterface
public void setDoubleClickActionCommand(boolean b)
public boolean isDoubleClickActionCommand()
public void applyContext()
applyContext
in interface Precreation
public Font getFont()
Component
getFont
in interface ListBoxInterface
getFont
in interface Component
getFont
in class AbstractComponent
public void setFont(Font newValue)
Component
setFont
in interface ListBoxInterface
setFont
in interface Component
setFont
in class AbstractComponent
newValue
- The new font of the component.public void setAsync(boolean async)
public boolean isAsync()
public void changed(java.util.Collection collection)
changed
in interface CollectionChangeListener
public java.lang.String getSelectedLabels()
public void setSelectedLabels(java.lang.String labels)
public java.lang.String getCssClass()
public void setCssClass(java.lang.String newValue)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |