org.openswing.swing.form.client
Class Form

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.form.client.Form
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, DataController, java.util.EventListener, GenericButtonController, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ValueChangeListener

public class Form
extends javax.swing.JPanel
implements DataController, ValueChangeListener, GenericButtonController, java.awt.event.ActionListener

Title: OpenSwing Framework

Description: Panel used to contains input controls. It can set input control values and retrieve from them the values to set the model (the value object). It can also remotely read data and set the v.o. (and the input controls).

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
Form()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Callback method invoked by the navigator bar of the grid when the user has pressed a button on it.
 void addButtonsNotEnabled(java.util.HashSet buttons, GenericButtonController buttonController)
          Define GenericButton objects linked to this that will be disabled (independently from the form mode) when the specified attribute will be set to the specified value.
 void addGenericButton(GenericButton b)
          Add a generic button, that inherits abilitation state of the other form buttons.
 void addInputControlAttributesNotEditableOnState(java.util.HashSet attributeNames, java.lang.String stateAttributeName, java.lang.Object state)
          Define input controls attribute names that will be disabled (independently from enabledOnInsert/Edit settings) when the specified attribute will be set to the specified value.
 void addLinkButton(LinkButton b)
          Add a link button, that inherits abilitation state of the other form buttons.
 void addLinkedPanel(java.awt.Container c)
          Add a linked panel, that will receive the same events of this form (in pull/store operations).
 void addNotify()
          Method overridden to initialize input controls.
 void bind(InputControl comp)
          Create a binding between the specified input control and this data model
 void cleanUp()
          Clean up fields content.
 void cleanUp(boolean cleanUpAlsoNotEditableFields)
          Clean up fields content, for each field or editable only fields.
 boolean containsLinkedPanel(java.awt.Container c)
           
 void copy()
          Method called by copy button.
 void delete()
          Method called by delete button.
 void dropFocusFromForm()
          Remove focus from current form.
 void edit()
          Method called by edit button.
 void executeReload()
          This method is called by reload method to reload data.
 void export()
          Method called when user has clicked on export button: not supported.
 void filterSort()
          Method called when used has clicked on filter button: not supported.
 void finalize()
           
 java.util.HashSet getBindedButtons()
           
 CopyButton getCopyButton()
           
 boolean getCurrentValue(GenericButton button)
           
 DeleteButton getDeleteButton()
           
 EditButton getEditButton()
           
 FormController getFormController()
           
 java.lang.String getFunctionId()
           
 java.util.ArrayList getInputControlsNotValid()
           
 InsertButton getInsertButton()
           
 java.util.Set getLazyInitializedAttributes()
           
 int getMode()
           
 javax.swing.border.Border getNotFocusedBorder()
           
 ReloadButton getReloadButton()
           
 int getRowIndexInGrid()
           
 SaveButton getSaveButton()
           
 java.lang.String getVOClassName()
           
 VOModel getVOModel()
           
 void importData()
          Method called when user has clicked on import button: not supported.
 void insert()
          Method called by insert button.
 boolean isButtonDisabled(GenericButton button)
          Method called by GenericButton.setEnabled method to check if the button must be disabled.
 boolean isChanged()
           
 boolean isCreateInnerVO()
           
 boolean isCurrentFormHasFocus()
           
 void linkGrid(GridControl grid, java.util.HashSet pkAttributes, boolean reloadModelWhenSelectingOnGrid)
          Link the specified grid control to the current Form, so that: - row selection event (fired by grid navigator bar) will force the Form data loading (ONLY IF loadModelWhenSelectingOnGrid is set to true) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values.
 void linkGrid(GridControl grid, java.util.HashSet pkAttributes, boolean reloadModelWhenSelectingOnGrid, boolean reloadModelWhenClickingWithMouse, boolean reloadModelWhenPressingKey, NavigatorBar navBar)
          Link the specified grid control to the current Form, so that: - grid navigator bar event (i.e. pressing one of its buttons) on grid will force the Form data loading (e.g. when using grid navigator bar) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values.
 void linkGrid(GridControl grid, java.util.HashSet pkAttributes, boolean reloadModelWhenSelectingOnGrid, NavigatorBar navBar)
          Link the specified grid control to the current Form, so that: - grid navigator bar event (i.e. pressing one of its buttons) on grid will force the Form data loading (e.g. when using grid navigator bar) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values.
 boolean pull()
          Set the content for each linked input control, based on value object content.
 boolean pull(java.lang.String attributeName)
          Set the content for the specified linked input control, based on value object content.
 boolean push()
          If all input controls linked to the form are in a valid state, then push each value to its associated data model.
 void reload()
          Method called by refresh/cancel button.
 void removeGenericButton(GenericButton b)
          Remove a generic button, that inherits abilitation state of the other form buttons.
 void removeLinkButton(LinkButton b)
          Remove a link button, that inherits abilitation state of the other form buttons.
 void removeLinkedPanel(java.awt.Container c)
          Remove an added linked panel.
 void requestFocus()
           
 void resetButtonsState()
          Method automatically called by the Form to check buttons disabilitation.
 boolean save()
          Method called by save button.
 void setCopyButton(CopyButton copyButton)
          Set copy button linked to this form.
 void setCreateInnerVO(boolean createInnerVO)
          Define if an inner v.o. must be automatically instantiated when a setter method is invoked.
 void setCurrentValue(GenericButton button, boolean currentValue)
          Set current enabled value of button.
 void setDeleteButton(DeleteButton deleteButton)
          Set delete button linked to this form.
 void setEditButton(EditButton editButton)
          Set edit button linked to this form.
 void setFocusOnForm()
          Set focus on current form.
 void setFormController(FormController formController)
          Set form controller.
 void setFunctionId(java.lang.String functionId)
          Set the functionId identifier, associated to the container
 void setInsertButton(InsertButton insertButton)
          Set insert button linked to this form.
 void setMode(int mode)
          Set current form mode and consequently the input controls editing state.
 void setReloadButton(ReloadButton reloadButton)
          Set refresh/cancel button linked to this form.
 void setSaveButton(SaveButton saveButton)
          Set save button linked to this form.
 void setVOClassName(java.lang.String voClassName)
          Set data model to link to the form.
 void unbind(InputControl comp)
          Remove an existing binding between the specified input control and this data model
 void valueChanged(ValueChangeEvent e)
          Invoked when the value of a linked input control changes.
 
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, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form()
Method Detail

