borland Packages  Class Hierarchy  jbcl.view Package  Index 

GridView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----com.sun.java.swing.JScrollPane
                                   +----borland.jbcl.view.GridView
                                           +----borland.jbcl.control.GridControl

About the GridView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements HeaderListener, MatrixView, Accessible, ScrollPaneConstants, ImageObserver, MenuContainer, Serializable, EventListener

GridView is a scrollable view of matrix data with a row header and a column header. It uses a Panel that contains:

It also uses a ColumnView.

This class delegates all the necessary methods to other classes, which are:

The buttons that appear in the corners of the grid provide a quick way to navigate to the upper-left, upper-right, lower-left, and lower-right corners of the grid.


GridView variables

Variables implemented in this class

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in com.sun.java.swing.JScrollPane

Variables implemented in java.awt.Component

GridView constructors

GridView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in com.sun.java.swing.JScrollPane

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

GridView methods

Methods implemented in this class

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in com.sun.java.swing.JScrollPane

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

GridView event listeners


GridView variables

butLL

  protected GridView_Button butLL
A GridView_JButton that appears at the lower-left corner of the grid.

butLR

  protected GridView_Button butLR
A GridView_JButton that appears at the lower-right corner of the grid.

butUL

  protected GridView_Button butUL
A GridView_JButton that appears at the upper-left corner of the grid.

butUR

  protected GridView_Button butUR
A GridView_JButton that appears at the upper-right corner of the grid.

columnHeader

  protected HeaderView columnHeader
The header view for he columnHeader of the grid.

columnHeaderHeight

  protected int columnHeaderHeight
Contains the height of the column header in pixels.

columnHeaderVisible

  protected boolean columnHeaderVisible
Determines whether the column header is visible. If the value is true, the column header appears on the grid.

prefSize

  protected Dimension prefSize
The preferred size of the GridView.

rowHeader

  protected HeaderView rowHeader
The header view for the row header of the grid.

rowHeaderVisible

  protected boolean rowHeaderVisible
Determines whether the row header is visible. If the value is true, the row header appears on the grid.

rowHeaderWidth

  protected int rowHeaderWidth
Contains the width of the row header in pixels.

GridView constructors

GridView()

  public GridView()
Constructs a grid view.


GridView properties

autoAppend

 public boolean isAutoAppend()
 public void setAutoAppend(boolean autoAppend)
This property enables or disables automatic row appending at the end of the grid. By default, this property is false, and a user must insert rows with the Insert key or by navigating to the end of the grid and pressing Ctrl+Down. Setting this property to true allows the user to append new rows by navigating past the last row.

autoEdit

 public boolean isAutoEdit()
 public void setAutoEdit(boolean autoEdit)
The autoEdit property enables or disables automatic cell editing in the grid. By default, this property is true, and a user can edit values in any cell on the grid by typing a character on the keyboard. If set to false, the user must press F2 or Ctrl+Enter, or double-click to start an edit session.

background

 public void setBackground(java.awt.Color color)

batchMode

 public boolean isBatchMode()
 public void setBatchMode(boolean batchMode)
The batchMode property enables or disables all painting in the grid. This is used for programmatic mass updates to the grid's model, selection, or related elements, without triggering repaint() messages.

columnHeaderHeight

 public int getColumnHeaderHeight()
 public void setColumnHeaderHeight(int height)
The columnHeaderHeight property defines the height of the column header in pixels.

columnHeaderView

 public HeaderView getColumnHeaderView()
Determines the HeaderView class instance used for the column header.

columnHeaderVisible

 public boolean isColumnHeaderVisible()
 public void setColumnHeaderVisible(boolean visible)
The columnHeaderVisible property controls wether or not the column header is visible. The default is true.

columnSizes

 public SizeVector getColumnSizes()
 public void setColumnSizes(borland.jbcl.view.SizeVector newSizes)
The columnSizes property defines a SizeVector to manage the column widths in the grid. SizeVector is an interface that has two common implementations: FixedSizeVector, and VariableSizeVector. FixedSizeVector keeps all the column widths identical. A VariableSizeVector (the default for columnSizes) allows a different size for each column.

columnViews

 public ColumnView[] getColumnViews()
 public void setColumnViews(borland.jbcl.view.ColumnView[] columnViews)
A ColumnView defines the view state information for a particular column in the grid. The ColumnView class defines properties such as background, foreground, and font. Every column displayed in the grid has a ColumnView to go with it. Individual ColumnViews can be set using this indexed columnView property. The entire set of ColumnViews can be set using the columnViews property.

coreComponent

 public Component getCoreComponent()
Returns the contained GridCore (non-public) class instance as a Component.

dataToolTip

 public boolean isDataToolTip()
 public void setDataToolTip(boolean dataToolTip)
The dataToolTip property enables/disables the automatic tooltip mechanism to display the contents of the model (as text) in a tooltip window when the mouse is floating over the field. By default, this property is false. If dataToolTip is set to true, the text stored in the toolTipText property is discarded.

defaultColumnWidth

 public int getDefaultColumnWidth()
 public void setDefaultColumnWidth(int defaultWidth)
The defaultColumnWidth property is the columnWidth used when a new column is inserted into the grid. The default is 100 pixels.

dragSubfocus

 public boolean isDragSubfocus()
 public void setDragSubfocus(boolean dragSubfocus)
The dragSubocus property determines whether the subfocus follows the mouse pointer around when it is dragged over the grid. By default, this property is true.

editing

 public boolean isEditing()
The editing property (read-only) returns true if a cell is currently being edited in the grid.

editInPlace

 public boolean isEditInPlace()
 public void setEditInPlace(boolean editInPlace)
The editInPlace property enables or disables cell editing in the grid. By default, this property is true, and a user can edit values in any cell on the grid. If set to false, the matrix data cannot by modified by the user, except through programmatic access to the grid's model.

editor

 public ItemEditor getEditor()
Returns the item editor being used or null if the grid is not being edited.

enabled

 public void setEnabled(boolean enabled)
Determines if the grid is enabled. If enabled is true, the user can use the grid. If enabled is false, the user cannot use the grid and it will appear dimmed.

gridLineColor

 public Color getGridLineColor()
 public void setGridLineColor(java.awt.Color gridLineColor)
The gridLineColor property defines the line color for the grid. The default color for the grid lines is SystemColor.control.

gridVisible

 public boolean isGridVisible()
 public void setGridVisible(boolean visible)
The gridVisible property shows or hides the grid lines. The default is true.

growEditor

 public boolean isGrowEditor()
 public void setGrowEditor(boolean growEditor)
The growEditor property enables/disables the automatic sizing of an item's item editor. In some look and feel settings, the item editors must grow vertically to properly edit the data. By default, this property is set to true.

horizontalLines

 public boolean isHorizontalLines()
 public void setHorizontalLines(boolean visible)
The horizontalLines property determines whether horizontal grid lines appear between the rows in the grid. The default value is true.

model

 public MatrixModel getModel()
 public void setModel(borland.jbcl.model.MatrixModel model)
The model property defines the MatrixModel that this grid is displaying data from. If the current model is an instance of WritableMatrixModel, an external user can get access to it using getWriteModel().

moveableColumns

 public boolean isMoveableColumns()
 public void setMoveableColumns(boolean moveable)
The moveableColumns property controls whether the grid columns can be rearranged by the user. The default value is true, which means the columns can be moved with the mouse.

navigateOnEnter

 public boolean isNavigateOnEnter()
 public void setNavigateOnEnter(boolean navigateOnEnter)
The navigateOnEnter property determines whether pressing the Enter key moves the focus to the next the next column (or first column in the next row). The default value of true enables the automatic navigation. If navigateOnEnter is false, the user must use the arrow keys or mouse to navigate.

navigateOnTab

 public boolean isNavigateOnTab()
 public void setNavigateOnTab(boolean navigateOnTab)
The navigateOnTab property enables/disables automatic navigation within the grid when the user presses the Tab key. By default, this property is true and pressing the Tab key moves the focus to the next column (or first column in the next row). If navigateOnTab is false, the user must use the arrow keys (or mouse) to navigate.

opaque

 public boolean isOpaque()
 public void setOpaque(boolean opaque)
The opaque property determines whether the grid is opaque so that nothing it covers can be seen, or whether objects behind the grid can be seen through the grid. If the texture property is set, the opaque property is set to true, the default value.

postOnEndEdit

 public boolean isPostOnEndEdit()
 public void setPostOnEndEdit(boolean post)
The postOnEndEdit property controls whether or not the grid will post changes to a cell back to the model when the user clicks off of the cell, or tabs off of the cell. If false, editing a cell's value will not "stick" unless committed by pressing Enter. Clicking off of the cell being edited will revert the value back to its original state. By default, this property is set to true.

preferredSize

 public Dimension getPreferredSize()
 public void setPreferredSize(java.awt.Dimension prefSize)
Returns and sets the preferred size of the GridView.

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)
The readOnly property is used when the model property is actually a WritableMatrixModel, but the user wants it to be treated as a read-only model. This is commonly used to allow users to browse, but not edit, normally writable matricies of data.

resizableColumns

 public boolean isResizableColumns()
 public void setResizableColumns(boolean resizable)
The resizableColumns property controls whether or not the grid columns are resizable by the user. The default is true, and the columns can be resized using the mouse.

resizableRows

 public boolean isResizableRows()
 public void setResizableRows(boolean resizable)
The resizableRows property controls whether or not the grid rows are resizable by the user. The default is true, and the rows can be resized using the mouse.

rowHeaderView

 public HeaderView getRowHeaderView()
Determines the HeaderView class instance used for the row header.

rowHeaderVisible

 public boolean isRowHeaderVisible()
 public void setRowHeaderVisible(boolean visible)
The rowHeaderVisible property controls whether or not the rowHeader is visible. The default is true.

rowHeaderWidth

 public int getRowHeaderWidth()
 public void setRowHeaderWidth(int width)
The rowHeaderWidth property defines the width of the row header in pixels.

rowSizes

 public SizeVector getRowSizes()
 public void setRowSizes(borland.jbcl.view.SizeVector newSizes)
The rowSizes property defines a SizeVector to manage the row heights in the grid. SizeVector is an interface that has two common implementations: FixedSizeVector, and VariableSizeVector. FixedSizeVector (which is the default for rowSizes) keeps all the row sizes identical. VariableSizeVector allows a different size for each row.

selection

 public WritableMatrixSelection getSelection()
 public void setSelection(borland.jbcl.model.WritableMatrixSelection wms)
The selection property defines a WritableMatrixSelection manager. This allows multiple matrix viewers to share the same selection pool, and allows the grid to handle selection in a generic manner. This allows users to plug in their own implemention of a selection manager, to have custom selection behavior.

showFocus

 public boolean isShowFocus()
 public void setShowFocus(boolean visible)
The showFocus property enables or disables the painting of the focus rectangle on the current subfocus cell. In reality, the showFocus property turns on or off the FOCUSED bit in the state information that is passed to the ItemPainter when a cell is painted. If an ItemPainter plugged into the grid ignores the FOCUSED bit, this property will have no effect. By default, showFocus is true.

showRollover

 public boolean isShowRollover()
 public void setShowRollover(boolean showRollover)
The showRollover property enables and disables the repainting of the rollover cell. The rollover cell is the cell that currently has the mouse floating over it. If an ItemPainter plugged into the grid ignores the ROLLOVER bit, this property has no effect. By default, showRollover is false.

subfocus

 public MatrixLocation getSubfocus()
 public void setSubfocus(borland.jbcl.model.MatrixLocation newSubfocus)
The subfocus property defines the "current" cell (defined by a MatrixLocation) in the grid. This is the cell that is receiving keyboard input. The subfocus can be set using a MatrixLocation, or by specifying a row and column pair.

texture

 public Image getTexture()
 public void setTexture(java.awt.Image texture)
The texture property defines an image that is tiled to fill the background of the grid.

toolTipText

 public String getToolTipText()
 public void setToolTipText(java.lang.String text)
Determines the text that appears in the tool tip window. Specify the text as the value of the text parameter.

verticalLines

 public boolean isVerticalLines()
 public void setVerticalLines(boolean visible)
verticalLines determines whether the vertical grid lines appear between the columns in the grid. The default value is true.

viewManager

 public MatrixViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.MatrixViewManager viewManager)
The viewManager property defines the MatrixViewManager that brokers ItemPainters and ItemEditors to this grid. If a ColumnView has a defined ItemPainter or ItemEditor for a particular column, it will used. If none is defined, which is typical, the ItemPainters and ItemViewers are obtained from this view manager.

writeModel

 public WritableMatrixModel getWriteModel()
Returns the WritableMatrixModel for the GridView.

GridView methods

checkParentWindow()

  public void checkParentWindow()

columnHeaderClicked(int)

  protected void columnHeaderClicked(int index)
Moves the subfocus to the cell in the current row with the column position specified by the index parameter.

createDefaultModel()

  protected MatrixModel createDefaultModel()
Creates a BasicMatrixContainer.

createDefaultSelection()

  protected WritableMatrixSelection createDefaultSelection()
Creates a SingleMatrixSelection.

createDefaultViewManager()

  protected MatrixViewManager createDefaultViewManager()
Creates a BasicViewManager.

endEdit()

  public void endEdit()
Ends the current edit session (if any). If the value has been modified, it will be posted if postOnEndEdit is set to true (the default). If postOnEndEdit is false, the edit session will be terminated without saving the changes to the cell value.

endEdit(boolean)

  public void endEdit(boolean post)
Ends the current edit session (if any). If the value has been modified, it will be posted if post is set to true. If post is false, the edit session will be terminated without saving the changes to the cell value.

getCellRangeRect(borland.jbcl.model.MatrixLocation, borland.jbcl.model.MatrixLocation)

  public Rectangle getCellRangeRect(borland.jbcl.model.MatrixLocation start, borland.jbcl.model.MatrixLocation end)
Returns the Rectangle (in pixels) that bounds the range of cells at the specified locations. Coordinates are relative to the entire scrollable region inside of the GridView. Use getScrollPosition() and getViewportSize() to calculate relative point positions to external components.

Returns the bounding rectangle of the cell range.

Parameters:

start
The top-left cell location to calculate.
end
The bottom-right cell location to calculate.

getCellRect(borland.jbcl.model.MatrixLocation)

  public Rectangle getCellRect(borland.jbcl.model.MatrixLocation cell)
Returns the Rectangle (in pixels) that bounds the cell at the specified location. Coordinates are relative to the entire scrollable region inside of the GridView. Use getScrollPosition() and getViewportSize() to calculate relative point positions to external components.

Returns the bounding rectangle of the cell range.

Parameters:

cell
The cell that you want the rectangle for.

getColumnOrdinal(int)

  public int getColumnOrdinal(int displayColumn)
A ColumnView may not appear in the columnViews array at the same ordinal as its data does in the model. Use getColumnOrdinal() to determine the MatrixModel column ordinal for a display column.

getColumnView(int)

  public ColumnView getColumnView(int index)
Returns the ColumnView object specified with the index parameter from the ColumnViews array.

getColumnWidth(int)

  public int getColumnWidth(int row)
Returns the width of the column. The columnSizes property is a VariableSizeVector that contains the widths of all columns in the grid. getColumnWidth() calls core.getColumnSizes().getSize(row), so the row parameter for getColumnWidth() refers to the item in the vector, which identifies the column for which you want the width.

getRowHeight(int)

  public int getRowHeight(int row)
Returns the row height of the row specified with the row parameter.

hasFocus()

  public boolean hasFocus()

Overrides: com.sun.java.swing.JComponent.hasFocus() Determines whether the grid has the focus. If it returns true, the grid has the focus.

hitTest(int, int)

  public MatrixLocation hitTest(int x, int y)
Returns the address (MatrixLocation) of the cell at the coordinates specified. Coordinates are relative to the entire scrollable region inside of the GridView. Use getScrollPosition() and getViewportSize() to calculate relative point positions to external components.

Returns the MatrixLocation (row,column) that was hit, or null if nothing was hit.

Parameters:

x
The x location.
y
The y location.

init()

  protected void init()

repaintCell(borland.jbcl.model.MatrixLocation)

  public void repaintCell(borland.jbcl.model.MatrixLocation cell)
Repaints the cell at the passed location.

repaintCells()

  public void repaintCells()
Repaints all the visible cells in the grid.

repaintCells(borland.jbcl.model.MatrixLocation, borland.jbcl.model.MatrixLocation)

  public void repaintCells(borland.jbcl.model.MatrixLocation start, borland.jbcl.model.MatrixLocation end)
