JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Class ViewControlWrapper

java.lang.Object
  |
  +--org.objectweb.jac.core.Wrapper
        |
        +--org.objectweb.jac.aspects.gui.ViewControlWrapper
All Implemented Interfaces:
Serializable

public class ViewControlWrapper
extends Wrapper

This wrapper updates the views of a given object when its state changes, that is to say when a write method is called on the wrappee.

A view controller can control several views of the same wrappee at the same time.

This mecanism is similar to the famous MVC design pattern. The model is the wrappee and the controller is the wrapper.

See Also:
View, registerObject(Wrappee,ObjectUpdate,Object), registerField(Wrappee,FieldItem,FieldUpdate,Object), registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object), unregisterObject(Wrappee,ObjectUpdate), unregisterField(Wrappee,FieldItem,FieldUpdate), unregisterCollection(Wrappee,CollectionItem,CollectionUpdate), Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac
 
Constructor Summary
ViewControlWrapper(AspectComponent ac)
          Creates an empty view control wrapper.
 
Method Summary
 void registerCollection(Wrappee wrappee, CollectionItem collection, CollectionUpdate client, Object param)
          Register for a collectionUpdated event.
 void registerField(Wrappee wrappee, FieldItem field, FieldUpdate client, Object param)
          Register for a fieldUpdated event.
 void registerMethod(Wrappee wrappee, MethodItem method, MethodUpdate client, Object param)
          Register for a fieldUpdated event.
 void registerObject(Wrappee wrappee, ObjectUpdate client, Object param)
          Register for an objectUpdated event.
 void unregister(Wrappee wrappee, Object client)
          Unregister a client from all update events
 void unregisterCollection(Wrappee wrappee, CollectionItem collection, CollectionUpdate client)
          Unregister from a collectionUpdated event.
 void unregisterField(Wrappee wrappee, FieldItem field, FieldUpdate client)
          Unregister from a fieldUpdated event.
 void unregisterMethod(Wrappee wrappee, MethodItem method, MethodUpdate client)
           
 void unregisterObject(Wrappee wrappee, ObjectUpdate client)
          Unregister from an objectUpdated event.
 Object updateView(Interaction interaction)
          A wrapping method that updates the views of the objects.
 
Methods inherited from class org.objectweb.jac.core.Wrapper
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed, setAspectComponent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ViewControlWrapper

public ViewControlWrapper(AspectComponent ac)
Creates an empty view control wrapper.

Method Detail

registerField

public void registerField(Wrappee wrappee,
                          FieldItem field,
                          FieldUpdate client,
                          Object param)
Register for a fieldUpdated event.

Parameters:
wrappee -
field - the field whose updates must be notified
client - the object to notify when the field is updated
param -
See Also:
unregisterField(Wrappee,FieldItem,FieldUpdate)

unregisterField

public void unregisterField(Wrappee wrappee,
                            FieldItem field,
                            FieldUpdate client)
Unregister from a fieldUpdated event.

Parameters:
field - the field whose updates must not be notified anymore
client - the object not to notify anymore
See Also:
registerField(Wrappee,FieldItem,FieldUpdate,Object)

registerCollection

public void registerCollection(Wrappee wrappee,
                               CollectionItem collection,
                               CollectionUpdate client,
                               Object param)
Register for a collectionUpdated event.

Parameters:
client - the object to notify when the field is updated
See Also:
unregisterCollection(Wrappee,CollectionItem,CollectionUpdate)

unregisterCollection

public void unregisterCollection(Wrappee wrappee,
                                 CollectionItem collection,
                                 CollectionUpdate client)
Unregister from a collectionUpdated event.

Parameters:
collection - the collection whose updates must not be notified anymore
client - the object not to notify anymore
See Also:
registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

registerMethod

public void registerMethod(Wrappee wrappee,
                           MethodItem method,
                           MethodUpdate client,
                           Object param)
Register for a fieldUpdated event.

Parameters:
wrappee -
method - the method whose updates must be notified
client - the object to notify when the field is updated
param -
See Also:
unregisterField(Wrappee,FieldItem,FieldUpdate)

unregisterMethod

public void unregisterMethod(Wrappee wrappee,
                             MethodItem method,
                             MethodUpdate client)

registerObject

public void registerObject(Wrappee wrappee,
                           ObjectUpdate client,
                           Object param)
Register for an objectUpdated event.

Parameters:
client - whom to notify when the wrappee is updated
param - an object that will be passed back to client on each notification event.

unregisterObject

public void unregisterObject(Wrappee wrappee,
                             ObjectUpdate client)
Unregister from an objectUpdated event.

Parameters:
client - whom not to notify anymore

unregister

public void unregister(Wrappee wrappee,
                       Object client)
Unregister a client from all update events

Parameters:
wrappee - the object to unregister from
client - the client to unregister

updateView

public Object updateView(Interaction interaction)
A wrapping method that updates the views of the objects.

It uses the RTTI aspect to know the fields and the collections that are written, added, or removed by the currently wrapped method. Then it upcall the refreshStateComponent of all the controlled views to refresh the implied GUI components.

See Also:
org.objectweb.jac.core.rtti, ObjectUpdate, FieldUpdate, CollectionUpdate

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli