[]
        
(Showing Draft Content)

IItemCollection

Interface IItemCollection

All Superinterfaces:
Iterable<T>
All Known Subinterfaces:
IDropDownItemList, IItemList<T>, IListBoxItemCollection, IListBoxItemList

public interface IItemCollection<T> extends Iterable<T>
Holds the collection of items that constitute the content of an ISelector.

This interface defines the common collection operations for selector items, including iteration, counting, adding, clearing, testing for membership, and removing item references. It is typically obtained from a selector control through ISelectorT.getItems().


 IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
 IItemCollection<DropDownItem> items = dropDown.getItems();
 items.add(new DropDownItem("Pending"));
 items.add(new DropDownItem("Approved"));
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T newItem)
    Adds an item to the collection.
    void
    Clears the collection and releases the references on all items currently in the collection.
    boolean
    contains(T containItem)
    Returns a value that indicates whether the specified item is in this view.
    int
    Gets the number of records in the collection.
    boolean
    remove(T removeItem)
    Removes the specified item reference from the collection or view.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • getCount

      int getCount()
      Gets the number of records in the collection.

      Use this method to retrieve the current number of items stored in an IItemCollection.

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
       IItemCollection<DropDownItem> items = dropDown.getItems();
       items.add(new DropDownItem("Pending"));
       items.add(new DropDownItem("Approved"));
       int count = items.getCount();
       
      Returns:
      The number of records in the collection.
    • add

      void add(T newItem)
      Adds an item to the collection.

      Use this method to append an item to a mutable IItemCollection returned by a selector control such as IDropDown.

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
       IItemCollection<DropDownItem> items = dropDown.getItems();
       items.add(new DropDownItem("Pending"));
       
      Parameters:
      newItem - The item to add to the collection.
    • clear

      void clear()
      Clears the collection and releases the references on all items currently in the collection.

      Use this method to remove every item reference from the collection in a single call.

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
       IItemCollection<DropDownItem> items = dropDown.getItems();
       items.add(new DropDownItem("Pending"));
       items.add(new DropDownItem("Approved"));
       items.clear();
       
    • contains

      boolean contains(T containItem)
      Returns a value that indicates whether the specified item is in this view.

      Use this method to determine whether an item belongs to the current collection view and passes the active filter.

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
       IItemCollection<DropDownItem> items = dropDown.getItems();
       DropDownItem approved = new DropDownItem("Approved");
       items.add(new DropDownItem("Pending"));
       items.add(approved);
       boolean containsApproved = items.contains(approved);
       
      Parameters:
      containItem - The object to check.
      Returns:
      true to indicate that the item belongs to this collection and passes the active filter; otherwise, false.
    • remove

      boolean remove(T removeItem)
      Removes the specified item reference from the collection or view.

      Use this method to remove an existing item object from a selector item's collection, such as the items returned by ISelectorT.getItems().

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 20);
       IItemCollection<DropDownItem> items = dropDown.getItems();
       DropDownItem approved = new DropDownItem("Approved");
       items.add(new DropDownItem("Pending"));
       items.add(approved);
       boolean removed = items.remove(approved);
       
      Parameters:
      removeItem - The object to remove.
      Returns:
      true if item is successfully removed; otherwise, false.