Diamond Control Suite 3.0

diamondedge.swing.grid
Class DsTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by diamondedge.swing.grid.DsTable
All Implemented Interfaces:
DsConstants, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable, SwingConstants
Direct Known Subclasses:
DsGrid, GridRowHeader

public class DsTable
extends JTable
implements DsConstants

A class which implements many common functions used in DsGrid and other tables

See Also:
Serialized Form

Nested Class Summary
static class DsTable.BooleanEditor
           
static class DsTable.BooleanRenderer
           
static class DsTable.ComponentEditor
           
static class DsTable.ComponentRenderer
           
static class DsTable.DateEditor
           
static class DsTable.ListEditor
           
static class DsTable.TableEditor
           
 
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean cellsEditable
           
protected  boolean spannedCells
           
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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 diamondedge.swing.DsConstants
ACCOUNTING, ALL, ASCENDING, ASCENDING_CASE, BORDER_BOTTOM, BORDER_LEFT, BORDER_NONE, BORDER_OUTLINE, BORDER_RIGHT, BORDER_TOP, CROSS_LINES, DASH, DASH_DOT, DASH_DOT_DOT, DEFAULT, DESCENDING, DESCENDING_CASE, DIAGONAL_CROSS_LINES, DOT, DOUBLE, DOUBLE_LINE, DOWNWARD_DIAGONAL_LINES, ETCHED, ETCHED_RAISED, FALSE, FIND_ALL, FIND_EQUALS, FIND_GT, FIND_GTE, FIND_LT, FIND_LTE, FIND_NE, FIND_PREFIX, FIND_REGEX, FIND_STRING, FIRST, FLAT, GRID_DASH, GRID_DASH_DOT, GRID_DASH_DOT_DOT, GRID_DOT, GRID_LINE, HIGHLIGHT_SELECTION_ALWAYS, HIGHLIGHT_SELECTION_NEVER, HIGHLIGHT_SELECTION_WITH_FOCUS, HORIZONTAL_LINES, LOWERED, LOWERED_LIGHT, NONE, RAISED, RAISED_LIGHT, SELECT_CELL, SELECT_NONE, SELECT_ROW, SINGLE, SINGLE_LINE, SOLID, STRETCH, TILE, TRANSPARENT, TRUE, UPWARD_DIAGONAL_LINES, VERTICAL_LINES
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 TableColumn addColumn()
          Adds a column to the end.
 TableColumn addColumn(String columnName, String id)
          Adds a column to the end with the given name (HeaderValue) and identifier.
 void addColumn(TableColumn aColumn)
          Appends aColumn to the end of the array of columns held by the column model.
 int calculateColumnWidthToFit(int column, boolean fitName, boolean fitData)
          Returns the width of the column at the given index needed to fit the text for the name of the column and/or the data in cells in that column.
 int calculateWidthToFit(boolean fitColumnNames, boolean fitColumnData)
          Returns the total width of the table needed to fit the text for the name of the column and/or the data in cells in that column for each column in the table.
 int columnAtPoint(Point point)
           
 void columnSelectionChanged(ListSelectionEvent e)
           
protected  DsCell createCell()
          Returns a new DsCell.
 void createDefaultColumnsFromModel()
           
protected  void createDefaultEditors()
           
protected  void createDefaultRenderers()
           
protected  JTableHeader createDefaultTableHeader()
           
 DsCell getCellAt(int row, int col)
          Returns the cell at the given row and column.
protected  int getCellColumnSpan(int row, int column)
           
 TableCellEditor getCellEditor(int row, int column)
           
 Rectangle getCellRect(int row, int column, boolean includeSpacing)
           
 TableCellRenderer getCellRenderer(int row, int column)
           
