|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jdesktop.jdnc.JNComponent
org.jdesktop.jdnc.JNTable
public class JNTable
High level table component which displays tabular data from a data model in a scrollable view.
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 |
---|
public int DEFAULT_ROW_HEIGHT
public int DEFAULT_ROW_MARGIN
public int DEFAULT_VISIBLE_ROW_COUNT
public int DEFAULT_COLUMN_MARGIN
protected javax.swing.JScrollPane scrollPane
protected JXTable jxtable
Constructor Detail |
---|
public JNTable()
public JNTable(javax.swing.table.TableModel model)
model
- data model which holds the data for this table
throws
- IllegalArgumentException if model is nullpublic JNTable(java.net.URL url)
a
- non-null url which represents tabular dataprotected JNTable(javax.swing.JTable jxtable)
Method Detail |
---|
protected void setTable(JXTable jxtable)
public JXTable getTable()
public void setModel(javax.swing.table.TableModel model)
model
- table model which holds the data for this table. Must not be null.public javax.swing.table.TableModel getModel()
public void addColumn(TableColumnExt column)
column
- TableColumnExt which holds state for the view columnpublic void removeColumn(TableColumnExt column)
public TableColumnExt getColumn(java.lang.String name)
name
- String containing the logical name of the column
public TableColumnExt getColumn(int currentViewIndex)
currentViewIndex
- integer index which contains the position of the
column
getColumn(java.lang.String)
public java.awt.Color getOddRowBackground()
public void setOddRowBackground(java.awt.Color color)
color
- background color used to render odd rows in the table.public java.awt.Color getEvenRowBackground()
public void setEvenRowBackground(java.awt.Color color)
color
- background color used to render even rows in the table.public boolean getHasColumnControl()
public void setHasColumnControl(boolean hasControl)
hasControl
- true to turn the column control on; otherwise falsepublic boolean isRowHeaderLocked()
public void setRowHeaderLocked(boolean lockState)
lockState
- protected javax.swing.table.TableColumn initRowHeader()
protected void lockRowHeader()
protected void unlockRowHeader()
public int getRowHeight()
public void setRowHeight(int value)
value
- integer containing the height of a table row in pixelspublic int getPreferredVisibleRowCount()
public void setPreferredVisibleRowCount(int value)
value
- integer containing the number of visible rows which should
be displayed in the scrollable view when the table is first shownpublic int getColumnMargin()
public void setColumnMargin(int value)
public int getRowMargin()
public void setRowMargin(int value)
public int getSelectionMode()
public void setSelectionMode(int mode)
public boolean getShowHorizontalLines()
public void setShowHorizontalLines(boolean value)
public boolean getShowVerticalLines()
public void setShowVerticalLines(boolean value)
public FilterPipeline getFilters()
public void setFilters(FilterPipeline pipeline)
public HighlighterPipeline getHighlighters()
public void setHighlighters(HighlighterPipeline pipeline)
public void setBackground(java.awt.Color color)
setBackground
in class JNComponent
public void setForeground(java.awt.Color color)
setForeground
in class JNComponent
public void setFont(java.awt.Font font)
setFont
in class JNComponent
public void setGridColor(java.awt.Color color)
public void setHeaderBackground(java.awt.Color headerBackground)
headerBackground
- Color used to render background of table column headerspublic java.awt.Color getHeaderBackground()
public void setHeaderForeground(java.awt.Color headerForeground)
headerForeground
- Color used to render foreground of table column headerspublic java.awt.Color getHeaderForeground()
public void setHeaderFont(java.awt.Font headerFont)
headerFont
- Font used to render text in the table column headerspublic java.awt.Font getHeaderFont()
public void setHeaderSortUpIcon(javax.swing.Icon upIcon)
upIcon
- Icon which indicates ascending sort on a columnpublic javax.swing.Icon getHeaderSortUpIcon()
public void setHeaderSortDownIcon(javax.swing.Icon downIcon)
downIcon
- Icon which indicates descending sort on a columnpublic javax.swing.Icon getHeaderSortDownIcon()
public java.lang.Class getColumnClass(java.lang.String columnName)
columnName
- String containing the logical name of the column
public void setColumnBackground(java.lang.String columnName, java.awt.Color background)
columnName
- String containing the logical name of the columnbackground
- Color used to render the background of cells in the columnpublic java.awt.Color getColumnBackground(java.lang.String columnName)
columnName
- String containing the logical name of the column
public void setColumnForeground(java.lang.String columnName, java.awt.Color foreground)
null
will cause the column to be rendered with the default (table foreground).
columnName
- String containing the logical name of the columnforeground
- Color used to render the foreground of cells in the columnpublic java.awt.Color getColumnForeground(java.lang.String columnName)
columnName
- String containing the logical name of the column
public void setColumnFont(java.lang.String columnName, java.awt.Font font)
columnName
- String containing the logical name of the columnfont
- Font used to render text inside cells in the columnpublic java.awt.Font getColumnFont(java.lang.String columnName)
columnName
- String containing the logical name of the column
public void setColumnHorizontalAlignment(java.lang.String columnName, int alignment)
columnName
- String containing the logical name of the columnalignment
- integer representing the horizontal alignment within the columnJLabel.setHorizontalAlignment(int)
public int getColumnHorizontalAlignment(java.lang.String columnName)
columnName
- String containing the logical name of the column
public void setColumnPrototypeValue(java.lang.String columnName, java.lang.Object prototype)
null
will cause the the
preferred width to fallback to a static pixel width.
columnName
- String containing the logical name of the columnprototype
- Object used to calculate preferred width of columngetColumnClass(java.lang.String)
public java.lang.Object getColumnPrototypeValue(java.lang.String columnName)
columnName
- String containing the logical name of the column
public boolean print() throws java.awt.print.PrinterException
java.awt.print.PrinterException
public java.lang.String toString()
toString
in class java.awt.Component
public void setColumnSequence(java.lang.String[] columnNames)
columnNames
- array of logical column names
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |