borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.view 

ScrollPaneGridView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.ScrollPane
                           +----borland.jbcl.view.ScrollPaneGridView

About the ScrollPaneGridView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements MatrixView, Scroller, MenuContainer, ImageObserver, Serializable

The ScrollPaneGridView component is a scrollable view of matrix data. It is composed of a ScrollPane.


ScrollPaneGridView variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in java.awt.ScrollPane

ScrollPaneGridView constructors

ScrollPaneGridView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.awt.ScrollPane

Properties implemented in java.lang.Object

ScrollPaneGridView methods

Methods implemented in this class

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.ScrollPane

Methods implemented in java.lang.Object

ScrollPaneGridView event listeners


ScrollPaneGridView variables

prefSize

  protected Dimension prefSize

ScrollPaneGridView constructors

ScrollPaneGridView()

  public ScrollPaneGridView()

ScrollPaneGridView properties

alwaysEdit

 public boolean isAlwaysEdit()
 public void setAlwaysEdit(boolean alwaysEdit)
Controls whether or not the grid automatically starts an edit session when subfocus moves to a new cell. By default, this property is set to false, and a user must type a key, double-click, or hit F2 to edit a cell's value. If true, moving subfocus always starts an edit session of the cell.

autoEdit

 public boolean isAutoEdit()
 public void setAutoEdit(boolean autoEdit)
Determines whether cell editing is automatic 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 false, the user must hit F2, Ctrl+Enter, or double click to start an edit session.

batchMode

 public boolean isBatchMode()
 public void setBatchMode(boolean batchMode)
Determines whether all painting in the grid is enabled or disabled. This is useful when performing large-scale programmatic updates to the grid's model, selection, subfocus, and so on where you want to suppress the repaint messages until the updates have completed.

columnSizes

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

See also: resyncEditor()

columnViews

 public ColumnView[] getColumnViews()
 public void setColumnViews(borland.jbcl.view.ColumnView[] columnViews)
Specifies the borland.jbcl.view.ColumnView class object that defines the view state information for a particular column in the grid. The ColumnView class defines such properties as background, foreground, font, and so on. Every Column displayed in the grid has an associated ColumnView component. Individual ColumnView components can be set using this property as well as the entire set of ColumnView components.

coreComponent

 public Component getCoreComponent()
Returns the core object as a Component.

defaultColumnWidth

 public int getDefaultColumnWidth()
 public void setDefaultColumnWidth(int defaultWidth)
The column width used for new columns inserted into the grid. The default is 100 pixels.

doubleBuffer

 public boolean isDoubleBuffer()
 public void setDoubleBuffer(boolean doubleBuffer)
Enables or disables the double-buffered screen painting built into the grid. The default value is true, meaning that the grid paints all of the visible cells onto an off-screen image before blitting (block transferring) the image onto the screen (to prevent flicker). Setting doubleBuffer to false disables this functionality, and all ItemPainters then paint directly to the screen. This property is set to false when a user is placing a grid onto a Panel (or some container) that has its own double-buffering, or if flickering is not a problem.

dragSubfocus

 public boolean isDragSubfocus()
 public void setDragSubfocus(boolean dragSubfocus)
Enables or disables dragging of the subfocus cell when dragging the mouse pointer over the grid (with the button depressed). By default this property is true.

editInPlace

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

editing

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

gridLineColor

 public Color getGridLineColor()
 public void setGridLineColor(java.awt.Color gridLineColor)
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)
Shows or hides the grid lines. The default is true.

increments

 public void setIncrements(java.awt.Point p)

minimumSize

 public Dimension getMinimumSize()

model

 public MatrixModel getModel()
 public void setModel(borland.jbcl.model.MatrixModel model)
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 the getWriteModel() method.

postOnEndEdit

 public boolean isPostOnEndEdit()
 public void setPostOnEndEdit(boolean post)
Controls whether or not the grid posts changes to a cell back to the model when the user clicks or tabs off of the cell. If false, the new edited value in a cell is not saved unless committed by hitting the Enter key. Clicking anywhere off the cell being edited reverts the cell's 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)

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)
Determines whether the model is treated as a read-only model or not. Used when the model property is actually a WritableMatrixModel, but you want 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.