getLazyInitializedAttributes

public final java.util.Set getLazyInitializedAttributes()
Returns:
collection of attributes to not manage because they are related to lazy initialized inner objects

isCurrentFormHasFocus

public final boolean isCurrentFormHasFocus()
Returns:
define if this Form panel currently has focus (used to listen for acceleration keys events to dispatch to toolbar buttons of the form)

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 for the specified button

finalize

public final void finalize()

requestFocus

public final void requestFocus()

setFocusOnForm

public final void setFocusOnForm()
Set focus on current form.


dropFocusFromForm

public final void dropFocusFromForm()
Remove focus from current form.


addNotify

public final void addNotify()
Method overridden to initialize input controls.


getInsertButton

public final InsertButton getInsertButton()
Returns:
insert button

getCopyButton

public final CopyButton getCopyButton()
Returns:
copy button

getEditButton

public final EditButton getEditButton()
Returns:
edit button

setEditButton

public final void setEditButton(EditButton editButton)
Set edit button linked to this form.

Parameters:
editButton - edit button

setInsertButton

public final void setInsertButton(InsertButton insertButton)
Set insert button linked to this form.

Parameters:
insertButton - insert button

setCopyButton

public final void setCopyButton(CopyButton copyButton)
Set copy button linked to this form.

Parameters:
copyButton - insert button

getReloadButton

public final ReloadButton getReloadButton()
Returns:
refresh/cancel button

setReloadButton

public final void setReloadButton(ReloadButton reloadButton)
Set refresh/cancel button linked to this form. It allows to cancel insert/edit operation and reloads the previous data in the form and set it in READONLY mode.


getDeleteButton

public final DeleteButton getDeleteButton()
Returns:
delete button

setDeleteButton

public final void setDeleteButton(DeleteButton deleteButton)
Set delete button linked to this form.

Parameters:
deleteButton - delete button

getSaveButton

public final SaveButton getSaveButton()
Returns:
save button

setSaveButton

public final void setSaveButton(SaveButton saveButton)
Set save button linked to this form. It allows to create an insert/edit sql instruction

Parameters:
saveButton - save button

setMode

public final void setMode(int mode)
Set current form mode and consequently the input controls editing state.

Parameters:
mode - form mode; possible values: READONLY, INSERT, EDIT

isChanged

public final boolean isChanged()
Returns:
true if there exists at least one input control that has been changed, false otherwise

addInputControlAttributesNotEditableOnState

public final void addInputControlAttributesNotEditableOnState(java.util.HashSet attributeNames,
                                                              java.lang.String stateAttributeName,
                                                              java.lang.Object state)
Define input controls attribute names that will be disabled (independently from enabledOnInsert/Edit settings) when the specified attribute will be set to the specified value.

Parameters:
attributeNames - collections of attribute names related to input controls to disable
stateAttributeName - attribute name in the form value object to test
state - attribute value in the form value object to test: if the value is this one, then input controls will be disabled (in INSERT/EDIT modes)

addButtonsNotEnabled

public final void addButtonsNotEnabled(java.util.HashSet buttons,
                                       GenericButtonController buttonController)
Define GenericButton objects linked to this that will be disabled (independently from the form 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 form for the specified button, false if there exists a disabilitation policy for the specified button (through addButtonsNotEnabledOnState form method)

resetButtonsState

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


getMode

public final int getMode()
Returns:
current form mode

reload

public final void reload()
Method called by refresh/cancel button.

Specified by:
reload in interface DataController

executeReload

public final void executeReload()
This method is called by reload method to reload data. Developer can explicity call this method to force data model reloading.


insert

public final void insert()
Method called by insert button.

Specified by:
insert in interface DataController

copy

public final void copy()
Method called by copy button.

Specified by:
copy in interface DataController

edit

public final void edit()
Method called by edit button.

Specified by:
edit in interface DataController

delete

public final void delete()
Method called by delete button.

Specified by:
delete in interface DataController

getInputControlsNotValid

public final java.util.ArrayList getInputControlsNotValid()
Returns:
boolean value indicating whether or not all fields in this form have a valid state i.e. if an input control is mandatory and has a null value then is not in a valid state

push

public final boolean push()
If all input controls linked to the form are in a valid state, then push each value to its associated data model.

Returns:
boolean indicating whether or not the input control values were successfully pushed to the data model

pull

public final boolean pull()
Set the content for each linked input control, based on value object content.

Returns:
boolean indicating whether or not the input controls are all correctly setted

pull

public final boolean pull(java.lang.String attributeName)
Set the content for the specified linked input control, based on value object content.

Returns:
boolean indicating whether or not the input control has been correctly setted, according to the specified attribute name

save

public final boolean save()
Method called by save button. If an error occours while saving data, an error message is showed.

Specified by:
save in interface DataController
Returns:
true if data saving is successfully completed, false if an error occours

getFormController

public final FormController getFormController()
Returns:
form controller

setFormController

public final void setFormController(FormController formController)
Set form controller.

Parameters:
formController - form controller

getVOClassName

public final java.lang.String getVOClassName()
Returns:
data model linked to the form

setVOClassName

public final void setVOClassName(java.lang.String voClassName)
Set data model to link to the form.


getVOModel

public final VOModel getVOModel()
Returns:
model associated to this Form panel

removeLinkedPanel

public final void removeLinkedPanel(java.awt.Container c)
Remove an added linked panel.


addLinkedPanel

public final void addLinkedPanel(java.awt.Container c)
Add a linked panel, that will receive the same events of this form (in pull/store operations).

Parameters:
c - container to link

containsLinkedPanel

public final boolean containsLinkedPanel(java.awt.Container c)
Parameters:
c - panel to check
Returns:
true if "panel" is a linked panel, false otherwise

cleanUp

public final void cleanUp()
Clean up fields content. Note: this method can be invoked only in INSERT/EDIT modes.


cleanUp

public final void cleanUp(boolean cleanUpAlsoNotEditableFields)
Clean up fields content, for each field or editable only fields. Note: this method can be invoked only in INSERT/EDIT modes.

Parameters:
cleanUpAlsoNotEditableFields - define if all fields must be clean up

bind

public final void bind(InputControl comp)
                throws java.lang.Exception
Create a binding between the specified input control and this data model

Parameters:
comp - input control
Throws:
java.lang.Exception - if an error occours

unbind

public final void unbind(InputControl comp)
                  throws java.lang.Exception
Remove an existing binding between the specified input control and this data model

Parameters:
comp - input control to unbind
Throws:
java.lang.Exception - if an error occours

valueChanged

public final void valueChanged(ValueChangeEvent e)
Invoked when the value of a linked input control changes.

Specified by:
valueChanged in interface ValueChangeListener
Parameters:
e - ValueChangeEvent describing the event

export

public final void export()
Method called when user has clicked on export button: not supported.

Specified by:
export in interface DataController

importData

public final void importData()
Method called when user has clicked on import button: not supported.

Specified by:
importData in interface DataController

filterSort

public void filterSort()
Method called when used has clicked on filter button: not supported.

Specified by:
filterSort in interface DataController

setFunctionId

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

Parameters:
functionId - identifier associated to the container

getFunctionId

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

getNotFocusedBorder

public final javax.swing.border.Border getNotFocusedBorder()
Returns:
not focused border

addGenericButton

public final void addGenericButton(GenericButton b)
Add a generic button, that inherits abilitation state of the other form buttons.

Parameters:
b - generic button, that inherits abilitation state of the other form buttons

removeGenericButton

public final void removeGenericButton(GenericButton b)
Remove a generic button, that inherits abilitation state of the other form buttons.

Parameters:
b - generic button, that inherits abilitation state of the other form buttons

addLinkButton

public final void addLinkButton(LinkButton b)
Add a link button, that inherits abilitation state of the other form buttons.

Parameters:
b - link button, that inherits abilitation state of the other form buttons

removeLinkButton

public final void removeLinkButton(LinkButton b)
Remove a link button, that inherits abilitation state of the other form buttons.

Parameters:
b - link button, that inherits abilitation state of the other form buttons

linkGrid

public final void linkGrid(GridControl grid,
                           java.util.HashSet pkAttributes,
                           boolean reloadModelWhenSelectingOnGrid)
Link the specified grid control to the current Form, so that: - row selection event (fired by grid navigator bar) will force the Form data loading (ONLY IF loadModelWhenSelectingOnGrid is set to true) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values. NOTE: "reloadModelWhenSelectingOnGrid" is set to true then Form data reloading is performed also when clicking with the left mouse button onto the grid and when pressing up/down keys onto the grid.

Parameters:
grid - grid control linked to the current Form, to update grid content
pkAttributes - attributes that must be defined both on grid v.o. and on the Form v.o. used to select on grid the (first) row that matches pk values; if the grid v.o. is the same class or a super-class of Form v.o. then this HashSet could
reloadModelWhenSelectingOnGrid - true to force data Form reloading when changing row selection on grid by grid navigator bar

linkGrid

public final void linkGrid(GridControl grid,
                           java.util.HashSet pkAttributes,
                           boolean reloadModelWhenSelectingOnGrid,
                           NavigatorBar navBar)
Link the specified grid control to the current Form, so that: - grid navigator bar event (i.e. pressing one of its buttons) on grid will force the Form data loading (e.g. when using grid navigator bar) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values. NOTE: if more than one Form has been opened, then all Forms will be reloaded to the same row when a grid navigator button is being pressed. In addition, Form data loading is automatically performed when using the specified navigator bar; also grid selection row is updated. NOTE: "reloadModelWhenSelectingOnGrid" is set to true then Form data reloading is performed also when clicking with the left mouse button onto the grid and when pressing up/down keys onto the grid.

Parameters:
grid - grid control linked to the current Form, to update grid content
pkAttributes - attributes that must be defined both on grid v.o. and on the Form v.o. used to select on grid the (first) row that matches pk values; if the grid v.o. is the same class or a super-class of Form v.o. then this HashSet could
reloadModelWhenSelectingOnGrid - true to force data Form reloading when changing row selection on grid by grid navigator bar
navBar - navigation bar linked to the current Form, used to load data on Form according to the selected row on grid, whose selection has been changed when using this navigator bar

linkGrid

public final void linkGrid(GridControl grid,
                           java.util.HashSet pkAttributes,
                           boolean reloadModelWhenSelectingOnGrid,
                           boolean reloadModelWhenClickingWithMouse,
                           boolean reloadModelWhenPressingKey,
                           NavigatorBar navBar)
Link the specified grid control to the current Form, so that: - grid navigator bar event (i.e. pressing one of its buttons) on grid will force the Form data loading (e.g. when using grid navigator bar) - insert new data on the Form will refresh grid by adding a new row - update data on Form will refresh grid for the related changed row - delete existing data on the Form will refresh grid content by removing the related row To correctly identify the row on grid to change a matching beetween attributes (specified in "pkAttributes" argument) of grid v.o. and Form v.o. is performed: it will be identified the first row on grid that matches this filter criteria, based on attribute values. NOTE: if more than one Form has been opened, then all Forms will be reloaded to the same row when a grid navigator button is being pressed. In addition, Form data loading is automatically performed when using the specified navigator bar; also grid selection row is updated.

Parameters:
grid - grid control linked to the current Form, to update grid content
pkAttributes - attributes that must be defined both on grid v.o. and on the Form v.o. used to select on grid the (first) row that matches pk values; if the grid v.o. is the same class or a super-class of Form v.o. then this HashSet could
reloadModelWhenSelectingOnGrid - true to force data Form reloading when changing row selection on grid by grid navigator bar
reloadModelWhenClickingWithMouse - true to enable Form data reloading when clicking with the left mouse button onto the grid
reloadModelWhenPressingKey - true to enable Form data reloading when pressing up/down keys onto the grid
navBar - navigation bar linked to the current Form, used to load data on Form according to the selected row on grid, whose selection has been changed when using this navigator bar

getRowIndexInGrid

public final int getRowIndexInGrid()
Returns:
row index in grid related to the linked grid's v.o. having the same pk of the current Form v.o.; -1 if that row does not exist in grid or when the grid has not been linked to this Form (see linkGrid method))

actionPerformed

public final void actionPerformed(java.awt.event.ActionEvent e)
Callback method invoked by the navigator bar of the grid when the user has pressed a button on it.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

isCreateInnerVO

public final boolean isCreateInnerVO()
Returns:
define if an inner v.o. must be automatically instantiated when a setter method is invoked

setCreateInnerVO

public final void setCreateInnerVO(boolean createInnerVO)
Define if an inner v.o. must be automatically instantiated when a setter method is invoked.

Parameters:
createInnerVO - define if an inner v.o. must be automatically instantiated when a setter method is invoked

getBindedButtons

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