org.openswing.swing.table.client
Class Grids

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.table.client.Grids
All Implemented Interfaces:
javax.accessibility.Accessible, DataController, java.awt.image.ImageObserver, java.awt.MenuContainer, NavigatorBarController, java.io.Serializable, VOListTableModelListener

public class Grids
extends javax.swing.JPanel
implements VOListTableModelListener, DataController, NavigatorBarController

Title: OpenSwing Framework

Description: Panel that contains the Grid object and a second Grid object, anchored to the left side of the panel (optional). 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
 
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
Grids(GridControl gridControl, int lockedColumns, boolean anchorLockedColumnsToLeft, java.lang.String valueObjectClassName, Column[] colProps, GridController gridController, GridStatusPanel statusPanel, GridDataLocator gridDataLocator, java.util.Map otherGridParams, boolean colorsInReadOnlyMode, java.util.ArrayList popupCommands, 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 addButtonsNotEnabled(java.util.HashSet buttons, GenericButtonController buttonController)
          Define GenericButton objects linked to this that will be disabled (independently from the grid mode) when the specified attribute will be set to the specified value.
 void addGenericButton(GenericButton button)
          Add an optional button.
 void addLoadDataCompletedListener(java.awt.event.ActionListener listener)
          Add a "load data completed" listener.
 void addNotify()
          Method called by JVM when viewing this class.
 void cleanUp(int row, boolean cleanUpAlsoNotEditableCells)
          Clean up cells content for the specified row, for each field or editable only cells.
 void clearData()
          Clear grid content.
 void collapseRow(int row)
          Collapse specified row.
 void copy()
          Method called when user clicks on copy button.
 void delete()
          Method called when user clicks on delete button.
 void edit()
          Method called when user clicks on edit button.
 void enableDrag(java.lang.String gridId)
          Enable drag onto the grid.
 boolean executeReload()
          Reload TableModel.
 void expandRow(int row)
          Expand specified row.
 void export()
          Method called when user clicks on export button.
 void export(java.util.ArrayList exportColumns, java.util.ArrayList exportAttrColumns, java.lang.String exportType)
          Method called by ExportDialog to export data.
 void filterSort()
          Method called when user has clicked on filter button.
 void finalize()
           
 void firstRow(NavigatorBar navBar)
          Method called when user click on "first" button on the navigation bar: it will clear table model, reload data and select the first row of the block.
 java.util.HashSet getBindedButtons()
           
 int getBlockSize()
           
 java.awt.Component getComponentInCache(int row)
           
 CopyButton getCopyButton()
           
 int getCurrentEditingRow()
           
 java.awt.Component getCurrentNestedComponent()
           
 int getCurrentNestedComponentRow()
           
 int getCurrentNumberOfNewRows()
           
 java.util.ArrayList getCurrentSortedColumns()
           
 java.util.ArrayList getCurrentSortedVersusColumns()
           
 boolean getCurrentValue(GenericButton button)
           
 GridExportOptions getDefaultGridExportOptions()
           
 GridExportOptions getDefaultGridExportOptions(java.util.HashSet attributesToExport)
           
 int getDefaultQuickFilterCriteria()
           
 DeleteButton getDeleteButton()
           
 EditButton getEditButton()
           
 ExportButton getExportButton()
           
 FilterButton getFilterButton()
           
 QuickFilterPanel getFilterPanel()
           
 java.lang.String getFunctionId()
           
 java.util.ArrayList getGenericButtons()
           
 Grid getGrid()
           
 GridControl getGridControl()
           
 GridController getGridController()
           
 java.lang.String getHeaderColumnName(java.lang.String attributeName)
           
 ImportButton getImportButton()
           
 InsertButton getInsertButton()
           
 int getLastIndex()
           
 Grid getLockedGrid()
           
 int getMaxNumberOfRowsOnInsert()
           
 int getMaxSortedColumns()
           
 int getMode()
           
 NavigatorBar getNavBar()
           
 java.util.Map getOtherGridParams()
           
 javax.swing.JPopupMenu getPopup()
           
 java.util.ArrayList getPopupCommands()
           
 java.util.Map getQuickFilterValues()
           
 ReloadButton getReloadButton()
           
 javax.swing.JMenuItem getRemovefilterItem()
           
 SaveButton getSaveButton()
           
 javax.swing.JScrollPane getScroll()
           
 int getSelectedColumn()
           
 int getSelectedRow()
           
 int[] getSelectedRows()
          Returns the indices of all selected rows.
 int getstartIndex()
           
 int getTotalResultSetLength()
           
 VOListTableModel getVOListTableModel()
           
 void importData()
          Method called when user clicks on import button.
 void importData(java.util.ArrayList columnTypes, java.util.ArrayList importAttrColumns, java.lang.String importType)
          Method called by ImportDialog to import data.
 void insert()
          Method called when user clicks on insert button.
 boolean isAllowInsertInEdit()
           
 boolean isAnchorLockedColumnsToLeft()
           
 boolean isButtonDisabled(GenericButton button)
          Method called by GenericButton.setEnabled method to check if the button must be disabled.
 boolean isEditOnSingleRow()
           
 boolean isEnableInReadOnlyMode(int columnIndex)
           
 boolean isFieldEditable(int rowNumber, java.lang.String attributeName)
           
 boolean isInsertRowsOnTop()
           
 boolean isListenEvent()
           
 boolean isMoreRows()
           
 boolean isRowExpanded(int row)
           
 void lastRow(NavigatorBar navBar)
          Method called when user click on "last" button on the navigation bar: it may clear table model, reload the last data block and select the last row of the block.
 void loadPage(int pageNr)
          Method invoked by NavigatorBar to change page to load.
 boolean mergeCells(int[] rows, int[] columns)
          Set the cell span for the specified range of cells.
 void modeChanged(int mode)
          Method called on changing grid mode.
 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.
 void nextRow(NavigatorBar navBar, java.awt.event.ActionEvent e)
          Method called when user click on "next" button on the navigation bar: it may clear table model, reload next data block and select the first row of the block.
 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 previousRow(NavigatorBar navBar, java.awt.event.ActionEvent e)
          Method called when user click on "previous" button on the navigation bar: it may clear table model, reload previous data block and select the last row of the block.
 void putComponentInCache(int row, java.awt.Component comp)
           
 void reload()
          Method called by reload button: - sets READONLY mode - reloads TableModel, by calling executeReload method
 void reloadDataFromStart()
          Method called from reload method: reload current data block.
 void removeComponentInCache(int row)
          Removce component from cache.
 void removeGenericButton(GenericButton button)
          Remove an optional button.
 void removeLoadDataCompletedListener(java.awt.event.ActionListener listener)
          Remove a "load data completed" listener.
 void resetButtonsState()
          Method automatically called by the Grid to check buttons disabilitation.
 int retrieveAdditionalRows(java.lang.String attributeName, java.lang.String textToSearch)
          This method fetches and appends additional rows that satisfy specified criteria.
 boolean save()
          Method called when user clicks on save button.
 void setAllowInsertInEdit(boolean allowInsertInEdit)
          Allow insert row (using DOWN key) in edit mode too; default value: false
 void setColorsInReadOnlyMode(boolean colorsInReadOnlyMode)
          Define if background and foreground colors must be setted according to GridController definition only in READONLY mode.
 void setCopyButton(CopyButton copyButton)
          Set copy button linked to grid.
 void setCurrentNestedComponent(int currentNestedComponentRow, java.awt.Component currentNestedComponent)
           
 void setCurrentNumberOfNewRows(int currentNumberOfNewRows)
          Set the current number of new rows.
 void setCurrentValue(GenericButton button, boolean currentValue)
          Set current enabled value of button.
 void setDeleteButton(DeleteButton deleteButton)
          Set delete button linked to grid.
 void setEditButton(EditButton editButton)
          Set edit button linked to grid.
 void setEditOnSingleRow(boolean editOnSingleRow)
          Define if cell editing is allows on one row only or on all rows: false all rows are editable, true edit is allowed only on current selected row
 void setExportButton(ExportButton exportButton)
          Set export button linked to grid.
 void setFilterButton(FilterButton filterButton)
          Set filter button linked to grid.
 void setFilterPanel(QuickFilterPanel filterPanel)
           
 void setFunctionId(java.lang.String functionId)
          Set the functionId identifier, associated to the container
 void setGenericButtonsEnabled(boolean enabled)
          Set (dis)abilitation for whole generic buttons.
 void setImportButton(ImportButton importButton)
          Set import button linked to grid.
 void setInsertButton(InsertButton insertButton)
          Set insert button linked to grid.
 void setInsertRowsOnTop(boolean insertRowsOnTop)
          Define where new rows must be added: true at the top of the grid or false at the bottom; default value: true
 void setIntercellSpacing(java.awt.Dimension spacing)
          Sets the rowMargin and the columnMargin -- the height and width of the space between cells -- to intercellSpacing.
 void setListenEvent(boolean listenEvent)
           
 void setMaxNumberOfRowsOnInsert(int maxNumberOfRowsOnInsert)
          Set the maximum number of rows to insert by pressing "down" key; default value: 1.
 void setMaxSortedColumns(int maxSortedColumns)
          Set maximum number of sorted columns.
 void setMode(int mode)
          Set grid mode.
 void setNavBar(NavigatorBar navBar)
          Set navigation bar.
 void setOtherGridParams(java.util.Map otherGridParams)
          Set other grid parameters.
 void setReloadButton(ReloadButton reloadButton)
          Set reload button linked to grid.
 void setReorderingAllowed(boolean reorderingAllowed)
          Define if column reordering is allowed.
 void setResizingAllowed(boolean resizingAllowed)
          Define if column resizing is allowed.
 void setRowMargin(int rowMargin)
          Sets the amount of empty space between cells in adjacent rows.
 void setRowSelectionInterval(int startRow, int endRow)
          Set row selection interval.
 void setSaveButton(SaveButton saveButton)
          Set save button linked to grid.
 void setSelectionMode(int selectionMode)
          Set grid selection mode.
 void setVisibleColumn(java.lang.String attributeName, boolean colVisible)
          Show/hide a column.
 void transferFocus()
          Remove cell editing, if needed.
 void updateColumnHeaderIcons()
          Method invoked by FilterPanel to repaint icons in column headers, according to sorting/filtering conditions just applied.
 boolean validateRows()
          Execute a validation on changed rows.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grids

public Grids(GridControl gridControl,
             int lockedColumns,
             boolean anchorLockedColumnsToLeft,
             java.lang.String valueObjectClassName,
             Column[] colProps,
             GridController gridController,
             GridStatusPanel statusPanel,
             GridDataLocator gridDataLocator,
             java.util.Map otherGridParams,
             boolean colorsInReadOnlyMode,
             java.util.ArrayList popupCommands,
             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:
valueObjectClassName - ValueObject class name
colProps - TableModel column properties (name, type, etc.)
statusPanel - bottom panel included into the grid; used to view selected row numbers
colorsInReadOnlyMode - flag used to define if background and foreground colors must be setted according to GridController definition only in READONLY mode
popupCommands - list of custom commands added to the popup menu accessed by right mouse click on grid
anchorLastColumn - define if last column must be anchored to the right margin of the grid
gridType - type of grid; possible values: Grid.MAIN_GRID, Grid.TOP_GRID, Grid.BOTTOM_GRID
Method Detail

setCurrentValue

public final void setCurrentValue(GenericButton button,
                                  boolean currentValue)
Set current enabled value of button.

Specified by:
setCurrentValue in interface DataController
Parameters:
button - generic button that fires this event
currentValue - current enabled value

getCurrentValue

public final boolean getCurrentValue(GenericButton button)
Specified by:
getCurrentValue in interface DataController
Parameters:
button - generic button
Returns:
current enabled value

setReorderingAllowed

public final void setReorderingAllowed(boolean reorderingAllowed)
Define if column reordering is allowed.

Parameters:
reorderingAllowed - allows column reordering

setResizingAllowed

public final void setResizingAllowed(boolean resizingAllowed)
Define if column resizing is allowed.

Parameters:
resizingAllowed - allows column resizing

setMode

public final void setMode(int mode)
Set grid mode.

Parameters:
mode - grid mode; possibile values: READONLY, INSERT, EDIT

setSelectionMode

public final void setSelectionMode(int selectionMode)
Set grid selection mode.

Parameters:
selectionMode - grid selection mode

transferFocus

public final void transferFocus()
Remove cell editing, if needed.


clearData

public final void clearData()
Clear grid content.


reloadDataFromStart

public final void reloadDataFromStart()
Method called from reload method: reload current data block. Data Loading is executed in a separated thread. After data loading, the old selected row is selected again. Method called from reload method: reload current data block. Data Loading is executed in a separated thread.


setFunctionId

public final void setFunctionId(java.lang.String functionId)
Set the functionId identifier, associated to the container

Parameters:
functionId - identifier associated to the container

setNavBar

public final void setNavBar(NavigatorBar navBar)
Set navigation bar.

Parameters:
navBar - navigation bar

getOtherGridParams

public final java.util.Map getOtherGridParams()
Returns:
other grid parameters

setOtherGridParams

public final void setOtherGridParams(java.util.Map otherGridParams)
Set other grid parameters.

Parameters:
otherGridParams - other grid parameters

setMaxSortedColumns

public final void setMaxSortedColumns(int maxSortedColumns)
Set maximum number of sorted columns.

Parameters:
maxSortedColumns - maximum number of sorted columns

getMaxSortedColumns

public final int getMaxSortedColumns()
Returns:
maximum number of sorted columns

getVOListTableModel

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

getMode

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

modeChanged

public final void modeChanged(int mode)
Method called on changing grid mode.

Specified by:
modeChanged in interface VOListTableModelListener
Parameters:
mode - current edit grid mode; possible values: READONLY, EDIT,INSERT

isFieldEditable

public final boolean isFieldEditable(int rowNumber,
                                     java.lang.String attributeName)
Parameters:
rowNumber - TableModel row index
attributeName - attribute name that identifies a grid column
Returns:
true means that the cell having the specified row and column index is editable, false otherwise

getFunctionId

public final java.lang.String getFunctionId()
Specified by:
getFunctionId in interface DataController
Returns:
identifier (functionId) associated to the container

getInsertButton

public InsertButton getInsertButton()
Returns:
insert button linked to grid

getExportButton

public ExportButton getExportButton()
Returns:
export button linked to grid

getImportButton

public ImportButton getImportButton()
Returns:
import button linked to grid

getCopyButton

public CopyButton getCopyButton()
Returns:
copy button linked to grid

getEditButton

public EditButton getEditButton()
Returns:
edit button linked to grid

setEditButton

public void setEditButton(EditButton editButton)
Set edit button linked to grid.

Parameters:
editButton - edit button linked to grid

setInsertButton

public void setInsertButton(InsertButton insertButton)
Set insert button linked to grid.

Parameters:
insertButton - insert button linked to grid

setExportButton

public void setExportButton(ExportButton exportButton)
Set export button linked to grid.

Parameters:
exportButton - export button linked to grid

setImportButton

public void setImportButton(ImportButton importButton)
Set import button linked to grid.

Parameters:
importButton - import button linked to grid

setCopyButton

public void setCopyButton(CopyButton copyButton)
Set copy button linked to grid.

Parameters:
copyButton - copy button linked to grid

setFilterButton

public void setFilterButton(FilterButton filterButton)
Set filter button linked to grid.

Parameters:
filterButton - filter button linked to grid

getFilterButton

public FilterButton getFilterButton()
Returns:
filter button linked to grid

getReloadButton

public ReloadButton getReloadButton()
Returns:
reload button linked to grid

setReloadButton

public void setReloadButton(ReloadButton reloadButton)
Set reload button linked to grid.

Parameters:
reloadButton - reload button linked to grid

getDeleteButton

public DeleteButton getDeleteButton()
Returns:
delete button linked to grid.

setDeleteButton

public void setDeleteButton(DeleteButton deleteButton)
Set delete button linked to grid.

Parameters:
deleteButton - delete button linked to grid

getSaveButton

public SaveButton getSaveButton()
Returns:
save button linked to grid.

setSaveButton

public void setSaveButton(SaveButton saveButton)
Set save button linked to grid.

Parameters:
saveButton - save button linked to grid

addGenericButton

public final void addGenericButton(GenericButton button)
Add an optional button.

Parameters:
button - generic button

removeGenericButton

public final void removeGenericButton(GenericButton button)
Remove an optional button.

Parameters:
button - generic button

getNavBar

public final NavigatorBar getNavBar()
Returns:
navigation bar (optional)

firstRow

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

Specified by:
firstRow in interface NavigatorBarController

nextRow

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

Specified by:
nextRow in interface NavigatorBarController

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.

Specified by:
previousPage in interface NavigatorBarController

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.

Specified by:
nextPage in interface NavigatorBarController

previousRow

public final void previousRow(NavigatorBar navBar,
                              java.awt.event.ActionEvent e)
Method called when user click on "previous" button on the navigation bar: it may clear table model, reload previous data block and select the last row of the block. This operations are executed in a separated thread.

Specified by:
previousRow in interface NavigatorBarController

lastRow

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

Specified by:
lastRow in interface NavigatorBarController

reload

public final void reload()
Method called by reload button: - sets READONLY mode - reloads TableModel, by calling executeReload method

Specified by:
reload in interface DataController

executeReload

public boolean executeReload()
Reload TableModel.


loadPage

public final void loadPage(int pageNr)
Method invoked by NavigatorBar to change page to load.

Specified by:
loadPage in interface NavigatorBarController
Parameters:
pageNr - pabe number to load

insert

public final void insert()
Method called when user clicks on insert button.

Specified by:
insert in interface DataController

export

public final void export()
Method called when user clicks on export button.

Specified by:
export in interface DataController

importData

public final void importData()
Method called when user clicks on import button.

Specified by:
importData in interface DataController

filterSort

public final void filterSort()
Method called when user has clicked on filter button.

Specified by:
filterSort in interface DataController

getDefaultGridExportOptions

public final GridExportOptions getDefaultGridExportOptions()
Returns:
GridExportOptions object created, starting from current visible columns

getDefaultGridExportOptions

public final GridExportOptions getDefaultGridExportOptions(java.util.HashSet attributesToExport)
Parameters:
attributesToExport - attributes to export
Returns:
GridExportOptions object created, starting from specified attributes to export

export

public final void export(java.util.ArrayList exportColumns,
                         java.util.ArrayList exportAttrColumns,
                         java.lang.String exportType)
Method called by ExportDialog to export data.

Parameters:
exportColumns - column identifiers related to columns to export
exportAttrColumns - attribute names related to the columns to export

importData

public final void importData(java.util.ArrayList columnTypes,
                             java.util.ArrayList importAttrColumns,
                             java.lang.String importType)
Method called by ImportDialog to import data.

Parameters:
columnTypes - column types
importAttrColumns - attribute names related to the columns to import

copy

public final void copy()
Method called when user clicks on copy button.

Specified by:
copy in interface DataController

edit

public final void edit()
Method called when user clicks on edit button.

Specified by:
edit in interface DataController

delete

public final void delete()
Method called when user clicks on delete button.

Specified by:
delete in interface DataController

save

public final boolean save()
Method called when user clicks on save button.

Specified by:
save in interface DataController
Returns:
true if saving operation was correctly completed, false otherwise

addNotify

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


getQuickFilterValues

public java.util.Map getQuickFilterValues()

getRemovefilterItem

public javax.swing.JMenuItem getRemovefilterItem()

getPopup

public javax.swing.JPopupMenu getPopup()

getFilterPanel

public QuickFilterPanel getFilterPanel()

isMoreRows

public boolean isMoreRows()

getLastIndex

public int getLastIndex()

getCurrentSortedColumns

public final java.util.ArrayList getCurrentSortedColumns()
Returns:
current sorted columns

getCurrentSortedVersusColumns

public final java.util.ArrayList getCurrentSortedVersusColumns()
Returns:
current sorted columns versus (Ascending/Descending)

setFilterPanel

public void setFilterPanel(QuickFilterPanel filterPanel)

getPopupCommands

public java.util.ArrayList getPopupCommands()

getGenericButtons

public java.util.ArrayList getGenericButtons()

isListenEvent

public boolean isListenEvent()

setListenEvent

public void setListenEvent(boolean listenEvent)

setGenericButtonsEnabled

public void setGenericButtonsEnabled(boolean enabled)
Set (dis)abilitation for whole generic buttons. This method is automatically called when changing grid mode: generic buttons are enabled only in read only mode.

Parameters:
enabled - (dis)abilitation for whole generic buttons.

validateRows

public final boolean validateRows()
Execute a validation on changed rows.

Returns:
true if all changed rows are in a valid state, false otherwise

getGridControl

public GridControl getGridControl()

setRowSelectionInterval

public void setRowSelectionInterval(int startRow,
                                    int endRow)
Set row selection interval.

Parameters:
startRow - first selected row index
endRow - last selected row index

getGrid

public Grid getGrid()

getLockedGrid

public Grid getLockedGrid()

getSelectedRows

public int[] getSelectedRows()
Returns the indices of all selected rows.

Returns:
an array of integers containing the indices of all selected rows, or an empty array if no row is selected
See Also:
getSelectedRow()

getSelectedRow

public int getSelectedRow()

getSelectedColumn

public int getSelectedColumn()

getDefaultQuickFilterCriteria

public final int getDefaultQuickFilterCriteria()
Returns:
default value that could be set in the quick filter criteria; values allowed: Consts.EQUALS,Consts.CONTAINS,Consts.STARTS_WITH,Consts.ENDS_WITH

enableDrag

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

Parameters:
gridId - grid identifier

addButtonsNotEnabled

public final void addButtonsNotEnabled(java.util.HashSet buttons,
                                       GenericButtonController buttonController)
Define GenericButton objects linked to this that will be disabled (independently from the grid mode) when the specified attribute will be set to the specified value.

Parameters:
buttons - collections GenericButton objects linked to this that have to be disabled
buttonController - interface that defines button disabilitation, according to some custom policy

isButtonDisabled

public final boolean isButtonDisabled(GenericButton button)
Method called by GenericButton.setEnabled method to check if the button must be disabled.

Specified by:
isButtonDisabled in interface DataController
Parameters:
button - button whose abilitation must be checked
Returns:
true if no policy is defined in the grid for the specified button, false if there exists a disabilitation policy for the specified button (through addButtonsNotEnabledOnState grid method)

resetButtonsState

public final void resetButtonsState()
Method automatically called by the Grid to check buttons disabilitation.


getMaxNumberOfRowsOnInsert

public final int getMaxNumberOfRowsOnInsert()
Returns:
maximum number of rows to insert by pressing "down" key; default value: 1

setMaxNumberOfRowsOnInsert

public final void setMaxNumberOfRowsOnInsert(int maxNumberOfRowsOnInsert)
Set the maximum number of rows to insert by pressing "down" key; default value: 1.

Parameters:
maxNumberOfRowsOnInsert - maximum number of rows to insert by pressing "down" key

isAllowInsertInEdit

public final boolean isAllowInsertInEdit()
Returns:
allow insert row (using DOWN key) in edit mode too; default value: false

setAllowInsertInEdit

public final void setAllowInsertInEdit(boolean allowInsertInEdit)
Allow insert row (using DOWN key) in edit mode too; default value: false

Parameters:
allowInsertInEdit - allow insert row (using DOWN key) in edit mode too

isInsertRowsOnTop

public final boolean isInsertRowsOnTop()
Returns:
define where new rows must be added: true at the top of the grid or false at the bottom

setInsertRowsOnTop

public final void setInsertRowsOnTop(boolean insertRowsOnTop)
Define where new rows must be added: true at the top of the grid or false at the bottom; default value: true

Parameters:
insertRowsOnTop - define where new rows must be added: true at the top of the grid or false at the bottom

getCurrentNumberOfNewRows

public final int getCurrentNumberOfNewRows()
Returns:
current number of new rows

setCurrentNumberOfNewRows

public void setCurrentNumberOfNewRows(int currentNumberOfNewRows)
Set the current number of new rows.


setVisibleColumn

public final void setVisibleColumn(java.lang.String attributeName,
                                   boolean colVisible)
Show/hide a column. Do not invoke this method before grid is being visible.

Parameters:
attributeName - attribute name that identities the column

getHeaderColumnName

public final java.lang.String getHeaderColumnName(java.lang.String attributeName)
Parameters:
attributeName - attribute name related to a visible column
Returns:
header column name if the specified attribute is found; attributeName otherwise

updateColumnHeaderIcons

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


finalize

public final void finalize()

getScroll

public final javax.swing.JScrollPane getScroll()
Returns:
locked + std grid scrollpane

getstartIndex

public final int getstartIndex()
Returns:
first row index to load on grid (related to result set); -1 = no rows yet loaded

setIntercellSpacing

public void setIntercellSpacing(java.awt.Dimension spacing)
Sets the rowMargin and the columnMargin -- the height and width of the space between cells -- to intercellSpacing.

See Also:
#getIntercellSpacing

setRowMargin

public void setRowMargin(int rowMargin)
Sets the amount of empty space between cells in adjacent rows.

Parameters:
rowMargin - the number of pixels between cells in a row
See Also:
#getRowMargin

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

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

addLoadDataCompletedListener

public final void addLoadDataCompletedListener(java.awt.event.ActionListener listener)
Add a "load data completed" listener.


removeLoadDataCompletedListener

public final void removeLoadDataCompletedListener(java.awt.event.ActionListener listener)
Remove a "load data completed" listener.


getGridController

public final GridController getGridController()
Returns:
grid controller, used to listen grid events

isRowExpanded

public final boolean isRowExpanded(int row)
Parameters:
row - row number
Returns:
true if specified row is currently expanded, false otherwise

getComponentInCache

public final java.awt.Component getComponentInCache(int row)
Parameters:
row - row number
Returns:
component already cached

putComponentInCache

public final void putComponentInCache(int row,
                                      java.awt.Component comp)
Parameters:
row - row number
Returns:
component already cached

removeComponentInCache

public final void removeComponentInCache(int row)
Removce component from cache.

Parameters:
row - row number

expandRow

public final void expandRow(int row)
Expand specified row. This command will be performed only if "expandableRowController" property is setted and row is not yet expanded

Parameters:
row - row number

collapseRow

public final void collapseRow(int row)
Collapse specified row. This command will be performed only if "expandableRowController" property is setted and row is not yet collapsed

Parameters:
row - row number

getCurrentNestedComponent

public final java.awt.Component getCurrentNestedComponent()
Returns:
current nested component that is expanded and has focus

getCurrentNestedComponentRow

public final int getCurrentNestedComponentRow()
Returns:
current nested component row index

setCurrentNestedComponent

public final void setCurrentNestedComponent(int currentNestedComponentRow,
                                            java.awt.Component currentNestedComponent)
Returns:
current nested component that is expanded and has focus

isEditOnSingleRow

public final boolean isEditOnSingleRow()
Returns:
force the editing of one row only: the current selected row: false all rows are editable, true edit is allowed only on current selected row

setEditOnSingleRow

public final void setEditOnSingleRow(boolean editOnSingleRow)
Define if cell editing is allows on one row only or on all rows: false all rows are editable, true edit is allowed only on current selected row

Parameters:
editOnSingleRow - false all rows are editable, true edit is allowed only on current selected row

getCurrentEditingRow

public final int getCurrentEditingRow()
Returns:
current selected row when grid is switched to EDIT mod and "editOnSingleRow" property is set to true

getTotalResultSetLength

public final int getTotalResultSetLength()
Specified by:
getTotalResultSetLength in interface NavigatorBarController
Returns:
last record number in result set; -1 as default value

getBlockSize

public final int getBlockSize()
Specified by:
getBlockSize in interface NavigatorBarController
Returns:
block size; -1 if loading is not based on one page per time

getBindedButtons

public final java.util.HashSet getBindedButtons()
Specified by:
getBindedButtons in interface DataController
Returns:
collection of buttons binded to grid (InsertButton, EditButton, etc)

isEnableInReadOnlyMode

public final boolean isEnableInReadOnlyMode(int columnIndex)
Parameters:
columnIndex - column index, related to check-box, link button or button
Returns:
indicate if the check-box is enabled also when the grid is in readonly mode; default value: false i.e. the check-box is enabled only in INSERT/EDIT modes, according to "editableOnEdit" and "editableOnInsert" properties

cleanUp

public final void cleanUp(int row,
                          boolean cleanUpAlsoNotEditableCells)
Clean up cells content for the specified row, for each field or editable only cells. Note: this method can be invoked only in INSERT/EDIT modes.

Parameters:
cleanUpAlsoNotEditableCells - define if all cells must be clean up

retrieveAdditionalRows

public final int retrieveAdditionalRows(java.lang.String attributeName,
                                        java.lang.String textToSearch)
This method fetches and appends additional rows that satisfy specified criteria.

Parameters:
attributeName - attribute used to filter data
textToSearch - text to search
Returns:
first added row that satify specified criteria

isAnchorLockedColumnsToLeft

public final boolean isAnchorLockedColumnsToLeft()
Returns:
define where to anchor locked columns: to the left or to the right of the grid; default value: true i.e. to the left