org.openswing.swing.table.client
Class Grid

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTable
                  extended byorg.openswing.swing.table.client.Grid
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.CellEditorListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener, java.awt.image.ImageObserver, javax.swing.event.ListSelectionListener, java.awt.MenuContainer, java.awt.event.MouseListener, QuickFilterListener, javax.swing.Scrollable, SearchControl, java.io.Serializable, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener

public class Grid
extends javax.swing.JTable
implements QuickFilterListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, SearchControl, java.awt.event.MouseListener

Title: OpenSwing Framework

Description: Grid based on VOListTableModel. This class has not be used directly by the programmer: it's called by GridControl.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static int BOTTOM_GRID
          bottom grid (optional), that contains the bottom locked rows
static int MAIN_GRID
          main grid
 boolean searchAdditionalRows
          flag used in grid to enable the retrieval of additional rows in fast search, when search criteria fails; default value: ClientSettings.SEARCH_ADDITION_ROWS
static int TOP_GRID
          top grid (optional), that contains the top locked rows
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS
 
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
Grid(Grids grids, Column[] colProps, GridStatusPanel statusPanel, int fromColIndex, int toColIndex, boolean colorsInReadOnlyMode, VOListTableModel model, VOListAdapter modelAdapter, GridController gridController, boolean lockedGrid, boolean anchorLastColumn, int expandableColumn, boolean singleExpandableRow, boolean overwriteRowWhenExpanding, ExpandableRowController expandableRowController, java.util.HashMap comboFilters, int headerHeight, boolean searchAdditionalRows, boolean allowColumnsSortingInEdit, int gridType)
          Costructor called by GridControl: programmer never called directly this class.
 
Method Summary
 void addNotify()
          Method called by JVM when viewing this class.
 void addPopupCommand(javax.swing.JMenuItem item)
          Add a command to the grids.getPopup() menu.
 void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
          Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
 void collapseRow(int row)
          If expandableRenderer attribute is not null, then collapse the specified row.
 int columnAtPoint(java.awt.Point point)
          Method overrided to calculate column index according to the cell visibility (that is dependent from the cells span)
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Method called by JTable when resizing a column.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Method called my JTable when moving a column.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Method overrided to ensure that the current selected cell is always visible.
 boolean disableListener()
           
 void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
          This message goes to DragSourceListener, informing it that the dragging has ended.
 void dragEnter(java.awt.dnd.DragSourceDragEvent event)
          This message goes to DragSourceListener, informing it that the dragging has entered the DropSite
 void dragEnter(java.awt.dnd.DropTargetDragEvent event)
          This method is invoked when you are dragging over the DropSite.
 void dragExit(java.awt.dnd.DragSourceEvent event)
          This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.
 void dragExit(java.awt.dnd.DropTargetEvent event)
          This method is invoked when you are exit the DropSite without dropping.
 void dragOver(java.awt.dnd.DragSourceDragEvent event)
          This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.
 void dragOver(java.awt.dnd.DropTargetDragEvent event)
          This method is invoked when a drag operation is going on.
 void drop(java.awt.dnd.DropTargetDropEvent event)
          This method is invoked when a drop event has occurred.
 void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
          This method is invoked when the user changes the dropAction.
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
          This method is invoked if the use modifies the current drop gesture.
 boolean editCellAt(int row, int column, java.util.EventObject e)
          Method redefined to store the current selected cell when user clicks directly in the cell with the mouse.
 void editingStopped(javax.swing.event.ChangeEvent e)
          Invoked when editing is finished.
 void enableDrag(java.lang.String gridId)
          Enable drag onto the grid.
 void ensureRowIsVisible(int selRow)
          This method override the super class method, to fix a bug.
 void filter(Column colProps, java.lang.Object value1, java.lang.Object value2)
          Method called by quick filter panel to filter the specified column.
 void finalize()
           
 java.awt.Color getActiveCellBackgroundColor()
           
 java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
           
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int col)
           
 int getColumnIndex(java.lang.String columnName)
           
 javax.swing.JComponent getComponent()
           
 java.lang.String getExpandableColumnAttributeName()
           
 ExpandableRowController getExpandableRowController()
           
 Grids getGrids()
           
 int getMode()
           
 Grid getParentGrid()
           
 int getRowCount()
           
 int getSelectedIndex()
           
 java.awt.event.MouseListener getSortingMouseListener()
           
 org.openswing.swing.table.client.Grid.Pair getSpan(int row, int column)
           
 java.lang.String getValueAt(int index)
           
 VOListTableModel getVOListTableModel()
           
 boolean hasCellSpan()
           
 boolean hasColSpan()
           
 void internalSorting()
          Sort the list of value objects already loaded, according to current column sorting settings.
 boolean isColorsInReadOnlyMode()
           
 boolean isDataModified()
           
 boolean isOverwriteRowWhenExpanding()
           
 boolean isReadOnly()
           
 boolean isRowHeightFixed()
           
 boolean isSearchWindowVisible()
           
 boolean isSingleExpandableRow()
           
 boolean isVisible(int row, int column)
           
 boolean mergeCells(int[] rows, int[] columns)
          Set the cell span for the specified range of cells.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void nextPage(NavigatorBar navBar)
          Method called when user click on "next page" button on the navigation bar: it does clear table model, reload next data block and select the first row of the block.
 java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor, int row, int column)
           
 void prepareJTable()
          Prepare a JTable for use with this model.
 java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column)
          Prepares the renderer by querying the data model for the value and selection state of the cell at row, column.
 void previousPage(NavigatorBar navBar)
          Method called when user click on "previous page" button on the navigation bar: it does clear table model, reload previous data block and select the last row of the block.
 void refreshExpandableRenderer()
          If expandableRenderer attribute is not null and there is an expanded row, then refresh it.
 void removeEditor()
           
 boolean removeMergedCells(int[] rows, int[] columns)
          Remove the cell span for the specified range of cells.
 void removeQuickFilter(java.lang.String attributeName)
          Remove filter from the specified column.
 void requestFocus()
           
 void resetColumns(org.openswing.swing.table.profiles.java.GridProfile profile)
          Method invoked by Grid.applyProfile to reset column visibility, position, width.
 int rowAtPoint(java.awt.Point point)
          Method overrided to calculate row index according to the cell visibility (that is dependent from the cells span)
 int search(java.lang.String textToSearch)
          Method invoked by SearchWindowManager when the specified "textToSeach" pattern has not matchings in the current content of binded control.
 void setActiveCellBackgroundColor(java.awt.Color activeCellBackgroundColor)
          Set background color for the selected cell.
 void setColorsInReadOnlyMode(boolean colorsInReadOnlyMode)
          Define if background and foreground colors must be setted according to GridController definition only in READONLY mode.
 void setOrderWithLoadData(boolean orderWithLoadData, OrderPolicy orderPolicy)
          Used to define if grid sorting operation must always invoke loadData method to retrieve a new list of v.o. or the grid must sort the current v.o. list without invoking loadData (only with the whole result set loaded).
 void setReorderingAllowed(boolean reorderingAllowed)
          Set if it is allowed to reorder columns.
 void setResizingAllowed(boolean resizingAllowed)
          Set if it is allowed to resize columns.
 void setRowHeightFixed(boolean rowHeightFixed)
           
 void setSelectedIndex(int index)
          Set the selected index.
 void setVisibleColumn(int columnModelIndex, boolean colVisible)
          Set (in)visibility state of the specified column.
 boolean stopCellEditing()
           
 void updateColumnHeaderIcons()
          Method invoked by FilterPanel to repaint icons in column headers, according to sorting/filtering conditions just applied.
 void valueChanged(javax.swing.event.ListSelectionEvent e)
          Called whenever the value of the selection changes.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addRowSelectionInterval, clearSelection, columnAdded, columnRemoved, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnsFromModel, createScrollPaneForTable, doLayout, editCellAt, editingCanceled, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, removeColumn, removeColumnSelectionInterval, removeNotify, removeRowSelectionInterval, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, 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, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, 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, 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
 

Field Detail

MAIN_GRID

public static final int MAIN_GRID
main grid

See Also:
Constant Field Values

TOP_GRID

public static final int TOP_GRID
top grid (optional), that contains the top locked rows

See Also:
Constant Field Values

BOTTOM_GRID

public static final int BOTTOM_GRID
bottom grid (optional), that contains the bottom locked rows

See Also:
Constant Field Values

searchAdditionalRows

public boolean searchAdditionalRows
flag used in grid to enable the retrieval of additional rows in fast search, when search criteria fails; default value: ClientSettings.SEARCH_ADDITION_ROWS

Constructor Detail

Grid

public Grid(Grids grids,
            Column[] colProps,
            GridStatusPanel statusPanel,
            int fromColIndex,
            int toColIndex,
            boolean colorsInReadOnlyMode,
            VOListTableModel model,
            VOListAdapter modelAdapter,
            GridController gridController,
            boolean lockedGrid,
            boolean anchorLastColumn,
            int expandableColumn,
            boolean singleExpandableRow,
            boolean overwriteRowWhenExpanding,
            ExpandableRowController expandableRowController,
            java.util.HashMap comboFilters,
            int headerHeight,
            boolean searchAdditionalRows,
            boolean allowColumnsSortingInEdit,
            int gridType)
Costructor called by GridControl: programmer never called directly this class.

Parameters:
colProps - TableModel column properties (name, type, etc.)
statusPanel - bottom panel included into the grid; used to view selected row numbers
fromColIndex - column index from which to start to add TableColumn (related to colProps list)
toColIndex - final column index of TableColumn objects to add (related to colProps list), index excluded
colorsInReadOnlyMode - flag used to define if background and foreground colors must be setted according to GridController definition only in READONLY mode
model - grid model
modelAdapter - grid model adapter
gridController - grid controller
lockedGrid - locked grid (optional)
anchorLastColumn - define if last column must be anchored to the right margin
expandableColumn - optional column index, related to column expandable, i.e. a cell that can contains an inner panel
singleExpandableRow - flag used to define cell expansion policy
overwriteRowWhenExpanding - flag used to define cell expansion policy
expandableRowController - controller of cell expansion task
comboFilters - collection of combo filters
headerHeight - header height
gridType - type of grid; possible values: Grid.MAIN_GRID, Grid.TOP_GRID, Grid.BOTTOM_GRID
Method Detail

prepareJTable

public final void prepareJTable()
Prepare a JTable for use with this model. This method creates the necessary columns in the JTable and assigns the appropriate cell renderers and editors (as provided by the attribute adapter) for each column.


editCellAt

public boolean editCellAt(int row,
                          int column,
                          java.util.EventObject e)
Method redefined to store the current selected cell when user clicks directly in the cell with the mouse.


prepareEditor

public java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor,
                                        int row,
                                        int column)

removeEditor

public void removeEditor()

previousPage

public final void previousPage(NavigatorBar navBar)
Method called when user click on "previous page" button on the navigation bar: it does clear table model, reload previous data block and select the last row of the block.


nextPage

public final void nextPage(NavigatorBar navBar)
Method called when user click on "next page" button on the navigation bar: it does clear table model, reload next data block and select the first row of the block. This operations are executed in a separated thread.


internalSorting

public final void internalSorting()
Sort the list of value objects already loaded, according to current column sorting settings.


setVisibleColumn

public final void setVisibleColumn(int columnModelIndex,
                                   boolean colVisible)
Set (in)visibility state of the specified column.

Parameters:
columnModelIndex - column model index
colVisible - (in)visibility state for the specified column

getVOListTableModel

public final VOListTableModel getVOListTableModel()
Returns:
table model of the grid

changeSelection

public void changeSelection(int rowIndex,
                            int columnIndex,
                            boolean toggle,
                            boolean extend)
