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
-
MultiColumnList(ObjectPainter[])
- Create a new list with the given columns.
-
MultiColumnList(ObjectPainter[], TRowDocument)
- Create a new list with the given columns, and attach the given data.
-
adjustmentValueChanged(AdjustmentEvent)
- Deal with scrollbar movement.
-
attach(TDocument)
- Attach the View to the Document.
-
componentHidden(ComponentEvent)
-
-
componentMoved(ComponentEvent)
-
-
componentResized(ComponentEvent)
- Called when this container gets resized.
-
componentShown(ComponentEvent)
-
-
countColumns()
- Returns the number of columns in the list.
-
detach(TDocument)
- Detach the View from the Document.
-
doubleClicked()
- Called when user double-clicks on item in list, or presses <cr>.
-
focusGained(FocusEvent)
- Change selection bar color if we get the focus.
-
focusLost(FocusEvent)
- Change selection bar color if we lose the focus.
-
getBarColor()
- BarColor - Color for the highlight bar.
-
getColors()
- Colors - the arry of colors (one per column) used to draw each column.
-
getDoubleClickTime()
- DoubleClickTime - microseconds between 2 mouse clicks for them to
be counted as a double-click.
-
getDragSensitivity()
- DragSensitivity - no of pixels either side of border where cursor
changes to allow dragging border.
-
getHeadingColor()
- HeadingColor - Color for the heading bar.
-
getMinimumWidth()
- MinimumWidth - minimum width of a column.
-
getWidths()
- Get the proportional widths of each column.
-
isAdjustable()
- Adjustable - true if use is allowed to drag borders to change column sizes.
-
isFocusTraversable()
- This Panel is a tabstop (can accept focus).
-
keyPressed(KeyEvent)
- Handle standard list keyboard stuff.
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
makeItemVisible(int)
- Make sure a given item in the list is visible on the screen.
-
mouseClicked(MouseEvent)
-
-
mouseDragged(MouseEvent)
- If a column is selected, change it's width.
-
mouseEntered(MouseEvent)
-
-
mouseExited(MouseEvent)
-
-
mouseMoved(MouseEvent)
- Change the mouse cursor if over a draggable column border.
-
mousePressed(MouseEvent)
- Select a list item or a column to drag.
-
mouseReleased(MouseEvent)
- Stop dragging a list column.
-
paint(Graphics)
- Blit the backing image to the front.
-
select(int)
- Select a given item in the list.
-
setAdjustable(boolean)
- Adjustable - true if use is allowed to drag borders to change column sizes.
-
setBarColor(Color)
- BarColor - Color for the highlight bar.
-
setColors(Color[])
- Set the array of colors used to draw each column.
-
setDoubleClickTime(int)
- DoubleClickTime - microseconds between 2 mouse clicks for them to
be counted as a double-click.
-
setDragSensitivity(int)
- DragSensitivity - no of pixels either side of border where cursor
changes to allow dragging border.
-
setEnable(boolean)
- Enable or disable the control.
-
setHeadingColor(Color)
- HeadingColor - Color for the heading bar.
-
setMinimumWidth(int)
- MinimumWidth - minimum width of a column.
-
setWidths(float[])
- Set the proportional widths of each column.
-
toString()
- Standard toString returns "DragGridPanel[x][y]" and Panel info.
-
update()
- The Document has changed - update the whole view.
-
update(Graphics)
- Called sometime after repaint().
-
update(Object)
-
Part of the Document has changed.
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.
MultiColumnList
public MultiColumnList(ObjectPainter t[])
- Create a new list with the given columns.
- Parameters:
- t - the array of ObjectPainters which will paint the columns.
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.
getWidths
public float[] getWidths()
- Get the proportional widths of each column.
- Returns:
- a float array containing the proportions (adds up to 1).
isAdjustable
public boolean isAdjustable()
- Adjustable - true if use is allowed to drag borders to change column sizes.
setAdjustable
public void setAdjustable(boolean on)
- Adjustable - true if use is allowed to drag borders to change column sizes.
getMinimumWidth
public int getMinimumWidth()
- MinimumWidth - minimum width of a column.
setMinimumWidth
public void setMinimumWidth(int width)
- MinimumWidth - minimum width of a column. Default 6.
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.
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.
getDoubleClickTime
public int getDoubleClickTime()
- DoubleClickTime - microseconds between 2 mouse clicks for them to
be counted as a double-click.
setDoubleClickTime
public void setDoubleClickTime(int t)
- DoubleClickTime - microseconds between 2 mouse clicks for them to
be counted as a double-click. Default 250.
getColors
public Color[] getColors()
- Colors - the arry of colors (one per column) used to draw each column.
May be null to default to foregroundColor.
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.
getHeadingColor
public Color getHeadingColor()
- HeadingColor - Color for the heading bar.
setHeadingColor
public void setHeadingColor(Color c)
- HeadingColor - Color for the heading bar. Defaults to background.
getBarColor
public Color getBarColor()
- BarColor - Color for the highlight bar.
setBarColor
public void setBarColor(Color c)
- BarColor - Color for the highlight bar. Default black.
countColumns
public int countColumns()
- Returns the number of columns in the list.
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.
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.
doubleClicked
public void doubleClicked()
- Called when user double-clicks on item in list, or presses <cr>.
update
public void update()
- The Document has changed - update the whole view.
update
public void update(Object o)
- Part of the Document has changed.
- Parameters:
- o - Object representing that part of the document
which has changed.
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.
detach
public synchronized void detach(TDocument d)
- Detach the View from the Document.
setEnable
public void setEnable(boolean enabled)
- Enable or disable the control.
paint
public void paint(Graphics g)
- Blit the backing image to the front.
- Overrides:
- paint in class Container
update
public void update(Graphics g)
- Called sometime after repaint().
- Overrides:
- update in class Container
isFocusTraversable
public boolean isFocusTraversable()
- This Panel is a tabstop (can accept focus).
- Overrides:
- isFocusTraversable in class Component
toString
public String toString()
- Standard toString returns "DragGridPanel[x][y]" and Panel info.
- Overrides:
- toString in class Component
mouseMoved
public void mouseMoved(MouseEvent e)
- Change the mouse cursor if over a draggable column border.
mousePressed
public void mousePressed(MouseEvent e)
- Select a list item or a column to drag.
mouseReleased
public void mouseReleased(MouseEvent e)
- Stop dragging a list column.
mouseClicked
public void mouseClicked(MouseEvent e)
mouseEntered
public void mouseEntered(MouseEvent e)
mouseExited
public void mouseExited(MouseEvent e)
mouseDragged
public void mouseDragged(MouseEvent e)
- If a column is selected, change it's width.
focusGained
public void focusGained(FocusEvent e)
- Change selection bar color if we get the focus.
focusLost
public void focusLost(FocusEvent e)
- Change selection bar color if we lose the focus.
keyPressed
public void keyPressed(KeyEvent e)
- Handle standard list keyboard stuff.
keyReleased
public void keyReleased(KeyEvent e)
keyTyped
public void keyTyped(KeyEvent e)
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
- Deal with scrollbar movement.
componentResized
public void componentResized(ComponentEvent e)
- Called when this container gets resized.
componentMoved
public void componentMoved(ComponentEvent e)
componentShown
public void componentShown(ComponentEvent e)
componentHidden
public void componentHidden(ComponentEvent e)
All Packages Class Hierarchy This Package Previous Next Index