JBCSolutions - Jbcgrid v1.6

This document is the API specification for the JbcGrid, version 1.6


jbc.grid
Class JbcGridTable

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 jbc.grid.JbcGridTable
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable

public class JbcGridTable
extends javax.swing.JTable

All you ever wanted to do with a JTable/JTree... but were afraid to code.

If the JTable component allows the developper to present data in a spreadsheet fashion, allowing the end-user to edit the cells may become quite difficult. More, if you want to display some of these data in a customized way then programming can quickly become a challenge. Not only the JbcGridTable component comes with its own set of editors and renderers, it accepts any other bean you may use. (The associated demo uses the JCB Gui Beans Suite).

More, it allows the dynamic insertion of any other swing component inside the table area that may be used to display or edit the contents of a row. (This feature can dramaticaly simplify the verification of the user's modification of the row data whithout the need of opening a new window at the user's request). This row expansion can be triggered by any event.

As a generalization of the insertion of any component, you can even expand a row into another JbcGridTable giving to the resulting one the best of the JTable and the JTree components. You can even nest as many levels of JbcGridTable as your application may need.

You may put your data into a vector or not, or use information directly from a database (see JbcGridDefaultTableModel or JbcGridAbstractTableModel).

This screenshot shows the JBCGridTable ability for nesting components and displaying a hierarchy of tables.

Author:
Copyright © 1999-2005, JBC. All Rights Reserved.
Licensed Materials - Property of JBC.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
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
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JbcGridTable()
          Constructs a default JbcGridTable that is initialized with a default data model, a default column model, and a default selection model.
JbcGridTable(int numRows, int numColumns)
          Constructs a JbcGridTable with numRows and numColumns of empty cells using JbcGridDefaultTableModel.
JbcGridTable(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
          Constructs a JbcGridTable to display the values in the two dimensional array, rowData, with column names, columnNames.
JbcGridTable(javax.swing.table.TableModel dm)
          Constructs a JbcGridTable that is initialized with dm as the data model, a default column model, and a default selection model.
JbcGridTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm)
          Constructs a JbcGridTable that is initialized with dm as the data model, cm as the column model, and a default selection model.
JbcGridTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm, javax.swing.ListSelectionModel sm)
          Constructs a JbcGridTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model.
JbcGridTable(java.util.Vector rowData, java.util.Vector columnNames)
          Constructs a JbcGridTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.
 
Method Summary
 void collapseAllRows()
          This function collapses all the expanded rows.
 void collapseAllTreeviews()
          This function collapses all the expanded treeview rows.
 int convertRealIndexToRow(int index)
          This function converts the number of a DataBase-row to a number of a table-row.
 int convertRowToRealIndex(int row)
          This function converts the number of a table-row to a number of a DataBase-row.
 boolean editCellAt(int row, int column, java.util.EventObject e)
          Programmatically starts editing the cell at row and column, if the cell is editable.
 java.lang.String getAbout()
          Application code will not use these methods explicitly.
 java.awt.Color getAlternateBackgroundColor()
          Gets the alternate background color of this component.
 int getAutoResizeMode()
          Returns the auto resize mode of the table.
static int getClickCountToStart()
          Returns the number of clicks needed to start editing.
 java.awt.Color getConnectingLineColor()
          Gets the connectingLineColor color of this component.
 java.awt.Color getExpandColumnColor()
          Gets the expandColumnColor color of this component.
 int[] getExpandedRows(boolean realIndex)
          This method returns an array for all the expanded rows.
 int getExpandedTreeviewRowCount()
          This functions returns the number of rows that will be expanded (Treeview).
 int[] getExpandedTreeviewRows(boolean realIndex)
          This method returns an array for all the expanded, treeview rows.
 java.awt.Color getFillerColor()
          Gets the filler color of this component.
static JbcGridTable getGridTableFromComponent(javax.swing.JComponent component)
          This method returns the GridTable owned by the expanded component.
static int getRowFromComponent(javax.swing.JComponent component)
          This method returns the row owned by the expanded component.
 javax.swing.border.Border getTreeViewBorder()
          Returns the current border used for nested treeview components.
 java.lang.Object getValueAt(int row, int column)
          Returns the cell value at row and column.
 boolean isExpandedRow(int row)
          Returns true if this row is overloaded by a component.
 boolean isExpandedTreeview(int row)
          Returns true if this row is expanded with a tree-view component.
 boolean isTreeViewAllowed()
          Returns true if the Grid table may be expanded in tree view.
 void repaint(long tm, int x, int y, int width, int height)
          Repaints the specified rectangle of this component within tm milliseconds.
 void setAbout(java.lang.String text)
          Application code will not use these methods explicitly.
 void setAlternateBackgroundColor(java.awt.Color c)
          Sets the alternate background color of this component.
 void setAutoResizeMode(int mode)
          Sets the table's auto resize mode when the table is resized.
static void setClickCountToStart(int clickCountToStartEditors)
          clickCountToStart controls the number of clicks required to start editing.
 void setConnectingLineColor(java.awt.Color c)
          Sets the connectingLine Color color of this component.
 void setExpandColumnColor(java.awt.Color c)
          Sets the expandColumn Color color of this component.
 void setExpandedRow(int row, boolean expanded)
          Sets if the row should be overloaded by a component.
 void setExpandedTreeview(int row, boolean expanded)
          Sets if the row should be expanded with a tree-view component.
 void setFillerColor(java.awt.Color c)
          Sets the filler color of this component.
 void setIntercellSpacing(java.awt.Dimension intercellSpacing)
          Sets the rowMargin and the columnMargin -- the height and width of the space between cells -- to intercellSpacing.
 void setModel(javax.swing.table.TableModel dataModel)
          Sets the data model for this table to newModel and registers with it for listener notifications from the new data model.
 void setRowHeight(int rowHeight)
          Sets the height, in pixels, of all cells to rowHeight, revalidates, and repaints.
 void setRowHeight(int row, int rowHeight)
          Sets the height for row to rowHeight, revalidates, and repaints.
 void setRowMargin(int rowMargin)
          Sets the amount of empty space between cells in adjacent rows.
 void setTreeViewAllowed(boolean treeViewAllowed)
          If true the component may be expanded in tree view.
 void setTreeViewBorder(javax.swing.border.Border treeViewBorder)
          Sets the border for nested treeviews.
 void setValueAt(java.lang.Object aValue, int row, int column)
          Sets the value for the cell in the table model at row and column.
 void tableChanged(javax.swing.event.TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
 void updateUI()
          Notification from the UIManager that the L&F has changed.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnsFromModel, createScrollPaneForTable, doLayout, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, prepareEditor, prepareRenderer, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setPreferredScrollableViewportSize, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, sizeColumnsToFit, sizeColumnsToFit, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JbcGridTable

public JbcGridTable()
Constructs a default JbcGridTable that is initialized with a default data model, a default column model, and a default selection model.


JbcGridTable

public JbcGridTable(javax.swing.table.TableModel dm)
Constructs a JbcGridTable that is initialized with dm as the data model, a default column model, and a default selection model.

Parameters:
dm - the data model for the table

JbcGridTable

public JbcGridTable(javax.swing.table.TableModel dm,
                    javax.swing.table.TableColumnModel cm)
Constructs a JbcGridTable that is initialized with dm as the data model, cm as the column model, and a default selection model.

Parameters:
dm - the data model for the table
cm - the column model for the table

JbcGridTable

public JbcGridTable(javax.swing.table.TableModel dm,
                    javax.swing.table.TableColumnModel cm,
                    javax.swing.ListSelectionModel sm)
Constructs a JbcGridTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model. If any of the parameters are null this method will initialize the table with the corresponding default model. The autoCreateColumnsFromModel flag is set to false if cm is non-null, otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in dm.

Parameters:
dm - the data model for the table
cm - the column model for the table
sm - the row selection model for the table

JbcGridTable

public JbcGridTable(int numRows,
                    int numColumns)
Constructs a JbcGridTable with numRows and numColumns of empty cells using JbcGridDefaultTableModel. The columns will have names of the form "A", "B", "C", etc.

Parameters:
numRows - the number of rows the table holds
numColumns - the number of columns the table holds

JbcGridTable

public JbcGridTable(java.util.Vector rowData,
                    java.util.Vector columnNames)
Constructs a JbcGridTable to display the values in the Vector of Vectors, rowData, with column names, columnNames. The Vectors contained in rowData should contain the values for that row. In other words, the value of the cell at row 1, column 5 can be obtained with the following code:

((Vector)rowData.elementAt(1)).elementAt(5);

Parameters:
rowData - the data for the new table
columnNames - names of each column

JbcGridTable

public JbcGridTable(java.lang.Object[][] rowData,
                    java.lang.Object[] columnNames)
Constructs a JbcGridTable to display the values in the two dimensional array, rowData, with column names, columnNames. rowData is an array of rows, so the value of the cell at row 1, column 5 can be obtained with the following code:

 rowData[1][5]; 

All rows must be of the same length as columnNames.

Parameters:
rowData - the data for the new table
columnNames - names of each column
Method Detail

setAbout

public void setAbout(java.lang.String text)
Application code will not use these methods explicitly.


getAbout

public final java.lang.String getAbout()
Application code will not use these methods explicitly.


isTreeViewAllowed

public boolean isTreeViewAllowed()
Returns true if the Grid table may be expanded in tree view.

Returns:
true if expanding the grid table in tree view is allowed.
See Also:
setTreeViewAllowed(boolean)

setTreeViewAllowed

public void setTreeViewAllowed(boolean treeViewAllowed)
If true the component may be expanded in tree view.

Parameters:
treeViewAllowed - true if the component may be expanded in tree view
See Also:
isTreeViewAllowed()

setClickCountToStart

public static void setClickCountToStart(int clickCountToStartEditors)
clickCountToStart controls the number of clicks required to start editing. For example, by default the clickCountToStart is set to 1, so in a JbcGridTable the user will need only one click to begin editing a cell. This value will be used as a default value by any JbcCellEditor.


getClickCountToStart

public static int getClickCountToStart()
Returns the number of clicks needed to start editing.

Returns:
the number of clicks needed to start editing

setTreeViewBorder

public void setTreeViewBorder(javax.swing.border.Border treeViewBorder)
Sets the border for nested treeviews.

Parameters:
treeViewBorder - The border to become this component's current border. If this parameter is null then the initial (default) border will be restored.
See Also:
getTreeViewBorder()

getTreeViewBorder

public javax.swing.border.Border getTreeViewBorder()
Returns the current border used for nested treeview components.

Returns:
the border

getConnectingLineColor

public java.awt.Color getConnectingLineColor()
Gets the connectingLineColor color of this component.

Returns:
This component's connectingLine color. If this component does not have a connectingLine color, the default connectingLine color is returned.
See Also:
setConnectingLineColor(java.awt.Color), updateUI()

setConnectingLineColor

public void setConnectingLineColor(java.awt.Color c)
Sets the connectingLine Color color of this component.

Parameters:
color - The color to become this component's connectingLine color. If this parameter is null then this component will inherit the default connectingLine. The connectingLine color is used to paint connectingLine (tree view areas).
See Also:
getConnectingLineColor(), updateUI()

getExpandColumnColor

public java.awt.Color getExpandColumnColor()
Gets the expandColumnColor color of this component.

Returns:
This component's expandColumn color. If this component does not have a expandColumn color, the default expandColumn color is returned.
See Also:
setExpandColumnColor(java.awt.Color), updateUI()

setExpandColumnColor

public void setExpandColumnColor(java.awt.Color c)
Sets the expandColumn Color color of this component.

Parameters:
color - The color to become this component's expandColumn color. If this parameter is null then this component will inherit the default expandColumn. The expandColumn color is used to paint expandColumn (tree view areas).
See Also:
getExpandColumnColor(), updateUI()

getFillerColor

public java.awt.Color getFillerColor()
Gets the filler color of this component.

Returns:
This component's filler color. If this component does not have a filler color, the default filler color is returned.
See Also:
setFillerColor(java.awt.Color), updateUI()

setFillerColor

public void setFillerColor(java.awt.Color c)
Sets the filler color of this component.

Parameters:
color - The color to become this component's filler color. If this parameter is null then this component will inherit the default filler. The filler color is used to paint tree view areas.
See Also:
getFillerColor(), updateUI()

getAlternateBackgroundColor

public java.awt.Color getAlternateBackgroundColor()
Gets the alternate background color of this component.

Returns:
This component's filler color. If this component does not have a alternate background color, the default filler color is returned. The alternate background color is used by JbcCellRenderer to paint odd rows.
See Also:
setAlternateBackgroundColor(java.awt.Color), updateUI()

setAlternateBackgroundColor

public void setAlternateBackgroundColor(java.awt.Color c)
Sets the alternate background color of this component.

Parameters:
color - The color to become this component's filler color. If this parameter is null then this component will inherit the default alternate background.
See Also:
#geAlternateBackgroundColor, updateUI()

setModel

public void setModel(javax.swing.table.TableModel dataModel)
Sets the data model for this table to newModel and registers with it for listener notifications from the new data model.

Overrides:
setModel in class javax.swing.JTable
Parameters:
newModel - the new data source for this table
Throws:
java.lang.IllegalArgumentException - if newModel is null or not an instance of JbcGridInterfaceTableModel
See Also:
JbcGridDefaultTableModel, JbcGridAbstractTableModel, JbcGridInterfaceTableModel

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Repaints the specified rectangle of this component within tm milliseconds.

Overrides:
repaint in class javax.swing.JComponent
Parameters:
tm - maximum time in milliseconds before update
x - the x coordinate
y - the y coordinate
width - the width
height - the height

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this JTable when it receives the event.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Overrides:
tableChanged in class javax.swing.JTable

editCellAt

public boolean editCellAt(int row,
                          int column,
                          java.util.EventObject e)
Programmatically starts editing the cell at row and column, if the cell is editable. To prevent the JTable from editing a particular table, column or cell value, return false from the isCellEditable method in the TableModel interface.

Overrides:
editCellAt in class javax.swing.JTable
Parameters:
row - the row to be edited
column - the column to be edited
e - event to pass into shouldSelectCell; note that as of Java 2 platform v1.2, the call to shouldSelectCell is no longer made
Returns:
false if for any reason the cell cannot be edited
Throws:
java.lang.IllegalArgumentException - if row or column is not in the valid range

setRowMargin

public void setRowMargin(int rowMargin)
Sets the amount of empty space between cells in adjacent rows.

Overrides:
setRowMargin in class javax.swing.JTable
Parameters:
rowMargin - the number of pixels between cells in a row
See Also:
JTable.getRowMargin()

setIntercellSpacing

public void setIntercellSpacing(java.awt.Dimension intercellSpacing)
Sets the rowMargin and the columnMargin -- the height and width of the space between cells -- to intercellSpacing.

Overrides:
setIntercellSpacing in class javax.swing.JTable
Parameters:
intercellSpacing - a Dimension specifying the new width and height between cells
See Also:
JTable.getIntercellSpacing()

setRowHeight

public void setRowHeight(int rowHeight)
Sets the height, in pixels, of all cells to rowHeight, revalidates, and repaints. The height of the cells will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class javax.swing.JTable
Parameters:
rowHeight - new row height
Throws:
java.lang.IllegalArgumentException - if rowHeight is less than 1
See Also:
JTable.getRowHeight()

setRowHeight

public void setRowHeight(int row,
                         int rowHeight)
Sets the height for row to rowHeight, revalidates, and repaints. The height of the cells in this row will be equal to the row height minus the row margin.

Overrides:
setRowHeight in class javax.swing.JTable
Parameters:
row - the row whose height is being changed
rowHeight - new row height, in pixels
Throws:
java.lang.IllegalArgumentException - if rowHeight is less than 1

updateUI

public void updateUI()
Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager.

If filler color is null or instanceof javax.swing.plaf.ColorUIResource the filler color is reset to the default filler color.

If expandColumn color is null or instanceof javax.swing.plaf.ColorUIResource the expandColumn color is reset to the default expandColumn color.

If connectingLine color is null or instanceof javax.swing.plaf.ColorUIResource the connectingLine color is reset to the default connectingLine color.

If alternateBackground color is null or instanceof javax.swing.plaf.ColorUIResource the alternateBackground color is reset to the default alternateBackground color.

Overrides:
updateUI in class javax.swing.JTable
See Also:
JComponent.updateUI()

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the cell value at row and column.

Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.

Overrides:
getValueAt in class javax.swing.JTable
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the Object at the specified cell

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Sets the value for the cell in the table model at row and column.

Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering. aValue is the new value.

Overrides:
setValueAt in class javax.swing.JTable
Parameters:
aValue - the new value
row - the row of the cell to be changed
column - the column of the cell to be changed
See Also:
getValueAt(int, int)

getRowFromComponent

public static int getRowFromComponent(javax.swing.JComponent component)
This method returns the row owned by the expanded component.

Parameters:
component - the expanded component
Returns:
the row at the specified component

getGridTableFromComponent

public static JbcGridTable getGridTableFromComponent(javax.swing.JComponent component)
This method returns the GridTable owned by the expanded component.

Parameters:
component - the expanded component
Returns:
the GridTable component

isExpandedTreeview

public boolean isExpandedTreeview(int row)
Returns true if this row is expanded with a tree-view component.

Parameters:
row - the row
Returns:
true if this row is expanded
See Also:
setExpandedTreeview(int, boolean)

setExpandedTreeview

public void setExpandedTreeview(int row,
                                boolean expanded)
Sets if the row should be expanded with a tree-view component.

Parameters:
row - the row
expanded - the row
See Also:
isExpandedTreeview(int)

isExpandedRow

public boolean isExpandedRow(int row)
Returns true if this row is overloaded by a component.

Parameters:
row - the row
Returns:
true if this row is overloaded
See Also:
setExpandedRow(int, boolean)

setExpandedRow

public void setExpandedRow(int row,
                           boolean expanded)
Sets if the row should be overloaded by a component.

Parameters:
row - the row
expanded - the row
See Also:
isExpandedRow(int)

getExpandedTreeviewRows

public int[] getExpandedTreeviewRows(boolean realIndex)
This method returns an array for all the expanded, treeview rows.

Parameters:
realIndex - True if rows should be converted by using the convertRowToRealIndex method.
Returns:
an array
See Also:
setExpandedTreeview(int, boolean), convertRowToRealIndex(int)

collapseAllTreeviews

public void collapseAllTreeviews()
This function collapses all the expanded treeview rows. This function should be used before re-sorting the order of rows.

See Also:
setExpandedTreeview(int, boolean)

getExpandedRows

public int[] getExpandedRows(boolean realIndex)
This method returns an array for all the expanded rows.

Parameters:
realIndex - True if rows should be converted by using the convertRowToRealIndex method.
Returns:
an array
See Also:
setExpandedRow(int, boolean), convertRowToRealIndex(int)

collapseAllRows

public void collapseAllRows()
This function collapses all the expanded rows.

See Also:
setExpandedRow(int, boolean)

convertRowToRealIndex

public int convertRowToRealIndex(int row)
This function converts the number of a table-row to a number of a DataBase-row.

Each time a row is expanded (Treeview), a virtual row is inserted. This function converts a row index of the view (table) without considering the virtual rows that might have been added. This method may be useful when using data from a database..

Parameters:
row - the row index of the row to be converted
Returns:
returns the new row index
See Also:
convertRealIndexToRow(int)

convertRealIndexToRow

public int convertRealIndexToRow(int index)
This function converts the number of a DataBase-row to a number of a table-row.

Each time a row is expanded (Treeview), a virtual row is inserted. This function converts a row index of the data base with considering the virtual rows that might have been added. This method may be useful when using data from a database.

Parameters:
index - the index of the row to be converted
Returns:
returns the new row index
See Also:
convertRowToRealIndex(int)

getExpandedTreeviewRowCount

public int getExpandedTreeviewRowCount()
This functions returns the number of rows that will be expanded (Treeview).

Returns:
returns the number of rows that will be expanded

setAutoResizeMode

public void setAutoResizeMode(int mode)
Sets the table's auto resize mode when the table is resized.

Overrides:
setAutoResizeMode in class javax.swing.JTable
Parameters:
mode - One of 5 legal values: AUTO_RESIZE_OFF, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS

About Horizontal ScrollBarPolicy : only HORIZONTAL_SCROLLBAR_AS_NEEDED or HORIZONTAL_SCROLLBAR_ALWAYS are supported.

Setting "auto resize mode" to AUTO_RESIZE_OFF forces HorizontalScrollBarPolicy to HORIZONTAL_SCROLLBAR_ALWAYS.

See Also:
getAutoResizeMode(), JTable.doLayout()

getAutoResizeMode

public int getAutoResizeMode()
Returns the auto resize mode of the table. The default mode is AUTO_RESIZE_SUBSEQUENT_COLUMNS.

Overrides:
getAutoResizeMode in class javax.swing.JTable
Returns:
the autoResizeMode of the table
See Also:
setAutoResizeMode(int), JTable.doLayout()

JBCSolutions - Jbcgrid v1.6

JBCSolutions - Jbcgrid v1.6