JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.higrid
Class Controller

java.lang.Object
  |
  +--com.klg.jclass.higrid.Controller
All Implemented Interfaces:
EventListener, JCCellEditorListener, KeyListener, MouseListener, MouseMotionListener, Serializable

public class Controller
extends Object
implements Serializable, JCCellEditorListener, KeyListener, MouseListener, MouseMotionListener

The Controller class performs the Controller function in the Model-View-Controller (MVC) paradigm. It handles all mouse and keyboard input and positions the CellEditors in the GridArea.

See Also:
Serialized Form

Nested Class Summary
protected  class Controller.JColumnHeaderLabel
           
 
Field Summary
protected  Vector actions
           
protected  int columnIndexResize
           
protected  Controller.JColumnHeaderLabel columnLabel
           
protected  Point columnOrigin
           
protected  int columnXResize
           
protected  int currentAction
           
protected  com.klg.jclass.higrid.CellPosition currentCell
           
protected  com.klg.jclass.cell.JCCellEditor currentCellEditor
           
protected  int desiredColumn
           
protected  boolean duringTraversal
           
protected  com.klg.jclass.higrid.HiGridFocusAdapter focusListener
           
protected  boolean inEditMode
           
protected  int lastKeyProcessed
           
protected  com.klg.jclass.higrid.RowNode lastSelectedRowNode
           
static int MINIMUM_COLUMN_WIDTH
           
static int MINIMUM_ROW_HEIGHT
           
protected  boolean mouseExited
           
protected  boolean movingColumn
           
protected  Class nullEditor
           
protected  Point originalMousePress
           
protected  com.klg.jclass.higrid.CellPosition resizeCell
           
protected  com.klg.jclass.higrid.RowNode resizeLevel
           
protected  JPanel resizer
           
protected  boolean resizingColumn
           
protected  boolean resizingRow
           
protected  int rowYResize
           
static int SELECT_TOLERANCE
           
protected  com.klg.jclass.higrid.CellPosition selectedCell
           
protected  Vector selectedRowNodes
           
protected  boolean selectingColumn
           
protected  int xResizeOffset
           
protected  int yResizeOffset
           
 
Constructor Summary
Controller(com.klg.jclass.higrid.HiGrid grid)
           
 
Method Summary
protected  void acquireFocusForCellEditor()
          Attempts to acquire keyboard focus for the current CellEditor
 void addAction(com.klg.jclass.higrid.ActionInitiator initiator, int action)
          Adds an ActionInitiator/action pair to table.
 void addAction(com.klg.jclass.higrid.HiGridAction action)
          Adds a HiGridAction to table.
protected  void addEditor()
          Adds the current CellEditor to the GridArea
 void cancelCellEditing()
          Tells the current CellEditor to cancel editing.
protected  boolean canSelectRowNode(int selectionMode, com.klg.jclass.higrid.RowNode referenceRowNode, com.klg.jclass.higrid.RowNode rowNode)
          Helper method to determine if selection mode allows the operation to continue.
protected  boolean collapseFolder(com.klg.jclass.higrid.RowNode rowNode)
          Collapses the passed rowNode.
protected  boolean commitAndConvert()
          Tries to complete any existing CellEditor edits, validate the result and store the result in the dataModel.
protected  boolean containerReserved(com.klg.jclass.cell.JCKeyModifier km)
          Determines whether the specified key modifier represents an attempt by an editor to reserve a key that Table reserves for itself.
protected  void createColumnLabel()
          Creates the moving column header label for run-time user placement of columns.
 void createDefaultActions()
          Re-creates all standard actions.
protected  void createEditor()
          Creates a CellEditor for the current cell
protected  void createEditor(AWTEvent initialEvent)
          Creates a CellEditor for the current cell
protected  boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode, int selectionMode)
          Do row select based on the selection mode.
protected  boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode, int selectionMode, boolean groupSelection)
          Do row select/deselect based on mouse input
protected  boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode, int selectionMode, boolean groupSelection, boolean refresh)
          Do row select/deselect based on mouse input
protected  com.klg.jclass.higrid.CellPosition doTheRecordWalk(com.klg.jclass.higrid.RowNode startNode, int count, boolean downward)
          Walks the RowTree to a CellPosition based on the passed parameters.
protected  boolean duringColumnResizing(com.klg.jclass.higrid.NullGraphics nullgc)
          Returns true if the mouse is over a column divider.
protected  boolean duringRowResizing(com.klg.jclass.higrid.NullGraphics nullgc)
          Returns true if the mouse is over a row divider.
 void editingCanceled(com.klg.jclass.cell.JCCellEditorEvent e)
          Tells the listeners that the editor has cancelled editing.
 void editingStopped(com.klg.jclass.cell.JCCellEditorEvent e)
          Tells the listeners that the editor has ended editing.
