LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LySimpleWorkSpace

java.lang.Object
  extended by leon.data.LyObjectList
      extended by leon.data.LyWorkSpace
          extended by leon.data.LySimpleWorkSpace
All Implemented Interfaces:
LyGetSessionInterface, LyAdvancedDataSourceListener, LyDataSourceListener

public final class LySimpleWorkSpace
extends LyWorkSpace

This class implements a simple workspace : dynamic objects list where objects are added and removed "by hand" (directly using addObject and removeObject methods) .

Objects of different classes can be managed in this type of workspace.


Field Summary
static java.lang.String __VERSION
          File version
 
Constructor Summary
LySimpleWorkSpace(LyDataSession session, boolean dynamic)
          Constructs a simple workspace within a given session.
LySimpleWorkSpace(LyDataSession session, LyObject object, boolean dynamic)
          Constructs a simple workspace within a given session with a single object.
LySimpleWorkSpace(LyDataSession session, LyObjectList list, boolean dynamic)
          Constructs a simple workspace within a given session from an objects list.
 
Method Summary
 void addList(LyObjectList list)
          Adds objects of the specified list to this list.
 int addObject(LyObject object)
          Adds an object in this workspace.
 int addObject(LyObject object, int position)
          Adds an object in this workspace at the given position.
 void allowMultipleOccurences()
          Allow multiple occurences of the same object.
 LyInfoList<LyClassInfo> getClasses()
          Return the list of all class infos to which objects of this workspace belong.
 int getCount(LyClassInfo classInfo)
          Get count of objects for the given class info.
 boolean objectCreated(LyDataSourceEvent event)
          Method for receiving an object creation.
 boolean objectModified(LyDataSourceEvent event)
          Method for receiving an object modification.
 void registerClassInfo(LyClassInfo classInfo)
          Add given class to known classes to be able to receive creation events.
 void removeList(LyObjectList list)
          Removes objects of the specified list to this list.
 int removeObject(LyObject object)
          Removes an object from this workspace.
 void setNotifyChange(boolean notifyChange)
          Allows listeners to be notified on object changes for classes of this workspace concerning objects that are not in the workspace.
 void setNotifyCreation(boolean notifyCreation)
          Allows listeners to be notified on object creations for classes of this workspace.
 
Methods inherited from class leon.data.LyWorkSpace
addListener, dataSourceEventsGrouped, free, getListener, getListenerCount, getSession, getSources, isDynamic, isLocal, lock, objectDeleted, objectStateChanged, objectUserEvent, removeListener, reset, unlock
 
Methods inherited from class leon.data.LyObjectList
contains, delete, delete, equals, equals, getIndex, getIntersection, getList, getList, getList, getList, getList, getList, getList, getList, getList, getList, getList, getList, getObject, getObject, getObject, getObjects, getSize, getSize, getSort, getSortedList, indexOf, intersects, isEmpty, isSorted, iterator, set, setSort, setSortByName, setSorted, toObjectIds, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values
Constructor Detail

LySimpleWorkSpace

public LySimpleWorkSpace(LyDataSession session,
                         boolean dynamic)
Constructs a simple workspace within a given session.

Parameters:
session - Session in which this workspace is constructed.
dynamic - Specifies if this workspace is dynamic or not.

LySimpleWorkSpace

public LySimpleWorkSpace(LyDataSession session,
                         LyObject object,
                         boolean dynamic)
Constructs a simple workspace within a given session with a single object.

Parameters:
session - Session in which this workspace is constructed.
object - Object added in the constructed workspace.
dynamic - Specifies if this workspace is dynamic or not.

LySimpleWorkSpace

public LySimpleWorkSpace(LyDataSession session,
                         LyObjectList list,
                         boolean dynamic)
Constructs a simple workspace within a given session from an objects list.

Parameters:
session - Session in which this workspace is constructed.
list - Objects list used to initialize this workspace.
dynamic - Specifies if this workspace is dynamic or not.
Method Detail

getClasses

public LyInfoList<LyClassInfo> getClasses()
Return the list of all class infos to which objects of this workspace belong.

Specified by:
getClasses in class LyObjectList
Returns:
List of classes to which objects of this workspace belong.

getCount

public int getCount(LyClassInfo classInfo)
Get count of objects for the given class info.

Parameters:
classInfo - Class info for which objects count is requested.
Returns:
Number of objects of the given class info found in this workspace.

setNotifyCreation

public void setNotifyCreation(boolean notifyCreation)
Allows listeners to be notified on object creations for classes of this workspace. This method has effect only if this workspace is dynamic.

Parameters:
notifyCreation - Boolean indicating if notifications for creations are requested.

setNotifyChange

public void setNotifyChange(boolean notifyChange)
Allows listeners to be notified on object changes for classes of this workspace concerning objects that are not in the workspace. This method has effect only if this workspace is dynamic.

Parameters:
notifyChange - Boolean indicating if notifications for all changes are requested.

registerClassInfo

public void registerClassInfo(LyClassInfo classInfo)
Add given class to known classes to be able to receive creation events. This method does make sense only if this workspace is dynamic. It's necessary to receive creation before any object of the given class was added.

Parameters:
classInfo - The class info to register.

addObject

public int addObject(LyObject object)
Adds an object in this workspace. This method is overriden from LyWorkSpace to become public.

Parameters:
object - Object to add in the workspace.
Returns:
If the object was not in this list, returns a positive index giving the position where the object was added. Otherwise, returns a negative index giving the position minus 1 where the same object was found.
See Also:
LyObjectList.add(leon.data.LyObject)

addObject

public int addObject(LyObject object,
                     int position)
Adds an object in this workspace at the given position. This method is overriden from LyWorkSpace to become public.

Parameters:
object - Object to add in the workspace.
position - Position where the object is added in the list.
Returns:
If the object was not in this list, returns a positive index giving the position where the object was added. Otherwise, returns a negative index giving the position minus 1 where the same object was found.

removeObject

public int removeObject(LyObject object)
Removes an object from this workspace. This method is overriden from LyWorkSpace to become public.

Parameters:
object - Object to remove from the workspace.
Returns:
Index where the object was found in this workspace.
Throws:
java.lang.IllegalArgumentException - If the object was not found in this workspace.

addList

public void addList(LyObjectList list)
Adds objects of the specified list to this list. This method is overriden from LyWorkSpace to re-enable it for this type of workspace.

Overrides:
addList in class LyWorkSpace
Parameters:
list - Objects to add to this list.

removeList

public void removeList(LyObjectList list)
Removes objects of the specified list to this list.

Parameters:
list - Objects to remove to this list.

objectCreated

public boolean objectCreated(LyDataSourceEvent event)
Method for receiving an object creation. If the object is contained in this workspace, that means it was added with addObject method, so we send an event to our listeners.

Specified by:
objectCreated in interface LyDataSourceListener
Overrides:
objectCreated in class LyWorkSpace
Parameters:
event - Event notifying the creation 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. Changes the object concerned by the event if it is found in this workspace.

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

allowMultipleOccurences

public void allowMultipleOccurences()
Allow multiple occurences of the same object.


(c) January 2013 - W4 S.A.

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