org.jdesktop.jdnc
Class JNTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.jdesktop.jdnc.JNComponent
                      extended by org.jdesktop.jdnc.JNTable
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.DesignMode, java.io.Serializable, javax.accessibility.Accessible, Targetable, MessageSource
Direct Known Subclasses:
JNTreeTable

public class JNTable
extends JNComponent

High level table component which displays tabular data from a data model in a scrollable view.

Author:
Ramesh Gupta, Amy Fowler
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 int DEFAULT_COLUMN_MARGIN
          The default margin between columns TODO It seems like this is ok, but needs to be somewhat influenced by the laf?
 int DEFAULT_ROW_HEIGHT
          The default row height for rows in this JNTable.
 int DEFAULT_ROW_MARGIN
          The default margin between rows TODO It seems like this is ok, but needs to be somewhat influenced by the laf?
 int DEFAULT_VISIBLE_ROW_COUNT
          TODO It seems like this is ok, but needs to be somewhat influenced by the laf?
protected  JXTable jxtable
          The JXTable being wrapped by this JNTable.
protected  javax.swing.JScrollPane scrollPane
          The JNTable automatically places the table component into this scrollPane
 
Fields inherited from class org.jdesktop.jdnc.JNComponent
dataField, dataSource, image, support, toolBar
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
  JNTable()
          Constructs a JNTable component with a DefaultTableModel instance as the data model.
protected JNTable(javax.swing.JTable jxtable)
           
  JNTable(javax.swing.table.TableModel model)
          Constructs a JNTable component that displays a row/column view for the specified data model.
  JNTable(java.net.URL url)
          Constructs a JNTable loaded with data from the URL.
 
Method Summary
 void addColumn(TableColumnExt column)
          Adds the specified view column to this table
 TableColumnExt getColumn(int currentViewIndex)
          Returns the column which is currently located at the specified column view index.
 TableColumnExt getColumn(java.lang.String name)
           
 java.awt.Color getColumnBackground(java.lang.String columnName)
           
 java.lang.Class getColumnClass(java.lang.String columnName)
          Convenience method for obtaining the class of a named column in the table.
 java.awt.Font getColumnFont(java.lang.String columnName)
           
 java.awt.Color getColumnForeground(java.lang.String columnName)
           
 int getColumnHorizontalAlignment(java.lang.String columnName)
           
 int getColumnMargin()
           
 java.lang.Object getColumnPrototypeValue(java.lang.String columnName)
           
 java.awt.Color getEvenRowBackground()
           
 FilterPipeline getFilters()
           
 boolean getHasColumnControl()
           
 java.awt.Color getHeaderBackground()
           
 java.awt.Font getHeaderFont()
           
 java.awt.Color getHeaderForeground()
           
 javax.swing.Icon getHeaderSortDownIcon()
           
 javax.swing.Icon getHeaderSortUpIcon()
           
 HighlighterPipeline getHighlighters()
           
 javax.swing.table.TableModel getModel()
           
 java.awt.Color getOddRowBackground()
           
 int getPreferredVisibleRowCount()
           
 int getRowHeight()
           
 int getRowMargin()
           
 int getSelectionMode()
           
 boolean getShowHorizontalLines()
           
 boolean getShowVerticalLines()
           
 JXTable getTable()
           
protected  javax.swing.table.TableColumn initRowHeader()
           
 boolean isRowHeaderLocked()
           
protected  void lockRowHeader()
           
 boolean print()
           
 void removeColumn(TableColumnExt column)
          Removes the specified column from this JNTable
 void setBackground(java.awt.Color color)
           
 void setColumnBackground(java.lang.String columnName, java.awt.Color background)
          Sets the background color for all cells in the specified named column.
 void setColumnFont(java.lang.String columnName, java.awt.Font font)
          Sets the font for all text rendering of cells in the specified named column.
 void setColumnForeground(java.lang.String columnName, java.awt.Color foreground)
          Sets the foreground color for all cells in the specified named column.
 void setColumnHorizontalAlignment(java.lang.String columnName, int alignment)
          Sets the horizontal alignment of content rendered inside cells in the specified named column.
 void setColumnMargin(int value)
           
 void setColumnPrototypeValue(java.lang.String columnName, java.lang.Object prototype)
          Sets the prototype value for the specified named column.
 void setColumnSequence(java.lang.String[] columnNames)
          reorders the columns in the sequence given array.
 void setEvenRowBackground(java.awt.Color color)
          Sets the background color for even rows in the table.
 void setFilters(FilterPipeline pipeline)
           
 void setFont(java.awt.Font font)
           
 void setForeground(java.awt.Color color)
           
 void setGridColor(java.awt.Color color)
           
 void setHasColumnControl(boolean hasControl)
          Sets whether the column control should be made visible.
 void setHeaderBackground(java.awt.Color headerBackground)
          Sets the background of the table's column headers to the specified color.
 void setHeaderFont(java.awt.Font headerFont)
          Sets the font of the table's column headers to the specified font.
 void setHeaderForeground(java.awt.Color headerForeground)
          Sets the foreground of the table's column headers to the specified color.
 void setHeaderSortDownIcon(javax.swing.Icon downIcon)
          Sets the icon which is displayed in a column's header when it has been sorted in descending order.
 void setHeaderSortUpIcon(javax.swing.Icon upIcon)
          Sets the icon which is displayed in a column's header when it has been sorted in ascending order.
 void setHighlighters(HighlighterPipeline pipeline)
           
 void setModel(javax.swing.table.TableModel model)
          Set the model for the table.
 void setOddRowBackground(java.awt.Color color)
          Sets the background color for odd rows in the table.
 void setPreferredVisibleRowCount(int value)
          Sets the number of visible rows which should be displayed in the scrollable view when the table is first shown.
 void setRowHeaderLocked(boolean lockState)
          Initialization property.
 void setRowHeight(int value)
           
 void setRowMargin(int value)
           
 void setSelectionMode(int mode)
           
 void setShowHorizontalLines(boolean value)
           
 void setShowVerticalLines(boolean value)
           
protected  void setTable(JXTable jxtable)
          Uses the specified table as the basis for this JNTable TODO This method does not currently appear to handle changing JXTables in midstream appropriately.
 java.lang.String toString()
           
protected  void unlockRowHeader()
           
 
Methods inherited from class org.jdesktop.jdnc.JNComponent
addAction, addMessageListener, addSeparator, addToolBar, addToolBarComponent, doCommand, getBackgroundImage, getCommands, getComponent, getDataField, getDataSource, getMessageListeners, getPopupMenu, hasCommand, isDesignTime, paint, removeMessageListener, sendMessage, setBackgroundImage, setComponent, setDataField, setDataSource, setDesignTime, setEnabled, setOpaque, setPopupMenu
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ROW_HEIGHT

public int DEFAULT_ROW_HEIGHT
The default row height for rows in this JNTable. TODO It seems like this is ok, but needs to be somewhat influenced by the laf?


DEFAULT_ROW_MARGIN

public int DEFAULT_ROW_MARGIN
The default margin between rows TODO It seems like this is ok, but needs to be somewhat influenced by the laf?


DEFAULT_VISIBLE_ROW_COUNT

public int DEFAULT_VISIBLE_ROW_COUNT
TODO It seems like this is ok, but needs to be somewhat influenced by the laf?


DEFAULT_COLUMN_MARGIN

public int DEFAULT_COLUMN_MARGIN
The default margin between columns TODO It seems like this is ok, but needs to be somewhat influenced by the laf?


scrollPane

protected javax.swing.JScrollPane scrollPane
The JNTable automatically places the table component into this scrollPane


jxtable

