Ontimize 5.2072EN

com.ontimize.gui
Class InteractionManager

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

public class InteractionManager
extends java.lang.Object
implements Freeable, ValueChangeListener, DataNavigationListener

InteractionManager is the class that manages the Form basic events. The FormManager sets an InteractionManager to every Form. When a specific InteractionManager is needed, this class must be extended, and the relation between the Form to manage and the implemented Interaction Manager must be done in the way specified by the FormManager

Important

In order to make this Manager to work right, the buttons (see Button) must have the following standard keys:


Nested Class Summary
protected  class InteractionManager.DeleteFieldsListener
          Class that implements the lister to the button 'delete fields' which set a initial mode to the form (QueryInsert mode setQueryInsertMode()) and delete the contents of all the fields in the form.
protected  class InteractionManager.InteractionManagerAction
          This class implements the normal behavior buttons in the InteractionManager must have.
protected  class InteractionManager.PrintingThread
          Class that creates a thread which prints the form contents using a HTMLProcessor
 
Field Summary
protected  InteractionManagerAction actionHandler
           
static java.lang.String ADVANCED_QUERY_KEY
           
static boolean CHECK_MODIFIED_DATA_CHANGED_DEFAULT_VALUE
           
protected  boolean checkModifiedDataChangeEvent
          Enables or disables checking the modified data when performing a navigation operation in the application, for example, changing the record when a field was modified.
protected  ClientMessenger_Impl client
           
 int currentMode
          The form current mode.
protected  boolean dataChangedEventProcessing
           
static boolean DEBUG
          Activates the DEBUG mode, which prints some useful information about the execution of this class.
static java.lang.String DELETE_KEY
           
protected  InteractionManager.DeleteFieldsListener deleteFieldsListener
           
protected  java.lang.String f11Button
           
protected  java.lang.String f12Button
           
protected  java.lang.String f7Button
           
protected  java.lang.String f9Button
           
 FormManager formManager
          The form manager related to the InteractionManager
static java.lang.String HELP_KEY
           
static int INSERT
           
static java.lang.String INSERT_KEY
           
protected  java.util.ArrayList interactionManagerModeListenerList
           
 Form managedForm
          The form managed by this InteractionManager
protected  java.util.Vector modifiedFieldAttributes
           
static boolean NEWMODE
          Activates a new state diagram, in which in QUERYINSERT state you can either insert or query directly.
protected  java.lang.Thread printThread
           
static int QUERY
           
static java.lang.String QUERY_INSERT_KEY
           
static java.lang.String QUERY_KEY
           
static int QUERYINSERT
           
static java.lang.String selectionPrintingKey
           
protected  boolean setDefaultFocusEnabled
           
static int UPDATE
           
static int UPDATE_ALL
           
static int UPDATE_CHANGED
           
static java.lang.String UPDATE_KEY
           
protected  int updateMethod
           
protected  java.util.Vector valueChangedListenerAttributes
           
protected  boolean valueChangeListenerEnabled
           
protected static java.lang.String warningBirthdayMessage
           
 
Constructor Summary
InteractionManager()
          Constructs an InteractionManager
 
Method Summary
 void addInteractionManagerModeListener(InteractionManagerModeListener listener)
          Register a listener that will be notified of the changes of mode in the Interaction Manager.
 boolean checkBirthday(java.lang.String attr)
          Checks that the field in the managed form identified by the attr Strings is a Date and, if so, checks that the Date is before than the actual Date.
 InteractionManager cloneInteractionManager()
          Clones this InteractionManager.
 void dataChanged(DataNavigationEvent e)
          Method invoked when the register shown in the form changes.
 boolean dataWillChange(DataNavigationEvent e)
          Method invoked when the register shown in the form is going to change.
protected  void finalize()
           
protected  void fireInteractionManagerModeChanged(InteractionManagerModeEvent event)
          Notifies all the registered listeners that the form mode has changed.
 void free()
          Removes all the references that this InteractionManager has in order to free the memory.
 InteractionManagerAction getActionHandler()
           
 boolean getCheckModifiedDataChangeEvent()
          Checks whether the verification of modified data is enabled or not.
 int getCurrentMode()
          Returns the actual mode of the form
 boolean getDataChangedEventProcessing()
          Checks whether the execution of the method dataChanged(DataNavigationEvent) is enabled or not.
 boolean getDefaultActiveFocus()
          Returns the current focus configuration.
 java.util.Hashtable getFieldValues(Form form)
          Gets field values included in form that are inserted when template is filled.
 java.util.Hashtable getImageValues(Form form, boolean insertEmptyImages)
          Gets image values included in form that are inserted when template is filled.
 java.util.Vector getModifiedFieldAttributes()
          Returns a Vector with the atributes of the fields that have been modified.
 java.util.Hashtable getTableValues(Form form)
          Gets table values included in form that are inserted when template is filled.
 java.util.Hashtable getTemplateFields(Form form)
          Gets fields included in form that are inserted when template is created.
 java.util.Hashtable getTemplateImages(Form form)
          Gets images included in form that are inserted when template is created.
 java.util.Hashtable getTemplateTables(Form form)
          Gets tables included in form that are inserted when template is created.
 boolean isValueChangeListenerEnabled()
           
 void loadActionHandler(java.lang.String resource)
           
 void print()
          Method that responds to the print button keystroke.
protected  void registerFormKeyBindings()
          Called when creating the InteractionManager, this method registers all the keystrokes for the form.
 void registerInteractionManager(Form form, FormManager formManager)
          Registers the InteractionManager as form event listener.
 void removeInteractionManagerModeListener(InteractionManagerModeListener listener)
          Removes a listener from the ones sets to listen to the InteractionManager mode changes.
 void setCheckModifiedDataChangeEvent(boolean check)
          Enables or disables the verification of modified data.
 void setDataChangedEventProcessing(boolean enable)
          Enables or disables the execution of the method dataChanged(DataNavigationEvent).
 void setDefaultFocusEnabled(boolean enable)
          Enables or not the focus strategy in which the focus is set to the first form component.
 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.
protected  void setUpdateMethodVersion(int method)
          Sets the update method.
 void setUpdateMode()
          Sets the mode of the form in Update.
 void setValueChangedEventListener(java.lang.Object attr, boolean listen)
          Register elements as valuechanged listeners, so in the case that they are a valuechangeevent source the InteractionManager will process that events.
 void setValueChangeEventListenerEnabled(boolean enabled)
           
 void setWarningBirthdayMessage(java.lang.String message)
          Deprecated.  
 void valueChanged(ValueEvent e)
          Invoked when a value in some of the form elements has changed.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Activates the DEBUG mode, which prints some useful information about the execution of this class.


NEWMODE

public static boolean NEWMODE
Activates a new state diagram, in which in QUERYINSERT state you can either insert or query directly.


selectionPrintingKey

public static java.lang.String selectionPrintingKey

CHECK_MODIFIED_DATA_CHANGED_DEFAULT_VALUE

public static boolean CHECK_MODIFIED_DATA_CHANGED_DEFAULT_VALUE

QUERYINSERT

public static final int QUERYINSERT
See Also:
Constant Field Values

QUERY

public static final int QUERY
See Also:
Constant Field Values

INSERT

public static final int INSERT
See Also:
Constant Field Values

UPDATE

public static final int UPDATE
See Also:
Constant Field Values

HELP_KEY

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

QUERY_KEY

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

QUERY_INSERT_KEY

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

INSERT_KEY

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

UPDATE_KEY

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

DELETE_KEY

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

ADVANCED_QUERY_KEY

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

f7Button

protected java.lang.String f7Button

f9Button

protected java.lang.String f9Button

f11Button

protected java.lang.String f11Button

f12Button

protected java.lang.String f12Button

interactionManagerModeListenerList

protected java.util.ArrayList interactionManagerModeListenerList

dataChangedEventProcessing

protected boolean dataChangedEventProcessing

warningBirthdayMessage

protected static java.lang.String warningBirthdayMessage

setDefaultFocusEnabled

protected boolean setDefaultFocusEnabled

checkModifiedDataChangeEvent

protected boolean checkModifiedDataChangeEvent
Enables or disables checking the modified data when performing a navigation operation in the application, for example, changing the record when a field was modified.


valueChangedListenerAttributes

protected java.util.Vector valueChangedListenerAttributes

valueChangeListenerEnabled

protected boolean valueChangeListenerEnabled

UPDATE_ALL

public static final int UPDATE_ALL
See Also:
Constant Field Values

UPDATE_CHANGED

public static final int UPDATE_CHANGED
See Also:
Constant Field Values

modifiedFieldAttributes

protected java.util.Vector modifiedFieldAttributes

updateMethod

protected int updateMethod

formManager

public FormManager formManager
The form manager related to the InteractionManager


managedForm

public Form managedForm
The form managed by this InteractionManager


currentMode

public int currentMode
The form current mode. Values can be:


actionHandler

protected InteractionManagerAction actionHandler

client

protected ClientMessenger_Impl client

printThread

protected java.lang.Thread printThread

deleteFieldsListener

protected InteractionManager.DeleteFieldsListener deleteFieldsListener
Constructor Detail

InteractionManager

public InteractionManager()
Constructs an InteractionManager

Method Detail

setUpdateMethodVersion

protected void setUpdateMethodVersion(int method)
Sets the update method. This can be one of the following:

Parameters:
method - - the update method to set

setInitialState

public 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. Other buttons of the form will not be enabled by default, so they have to be activated overwriting this method.


registerInteractionManager

public void registerInteractionManager(Form form,
                                       FormManager formManager)
Registers the InteractionManager as form event listener. This method is called automatically from the FormManager when a Form is loaded. If new listeners wants to be added to some objects of the managed form, this must be done by overwriting this method.

In this basic implementation of the method, only the form and the form manager are assigned and stored by the InteractionManager in order to have references to these classes later. A basic way of overwriting this must call the super.registerInteractionManager(form, FormsManager)

This method links a key stroke to the standard buttons:

Parameters:
form - - the form to be associated with this manager
formManager - - the form manager that rules the association

setQueryInsertMode

public void setQueryInsertMode()
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.


setInsertMode

public void setInsertMode()
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.


setUpdateMode

public void setUpdateMode()
Sets the mode of the form in Update. The fields are enabled and allows modifications. The update button is enabled.


setQueryMode

public void setQueryMode()
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.


print

public void print()
           throws java.lang.Exception
Method that responds to the print button keystroke.

Throws:
java.lang.Exception

cloneInteractionManager

public InteractionManager cloneInteractionManager()
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.

Returns:

free

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

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

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

getCheckModifiedDataChangeEvent

public boolean getCheckModifiedDataChangeEvent()
Checks whether the verification of modified data is enabled or not.

Returns:

setCheckModifiedDataChangeEvent

public void setCheckModifiedDataChangeEvent(boolean check)
Enables or disables the verification of modified data.

Parameters:
check -

getModifiedFieldAttributes

public java.util.Vector getModifiedFieldAttributes()
Returns a Vector with the atributes of the fields that have been modified.

Returns:
- the vector with the modified field attributes.

valueChanged

public void valueChanged(ValueEvent e)
Invoked when a value in some of the form elements has changed. If the source of the event implements the interface IdentifyElement the element's attribute is added to the modified field attributes (see getModifiedFieldAttributes())

Specified by:
valueChanged in interface ValueChangeListener
Parameters:
e - Event with the previous value and the new one

getCurrentMode

public int getCurrentMode()
Returns the actual mode of the form

Returns:
- the actual mode

dataWillChange

public boolean dataWillChange(DataNavigationEvent e)
Method invoked when the register shown in the form is going to change.

Specified by:
dataWillChange in interface DataNavigationListener
Parameters:
e -
Returns:
true if the change can be done; false otherwise

dataChanged

public void dataChanged(DataNavigationEvent e)
Method invoked when the register shown in the form changes. This methods updates the tree selection if the tree exists using the right methods from the Node.

If there's no match between the register in the form and the organizational node's child (this could happen because the tree is not refreshed yet) the organizational node is selected. In this case the update button is disabled and the list of modified fields is removed.

Specified by:
dataChanged in interface DataNavigationListener
Parameters:
e -

setDataChangedEventProcessing

public void setDataChangedEventProcessing(boolean enable)
Enables or disables the execution of the method dataChanged(DataNavigationEvent).

Parameters:
enable -

getDataChangedEventProcessing

public boolean getDataChangedEventProcessing()
Checks whether the execution of the method dataChanged(DataNavigationEvent) is enabled or not.

Returns:

setWarningBirthdayMessage

public void setWarningBirthdayMessage(java.lang.String message)
Deprecated.  

Parameters:
message -

checkBirthday

public boolean checkBirthday(java.lang.String attr)
Checks that the field in the managed form identified by the attr Strings is a Date and, if so, checks that the Date is before than the actual Date. In that case returns true. In other case displays a question advicing the user that the Date is after the actual day, and asking whether the execution must continue with this value.

Parameters:
attr - = the field which has to be compared to
Returns:
true if the execution can continue, false if it can't

setValueChangedEventListener

public void setValueChangedEventListener(java.lang.Object attr,
                                         boolean listen)
Register elements as valuechanged listeners, so in the case that they are a valuechangeevent source the InteractionManager will process that events.

Parameters:
attr - the attribute of the element that wants to be registered. This object should be a String in the text fields or integer fields, but it can be a different object in other fields like reference fields
listen - if the value is true, the element will be added, is false, the element will be removed

setValueChangeEventListenerEnabled

public void setValueChangeEventListenerEnabled(boolean enabled)

isValueChangeListenerEnabled

public boolean isValueChangeListenerEnabled()

registerFormKeyBindings

protected void registerFormKeyBindings()
Called when creating the InteractionManager, this method registers all the keystrokes for the form. The default keystrokes provide fast access to the main form buttons:


setDefaultFocusEnabled

public void setDefaultFocusEnabled(boolean enable)
Enables or not the focus strategy in which the focus is set to the first form component.

Parameters:
enable -

getDefaultActiveFocus

public boolean getDefaultActiveFocus()
Returns the current focus configuration. If true, the focus will be set to the first form component.

Returns:
- true if the default active focus is set false in other case

getTemplateTables

public java.util.Hashtable getTemplateTables(Form form)
Gets tables included in form that are inserted when template is created.

Parameters:
form - Form that is source to create template
Returns:
Hashtable with tables included in template

getTemplateFields

public java.util.Hashtable getTemplateFields(Form form)
Gets fields included in form that are inserted when template is created.

Parameters:
form - Form that is source to create template
Returns:
Hashtable with fields included in template

getTemplateImages

public java.util.Hashtable getTemplateImages(Form form)
Gets images included in form that are inserted when template is created.

Parameters:
form - Form that is source to create template
Returns:
Hashtable with tables included in template

getFieldValues

public java.util.Hashtable getFieldValues(Form form)
Gets field values included in form that are inserted when template is filled.

Parameters:
form - Form that is source to fill template
Returns:
Hashtable with field values included in template

getTableValues

public java.util.Hashtable getTableValues(Form form)
Gets table values included in form that are inserted when template is filled.

Parameters:
form - Form that is source to fill template
Returns:
Hashtable with table values included in template

getImageValues

public java.util.Hashtable getImageValues(Form form,
                                          boolean insertEmptyImages)
Gets image values included in form that are inserted when template is filled.

Parameters:
form - Form that is source to fill template
Returns:
Hashtable with image values included in template

addInteractionManagerModeListener

public void addInteractionManagerModeListener(InteractionManagerModeListener listener)
Register a listener that will be notified of the changes of mode in the Interaction Manager.

Parameters:
listener - the listener to add

removeInteractionManagerModeListener

public void removeInteractionManagerModeListener(InteractionManagerModeListener listener)
Removes a listener from the ones sets to listen to the InteractionManager mode changes.

Parameters:
listener - the listener to be removed

fireInteractionManagerModeChanged

protected void fireInteractionManagerModeChanged(InteractionManagerModeEvent event)
Notifies all the registered listeners that the form mode has changed.

Parameters:
event -

getActionHandler

public InteractionManagerAction getActionHandler()

loadActionHandler

public void loadActionHandler(java.lang.String resource)

Ontimize