[]
        
(Showing Draft Content)

SelectorItem

Class SelectorItem

java.lang.Object
com.grapecity.documents.excel.forms.SelectorItem
Direct Known Subclasses:
DropDownItem, ListBoxItem

public abstract class SelectorItem extends Object
Represents a base item for selection controls such as IDropDown and IListBox.

A SelectorItem stores the text value associated with an item and provides shared behavior for selector-based controls, including read-only state management. This abstract class is not used directly; instead, work with a concrete subclass and add instances to the item collection of the owning control.

When an item is marked as read-only, calling setValue(String) throws an IllegalStateException. Use getValue() to read the current item content and setReadOnly(boolean) to control whether the item can be modified.

  • Constructor Details

    • SelectorItem

      public SelectorItem()
  • Method Details

    • getValue

      public final String getValue()
      Gets the content of this item.

      Returns the string currently stored in the selector item. This value represents the item content used by selector-based controls such as IDropDown and IListBox.

      
       DropDownItem item = new DropDownItem("Pending");
       String value = item.getValue();
       
      Returns:
      The current item content, or null if no value has been assigned.
    • setValue

      public final void setValue(String value)
      Sets the content of this item.

      Sets the string currently stored in the selector item. This value represents the item content used by selector-based controls such as IDropDown and IListBox.

      
       DropDownItem item = new DropDownItem("Pending");
       item.setValue("Sample");
       
      Parameters:
      value - The current item content, or null if no value has been assigned.
    • UpdateBindingValue

      public final void UpdateBindingValue(String value)
      Updates the binding value of this item.

      This method assigns the specified value directly to the item's stored value. Unlike setValue(String), it does not check the read-only state and does not raise the value-changed event.

      
       DropDownItem item = new DropDownItem("Pending");
       item.UpdateBindingValue("Approved");
       
      Parameters:
      value - The binding value to assign to the item. Can be null.
    • isReadOnly

      public final boolean isReadOnly()
      Gets whether this item is in read-only mode.

      When this property returns true, attempts to change the item content through setValue(String) throw an IllegalStateException.

      
       DropDownItem item = new DropDownItem("Pending");
       item.setReadOnly(true);
       boolean readOnly = item.isReadOnly();
       
      Returns:
      true if this item is read-only; otherwise, false.
    • setReadOnly

      public final void setReadOnly(boolean value)
      Sets whether this item is read-only.

      When this property is set to true, the item cannot be modified through setValue(String). Set it to false to allow the item value to be edited.

      
       DropDownItem item = new DropDownItem("Pending");
       item.setReadOnly(true);
       
      Parameters:
      value - true to make the item read-only; false to make it editable.