protected  void exchangeColumns(com.klg.jclass.higrid.CellPosition oldCell, com.klg.jclass.higrid.CellPosition newCell)
          Exchanges two columns within a given table.
protected  void exchangeColumns(Vector dataFormats, int oldColumn, int newColumn)
          Helper method to exchange two columns within a given table.
protected  boolean expandFolder(com.klg.jclass.higrid.RowNode rowNode)
          Expands the passed rowNode.
 int getAction(AWTEvent event)
          Returns the action mapped to the given event.
 int getActualIndex(com.klg.jclass.higrid.RowFormat newRowFormat, int newDesiredColumn)
          Retrieves an actual column index given a desired column.
 Enumeration getAllActions()
          Returns an enumeration of the HiGridActions
protected  com.klg.jclass.higrid.NullGraphics getCellFromXY(Point point)
          Determines the cell that corresponds to the given point.
 int getCurrentAction()
          Retrieves the HiGridAction (if any) that is being currently processed.
protected  com.klg.jclass.higrid.CellPosition getCurrentCell()
          Retrieves the current edit cell
protected  int getDesiredColumn()
          Retrieves the desired column.
protected  void getEditorSize(Component editComponent, com.klg.jclass.higrid.CellFormat format, Dimension cellSize)
          Gets the CellEditor size based on the EditWidth and EditHeight policies.
protected  com.klg.jclass.higrid.CellPosition getFirstCell(com.klg.jclass.higrid.RowNode row)
          Returns the first available editable position in the grid
protected  Component getFirstTraversable(Component editorComponent)
          Retrieves the first traversable component of the CellEditor
protected  com.klg.jclass.higrid.CellPosition getLastCell(com.klg.jclass.higrid.RowNode row)
          Returns the last available editable position in the grid
 com.klg.jclass.higrid.MouseActionInitiator getMouseActionInitiator(int button_mask, int modifier)
          Returns the specified MouseActionInitiator, If no matching ActionInitiator exists, null is returned.
 Vector getSelectedRows()
          Returns the Vector of selected row items.
 int getVisibleIndex(com.klg.jclass.higrid.CellPosition newPosition)
          Retrieves the visible column index associated with the given cell.
protected  com.klg.jclass.higrid.NullGraphics getXYFromCell(com.klg.jclass.higrid.CellPosition cellPosition)
          Determines the point that corresponds to the given cell.
protected  com.klg.jclass.higrid.CellPosition goDown()
          Traverse to the same column in the next row.
protected  com.klg.jclass.higrid.CellPosition goEnd()
          Traverse to the last cell in the current row.
protected  com.klg.jclass.higrid.CellPosition goHome()
          Traverse to the first cell in the current row.
protected  com.klg.jclass.higrid.CellPosition goLeft()
          Traverse to the previous column in the same row.
protected  com.klg.jclass.higrid.CellPosition goLevelDown()
          Traverse to the next row of the table associated with the current row.
protected  com.klg.jclass.higrid.CellPosition goLevelDown(com.klg.jclass.higrid.RowNode rowNode, boolean downOneOnly)
          Traverse to the next row of the table associated with the passed row.
protected  com.klg.jclass.higrid.CellPosition goLevelEnd()
          Traverse to the previous row of the table associated with the current row.
protected  com.klg.jclass.higrid.CellPosition goLevelEnd(com.klg.jclass.higrid.RowNode rowNode)
          Traverse to the last row of the table associated with the passed row.
protected  com.klg.jclass.higrid.CellPosition goLevelHome()
          Traverse to the first row of the table associated with the current row.
protected  com.klg.jclass.higrid.CellPosition goLevelHome(com.klg.jclass.higrid.RowNode rowNode)
          Traverse to the first row of the table associated with the passed row.
protected  com.klg.jclass.higrid.CellPosition goLevelParent()
          Traverse to the parent row of the current row.
protected  com.klg.jclass.higrid.CellPosition goLevelUp()
          Traverse to the previous row of the table associated with the current row.
protected  com.klg.jclass.higrid.CellPosition goLevelUp(com.klg.jclass.higrid.RowNode rowNode, boolean upOneOnly)
          Traverse to the previous row of the table associated with the passed row.
protected  com.klg.jclass.higrid.CellPosition goRight()
          Traverse to the next column in the same row.
protected  com.klg.jclass.higrid.CellPosition goUp()
          Traverse to the same column in the previous row.
protected  void handleAutoEdit()
          Pops up the appropriate CellEditor if HiGrid is in autoEdit mode.
protected  int horizontalCellAdjustment(com.klg.jclass.higrid.CellPosition cellPosition)
          Computes the number of pixels needed to scroll horizontally to make the passed cellPosition visible.
protected  void initializeEditor()
          Initializes the current CellEditor
protected  void initializeEditor(AWTEvent initialEvent)
          Initializes the current CellEditor
protected  boolean isSourceEditorComponent(Object source)
          Checks whether the passed source object refers to the current CellEditor.
protected  boolean isTraversing()
          Retrieves whether we are currently traversing
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void makeCellEditorVisible()
          Scrolls HiGrid so that the current CellEditor is in view.
protected  void makeCellEditorVisible(int action)
          Scrolls HiGrid so that the current CellEditor is in view.
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 boolean moveCurrentCell(com.klg.jclass.higrid.CellPosition newPosition, int newDesiredColumn)
          Moves the current cell to the new row and column.
 boolean moveCurrentCell(com.klg.jclass.higrid.CellPosition newPosition, int newDesiredColumn, boolean refresh, boolean moveInDataModel)
          Moves the current cell to the new row and column.
protected  boolean moveCurrentCellInternal(com.klg.jclass.higrid.CellPosition newPosition, int newDesiredColumn)
          Moves the current cell to the new row and column.
protected  boolean moveCurrentCellInternal(com.klg.jclass.higrid.CellPosition newPosition, int newDesiredColumn, boolean refresh, boolean moveInDataModel)
          Moves the current cell to the new row and column.
 void pasteData(Vector rows, com.klg.jclass.higrid.RowNode insertBefore)
          Pastes a vector of rows before the given cellPosition.
 void performCopyAction()
          Executes a copy action using the system clipboard.
 void performCopyAction(Vector rows)
          Executes a copy action using the system clipboard.
 void performPasteAction()
          Executes a paste action using the system clipboard.
 void performPasteAction(com.klg.jclass.higrid.CellPosition cellPosition)
          Executes a paste action using the system clipboard.
protected  void popupEditor(AWTEvent initialEvent)
          Pops up the CellEditor for the current cell
protected  void positionColumnLabel(MouseEvent e)
          Positions the moving column header label horizontally based on user input, but keeps it from moving vertically.
protected  void positionCurrentCell()
          Finds a default place to put the current cell when it is uninitialized
protected  void positionEditor()
          Positions the current CellEditor at the current cell
protected  void positionEditor(boolean wantFocus)
          Positions the current CellEditor at the current cell
protected  void processKey(KeyEvent e)
          Processes the KeyEvent from the user.
 void removeAction(com.klg.jclass.higrid.ActionInitiator initiator, int action)
          Removes an ActionInitiator/action pair from HiGrid.
 void removeAction(com.klg.jclass.higrid.HiGridAction action)
          Removes an action from HiGrid.
 void removeAction(int action)
          Removes any ActionInitiator set for the given action type.
 void removeAllActions()
          Removes all actions from HiGrid.
 void removeAllKeyActions()
          Removes all key actions from HiGrid.
 void removeAllMouseActions()
          Removes all mouse actions from HiGrid.
protected  void removeEditor()
          Removes the current CellEditor from the GridArea
protected  void repositionCurrentCell(com.klg.jclass.higrid.RowNode rowNode, boolean showEditor, boolean moveEditor)
          Reposition the current cell.
protected  boolean resetRowSelection()
          Reset all row selection.
protected  boolean resetRowSelection(boolean refresh)
          Reset all row selection.
protected  boolean scrollEditorIntoView(int action)
          Scrolls both vertically and horizontally, if necessary, to scroll the current CellEditor into view.
protected  boolean selectRows(com.klg.jclass.higrid.RowNode rowNode, boolean state)
          (De-)Select the passed RowNode.
protected  boolean selectRows(Vector rows, boolean state)
          (De-)Select the passed Vector of rows.
protected  void setCurrentAction(int action)
          Sets the HiGridAction (if any) that is being currently processed.
protected  void setCurrentCell(com.klg.jclass.higrid.CellPosition pos)
          Sets the current edit cell
protected  void setDesiredColumn(int column)
          Sets the desired column.
protected  void setOurCursor(MouseEvent e)
          Based on the passed event, sets the appropriate cursor for HiGrid.
protected  void setSelectedRows(Vector rowNodes)
          Sets the Vector of selected row items.
protected  boolean shouldProcessThisKey(int key, int modifiers)
          Determines whether the specified key and modifier represents a combination that HiGrid should process, or whether it is reserved by a CellEditor.
protected  void showEditor(boolean show)
          Shows or hides the current CellEditor
protected  void showPopupMenu(InputEvent e)
          Helper method to show the popup menu
 void stopCellEditing()
          Tells the current CellEditor to (save changes and) stop editing.
