[]
        
(Showing Draft Content)

ISelectorT

Interface ISelectorT>

All Superinterfaces:
ICellLinkControl, ICellLinkControlT<Integer>, IControl, ISelector
All Known Subinterfaces:
IDropDown, IListBox

public interface ISelectorT<T extends SelectorItem,TCollection extends IItemList<T>> extends ISelector
Represents a selector control with strongly typed items.

This interface extends ISelector with item-based access for controls such as IDropDown and IListBox. Use getItems() to manage the control's child items, getSelectedItem() to retrieve the current selection. The items list is read-only when ISelector.getItemsSourceRange() is set.


 ISelectorT<DropDownItem, IDropDownItemList> selector =
         worksheet.getControls().addDropDown(20, 20, 120, 20);
 selector.getItems().add(new DropDownItem("Pending"));
 selector.getItems().add(new DropDownItem("Approved"));
 selector.setSelectedItem(selector.getItems().get(1));
 
  • Method Details

    • getItems

      TCollection getItems()
      Gets items of this control.

      Returns the item list that defines the selectable content of the control. The list is read-only if ISelector.getItemsSourceRange() is set.

      
       IDropDown dropDown = worksheet.getControls().addDropDown(20, 20, 120, 24);
       dropDown.getItems().add(new DropDownItem("Name"));
       dropDown.getItems().add(new DropDownItem("Value"));
       IDropDownItemList items = dropDown.getItems();
       
      Returns:
      The items of this control.
      API Note:
      Not fully supported by the *.ssjson format. Data may be lost.
    • getSelectedItem

      T getSelectedItem()
      Gets the currently selected item.

      Returns the item that corresponds to the current selected index, or null if no item is selected.

      
       IDropDown selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
       selector.getItems().add(new DropDownItem("Pending"));
       selector.getItems().add(new DropDownItem("Approved"));
       selector.setSelectedItem(selector.getItems().get(1));
       DropDownItem selectedItem = selector.getSelectedItem();
       
      Returns:
      The currently selected item, or null if no item is selected.
      API Note:
      Not fully supported by the *.ssjson format. IndexOutOfBoundsException could occur if items are lost.