LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyContextManager

java.lang.Object
  extended by leon.data.LyContextManager
All Implemented Interfaces:
LyDataSourceListener

public class LyContextManager
extends java.lang.Object
implements LyDataSourceListener

This class manages the instances of LyContext. There is only one instance of this class for a Leonardi application (i.e. for a primary module).

See Also:
LyContext, LyApplication

Field Summary
static java.lang.String __VERSION
          File version.
 
Constructor Summary
LyContextManager(LyDataSession session)
          Constructs a context manager.
 
Method Summary
 void cancelAll()
          Cancel all contexts.
 void clearUndoRedo()
          Method for clearing the lists of contexts for undo/redo operations.
 void free()
          Free this context manager.
 LyContext getContext(int index)
          Gets context at the given index in contexts list.
 int getContextCount()
          Gets number of current contexts.
 java.util.Collection<LyContext> getContexts()
          Accessor to the contexts list.
 java.lang.String getRedoName()
          To get the name of the next available redo operation.
 java.lang.String getUndoName()
          To get the name of the next available undo operation.
 boolean isRedoAvailable()
          To test if a redo operation can be done.
 boolean isUndoAvailable()
          To test if an undo operation can be done.
 LyContext newContext(LyDataSession session)
          To begin a new context.
 LyContext newContext(LyDataSession session, LyContext.Type type)
          To begin a new context.
 boolean objectCreated(LyDataSourceEvent event)
          Method for receiving an object creation.
 boolean objectDeleted(LyDataSourceEvent event)
          Method for receiving an object deletion.
 boolean objectModified(LyDataSourceEvent event)
          Method for receiving an object modification.
 boolean redo(LyDataSession session)
          Redo all operations undo by the last undo call.
 boolean undo(LyDataSession session)
          Undo all operations done by the last comitted context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version.

See Also:
Constant Field Values
Constructor Detail

LyContextManager

public LyContextManager(LyDataSession session)
Constructs a context manager. Initialization is done with the init method.

Parameters:
session - Current session instance
Method Detail

free

public void free()
Free this context manager.


newContext

public final LyContext newContext(LyDataSession session)
To begin a new context. The new context is associated with the current user session.

Parameters:
session - the associated user session.
Returns:
the new created context.

newContext

public LyContext newContext(LyDataSession session,
                            LyContext.Type type)
To begin a new context. The new context is associated with the current user session.

Parameters:
session - the associated user session.
type - the type of the new context.
Returns:
the new created context.

getContexts

public java.util.Collection<LyContext> getContexts()
Accessor to the contexts list.

Returns:
Collection of current contexts managed by the context manager.

getContextCount

public int getContextCount()
Gets number of current contexts.

Returns:
Number of contexts registered on this context managaer.

getContext

public LyContext getContext(int index)
Gets context at the given index in contexts list.

Parameters:
index - Index of the requested context.
Returns:
Context at the specified poistion if it exists, false otherwise.

cancelAll

public void cancelAll()
Cancel all contexts. This method only unlocks the objects locked by all contexts.


clearUndoRedo

public void clearUndoRedo()
Method for clearing the lists of contexts for undo/redo operations.


isUndoAvailable

public boolean isUndoAvailable()
To test if an undo operation can be done.

Returns:
true if an undo is available, false otherwise.

getUndoName

public java.lang.String getUndoName()
To get the name of the next available undo operation.

Returns:
The anme of the next available undo operation or null if no undo operation is available.

isRedoAvailable

public boolean isRedoAvailable()
To test if a redo operation can be done.

Returns:
true if a redo is available, false otherwise.

getRedoName

public java.lang.String getRedoName()
To get the name of the next available redo operation.

Returns:
The anme of the next available redo operation or null if no redo operation is available.

undo

public boolean undo(LyDataSession session)
Undo all operations done by the last comitted context.

Parameters:
session - the current session
Returns:
true if successfull

redo

public boolean redo(LyDataSession session)
Redo all operations undo by the last undo call.

Parameters:
session - the current session
Returns:
True if last operation was successfully redone.

objectCreated

public boolean objectCreated(LyDataSourceEvent event)
Method for receiving an object creation.

Specified by:
objectCreated in interface LyDataSourceListener
Parameters:
event - Event notifying the creation of an object.
Returns:
True indicating if the event was used, false otherwise.

objectDeleted

public boolean objectDeleted(LyDataSourceEvent event)
Method for receiving an object deletion.

Specified by:
objectDeleted in interface LyDataSourceListener
Parameters:
event - Event notifying the deletion of an object.
Returns:
True indicating if the event was used, false otherwise.

objectModified

public boolean objectModified(LyDataSourceEvent event)
Method for receiving an object modification.

Specified by:
objectModified in interface LyDataSourceListener
Parameters:
event - Event notifying the modification of an object.
Returns:
True indicating if the event was used, false otherwise.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com