Repaints all the visible cells in the range between the start and end cell location.

Parameters:

start
The top-left cell location to repaint.
end
The bottom-right cell location to repaint.

requestFocus()

  public void requestFocus()

Overrides: com.sun.java.swing.JComponent.requestFocus()

reset()

  public void reset()
Resets the scroll position, sets the subfocus back to (0,0), and makes sure the grid is properly sized and validated.

resyncEditor()

  public void resyncEditor()
Moves any embedded editor to its proper position (and size) if the GridView has been externally manipulated. This method is used by subclasses or consumers that are manipulating the rowSizes and columnSizes while the grid is in an edit session.

rowHeaderClicked(int)

  protected void rowHeaderClicked(int index)
Moves the subfocus to the cell in the current column with the row position specified by the index parameter.

safeEndEdit()

  public void safeEndEdit()
Ends the current edit session (if any), catching any exceptions. If the value has been modified, it will be posted if postOnEndEdit is set to true (the default). If postOnEndEdit is false, the edit session will be terminated without saving the changes to the cell value.

safeEndEdit(boolean)

  public void safeEndEdit(boolean post)
Ends the current edit session (if any), catching any exceptions. If the value has been modified, it will be posted if post is set to true. If post is false, the edit session will be terminated without saving the changes to the cell value.

setColumnView(int, borland.jbcl.view.ColumnView)

  public void setColumnView(int index, borland.jbcl.view.ColumnView col)
A ColumnView defines the view state information for a particular column in the grid. The ColumnView class defines properties such as background, foreground, and font. Every column displayed in the grid has a ColumnView to go with it. Individual ColumnViews can be set using this indexed columnView property. The entire set of ColumnViews can be set using the columnViews property.

setColumnWidth(int, int)

  public void setColumnWidth(int column, int width)
Individual column widths can be modified using the columnWidth indexed property. Column widths are controlled by a SizeVector, which, by default, is a VariableSizeVector. If you want the columns to all match widths, see the columnSizes property to plug in a FixedSizeVector.

setRowHeight(int, int)

  public void setRowHeight(int row, int height)
Individual row heights can be modified using the rowHeight indexed property. Row heights are controlled by a SizeVector, which, by default, is a FixedSizeVector. A FixedSizeVector will set all of the row heights to the setting that is passed, regardless of the row index passed. If you want to modify individual row heights, use the rowSizes property, to plug in a VariableSizeVector.

setSubfocus(int, int)

  public void setSubfocus(int row, int column)
Sets the subfocus to the cell specified with the row and column parameters.

startEdit(borland.jbcl.model.MatrixLocation)

  public void startEdit(borland.jbcl.model.MatrixLocation cell)
Starts an edit session at the cell location defined by cell. If editInPlace is false or if readOnly is true, this method is a no-op.

updateUI()

  public void updateUI()

Overrides: com.sun.java.swing.JScrollPane.updateUI() Updates the user interface of the view in preparation for painting.


GridView event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public void removeContainerListener(java.awt.event.ContainerListener )

customItem

 public void addCustomItemListener(borland.jbcl.view.CustomItemListener l)
 public void removeCustomItemListener(borland.jbcl.view.CustomItemListener l)

focus

 public void addFocusListener(java.awt.event.FocusListener listener)
 public void removeFocusListener(java.awt.event.FocusListener listener)

header

 public void addHeaderListener(borland.jbcl.view.HeaderListener l)
 public void removeHeaderListener(borland.jbcl.view.HeaderListener l)

key

 public void addKeyListener(java.awt.event.KeyListener l)
 public void removeKeyListener(java.awt.event.KeyListener l)

model

 public void addModelListener(borland.jbcl.model.MatrixModelListener listener)
 public void removeModelListener(borland.jbcl.model.MatrixModelListener listener)

mouse

 public void addMouseListener(java.awt.event.MouseListener l)
 public void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

selection

 public void addSelectionListener(borland.jbcl.model.MatrixSelectionListener listener)
 public void removeSelectionListener(borland.jbcl.model.MatrixSelectionListener listener)

subfocus

 public void addSubfocusListener(borland.jbcl.model.MatrixSubfocusListener listener)
 public void removeSubfocusListener(borland.jbcl.model.MatrixSubfocusListener listener)

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )