org.itsnat.comp.list
Interface ItsNatList

All Superinterfaces:
ItsNatComponent, ItsNatElementComponent, ItsNatUserData
All Known Subinterfaces:
ItsNatComboBox, ItsNatFreeComboBox, ItsNatFreeList, ItsNatFreeListMultSel, ItsNatHTMLSelect, ItsNatHTMLSelectComboBox, ItsNatHTMLSelectMult, ItsNatListMultSel

public interface ItsNatList
extends ItsNatElementComponent

Is the base interface of list based components.

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.

This component family is the "componentized" version of ElementList and follows a similar philosophy.

Author:
Jose Maria Arranz Santamaria

Method Summary
 javax.swing.ListModel createDefaultListModel()
          Creates a data model instance appropriated to this component.
 int getEditingIndex()
          Returns the index of the list item being edited.
 java.lang.String getEditorActivatorEvent()
          Returns the event type used to activate the list item edition process by the user.
 ItsNatListCellEditor getItsNatListCellEditor()
          Returns the current list item editor.
 ItsNatListCellRenderer getItsNatListCellRenderer()
          Returns the current component renderer.
 ItsNatListStructure getItsNatListStructure()
          Returns the component structure.
 ItsNatListUI getItsNatListUI()
          Returns the user interface manager of this component.
 javax.swing.ListModel getListModel()
          Returns the current data model of this component.
 int getSelectedIndex()
          Returns the index of the first selected list item.
 int indexOf(java.lang.Object obj)
          Returns the zero based position in the list of the specified value.
 boolean isEditing()
          Informs whether a list item value is being edited.
 boolean isEditingEnabled()
          Informs whether the in place edition is enabled.
 void setEditingEnabled(boolean value)
          Enables or disables temporally the in place edition.
 void setEditorActivatorEvent(java.lang.String eventType)
          Sets the event type used to activate the list item edition process by the user.
 void setItsNatListCellEditor(ItsNatListCellEditor editor)
          Sets the list item editor.
 void setItsNatListCellRenderer(ItsNatListCellRenderer renderer)
          Sets the component renderer.
 void setListModel(javax.swing.ListModel dataModel)
          Changes the data model of this component.
 void setSelectedIndex(int index)
          Selects the specified list item.
 void startEditingAt(int index)
          Used to start programmatically a list item edition process "in place".
 
Methods inherited from interface org.itsnat.comp.ItsNatElementComponent
getElement, getItsNatElementComponentUI
 
Methods inherited from interface org.itsnat.comp.ItsNatComponent
addEventListener, addEventListener, addEventListener, addEventListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, disableEventListener, disableEventListener, dispose, enableEventListener, enableEventListener, getArtifact, getArtifact, getItsNatComponentManager, getItsNatComponentUI, getItsNatDocument, getNode, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, isDisposed, isEnabled, registerArtifact, removeArtifact, removeEventListener, removeEventListener, removeEventListener, removeEventListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, setEnabled, setEventListenerParams, setEventListenerParams, setNode
 
Methods inherited from interface org.itsnat.core.ItsNatUserData
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
 

Method Detail

getItsNatListUI

ItsNatListUI getItsNatListUI()
Returns the user interface manager of this component.

Returns:
the user interface manager.

getListModel

javax.swing.ListModel getListModel()
Returns the current data model of this component.

Returns:
the current data model
See Also:
setListModel(javax.swing.ListModel)

setListModel

void setListModel(javax.swing.ListModel dataModel)
Changes the data model of this component.

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:
getListModel()

createDefaultListModel

javax.swing.ListModel createDefaultListModel()
Creates a data model instance appropriated to this component. This instance is not bound to the component.

Returns:
a new data model instance.

getSelectedIndex

int getSelectedIndex()
Returns the index of the first selected list item. If the component allows multiple selection returns the first one.

Returns:
index of the first selected list item. -1 if none is selected.

setSelectedIndex

void setSelectedIndex(int index)
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

indexOf

int indexOf(java.lang.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.
Returns:
the zero based position of the value, -1 if not in the list.

getItsNatListStructure

ItsNatListStructure getItsNatListStructure()
Returns the component structure.

Returns:
the component structure.

getItsNatListCellRenderer

ItsNatListCellRenderer getItsNatListCellRenderer()
Returns the current component renderer. This renderer converts a list item value to markup.

Returns:
the current renderer. By default uses the default renderer (ItsNatComponentManager.createDefaultItsNatListCellRenderer())
See Also:
setItsNatListCellRenderer(ItsNatListCellRenderer)

setItsNatListCellRenderer

void setItsNatListCellRenderer(ItsNatListCellRenderer renderer)
Sets the component renderer.

Parameters:
renderer - the new renderer.
See Also:
getItsNatListCellRenderer()

getItsNatListCellEditor

ItsNatListCellEditor getItsNatListCellEditor()
Returns the current list item editor. This object is used to edit in place a list item value.

Returns:
the current editor. By default uses the default editor calling (ItsNatComponentManager.createDefaultItsNatListCellEditor(ItsNatComponent)) with a null parameter.
See Also:
setItsNatListCellEditor(ItsNatListCellEditor)

setItsNatListCellEditor

void setItsNatListCellEditor(ItsNatListCellEditor editor)
Sets the list item editor.

List item edition works very much the same as label edition (see ItsNatLabel.setItsNatLabelEditor(ItsNatLabelEditor)).

Some differences:

The edition process starts programmatically by calling startEditingAt(int).

The edition takes place inside the list item content element as returned by ItsNatListStructure.getContentElement(ItsNatList,int,org.w3c.dom.Element).

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)).

Parameters:
editor - the new editor. May be null (edition disabled).
See Also:
getItsNatListCellEditor()

startEditingAt

void startEditingAt(int index)
Used to start programmatically a list item edition process "in place".

See Also:
isEditing()

isEditing

boolean isEditing()
Informs whether a list item value is being edited.

Returns:
true if a list item value is being edited.
See Also:
startEditingAt(int)

getEditingIndex

int getEditingIndex()
Returns the index of the list item being edited.

Returns:
the index of the list item being edited. -1 if none is being edited.

getEditorActivatorEvent

java.lang.String getEditorActivatorEvent()
Returns the event type used to activate the list item edition process by the user.

If returns null edition activated by events is disabled .

Returns:
the event type used to activate the edition. By default is "dblclick".
See Also:
setEditorActivatorEvent(String)

setEditorActivatorEvent

void setEditorActivatorEvent(java.lang.String eventType)
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:
getEditorActivatorEvent()

isEditingEnabled

boolean isEditingEnabled()
Informs whether the in place edition is enabled.

Returns:
false if the editing in place is temporally disabled. True by default.
See Also:
setEditingEnabled(boolean)

setEditingEnabled

void setEditingEnabled(boolean value)
Enables or disables temporally the in place edition.

Parameters:
value - true to enable in place edition.
See Also:
isEditingEnabled()


Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.