protected JXTable jxtable
The JXTable being wrapped by this JNTable. This wrapped table is used as the delegate for doing table functions, such as painting.

Constructor Detail

JNTable

public JNTable()
Constructs a JNTable component with a DefaultTableModel instance as the data model.


JNTable

public JNTable(javax.swing.table.TableModel model)
Constructs a JNTable component that displays a row/column view for the specified data model.

Parameters:
model - data model which holds the data for this table
Throws:
throws - IllegalArgumentException if model is null

JNTable

public JNTable(java.net.URL url)
Constructs a JNTable loaded with data from the URL.

Parameters:
a - non-null url which represents tabular data

JNTable

protected JNTable(javax.swing.JTable jxtable)
Method Detail

setTable

protected void setTable(JXTable jxtable)
Uses the specified table as the basis for this JNTable TODO This method does not currently appear to handle changing JXTables in midstream appropriately. There is no logic to handle updating the column control, and there is no logic to handle updating the RowHeaderColumn, if one is in use.


getTable

public JXTable getTable()
Returns:
the internal JXTable instance for this component

setModel

public void setModel(javax.swing.table.TableModel model)
Set the model for the table.

Parameters:
model - table model which holds the data for this table. Must not be null.

getModel

public javax.swing.table.TableModel getModel()
Returns:
data model which holds the data for this table

addColumn

public void addColumn(TableColumnExt column)
Adds the specified view column to this table

Parameters:
column - TableColumnExt which holds state for the view column

removeColumn

public void removeColumn(TableColumnExt column)
Removes the specified column from this JNTable


getColumn

public TableColumnExt getColumn(java.lang.String name)
Parameters:
name - String containing the logical name of the column
Returns:
TableColumnExt which holds state for the view column

getColumn

public TableColumnExt getColumn(int currentViewIndex)
Returns the column which is currently located at the specified column view index. Note that since columns may be re-ordered in the view, either programmatically or by the user, a column's view index may change over time, therefore it is recommended to retrieve column objects by name when accessing specific columns.

Parameters:
currentViewIndex - integer index which contains the position of the column
Returns:
TableColumnExt which holds state for the view column
See Also:
getColumn(java.lang.String)

getOddRowBackground

public java.awt.Color getOddRowBackground()
Returns:
Color background color used to render odd rows in the table.

setOddRowBackground

public void setOddRowBackground(java.awt.Color color)
Sets the background color for odd rows in the table.

Parameters:
color - background color used to render odd rows in the table.

getEvenRowBackground

public java.awt.Color getEvenRowBackground()
Returns:
Color background color used to render even rows in the table.

setEvenRowBackground

public void setEvenRowBackground(java.awt.Color color)
Sets the background color for even rows in the table.

Parameters:
color - background color used to render even rows in the table.

getHasColumnControl

public boolean getHasColumnControl()
Returns:
boolean indicating whether the table provides a control which enables the end user to modify column visibility

setHasColumnControl

public void setHasColumnControl(boolean hasControl)
Sets whether the column control should be made visible. The column control is a popup which enables or disables the visibility of columns.

Parameters:
hasControl - true to turn the column control on; otherwise false

isRowHeaderLocked

public boolean isRowHeaderLocked()

setRowHeaderLocked

public void setRowHeaderLocked(boolean lockState)
Initialization property. Do not set after table has been shown.

Parameters:
lockState -

initRowHeader

protected javax.swing.table.TableColumn initRowHeader()

lockRowHeader

protected void lockRowHeader()

unlockRowHeader

protected void unlockRowHeader()

getRowHeight

public int getRowHeight()
Returns:
integer containing the height of a table row in pixels

setRowHeight

public void setRowHeight(int value)
Parameters:
value - integer containing the height of a table row in pixels

getPreferredVisibleRowCount

public int getPreferredVisibleRowCount()
Returns:
integer containing the number of visible rows which should be displayed in the scrollable view when the table is first shown

