com.sun.lwuit.list
Class ContainerList

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.Container
          extended by com.sun.lwuit.list.ContainerList
All Implemented Interfaces:
Animation, StyleListener

public class ContainerList
extends Container

This is a "list component" implemented as a container with a layout manager which provides some of the ui advantages of a Container and some of a list while pulling out some of the drawbacks of both. This container uses the model/renderer approach for populating itself, adding/removing entries will probably break it. It still provides most of the large size advantages a list offers since the components within it are very simple and don't contain any actual state other than layout information. The big advantage with this class is the ability to leverage elaborate LWUIT layouts such as Grid, Table & flow layout to provide other ways of rendering the content of a list model.

Author:
Shai Almog

Field Summary
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
ContainerList()
          Default constructor
ContainerList(Layout l, ListModel m)
          Constructs a container list with the given model and layout
ContainerList(ListModel m)
          Constructs a container list with the given model
 
Method Summary
 void addActionListener(ActionListener l)
          Allows binding a listener to user selection actions
 java.util.Vector getActionListeners()
          This method allows extracting the action listeners from the current list
 ListModel getModel()
          Returns the list model
 CellRenderer getRenderer()
          The renderer used to draw the container list elements
 java.lang.Object getSelectedItem()
          Returns the current/last selected item
protected  void initComponent()
          Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
 void removeActionListener(ActionListener l)
          Allows binding a listener to user selection actions
 void setModel(ListModel model)
          Set the model for the container list
 void setRenderer(CellRenderer r)
          The renderer used to draw the container list elements
 
Methods inherited from class com.sun.lwuit.Container
addComponent, addComponent, addComponent, addComponent, applyRTL, calcPreferredSize, contains, dragInitiated, findFirstFocusable, flushReplace, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, invalidate, isEnabled, isScrollableX, isScrollableY, keyPressed, keyReleased, layoutContainer, paint, paintGlass, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replaceAndWait, revalidate, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, animate, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getSideGap, getStyle, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, handlesInput, hasFocus, initCustomStyle, isDragActivated, isFocusable, isFocusPainted, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setDirtyRegion, setDisabledStyle, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setStyle, setTactileTouch, setTensileDragEnabled, setUIID, setUnselectedStyle, setUnSelectedStyle, setVisible, setWidth, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContainerList

public ContainerList()
Default constructor


ContainerList

public ContainerList(ListModel m)
Constructs a container list with the given model

Parameters:
m - the model

ContainerList

public ContainerList(Layout l,
                     ListModel m)
Constructs a container list with the given model and layout

Parameters:
l - layout manager
m - the model
Method Detail

setRenderer

public void setRenderer(CellRenderer r)
The renderer used to draw the container list elements

Parameters:
r - renderer instance

getRenderer

public CellRenderer getRenderer()
The renderer used to draw the container list elements

Parameters:
r - renderer instance

getModel

public ListModel getModel()
Returns the list model

Returns:
the list model

addActionListener

public void addActionListener(ActionListener l)
Allows binding a listener to user selection actions

Parameters:
l - the action listener to be added

getActionListeners

public java.util.Vector getActionListeners()
This method allows extracting the action listeners from the current list

Returns:
vector containing the action listeners on the list

removeActionListener

public void removeActionListener(ActionListener l)
Allows binding a listener to user selection actions

Parameters:
l - the action listener to be removed

initComponent

protected void initComponent()
Description copied from class: Component
Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state

Overrides:
initComponent in class Component

setModel

public void setModel(ListModel model)
Set the model for the container list

Parameters:
model - a model class that is mapped into the internal components

getSelectedItem

public java.lang.Object getSelectedItem()
Returns the current/last selected item

Returns:
selected item or null