dog.gui
Class DList

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--dog.gui.DContainer
                    |
                    +--dog.gui.DList
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.beans.PropertyChangeListener, Referential, java.io.Serializable

public class DList
extends DContainer
implements java.awt.ItemSelectable, java.awt.event.AdjustmentListener, java.beans.PropertyChangeListener

A container for displaying and manipulating items.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int CENTER
          The centre column alignment.
protected  ItemCollator collator
          The item collator used to sort the items in this list.
protected  java.util.Hashtable columnMap
           
protected  java.util.Vector columns
          The columns in this list.
static int COLUMNS
          The items' fields are displayed in columns according to the column specifications in the list.
protected  java.text.DateFormat dateFormat
          The date formatter used to format dates in items.
static java.lang.String DEFAULT_COLUMN
          The default column name.
protected  java.util.Hashtable descendingMap
          The sort direction of the indices.
protected  boolean filled
          Is this list filled?
static int ICON
          Items are displayed as icons with the label below the icon.
protected  int indent
          The amount by which items in the tree are indented.
protected  java.util.Vector indices
          The sort indices and direction.
protected  Tree items
          The items in this list.
protected  boolean lastItemDeselectable
          Whether to allow the last selected item in the list to be deselected.
static int LEFT
          The left column alignment.
static int LIST_HORIZONTAL
          Items are displayed as entries with the label to the east of the icon and the icon rescaled to the text height.
static int LIST_VERTICAL
          Items are displayed as entries with the label to the east of the icon and the icon rescaled to the text height.
protected static java.awt.Dimension MINLARGEICONSIZE
          The minimum size for large icons (32x32).
protected static java.awt.Dimension MINSMALLICONSIZE
          The minimum size for small icons (16x16).
protected  int mode
          The mode of this view (LIST, FIELDS, or ICON).
protected  boolean multipleMode
          Whether to allow multiple selections.
static int RIGHT
          The right column alignment.
protected  boolean selectable
          Whether to allow items in the list to be selected.
protected  boolean showColumnLines
          Should vertical lines be drawn separating the columns?
protected  boolean showTreeLines
          Should tree lines be drawn to child items in a tree?
protected  boolean sorted
          Whether to sort this list.
protected  boolean suppressHorizontalScrollbar
          Whether to suppress the horizontal scrollbar.
protected  boolean suppressVerticalScrollbar
          Whether to suppress the vertical scrollbar, if necessary.
protected  TreeValidator treeValidator
          The object used to validate lazy items.
protected  DScrollbar vertical
          The vertical scrollbar.
 
Fields inherited from class dog.gui.DContainer
cancelButton, defaultButton, EAST, NORTH, NORTHEAST, NORTHWEST, reference, SOUTH, SOUTHEAST, SOUTHWEST, tooltip, WEST
 
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
DList()
          Constructs a list.
DList(boolean multipleMode)
          Constructs a list, indicating whether to allow multiple selections.
DList(boolean multipleMode, int mode)
          Constructs a list with the specified mode, indicating whether to allow multiple selections.
DList(int mode)
          Constructs a list with the specified mode.
 
Method Summary
 DItem add(DItem item)
          Adds an item to the list.
 DItem[] add(DItem[] items)
          Adds items to the list.
 DItem add(DItem parent, DItem child)
          Adds an item to the list as a child of the specified parent item.
 DItem[] add(DItem parent, DItem[] children)
          Adds items to the list as children of the specified parent item.
 void addActionListener(java.awt.event.ActionListener listener)
          Adds the specified action listener to receive action events from this list.
 void addColumn(java.lang.String name)
          Adds a column to the list with the specified name.
 void addColumn(java.lang.String name, int align)
          Adds a column to the list with the specified name and alignment.
 void addColumn(java.lang.String name, java.lang.Object content, int width, int align)
          Adds a column to the list with the specified name, content, width, and alignment.
 void addColumn(java.lang.String name, java.lang.String label)
          Adds a column to the list with the specified name and text label.
 void addColumn(java.lang.String name, java.lang.String label, int align)
          Adds a column to the list with the specified name, label, and alignment.
protected  void addImpl(java.awt.Component component, java.lang.Object constraints, int index)
          Adds a component to this list's view (unless it is a scrollbar or the view itself).
 void addIndex(java.lang.String column, boolean descending)
          Adds a sort index to the list.
 void addItemListener(java.awt.event.ItemListener listener)
          Adds the specified item listener to receive item events from this list.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds the specified vetoable change listener to receive vetoable change events from this component.
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
          A scrollbar was moved.
 void clear()
          Removes all items from the list.
 void collapseAll()
          Collapse all the items in the list.
 boolean contains(DItem item)
          Indicates whether this list contains the specified item.
 void doLayout()
          Lays out the scrollbars and content, calculating the column widths.
 void expandAll()
          Expand all the items in the list.
 int getChildCount(DItem parent)
          Returns the number of children of the specified parent item.
 DItem[] getChildren(DItem parent)
          Returns the children of the specified parent item.
 DItem[] getCollapsed()
          Returns the collapsed items in this list.
 java.lang.Object getColumn(java.lang.String column)
          Returns the content of the given column.
 int getColumnAlign(java.lang.String column)
          Returns the alignment of the given column (LEFT, CENTRE, or RIGHT), or -1 if the column does not exist.
 java.lang.String[] getColumnNames()
          Returns the names of the columns in this list.
 int getColumnWidth(java.lang.String column)
          Returns the width of the given column, or -1 if the column does not exist.
 DItem getCurrent()
          In single-select mode, returns the selected item in this list.
 java.lang.Object getCurrentReference()
          Returns the current item's reference.
 java.text.DateFormat getDateFormat()
          Returns the date formatter used to format dates in this list.
 int getDepth(DItem item)
          Returns the depth of the specified item in the hierarchical tree.
 int getFontStyle(DItem item)
          Returns the specified item's font style in this list.
 int getIndent()
          Returns the indentation of the items when displayed in tree form.
 java.lang.String[] getIndices()
          Returns the names of the columns that the list is sorted on.
 DItem getItem(java.lang.Object reference)
          Returns the item in this list with the specified reference, or null if no such item exists.
 int getItemCount()
          Returns the number of items in the list.
 DItem[] getItems()
          Returns all the items in the list.
 int getMode()
          Returns the mode this list displays its items according to.
 DItem getParent(DItem child)
          Returns the parent of the specified child item, or null if the child has no parent in this list.
 java.awt.Dimension getPreferredSize()
           
 java.lang.Object getReference()
          Returns the object reference.
 int getRootCount()
          Returns the number of root items in this list.
 DItem[] getRoots()
          Returns the root items in this list.
 DItem[] getSelected()
          Returns the selected items in this list.
 int getSelectedCount()
          Returns the number of selected items in this list.
 java.lang.Object[] getSelectedObjects()
          Returns the selected items in this list.
 TreeValidator getTreeValidator()
          Returns the tree validator used to validate lazy items.
 int getVisibleItemCount()
          Returns the number of items that can visually fit into the list view area.
 boolean hasChildren()
          Determines if this list contains items that are children of other items.
 boolean hasChildren(DItem parent)
          Indicates whether the specified parent item has any children.
 boolean isCollapsed(DItem item)
          Indicates whether the specified item is collapsed in this list.
 boolean isEnabled(DItem item)
          Indicates whether the specified item is enabled in this list.
 boolean isFilled()
          Indicates whether this list is filled.
 boolean isIndexDescending(java.lang.String column)
          Indicates whether the list is sorted in reverse order on the specified column.
 boolean isLastItemDeselectable()
          Indicates whether the last selected item in the list can be deselected.
 boolean isLazy(DItem item)
          Indicates whether the specified item is lazy in this list.
 boolean isMultipleMode()
          Indicates whether multiple items can be selected in the list.
 boolean isSelectable()
          Indicates whether items in the list can be selected.
 boolean isSelected(DItem item)
          Indicates whether the specified item is selected in this list.
 boolean isShowColumnLines()
          Indicates whether column lines are shown.
 boolean isShowTreeLines()
          Indicates whether tree lines are shown.
 boolean isSorted()
          Indicates whether this list is sorted.
 boolean isSuppressHorizontalScrollbar()
          Indicates whether this list suppresses the use of the horizontal scrollbar.
 boolean isSuppressVerticalScrollbar()
          Indicates whether this list suppresses the use of the vertical scrollbar.
 void moveColumn(java.lang.String column, int index)
          Moves the specified column in the list of columns.
 void paint(java.awt.Graphics g)
          Paints the list.
 java.lang.String paramString()
          Returns a shortish parameter string for the list.
protected  void processActionEvent(java.awt.event.ActionEvent event)
          Processes action events on this list by dispatching them to any registered ActionListeners.
protected  void processEvent(java.awt.AWTEvent event)
          Processes events on this list.
protected  void processItemEvent(java.awt.event.ItemEvent event)
          Processes item events on this list by dispatching them to any registered ItemListeners.
protected  void processMouseEvent(java.awt.event.MouseEvent event)
          Process mouse events.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent event)
          Process mouse motion events.
protected  void processSelection(DItem item, int modifiers, int clickCount)
          Processes an input event representing a selection.
 void propertyChange(java.beans.PropertyChangeEvent event)
          An item in this list changed state.
 DItem remove(DItem item)
          Removes an item from the list.
 DItem[] remove(DItem[] items)
          Removes items from the list.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes the specified action listener so that it no longer receives action events from this list.
 void removeAllColumns()
          Removes all the columns from the list.
 void removeAllIndices()
          Removes all the sort indices from the list.
 void removeChildren(DItem parent)
          Removes an item's children from the list.
 void removeColumn(java.lang.String column)
          Removes a column from the list.
 void removeIndex(java.lang.String column)
          Removes a sort index from the list.
 void removeItemListener(java.awt.event.ItemListener listener)
          Removes the specified item listener so that it no longer receives item events from this list.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes the specified vetoable change listener so it no longer receives vetoable change events from this component.
 DItem[] replace(DItem[] items)
          Convenience method for replacing all the items with the specified set.
 void scrollTo(DItem item)
          Scrolls the view so that the specified item is in sight, if it exists.
 DItem[] setCollapsed(DItem[] items, boolean flag)
          Set the specified items to be collapsed or expanded.
 DItem setCollapsed(DItem item, boolean flag)
          Sets the specified item to be collapsed or expanded.
 void setDateFormat(java.text.DateFormat dateFormat)
          Sets the date formatter used to format dates in this list.
 DItem[] setEnabled(DItem[] items, boolean flag)
          Set the specified items to be enabled or not.
 DItem setEnabled(DItem item, boolean flag)
          Sets the specified item to be enabled or not.
 void setFilled(boolean filled)
          Sets whether to fill this list with the fill colour.
 DItem[] setFontStyle(DItem[] items, int style)
          Set the specified items' font style.
 DItem setFontStyle(DItem item, int style)
          Sets the specified item's font style.
 void setIndent(int indent)
          Sets the indentation of the items when displayed in tree form.
 void setLastItemDeselectable(boolean flag)
          Sets whether to allow the last selected item in the list to be deselected.
 DItem[] setLazy(DItem[] items, boolean flag)
          Set the specified items to be lazy or not.
 DItem setLazy(DItem item, boolean flag)
          Sets the specified item to be lazy or not.
 void setMode(int mode)
          Sets the mode this list displays its items according to.
 void setMultipleMode(boolean flag)
          Sets whether to allow selection of multiple items in the list.
 void setReference(java.lang.Object reference)
          Sets the object reference.
 void setSelectable(boolean flag)
          Sets whether to allow items in the list to be selected.
 DItem[] setSelected(DItem[] items, boolean flag)
          Set the specified items to be selected or unselected.
 DItem setSelected(DItem item, boolean flag)
          Sets the specified item to be selected or unselected.
 void setShowColumnLines(boolean flag)
          Sets whether to show column lines.
 void setShowTreeLines(boolean flag)
          Sets whether to show tree lines.
 void setSorted(boolean flag)
          Sets whether to sort this list.
 void setSuppressHorizontalScrollbar(boolean flag)
          Sets whether to suppress the horizontal scrollbar.
 void setSuppressVerticalScrollbar(boolean flag)
          Sets whether to suppress the vertical scrollbar.
 void setTreeValidator(TreeValidator validator)
          Sets the tree validator used to validate lazy items.
 
Methods inherited from class dog.gui.DContainer
addPropertyChangeListener, alignParamString, drawActiveButtonBorder, drawActiveOptionBorder, drawArrow, drawBorder, drawButtonBorder, drawCheckbox, drawDarkBorder, drawDefaultButtonBorder, drawDisabledBorder, drawDisabledCheckbox, drawDisabledOption, drawExpander, drawFocusBorder, drawImage, drawLabel, drawOption, drawOptionBorder, drawPressedBorder, getCancelButton, getComponent, getDefaultButton, getDefaultToolkit, getImage, getImage, getImage, getRootPane, getTooltip, isPreloadImages, processCancelAction, processDefaultAction, removePropertyChangeListener, setCancelButton, setDefaultButton, setEnabled, setPreloadImages, setTooltip, toString
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LIST_VERTICAL

public static final int LIST_VERTICAL
Items are displayed as entries with the label to the east of the icon and the icon rescaled to the text height. They are laid out vertically; a vertical scrollbar is normally used when there are too many items to be visible in the list.

LIST_HORIZONTAL

public static final int LIST_HORIZONTAL
Items are displayed as entries with the label to the east of the icon and the icon rescaled to the text height. They are laid out vertically, wrapping into the next column when they reach the bottom of the visible area; a horizontal scrollbar is normally used when there are too many items to be visible in the list.

MINSMALLICONSIZE

protected static final java.awt.Dimension MINSMALLICONSIZE
The minimum size for small icons (16x16).

MINLARGEICONSIZE

protected static final java.awt.Dimension MINLARGEICONSIZE
The minimum size for large icons (32x32).

COLUMNS

public static final int COLUMNS
The items' fields are displayed in columns according to the column specifications in the list. If the items are in a tree or have icons, the tree and icons are displayed in the default column.
See Also:
getColumnNames(), getColumn(String), getColumnWidth(String), getColumnAlign(String), DEFAULT_COLUMN

ICON

public static final int ICON
Items are displayed as icons with the label below the icon.

LEFT

public static final int LEFT
The left column alignment.

CENTER

public static final int CENTER
The centre column alignment.

RIGHT

public static final int RIGHT
The right column alignment.

mode

protected int mode
The mode of this view (LIST, FIELDS, or ICON).
See Also:
getMode(), setMode(int)

indent

protected int indent
The amount by which items in the tree are indented.
See Also:
getIndent(), setIndent(int)

multipleMode

protected boolean multipleMode
Whether to allow multiple selections.
See Also:
isMultipleMode(), setMultipleMode(boolean)

filled

protected boolean filled
Is this list filled?
See Also:
isFilled(), setFilled(boolean)

showColumnLines

protected boolean showColumnLines
Should vertical lines be drawn separating the columns?
See Also:
isShowColumnLines(), setShowColumnLines(boolean)

showTreeLines

protected boolean showTreeLines
Should tree lines be drawn to child items in a tree?
See Also:
isShowTreeLines(), setShowTreeLines(boolean)

selectable

protected boolean selectable
Whether to allow items in the list to be selected.
See Also:
isSelectable(), setSelectable(boolean)

lastItemDeselectable

protected boolean lastItemDeselectable
Whether to allow the last selected item in the list to be deselected.
See Also:
isLastItemDeselectable(), setLastItemDeselectable(boolean)

suppressHorizontalScrollbar

protected boolean suppressHorizontalScrollbar
Whether to suppress the horizontal scrollbar.
See Also:
isSuppressHorizontalScrollbar(), setSuppressHorizontalScrollbar(boolean)

suppressVerticalScrollbar

protected boolean suppressVerticalScrollbar
Whether to suppress the vertical scrollbar, if necessary.
See Also:
isSuppressVerticalScrollbar(), setSuppressVerticalScrollbar(boolean)

vertical

protected DScrollbar vertical
The vertical scrollbar.

items

protected Tree items
The items in this list.

treeValidator

protected TreeValidator treeValidator
The object used to validate lazy items.

dateFormat

protected java.text.DateFormat dateFormat
The date formatter used to format dates in items.

columns

protected java.util.Vector columns
The columns in this list.

columnMap

protected java.util.Hashtable columnMap

DEFAULT_COLUMN

public static final java.lang.String DEFAULT_COLUMN
The default column name.

sorted

protected boolean sorted
Whether to sort this list.

indices

protected java.util.Vector indices
The sort indices and direction.

descendingMap

protected java.util.Hashtable descendingMap
The sort direction of the indices.

collator

protected ItemCollator collator
The item collator used to sort the items in this list.
Constructor Detail

DList

public DList()
Constructs a list.

DList

public DList(boolean multipleMode)
Constructs a list, indicating whether to allow multiple selections.
Parameters:
multipleMode - true if multiple selections are to be allowed, false otherwise.

DList

public DList(int mode)
Constructs a list with the specified mode.
Parameters:
mode - the mode of the list (LIST_VERTICAL, LIST_HORIZONTAL, COLUMNS, or ICON).

DList

public DList(boolean multipleMode,
             int mode)
Constructs a list with the specified mode, indicating whether to allow multiple selections.
Parameters:
multipleMode - true if multiple selections are to be allowed, false otherwise.
mode - the mode of the list (LIST_VERTICAL, LIST_HORIZONTAL, COLUMNS, or ICON).
Method Detail

getMode

public int getMode()
Returns the mode this list displays its items according to. Valid values are LIST_VERTICAL, LIST_HORIZONTAL, COLUMNS, and ICON.
See Also:
setMode(int)

setMode

public void setMode(int mode)
Sets the mode this list displays its items according to.
Parameters:
mode - LIST_VERTICAL, LIST_HORIZONTAL, COLUMNS, or ICON.
Throws:
java.lang.IllegalArgumentException - if an invalid mode is supplied
See Also:
getMode()

getIndent

public int getIndent()
Returns the indentation of the items when displayed in tree form. A negative value indicates that the indentation is calculated automatically.
See Also:
setIndent(int)

setIndent

public void setIndent(int indent)
Sets the indentation of the items when displayed in tree form. A negative value indicates that the indentation is to be calculated automatically.
See Also:
getIndent()

isMultipleMode

public boolean isMultipleMode()
Indicates whether multiple items can be selected in the list.
See Also:
setMultipleMode(boolean)

setMultipleMode

public void setMultipleMode(boolean flag)
Sets whether to allow selection of multiple items in the list.
See Also:
isMultipleMode()

isLastItemDeselectable

public boolean isLastItemDeselectable()
Indicates whether the last selected item in the list can be deselected.
See Also:
setLastItemDeselectable(boolean)

setLastItemDeselectable

public void setLastItemDeselectable(boolean flag)
Sets whether to allow the last selected item in the list to be deselected. By default, a list should always have at least one selection.
See Also:
isLastItemDeselectable()

isSelectable

public boolean isSelectable()
Indicates whether items in the list can be selected.
See Also:
setSelectable(boolean)

setSelectable

public void setSelectable(boolean flag)
Sets whether to allow items in the list to be selected.
See Also:
isSelectable()

isSuppressHorizontalScrollbar

public boolean isSuppressHorizontalScrollbar()
Indicates whether this list suppresses the use of the horizontal scrollbar. Normally a horizontal scrollbar is used when the items are too wide to be fully visible.
See Also:
setSuppressHorizontalScrollbar(boolean)

setSuppressHorizontalScrollbar

public void setSuppressHorizontalScrollbar(boolean flag)
Sets whether to suppress the horizontal scrollbar.
See Also:
isSuppressHorizontalScrollbar()

isSuppressVerticalScrollbar

public boolean isSuppressVerticalScrollbar()
Indicates whether this list suppresses the use of the vertical scrollbar. Normally a vertical scrollbar is used when there are too many items to fit in the visible area of the list.
See Also:
setSuppressVerticalScrollbar(boolean)

setSuppressVerticalScrollbar

public void setSuppressVerticalScrollbar(boolean flag)
Sets whether to suppress the vertical scrollbar.
See Also:
isSuppressVerticalScrollbar()

isFilled

public boolean isFilled()
Indicates whether this list is filled.

setFilled

public void setFilled(boolean filled)
Sets whether to fill this list with the fill colour.

isShowColumnLines

public boolean isShowColumnLines()
Indicates whether column lines are shown.

setShowColumnLines

public void setShowColumnLines(boolean flag)
Sets whether to show column lines.

isShowTreeLines

public boolean isShowTreeLines()
Indicates whether tree lines are shown.

setShowTreeLines

public void setShowTreeLines(boolean flag)
Sets whether to show tree lines.

getDateFormat

public java.text.DateFormat getDateFormat()
Returns the date formatter used to format dates in this list.

setDateFormat

public void setDateFormat(java.text.DateFormat dateFormat)
Sets the date formatter used to format dates in this list.

addImpl

protected void addImpl(java.awt.Component component,
                       java.lang.Object constraints,
                       int index)
Adds a component to this list's view (unless it is a scrollbar or the view itself).
Overrides:
addImpl in class DContainer

getItems

public DItem[] getItems()
Returns all the items in the list.

getItemCount

public int getItemCount()
Returns the number of items in the list.

getItem

public DItem getItem(java.lang.Object reference)
Returns the item in this list with the specified reference, or null if no such item exists. This method wil not return an item with a null reference.

hasChildren

public boolean hasChildren()
Determines if this list contains items that are children of other items.

getChildren

public DItem[] getChildren(DItem parent)
Returns the children of the specified parent item.
Parameters:
parent - the parent item

hasChildren

public boolean hasChildren(DItem parent)
Indicates whether the specified parent item has any children.
Parameters:
parent - the parent item

getChildCount

public int getChildCount(DItem parent)
Returns the number of children of the specified parent item.
Parameters:
parent - the parent item

getParent

public DItem getParent(DItem child)
Returns the parent of the specified child item, or null if the child has no parent in this list.
Parameters:
child - the child item

getDepth

public int getDepth(DItem item)
Returns the depth of the specified item in the hierarchical tree. Top-level items have a depth of 1. If the item is not in this list, this method returns 0.

getRoots

public DItem[] getRoots()
Returns the root items in this list. Root items are items that have no parents.

getRootCount

public int getRootCount()
Returns the number of root items in this list. Root items are items that have no parents.

contains

public boolean contains(DItem item)
Indicates whether this list contains the specified item.

add

public DItem add(DItem item)
Adds an item to the list. Returns the added item.
Parameters:
item - the item to add
See Also:
remove(dog.gui.DItem)

add

public DItem add(DItem parent,
                 DItem child)
Adds an item to the list as a child of the specified parent item. The parent item must already exist in the list. Returns the added child.
See Also:
remove(dog.gui.DItem), getChildren(DItem), getParent(DItem), getRoots()

add

public DItem[] add(DItem[] items)
Adds items to the list. Returns the list of items.
See Also:
remove(dog.gui.DItem)

add

public DItem[] add(DItem parent,
                   DItem[] children)
Adds items to the list as children of the specified parent item. The parent item must already exist in the list. Returns the list of children.
See Also:
remove(dog.gui.DItem)

replace

public DItem[] replace(DItem[] items)
Convenience method for replacing all the items with the specified set. This allows for reordering, etc.
Parameters:
items - the new set of items

remove

public DItem remove(DItem item)
Removes an item from the list. If it has any children, these are also removed from the list. Returns the item.
See Also:
add(DItem), removeChildren(DItem)

remove

public DItem[] remove(DItem[] items)
Removes items from the list. If they have any children, these are also removed from the list. Returns the list of items.
See Also:
add(DItem), removeChildren(DItem)

clear

public void clear()
Removes all items from the list.

removeChildren

public void removeChildren(DItem parent)
Removes an item's children from the list.
See Also:
remove(DItem)

isSelected

public boolean isSelected(DItem item)
Indicates whether the specified item is selected in this list.
See Also:
getSelected(), setSelected(dog.gui.DItem, boolean)

setSelected

public DItem setSelected(DItem item,
                         boolean flag)
Sets the specified item to be selected or unselected. Returns the item if its selected state was changed, null otherwise.
Parameters:
flag - true if the item is to be selected, false otherwise
See Also:
getSelected(), isSelected(dog.gui.DItem)

setSelected

public DItem[] setSelected(DItem[] items,
                           boolean flag)
Set the specified items to be selected or unselected. Returns a list of items that were changed.
Parameters:
flag - true if the items are to be selected, false otherwise
See Also:
getSelected(), isSelected(dog.gui.DItem)

getSelected

public DItem[] getSelected()
Returns the selected items in this list.
See Also:
getSelectedCount(), isSelected(dog.gui.DItem), setSelected(dog.gui.DItem, boolean)

getSelectedCount

public int getSelectedCount()
Returns the number of selected items in this list.
See Also:
getSelected()

getCurrent

public DItem getCurrent()
In single-select mode, returns the selected item in this list. In multi-select mode, returns either the last item selected by the user or the first selected item in the tree.
See Also:
getCurrentReference()

getCurrentReference

public java.lang.Object getCurrentReference()
Returns the current item's reference.
See Also:
getCurrent()

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Returns the selected items in this list. This method is semantically equivalent to getSelected(), which may be more useful, and is included only to implement ItemSelectable.
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable
See Also:
getSelected(), getSelectedCount()

isCollapsed

public boolean isCollapsed(DItem item)
Indicates whether the specified item is collapsed in this list. This returns true if the item is lazy.

setCollapsed

public DItem setCollapsed(DItem item,
                          boolean flag)
Sets the specified item to be collapsed or expanded. Returns the item if its collapsed state was changed, null otherwise.
Parameters:
flag - true if the item is to be collapsed, false if it is to be expanded

setCollapsed

public DItem[] setCollapsed(DItem[] items,
                            boolean flag)
Set the specified items to be collapsed or expanded. Returns a list of items that were changed.
Parameters:
flag - true if the items are to be collapsed, false if they are to be expanded

collapseAll

public void collapseAll()
Collapse all the items in the list.

expandAll

public void expandAll()
Expand all the items in the list.

getCollapsed

public DItem[] getCollapsed()
Returns the collapsed items in this list.

isLazy

public boolean isLazy(DItem item)
Indicates whether the specified item is lazy in this list.

setLazy

public DItem setLazy(DItem item,
                     boolean flag)
Sets the specified item to be lazy or not. Returns the item if its lazy state was changed, null otherwise.
Parameters:
flag - true if the item is to be lazy, false otherwise

setLazy

public DItem[] setLazy(DItem[] items,
                       boolean flag)
Set the specified items to be lazy or not. Returns a list of items that were changed.
Parameters:
flag - true if the items are to be lazy, false otherwise

isEnabled

public boolean isEnabled(DItem item)
Indicates whether the specified item is enabled in this list.

setEnabled

public DItem setEnabled(DItem item,
                        boolean flag)
Sets the specified item to be enabled or not. Returns the item if its enabled state was changed, null otherwise.
Parameters:
flag - true if the item is to be enabled, false otherwise

setEnabled

public DItem[] setEnabled(DItem[] items,
                          boolean flag)
Set the specified items to be enabled or not. Returns a list of items that were changed.
Parameters:
flag - true if the items are to be enabled, false otherwise

getFontStyle

public int getFontStyle(DItem item)
Returns the specified item's font style in this list. A value of -1 indicates that the item inherits its font style from the list.
See Also:
Font

setFontStyle

public DItem setFontStyle(DItem item,
                          int style)
Sets the specified item's font style. Returns the item if its font style was changed, null otherwise.
Parameters:
style - the font style
See Also:
Font

setFontStyle

public DItem[] setFontStyle(DItem[] items,
                            int style)
Set the specified items' font style. Returns a list of items that were changed.
Parameters:
style - the font style
See Also:
Font

scrollTo

public void scrollTo(DItem item)
Scrolls the view so that the specified item is in sight, if it exists.
Parameters:
item - the item

getTreeValidator

public TreeValidator getTreeValidator()
Returns the tree validator used to validate lazy items.

setTreeValidator

public void setTreeValidator(TreeValidator validator)
Sets the tree validator used to validate lazy items.
Parameters:
validator - the tree validator used to validate lazy items

getVisibleItemCount

public int getVisibleItemCount()
Returns the number of items that can visually fit into the list view area. NB this method will return 0 if the list is not visible.

getColumnNames

public java.lang.String[] getColumnNames()
Returns the names of the columns in this list.

getColumn

public java.lang.Object getColumn(java.lang.String column)
Returns the content of the given column.
Parameters:
column - the column name

getColumnWidth

public int getColumnWidth(java.lang.String column)
Returns the width of the given column, or -1 if the column does not exist.
Parameters:
column - the column name

getColumnAlign

public int getColumnAlign(java.lang.String column)
Returns the alignment of the given column (LEFT, CENTRE, or RIGHT), or -1 if the column does not exist.
Parameters:
column - the column name

addColumn

public void addColumn(java.lang.String name)
Adds a column to the list with the specified name. The column name is also used as the text label for the column.
Parameters:
name - the column name

addColumn

public void addColumn(java.lang.String name,
                      int align)
Adds a column to the list with the specified name and alignment. The column name is also used as the text label for the column.
Parameters:
name - the column name
align - the alignment of the column (LEFT, CENTRE, or RIGHT)

addColumn

public void addColumn(java.lang.String name,
                      java.lang.String label)
Adds a column to the list with the specified name and text label.
Parameters:
name - the column name
label - the column label

addColumn

public void addColumn(java.lang.String name,
                      java.lang.String label,
                      int align)
Adds a column to the list with the specified name, label, and alignment.
Parameters:
name - the column name
label - the column label
align - the alignment of the column (LEFT, CENTRE, or RIGHT)

addColumn

public void addColumn(java.lang.String name,
                      java.lang.Object content,
                      int width,
                      int align)
Adds a column to the list with the specified name, content, width, and alignment. The list can render the following Java objects as column headers:
Parameters:
name - the column name
content - the column content
width - the width of the column; values less than or equal to zero specify that the column is to be resized dynamically
align - the alignment of the column (LEFT, CENTRE, or RIGHT)

removeColumn

public void removeColumn(java.lang.String column)
Removes a column from the list. This also removes the associated index if one exists.
Parameters:
column - the column name

removeAllColumns

public void removeAllColumns()
Removes all the columns from the list. This also removes all the indices.

moveColumn

public void moveColumn(java.lang.String column,
                       int index)
Moves the specified column in the list of columns.
Parameters:
column - the column name
index - the index to move to

isSorted

public boolean isSorted()
Indicates whether this list is sorted.
See Also:
setSorted(boolean), getIndices()

setSorted

public void setSorted(boolean flag)
Sets whether to sort this list. The list is sorted according to the following rules:
  1. in COLUMNS mode, items are sorted on their fields according to the sort indices defined. If no sort indices are defined, the list is sorted on the default column in ascending order.
  2. in other modes, items are sorted on their labels in ascending order, independently of any indices defined.
See Also:
isSorted(), addIndex(java.lang.String, boolean)

getIndices

public java.lang.String[] getIndices()
Returns the names of the columns that the list is sorted on.

isIndexDescending

public boolean isIndexDescending(java.lang.String column)
Indicates whether the list is sorted in reverse order on the specified column.
Parameters:
column - the column name

addIndex

public void addIndex(java.lang.String column,
                     boolean descending)
Adds a sort index to the list. If the column does not currently exist in the list, the indices are unchanged.
Parameters:
column - the name of the column to sort on
descending - if true, sort on this column in the reverse order

removeIndex

public void removeIndex(java.lang.String column)
Removes a sort index from the list.
Parameters:
column - the name of the column not to sort on

removeAllIndices

public void removeAllIndices()
Removes all the sort indices from the list. The list will be sorted on the default column.

getReference

public java.lang.Object getReference()
Returns the object reference.
Overrides:
getReference in class DContainer

setReference

public void setReference(java.lang.Object reference)
Sets the object reference.
Overrides:
setReference in class DContainer
Parameters:
reference - the object reference to store.

getPreferredSize

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

doLayout

public void doLayout()
Lays out the scrollbars and content, calculating the column widths.
Overrides:
doLayout in class java.awt.Container

paint

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

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener to receive action events from this list.
Parameters:
listener - the action listener

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener so that it no longer receives action events from this list.
Parameters:
listener - the action listener

addItemListener

public void addItemListener(java.awt.event.ItemListener listener)
Adds the specified item listener to receive item events from this list.
Specified by:
addItemListener in interface java.awt.ItemSelectable
Parameters:
listener - the item listener

removeItemListener

public void removeItemListener(java.awt.event.ItemListener listener)
Removes the specified item listener so that it no longer receives item events from this list.
Specified by:
removeItemListener in interface java.awt.ItemSelectable
Parameters:
listener - the item listener

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the specified vetoable change listener to receive vetoable change events from this component.
Parameters:
listener - the vetoable change listener

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the specified vetoable change listener so it no longer receives vetoable change events from this component.
Parameters:
listener - the vetoable change listener

processEvent

protected void processEvent(java.awt.AWTEvent event)
Processes events on this list. If the event is an ActionEvent, it invokes the processActionEvent method. If the event is an ItemEvent, it invokes the processItemEvent method.
Overrides:
processEvent in class DContainer
Parameters:
event - the event

processActionEvent

protected void processActionEvent(java.awt.event.ActionEvent event)
Processes action events on this list by dispatching them to any registered ActionListeners.
Parameters:
event - the action event

processItemEvent

protected void processItemEvent(java.awt.event.ItemEvent event)
Processes item events on this list by dispatching them to any registered ItemListeners.
Parameters:
event - the item event

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent event)
Process mouse events.
Overrides:
processMouseEvent in class DContainer

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent event)
Process mouse motion events.
Overrides:
processMouseMotionEvent in class DContainer

processSelection

protected void processSelection(DItem item,
                                int modifiers,
                                int clickCount)
Processes an input event representing a selection. Can be overridden not to select the item.
Parameters:
item - the item that was activated
modifiers - the key modifiers for the event
clickCount - the number of clicks registered on the item

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
An item in this list changed state.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
A scrollbar was moved.
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

paramString

public java.lang.String paramString()
Returns a shortish parameter string for the list.
Overrides:
paramString in class DContainer