Class Listor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--Listor

public class Listor
extends java.awt.Panel

This class is one big panel, that holds a "master row" at the top, with resizable labels, and then a bunch of data rows below it.

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Listor(int numc, int totalwidth)
           
 
Method Summary
 void addValues(java.lang.String[] vals)
          Add a new "data row" created around the string array passed in Note that the size of the array must exactly match the number of rows the Listor was created for.
 void clearHighlight(int rownum)
          simply unsets the "highlight" bit on the given data row.
 void clearHighlights()
           
 void clearValues()
          This drops all the "rows", but PRESERVES the column header names and sizes.
 int getHighlightedIndex()
          This will return the row number of the "first" row highlighted.
 java.lang.String[] getHighlightedRow()
          Similar to getHighlightedIndex, except returns the actual String[] that the first highlighted row contains.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
protected  void mouseClicked(java.awt.event.MouseEvent evt)
          This is "public", but should not be used publically private gets called by internal objects for mouseclicks.
 void resetCursor()
          Irritating workaround for race condition issue in parent container Panel.
 void setColName(int colnum, java.lang.String name)
          Set the name of a specific column.
 void setColWidth(int colnum, int width)
          Set the width of a specific column, different from the default.
 void setDataBG(java.awt.Color c)
          Set default "data row" background color, and also update any existing data rows.
 void setMasterBG(java.awt.Color c)
          Set "top row" background color
 void showUpdates()
          If you change the values in a pre-existing row, by changing values in the String[] array you passed to addValues(), then you will need to call this, to show your updated values.
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Listor

public Listor(int numc,
              int totalwidth)
Parameters:
numc - number of columns you want every datarow to have
totalwidth - full pixel width of the entire Listor object
Method Detail

showUpdates

public void showUpdates()
If you change the values in a pre-existing row, by changing values in the String[] array you passed to addValues(), then you will need to call this, to show your updated values.

getPreferredSize

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

getMinimumSize

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

mouseClicked

protected void mouseClicked(java.awt.event.MouseEvent evt)
This is "public", but should not be used publically private gets called by internal objects for mouseclicks. Changed to 'protected' to hide it from javadoc.

resetCursor

public void resetCursor()
Irritating workaround for race condition issue in parent container Panel. If we create rows while parent is in BUSY cursor... cursor for each row does not get reset to normal, when parent sets cursor to non-busy again!

clearHighlights

public void clearHighlights()

clearHighlight

public void clearHighlight(int rownum)
simply unsets the "highlight" bit on the given data row. It is not an error to call this on a row that was not already highlighted.

getHighlightedIndex

public int getHighlightedIndex()
This will return the row number of the "first" row highlighted. returns -1 if none highlighted. Use this in conjunction with clearHighlight to walk through the case of multiple lines highlighted

getHighlightedRow

public java.lang.String[] getHighlightedRow()
Similar to getHighlightedIndex, except returns the actual String[] that the first highlighted row contains. (or returns null, if non set)

clearValues

public void clearValues()
This drops all the "rows", but PRESERVES the column header names and sizes.

addValues

public void addValues(java.lang.String[] vals)
Add a new "data row" created around the string array passed in Note that the size of the array must exactly match the number of rows the Listor was created for. Note also that the array is passed by reference, not copied. Later changes to the values in the array, will affect the row created for it, although you will have to call showUpdates for the Listor object to show the new values.
Parameters:
vals - contains data for each column in the row/line

setMasterBG

public void setMasterBG(java.awt.Color c)
Set "top row" background color

setDataBG

public void setDataBG(java.awt.Color c)
Set default "data row" background color, and also update any existing data rows.

setColName

public void setColName(int colnum,
                       java.lang.String name)
Set the name of a specific column. This gets stored in the internal "master row"

setColWidth

public void setColWidth(int colnum,
                        int width)
Set the width of a specific column, different from the default. This gets stored in an instance-global array.