Ontimize 5.2071EN

com.ontimize.gui
Class BasicInteractionManager

java.lang.Object
  extended bycom.ontimize.gui.InteractionManager
      extended bycom.ontimize.gui.BasicInteractionManager
All Implemented Interfaces:
DataNavigationListener, java.util.EventListener, Freeable, ValueChangeListener
Direct Known Subclasses:
TableBasicInteractionManager

public class BasicInteractionManager
extends InteractionManager

BasicInteractionManager is the class that manages the Form instances, extending the default behavior provided by the InteractionManager class. The BasicInteractionManager manages the events related to the default buttons, that is, the query, insert, delete and update buttons. The keys of these buttons must be the following ones:


Nested Class Summary
 class BasicInteractionManager.AvancedQueryListener
          Class that implements the listener to the standard feature AdvancedQuery.
 class BasicInteractionManager.DeleteListener
          This class implements the delete button default behavior.
 class BasicInteractionManager.InsertListener
          Default insertion listener.
 class BasicInteractionManager.QueryListener
          Query button default listener.
 class BasicInteractionManager.UpdateListener
          Update button default listener.
 
Nested classes inherited from class com.ontimize.gui.InteractionManager
InteractionManager.DeleteFieldsListener, InteractionManager.InteractionManagerAction, InteractionManager.PrintingThread
 
Field Summary
protected  boolean addColumnsToTableView
           
protected  boolean afterUpdate
           
protected  java.util.Vector attributes
           
protected  java.util.Hashtable attributesValues
           
static boolean AVANCED_QUERY_DEFAULT_VALUE
          The advanced query mode.
 BasicInteractionManager.AvancedQueryListener avancedQueryListener
           
static boolean CLOSE_DETAIL_FORM_AFTER_INSERT_DEFAULT_VALUE
          When true, closes the detail form after performing an insertion.
protected  boolean closeDetailFormAfterInsert
           
static boolean CONFIRM_DELETE_DEFAULT_VALUE
          When true, shows a message prior performing any deletion.
static java.lang.String defaultInteractionScriptManagerClassName
           
static boolean defaultScriptEnabled
           
 BasicInteractionManager.DeleteListener deleteListener
           
protected  boolean detailForm
           
protected  QueryExpression expression
           
protected  java.awt.Window formAncestor
           
protected  IFormInteractionScriptManager formInteractionScriptManager
           
 BasicInteractionManager.InsertListener insertListener
           
protected  java.util.Hashtable keysValues
           
protected  java.util.Hashtable keysValuesLastQuery
           
static java.lang.String M_DELETE_CONFIRM
           
static java.lang.String M_FILL_ALL_REQUIRED_FIELDS
           
static java.lang.String M_MODIFIED_DATA_APPLY_CHANGES
           
static java.lang.String M_UPDATE_CONFIRM
           
 BasicInteractionManager.QueryListener queryListener
           
static java.lang.String S_CORRECT_DELETE
           
static java.lang.String S_CORRECT_INSERT
           
static java.lang.String S_CORRECT_UPDATE
           
static java.lang.String S_INCORRECT_DELETE
           
static java.lang.String S_INCORRECT_INSERT
           
static java.lang.String S_INCORRECT_UPDATE
           
protected  boolean scriptEnabled
           
protected  boolean searchBetweenResults
           
protected  boolean showDeleteConfirmMessage
          Makes the InteractionManager to show a message prior performing the deletion, asking to the user to do so.
protected  boolean stayInRecordAfterInsert
           
 BasicInteractionManager.UpdateListener updateListener
           
 
Fields inherited from class com.ontimize.gui.InteractionManager
actionHandler, ADVANCED_QUERY_KEY, CHECK_MODIFIED_DATA_CHANGED_DEFAULT_VALUE, checkModifiedDataChangeEvent, client, currentMode, dataChangedEventProcessing, DEBUG, DELETE_KEY, deleteFieldsListener, f11Button, f12Button, f7Button, f9Button, formManager, HELP_KEY, INSERT, INSERT_KEY, interactionManagerModeListenerList, managedForm, modifiedFieldAttributes, NEWMODE, printThread, QUERY, QUERY_INSERT_KEY, QUERY_KEY, QUERYINSERT, selectionPrintingKey, setDefaultFocusEnabled, UPDATE, UPDATE_ALL, UPDATE_CHANGED, UPDATE_KEY, updateMethod, valueChangedListenerAttributes, valueChangeListenerEnabled, warningBirthdayMessage
 
Constructor Summary
  BasicInteractionManager()
          Constructs a BasicInterationManager.
  BasicInteractionManager(boolean update)
          Constructs a BasicInterationManager.
protected BasicInteractionManager(boolean update, boolean detailForm)
          Constructs a BasicInteractionManager.
 
Method Summary
 boolean checkDelete()
          Performs basic checks in order to process the delete order.
 boolean checkInsert()
          Performs basic checks in order to process the insert order.
 boolean checkQuery()
          Performs the logical checks prior to execute the query action.
 boolean checkSearchInResults()
          Sets the right values to the keysValues vector and also to the attributes one, getting those values from the managed form.
 boolean checkUpdate()
          Checks whether an update can be done or no.
 InteractionManager cloneInteractionManager()
          Clones this InteractionManager.
protected  void createScriptManager(Form form)
           
 boolean dataWillChange(DataNavigationEvent e)
          Method invoked when the register shown in the form is going to change.
protected  void ensureComponentVisible(java.awt.Component component)
          Ensure that the component is visible in the form, if the component is in a Tab or CollapsiblePanel or SplitPane
 void free()
          Removes all the references that this InteractionManager has in order to free the memory.
protected  java.util.List getAncestorsTo(java.awt.Component component, java.lang.Class parentClass)
           
protected  java.util.Hashtable getAttributesValuesUpdateForm()
          Returns the attributes and the values that changed in the form to perform the update.
protected  java.lang.String getEmptyRequiredFieldsMessage(java.util.Vector emptyFields)
          Create the message to show when you are trying to insert or update a record with empty required fields.
 IFormInteractionScriptManager getFormInteractionScriptManager()
           
protected  java.util.Hashtable getFormKeyValues()
          Returns the form keys and its values, to identify the record.
protected  java.util.Hashtable getInsertAttributesValues()
          Returns all the attributes that will be inserted and the values that will be inserted in that attributes.
protected  java.util.Vector getQueryAttributes()
          Returns the attributes that must be queried.
 boolean isScriptEnabled()
           
 void print()
          Method that responds to the print button keystroke.
protected  EntityResult query(java.util.Hashtable keysValues, java.util.Vector attributes)
          Performs a query to the entity configured in the managed form.
 void registerInteractionManager(Form form, FormManager formManager)
          Registers the basic listener for the basic operations that can be performed by an interaction manager.
 void removeDeleteListener()
          Removes the listener associated to the Delete button.
 void removeInsertListener()
          Removes the listener associated to the Insert button.
 void removeQueryListener()
          Removes the listener associated to the Query button.
 void removeUpdateListener()
          Removes the listener associated to the Update button.
protected  void requestFocusForEmptyRequiredComponent(java.util.Vector emptyRequiredDataField)
          Request the focus for the first element in the list and ensures that this component is visible in the form
protected  void setDetailForm(boolean f)
           
 void setInitialState()
          Establishes the initial state of the managed form, and sets the form states in QueryInsert mode that implies that by default the query button and the insert button will be enables.
 void setInsertMode()
          Sets the mode of the form in Insert.
 void setQueryInsertMode()
          Sets the mode of the form in QueryInsert.
 void setQueryMode()
          Sets the mode of the form in Query.
 void setShowDeleteConfirmMessage(boolean show)
          Configures the confirm message before performing operations.
 void setStayInRecordAfterInsert(boolean stayInRecordAfterInsert)
          This method determines whether the form will remain in a record after being inserted, to check the new record information, or it will be remain in insert mode to make another insertion.
 void setUpdateMode()
          Sets the mode of the form in Update.
 
Methods inherited from class com.ontimize.gui.InteractionManager
addInteractionManagerModeListener, checkBirthday, dataChanged, finalize, fireInteractionManagerModeChanged, getActionHandler, getCheckModifiedDataChangeEvent, getCurrentMode, getDataChangedEventProcessing, getDefaultActiveFocus, getFieldValues, getImageValues, getModifiedFieldAttributes, getTableValues, getTemplateFields, getTemplateImages, getTemplateTables, isValueChangeListenerEnabled, loadActionHandler, registerFormKeyBindings, removeInteractionManagerModeListener, setCheckModifiedDataChangeEvent, setDataChangedEventProcessing, setDefaultFocusEnabled, setUpdateMethodVersion, setValueChangedEventListener, setValueChangeEventListenerEnabled, setWarningBirthdayMessage, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_CORRECT_INSERT

public static final java.lang.String S_CORRECT_INSERT
See Also:
Constant Field Values

S_INCORRECT_INSERT

public static final java.lang.String S_INCORRECT_INSERT
See Also:
Constant Field Values

S_CORRECT_UPDATE

public static final java.lang.String S_CORRECT_UPDATE
See Also:
Constant Field Values

S_INCORRECT_UPDATE

public static final java.lang.String S_INCORRECT_UPDATE
See Also:
Constant Field Values

S_CORRECT_DELETE

public static final java.lang.String S_CORRECT_DELETE
See Also:
Constant Field Values

S_INCORRECT_DELETE

public static final java.lang.String S_INCORRECT_DELETE
See Also:
Constant Field Values

M_DELETE_CONFIRM

public static final java.lang.String M_DELETE_CONFIRM
See Also:
Constant Field Values

M_UPDATE_CONFIRM

public static final java.lang.String M_UPDATE_CONFIRM
See Also:
Constant Field Values

M_FILL_ALL_REQUIRED_FIELDS

public static final java.lang.String M_FILL_ALL_REQUIRED_FIELDS
See Also:
Constant Field Values

M_MODIFIED_DATA_APPLY_CHANGES

public static java.lang.String M_MODIFIED_DATA_APPLY_CHANGES

CONFIRM_DELETE_DEFAULT_VALUE

public static boolean CONFIRM_DELETE_DEFAULT_VALUE
When true, shows a message prior performing any deletion.


AVANCED_QUERY_DEFAULT_VALUE

public static boolean AVANCED_QUERY_DEFAULT_VALUE
The advanced query mode.


defaultScriptEnabled

public static boolean defaultScriptEnabled

CLOSE_DETAIL_FORM_AFTER_INSERT_DEFAULT_VALUE

public static boolean CLOSE_DETAIL_FORM_AFTER_INSERT_DEFAULT_VALUE
When true, closes the detail form after performing an insertion.


keysValuesLastQuery

protected java.util.Hashtable keysValuesLastQuery

keysValues

protected java.util.Hashtable keysValues

expression

protected QueryExpression expression

attributesValues

protected java.util.Hashtable attributesValues

attributes

protected java.util.Vector attributes

detailForm

protected boolean detailForm

afterUpdate

protected boolean afterUpdate

showDeleteConfirmMessage

protected boolean showDeleteConfirmMessage
Makes the InteractionManager to show a message prior performing the deletion, asking to the user to do so.


searchBetweenResults

protected boolean searchBetweenResults

queryListener

public BasicInteractionManager.QueryListener queryListener

avancedQueryListener

public BasicInteractionManager.AvancedQueryListener avancedQueryListener

insertListener

public BasicInteractionManager.InsertListener insertListener

updateListener

public BasicInteractionManager.UpdateListener updateListener

deleteListener

public BasicInteractionManager.DeleteListener deleteListener

formAncestor

protected java.awt.Window formAncestor

stayInRecordAfterInsert

protected boolean stayInRecordAfterInsert

closeDetailFormAfterInsert

protected boolean closeDetailFormAfterInsert

addColumnsToTableView

protected boolean addColumnsToTableView

scriptEnabled

protected boolean scriptEnabled

formInteractionScriptManager

protected IFormInteractionScriptManager formInteractionScriptManager

defaultInteractionScriptManagerClassName

public static java.lang.String defaultInteractionScriptManagerClassName
Constructor Detail

BasicInteractionManager

public BasicInteractionManager()
Constructs a BasicInterationManager. By default sets no detailForm, what means that the InteractionManager is no related to a From arising from a Table, and also refreshing of the related trees and tables is active.


BasicInteractionManager

public BasicInteractionManager(boolean update)
Constructs a BasicInterationManager. By default sets no detailForm, what means that the InteractionManager is no related to a From arising from a Table. Can be specified whether the InteractionManager has to refresh the tree nodes and the tables or just letting the to be refreshed on their own.

Parameters:
update - false if to refresh the trees and the tables from the BasicInteractionManager is not desired

BasicInteractionManager

protected BasicInteractionManager(boolean update,
                                  boolean detailForm)
Constructs a BasicInteractionManager.

Parameters:
update - false if to refresh the trees and the tables from the BasicInteractionManager is not desired
detailForm - when true indicates that the form comes from a Table
Method Detail

setInsertMode

public void setInsertMode()
Description copied from class: InteractionManager
Sets the mode of the form in Insert. This implies to disable all the form buttons but the insert one, and to disable the tables too.

Overrides:
setInsertMode in class InteractionManager

getFormInteractionScriptManager

public IFormInteractionScriptManager getFormInteractionScriptManager()

setStayInRecordAfterInsert

public void setStayInRecordAfterInsert(boolean stayInRecordAfterInsert)
This method determines whether the form will remain in a record after being inserted, to check the new record information, or it will be remain in insert mode to make another insertion.

Parameters:
stayInRecordAfterInsert - if true, the form will show a record after its insertion

setQueryInsertMode

public void setQueryInsertMode()
Description copied from class: InteractionManager
Sets the mode of the form in QueryInsert. This implies to delete the field values and to disable all the form buttons but the insert and query ones.

Overrides:
setQueryInsertMode in class InteractionManager

setQueryMode

public void setQueryMode()
Description copied from class: InteractionManager
Sets the mode of the form in Query. This implies to disable all the form buttons but the insert one, and to disable the tables too.

Overrides:
setQueryMode in class InteractionManager

setUpdateMode

public void setUpdateMode()
Description copied from class: InteractionManager
Sets the mode of the form in Update. The fields are enabled and allows modifications. The update button is enabled.

Overrides:
setUpdateMode in class InteractionManager

checkQuery

public boolean checkQuery()
Performs the logical checks prior to execute the query action.

Returns:
- true if the query can be executed

getQueryAttributes

protected java.util.Vector getQueryAttributes()
Returns the attributes that must be queried.

Returns:
a vector with the query attributes

checkSearchInResults

public boolean checkSearchInResults()
Sets the right values to the keysValues vector and also to the attributes one, getting those values from the managed form.

Returns:
true

checkInsert

public boolean checkInsert()
Performs basic checks in order to process the insert order. This can be used to insert client logic to prevent non desired insertions, by overwriting this method.

Returns:
false if the insertion can't be done, true if it can

requestFocusForEmptyRequiredComponent

protected void requestFocusForEmptyRequiredComponent(java.util.Vector emptyRequiredDataField)
Request the focus for the first element in the list and ensures that this component is visible in the form

Parameters:
emptyRequiredDataField - List of all the empty required field names (String attr)

ensureComponentVisible

protected void ensureComponentVisible(java.awt.Component component)
Ensure that the component is visible in the form, if the component is in a Tab or CollapsiblePanel or SplitPane

Parameters:
component -

getAncestorsTo

protected java.util.List getAncestorsTo(java.awt.Component component,
                                        java.lang.Class parentClass)

checkUpdate

public boolean checkUpdate()
Checks whether an update can be done or no. This method checks that all the required fields have values. In case the update can be done, the method sets the right values to the attributes and keysValues variables from the managed form. This method must be overwritten in order to set a check that can avoid to perform the update.

Returns:
true if the update can be done, false if not

getEmptyRequiredFieldsMessage

protected java.lang.String getEmptyRequiredFieldsMessage(java.util.Vector emptyFields)
Create the message to show when you are trying to insert or update a record with empty required fields. This method create a message using the name of the fields

Parameters:
emptyFields -
Returns:

checkDelete

public boolean checkDelete()
Performs basic checks in order to process the delete order. This can be used to insert client logic to prevent non desired deletions, by overwriting this method.

This standard implementations returns always true, but can be changed calling the method setShowDeleteConfirmMessage.

Returns:
false if the deletion can't be done, true if it can

cloneInteractionManager

public InteractionManager cloneInteractionManager()
Description copied from class: InteractionManager
Clones this InteractionManager. It is used in forms that are opened from tables. This basic implementation creates the InteractionManager with Class.forName() and a no parameter constructor.

Overrides:
cloneInteractionManager in class InteractionManager
Returns:

dataWillChange

public boolean dataWillChange(DataNavigationEvent e)
Description copied from class: InteractionManager
Method invoked when the register shown in the form is going to change.

Specified by:
dataWillChange in interface DataNavigationListener
Overrides:
dataWillChange in class InteractionManager

registerInteractionManager

public void registerInteractionManager(Form form,
                                       FormManager formManager)
Registers the basic listener for the basic operations that can be performed by an interaction manager.

Overrides:
registerInteractionManager in class InteractionManager
Parameters:
form - - the form to be associated with this manager
formManager - - the form manager that rules the association

isScriptEnabled

public boolean isScriptEnabled()

createScriptManager

protected void createScriptManager(Form form)

removeDeleteListener

public void removeDeleteListener()
Removes the listener associated to the Delete button. The listener is added in the registerInteractionManager(Form, FormManager) method.


removeQueryListener

public void removeQueryListener()
Removes the listener associated to the Query button. The listener is added in the registerInteractionManager(Form, FormManager) method.


removeInsertListener

public void removeInsertListener()
Removes the listener associated to the Insert button. The listener is added in the registerInteractionManager(Form, FormManager) method.


removeUpdateListener

public void removeUpdateListener()
Removes the listener associated to the Update button. The listener is added in the registerInteractionManager(Form, FormManager) method.


free

public void free()
          throws java.lang.Exception
Description copied from class: InteractionManager
Removes all the references that this InteractionManager has in order to free the memory.

Specified by:
free in interface Freeable
Overrides:
free in class InteractionManager
Throws:
java.lang.Exception

print

public void print()
           throws java.lang.Exception
Description copied from class: InteractionManager
Method that responds to the print button keystroke.

Overrides:
print in class InteractionManager
Throws:
java.lang.Exception

setShowDeleteConfirmMessage

public void setShowDeleteConfirmMessage(boolean show)
Configures the confirm message before performing operations.

Parameters:
show - if true, a message will appear before performing operations

query

protected EntityResult query(java.util.Hashtable keysValues,
                             java.util.Vector attributes)
Performs a query to the entity configured in the managed form.

Parameters:
keysValues - the keysValues that filter the query
attributes - the attributes to query
Returns:
the result of the query

getFormKeyValues

protected java.util.Hashtable getFormKeyValues()
Returns the form keys and its values, to identify the record.

Returns:

getInsertAttributesValues

protected java.util.Hashtable getInsertAttributesValues()
Returns all the attributes that will be inserted and the values that will be inserted in that attributes.

Returns:

getAttributesValuesUpdateForm

protected java.util.Hashtable getAttributesValuesUpdateForm()
Returns the attributes and the values that changed in the form to perform the update.

Returns:
the attributes that changed and the new values

setInitialState

public void setInitialState()
Description copied from class: InteractionManager
Establishes the initial state of the managed form, and sets the form states in QueryInsert mode that implies that by default the query button and the insert button will be enables. Other buttons of the form will not be enabled by default, so they have to be activated overwriting this method.

Overrides:
setInitialState in class InteractionManager

setDetailForm

protected void setDetailForm(boolean f)

Ontimize