rcx.rcxtools.filebrowser
Class ListBrowser

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by rcx.rcxtools.filebrowser.ListBrowser
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class ListBrowser
extends java.awt.Panel
implements java.awt.event.AdjustmentListener

This class is a generic list browser.

Author:
Thierry.Kormann@sophia.inria.fr
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static int MULTIPLE
          The policy that enables a multiple selection of nodes.
static int SINGLE
          This policy that lets just one node selected at the same time.
 
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
ListBrowser(ListBrowserHandler handler)
          Constructs a new ListBrowser with the specified handler.
 
Method Summary
 void addNode(java.awt.Image image, java.awt.Image simage, java.lang.String name, java.lang.Object item)
          Adds a new node with the specified image, name and client data.
 void addNode(java.net.URL url, java.net.URL surl, java.lang.String name, java.lang.Object item)
          Adds a new node with the specified url, name and client data.
 void addNotify()
           
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt)
           
 ListNode getSelectedNode(int index)
          Gets the selected node at the specified index.
 int getSelectedNodeCount()
          Gets the number of selected node in this browser.
 int getSelectionPolicy()
          Gets the selection policy.
 void paint(java.awt.Graphics g)
           
 void removeAllNodes()
          Removes all nodes.
 void removeNode(ListNode node)
          Removes the specified node.
 void setFont(java.awt.Font font)
           
 void setIncrement(int inc)
          Sets the increment before each line to the specified value.
 void setSelected(ListNode node, boolean state)
          Sets the specified node selected or not, depending on the specified parameter.
 void setSelectionBackgroudColor(java.awt.Color color)
          Sets the background color of a selected node to the specified color.
 void setSelectionFontColor(java.awt.Color color)
          Sets the color of a selected node to the specified color.
 void setSelectionPolicy(int policy)
          Sets the selection policy.
 void setVerticalScrollbar(java.awt.Scrollbar vscroll)
          Sets the vertical scroll of this browser to the specified scroll bar.
 void unselectAll()
          Unselects all selected component.
 void update(java.awt.Graphics pg)
           
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SINGLE

public static final int SINGLE
This policy that lets just one node selected at the same time.

See Also:
Constant Field Values

MULTIPLE

public static final int MULTIPLE
The policy that enables a multiple selection of nodes.

See Also:
Constant Field Values
Constructor Detail

ListBrowser

public ListBrowser(ListBrowserHandler handler)
Constructs a new ListBrowser with the specified handler.

Parameters:
handler - the list handler to manage actions
Method Detail

setIncrement

public void setIncrement(int inc)
Sets the increment before each line to the specified value.

Parameters:
inc - the number of pixels before next line in the list

addNode

public void addNode(java.net.URL url,
                    java.net.URL surl,
                    java.lang.String name,
                    java.lang.Object item)
Adds a new node with the specified url, name and client data.

Parameters:
url - the icon url
surl - the selected icon url
name - the entry name
item - the client data

addNode

public void addNode(java.awt.Image image,
                    java.awt.Image simage,
                    java.lang.String name,
                    java.lang.Object item)
Adds a new node with the specified image, name and client data.

Parameters:
image - the icon
simage - the selected icon
name - the entry name
item - the client data

addNotify

public void addNotify()
Overrides:
addNotify in class java.awt.Panel

setVerticalScrollbar

public void setVerticalScrollbar(java.awt.Scrollbar vscroll)
Sets the vertical scroll of this browser to the specified scroll bar. The Browser becomes an AdjustmentListener of this scrollbar.

Parameters:
vscroll - the scrollbar

setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class java.awt.Container

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt)
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

update

public void update(java.awt.Graphics pg)
Overrides:
update in class java.awt.Container

paint

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

removeNode

public void removeNode(ListNode node)
Removes the specified node.

Parameters:
node - the node to remove

removeAllNodes

public void removeAllNodes()
Removes all nodes.


getSelectedNodeCount

public int getSelectedNodeCount()
Gets the number of selected node in this browser.


getSelectedNode

public ListNode getSelectedNode(int index)
Gets the selected node at the specified index.

Parameters:
index - the index of the selected node

unselectAll

public void unselectAll()
Unselects all selected component.


setSelectionPolicy

public void setSelectionPolicy(int policy)
Sets the selection policy.

Parameters:
policy: - SINGLE or MULTIPLE

getSelectionPolicy

public int getSelectionPolicy()
Gets the selection policy.


setSelectionFontColor

public void setSelectionFontColor(java.awt.Color color)
Sets the color of a selected node to the specified color.

Parameters:
color - the color used to paint a selected node

setSelectionBackgroudColor

public void setSelectionBackgroudColor(java.awt.Color color)
Sets the background color of a selected node to the specified color.

Parameters:
color - the color used to paint the background of a selected node

setSelected

public void setSelected(ListNode node,
                        boolean state)
Sets the specified node selected or not, depending on the specified parameter.

Parameters:
node - the node
state - if true, the node is selected, false implies the node is unselected