Updates the selection models of the table, depending on the state of the two flags: 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.

This implementation uses the following conventions:

Parameters:
rowIndex - affects the selection at row
columnIndex - affects the selection at column
toggle - see description above
extend - if true, extend the current selection

valueChanged

public final void valueChanged(javax.swing.event.ListSelectionEvent e)
Called whenever the value of the selection changes.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
e - grid selection event

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Method overrided to ensure that the current selected cell is always visible.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - ListSelectionEvent

getActiveCellBackgroundColor

public final java.awt.Color getActiveCellBackgroundColor()
Returns:
background color for the selected cell

setActiveCellBackgroundColor

public final void setActiveCellBackgroundColor(java.awt.Color activeCellBackgroundColor)
Set background color for the selected cell.

Parameters:
activeCellBackgroundColor - background color for the selected cell

getMode

public final int getMode()
Returns:
current grid mode; possible values: Consts.READ_ONLY, Consts.EDIT, Consts.INSERT

setReorderingAllowed

public final void setReorderingAllowed(boolean reorderingAllowed)
Set if it is allowed to reorder columns.

Parameters:
reorderingAllowed - flag used to set columns reordering

setResizingAllowed

public final void setResizingAllowed(boolean resizingAllowed)
Set if it is allowed to resize columns.


ensureRowIsVisible

public final void ensureRowIsVisible(int selRow)
This method override the super class method, to fix a bug.

Parameters:
selRow - selected row

isSearchWindowVisible

public final boolean isSearchWindowVisible()
Returns:
true if search window is currently visible, false otherwise

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener

filter

public void filter(Column colProps,
                   java.lang.Object value1,
                   java.lang.Object value2)
Method called by quick filter panel to filter the specified column.

Specified by:
filter in interface QuickFilterListener
Parameters:
colProps - column properties
value1 - value used in the filter column (as unique filtering value or as the miminum value in a range filtering)
value2 - (optional) value used in the filter column (as the maximum value in a range filtering)

updateColumnHeaderIcons

public final void updateColumnHeaderIcons()
Method invoked by FilterPanel to repaint icons in column headers, according to sorting/filtering conditions just applied.


removeQuickFilter

public void removeQuickFilter(java.lang.String attributeName)
Remove filter from the specified column.

Parameters:
attributeName - attribute name that identifies the column

addNotify

public final void addNotify()
Method called by JVM when viewing this class.


isDataModified

public boolean isDataModified()
Returns:
true if TableModel is changed, false otherwise

stopCellEditing

public final boolean stopCellEditing()
Returns:
true if current editing cell is in valid state, false otherwise

addPopupCommand

public final void addPopupCommand(javax.swing.JMenuItem item)
Add a command to the grids.getPopup() menu.

Parameters:
item - command to add in the grids.getPopup() menu

getColumnIndex

public int getColumnIndex(java.lang.String columnName)
Parameters:
columnName - column name
Returns:
int column index of the specified column name

setRowHeightFixed

public final void setRowHeightFixed(boolean rowHeightFixed)
Parameters:
rowHeightFixed - define if row height can change for each row, according to image height included in a cell of grid; default value: true

isRowHeightFixed

public final boolean isRowHeightFixed()
Returns:
define if row height can change for each row, according to image height included in a cell of grid; default value: true

setOrderWithLoadData

public final void setOrderWithLoadData(boolean orderWithLoadData,
                                       OrderPolicy orderPolicy)
Used to define if grid sorting operation must always invoke loadData method to retrieve a new list of v.o. or the grid must sort the current v.o. list without invoking loadData (only with the whole result set loaded).

Parameters:
orderWithLoadData - flag used to define if grid sorting operation must always invoke loadData method to retrieve a new list of v.o. or the grid must sort the current v.o. list without invoking loadData (only with the whole result set loaded)

getSortingMouseListener

public final java.awt.event.MouseListener getSortingMouseListener()
Returns:
mouse listener applied to tabler headers to sort columns

enableDrag

public final void enableDrag(java.lang.String gridId)
Enable drag onto the grid.

Parameters:
gridId - grid identifier

dragEnter

public final void dragEnter(java.awt.dnd.DragSourceDragEvent event)
This message goes to DragSourceListener, informing it that the dragging has entered the DropSite

Specified by:
dragEnter in interface java.awt.dnd.DragSourceListener

dragExit

public final void dragExit(java.awt.dnd.DragSourceEvent event)
This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.

Specified by:
dragExit in interface java.awt.dnd.DragSourceListener

dragOver

public final void dragOver(java.awt.dnd.DragSourceDragEvent event)
This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.

Specified by:
dragOver in interface java.awt.dnd.DragSourceListener

dropActionChanged

public final void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
This method is invoked when the user changes the dropAction.

Specified by:
dropActionChanged in interface java.awt.dnd.DragSourceListener

dragDropEnd

public final void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
This message goes to DragSourceListener, informing it that the dragging has ended.

Specified by:
dragDropEnd in interface java.awt.dnd.DragSourceListener

dragEnter

public final void dragEnter(java.awt.dnd.DropTargetDragEvent event)
This method is invoked when you are dragging over the DropSite.

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragExit

public final void dragExit(java.awt.dnd.DropTargetEvent event)
This method is invoked when you are exit the DropSite without dropping.

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

dragOver

public final void dragOver(java.awt.dnd.DropTargetDragEvent event)
This method is invoked when a drag operation is going on.

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

drop

public final void drop(java.awt.dnd.DropTargetDropEvent event)
This method is invoked when a drop event has occurred.

Specified by:
drop in interface java.awt.dnd.DropTargetListener

dropActionChanged

public final void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
This method is invoked if the use modifies the current drop gesture.

Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

columnMoved

public final void columnMoved(javax.swing.event.TableColumnModelEvent e)
Method called my JTable when moving a column.

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener

columnMarginChanged

public final void columnMarginChanged(javax.swing.event.ChangeEvent e)
Method called by JTable when resizing a column.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener

setColorsInReadOnlyMode

public final void setColorsInReadOnlyMode(boolean colorsInReadOnlyMode)
Define if background and foreground colors must be setted according to GridController definition only in READONLY mode.

Parameters:
colorsInReadOnlyMode - false to enable background and foreground colors to be setted according to GridController definition in all grid modes; true to enable background and foreground colors to be setted according to GridController definition only in READONLY mode

isColorsInReadOnlyMode

public final boolean isColorsInReadOnlyMode()
Returns:
define if background and foreground colors must be setted according to GridController definition only in READONLY mode

hasColSpan

public final boolean hasColSpan()

mergeCells

public final boolean mergeCells(int[] rows,
                                int[] columns)
Set the cell span for the specified range of cells.

Parameters:
rows - row indexes that identify the cells to merge
columns - column indexes that identify the cells to merge
Returns:
true if merge operation is allowed, false if the cells range is invalid

removeMergedCells

public final boolean removeMergedCells(int[] rows,
                                       int[] columns)
Remove the cell span for the specified range of cells.

Parameters:
rows - row indexes that identify the cells to merge
columns - column indexes that identify the cells to merge
Returns:
true if merge operation is allowed, false if the cells range is invalid

isVisible

public final boolean isVisible(int row,
                               int column)
Returns:
true if the specified cell is visible (according to cells span settings), false otherwise

getSpan

public final org.openswing.swing.table.client.Grid.Pair getSpan(int row,
                                                                int column)
Returns:
cell span

hasCellSpan

public final boolean hasCellSpan()
Returns:
boolean

getCellRect

public java.awt.Rectangle getCellRect(int row,
                                      int column,
                                      boolean includeSpacing)

rowAtPoint

public final int rowAtPoint(java.awt.Point point)
Method overrided to calculate row index according to the cell visibility (that is dependent from the cells span)


columnAtPoint

public final int columnAtPoint(java.awt.Point point)
Method overrided to calculate column index according to the cell visibility (that is dependent from the cells span)


editingStopped

public void editingStopped(javax.swing.event.ChangeEvent e)
Invoked when editing is finished. The changes are saved and the editor is discarded.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
editingStopped in interface javax.swing.event.CellEditorListener
Parameters:
e - the event received
See Also:
This method has been overriden to restore focus in the just edited cell when its value is not valid.

resetColumns

public final void resetColumns(org.openswing.swing.table.profiles.java.GridProfile profile)
Method invoked by Grid.applyProfile to reset column visibility, position, width.


getSelectedIndex

public final int getSelectedIndex()
Specified by:
getSelectedIndex in interface SearchControl
Returns:
the selected index in the input control

setSelectedIndex

public final void setSelectedIndex(int index)
Set the selected index.

Specified by:
setSelectedIndex in interface SearchControl

getRowCount

public final int getRowCount()
Specified by:
getRowCount in interface SearchControl
Returns:
total rows count in the input control

getValueAt

public final java.lang.String getValueAt(int index)
Specified by:
getValueAt in interface SearchControl
Returns:
the element at the specified index, converted in String format

getComponent

public final javax.swing.JComponent getComponent()
Specified by:
getComponent in interface SearchControl
Returns:
combo control

isReadOnly

public final boolean isReadOnly()
Specified by:
isReadOnly in interface SearchControl
Returns:
true if the input control is in read only mode (so search is enabled), false otherwise

getExpandableColumnAttributeName

public final java.lang.String getExpandableColumnAttributeName()
Returns:
attribute name of the column declared as expandable, i.e. user can click on it to expand cell to show an inner component

isSingleExpandableRow

public final boolean isSingleExpandableRow()
Returns:
define whether expanded rows in the past must be collapsed when expanding the current one; used only when "expandableColumn" property is not null

getExpandableRowController

public final ExpandableRowController getExpandableRowController()
Returns:
controller that manages row expansion

isOverwriteRowWhenExpanding

public final boolean isOverwriteRowWhenExpanding()
Returns:
define whether the row to show, when expanding the current one, must be showed over the current one on in a new row below it; used only when "overwriteRowWhenExpanding" property is not null

getCellRenderer

public final javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                                 int col)
Parameters:
row - row number
col - column niumber in grid
Returns:
TableCellRenderer associated to the specified cell

refreshExpandableRenderer

public final void refreshExpandableRenderer()
If expandableRenderer attribute is not null and there is an expanded row, then refresh it. This method can be invoked by Form when updating a nested Form panel, in order to refresh expanded row content.


collapseRow

public final void collapseRow(int row)
If expandableRenderer attribute is not null, then collapse the specified row.

Parameters:
row - row to collapse

prepareRenderer

public final java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer,
                                                int row,
                                                int column)
Prepares the renderer by querying the data model for the value and selection state of the cell at row, column. Returns the component (may be a Component or a JComponent) under the event location.

Note: Throughout the table package, the internal implementations always use this method to prepare renderers so that this default behavior can be safely overridden by a subclass.

Parameters:
renderer - the TableCellRenderer to prepare
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
Returns:
the Component under the event location

getParentGrid

public final Grid getParentGrid()
Returns:
parent Grid that has this as nested grid; null if this is a main grid, not a nested grid

disableListener

public final boolean disableListener()
Specified by:
disableListener in interface SearchControl
Returns:
true to disable key listening on input control (for instance, in case of nested grids), false to listen for key events

search

public final int search(java.lang.String textToSearch)
Method invoked by SearchWindowManager when the specified "textToSeach" pattern has not matchings in the current content of binded control. This callback can be used to retrieve additional data into control and to search inside new data.

Specified by:
search in interface SearchControl
Parameters:
textToSearch - patten of text to search
Returns:
-1 if no additional data is available, otherwise the row index of data just added that satify the pattern

requestFocus

public final void requestFocus()

getGrids

public Grids getGrids()

finalize

public void finalize()