setPreferredVisibleRowCount

public void setPreferredVisibleRowCount(int value)
Sets the number of visible rows which should be displayed in the scrollable view when the table is first shown. If set to a value greater or equal to 0, then the table will attempt to initialize the viewport size to display exactly this number of rows. Subsequent size changes to the user-interface (due to end-user or programmatic resizing) may cause the number of visible rows to change.

Parameters:
value - integer containing the number of visible rows which should be displayed in the scrollable view when the table is first shown

getColumnMargin

public int getColumnMargin()

setColumnMargin

public void setColumnMargin(int value)

getRowMargin

public int getRowMargin()

setRowMargin

public void setRowMargin(int value)

getSelectionMode

public int getSelectionMode()

setSelectionMode

public void setSelectionMode(int mode)

getShowHorizontalLines

public boolean getShowHorizontalLines()

setShowHorizontalLines

public void setShowHorizontalLines(boolean value)

getShowVerticalLines

public boolean getShowVerticalLines()

setShowVerticalLines

public void setShowVerticalLines(boolean value)

getFilters

public FilterPipeline getFilters()

setFilters

public void setFilters(FilterPipeline pipeline)

getHighlighters

public HighlighterPipeline getHighlighters()

setHighlighters

public void setHighlighters(HighlighterPipeline pipeline)

setBackground

public void setBackground(java.awt.Color color)
Overrides:
setBackground in class JNComponent

setForeground

public void setForeground(java.awt.Color color)
Overrides:
setForeground in class JNComponent

setFont

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

setGridColor

public void setGridColor(java.awt.Color color)

setHeaderBackground

public void setHeaderBackground(java.awt.Color headerBackground)
Sets the background of the table's column headers to the specified color. If the table has no header, this method does nothing.

Parameters:
headerBackground - Color used to render background of table column headers

getHeaderBackground

public java.awt.Color getHeaderBackground()
Returns:
Color used to render background of table column headers or null if the table has no header.

setHeaderForeground

public void setHeaderForeground(java.awt.Color headerForeground)
Sets the foreground of the table's column headers to the specified color. If the table has no header, this method does nothing.

Parameters:
headerForeground - Color used to render foreground of table column headers

getHeaderForeground

public java.awt.Color getHeaderForeground()
Returns:
Color used to render foreground of table column headers or null if the table has no header.

setHeaderFont

public void setHeaderFont(java.awt.Font headerFont)
Sets the font of the table's column headers to the specified font. If the table has no header, this method does nothing.

Parameters:
headerFont - Font used to render text in the table column headers

getHeaderFont

public java.awt.Font getHeaderFont()
Returns:
Font used to render text in the table column headers or null if the table has no header.

setHeaderSortUpIcon

public void setHeaderSortUpIcon(javax.swing.Icon upIcon)
Sets the icon which is displayed in a column's header when it has been sorted in ascending order. If the table has no header, this method does nothing.

Parameters:
upIcon - Icon which indicates ascending sort on a column

getHeaderSortUpIcon

public javax.swing.Icon getHeaderSortUpIcon()
Returns:
Icon which indicates ascending sort on a column

setHeaderSortDownIcon

public void setHeaderSortDownIcon(javax.swing.Icon downIcon)
Sets the icon which is displayed in a column's header when it has been sorted in descending order. If the table has no header, this method does nothing.

Parameters:
downIcon - Icon which indicates descending sort on a column

getHeaderSortDownIcon

public javax.swing.Icon getHeaderSortDownIcon()
Returns:
Icon which indicates descending sort on a column

getColumnClass

public java.lang.Class getColumnClass(java.lang.String columnName)
Convenience method for obtaining the class of a named column in the table. This method will obtain the class from the underlying data model.

Parameters:
columnName - String containing the logical name of the column
Returns:
Class representing the data-type for values in the column

setColumnBackground

public void setColumnBackground(java.lang.String columnName,
                                java.awt.Color background)
