|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
net.sf.jeppers.grid.JGrid
The JGrid is used to display and edit regular two-dimensional grid of cells. Unlike JTable which is fundamentally vertical in that the structure is determined in the columns, while the rows contain the data. JGrid is symmetrical with respect to the vertical and the horizontal orientations. JGrid also allows for cells to be merged into bigger rectangular arrays, called spans.
Nested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary |
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JGrid()
|
|
JGrid(GridModel gridModel,
SpanModel spanModel,
StyleModel styleModel)
|
|
JGrid(GridModel gridModel,
SpanModel spanModel,
StyleModel styleModel,
RulerModel rowModel,
RulerModel columnModel,
SelectionModel selectionModel)
|
|
JGrid(int rows,
int columns)
|
Method Summary | |
void |
changeSelection(int row,
int column,
boolean toggle,
boolean extend)
|
JGrid |
cloneView()
|
int |
columnAtPoint(java.awt.Point point)
Return the column at the specified point |
boolean |
editCellAt(int row,
int column)
|
boolean |
editCellAt(int row,
int column,
java.util.EventObject e)
Programmatically 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)
|
java.awt.Rectangle |
getCellBounds(int row,
int column)
Get cell bounds of (row, column) |
GridCellEditor |
getCellEditor(int row,
int column)
|
GridCellRenderer |
getCellRenderer(int row,
int column)
|
int |
getColumnCount()
Returns the number of columns in this grid's model. |
RulerModel |
getColumnModel()
|
int |
getColumnPosition(int column)
Return the left horizontal coordinate (in pixels) of column |
int |
getColumnWidth(int column)
Returns the width (in pixels) of column . |
GridCellEditor |
getCurrentCellEditor()
Return the current cell editor |
int |
getEditingColumn()
Returns the index of the column that contains the cell currently being edited. |
int |
getEditingRow()
Returns the index of the row that contains the cell currently being edited. |
java.awt.Component |
getEditorComponent()
Returns the component that is handling the editing session. |
java.awt.Color |
getFocusBackgroundColor()
Returns the background color for cells with focus. |
java.awt.Color |
getFocusForegroundColor()
Returns the foreground color for cells with focus. |
java.awt.Color |
getGridColor()
Returns the color used to draw grid lines. |
GridModel |
getGridModel()
|
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for this table. |
int |
getRowCount()
Returns the number of rows in this grid's model. |
int |
getRowHeight(int row)
Returns the height (in pixels) of row . |
RulerModel |
getRowModel()
|
int |
getRowPosition(int row)
Return the top vertical coordinate (in pixels) of row |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns visibleRect.height or
visibleRect.width ,
depending on this spreadsheet's orientation. |
boolean |
getScrollableTracksViewportHeight()
Returns false to indicate that the height of the viewport does not determine the height of the spreadsheet. |
boolean |
getScrollableTracksViewportWidth()
Returns false to indicate that the width of the viewport does not determine the width of the spreadsheet. |
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.Color |
getSelectionBackgroundColor()
Returns the background color for selected cells. |
java.awt.Color |
getSelectionForegroundColor()
Returns the foreground color for selected cells. |
SelectionModel |
getSelectionModel()
|
boolean |
getShowGrid()
Returns true if the grid draws grid lines. |
SpanModel |
getSpanModel()
|
StyleModel |
getStyleModel()
|
GridUI |
getUI()
Returns the L&F object that renders this component. |
java.lang.String |
getUIClassID()
Returns a string that specifies the name of the l&f class that renders this component. |
java.lang.Object |
getValueAt(int row,
int column)
|
void |
gridChanged(GridModelEvent event)
Sync row and column sizes between models |
boolean |
isCellSpan(int row,
int column)
|
boolean |
isEditing()
Returns true if a cell is being edited. |
boolean |
isSelected(int row,
int column)
|
java.awt.Component |
prepareEditor(GridCellEditor editor,
int row,
int column)
Prepares the editor for cell(row, column) |
java.awt.Component |
prepareRenderer(GridCellRenderer renderer,
int row,
int column)
Prepares the renderer for painting cell(row,column) |
void |
removeEditor()
Discards the editor object and frees the real estate it used for cell rendering. |
void |
resizeAndRepaint()
|
int |
rowAtPoint(java.awt.Point point)
Return the row at the specified point |
void |
setColumnModel(RulerModel model)
|
void |
setColumnWidth(int column,
int width)
Sets the width for column to width . |
void |
setEditingColumn(int aColumn)
Sets the editingColumn variable. |
void |
setEditingRow(int aRow)
Sets the editingRow variable. |
void |
setFocusBackgroundColor(java.awt.Color focusBackgroundColor)
Sets the background color for cells with focus. |
void |
setFocusForegroundColor(java.awt.Color focusForegroundColor)
Sets the foreground color for cells with focus. |
void |
setGridColor(java.awt.Color gridColor)
Sets the color used to draw grid lines. |
void |
setGridModel(GridModel model)
|
void |
setPreferredScrollableViewportSize(java.awt.Dimension size)
Sets the preferred size of the viewport for this table. |
void |
setRowHeight(int row,
int height)
Sets the height for row to height . |
void |
setRowModel(RulerModel model)
|
void |
setSelectionBackgroundColor(java.awt.Color selectionBackgroundColor)
Sets the background color for selected cells. |
void |
setSelectionForegroundColor(java.awt.Color selectionForegroundColor)
Sets the foreground color for selected cells. |
void |
setSelectionModel(SelectionModel model)
|
void |
setShowGrid(boolean show)
Sets wether grid lines should be drawn. |
void |
setSpanModel(SpanModel model)
|
void |
setStyleModel(StyleModel model)
|
void |
setUI(GridUI ui)
Sets the L&F object that renders this component. |
void |
setValueAt(java.lang.Object value,
int row,
int column)
|
void |
updateUI()
Notification from the UIFactory that the L&F has changed. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JGrid()
public JGrid(int rows, int columns)
public JGrid(GridModel gridModel, SpanModel spanModel, StyleModel styleModel)
public JGrid(GridModel gridModel, SpanModel spanModel, StyleModel styleModel, RulerModel rowModel, RulerModel columnModel, SelectionModel selectionModel)
Method Detail |
public JGrid cloneView()
public java.awt.Color getFocusForegroundColor()
Color
used for the foreground of focused cellspublic void setFocusForegroundColor(java.awt.Color focusForegroundColor)
focusForegroundColor
- the Color
to use for foreground of
focused cellspublic java.awt.Color getFocusBackgroundColor()
Color
used for the background of focused cellspublic void setFocusBackgroundColor(java.awt.Color focusBackgroundColor)
focusBackgroundColor
- the Color
to use for background of
focused cellspublic java.awt.Color getSelectionForegroundColor()
Color
used for the foreground of selected cells.public void setSelectionForegroundColor(java.awt.Color selectionForegroundColor)
selectionForegroundColor
- the Color
used for the foreground
of selected cellspublic java.awt.Color getSelectionBackgroundColor()
Color
used for the background of selected cells.public void setSelectionBackgroundColor(java.awt.Color selectionBackgroundColor)
selectionBackgroundColor
- the Color
used for the background
of selected cellspublic java.awt.Color getGridColor()
Color
used to draw grid linespublic void setGridColor(java.awt.Color gridColor)
gridColor
- the new Color
of the grid linespublic boolean getShowGrid()
public void setShowGrid(boolean show)
public int getRowCount()
public int getColumnCount()
public int getRowHeight(int row)
row
.
row
- the row whose height is to be returned
row
public int getColumnWidth(int column)
column
.
column
- the column whose width is to be returned
column
public void setRowHeight(int row, int height)
row
to height
.
row
- the row whose height is to be changedheight
- new row height (in pixels)public void setColumnWidth(int column, int width)
column
to width
.
column
- the column whose width is to be changedwidth
- new column width (in pixels)public int getRowPosition(int row)
public int getColumnPosition(int column)
public java.awt.Rectangle getCellBounds(int row, int column)
public int rowAtPoint(java.awt.Point point)
public int columnAtPoint(java.awt.Point point)
public boolean isCellSpan(int row, int column)
public GridCellRenderer getCellRenderer(int row, int column)
public GridCellEditor getCellEditor(int row, int column)
public java.awt.Component prepareRenderer(GridCellRenderer renderer, int row, int column)
public java.awt.Component prepareEditor(GridCellEditor editor, int row, int column)
public boolean isSelected(int row, int column)
public void ensureCellInVisibleRect(int row, int column)
public void changeSelection(int row, int column, boolean toggle, boolean extend)
public GridModel getGridModel()
public void setGridModel(GridModel model)
public SelectionModel getSelectionModel()
public void setSelectionModel(SelectionModel model)
public SpanModel getSpanModel()
public void setSpanModel(SpanModel model)
public StyleModel getStyleModel()
public void setStyleModel(StyleModel model)
public RulerModel getRowModel()
public void setRowModel(RulerModel model)
public RulerModel getColumnModel()
public void setColumnModel(RulerModel model)
public void gridChanged(GridModelEvent event)
gridChanged
in interface GridModelListener
public boolean editCellAt(int row, int column)
public boolean editCellAt(int row, int column, java.util.EventObject e)
row
and
column
, if the cell is editable.
row
- the row to be editedcolumn
- the column to be editede
- event to pass into shouldSelectCell
java.lang.IllegalArgumentException
- If row
or column
is not in the valid rangepublic void removeEditor()
public void setEditingColumn(int aColumn)
editingColumn
variable.
aColumn
- the column of the cell to be edited#editingColumn
public void setEditingRow(int aRow)
editingRow
variable.
aRow
- the row of the cell to be edited#editingRow
public boolean isEditing()
#editingColumn
,
#editingRow
public java.awt.Component getEditorComponent()
public int getEditingColumn()
#editingRow
public int getEditingRow()
#editingColumn
public GridCellEditor getCurrentCellEditor()
public void editingStopped(javax.swing.event.ChangeEvent e)
Application code will not use these methods explicitly, they are used internally by JSpread.
editingStopped
in interface javax.swing.event.CellEditorListener
e
- the event receivedCellEditorListener
public void editingCanceled(javax.swing.event.ChangeEvent e)
editingCanceled
in interface javax.swing.event.CellEditorListener
e
- the event receivedCellEditorListener
public void setPreferredScrollableViewportSize(java.awt.Dimension size)
size
- a Dimension
object specifying the preferredSize
of a
JViewport
whose view is this spreadsheetScrollable.getPreferredScrollableViewportSize()
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface javax.swing.Scrollable
Dimension
object containing the preferredSize
of the JViewport
which displays this tableScrollable.getPreferredScrollableViewportSize()
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface javax.swing.Scrollable
visibleRect
- the view area visible within the viewportorientation
- either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
direction
- less than zero to scroll up/left,
greater than zero for down/right
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
visibleRect.height
or
visibleRect.width
,
depending on this spreadsheet's orientation.
getScrollableBlockIncrement
in interface javax.swing.Scrollable
visibleRect.height
or
visibleRect.width
per the orientationScrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface javax.swing.Scrollable
Scrollable.getScrollableTracksViewportWidth()
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface javax.swing.Scrollable
Scrollable.getScrollableTracksViewportHeight()
public GridUI getUI()
public void setUI(GridUI ui)
ui
- the SpreadsheetUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
JComponent.updateUI()
public java.lang.String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void resizeAndRepaint()
public java.lang.Object getValueAt(int row, int column)
public void setValueAt(java.lang.Object value, int row, int column)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |