All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.trumphurst.controls.MultiColumnList

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.trumphurst.controls.MultiColumnList

public class MultiColumnList
extends Panel
implements TView, MouseListener, MouseMotionListener, KeyListener, FocusListener, AdjustmentListener, ComponentListener
Multi column list or tree control with titles for each column and draggable widths. This is the user interface component (TView) only - the actual data is held in a TRowDocument or TTreeListDocument. The rendering of the data in each column is done by an ObjectPainter supplied to the constructor.

See Also:
TRowDocument, TTreeListDocument, ObjectPainter

Constructor Index

 o MultiColumnList(ObjectPainter[])
Create a new list with the given columns.
 o MultiColumnList(ObjectPainter[], TRowDocument)
Create a new list with the given columns, and attach the given data.

Method Index

 o adjustmentValueChanged(AdjustmentEvent)
Deal with scrollbar movement.
 o attach(TDocument)
Attach the View to the Document.
 o componentHidden(ComponentEvent)
 o componentMoved(ComponentEvent)
 o componentResized(ComponentEvent)
Called when this container gets resized.
 o componentShown(ComponentEvent)
 o countColumns()
Returns the number of columns in the list.
 o detach(TDocument)
Detach the View from the Document.
 o doubleClicked()
Called when user double-clicks on item in list, or presses <cr>.
 o focusGained(FocusEvent)
Change selection bar color if we get the focus.
 o focusLost(FocusEvent)
Change selection bar color if we lose the focus.
 o getBarColor()
BarColor - Color for the highlight bar.
 o getColors()
Colors - the arry of colors (one per column) used to draw each column.
 o getDoubleClickTime()
DoubleClickTime - microseconds between 2 mouse clicks for them to be counted as a double-click.
 o getDragSensitivity()
DragSensitivity - no of pixels either side of border where cursor changes to allow dragging border.
 o getHeadingColor()
HeadingColor - Color for the heading bar.
 o getMinimumWidth()
MinimumWidth - minimum width of a column.
 o getWidths()
Get the proportional widths of each column.
 o isAdjustable()
Adjustable - true if use is allowed to drag borders to change column sizes.
 o isFocusTraversable()
This Panel is a tabstop (can accept focus).
 o keyPressed(KeyEvent)
Handle standard list keyboard stuff.
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o makeItemVisible(int)
Make sure a given item in the list is visible on the screen.
 o mouseClicked(MouseEvent)
 o mouseDragged(MouseEvent)
If a column is selected, change it's width.
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mouseMoved(MouseEvent)
Change the mouse cursor if over a draggable column border.
 o mousePressed(MouseEvent)
Select a list item or a column to drag.
 o mouseReleased(MouseEvent)
Stop dragging a list column.
 o paint(Graphics)
Blit the backing image to the front.
 o select(int)
Select a given item in the list.
 o setAdjustable(boolean)
Adjustable - true if use is allowed to drag borders to change column sizes.
 o setBarColor(Color)
BarColor - Color for the highlight bar.
 o setColors(Color[])
Set the array of colors used to draw each column.
 o setDoubleClickTime(int)
DoubleClickTime - microseconds between 2 mouse clicks for them to be counted as a double-click.
 o setDragSensitivity(int)
DragSensitivity - no of pixels either side of border where cursor changes to allow dragging border.
 o setEnable(boolean)
Enable or disable the control.
 o setHeadingColor(Color)
HeadingColor - Color for the heading bar.
 o setMinimumWidth(int)
MinimumWidth - minimum width of a column.
 o setWidths(float[])
Set the proportional widths of each column.
 o toString()
Standard toString returns "DragGridPanel[x][y]" and Panel info.
 o update()
The Document has changed - update the whole view.
 o update(Graphics)
Called sometime after repaint().
 o update(Object)
Part of the Document has changed.

Constructors

 o MultiColumnList
 public MultiColumnList(ObjectPainter t[],
                        TRowDocument doc)
Create a new list with the given columns, and attach the given data.

Parameters:
t - the array of ObjectPainters which will paint the columns.
doc - the TDocument containing the data.
 o MultiColumnList
 public MultiColumnList(ObjectPainter t[])
Create a new list with the given columns.

Parameters:
t - the array of ObjectPainters which will paint the columns.

Methods

 o setWidths
 public void setWidths(float widths[])
Set the proportional widths of each column.

Parameters:
widths - the widths.
Throws: ArrayIndexOutOfBoundsException
if not enough widths are supplied.
 o getWidths
 public float[] getWidths()
Get the proportional widths of each column.

Returns:
a float array containing the proportions (adds up to 1).
 o isAdjustable
 public boolean isAdjustable()
Adjustable - true if use is allowed to drag borders to change column sizes.

 o setAdjustable
 public void setAdjustable(boolean on)
Adjustable - true if use is allowed to drag borders to change column sizes.

 o getMinimumWidth
 public int getMinimumWidth()
MinimumWidth - minimum width of a column.

 o setMinimumWidth
 public void setMinimumWidth(int width)
MinimumWidth - minimum width of a column. Default 6.

 o getDragSensitivity
 public int getDragSensitivity()
DragSensitivity - no of pixels either side of border where cursor changes to allow dragging border. If this is greater than MinimumWidth, it can get difficult to drag very small columns.

 o setDragSensitivity
 public void setDragSensitivity(int s)
DragSensitivity - no of pixels either side of border where cursor changes to allow dragging border. If this is greater than MinimumWidth, it can get difficult to drag very small columns. Default 3.

 o getDoubleClickTime
 public int getDoubleClickTime()
DoubleClickTime - microseconds between 2 mouse clicks for them to be counted as a double-click.

 o setDoubleClickTime
 public void setDoubleClickTime(int t)
DoubleClickTime - microseconds between 2 mouse clicks for them to be counted as a double-click. Default 250.

 o getColors
 public Color[] getColors()
Colors - the arry of colors (one per column) used to draw each column. May be null to default to foregroundColor.

 o setColors
 public void setColors(Color c[])
Set the array of colors used to draw each column.

Parameters:
c - The color array (in column order), or null to use the default foregroundColor.
 o getHeadingColor
 public Color getHeadingColor()
HeadingColor - Color for the heading bar.

 o setHeadingColor
 public void setHeadingColor(Color c)
HeadingColor - Color for the heading bar. Defaults to background.

 o getBarColor
 public Color getBarColor()
BarColor - Color for the highlight bar.

 o setBarColor
 public void setBarColor(Color c)
BarColor - Color for the highlight bar. Default black.

 o countColumns
 public int countColumns()
Returns the number of columns in the list.

 o select
 public void select(int sel)
Select a given item in the list.

Parameters:
sel - the item number to select. Will be adjusted if out of range.
 o makeItemVisible
 public void makeItemVisible(int sel)
Make sure a given item in the list is visible on the screen.

Parameters:
sel - the item number to make visible. Will be adjusted if out of range.
 o doubleClicked
 public void doubleClicked()
Called when user double-clicks on item in list, or presses <cr>.

 o update
 public void update()
The Document has changed - update the whole view.

 o update
 public void update(Object o)
Part of the Document has changed.

Parameters:
o - Object representing that part of the document which has changed.
 o attach
 public synchronized void attach(TDocument d)
Attach the View to the Document.

Parameters:
d - the Document.
Throws: ClassCastException
if the document isn't a TRowDocument.
 o detach
 public synchronized void detach(TDocument d)
Detach the View from the Document.

 o setEnable
 public void setEnable(boolean enabled)
Enable or disable the control.

 o paint
 public void paint(Graphics g)
Blit the backing image to the front.

Overrides:
paint in class Container
 o update
 public void update(Graphics g)
Called sometime after repaint().

Overrides:
update in class Container
 o isFocusTraversable
 public boolean isFocusTraversable()
This Panel is a tabstop (can accept focus).

Overrides:
isFocusTraversable in class Component
 o toString
 public String toString()
Standard toString returns "DragGridPanel[x][y]" and Panel info.

Overrides:
toString in class Component
 o mouseMoved
 public void mouseMoved(MouseEvent e)
Change the mouse cursor if over a draggable column border.

 o mousePressed
 public void mousePressed(MouseEvent e)
Select a list item or a column to drag.

 o mouseReleased
 public void mouseReleased(MouseEvent e)
Stop dragging a list column.

 o mouseClicked
 public void mouseClicked(MouseEvent e)
 o mouseEntered
 public void mouseEntered(MouseEvent e)
 o mouseExited
 public void mouseExited(MouseEvent e)
 o mouseDragged
 public void mouseDragged(MouseEvent e)
If a column is selected, change it's width.

 o focusGained
 public void focusGained(FocusEvent e)
Change selection bar color if we get the focus.

 o focusLost
 public void focusLost(FocusEvent e)
Change selection bar color if we lose the focus.

 o keyPressed
 public void keyPressed(KeyEvent e)
Handle standard list keyboard stuff.

 o keyReleased
 public void keyReleased(KeyEvent e)
 o keyTyped
 public void keyTyped(KeyEvent e)
 o adjustmentValueChanged
 public void adjustmentValueChanged(AdjustmentEvent e)
Deal with scrollbar movement.

 o componentResized
 public void componentResized(ComponentEvent e)
Called when this container gets resized.

 o componentMoved
 public void componentMoved(ComponentEvent e)
 o componentShown
 public void componentShown(ComponentEvent e)
 o componentHidden
 public void componentHidden(ComponentEvent e)

All Packages  Class Hierarchy  This Package  Previous  Next  Index