protected  int getCellRowSpan(int row, int column)
           
 DsCellRange getCells(int firstRow, int firstColumn, int lastRow, int lastColumn)
          Returns a range of cells in between and including the specified cell corners.
 Object getCellValueAt(int row, int col)
          Returns the contents/object for the cell at the given row and column.
 TableColumn getColumn(int index)
          Returns the TableColumn object for the column at the given position.
 TableColumn getColumn(String columnId)
           
 int getColumnCount()
          Returns the total number of columns.
 DsTableColumnHeader getColumnHeader()
          Returns the column header.
 Color getColumnHeaderBackground()
          Returns the background color of the column header.
 Font getColumnHeaderFont()
          Returns the Font for the column headers
 Color getColumnHeaderForeground()
          Returns the color used to draw text of the column header.
 int getColumnHeaderHeight()
          Returns the height of the column header.
 int getColumnIndex(String columnId)
          Returns the column index for the column that has the given identifier or column name.
 String getColumnName(int column)
          Returns the object used to get the text displayed in the given column header.
 DsCellProperties getColumnProperties(int col)
          Returns the default cell containing the default properties for the column.
 DsCellRange getColumns(int firstColumn, int lastColumn)
          Returns a range of cells that includes all cells in the specified columns.
 int getColumnWidth(int index)
          Determines the width of the specified column in pixels.
 DsCellRange getRows(int firstRow, int lastRow)
          Returns a range of cells that includes all cells in the specified rows.
protected static JScrollPane getScrollPane(JTable table)
           
 String getToolTipText(MouseEvent event)
          Overrides JComponent's getToolTipText method in order to allow the cell's tips to be used if it has text set.
 void hideColumn(int index)
          Removes from the view the column at the given position.
 boolean isCellEditable(int row, int column)
          Returns true if the cell at row and column is editable.
 boolean isColumnReorderingAllowed()
          Returns true if the user is allowed to rearrange columns by dragging their headers, false otherwise.
 boolean isColumnResizingAllowed()
          Returns true if the user is allowed to resize columns by dragging between their headers, false otherwise.
 boolean isEditable()
          Returns whether any cell can be edited by the user.
 void removeSpan(int row, int column)
          Makes the cell at position row, column not span across multiple rows and/or columns.
 int rowAtPoint(Point point)
           
 void setColumnCount(int val)
          Sets the total number of columns by adding new columns or removing existing ones.
 void setColumnHeaderBackground(Color val)
          Sets the background color of the column header.
 void setColumnHeaderFont(Font f)
          Sets the Font for the column headers
 void setColumnHeaderForeground(Color val)
          Sets the color used to draw text of the column header.
 void setColumnHeaderHeight(int height)
          Sets the height of the column header.
 void setColumnHorizontalAlignment(int column, int align)
          Sets the horizontal alignment of the text in the column header.
 void setColumnName(int column, String val)
          Sets the text displayed in the column header.
 void setColumnReorderingAllowed(boolean reorderingAllowed)
          Shortcut to set whether the user can drag column headers to reorder columns.
 void setColumnResizingAllowed(boolean resizingAllowed)
          Shortcut to set whether the user can resize columns by dragging between headers.
 void setColumnVerticalAlignment(int column, int align)
          Sets the vertical alignment of the text in the column header.
 void setColumnWidth(int index, int width)
          Sets the width of the column at the given index to width.
 void setColumnWidth(String columnId, int width)
           
 void setColumnWidthToFit(int column, boolean fitName, boolean fitData)
          Sets the width of the column at the given index to fit the text for the name of the column and/or the data in cells in that column.
 void setEditable(boolean cellsCanBeEdited)
          Set whether any cell can be edited by the user.
 boolean spanCells(int startRow, int startColumn, int rowsToSpan, int columnsToSpan)
          Makes the cell at position startRow, startColumn span across rowsToSpan rows and columnsToSpan columns.
 void tableChanged(TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
 void updateUI()
           
 void valueChanged(ListSelectionEvent e)
           
 
Methods inherited from class javax.swing.JTable
addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnMarginChanged, columnMoved, columnRemoved, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultDataModel, createDefaultSelectionModel, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellSelectionEnabled, getColumn, getColumnClass, getColumnModel, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, 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, 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,