A generic list component manages a javax.swing.ListModel
data list, item values are rendered as markup using a special object, the renderer,
and may be optionally edited "in place" using a user defined editor.
Any change to the data model is notified to the component and the markup
is rendered again. The data model ever mandates over the markup, any initial markup content (initial child elements) is removed.
getEditorActivatorEvent() Returns the event type used to activate the list item edition process by the user.
the event type used to activate the edition.
getListModel() Returns the current data model of this component.
public int
getSelectedIndex() Returns the index of the first selected list item.
public int
indexOf(Object obj) Returns the zero based position in the list of the specified value.
If the value is repeated returns the first position.
Parameters: obj - the object value to search.
public boolean
isEditing() Informs whether a list item value is being edited.
public void
setEditorActivatorEvent(String eventType) Sets the event type used to activate the list item edition process by the user.
The new item value is set to the data model
calling javax.swing.DefaultListModel.setElementAt(Object,int),
if the data model is not DefaultListModel is the programmer responsibility
to set the new value to the data model (detecting when the editor stops editing,
see javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener)).
Current data model is disconnected from this component, and the new
data model is bound to this component, every change is tracked and
updates the user interfaces accordingly.
If the specified data model is the same instance as the current data model,
then is reset, component listener is removed and added again.
Returns the event type used to activate the list item edition process by the user.
the event type used to activate the edition. By default is "dblclick". See Also:ItsNatList.setEditorActivatorEvent(String)
Returns the index of the first selected list item. If the component
allows multiple selection returns the first one.
index of the first selected list item. -1 if none is selected.
Returns the zero based position in the list of the specified value.
If the value is repeated returns the first position.
Parameters: obj - the object value to search. the zero based position of the value, -1 if not in the list.
Informs whether a list item value is being edited.
true if a list item value is being edited. See Also:ItsNatList.startEditingAt(int)
setEditorActivatorEvent
public void setEditorActivatorEvent(String eventType)(Code)
Sets the event type used to activate the list item edition process by the user.
Parameters: eventType - the event type used to activate the edition. See Also:ItsNatList.getEditorActivatorEvent() See Also:
The new item value is set to the data model
calling javax.swing.DefaultListModel.setElementAt(Object,int),
if the data model is not DefaultListModel is the programmer responsibility
to set the new value to the data model (detecting when the editor stops editing,
see javax.swing.CellEditor.addCellEditorListener(javax.swing.event.CellEditorListener)).
Current data model is disconnected from this component, and the new
data model is bound to this component, every change is tracked and
updates the user interfaces accordingly.
If the specified data model is the same instance as the current data model,
then is reset, component listener is removed and added again. Use this technique if
you want to add a data model listener to be executed before the default component listener.
Parameters: dataModel - the new data model. See Also:ItsNatList.getListModel()
Selects the specified list item. If this component allows multiple selection,
the current selection is cleared before.
Parameters: index - the index of the item to select