protected  boolean traverseToCell(com.klg.jclass.higrid.CellPosition newCellPosition, int newDesiredColumn, AWTEvent initialEvent)
          Traverses to the new cell and displays a CellEditor
protected  boolean validateAndTraverse(com.klg.jclass.higrid.CellPosition newCellPosition, int newDesiredColumn, AWTEvent initialEvent)
          Validates any changes in the CellEditor and traverses to the new cell.
protected  boolean validateCell(com.klg.jclass.higrid.CellPosition newCellPosition)
          Tries to complete any outstanding edits and validate the passed cellPosition
protected  boolean validateCell(com.klg.jclass.higrid.CellPosition newCellPosition, boolean refresh)
          Tries to complete any outstanding edits and validate the passed cellPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_COLUMN_WIDTH

public static final int MINIMUM_COLUMN_WIDTH
See Also:
Constant Field Values

MINIMUM_ROW_HEIGHT

public static final int MINIMUM_ROW_HEIGHT
See Also:
Constant Field Values

SELECT_TOLERANCE

public static final int SELECT_TOLERANCE
See Also:
Constant Field Values

resizingColumn

protected boolean resizingColumn

columnXResize

protected int columnXResize

xResizeOffset

protected int xResizeOffset

columnIndexResize

protected int columnIndexResize

resizingRow

protected boolean resizingRow

rowYResize

protected int rowYResize

yResizeOffset

protected int yResizeOffset

resizeLevel

protected com.klg.jclass.higrid.RowNode resizeLevel

resizer

protected JPanel resizer

resizeCell

protected com.klg.jclass.higrid.CellPosition resizeCell

movingColumn

protected boolean movingColumn

columnLabel

protected Controller.JColumnHeaderLabel columnLabel

mouseExited

protected boolean mouseExited

columnOrigin

protected Point columnOrigin

selectingColumn

protected boolean selectingColumn

selectedCell

protected com.klg.jclass.higrid.CellPosition selectedCell

originalMousePress

protected Point originalMousePress

currentCell

protected com.klg.jclass.higrid.CellPosition currentCell

currentCellEditor

protected com.klg.jclass.cell.JCCellEditor currentCellEditor

inEditMode

protected boolean inEditMode

desiredColumn

protected int desiredColumn

lastSelectedRowNode

protected com.klg.jclass.higrid.RowNode lastSelectedRowNode

selectedRowNodes

protected Vector selectedRowNodes

actions

protected Vector actions

currentAction

protected int currentAction

duringTraversal

protected boolean duringTraversal

nullEditor

protected Class nullEditor

focusListener

protected com.klg.jclass.higrid.HiGridFocusAdapter focusListener

lastKeyProcessed

protected int lastKeyProcessed
Constructor Detail

Controller

public Controller(com.klg.jclass.higrid.HiGrid grid)
Method Detail

isTraversing

protected boolean isTraversing()
Retrieves whether we are currently traversing

Returns:
whether we are currently traversing

getCurrentCell

protected com.klg.jclass.higrid.CellPosition getCurrentCell()
Retrieves the current edit cell

Returns:
The current cell position

setCurrentCell

protected void setCurrentCell(com.klg.jclass.higrid.CellPosition pos)
Sets the current edit cell

Parameters:
pos - The current cell position

getDesiredColumn

protected int getDesiredColumn()
Retrieves the desired column.

Returns:
The desired column.

setDesiredColumn

protected void setDesiredColumn(int column)
Sets the desired column.

Parameters:
column - The desired column.

containerReserved

protected boolean containerReserved(com.klg.jclass.cell.JCKeyModifier km)
Determines whether the specified key modifier represents an attempt by an editor to reserve a key that Table reserves for itself. We reserve Tab and Escape only. We will get the rest if the editor doesn't want them.


shouldProcessThisKey

protected boolean shouldProcessThisKey(int key,
                                       int modifiers)
Determines whether the specified key and modifier represents a combination that HiGrid should process, or whether it is reserved by a CellEditor.


processKey

protected void processKey(KeyEvent e)
Processes the KeyEvent from the user.

Parameters:
e - KeyEvent created by user keyPress.

setCurrentAction

protected void setCurrentAction(int action)
Sets the HiGridAction (if any) that is being currently processed.

Parameters:
action - the current HiGridAction being processed

getCurrentAction

public int getCurrentAction()
Retrieves the HiGridAction (if any) that is being currently processed.

Returns:
action the current HiGridAction being processed. HiGridAction.NO_ACTION is returned if no action is being processed.

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

getVisibleIndex

public int getVisibleIndex(com.klg.jclass.higrid.CellPosition newPosition)
Retrieves the visible column index associated with the given cell.

Parameters:
newPosition - the new CellPosition being traversed to.
Returns:
the visible column index associated with the given cell.

getActualIndex

public int getActualIndex(com.klg.jclass.higrid.RowFormat newRowFormat,
                          int newDesiredColumn)
Retrieves an actual column index given a desired column. Due to cell visibility, the desired column may not be always possible.

Parameters:
newRowFormat - the new row to move to
newDesiredColumn - the column to move to
Returns:
the actual column index that can be moved to.

goHome

protected com.klg.jclass.higrid.CellPosition goHome()
Traverse to the first cell in the current row.

Returns:
the new cell to move to.

goEnd

protected com.klg.jclass.higrid.CellPosition goEnd()
Traverse to the last cell in the current row.

Returns:
the new cell to move to.

goUp

protected com.klg.jclass.higrid.CellPosition goUp()
Traverse to the same column in the previous row.

Returns:
the new cell to move to.

goDown

protected com.klg.jclass.higrid.CellPosition goDown()
Traverse to the same column in the next row.

Returns:
the new cell to move to.

goLeft

protected com.klg.jclass.higrid.CellPosition goLeft()
Traverse to the previous column in the same row.

Returns:
the new cell to move to.

goRight

protected com.klg.jclass.higrid.CellPosition goRight()
Traverse to the next column in the same row.

Returns:
the new cell to move to.

goLevelHome

protected com.klg.jclass.higrid.CellPosition goLevelHome(com.klg.jclass.higrid.RowNode rowNode)
Traverse to the first row of the table associated with the passed row.

Returns:
the new cell to move to.

goLevelHome

protected com.klg.jclass.higrid.CellPosition goLevelHome()
Traverse to the first row of the table associated with the current row.

Returns:
the new cell to move to.

goLevelUp

protected com.klg.jclass.higrid.CellPosition goLevelUp()
Traverse to the previous row of the table associated with the current row.

Returns:
the new cell to move to.

goLevelUp

protected com.klg.jclass.higrid.CellPosition goLevelUp(com.klg.jclass.higrid.RowNode rowNode,
                                                       boolean upOneOnly)
Traverse to the previous row of the table associated with the passed row.

Returns:
the new cell to move to.

goLevelEnd

protected com.klg.jclass.higrid.CellPosition goLevelEnd(com.klg.jclass.higrid.RowNode rowNode)
Traverse to the last row of the table associated with the passed row.

Returns:
the new cell to move to.

goLevelEnd

protected com.klg.jclass.higrid.CellPosition goLevelEnd()
Traverse to the previous row of the table associated with the current row.

Returns:
the new cell to move to.

goLevelDown

protected com.klg.jclass.higrid.CellPosition goLevelDown()
Traverse to the next row of the table associated with the current row.

Returns:
the new cell to move to.

goLevelDown

protected com.klg.jclass.higrid.CellPosition goLevelDown(com.klg.jclass.higrid.RowNode rowNode,
                                                         boolean downOneOnly)
Traverse to the next row of the table associated with the passed row.

Returns:
the new cell to move to.

goLevelParent

protected com.klg.jclass.higrid.CellPosition goLevelParent()
Traverse to the parent row of the current row.

Returns:
the new cell to move to.

isSourceEditorComponent

protected boolean isSourceEditorComponent(Object source)
Checks whether the passed source object refers to the current CellEditor.

Returns:
true if the source refers to the current CellEditor.

editingStopped

public void editingStopped(com.klg.jclass.cell.JCCellEditorEvent e)
Tells the listeners that the editor has ended editing.

Specified by:
editingStopped in interface JCCellEditorListener
Parameters:
e -

editingCanceled

public void editingCanceled(com.klg.jclass.cell.JCCellEditorEvent e)
Tells the listeners that the editor has cancelled editing.

Specified by:
editingCanceled in interface JCCellEditorListener
Parameters:
e -

cancelCellEditing

public void cancelCellEditing()
Tells the current CellEditor to cancel editing.


stopCellEditing

public void stopCellEditing()
Tells the current CellEditor to (save changes and) stop editing.


handleAutoEdit

protected void handleAutoEdit()
Pops up the appropriate CellEditor if HiGrid is in autoEdit mode.


mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

setOurCursor

protected void setOurCursor(MouseEvent e)
Based on the passed event, sets the appropriate cursor for HiGrid.


createColumnLabel

protected void createColumnLabel()
Creates the moving column header label for run-time user placement of columns.


positionColumnLabel

protected void positionColumnLabel(MouseEvent e)
Positions the moving column header label horizontally based on user input, but keeps it from moving vertically.


duringRowResizing

protected boolean duringRowResizing(com.klg.jclass.higrid.NullGraphics nullgc)
Returns true if the mouse is over a row divider.


duringColumnResizing

protected boolean duringColumnResizing(com.klg.jclass.higrid.NullGraphics nullgc)
Returns true if the mouse is over a column divider.


exchangeColumns

protected void exchangeColumns(Vector dataFormats,
                               int oldColumn,
                               int newColumn)
Helper method to exchange two columns within a given table.


exchangeColumns

protected void exchangeColumns(com.klg.jclass.higrid.CellPosition oldCell,
                               com.klg.jclass.higrid.CellPosition newCell)
Exchanges two columns within a given table.


expandFolder

protected boolean expandFolder(com.klg.jclass.higrid.RowNode rowNode)
Expands the passed rowNode.

Parameters:
rowNode - the RowNode to expand.
Returns:
true if the expansion was not denied

collapseFolder

protected boolean collapseFolder(com.klg.jclass.higrid.RowNode rowNode)
Collapses the passed rowNode.

Parameters:
rowNode - the RowNode to expand.
Returns:
true if the collapse was not denied

showEditor

protected void showEditor(boolean show)
Shows or hides the current CellEditor


initializeEditor

protected void initializeEditor()
Initializes the current CellEditor


initializeEditor

protected void initializeEditor(AWTEvent initialEvent)
Initializes the current CellEditor

Parameters:
initialEvent - the initial MouseEvent or KeyEvent

removeEditor

protected void removeEditor()
Removes the current CellEditor from the GridArea


addEditor

protected void addEditor()
Adds the current CellEditor to the GridArea


createEditor

protected void createEditor()
Creates a CellEditor for the current cell


createEditor

protected void createEditor(AWTEvent initialEvent)
Creates a CellEditor for the current cell

Parameters:
initialEvent - the initial MouseEvent or KeyEvent

positionEditor

protected void positionEditor()
Positions the current CellEditor at the current cell


positionEditor

protected void positionEditor(boolean wantFocus)
Positions the current CellEditor at the current cell

Parameters:
wantFocus - if true, also tries to acquire keyboard focus for the editor

acquireFocusForCellEditor

protected void acquireFocusForCellEditor()
Attempts to acquire keyboard focus for the current CellEditor


getEditorSize

protected void getEditorSize(Component editComponent,
                             com.klg.jclass.higrid.CellFormat format,
                             Dimension cellSize)
Gets the CellEditor size based on the EditWidth and EditHeight policies.

Parameters:
editComponent - the editor's component
format - the format for the cell that the editor will be placed at
cellSize - the eventual size of the editor

getFirstTraversable

protected Component getFirstTraversable(Component editorComponent)
Retrieves the first traversable component of the CellEditor

Parameters:
editorComponent - the CellEditor's component

positionCurrentCell

protected void positionCurrentCell()
Finds a default place to put the current cell when it is uninitialized


repositionCurrentCell

protected void repositionCurrentCell(com.klg.jclass.higrid.RowNode rowNode,
                                     boolean showEditor,
                                     boolean moveEditor)
Reposition the current cell.

Parameters:
rowNode - The row node of the current cell.
showEditor - if true, display the editor
moveEditor - if true, move the editor to this location

getLastCell

protected com.klg.jclass.higrid.CellPosition getLastCell(com.klg.jclass.higrid.RowNode row)
Returns the last available editable position in the grid

Parameters:
row - The row to look on; if null start at the first row of the grid

getFirstCell

protected com.klg.jclass.higrid.CellPosition getFirstCell(com.klg.jclass.higrid.RowNode row)
Returns the first available editable position in the grid

Parameters:
row - The row to look on; if null start at the first row of the grid

commitAndConvert

protected boolean commitAndConvert()
Tries to complete any existing CellEditor edits, validate the result and store the result in the dataModel.


horizontalCellAdjustment

protected int horizontalCellAdjustment(com.klg.jclass.higrid.CellPosition cellPosition)
Computes the number of pixels needed to scroll horizontally to make the passed cellPosition visible.

Parameters:
cellPosition - the CellPosition to scroll into view

scrollEditorIntoView

protected boolean scrollEditorIntoView(int action)
Scrolls both vertically and horizontally, if necessary, to scroll the current CellEditor into view.

Parameters:
action - the action that initiated the scroll

makeCellEditorVisible

public void makeCellEditorVisible()
Scrolls HiGrid so that the current CellEditor is in view.


makeCellEditorVisible

protected void makeCellEditorVisible(int action)
Scrolls HiGrid so that the current CellEditor is in view.

Parameters:
action - Action that caused traversal

moveCurrentCell

public boolean moveCurrentCell(com.klg.jclass.higrid.CellPosition newPosition,
                               int newDesiredColumn)
Moves the current cell to the new row and column.

Parameters:
newPosition - the new cell to move to
newDesiredColumn - the default column to move to when moving vertically Due to cell visibility, the desired column may not be always possible.
Returns:
true if validation and movement succeeds

moveCurrentCell

public boolean moveCurrentCell(com.klg.jclass.higrid.CellPosition newPosition,
                               int newDesiredColumn,
                               boolean refresh,
                               boolean moveInDataModel)
Moves the current cell to the new row and column.

Parameters:
newPosition - the new cell to move to
newDesiredColumn - the default column to move to when moving vertically
refresh - if true refresh editStatus
moveInDataModel - if true, also move current row in dataModel Due to cell visibility, the desired column may not be always possible.
Returns:
true if validation and movement succeeds

moveCurrentCellInternal

protected boolean moveCurrentCellInternal(com.klg.jclass.higrid.CellPosition newPosition,
                                          int newDesiredColumn)
Moves the current cell to the new row and column.

Parameters:
newPosition - the new cell to move to
newDesiredColumn - the default column to move to when moving vertically

moveCurrentCellInternal

protected boolean moveCurrentCellInternal(com.klg.jclass.higrid.CellPosition newPosition,
                                          int newDesiredColumn,
                                          boolean refresh,
                                          boolean moveInDataModel)
Moves the current cell to the new row and column.

Parameters:
newPosition - the new cell to move to
newDesiredColumn - the default column to move to when moving vertically
refresh - if true refresh editStatus
moveInDataModel - if true, also move current row in dataModel

validateCell

protected boolean validateCell(com.klg.jclass.higrid.CellPosition newCellPosition)
Tries to complete any outstanding edits and validate the passed cellPosition

Parameters:
newCellPosition - the new cell to move to
Returns:
true if validation succeeds

validateCell

protected boolean validateCell(com.klg.jclass.higrid.CellPosition newCellPosition,
                               boolean refresh)
Tries to complete any outstanding edits and validate the passed cellPosition

Parameters:
newCellPosition - the new cell to move to
refresh - if true refresh editStatus or current cell
Returns:
true if validation succeeds

traverseToCell

protected boolean traverseToCell(com.klg.jclass.higrid.CellPosition newCellPosition,
                                 int newDesiredColumn,
                                 AWTEvent initialEvent)
Traverses to the new cell and displays a CellEditor

Parameters:
newDesiredColumn - the default column to move to when moving vertically
initialEvent - the initial MouseEvent or KeyEvent
Returns:
true if traversal successful

popupEditor

protected void popupEditor(AWTEvent initialEvent)
Pops up the CellEditor for the current cell

Parameters:
initialEvent - the initial MouseEvent or KeyEvent

validateAndTraverse

protected boolean validateAndTraverse(com.klg.jclass.higrid.CellPosition newCellPosition,
                                      int newDesiredColumn,
                                      AWTEvent initialEvent)
Validates any changes in the CellEditor and traverses to the new cell.

Parameters:
newDesiredColumn - the default column to move to when moving vertically
initialEvent - the initial MouseEvent or KeyEvent
Returns:
true if traversal successful

getCellFromXY

protected com.klg.jclass.higrid.NullGraphics getCellFromXY(Point point)
Determines the cell that corresponds to the given point.

Parameters:
point - a point on the grid
Returns:
a NullGraphics object that contains the corresponding cell

getXYFromCell

protected com.klg.jclass.higrid.NullGraphics getXYFromCell(com.klg.jclass.higrid.CellPosition cellPosition)
Determines the point that corresponds to the given cell.

Parameters:
cellPosition - a cell in the grid
Returns:
a NullGraphics object that contains the corresponding point

doTheRecordWalk

protected com.klg.jclass.higrid.CellPosition doTheRecordWalk(com.klg.jclass.higrid.RowNode startNode,
                                                             int count,
                                                             boolean downward)
Walks the RowTree to a CellPosition based on the passed parameters.

Parameters:
startNode - the initial row to walk from
count - the number of units to walk
downward - if true walk downward vertically

showPopupMenu

protected void showPopupMenu(InputEvent e)
Helper method to show the popup menu


performCopyAction

public void performCopyAction()
Executes a copy action using the system clipboard. The currently selected rows are copied to the clipboard.


performCopyAction

public void performCopyAction(Vector rows)
Executes a copy action using the system clipboard.

Parameters:
rows - The rows to copy to the clipboard.

performPasteAction

public void performPasteAction()
Executes a paste action using the system clipboard.


performPasteAction

public void performPasteAction(com.klg.jclass.higrid.CellPosition cellPosition)
Executes a paste action using the system clipboard.

Parameters:
cellPosition - the cell position to insert before

pasteData

public void pasteData(Vector rows,
                      com.klg.jclass.higrid.RowNode insertBefore)
Pastes a vector of rows before the given cellPosition.

Parameters:
rows - a vector of row object vectors
insertBefore - the row to insert/paste the rows before

getSelectedRows

public Vector getSelectedRows()
Returns the Vector of selected row items.

Returns:
The Vector of RowNodes.

setSelectedRows

protected void setSelectedRows(Vector rowNodes)
Sets the Vector of selected row items.

Parameters:
rowNodes - The Vector of RowNodes.

canSelectRowNode

protected boolean canSelectRowNode(int selectionMode,
                                   com.klg.jclass.higrid.RowNode referenceRowNode,
                                   com.klg.jclass.higrid.RowNode rowNode)
Helper method to determine if selection mode allows the operation to continue.

Parameters:
selectionMode - The row selection mode.
referenceRowNode - The reference row node.
rowNode - The row node to check.
Returns:
True if the row node can be selected according to the selection mode.

doRowSelection

protected boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode,
                                 int selectionMode,
                                 boolean groupSelection,
                                 boolean refresh)
Do row select/deselect based on mouse input

Parameters:
rowNode - The record row node where the mouse click occurred.
selectionMode - The row selection mode.
groupSelection - True if a group of rows from the last single row selected should be selected.
refresh - True if the rows are to be repainted.

doRowSelection

protected boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode,
                                 int selectionMode,
                                 boolean groupSelection)
Do row select/deselect based on mouse input

Parameters:
rowNode - The record row node where the mouse click occurred.
selectionMode - The row selection mode.
groupSelection - True if a group of rows from the last single row selected should be selected.

doRowSelection

protected boolean doRowSelection(com.klg.jclass.higrid.RowNode rowNode,
                                 int selectionMode)
Do row select based on the selection mode.

Parameters:
rowNode - The record row node where the mouse click occurred.
selectionMode - The row selection mode.
Returns:
true if all selection operations succeeded

resetRowSelection

protected boolean resetRowSelection()
Reset all row selection.


resetRowSelection

protected boolean resetRowSelection(boolean refresh)
Reset all row selection.

Parameters:
refresh - True if the rows are to be refreshed.

selectRows

protected boolean selectRows(com.klg.jclass.higrid.RowNode rowNode,
                             boolean state)
(De-)Select the passed RowNode. The selection can be denied in the BEFORE_SELECT_ROW event.

Parameters:
rowNode - A RowNode to select
state - true for Select, false for Deselect
Returns:
true if the selection was permitted, or empty

selectRows

protected boolean selectRows(Vector rows,
                             boolean state)
(De-)Select the passed Vector of rows. The selection can be denied in the BEFORE_SELECT_ROW event.

Parameters:
rows - A Vector of RowNodes to select
state - true for Select, false for Deselect
Returns:
true if the selection was permitted, or empty

addAction

public void addAction(com.klg.jclass.higrid.ActionInitiator initiator,
                      int action)
Adds an ActionInitiator/action pair to table.

See Also:
addAction(HiGridAction)

addAction

public void addAction(com.klg.jclass.higrid.HiGridAction action)
Adds a HiGridAction to table. A HiGridAction maps an event to a particular action on HiGrid.


getAction

public int getAction(AWTEvent event)
Returns the action mapped to the given event. If no action exists, HiGridAction.NO_ACTION is returned.


getMouseActionInitiator

public com.klg.jclass.higrid.MouseActionInitiator getMouseActionInitiator(int button_mask,
                                                                          int modifier)
Returns the specified MouseActionInitiator, If no matching ActionInitiator exists, null is returned.


removeAction

public void removeAction(com.klg.jclass.higrid.HiGridAction action)
Removes an action from HiGrid.


removeAction

public void removeAction(com.klg.jclass.higrid.ActionInitiator initiator,
                         int action)
Removes an ActionInitiator/action pair from HiGrid.


removeAction

public void removeAction(int action)
Removes any ActionInitiator set for the given action type.


removeAllKeyActions

public void removeAllKeyActions()
Removes all key actions from HiGrid.


removeAllMouseActions

public void removeAllMouseActions()
Removes all mouse actions from HiGrid.


removeAllActions

public void removeAllActions()
Removes all actions from HiGrid.


getAllActions

public Enumeration getAllActions()
Returns an enumeration of the HiGridActions

Returns:
An enumeration of all current HiGridActions

createDefaultActions

public void createDefaultActions()
Re-creates all standard actions. Call removeAllActions() first if you want to start anew.


Copyright © 2004 Quest Software Inc..
All rights reserved.