org.caleigo.core
Class ControlledProxySelection

java.lang.Object
  extended byorg.caleigo.core.ProxySelection
      extended byorg.caleigo.core.ControlledProxySelection
All Implemented Interfaces:
IControlledProxy, IEntityPool, IProxySelection, ISelection, java.io.Serializable

public class ControlledProxySelection
extends ProxySelection
implements IControlledProxy

Version:
1.00
Author:
Dennis Zikovic
See Also:
Serialized Form

Nested Class Summary
protected  class ControlledProxySelection.ControllListener
           
 
Nested classes inherited from class org.caleigo.core.ProxySelection
ProxySelection.RelayListener
 
Constructor Summary
protected ControlledProxySelection(IProxyController controller, IEntityDescriptor selectionDescriptor)
          Creates new ControledSelectionProxy.
protected ControlledProxySelection(IProxyController controller, IEntityDescriptor selectionDescriptor, IEntityRelationPath relationPath)
          Creates new ControledSelectionProxy.
 
Method Summary
 boolean addEntity(IEntity entity)
          Adds the provided IEntity object to the end of selection object.
 boolean addEntity(int index, IEntity entity)
          Adds the provided IEntity object to at the specified index in the selection object.
protected  IEntityRelationPath createRelationPath()
          Protected help method responsible for creating the relation path between the master and slave descriptor.
 void deleteAll()
          Deletes all contained entities.
protected  void doOnControllerChange()
          This method is called each time the view entity object are replaced.
protected  void doOnControllerDataChange(IFieldDescriptor fieldDescriptor)
          This method is called each time any data in the viewed entity data are changed.
 void finalizeTransaction(boolean successful)
          The finalizeTransaction method is called after a transaction have been fully completed.
 IProxyController getController()
           
protected  IEntity getLinkEntity(IEntity entity)
           
 IEntityRelationPath getRelationPath()
           
 boolean isDirty()
          Return true if any (one or more) of the collections's contained entities has the DIRTY flag set to true that is have unsaved changes.
 boolean isEditable()
           
protected  boolean isMasterRelationLinked()
           
protected  void loadRemoteSelection()
           
protected  IEntity makeLinkEntity(IEntity entity)
           
 void prepareLoad(IDataTransaction transaction)
           
 void prepareStore(IDataTransaction transaction)
           
 void refreshAll()
          Performs a refresh based on the current controller.
protected  void registerAdd(IEntity entity)
           
protected  void registerChange(IEntity entity)
           
protected  void registerRemove(IEntity entity)
           
 boolean removeEntity(IEntity entity)
          Mutation method that removes the provided entity from the selection.
 IEntity removeEntity(int index)
          Mutation method that removes the indexed entity from the selection.
 void storeAll()
          Stores all contained entities that have the DIRTY flag set to true.
 
Methods inherited from class org.caleigo.core.ProxySelection
addEntityChangeListener, addEntityListener, addProxyListener, addSelectionListener, asList, asSet, clear, contains, createRelayListener, createSubSelection, createSubSelection, doAfterRemoteChange, doesAccept, fireContentsChanged, fireEntityAdded, fireEntityRemoved, fireProxyEvent, fireStatusChangedEvent, getData, getEntity, getEntityDescriptor, getRelayListener, getRemoteSelection, getSourceSelection, hasRemoteSelection, hasSourceSelection, indexOf, indexOf, isEmpty, iterator, removeEntityChangeListener, removeEntityListener, removeProxyListener, removeSelectionListener, setData, setRemoteSelection, size, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.caleigo.core.IControlledProxy
getEntityDescriptor
 

Constructor Detail

ControlledProxySelection

protected ControlledProxySelection(IProxyController controller,
                                   IEntityDescriptor selectionDescriptor)
Creates new ControledSelectionProxy. Note protected scope the class should normally be instantiated by a call to object impementing the IProxyController interface and the getControlledProxy method.


ControlledProxySelection

protected ControlledProxySelection(IProxyController controller,
                                   IEntityDescriptor selectionDescriptor,
                                   IEntityRelationPath relationPath)
Creates new ControledSelectionProxy. Note protected scope the class should normally be instantiated by a call to object impementing the IProxyController interface and the getControlledProxy method. Provided path should be directed from controller to slave.

Method Detail

isDirty

public boolean isDirty()
Return true if any (one or more) of the collections's contained entities has the DIRTY flag set to true that is have unsaved changes.

Specified by:
isDirty in interface IControlledProxy
Overrides:
isDirty in class ProxySelection

storeAll

public void storeAll()
Stores all contained entities that have the DIRTY flag set to true. The entities are stored in a single transaction meaning that if one store fails then all fails.

Specified by:
storeAll in interface ISelection
Overrides:
storeAll in class ProxySelection

deleteAll

public void deleteAll()
Deletes all contained entities. The entities are deleted in a single transaction meaning that if one delete fails then all fails. USE THIS METHOD WITH CAUTION.

Specified by:
deleteAll in interface ISelection
Overrides:
deleteAll in class ProxySelection

refreshAll

public void refreshAll()
Performs a refresh based on the current controller. All queued edit operations are cleared.

Specified by:
refreshAll in interface ISelection
Overrides:
refreshAll in class ProxySelection

addEntity

public boolean addEntity(IEntity entity)
Adds the provided IEntity object to the end of selection object. If an entity with the same identity already exists in the selection the requeat is ignored and false is returned.

Specified by:
addEntity in interface ISelection
Overrides:
addEntity in class ProxySelection

addEntity

public boolean addEntity(int index,
                         IEntity entity)
Adds the provided IEntity object to at the specified index in the selection object. If an entity with the same identity already exists in the selection the requeat is ignored and false is returned.

Specified by:
addEntity in interface ISelection
Overrides:
addEntity in class ProxySelection

removeEntity

public boolean removeEntity(IEntity entity)
Mutation method that removes the provided entity from the selection. Returns true if the entity was found and removed otherwise false is returned.

Specified by:
removeEntity in interface ISelection
Overrides:
removeEntity in class ProxySelection

removeEntity

public IEntity removeEntity(int index)
Mutation method that removes the indexed entity from the selection. Returns the indexed entity if it was found and removed otherwise null is returned. The entities are not effecte in any other way.

Specified by:
removeEntity in interface ISelection
Overrides:
removeEntity in class ProxySelection

getController

public IProxyController getController()
Specified by:
getController in interface IControlledProxy

getRelationPath

public IEntityRelationPath getRelationPath()
Specified by:
getRelationPath in interface IControlledProxy

isEditable

public boolean isEditable()
Specified by:
isEditable in interface IControlledProxy

prepareLoad

public void prepareLoad(IDataTransaction transaction)
Specified by:
prepareLoad in interface IControlledProxy

prepareStore

public void prepareStore(IDataTransaction transaction)
Specified by:
prepareStore in interface IControlledProxy

finalizeTransaction

public void finalizeTransaction(boolean successful)
The finalizeTransaction method is called after a transaction have been fully completed. This method will always be called once after any call to prepareLoad or prepareStore.

Specified by:
finalizeTransaction in interface IControlledProxy

isMasterRelationLinked

protected boolean isMasterRelationLinked()

getLinkEntity

protected IEntity getLinkEntity(IEntity entity)

makeLinkEntity

protected IEntity makeLinkEntity(IEntity entity)

registerAdd

protected void registerAdd(IEntity entity)

registerChange

protected void registerChange(IEntity entity)

registerRemove

protected void registerRemove(IEntity entity)

loadRemoteSelection

protected void loadRemoteSelection()

doOnControllerChange

protected void doOnControllerChange()
This method is called each time the view entity object are replaced. It is called prior to doOnDataChange and does does by default clears the selection if the master is set to "empty".


doOnControllerDataChange

protected void doOnControllerDataChange(IFieldDescriptor fieldDescriptor)
This method is called each time any data in the viewed entity data are changed. It is called emidiately after doOnEntityChange and does nothing by default.


createRelationPath

protected IEntityRelationPath createRelationPath()
Protected help method responsible for creating the relation path between the master and slave descriptor. The method is only called if no relation path was provided in the object construction. By default i creates a new EntityRelationPath with no provided waypoint by it can be overrriden for more customized bahaviour.



Copyright © 2005 Caleigo. All Rights Reserved.