borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.control 

GridControl component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.Panel
                           +----borland.jbcl.view.GridView
                                   +----borland.jbcl.control.GridControl

About the GridControl component

Variables  Constructors  Properties  Methods  Event Listeners

Implements AccessListener, DataChangeListener, NavigationListener, MatrixModel, MatrixSubfocusListener, WritableMatrixModel, BlackBox, HeaderListener, MatrixView, Scroller, MenuContainer, ImageObserver, Serializable, EventListener

This component allows database- or spreadsheet-type editing of data. It contains top and left Header objects and extends GridView.

The GridControl is a graphical user interface element that shows a table of values. Use a GridControl when you want to display a table of values in your application. This value can be any specific table of items, or a value stored in a DataSet.

The GridControl is a composite component that follows the model-view architecture and uses a Grid data model. Use the Grid data model if you want to display a specified table of values.

The GridControl can also derive its value from a DataSet. In such cases, the data source of this value is specified by its dataSet properties.


GridControl variables

Variables implemented in borland.jbcl.view.GridView

Variables implemented in java.awt.Component

GridControl constructors

GridControl properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.GridView

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

GridControl methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.GridView

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

GridControl event listeners


GridControl constructors

GridControl()

  public GridControl()
Uses GridView to construct a GridControl component with no generated columns. Includes a horizontal header and, if allowed, a vertical header. Creates a temporary placeholder dataset using TableDataSet. Includes a single column with a null heading.


GridControl properties

autoInsert

 public boolean isAutoInsert()
 public void setAutoInsert(boolean auto)

The autoInsert property stores whether to automatically insert a row. Inserts a blank data object when the GridControl is empty.

When focusGained is called, if the grid is not read-only and if there are variable rows, this method adds a row.

The default is true.

columnCount

 public int getColumnCount()
The columnCount property stores the number of columns in the GridControl.

columnViews

 public void setColumnViews(borland.jbcl.view.ColumnView[] newViews)
A ColumnView is the set of properties that describe a visible column in the GridControl.

Overrides: borland.jbcl.view.GridView.columnViews

dataSet

 public DataSet getDataSet()
 public void setDataSet(borland.jbcl.dataset.DataSet newDataSet)
The data source that provides items to show in the GridControl.

items

 public synchronized String[][] getItems()
 public synchronized void setItems(java.lang.String[][] newItems)
Set this property to make the grid control behave like a string grid.

This is a non-data-aware property for data. Uses an internal model for spreadsheet-type uses.

The items property in the Component Inspector shows the following dialog:

model

 public void setModel(borland.jbcl.model.MatrixModel model)
The object that actually contains the data. Used by the items property.

multiSelect

 public boolean isMultiSelect()
 public void setMultiSelect(boolean select)
Allows or prevents user-selection of a range of cells. Overrides selectRow and selectColumn.

navigateWithDataSet

 public boolean isNavigateWithDataSet()
 public void setNavigateWithDataSet(boolean navigate)
Set this property to control whether the GridControl's sub-focus drives the dataSet and vice-versa. If true, navigating within the Grid navigates all controls connected to the same dataSet. If false, the Grid will navigate independently of other controls connected to the dataSet.

rowCount

 public int getRowCount()
The rowCount property stores the number of rows that are in the model that supplies the GridControl.

selectColumn

 public boolean isSelectColumn()
 public void setSelectColumn(boolean select)
Selects the entire column as you navigate within the GridControl.

selectRow

 public boolean isSelectRow()
 public void setSelectRow(boolean select)
Specifies whether the entire row is selected as you navigate within the GridControl.

showPopup

 public boolean isShowPopup()
 public void setShowPopup(boolean show)

Whether to show the context menu when the pointer is over the grid cells and the user right-clicks. The menu is shown below.

sortOnHeaderClick

 public boolean isSortOnHeaderClick()
 public void setSortOnHeaderClick(boolean sort)
If true and dataSet is set, sorts on the selected column. If false or if dataSet is not set, moves the focus to that column.

variableColumns

 public boolean isVariableColumns()
The variableColumns property stores whether columns can be added to or removed from the matrix model that supplies the GridControl. If true, columns can be added or removed.

variableRows

 public boolean isVariableRows()
The variableRows property stores whether rows can be added to or removed from the matrix model that supplies the GridControl. If true, rows can be added or removed.


GridControl methods

addNotify()

  public void addNotify()
A hook to open the dataSet when the Grid is displayed, if the dataSet's autoOpen property is set.

buildColumnViews(borland.jbcl.dataset.DataSet, borland.jbcl.view.ColumnView[], boolean)

  protected ColumnView[] buildColumnViews(borland.jbcl.dataset.DataSet cursor, borland.jbcl.view.ColumnView[] oldViews, boolean rebuild)
Returns an array of columnViews constructed from the passed DataSet and array of old columnView components. If rebuild is true, it ignores old columnView components and constructs a new array based on the passed DataSet. If rebuild is false, it merely fills in un-set properties in the old columnViews with values from the DataSet.

columnHeaderClicked(int)

  protected void columnHeaderClicked(int column)
An event response. Checks on the states of sort and acts accordingly.

Overrides: borland.jbcl.view.CompositeGridView.columnHeaderClicked(int)

toggleColumnSort(int)

  public void toggleColumnSort(int column)
Calls DataSet.toggleViewOrder() for the current column. Only applies if a DataSet is used. If the DataSet is in the editing state, saves the current row to the DataSet.


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

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)

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)