Sets the background color for all cells in the specified named column. By default, cells are rendered in the background color of the table component or using the alternate row color properties (if set), so this method should only be used if a column needs to have an individual background color.

Parameters:
columnName - String containing the logical name of the column
background - Color used to render the background of cells in the column

getColumnBackground

public java.awt.Color getColumnBackground(java.lang.String columnName)
Parameters:
columnName - String containing the logical name of the column
Returns:
Color used to render the background of cells in the column or null if no background color was set on the column

setColumnForeground

public void setColumnForeground(java.lang.String columnName,
                                java.awt.Color foreground)
Sets the foreground color for all cells in the specified named column. By default, cells are rendered in the foreground color of the table component so this method should only be used if a column needs to have an individual foreground color. Setting the column foreground to null will cause the column to be rendered with the default (table foreground).

Parameters:
columnName - String containing the logical name of the column
foreground - Color used to render the foreground of cells in the column

getColumnForeground

public java.awt.Color getColumnForeground(java.lang.String columnName)
Parameters:
columnName - String containing the logical name of the column
Returns:
Color used to render the foreground of cells in the column or null if no foreground color was set on the column

setColumnFont

public void setColumnFont(java.lang.String columnName,
                          java.awt.Font font)
Sets the font for all text rendering of cells in the specified named column. By default, cells are rendered in the font of the table component so this method should only be used if a column needs to be rendered in an individual font.

Parameters:
columnName - String containing the logical name of the column
font - Font used to render text inside cells in the column

getColumnFont

public java.awt.Font getColumnFont(java.lang.String columnName)
Parameters:
columnName - String containing the logical name of the column
Returns:
Font used to render text within the cells in the column or null if no font was set on the column

setColumnHorizontalAlignment

public void setColumnHorizontalAlignment(java.lang.String columnName,
                                         int alignment)
Sets the horizontal alignment of content rendered inside cells in the specified named column. By default, cells are rendered with a horizontal alignment which is determined by the column's type (e.g. strings are leading-aligned, numbers are trailing-aligned, dates are center-aligned, etc). This method should only be used if a column needs to override the default alignment for the column's type. Setting the column alignment to -1 will restore the alignment to its default setting.

Parameters:
columnName - String containing the logical name of the column
alignment - integer representing the horizontal alignment within the column
See Also:
JLabel.setHorizontalAlignment(int)

getColumnHorizontalAlignment

public int getColumnHorizontalAlignment(java.lang.String columnName)
Parameters:
columnName - String containing the logical name of the column
Returns:
integer representing the horizontal alignment within the column or -1 if column alignment was not explicitly set

setColumnPrototypeValue

public void setColumnPrototypeValue(java.lang.String columnName,
                                    java.lang.Object prototype)
Sets the prototype value for the specified named column. The prototype value is used to compute the preferred width of the column when the table's size if first initialized, therefore this property should be set before the table is shown. The value should be an instance of the column's type. Setting the prototype value to null will cause the the preferred width to fallback to a static pixel width.

Parameters:
columnName - String containing the logical name of the column
prototype - Object used to calculate preferred width of column
See Also:
getColumnClass(java.lang.String)

getColumnPrototypeValue

public java.lang.Object getColumnPrototypeValue(java.lang.String columnName)
Parameters:
columnName - String containing the logical name of the column
Returns:
Object used to calculate preferred width of column or null if the preferred width should be based on a static pixel value

print

public boolean print()
              throws java.awt.print.PrinterException
Throws:
java.awt.print.PrinterException

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

setColumnSequence

public void setColumnSequence(java.lang.String[] columnNames)
reorders the columns in the sequence given array. Logical names that do not correspond to any column in the model will be ignored. Columns with logical names not contained are added at the end.

Parameters:
columnNames - array of logical column names


Copyright © 2005 Sun Microsystems All Rights Reserved.