rowSizes

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

See also: resyncEditor()

scrollUnits

 public int getScrollUnits()

selection

 public WritableMatrixSelection getSelection()
 public void setSelection(borland.jbcl.model.WritableMatrixSelection wms)
Defines a WritableMatrixSelection manager. This allows multiple matrix viewers to share the same selection pool and for the grid to handle selection in a generic manner. Users can therefore plug in their own implemention of a selection manager to have custom selection behavior.

showFocus

 public boolean isShowFocus()
 public void setShowFocus(boolean visible)
Enables or disables the painting of the focus rectangle on the current subfocus cell. In reality, the showFocus property toggles the FOCUSED bit in the state information that is passed to the ItemPainter when a cell is painted. In cases where an ItemPainter that is plugged into the grid ignores the FOCUSED bit, this property has no effect. This property defaults to true.

snapOrigin

 public boolean isSnapOrigin()
 public void setSnapOrigin(boolean snapOrigin)
Controls whether or not the grid automatically snaps the scroll position to align the top-left cell with the edges of the grid. If set to false, the grid does not snap the scroll position, and it scrolls smoothly with changes to the subfocus cell. This property defaults to true.

subfocus

 public MatrixLocation getSubfocus()
 public void setSubfocus(borland.jbcl.model.MatrixLocation newSubfocus)
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.

viewManager

 public MatrixViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.MatrixViewManager viewManager)
Defines the MatrixViewManager that brokers the ItemPainter and ItemEditor classes to this grid. If a ColumnView has a defined ItemPainter and/or ItemEditor for a particular Column, those will be used. If not (the more common case), the ItemPainter and ItemViewer objects are obtained from this ViewManager. The ViewManager is esentially a back-stop for the grid.

writeModel

 public WritableMatrixModel getWriteModel()

ScrollPaneGridView methods

endEdit()

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

endEdit(boolean)

  public void endEdit(boolean post)
Ends the current edit session (if any). If the value has been modified, it is posted if the post parameter is set to true. If post is false, the edit session is terminated without saving the changes to the cell's 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 ScrollPaneGridView. Use the getScrollPosition() and getViewportSize() methods to calculate relative point positions to external components.

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 ScrollPaneGridView. Use the getScrollPosition() and getViewportSize() methods to calculate relative point positions to external components.

Parameters:

cell
The cell that you want the rectangle for.

getColumnView(int)

  public ColumnView getColumnView(int index)

getColumnWidth(int)

  public int getColumnWidth(int row)

getRowHeight(int)

  public int getRowHeight(int row)

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 ScrollPaneGridView. Use the getScrollPosition() and getViewportSize() methods to calculate relative point positions to external components. This method returns the hit MatrixLocation (row,column), or null if nothing was hit.

Parameters:

x
The x location.
y
The y location.

repaintCell(borland.jbcl.model.MatrixLocation)

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

Parameters:

cell
The MatrixLocation that you want repainted.

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: java.awt.Component.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 ScrollPaneGridView has been externally manipulated. This method is used by subclasses or consumers that are manipulating the rowSizes and columnSizes properties while the grid is in an edit session.

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 component defines such properties as background, foreground, font, and so on. Every Column displayed in the grid has an associated ColumnView and individual ColumnView components can be set using this indexed ColumnView property. The entire set of ColumnView components 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 all columns to 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 sets ALL the row heights to the setting that is passed, regardless of the row index passed. See the rowSizes property to plug in a VariableSizeVector if you want to modify individual row heights.

setSubfocus(int, int)

  public void setSubfocus(int row, int column)

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 the editInPlace property is false or if readOnly is true, this method does nothing.

Parameters:

The n to start the edit session at.

ScrollPaneGridView 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)

component

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

container

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

focus

 public void addFocusListener(java.awt.event.FocusListener l)
 public void removeFocusListener(java.awt.event.FocusListener 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)

motionMouse

 public void removeMotionMouseListener(java.awt.event.MouseMotionListener l)

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)

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)