LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyPageWorkSpace

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

public final class LyPageWorkSpace
extends LyClassWorkSpace

This class implements a page workspace : workspace where objects are loaded per "page" containing a given number of objects of a class info and optionally. matching a filter.

This mode of loading requires to be able to order and filter objects. These parameters are calculated on a field info that is given on construction of the workspace.

Once loaded, it's possible on demand to load the next or the previous page.


Field Summary
static java.lang.String __VERSION
          File version
static int DEFAULT_LIMIT
           
static boolean FORCE_RELOAD_PAGE_FOR_DATES
           
static int ITERATOR_LIMIT
           
static int MAX_LIMIT
           
static int MAX_PEER_LIMIT
           
 
Constructor Summary
LyPageWorkSpace(LyDataSession session, LyClassInfo classInfo, LyFilter filter, LySort sort, int limit)
          Constructs a class workspace within a given session for a class info.
LyPageWorkSpace(LyDataSession session, LyClassInfo classInfo, LyInfoList<LyFieldInfo> fieldInfos, LyFilter filter, LySort sort, int limit)
          Constructs a class workspace within a given session for a class info.
LyPageWorkSpace(LyDataSession session, LyClassInfo classInfo, LyInfoList<LyFieldInfo> fieldInfos, LyFilter filter, LySort sort, int limit, boolean dynamic, boolean sorted)
          Constructs a class workspace within a given session for a class info.
 
Method Summary
 boolean dataSourceEventsGrouped(java.util.ArrayList<LyDataSourceEvent> events)
          Called when grouped events are sent.
 LyFilter getFilter()
          Gets the filter of this class workspace.
 short getPage()
          Gets the current page number.
 short getPageCount()
          Gets page count.
 LySort getSort()
          Gets the current sort of this list.
 int getTotalCount()
           
 boolean isPaginatedByPeer()
          Indicates whether peer can paginate results.
 java.util.Iterator<LyObject> iterator()
          Returns an implementation of the Iterator interface for this LyObjectList.
 void loadPage(boolean next)
          Load objects corresponding to the next or previous objects "page".
 void loadPage(short page)
          Load objects corresponding to a given objects "page".
 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.
 void reload()
          Method for reloading this workspace.
 void reset()
          Method for resetting this workspace.
 void setFilter(LyFilter filter)
          Sets the filter of this class workspace.
 void setFilter(LyFilter filter, boolean reset)
          Sets the filter of this class workspace.
 void setFilterAndSort(LyFilter filter, LySort sort, boolean reset)
          Sets the at the same time the current sort and the filter of this list.
 void setSort(LySort sort)
          Sets the current sort of this list.
 void setSort(LySort sort, boolean reset)
          Sets the current sort of this list.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class leon.data.LyClassWorkSpace
getClasses, getClassInfo, getFieldInfos, getObjectSource, objectStateChanged, objectUserEvent, setFieldInfos
 
Methods inherited from class leon.data.LyWorkSpace
addList, addListener, free, getListener, getListenerCount, getSession, getSources, isDynamic, isLocal, lock, removeListener, 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, getSortedList, indexOf, intersects, isEmpty, isSorted, set, setSortByName, setSorted, toObjectIds
 
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

FORCE_RELOAD_PAGE_FOR_DATES

public static boolean FORCE_RELOAD_PAGE_FOR_DATES

DEFAULT_LIMIT

public static int DEFAULT_LIMIT

MAX_LIMIT

public static int MAX_LIMIT

MAX_PEER_LIMIT

public static int MAX_PEER_LIMIT

ITERATOR_LIMIT

public static int ITERATOR_LIMIT
Constructor Detail

LyPageWorkSpace

public LyPageWorkSpace(LyDataSession session,
                       LyClassInfo classInfo,
                       LyFilter filter,
                       LySort sort,
                       int limit)
Constructs a class workspace within a given session for a class info.

Parameters:
session - Session in which the workspace is constructed.
classInfo - Class info to which objects of this workspace belong.
filter - Filter applied to objects for being in this workspace.
sort - Sort requested in this workspace.
limit - Number of objects per page.

LyPageWorkSpace

public LyPageWorkSpace(LyDataSession session,
                       LyClassInfo classInfo,
                       LyInfoList<LyFieldInfo> fieldInfos,
                       LyFilter filter,
                       LySort sort,
                       int limit)
Constructs a class workspace within a given session for a class info.

Parameters:
session - Session in which the workspace is constructed.
classInfo - Class info to which objects of this workspace belong.
fieldInfos - List of fieldinfos to load.
filter - Filter applied to objects for being in this workspace.
sort - Sort requested in this workspace.
limit - Number of objects per page.

LyPageWorkSpace

public LyPageWorkSpace(LyDataSession session,
                       LyClassInfo classInfo,
                       LyInfoList<LyFieldInfo> fieldInfos,
                       LyFilter filter,
                       LySort sort,
                       int limit,
                       boolean dynamic,
                       boolean sorted)
Constructs a class workspace within a given session for a class info.

Parameters:
session - Session in which the workspace is constructed.
classInfo - Class info to which objects of this workspace belong.
fieldInfos - List of fieldinfos to load.
filter - Filter applied to objects for being in this workspace.
sort - Sort requested in this workspace.
limit - Number of objects per page.
dynamic - Specifies if this workspace is dynamic or not.
sorted - Indicates if this workspace is sorted or not.
Method Detail

getFilter

public LyFilter getFilter()
Gets the filter of this class workspace.

Overrides:
getFilter in class LyClassWorkSpace
Returns:
Filter specified for this class workspace.

setFilter

public void setFilter(LyFilter filter)
Sets the filter of this class workspace.

Parameters:
filter - Filter specified for this class workspace.

setFilter

public void setFilter(LyFilter filter,
                      boolean reset)
Sets the filter of this class workspace. The list is immediatly resorted and filtered if reset param is true.

Parameters:
filter - Filter specified for this class workspace.
reset - indicates if we reset immediately or not

setSort

public void setSort(LySort sort)
Sets the current sort of this list. The list is immediatly resorted.

Overrides:
setSort in class LyObjectList
Parameters:
sort - New sort for this list.

setSort

public void setSort(LySort sort,
                    boolean reset)
Sets the current sort of this list. The list is immediatly resorted. The list is immediatly resorted and filtered if reset param is true.

Parameters:
sort - New sort for this list.
reset - indicates if we reset immediately or not

setFilterAndSort

public void setFilterAndSort(LyFilter filter,
                             LySort sort,
                             boolean reset)
Sets the at the same time the current sort and the filter of this list. The list is immediatly resorted and filtered if reset param is true.

Parameters:
filter - Filter specified for this class workspace.
sort - New sort for this list.
reset - indicates if we reset immediately or not

reset

public void reset()
Method for resetting this workspace. Objects contained in this workspace are removed and reloaded from the object source of the class info specified for this workspace.

Overrides:
reset in class LyClassWorkSpace

reload

public void reload()
Method for reloading this workspace. Objects contained in this workspace are removed and reloaded from the object source of the class info specified for this workspace.


loadPage

public void loadPage(boolean next)
Load objects corresponding to the next or previous objects "page".

Parameters:
next - True if the next page is requested, false otherwise.

loadPage

public void loadPage(short page)
Load objects corresponding to a given objects "page".

Parameters:
page - Index of requested page.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class LyClassWorkSpace
Returns:
This workspace returned as a string.

getPage

public short getPage()
Gets the current page number.

Returns:
the page number

isPaginatedByPeer

public boolean isPaginatedByPeer()
Indicates whether peer can paginate results.


getPageCount

public short getPageCount()
Gets page count.

Returns:
the page count

getTotalCount

public int getTotalCount()
Returns:
The total number of objects for the class of this workspace including class filtering.

objectCreated

public boolean objectCreated(LyDataSourceEvent event)
Method for receiving an object creation. This method is overridden to check if the object is greater than min and lower than max, regarding current sort.

Specified by:
objectCreated in interface LyDataSourceListener
Overrides:
objectCreated in class LyClassWorkSpace
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. This method is overridden to check if the object is greater than min and lower than max, regarding current sort.

Specified by:
objectModified in interface LyDataSourceListener
Overrides:
objectModified in class LyClassWorkSpace
Parameters:
event - Event notifying the modification 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. This method is overridden to update min and max is if required.

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

dataSourceEventsGrouped

public boolean dataSourceEventsGrouped(java.util.ArrayList<LyDataSourceEvent> events)
Called when grouped events are sent.

Specified by:
dataSourceEventsGrouped in interface LyAdvancedDataSourceListener
Overrides:
dataSourceEventsGrouped in class LyWorkSpace
Parameters:
events - Sorted list of events.
Returns:
True if the events are used by the listener, false otherwise.

getSort

public LySort getSort()
Description copied from class: LyObjectList
Gets the current sort of this list.

Overrides:
getSort in class LyObjectList
Returns:
Current sort of this list (may be null if default sorting is used).
See Also:
LyObjectList.getSort()

iterator

public java.util.Iterator<LyObject> iterator()
Returns an implementation of the Iterator interface for this LyObjectList.

Overrides:
iterator in class LyObjectList

(c) January 2013 - W4 S.A.

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