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.


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
 java.lang.String[] getPropertyNames()
          A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code
 java.lang.Class[] getPropertyTypes()
          Matches the property names method (see that method for further details).
 java.lang.Object getPropertyValue(java.lang.String name)
          Returns the current value of the property name, this method is used by the GUI builder
 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
 java.lang.String setPropertyValue(java.lang.String name, java.lang.Object value)
          Sets a new value to the given property, returns an error message if failed and null if successful.
 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, animateLayout, animateLayoutAndWait, applyRTL, calcPreferredSize, contains, dragInitiated, drop, findFirstFocusable, flushReplace, getBottomGap, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, invalidate, isEnabled, isScrollableX, isScrollableY, keyPressed, keyReleased, layoutContainer, paint, paintBackground, paintGlass, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, 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, dragEnter, dragExit, draggingOver, drawDraggedImage, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getVisibleBounds, getX, getY, growShrink, handlesInput, hasFocus, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, 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


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

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from class: Component
A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

Overrides:
getPropertyNames in class Component
Returns:
the property names allowing mutation

getPropertyTypes

public java.lang.Class[] getPropertyTypes()
Description copied from class: Component
Matches the property names method (see that method for further details).

Overrides:
getPropertyTypes in class Component
Returns:
the types of the properties

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Description copied from class: Component
Returns the current value of the property name, this method is used by the GUI builder

Overrides:
getPropertyValue in class Component
Parameters:
name - the name of the property
Returns:
the value of said property

setPropertyValue

public java.lang.String setPropertyValue(java.lang.String name,
                                         java.lang.Object value)
Description copied from class: Component
Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

Overrides:
setPropertyValue in class Component
Parameters:
name - the name of the property
value - new value for the property
Returns:
error message or null