de.hedenus.mobilegui
Class ListSelection

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by de.hedenus.mobilegui.ListSelection
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class ListSelection
extends java.awt.Canvas
implements java.awt.ItemSelectable, java.awt.event.KeyListener, java.awt.event.FocusListener

A component which renders a list.

Author:
Michael Hedenus
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ListSelection()
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
           
 void addItemListener(java.awt.event.ItemListener l)
           
protected  void fireActionPerformed()
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 int getCellBorder()
           
 java.util.List getList()
           
 java.awt.Dimension getPreferredSize()
           
 int getRows()
           
 int getScrollPosition()
           
 java.lang.Object getSelectedItem()
           
 java.lang.Object[] getSelectedObjects()
           
 java.awt.Color getSelectionBackground()
           
 java.awt.Font getSelectionFont()
           
 java.awt.Color getSelectionForeground()
           
 int getSelectionPosition()
           
 int getVisibleRows()
          Returns the current number of visible rows (since last paint event).
 boolean isFocusTraversable()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void paint(java.awt.Graphics g)
           
 void removeActionListener(java.awt.event.ActionListener l)
           
 void removeItemListener(java.awt.event.ItemListener l)
           
protected  void scrollRowToVisible(int row)
           
 void setCellBorder(int cellBorder)
           
 void setList(java.util.List list)
           
 void setPreferredSize(java.awt.Dimension preferredSize)
           
 boolean setSelectedItem(java.lang.Object object)
           
 void setSelectionBackground(java.awt.Color selectionBackground)
           
 void setSelectionFont(java.awt.Font selectionFont)
           
 void setSelectionForeground(java.awt.Color selectionForeground)
           
 void setSelectionPosition(int selectionPosition)
           
protected  java.lang.String toString(java.util.List list, java.lang.Object item, int row, boolean selected)
          This method is used to get a string representation of a list item.
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListSelection

public ListSelection()
Method Detail

isFocusTraversable

public boolean isFocusTraversable()
Overrides:
isFocusTraversable in class java.awt.Component

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Canvas

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

toString

protected java.lang.String toString(java.util.List list,
                                    java.lang.Object item,
                                    int row,
                                    boolean selected)
This method is used to get a string representation of a list item. Override this method to customize the rendering of an item.

Parameters:
list -
item -
row -
selected -
Returns:
the string representation of the list item

setList

public void setList(java.util.List list)

getVisibleRows

public int getVisibleRows()
Returns the current number of visible rows (since last paint event).


getList

public java.util.List getList()

getCellBorder

public int getCellBorder()

setCellBorder

public void setCellBorder(int cellBorder)

getScrollPosition

public int getScrollPosition()

getRows

public int getRows()

getSelectionPosition

public int getSelectionPosition()

setSelectionPosition

public void setSelectionPosition(int selectionPosition)

scrollRowToVisible

protected void scrollRowToVisible(int row)

getSelectionBackground

public java.awt.Color getSelectionBackground()

setSelectionBackground

public void setSelectionBackground(java.awt.Color selectionBackground)

getSelectionForeground

public java.awt.Color getSelectionForeground()

setSelectionForeground

public void setSelectionForeground(java.awt.Color selectionForeground)

getSelectionFont

public java.awt.Font getSelectionFont()

setSelectionFont

public void setSelectionFont(java.awt.Font selectionFont)

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
Specified by:
addItemListener in interface java.awt.ItemSelectable

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
Specified by:
removeItemListener in interface java.awt.ItemSelectable

getSelectedItem

public java.lang.Object getSelectedItem()

setSelectedItem

public boolean setSelectedItem(java.lang.Object object)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable

addActionListener

public void addActionListener(java.awt.event.ActionListener l)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)

fireActionPerformed

protected void fireActionPerformed()

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Component

setPreferredSize

public void setPreferredSize(java.awt.Dimension preferredSize)
Overrides:
setPreferredSize in class java.awt.Component

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener