JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Class EventHandler

java.lang.Object
  |
  +--org.objectweb.jac.aspects.gui.EventHandler
All Implemented Interfaces:
FieldUpdate

public class EventHandler
extends Object
implements FieldUpdate

This handler manages events received from GUIs (web and swing for now). It is especially used for lists and arrays (onSelection, onView, etc ...)


Constructor Summary
EventHandler()
           
 
Method Summary
 void fieldUpdated(Object substance, FieldItem field, Object value, Object param)
          Upcalled when a field was modified.
static EventHandler get()
           
static void initAutocreatedObject(Object created, Object substance, FieldItem role)
          Initialize an autocreated object by setting
 void maybeInvalidatePane(ViewFactory factory, DisplayContext context, CustomizedView customizedView, String selectedPaneID)
          Removes the content of pane when another pane's content is changed
 void onAddToCollection(DisplayContext context, Object substance, CollectionItem collection)
          This method is upcalled when an object is added to a collection.
 void onAddToCollection(DisplayContext context, Object substance, CollectionItem collection, boolean noAutoCreate)
          This method is upcalled when an object is added to a collection.
 Object onCreateObject(DisplayContext context, ClassItem cli, Object substance, FieldItem field)
          This method is upcalled when an object has to be created in an object chooser.
 void onDropObject(DisplayContext context, Object target, Object droppedObject, Object source, boolean copy)
           
 void onInvoke(DisplayContext context, Object substance, AbstractMethodItem method)
          Upcalled when an invocation is performed on an object.
 void onInvoke(DisplayContext context, Object substance, AbstractMethodItem method, boolean askFormParameters, Object[] parameters, String[] attrNames, Object[] attrValues)
          Invoke a method in the general case.
 void onInvoke(DisplayContext context, Object substance, AbstractMethodItem method, String[] attrNames, Object[] attrValues)
          Upcalled when an invocation is performed on an object.
 void onInvokeDirect(DisplayContext context, Object substance, AbstractMethodItem method, Object[] parameters)
          Upcalled when a direct invocation is performed on an object (no parameters will be asked by the GUI).
 Object onInvokeSynchronous(DisplayContext context, Object substance, AbstractMethodItem method, Object[] parameters)
          Invoke a method and waits for the result (and returns it).
 void onNodeSelection(DisplayContext context, AbstractNode node, boolean forceView)
          Upcalled when a tree node is selected.
 void onRemoveFromCollection(DisplayContext context, Object substance, CollectionItem collection, boolean askFormParameters)
          This method is upcalled when an object is removed from a collection.
 void onRemoveFromCollection(DisplayContext context, Object substance, CollectionItem collection, Object selected, boolean askFormParameters)
          This method is upcalled when an object is removed from a collection.
 void onSelection(DisplayContext context, MemberItem container, Object selectedObject, FieldItem field, Object extraOption)
          Upcalled when a selection occurs on a field.
 void onSelection(DisplayContext context, MemberItem container, Object selectedObject, FieldItem field, Object extraOption, boolean forceView)
          Upcalled when a selection occurs on a field.
 void onView(DisplayContext context, MemberItem container, Object selectedObject, FieldItem field, Object extraOption)
          Upcalled when a view is asked on an object.
 void setFocus(View top, FieldItem field, Object option)
          Gives focus to the view which is a field editor for a given field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventHandler

public EventHandler()
Method Detail

get

public static EventHandler get()

onSelection

public void onSelection(DisplayContext context,
                        MemberItem container,
                        Object selectedObject,
                        FieldItem field,
                        Object extraOption)
Upcalled when a selection occurs on a field.

Parameters:
context - the context
container - ???
selectedObject - the selected object
field - ???
extraOption -

onView

public void onView(DisplayContext context,
                   MemberItem container,
                   Object selectedObject,
                   FieldItem field,
                   Object extraOption)
Upcalled when a view is asked on an object.

Parameters:
context - the context
container - ???
selectedObject - the selected object
field - ???
extraOption -

onSelection

public void onSelection(DisplayContext context,
                        MemberItem container,
                        Object selectedObject,
                        FieldItem field,
                        Object extraOption,
                        boolean forceView)
Upcalled when a selection occurs on a field. Displays a view of the selected object.

Parameters:
context - the context
container - member (reference, collection, or method) that references the selected object (the result in case of a method)
selectedObject - the selected object
field - give focus to this field in the view of the selected object
extraOption -
forceView - when true, a window containing the selected object is opened

maybeInvalidatePane

public void maybeInvalidatePane(ViewFactory factory,
                                DisplayContext context,
                                CustomizedView customizedView,
                                String selectedPaneID)
Removes the content of pane when another pane's content is changed

Parameters:
selectedPaneID - ID of the selected pane

setFocus

public void setFocus(View top,
                     FieldItem field,
                     Object option)
Gives focus to the view which is a field editor for a given field.

Parameters:
top - view to start searching from. All subviews of this view will be recursively inspected.
field - the field whose editor to search for
option - an option that will be passed when calling onSetFocus() on the FieldEditor.
See Also:
FieldEditor.onSetFocus(Object)

initAutocreatedObject

public static void initAutocreatedObject(Object created,
                                         Object substance,
                                         FieldItem role)
Initialize an autocreated object by setting


onNodeSelection

public void onNodeSelection(DisplayContext context,
                            AbstractNode node,
                            boolean forceView)
Upcalled when a tree node is selected.

Parameters:
context - the display context
node - the selected tree node
forceView - if true, the subtance of the node is opened in a new window

onInvokeDirect

public void onInvokeDirect(DisplayContext context,
                           Object substance,
                           AbstractMethodItem method,
                           Object[] parameters)
Upcalled when a direct invocation is performed on an object (no parameters will be asked by the GUI).

Parameters:
context - the display context
substance - the object that holds the method
method - the method to invoke
parameters - the parameters of the method

onInvoke

public void onInvoke(DisplayContext context,
                     Object substance,
                     AbstractMethodItem method)
Upcalled when an invocation is performed on an object.

Parameters:
context - the display context
substance - the object that holds the method
method - the method to invoke

onInvoke

public void onInvoke(DisplayContext context,
                     Object substance,
                     AbstractMethodItem method,
                     String[] attrNames,
                     Object[] attrValues)
Upcalled when an invocation is performed on an object.

Parameters:
context - the display context
substance - the object that holds the method
method - the method to invoke
attrValues - the contextual attributes values

onInvoke

public void onInvoke(DisplayContext context,
                     Object substance,
                     AbstractMethodItem method,
                     boolean askFormParameters,
                     Object[] parameters,
                     String[] attrNames,
                     Object[] attrValues)
Invoke a method in the general case. Sets the necessary attributes in the context.

Parameters:
context - the display context
substance - the object that holds the method
method - the method to invoke
parameters - the method's parameters
attrValues - the contextual attributes values

onInvokeSynchronous

public Object onInvokeSynchronous(DisplayContext context,
                                  Object substance,
                                  AbstractMethodItem method,
                                  Object[] parameters)
Invoke a method and waits for the result (and returns it).

Parameters:
context - the display context
substance - the object that holds the method
method - the method to invoke
parameters - the method's parameters

onAddToCollection

public void onAddToCollection(DisplayContext context,
                              Object substance,
                              CollectionItem collection)
This method is upcalled when an object is added to a collection.

Parameters:
context - the display context
substance - the object that holds the collection
collection - the collection

onAddToCollection

public void onAddToCollection(DisplayContext context,
                              Object substance,
                              CollectionItem collection,
                              boolean noAutoCreate)
This method is upcalled when an object is added to a collection.

Parameters:
context - the display context
substance - the object that holds the collection
collection - the collection
noAutoCreate - if true, does not auto create the object to add, whatever the configuration for the collection.

onRemoveFromCollection

public void onRemoveFromCollection(DisplayContext context,
                                   Object substance,
                                   CollectionItem collection,
                                   boolean askFormParameters)
This method is upcalled when an object is removed from a collection.

Parameters:
context - the display context
substance - the object that holds the collection
collection - the collection

onRemoveFromCollection

public void onRemoveFromCollection(DisplayContext context,
                                   Object substance,
                                   CollectionItem collection,
                                   Object selected,
                                   boolean askFormParameters)
This method is upcalled when an object is removed from a collection.

Parameters:
context - the display context
substance - the object that holds the collection
collection - the collection
selected - the object to remove in the collection

onCreateObject

public Object onCreateObject(DisplayContext context,
                             ClassItem cli,
                             Object substance,
                             FieldItem field)
This method is upcalled when an object has to be created in an object chooser.

Parameters:
context - the display context
cli - the class of the object to create
substance -
field - a field to which the created object will be "added". May be null.

onDropObject

public void onDropObject(DisplayContext context,
                         Object target,
                         Object droppedObject,
                         Object source,
                         boolean copy)

fieldUpdated

public void fieldUpdated(Object substance,
                         FieldItem field,
                         Object value,
                         Object param)
Description copied from interface: FieldUpdate
Upcalled when a field was modified.

Specified by:
fieldUpdated in interface FieldUpdate
Parameters:
substance - the object of which a field was updated
field - the updated field
value - new value of the vield
param - extra infos (unused)
See Also:
ViewControlWrapper.registerField(Wrappee,FieldItem,FieldUpdate,Object)

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli