|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.eliad.swing.JSmartGrid
The JSmartGrid is a JComponent where grid-oriented data can be displayed.
The data is represented by several models:
GridModel
represents a matrix with a given
number of row and columns, and values (Object
s) in each cell,
which may be editable or not.SpanModel
expresses the fact that cells
may be merged into rectangular areas. The topleft cell of such an area
is taken to be the cell actually displayed and the others "disappear"
while the span is in effect.StyleModel
specifies how given values in given
cells are rendered and edited.RulerModel
s, one each for both rows and columns,
specify (pixel) sizes, visibility, and resizing behavior along the two orientations.
Note that this does not assume the existence of header components.GridSelectionModel
specifies the user selection
behavior. Selection modes combine a unit (cell, row, or column) and a range type
(single, continuous, and any).
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
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 |
Constructor Summary | |
JSmartGrid()
Constructs a default JSmartGrid of size 10x10, using
a GenericGridModel .
|
|
JSmartGrid(GridModel model)
Constructs a JSmartGrid with a given GridModel ,
a null SpanModel , and a default StyleModel .
|
|
JSmartGrid(GridModel model,
SpanModel spanModel)
Constructs a JSmartGrid with a given GridModel ,
a given SpanModel , and a default StyleModel . |
|
JSmartGrid(GridModel model,
SpanModel spanModel,
StyleModel styleModel)
Constructs a JSmartGrid with a given GridModel ,
a given SpanModel , and a given StyleModel . |
|
JSmartGrid(int rowCount,
int columnCount)
Constructs a JSmartGrid of a given size, using
a GenericGridModel .
|
Method Summary | |
void |
addGridEditingListener(GridEditingListener l)
Adds a listener to the list that is notified each time an editing event occurs. |
void |
addGridListener(GridListener l)
Adds a listener to the list that is notified each time a cell event occurs. |
void |
addNotify()
Calls the configureEnclosingScrollPane method. |
void |
addVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
Adds an item to the vetoable property change listeners list. |
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds an item to the vetoable property change listeners list. |
void |
anchorChanged(GridSelectionEvent event)
|
void |
beforeItemsMoved(RulerModelEvent e)
Received a prenotification that ruler items are to be moved. |
void |
changeSelection(int row,
int column,
boolean toggle,
boolean extend)
Updates the selection models of the grid, depending on the state of the two flags: toggle and extend . |
void |
clearSelection()
Unselects all selected cells. |
protected java.awt.AWTEvent |
coalesceEvents(java.awt.AWTEvent existingEvent,
java.awt.AWTEvent newEvent)
Potentially coalesce an event being posted with an existing event. |
int |
columnAtPoint(java.awt.Point point)
Returns the index of the column that point lies in. |
int |
columnAtX(int x)
Returns the index of the column that x lies in. |
protected void |
columnsResized(int resizingItem)
Call-back for column resizing. |
protected void |
configureEnclosingScrollPane()
If this JSmartGrid is the viewportView of an enclosing JScrollPane
(as is usually the case), configure this ScrollPane by
installing the grid's gridHeader s as the HeaderView s of the scroll pane.
|
protected RulerModel |
createDefaultColumnModel()
Creates a default column model for an autonomous grid, based on the grid model dimension. |
protected RulerModel |
createDefaultRowModel()
Creates a default row model for an autonomous grid, based on the grid model dimension. |
protected javax.swing.JComponent |
createHeader(int orientation)
Creates a default header for this JSmartGrid object. |
protected static javax.swing.JComponent |
createHeader(JSmartGrid mainGrid,
int orientation)
Creates the preferred header for a JSmartGrid with a DefaultHeaderModel and DefaultHeaderStyleModel. |
protected static javax.swing.JComponent |
createHeader(JSmartGrid mainGrid,
int orientation,
GridModel gm,
SpanModel sm,
StyleModel uim)
Creates the preferred header for a JSmartGrid with specific GridModel, SpanModel and StyleModel. |
protected javax.swing.CellRendererPane |
createRendererPane()
Factory method to create the cellRendererPane used to render the cells. |
protected javax.swing.JComponent |
createTopLeft(JSmartGrid rowHeader,
RulerModel rowHeaderHorizontalRuler,
GridModel rhm,
JSmartGrid columnHeader,
RulerModel columnHeaderVerticalRuler,
GridModel chm)
Creates a default top left corner component for this grid. |
protected void |
doEnsurePreferredSizeAt(int orientation,
int index)
Computes automatically a "best"size for a given item on a given orientation, based on the renderers preferred sizes. |
protected void |
doEnsurePreferredSizeAt(int orientation,
int index,
boolean abovePref)
Computes automatically a "best"size for a given item on a given orientation, based on the renderers preferred sizes. |
boolean |
editCellAt(int row,
int column)
Starts editing the cell at row and
column , if the cell is editable. |
boolean |
editCellAt(int row,
int column,
java.util.EventObject e)
Starts editing the cell at row and
column , if the cell is editable.
|
void |
editingCanceled(javax.swing.event.ChangeEvent e)
Invoked when editing is canceled. |
void |
editingStopped(javax.swing.event.ChangeEvent e)
Invoked when editing is finished. |
void |
ensureCellInVisibleRect(int row,
int column,
boolean isSpanSensitive)
Ensures that a given cell is in the visible rectangle, scrolling the view if necessary. |
protected boolean |
ensureNarrowSizes()
Computes automatic "best" sizes for the orientation on which the grid is dependent, unless it is fully dependent. |
void |
ensurePreferredSizeAt(int orientation,
int index)
Auto resize a column (resp. row). |
protected void |
fireEditingCanceled(int row,
int column)
Notifies registered listeners that editing was canceled in a given cell |
protected void |
fireEditingStarted(int row,
int column)
Notifies registered listeners that editing has started in a given cell |
protected void |
fireEditingStopped(int row,
int column)
Notifies registered listeners that editing is completed in a given cell |
protected void |
fireFocusGained(java.awt.event.InputEvent ie,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse exited a cell |
protected void |
fireFocusLost(java.awt.event.InputEvent ie,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse entered a cell |
protected void |
fireGridClicked(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that a click occurred in a cell |
protected void |
fireGridDragged(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse was dragged over a cell |
protected void |
fireGridEntered(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse entered a cell |
protected void |
fireGridExited(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse exited a cell |
protected void |
fireGridMoved(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse was moved over a cell |
protected void |
fireGridPressed(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse was pressed over a cell |
protected void |
fireGridReleased(java.awt.event.MouseEvent me,
int row,
int column,
int rowCount,
int columnCount)
Notifies registered listeners that the mouse was released over a cell |
void |
flushToolTipCache()
Invoked whenever the tooltips associated with cells components have changed, without the grid or style models having changed themselves. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JSmartGrid . |
JSmartGrid |
getActiveGrid(int orientation)
Returns the grid on which this grid is dependent for the given orientation, null if none. |
javax.swing.border.Border |
getCellBorder()
Returns the cell border for cells. |
java.awt.Rectangle |
getCellBounds(int row,
int column,
boolean isSpanSensitive,
boolean includeSpacing,
java.awt.Rectangle r)
Returns a rectangle for the cell that lies logically at the intersection of row and column , covering any overspanned cells.
|
java.awt.Dimension |
getCellMaximumSize(int row,
int column)
Returns the maximum size of a physical cell. |
java.awt.Dimension |
getCellMaximumSize(int row,
int column,
boolean isSpanSensitive)
Returns the maximum size of a cell. |
java.awt.Dimension |
getCellMinimumSize(int row,
int column)
Returns the minimum size of a physical cell. |
java.awt.Dimension |
getCellMinimumSize(int row,
int column,
boolean isSpanSensitive)
Returns the minimum size of a cell. |
java.awt.Dimension |
getCellPreferredSize(int row,
int column)
Returns the preferred size of a physical cell. |
java.awt.Dimension |
getCellPreferredSize(int row,
int column,
boolean isSpanSensitive)
Returns the preferred size of a cell. |
protected GridCellRenderer |
getCellRenderer(int row,
int column,
int height,
int width,
java.lang.Object id)
Returns an appropriate renderer for the cell specified by this row and column. |
JSmartGrid |
getColumnActiveGrid()
Returns the grid on which this grid is dependent for the horizontal orientation, null if none. |
int |
getColumnAutoResizeMode()
Returns the column auto resize mode of the grid. |
int |
getColumnCount()
|
java.awt.Component |
getColumnHeader()
Returns the component that serves as the horizontal header for this JSmartGrid ,
if any. |
int |
getColumnMargin()
Gets the amount of empty space (in pixels) between cells. |
RulerModel |
getColumnModel()
Returns the horizontal ruler model associated with this JSmartGrid . |
int |
getColumnPosition(int column)
Returns the leftmost horizontal coordinate (in pixels) of the cells in column . |
int |
getColumnWidth(int column)
Returns the width (in pixels) of the cells in column . |
GridCellEditor |
getCurrentCellEditor()
Returns the cell editor. |
int |
getDraggingDistance(int orientation)
Returns the dragging distance along the given orientation. |
protected java.awt.Component |
getEditorComponent()
Returns the component that is handling the editing session. |
java.awt.Rectangle |
getEnclosure(int row0,
int column0,
int row1,
int column1)
Computes the smallest rectangle enclosing two given cells and that fully contains any span that it crosses. |
int |
getFirstDraggingItem(int orientation)
Returns the index of the first item currently being dragged along the given orientation. |
int |
getFirstSelectedColumn()
|
int |
getFirstSelectedRow()
|
java.awt.Color |
getFocusBackgroundColor()
Returns the background color for the cells that have the focus. |
java.awt.Color |
getFocusForegroundColor()
Returns the foreground color for the cells that have the focus. |
javax.swing.border.Border |
getFocusHighlightBorder()
Returns the highlight border for the cells that have the focus. |
java.awt.Color |
getGridColor()
Returns the color used to draw grid lines. |
java.awt.Dimension |
getIntercellSpacing()
Returns the horizontal and vertical space between cells. |
int |
getLastDraggingItem(int orientation)
Returns the index of the last item currently being dragged along the given orientation. |
int |
getLastSelectedColumn()
|
int |
getLastSelectedRow()
|
protected int |
getListenerCount()
Returns the numbers of listeners of all types (bar the listeners on property change events). |
protected int |
getListenerCount(java.lang.Class clazz)
Returns the numbers of listeners of a given type. |
GridModel |
getModel()
Returns the data model associated with this JSmartGrid . |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for this table. |
protected GridContext |
getRendererContext(int row,
int column,
int height,
int width,
java.lang.Object identifier)
Returns the JSmartGrid viewed as a GridContext for a given cell |
java.awt.Component |
getRenderingComponent(int row,
int column)
Returns the component suitable for a specific cell. |
protected java.awt.Component |
getRenderingComponent(int row,
int column,
boolean isSpanSensitive)
Returns the component suitable for a specific cell. |
int |
getResizingItem()
Returns the index of the item currently used to resize cells. |
int |
getResizingOrientation()
Returns the orientation of the axis along which cells are currently resized. |
JSmartGrid |
getRowActiveGrid()
Returns the grid on which this grid is dependent for the vertical orientation, null if none. |
int |
getRowAutoResizeMode()
Returns the row auto resize mode of the grid. |
int |
getRowCount()
|
java.awt.Component |
getRowHeader()
Returns the component that serves as the vertical header for this JSmartGrid ,
if any. |
int |
getRowHeight(int row)
Returns the height (in pixels) of the cells in row . |
int |
getRowMargin()
Gets the amount of empty space (in pixels) between cells. |
RulerModel |
getRowModel()
Returns the vertical ruler model associated with this JSmartGrid . |
int |
getRowPosition(int row)
Returns the top vertical coordinate (in pixels) of the cells in row . |
RulerModel |
getRulerModel(int orientation)
Returns one of the ruler models associated with this JSmartGrid . |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the scroll increment (in pixels) that completely exposes one new "page". |
boolean |
getScrollableTracksViewportHeight()
Decides whether the height of the viewport determines the height of the grid. |
boolean |
getScrollableTracksViewportWidth()
Decides whether the width of the viewport determines the width of the grid. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation). |
java.awt.Rectangle |
getSelectableEnclosure(int row0,
int column0,
int row1,
int column1)
|
int |
getSelectedCellsCount(boolean isSpanSensitive)
Returns the number of selected cells in the data model. |
int |
getSelectedColumnCount()
Returns the number of selected columns. |
int[] |
getSelectedColumns()
Returns the selected columns as an array of their indexes. |
int |
getSelectedRowCount()
Returns the number of selected rows. |
int[] |
getSelectedRows()
Returns the selected rows as an array of their indexes. |
java.awt.Color |
getSelectionBackgroundColor()
Returns the background color for selected cells. |
javax.swing.border.Border |
getSelectionCellBorder()
Returns the border for selected cells |
java.awt.Color |
getSelectionForegroundColor()
Returns the foreground color for selected cells. |
int |
getSelectionMode()
Returns the current selection mode. |
GridSelectionModel |
getSelectionModel()
Returns the selection model associated with this JSmartGrid . |
int |
getSelectionPolicy()
Returns the current selection policy. |
int |
getSelectionUnit()
Returns the current selection unit. |
boolean |
getShowHorizontalLines()
Returns true if the grid draws horizontal lines between cells, false if it doesn't. |
boolean |
getShowVerticalLines()
Returns true if the grid draws vertical lines between cells, false if it doesn't. |
SpanModel |
getSpanModel()
Returns the span model associated with this JSmartGrid . |
ExtentCell |
getSpanOver(int row,
int column)
Obtains the span which contains the cell at row , column .
|
StyleModel |
getStyleModel()
Returns the style model associated with this JSmartGrid . |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
Returns the tooltip string that has been set with setToolTipText(). |
GridUI |
getUI()
Returns the Look & Feel object that renders this component. |
java.lang.String |
getUIClassID()
Returns the suffix used to construct the name of the L&F class used to render this component. |
java.lang.Object |
getValueAt(int row,
int column)
Returns the cell value at row and column .
|
protected javax.swing.JViewport |
getViewport()
Returns the viewport containing the grid, when the grid has been embedded in a scroll pane. |
java.awt.Rectangle |
getVisibleRect()
Returns the part of the grid that is currently not obscured by ancestors. |
void |
gridDataChanged(GridModelEvent e)
Call-back from the GridModel
after data was updated in some cells. |
void |
gridModelChanged(GridModelEvent e)
Call-back from the GridModel
after a global model change. |
void |
gridStructureChanged(GridModelEvent e)
Call-back from the GridModel
after a continuous block of either rows or columns
was either inserted or deleted. |
void |
hideGrid()
Supresses all forms of grid separation, both grid lines and intercells margins. |
void |
hierarchyChanged(java.awt.event.HierarchyEvent e)
Called when the hierarchy has been changed. |
protected void |
initializeTransients()
This is code that needs to be executed both by all constructorrs and by deserialization ( readObject ).
|
boolean |
isAutoCreateColumnHeader()
Returns true if a row header will be automatically created if the grid is set inside a javax.swing.JScrollPane . |
boolean |
isAutoCreateRowHeader()
Returns true if a row header will be automatically created if the grid is set inside a javax.swing.JScrollPane . |
boolean |
isCellEditable(int row,
int column,
boolean isSpanSensitive)
Returns true if the cell at row and column
is editable. |
boolean |
isCellSelected(int row,
int column,
boolean isSpanSensitive)
Returns true if the cell at the specified position is selected. |
boolean |
isColumnDraggable()
Returns the draggability of columns in the grid. |
boolean |
isColumnHeader()
Returns true if this grid is a column header, such that it is inside a scrollpane in the viewport reserved for column headers. |
boolean |
isColumnLeader()
Returns true if this grid is active along the horizontal axis. |
boolean |
isColumnResizable()
Returns the resizability of columns in the grid. |
boolean |
isColumnSelected(int column)
Returns true if the specified column is selected. |
boolean |
isColumnVisible(int column)
Returns the visibility of the column column . |
boolean |
isCorner()
Returns true if this grid is a corner grid, such that it is inside a scrollpane in the viewport reserved for corner components. |
boolean |
isDraggable(int orientation)
Returns the draggability of the grid for a given orientation. |
boolean |
isDragging(int orientation)
Returns true if the grid is being dragged on a ruler chosen by an orientation. |
boolean |
isEditing()
Returns true if a cell is being edited. |
boolean |
isFocusTraversable()
This method, whose implementation in JComponent
returns false, is overloaded to return true. |
boolean |
isLeader(int orientation)
Returns true if this grid is active for the given orientation. |
boolean |
isManagingFocus()
This method, whose implementation in JComponent
returns false, is overloaded to return true. |
boolean |
isResizable(int orientation)
Returns the resizability of the grid for a given orientation. |
boolean |
isResizing()
Returns true if the grid is being resized along a given orientation. |
boolean |
isRowDraggable()
Returns the draggability of rows in the grid. |
boolean |
isRowHeader()
Returns true if this grid is a row header, such that it is inside a scrollpane in the viewport reserved for row headers. |
boolean |
isRowLeader()
Returns true if this grid is active along the vertical axis. |
boolean |
isRowResizable()
Returns the resizability of rows in the grid. |
boolean |
isRowSelected(int row)
Returns true if the specified row is selected. |
boolean |
isRowVisible(int row)
Returns the visibility, of the row row . |
boolean |
isSelectionEmpty()
Returns true if no cells are selected. |
boolean |
isSpanEmpty()
Returns true if there is no spanned cell. |
protected void |
paintComponent(java.awt.Graphics g)
The JComponent method is overloaded here
in order to cleanup the CellRenderPane
used to "stencil" the individual cells
onto the JSmartGrid background. |
protected java.awt.Component |
prepareRenderer(GridCellRenderer renderer,
int row,
int column,
int height,
int width,
java.lang.Object id)
Prepares a renderer for display of a specific cell, taking into account whether the cell is the current one, whether it is selected, or editable. |
protected boolean |
processKeyBinding(javax.swing.KeyStroke ks,
java.awt.event.KeyEvent e,
int condition,
boolean pressed)
Invoked to process the key bindings for ks as the result of the Keystroke e .
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method is called when a bound property is changed. |
void |
rangeChanged(GridSelectionEvent event)
Invoked when the selection changes -- repaints to show the new selection. |
protected void |
removeEditor(boolean canceled,
boolean fireEvents)
Discards the editor object and frees the real estate it used for cell rendering. |
void |
removeGridEditingListener(GridEditingListener l)
Removes a listener from the list that is notified each time an editing event occurs. |
void |
removeGridListener(GridListener l)
Removes a listener from the list that is notified each time a a cell event occurs. |
void |
removeNotify()
Calls the unconfigureEnclosingScrollPane method. |
void |
removeVetoableChangeListener(java.lang.String propertyName,
java.beans.VetoableChangeListener listener)
Removes an item from the vetoable property change listeners list. |
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes an item from the vetoable property change listeners list. |
void |
resetDragging(int orientation)
Cancels all resizing along the given orientation |
void |
resizeAndRepaint()
Equivalent to revalidate followed by repaint . |
int |
rowAtPoint(java.awt.Point point)
Returns the index of the row that point lies in. |
int |
rowAtY(int y)
Returns the index of the row that y lies in. |
protected void |
rowsResized(int resizingItem)
Call-back for row resizing. |
void |
rulerDataChanged(RulerModelEvent e)
Call-back for whenever the ruler presentation model changes. |
void |
rulerModelChanged(RulerModelEvent e)
Call-back for global ruler model change. |
void |
rulerStructureChanged(RulerModelEvent e)
Call back for insertions and removals of items. |
void |
scrollRectToVisible(java.awt.Rectangle contentRect)
|
void |
selectAll()
Selects all the cells in the grid. |
void |
setActiveGrid(JSmartGrid activeGrid,
int orientation)
Specifies a grid on which this grid will be dependent along the given orientation. |
void |
setAutoCreateColumnHeader(boolean flag)
Determines whether a row header will be automatically created if the grid is set inside a javax.swing.JScrollPane . |
void |
setAutoCreateRowHeader(boolean flag)
Determines whether a row header will be automatically created if the grid is set inside a javax.swing.JScrollPane . |
void |
setAutoResizeMode(int mode)
Sets the grid's auto resize mode for both orientations. |
void |
setBounds(int x,
int y,
int width,
int height)
This method is overloaded here in order to enhance performance by communicating the area where efficient computations will be necessary. |
void |
setCellBorder(javax.swing.border.Border cellBorder)
Sets the border for cells. |
void |
setColumnActiveGrid(JSmartGrid activeGrid)
Specifies a grid on which this grid will be dependent for the horizontal orientation. |
void |
setColumnAutoResizeMode(int mode)
Sets the grid's auto resize mode for the horizontal axis. |
void |
setColumnDraggable(boolean isDraggable)
Changes the draggability of columns in the grid. |
void |
setColumnHeader(java.awt.Component c)
Sets the component that serves as the horizontal header for this JSmartGrid . |
void |
setColumnMargin(int columnMargin)
Sets the amount of empty space between cells in adjacent columns. |
void |
setColumnModel(RulerModel columnModel)
Sets a ruler presentation model for columns. |
void |
setColumnResizable(boolean isResizable)
Changes the resizability of columns in the grid. |
void |
setColumnVisible(int column,
boolean flag)
Sets the visibility for column . |
void |
setColumnWidth(int column,
int columnWidth)
Sets the width for column to columnWidth ,
revalidates, and repaints. |
void |
setDraggable(int orientation,
boolean isDraggable)
Changes the draggability of the grid for a given orientation. |
void |
setDraggingDistance(int orientation,
int d)
Changes the dragging distance along the given orientation. |
void |
setFirstDraggingItem(int orientation,
int index)
Sets the index of the first item currently being dragged along the given orientation. |
void |
setFocusBackgroundColor(java.awt.Color focusBackgroundColor)
Sets the background color for the cells that have the focus. |
void |
setFocusForegroundColor(java.awt.Color focusForegroundColor)
Sets the foreground color for the cells that have the focus. |
void |
setFocusHighlightBorder(javax.swing.border.Border focusHighlightBorder)
Sets the highlight border for cells that have the focus. |
void |
setGridColor(java.awt.Color gridColor)
Sets the color used to draw grid lines in gridColor and redisplays.
|
void |
setIntercellSpacing(java.awt.Dimension intercellSpacing)
Sets the rowMargin and the columnMargin --
the height and width of the space between cells -- to
intercellSpacing . |
void |
setLastDraggingItem(int orientation,
int index)
Sets the index of the first item currently being dragged along the given orientation. |
void |
setModel(GridModel model)
Sets the data model associated with this JSmartGrid . |
void |
setPreferredScrollableViewportSize(java.awt.Dimension size)
Sets the preferred size of the viewport for this table. |
void |
setResizable(int orientation,
boolean isResizable)
Changes the resizability of the grid for a given orientation. |
void |
setResizing(int orientation,
int index)
Sets the resizing index property on a ruler chosen by an orientation. |
void |
setRowActiveGrid(JSmartGrid activeGrid)
Specifies a grid on which this grid will be dependent for the vertical orientation. |
void |
setRowAutoResizeMode(int mode)
Sets the grid's auto resize mode for the vertical axis. |
void |
setRowDraggable(boolean isDraggable)
Changes the draggability of rows in the grid. |
void |
setRowHeader(java.awt.Component c)
Sets the component that serves as the vertical header for this JSmartGrid . |
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 |
setRowModel(RulerModel rowModel)
Sets a ruler model for rows. |
void |
setRowResizable(boolean isResizable)
Changes the resizability of rows in the grid. |
void |
setRowVisible(int row,
boolean flag)
Sets the visibility for row . |
void |
setRulerModel(RulerModel rulerModel)
Attaches a ruler model. |
void |
setSelectionBackgroundColor(java.awt.Color selectionBackgroundColor)
Sets the background color for selected cells. |
void |
setSelectionCellBorder(javax.swing.border.Border selectionCellBorder)
Sets the border for selected cells. |
void |
setSelectionForegroundColor(java.awt.Color selectionForegroundColor)
Sets the foreground color for selected cells. |
void |
setSelectionMode(int mode)
Sets the selection mode. |
void |
setSelectionModel(GridSelectionModel model)
Associates a new selection model with this JSmartGrid . |
void |
setSelectionPolicy(int policy)
Sets the selection policy. |
void |
setSelectionUnit(int unit)
Sets the selection unit. |
void |
setShowGrid(boolean showGrid)
Sets whether the grid draws grid lines around cells. |
void |
setShowHorizontalLines(boolean showHorizontalLines)
Sets whether the grid draws horizontal lines between cells. |
void |
setShowVerticalLines(boolean showVerticalLines)
Sets whether the grid draws vertical lines between cells. |
void |
setSpanModel(SpanModel spanModel)
Sets the span model associated with this JSmartGrid . |
void |
setStyleModel(StyleModel styleModel)
Sets the style model associated with this JSmartGrid . |
void |
setUI(GridUI ui)
Sets the Look & Feel object that renders this component and repaints. |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Sets the value for the cell in the grid model at row
and column .
|
void |
spanDataChanged(SpanModelEvent e)
Call-back from the SpanModel
after spans are modified, added or removed. |
java.util.Iterator |
spanIterator(int topRow,
int leftColumn,
int rowCount,
int columnCount,
boolean withUnspanned)
Obtains the spans intersecting a given rectangle (in cell positions). |
void |
spanModelChanged(SpanModelEvent e)
Call-back from the SpanModel
after all the span information changes. |
void |
spanStructureChanged(SpanModelEvent e)
Call-back from the SpanModel
after the underlying model shape is changed. |
void |
styleDataChanged(StyleModelEvent e)
Tells listeners that the renderer model was changed. |
void |
styleModelChanged(StyleModelEvent e)
Tells listeners that the model was changed. |
void |
styleStructureChanged(StyleModelEvent e)
Called when new renderer/editors are registered or when renderer/editors are forgotten |
void |
takeLeadershipOver(JSmartGrid grid,
int orientation)
Makes this grid the active one along the given orientation, making another grid dependent. |
protected void |
unconfigureEnclosingScrollPane()
Reverses the effect of configureEnclosingScrollPane
by removing the HeaderView s of the enclosing scroll pane.
|
void |
updateUI()
Notification from the UIManager that the L&F has changed.
|
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addPropertyChangeListener,
addPropertyChangeListener,
computeVisibleRect,
contains,
createToolTip,
disable,
enable,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getActionForKeyStroke,
getActionMap,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInputMap,
getInputMap,
getInputVerifier,
getInsets,
getInsets,
getListeners,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getPreferredSize,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getTopLevelAncestor,
getVerifyInputWhenFocusTarget,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
hide,
isDoubleBuffered,
isFocusCycleRoot,
isLightweightComponent,
isMaximumSizeSet,
isMinimumSizeSet,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isPreferredSizeSet,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
paramString,
print,
printAll,
printBorder,
printChildren,
printComponent,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
setActionMap,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setInputMap,
setInputVerifier,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVerifyInputWhenFocusTarget,
setVisible,
unregisterKeyboardAction,
update |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addHierarchyBoundsListener,
addHierarchyListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
contains,
createImage,
createImage,
disableEvents,
dispatchEvent,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphicsConfiguration,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
processComponentEvent,
processHierarchyBoundsEvent,
processHierarchyEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeHierarchyBoundsListener,
removeHierarchyListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public JSmartGrid(GridModel model, SpanModel spanModel, StyleModel styleModel)
JSmartGrid
with a given GridModel
,
a given SpanModel
, and a given StyleModel
.public JSmartGrid(GridModel model, SpanModel spanModel)
JSmartGrid
with a given GridModel
,
a given SpanModel
, and a default StyleModel
.public JSmartGrid(GridModel model)
JSmartGrid
with a given GridModel
,
a null SpanModel
, and a default StyleModel
.
Default models are generated for spans, selection and ruler.public JSmartGrid(int rowCount, int columnCount)
JSmartGrid
of a given size, using
a GenericGridModel
.
Default models are generated for span, selection and rulers.public JSmartGrid()
JSmartGrid
of size 10x10, using
a GenericGridModel
.
Default models are generated for span, selection and rulers.Method Detail |
protected final void initializeTransients()
readObject
).
It mainly initializes transient attributes to other
than default values.
Since this method must be called by constructors,
it cannot be overloaded.public final GridModel getModel()
JSmartGrid
.public void setModel(GridModel model)
JSmartGrid
.public final SpanModel getSpanModel()
JSmartGrid
.public void setSpanModel(SpanModel spanModel)
JSmartGrid
.public final StyleModel getStyleModel()
JSmartGrid
.public void setStyleModel(StyleModel styleModel)
JSmartGrid
.public final GridSelectionModel getSelectionModel()
JSmartGrid
.public void setSelectionModel(GridSelectionModel model)
JSmartGrid
.public boolean isRowHeader()
public boolean isColumnHeader()
public boolean isCorner()
public JSmartGrid getActiveGrid(int orientation)
public boolean isLeader(int orientation)
public JSmartGrid getRowActiveGrid()
public boolean isRowLeader()
public JSmartGrid getColumnActiveGrid()
public boolean isColumnLeader()
public void setRowActiveGrid(JSmartGrid activeGrid)
public void setColumnActiveGrid(JSmartGrid activeGrid)
public void setActiveGrid(JSmartGrid activeGrid, int orientation)
public void takeLeadershipOver(JSmartGrid grid, int orientation)
protected RulerModel createDefaultRowModel()
RulerConstants.AUTO_RESIZE_OFF
.protected RulerModel createDefaultColumnModel()
RulerConstants.AUTO_RESIZE_OFF
if the grid is vertically dependent, and RulerConstants.AUTO_RESIZE_SUBSEQUENT
if the grid
is fully autonomous.protected javax.swing.CellRendererPane createRendererPane()
public final RulerModel getRowModel()
JSmartGrid
.public void setRulerModel(RulerModel rulerModel)
rulerModel
- the ruler model to be attached to the grid. It
will be attached horizontally or vertically according to its
orientation property.protected boolean ensureNarrowSizes()
public void setRowModel(RulerModel rowModel)
rowModel
- a vertical ruler model.public final RulerModel getColumnModel()
JSmartGrid
.public void setColumnModel(RulerModel columnModel)
columnModel
- A horizontal ruler model.public final RulerModel getRulerModel(int orientation)
JSmartGrid
.protected javax.swing.JViewport getViewport()
public java.awt.Component getRowHeader()
JSmartGrid
,
if any.public java.awt.Component getColumnHeader()
JSmartGrid
,
if any.public void setColumnHeader(java.awt.Component c)
JSmartGrid
.public void setRowHeader(java.awt.Component c)
JSmartGrid
.public java.awt.Color getFocusForegroundColor()
Color
object for the foreground propertysetFocusForegroundColor(java.awt.Color)
,
getFocusBackgroundColor()
,
getFocusHighlightBorder()
,
getSelectionForegroundColor()
,
getSelectionBackgroundColor()
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public void setFocusForegroundColor(java.awt.Color focusForegroundColor)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
focusForegroundColor
- the foreground Color
used for focused cellsgetFocusForegroundColor()
,
getSelectionForegroundColor()
,
getSelectionBackgroundColor()
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public java.awt.Color getFocusBackgroundColor()
Color
object for the background propertysetFocusBackgroundColor(java.awt.Color)
,
getFocusForegroundColor()
,
getFocusHighlightBorder()
,
getSelectionBackgroundColor()
,
getSelectionForegroundColor()
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public void setFocusBackgroundColor(java.awt.Color focusBackgroundColor)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
focusBackgroundColor
- the background Color
used for focused cellsgetFocusBackgroundColor()
,
getFocusHighlightBorder()
,
setFocusHighlightBorder(javax.swing.border.Border)
,
setFocusForegroundColor(java.awt.Color)
,
getFocusForegroundColor()
,
getSelectionForegroundColor()
,
setSelectionBackgroundColor(java.awt.Color)
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public javax.swing.border.Border getFocusHighlightBorder()
Border
object used for focused cellssetFocusHighlightBorder(javax.swing.border.Border)
public void setFocusHighlightBorder(javax.swing.border.Border focusHighlightBorder)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
focusCellHighlightBorder
- the Border
used for focused cellsgetFocusHighlightBorder()
,
getFocusBackgroundColor()
,
setFocusForegroundColor(java.awt.Color)
,
JComponent.setBorder(javax.swing.border.Border)
public javax.swing.border.Border getCellBorder()
Border
object used for cellssetCellBorder(javax.swing.border.Border)
public void setCellBorder(javax.swing.border.Border cellBorder)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
cellBorder
- the Border
used for cellsgetCellBorder()
,
getFocusHighlightBorder()
,
setFocusHighlightBorder(javax.swing.border.Border)
,
JComponent.setBorder(javax.swing.border.Border)
public javax.swing.border.Border getSelectionCellBorder()
Border
object used for cells selectedsetSelectionCellBorder(javax.swing.border.Border)
public void setSelectionCellBorder(javax.swing.border.Border selectionCellBorder)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
cellBorder
- the Border
used for selected cellsgetSelectionCellBorder()
,
getFocusHighlightBorder()
,
setFocusHighlightBorder(javax.swing.border.Border)
,
JComponent.setBorder(javax.swing.border.Border)
public java.awt.Color getSelectionForegroundColor()
Color
object for the foreground propertysetSelectionForegroundColor(java.awt.Color)
,
setSelectionBackgroundColor(java.awt.Color)
public void setSelectionForegroundColor(java.awt.Color selectionForegroundColor)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionForeground
- the Color
used in the foreground
for selected list itemsgetSelectionForegroundColor()
,
setSelectionBackgroundColor(java.awt.Color)
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public java.awt.Color getSelectionBackgroundColor()
Color
used for the background of selected list itemssetSelectionBackgroundColor(java.awt.Color)
,
setSelectionForegroundColor(java.awt.Color)
public void setSelectionBackgroundColor(java.awt.Color selectionBackgroundColor)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionBackground
- the Color
used for the background
of selected cellsgetSelectionBackgroundColor()
,
setSelectionForegroundColor(java.awt.Color)
,
Component.setForeground(java.awt.Color)
,
Component.setBackground(java.awt.Color)
,
Component.setFont(java.awt.Font)
public void setBounds(int x, int y, int width, int height)
public java.awt.Rectangle getVisibleRect()
javax.swing.JScrollPane
, this is the part
that the JViewport
is displaying.public void setRowVisible(int row, boolean flag)
row
.row
- the row whose visibility is being changedflag
- the new row visibilitypublic boolean isRowVisible(int row)
row
.row
- the column whose visibility is to be returnedpublic void setRowHeight(int row, int rowHeight)
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.row
- the row whose height is being changedrowHeight
- the new row height (in pixels)rowHeight
is less than 1public int getRowHeight(int row)
row
.row
- the row whose height is to be returnedpublic int getRowPosition(int row)
row
.row
- the row whose position is to be returnedpublic void setColumnVisible(int column, boolean flag)
column
.column
- the column whose visibility is being changedflag
- new column visibilitypublic boolean isColumnVisible(int column)
column
.column
- the column whose visibility is to be returnedpublic void setColumnWidth(int column, int columnWidth)
column
to columnWidth
,
revalidates, and repaints. The width of the cells in this column
will be equal to the column width minus the column margin.column
- the column whose width is being changedcolumnWidth
- new column width (in pixels)columnWidth
is
less than 1public int getColumnWidth(int column)
column
.column
- the column whose width is to be returnedpublic int getColumnPosition(int column)
column
.column
- the column whose position is to be returnedpublic void setRowMargin(int rowMargin)
rowMargin
- the number of pixels between cells in a rowgetRowMargin()
public int getRowMargin()
getIntercellSpacing().height
.setRowMargin(int)
public void setColumnMargin(int columnMargin)
columnMargin
- the number of pixels between cells in a columngetColumnMargin()
public int getColumnMargin()
getIntercellSpacing().width
.setColumnMargin(int)
public void setIntercellSpacing(java.awt.Dimension intercellSpacing)
rowMargin
and the columnMargin
--
the height and width of the space between cells -- to
intercellSpacing
.intercellSpacing
- a Dimension
specifying the new width
and height between cellsgetIntercellSpacing()
public java.awt.Dimension getIntercellSpacing()
setIntercellSpacing(java.awt.Dimension)
public void hideGrid()
public void setGridColor(java.awt.Color gridColor)
gridColor
and redisplays.
The default color is Color.gray
.gridColor
- the new color of the grid linesgridColor
is null
getGridColor()
public java.awt.Color getGridColor()
Color.gray
.setGridColor(java.awt.Color)
public void setShowGrid(boolean showGrid)
showGrid
is true it does; if false, it doesn't.
There is no getShowGrid
method as this state is held
in two variables -- showHorizontalLines
and showVerticalLines
--
each of which can be queried independently.showGrid
- true if the grid view should draw grid linessetShowVerticalLines(boolean)
,
setShowHorizontalLines(boolean)
public void setShowHorizontalLines(boolean showHorizontalLines)
showHorizontalLines
is true it does; if false, it doesn't.showHorizontalLines
- true if the grid view should draw horizontal linesgetShowHorizontalLines()
,
setShowGrid(boolean)
,
setShowVerticalLines(boolean)
public void setShowVerticalLines(boolean showVerticalLines)
showVerticalLines
is true it does; if it is false it doesn't.showVerticalLines
- true if grid view should draw vertical linesgetShowVerticalLines()
,
setShowGrid(boolean)
,
setShowHorizontalLines(boolean)
public boolean getShowHorizontalLines()
setShowHorizontalLines(boolean)
public boolean getShowVerticalLines()
setShowVerticalLines(boolean)
public boolean isResizable(int orientation)
orientation
- the axis for which the resizable property is queried.setResizable(int, boolean)
public void setRowResizable(boolean isResizable)
isResizable
- the new value of the resizable property.setColumnResizable(boolean)
public void setColumnResizable(boolean isResizable)
isResizable
- the new value of the resizable property.setColumnResizable(boolean)
public boolean isRowResizable()
setRowResizable(boolean)
public boolean isColumnResizable()
setColumnResizable(boolean)
public void setResizable(int orientation, boolean isResizable)
orientation
- the axis for which the resizable property is changedisResizable
- the new value of the resizable property for the orientationisResizable(int)
public boolean isResizing()
setResizing(int, int)
,
getResizingItem()
,
getResizingOrientation()
public void setResizing(int orientation, int index) throws java.beans.PropertyVetoException
orientation
- the axis on which resizing is being done.index
- the index of the item origin of the resizing.getResizingItem()
,
getResizingOrientation()
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
public void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
public void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
public int getResizingOrientation()
public int getResizingItem()
public void ensurePreferredSizeAt(int orientation, int index)
mode
- One of 5 legal values:setResizable(int,boolean)
protected void doEnsurePreferredSizeAt(int orientation, int index)
protected void doEnsurePreferredSizeAt(int orientation, int index, boolean abovePref)
public void setAutoResizeMode(int mode)
mode
- One of 5 legal values:getRowAutoResizeMode()
,
getColumnAutoResizeMode()
,
RulerModel.sizeToFit(int)
public void setRowAutoResizeMode(int mode)
mode
- One of 5 legal values:getRowAutoResizeMode()
,
getColumnAutoResizeMode()
,
RulerModel.sizeToFit(int)
public void setColumnAutoResizeMode(int mode)
mode
- One of 5 legal values:getRowAutoResizeMode()
,
getColumnAutoResizeMode()
,
RulerModel.sizeToFit(int)
public int getRowAutoResizeMode()
RulerConstants.AUTO_RESIZE_SUBSEQUENT
.setRowAutoResizeMode(int)
,
RulerModel.sizeToFit(int)
public int getColumnAutoResizeMode()
RulerConstants.AUTO_RESIZE_SUBSEQUENT
.setColumnAutoResizeMode(int)
,
RulerModel.sizeToFit(int)
public boolean isDraggable(int orientation)
orientation
- the axis for which the draggable property is queried.setDraggable(int, boolean)
public void setRowDraggable(boolean isDraggable)
isDraggable
- the new value of the draggable property.setColumnDraggable(boolean)
public void setColumnDraggable(boolean isDraggable)
isDraggable
- the new value of the draggable property.setColumnDraggable(boolean)
public boolean isRowDraggable()
setRowDraggable(boolean)
public boolean isColumnDraggable()
setColumnDraggable(boolean)
public void setDraggable(int orientation, boolean isDraggable)
orientation
- the axis for which the draggable property is changedisDraggable
- the new value of the draggable property for the orientationisDraggable(int)
public boolean isDragging(int orientation)
orientation
- the orientation of the ruler of interest.setFirstDraggingItem(int, int)
,
getFirstDraggingItem(int)
public int getFirstDraggingItem(int orientation)
public void setFirstDraggingItem(int orientation, int index)
public int getLastDraggingItem(int orientation)
public void setLastDraggingItem(int orientation, int index)
public int getDraggingDistance(int orientation)
public void setDraggingDistance(int orientation, int d)
public void resetDragging(int orientation)
public void propertyChange(java.beans.PropertyChangeEvent evt)
evt
- a PropertyChangeEvent object describing the event source
and the property that has changed.public void hierarchyChanged(java.awt.event.HierarchyEvent e)
HierarchyEvent.getChangeFlags()
.
We are mainly interested in the removal of a master grid from the hierarchy.
HierarchyEvent.getChangeFlags()
public void flushToolTipCache()
protected void columnsResized(int resizingItem)
protected void rowsResized(int resizingItem)
public void rulerModelChanged(RulerModelEvent e)
public void rulerStructureChanged(RulerModelEvent e)
public void rulerDataChanged(RulerModelEvent e)
e
- the event that characterizes the change.public void beforeItemsMoved(RulerModelEvent e) throws java.beans.PropertyVetoException
public boolean isCellEditable(int row, int column, boolean isSpanSensitive)
row
and column
is editable. Otherwise, invoking setValueAt
on the cell
will have no effect.row
- the row whose value is to be queriedcolumn
- the column whose value is to be queriedisSpanSensitive
- if true, the row and column actually used are the ones
of the spanned cell over the given row and
column, if any.setValueAt(java.lang.Object, int, int)
public int getRowCount()
getColumnCount()
public int getColumnCount()
getRowCount()
public java.lang.Object getValueAt(int row, int column)
row
and column
.
Note: The row and column actually used are those of the spanned cell over the given row and column, if any.
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queriedpublic void setValueAt(java.lang.Object aValue, int row, int column)
row
and column
.
Note: The row and column actually used are those
of the spanned cell over the given row and
column, if any.
aValue
is the new value.
aValue
- the new valuerow
- the row of the cell to be changedcolumn
- the column of the cell to be changedgetValueAt(int, int)
public int rowAtY(int y)
y
lies in.y
- the vertical coordinate of interest.y
lies in.columnAtX(int)
public int rowAtPoint(java.awt.Point point)
point
lies in.point
- the location of interestpoint
lies in.rowAtY(int)
,
columnAtPoint(java.awt.Point)
public int columnAtX(int x)
x
lies in.x
- the horizontal coordinate of interest.x
lies in.rowAtY(int)
public int columnAtPoint(java.awt.Point point)
point
lies in.point
- the location of interestpoint
lies in.columnAtX(int)
public void ensureCellInVisibleRect(int row, int column, boolean isSpanSensitive)
row
- the row of the cell of interestcolumn
- the column of the cell of interestisSpanSensitive
- if true, and if there is a span over
the given cell, we shall try to make all of it visible.public void scrollRectToVisible(java.awt.Rectangle contentRect)
public java.awt.Rectangle getCellBounds(int row, int column, boolean isSpanSensitive, boolean includeSpacing, java.awt.Rectangle r)
row
and column
, covering any overspanned cells.
If includeSpacing
is true then the value returned
has the full height and width of the row and column
covered. If it is false, the returned rectangle is inset by the
intercell spacing to return the true bounds of the rendering or
editing component as it will be set during rendering.
If the row index is valid but the column index is less
than zero, the method returns a rectangle with the
y
and height
values set appropriately
and the x
and width
values both set
to zero. In general, when either the row or column indices indicate a
cell outside the appropriate range, the method returns a rectangle
depicting the closest edge of the closest cell that is within
the table's range. When both row and column indices are out
of range, the returned rectangle covers the closest
point of the closest cell.
In all cases, calulations that use this method to calculate results along one axis will not fail because of anomalies in calculations along the other axis. When the cell is not valid the includeSpacing parameter is ignored.
isSpanSensitive
- if true, the rectangle computed will be the one
of the spanned cell over the given row and
column, if any.includeSpacing
- if false, return the true cell bounds -
computed by subtracting the intercell
spacing from the height and width of
the column and row models.row
, column
public int getSelectionUnit()
setSelectionUnit(int)
,
GridSelectionModel.getSelectionUnit()
public void setSelectionUnit(int unit)
getSelectionUnit()
,
GridSelectionModel.getSelectionUnit()
public int getSelectionPolicy()
setSelectionPolicy(int)
,
GridSelectionModel.getSelectionPolicy()
public void setSelectionPolicy(int policy)
getSelectionPolicy()
,
GridSelectionModel.getSelectionPolicy()
public int getSelectionMode()
setSelectionMode(int)
public void setSelectionMode(int mode)
getSelectionMode()
public boolean isCellSelected(int row, int column, boolean isSpanSensitive)
row
- the row being queriedcolumn
- the column being queriedisSpanSensitive
- if true, the row and column actually used are those
of the spanned cell over the given row and
column, if any.(row, column)
is selected,
where the first row and first column are at index 0row
or column
are not in the valid rangepublic boolean isRowSelected(int row)
row
- the row testedpublic boolean isColumnSelected(int column)
column
- the column testedpublic boolean isSelectionEmpty()
public int getFirstSelectedRow()
public int getLastSelectedRow()
public int getFirstSelectedColumn()
public int getLastSelectedColumn()
public int getSelectedCellsCount(boolean isSpanSensitive)
isSpanSensitive
- if true, we do not count physical
cells which are overspanned by others.public int getSelectedRowCount()
public int getSelectedColumnCount()
public int[] getSelectedRows()
public int[] getSelectedColumns()
public java.awt.Rectangle getEnclosure(int row0, int column0, int row1, int column1)
public java.awt.Rectangle getSelectableEnclosure(int row0, int column0, int row1, int column1)
public void changeSelection(int row, int column, boolean toggle, boolean extend)
toggle
and extend
. All changes
to the selection that are the result of keyboard or mouse events received
by the UI are channeled through this method so that the behavior may be
overridden by a subclass. The behavior defined here is similar to the
one in the javax.swing.JTable
, but it is truly two-dimensional
while the JTable
uses a combination of two linear behaviors.
Spanned cells are also taken into account.
This implementation uses the following conventions:
toggle
: false, extend
: false.
Clears the previous selection and ensure the new cell is selected.
toggle
: false, extend
: true.
Extends the previous selection to include the specified cell.
toggle
: true, extend
: false.
Deselects the specified cell if it is selected. Selects it if it is not selected.
toggle
: true, extend
: true.
Leaves the selection state as it is, but move the anchor index to the specified location.
row
- affects the selection at row
.column
- affects the selection at column
.toggle
- see description above.extend
- if true, extends the current selection.public void selectAll()
public void clearSelection()
public ExtentCell getSpanOver(int row, int column)
row
, column
.
Delegated to the model.row
- the row of a cell.column
- the column a cell.public boolean isSpanEmpty()
public java.util.Iterator spanIterator(int topRow, int leftColumn, int rowCount, int columnCount, boolean withUnspanned)
topRow
- the top row of the rectangle of interest.leftColumn
- the leftnost column of the rectangle of interest.rowCount
- the height of the rectangle of interest.columnCount
- the width of the rectangle of interest.withUnspanned
- if true, even non-spanned cells will be returned,
in the form of trivial spans of (1,1) dimension.public void gridModelChanged(GridModelEvent e)
GridModel
after a global model change.public void gridStructureChanged(GridModelEvent e)
GridModel
after a continuous block of either rows or columns
was either inserted or deleted.public void gridDataChanged(GridModelEvent e)
GridModel
after data was updated in some cells.public void spanStructureChanged(SpanModelEvent e)
SpanModel
after the underlying model shape is changed.public void spanDataChanged(SpanModelEvent e)
SpanModel
after spans are modified, added or removed.public void spanModelChanged(SpanModelEvent e)
SpanModel
after all the span information changes.public void styleModelChanged(StyleModelEvent e)
public void styleStructureChanged(StyleModelEvent e)
public void styleDataChanged(StyleModelEvent e)
public void rangeChanged(GridSelectionEvent event)
Application code will not use these methods explicitly, they are used internally by JSmartGrid.
e
- the event receivedGridSelectionListener
public void anchorChanged(GridSelectionEvent event)
protected java.awt.AWTEvent coalesceEvents(java.awt.AWTEvent existingEvent, java.awt.AWTEvent newEvent)
This implementation of coalesceEvents coalesces only paint events.
existingEvent
- the event already on the EventQueue.newEvent
- the event being posted to the EventQueue.public void resizeAndRepaint()
revalidate
followed by repaint
.public void addNotify()
configureEnclosingScrollPane
method.configureEnclosingScrollPane()
protected javax.swing.JComponent createTopLeft(JSmartGrid rowHeader, RulerModel rowHeaderHorizontalRuler, GridModel rhm, JSmartGrid columnHeader, RulerModel columnHeaderVerticalRuler, GridModel chm)
protected static javax.swing.JComponent createHeader(JSmartGrid mainGrid, int orientation)
protected static javax.swing.JComponent createHeader(JSmartGrid mainGrid, int orientation, GridModel gm, SpanModel sm, StyleModel uim)
protected javax.swing.JComponent createHeader(int orientation)
public boolean isAutoCreateRowHeader()
javax.swing.JScrollPane
.public void setAutoCreateRowHeader(boolean flag)
javax.swing.JScrollPane
.public boolean isAutoCreateColumnHeader()
javax.swing.JScrollPane
.public void setAutoCreateColumnHeader(boolean flag)
javax.swing.JScrollPane
.protected void configureEnclosingScrollPane()
JSmartGrid
is the viewportView
of an enclosing JScrollPane
(as is usually the case), configure this ScrollPane
by
installing the grid's gridHeader
s as the HeaderView
s of the scroll pane.
When a JSmartGrid
is added to a JScrollPane
by
using new JScrollPane(myGrid)
, addNotify
is
called in the JSmartGrid
(when the table is added to the viewport).
JSmartGrid
's addNotify
method in turn calls this method,
which is protected so that this default installation procedure can
be overridden by a subclass.addNotify()
public void removeNotify()
unconfigureEnclosingScrollPane
method.unconfigureEnclosingScrollPane()
protected void unconfigureEnclosingScrollPane()
configureEnclosingScrollPane
by removing the HeaderView
s of the enclosing scroll pane.
JSmartGrid
's removeNotify
method calls
this method, which is protected so that this default uninstallation
procedure can be overridden by a subclass.removeNotify()
,
configureEnclosingScrollPane()
public GridUI getUI()
GridUI
object that renders this componentpublic void setUI(GridUI ui)
ui
- the GridUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.JComponent.updateUI()
public java.lang.String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected GridContext getRendererContext(int row, int column, int height, int width, java.lang.Object identifier)
GridContext
for a given cellrow
- the topmost row occupied by the cellcolumn
- the leftmost row occupied by the cellheight
- the number of rows occupied by the cellwidth
- the number of column occupied by the cellGridContext
,
GridCellRenderer
,
GridCellEditor
public void editingStopped(javax.swing.event.ChangeEvent e)
Application code will not use these methods explicitly, they are used internally by JSmartGrid.
e
- the event receivedCellEditorListener
public void editingCanceled(javax.swing.event.ChangeEvent e)
Application code will not use these methods explicitly, they are used internally by JSmartGrid.
e
- the event receivedCellEditorListener
public GridCellEditor getCurrentCellEditor()
GridCellEditor
that does the editingprotected void removeEditor(boolean canceled, boolean fireEvents)
public boolean editCellAt(int row, int column)
row
and
column
, if the cell is editable.row
- the row to be editedcolumn
- the column to be editedrow
or column
is not in the valid rangepublic boolean editCellAt(int row, int column, java.util.EventObject e)
row
and
column
, if the cell is editable.
To prevent the JSmartGrid
from editing a particular grid, column or
cell value, return false from the isCellEditable
method in the
GridModel
interface.row
- the row to be editedcolumn
- the column to be editede
- event to pass into
shouldSelectCellrow
or column
is not in the valid rangepublic boolean isEditing()
protected java.awt.Component getEditorComponent()
public boolean getScrollableTracksViewportWidth()
Scrollable.getScrollableTracksViewportWidth()
public boolean getScrollableTracksViewportHeight()
Scrollable.getScrollableTracksViewportHeight()
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
Delegated to the RulerModel
.
visibleRect
- the view area visible within the viewportorientation
- either VERTICAL
or HORIZONTAL
direction
- less than zero to scroll up/left,
greater than zero for down/rightScrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
Delegated to the RulerModel
.
Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)
public void setPreferredScrollableViewportSize(java.awt.Dimension size)
size
- a Dimension
object specifying the preferredSize
of a
JViewport
whose view is this tableScrollable.getPreferredScrollableViewportSize()
public java.awt.Dimension getPreferredScrollableViewportSize()
Dimension
object containing the preferredSize
of the JViewport
which displays this tableScrollable.getPreferredScrollableViewportSize()
public java.awt.Dimension getCellMinimumSize(int row, int column, boolean isSpanSensitive)
row
- a row identifying the cell whose minimum size is queried.column
- a column identifying the cell whose minimum size is queried.isSpanSensitive
- if true, the dimension computed will be that
of the spanned cell over the given row and
column, if any.public java.awt.Dimension getCellMinimumSize(int row, int column)
public java.awt.Dimension getCellPreferredSize(int row, int column, boolean isSpanSensitive)
row
- a row identifying the cell whose preferred size is queried.column
- a column identifying the cell whose preferred size is queried.isSpanSensitive
- if true, the dimension computed will be that
of the spanned cell over the given row and
column, if any.public java.awt.Dimension getCellPreferredSize(int row, int column)
public java.awt.Dimension getCellMaximumSize(int row, int column, boolean isSpanSensitive)
row
- a row identifying the cell whose maximum size is queried.column
- a column identifying the cell whose maximum size is queried.isSpanSensitive
- if true, the dimension computed will be that
of the spanned cell over the given row and
column, if any.public java.awt.Dimension getCellMaximumSize(int row, int column)
protected GridCellRenderer getCellRenderer(int row, int column, int height, int width, java.lang.Object id)
Note: Throughout the grid package, the internal implementations always use this method to provide renderers so that this default behavior can be safely overridden by a subclass.
row
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render,
where 0 is the first columnnull
,
returns the default renderer
for this type of objectprotected java.awt.Component prepareRenderer(GridCellRenderer renderer, int row, int column, int height, int width, java.lang.Object id)
Note: Throughout the grid package, the internal implementations always use this method to prepare renderers so that this default behavior can be safely overridden by a subclass.
renderer
- a renderer obtained from a call to getCellRenderer(int, int, int, int, java.lang.Object)
.row
- the row of the cell to render, where 0 is the first row.column
- the column of the cell to render, where 0 is the first column.height
- the height of the cell to render, may be > 1 if the cell is spanned.width
- the width of the cell to render, may be > 1 if the cell is spanned.protected java.awt.Component getRenderingComponent(int row, int column, boolean isSpanSensitive)
row
- the row of the cell to render, where 0 is the first row.column
- the column of the cell to render, where 0 is the first column.isSpanSensitive
- if true, the row and column actually used are the ones
of the spanned cell over the given row and
column, if any.public java.awt.Component getRenderingComponent(int row, int column)
row
- the row of the cell to render, where 0 is the first row.column
- the column of the cell to render, where 0 is the first column.protected void paintComponent(java.awt.Graphics g)
JComponent
method is overloaded here
in order to cleanup the CellRenderPane
used to "stencil" the individual cells
onto the JSmartGrid
background.public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
public boolean isManagingFocus()
JComponent
returns false, is overloaded to return true. This allows us to give a special
meaning to TAB and SHIFT-TAB in the JSmartGrid
.public boolean isFocusTraversable()
JComponent
returns false, is overloaded to return true. This indicates that the JSmartGrid
is a component that should be part of a tabbing focus cycle
by default.protected boolean processKeyBinding(javax.swing.KeyStroke ks, java.awt.event.KeyEvent e, int condition, boolean pressed)
ks
as the result of the Keystroke e
.
This contains the appropriate InputMap, gets the binding, gets the action from the ActionMap,
and then (if the action is found and the receiver is enabled) invokes NotifyAction
to notify the action.protected int getListenerCount()
protected int getListenerCount(java.lang.Class clazz)
clazz
- a class potentially used for registering listeners,
usually a listener interface. A listener actually registered
on clazz
should be an instance of some
class that implements clazz
(or is a subclass
of clazz
if it is not an interface).public void addGridEditingListener(GridEditingListener l)
l
- the GridEditingListenerpublic void removeGridEditingListener(GridEditingListener l)
l
- the GridEditingListenerprotected void fireEditingStarted(int row, int column)
row
- the row of the cell where editing has startedcolumn
- the column of the cell where editing has startedprotected void fireEditingStopped(int row, int column)
row
- the row of the cell where editing was completedcolumn
- the column of the cell where editing was completedprotected void fireEditingCanceled(int row, int column)
row
- the row of the cell where editing was canceledcolumn
- the column of the cell where editing was canceledpublic void addGridListener(GridListener l)
l
- the GridListenerpublic void removeGridListener(GridListener l)
l
- the GridListenerprotected void fireGridClicked(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell where the click occurredcolumn
- the column of the cell where the click occurredprotected void fireGridPressed(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell where the press occurredcolumn
- the column of the cell where the press occurredprotected void fireGridDragged(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell where the drag occurredcolumn
- the column of the cell where the drag occurredprotected void fireGridMoved(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell where the move occurredcolumn
- the column of the cell where the move occurredprotected void fireGridReleased(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell where the release occurredcolumn
- the column of the cell where release click occurredprotected void fireGridEntered(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell that was enteredcolumn
- the column of the cell that was enteredprotected void fireGridExited(java.awt.event.MouseEvent me, int row, int column, int rowCount, int columnCount)
row
- the row of the cell that was exitedcolumn
- the column of the cell that was exitedprotected void fireFocusLost(java.awt.event.InputEvent ie, int row, int column, int rowCount, int columnCount)
row
- the row of the cell that was enteredcolumn
- the column of the cell that was enteredprotected void fireFocusGained(java.awt.event.InputEvent ie, int row, int column, int rowCount, int columnCount)
row
- the row of the cell that was exitedcolumn
- the column of the cell that was exitedpublic javax.accessibility.AccessibleContext getAccessibleContext()
AccessibleContext
associated with this JSmartGrid
.AccessibleContext
of this JSmartGrid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |