com.centrasite.control.adapters.collection
Class CollectionsUtil

java.lang.Object
  extended by com.centrasite.control.adapters.collection.CollectionsUtil

public class CollectionsUtil
extends java.lang.Object

Utility class providing convenient methods for working with ReportCollection, ReportLine instances.


Method Summary
static boolean contains(ReportCollection collection, com.centrasite.control.Item item)
          Determines if the given collection contains the given item.
static int getLineNumberForItem(ReportCollection collection, com.centrasite.control.Item item)
          Returns the line number of the line containing the specified item.
static com.centrasite.control.Item getSelectedItem(ReportCollection reportCollection)
          Retrieves the first selected item in the given ReportCollection.
static java.util.Collection<com.centrasite.control.Item> getSelectedItems(ReportCollection reportCollection)
          Retrieves the selected items in the given ReportCollection.
static boolean isNullItem(TextGridAdapter.ItemLine line)
          Determine if the given line represents null item.
static int referencesItem(ReportCollection collection, com.centrasite.control.Item item, int change)
          Determines if the given item is referenced by the given collection.
static void refreshValue(ReportCollection collection, com.centrasite.control.ReportInterface report)
          Reinitialize the collection with the given ReportInterface.
static void setRows(ReportCollection collection, com.centrasite.control.RowIterator rowIt)
          Sets the rows coming from the given RowIterator as lines in the given ReportCollection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

referencesItem

public static int referencesItem(ReportCollection collection,
                                 com.centrasite.control.Item item,
                                 int change)
Determines if the given item is referenced by the given collection.

Parameters:
collection -
item -
change -
Returns:
int

contains

public static boolean contains(ReportCollection collection,
                               com.centrasite.control.Item item)
Determines if the given collection contains the given item.

Parameters:
collection -
item -
Returns:
boolean

isNullItem

public static boolean isNullItem(TextGridAdapter.ItemLine line)
Determine if the given line represents null item. Checks if it is null or if getItem() returns null.

Parameters:
line -
Returns:
boolean

getSelectedItems

public static java.util.Collection<com.centrasite.control.Item> getSelectedItems(ReportCollection reportCollection)
Retrieves the selected items in the given ReportCollection.

Parameters:
reportCollection -
Returns:
collection of selected items.

getSelectedItem

public static com.centrasite.control.Item getSelectedItem(ReportCollection reportCollection)
Retrieves the first selected item in the given ReportCollection.

Parameters:
reportCollection -
Returns:
First selected item.

setRows

public static void setRows(ReportCollection collection,
                           com.centrasite.control.RowIterator rowIt)
Sets the rows coming from the given RowIterator as lines in the given ReportCollection.

Parameters:
collection -
rowIt -

refreshValue

public static void refreshValue(ReportCollection collection,
                                com.centrasite.control.ReportInterface report)
Reinitialize the collection with the given ReportInterface. This includes initialize the ReportCollectionListener if present or clearing all lines, executing the report and populating the lines again.

Parameters:
collection -
report -

getLineNumberForItem

public static int getLineNumberForItem(ReportCollection collection,
                                       com.centrasite.control.Item item)
Returns the line number of the line containing the specified item.

Parameters:
item - item to check for
Returns:
number of line containing item or -1 if no matching row