[]
        
(Showing Draft Content)

SelectFieldItem

Class SelectFieldItem

java.lang.Object
com.grapecity.documents.excel.SelectFieldItem

public class SelectFieldItem extends Object
Represents an item in a CheckBoxListCellType or RadioButtonListCellType.

A SelectFieldItem stores the display text shown to the user and the underlying value associated with that option.


 SelectFieldItem item = new SelectFieldItem("Option 1", "1");
 CheckBoxListCellType cellType = new CheckBoxListCellType();
 cellType.getItems().add(item);
 
  • Constructor Details

    • SelectFieldItem

      public SelectFieldItem()
      Generates an item for a checkbox list or radio button list.

      This constructor creates an empty item. Set the item's text and value after construction by using setText(String) and setValue(Object).

      
       SelectFieldItem item = new SelectFieldItem();
       item.setText("Option 1");
       item.setValue("1");
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.getItems().add(item);
       
    • SelectFieldItem

      public SelectFieldItem(String text, Object value)
      Creates an item for a checkbox list or radio button list.

      This constructor initializes the display text shown to the user and the underlying value associated with the item.

      
       SelectFieldItem item = new SelectFieldItem("Option 1", "1");
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.getItems().add(item);
       
      Parameters:
      text - The display text of the item. Can be null.
      value - The value associated with the item. Can be null.
  • Method Details

    • getText

      public String getText()
      Gets the text of the item.

      Returns the display text used for this check box list or radio button list item.

      
       SelectFieldItem item = new SelectFieldItem("Option 1", "1");
       String text = item.getText();
       
      Returns:
      The text of the item. Returns null if no text has been assigned.
    • setText

      public void setText(String text)
      Sets the text of the item.

      Sets the display text used for this check box list or radio button list item.

      
       SelectFieldItem item = new SelectFieldItem("Option 1", "1");
       item.setText("Sample");
       
      Parameters:
      text - The text of the item. Sets null if no text has been assigned.
    • getValue

      public Object getValue()
      Gets the value of the item.

      This value identifies the selected item in a check box list or radio button list. The returned object is the value previously assigned by setValue(Object) or the SelectFieldItem(String,Object) constructor.

      
       SelectFieldItem item = new SelectFieldItem("Option 1", "1");
       Object value = item.getValue();
       
      Returns:
      The value of the item, or null if no value has been assigned.
    • setValue

      public void setValue(Object value)
      Sets the value of the item.
      
       SelectFieldItem item = new SelectFieldItem("Option 1", "1");
       item.setValue(100);
       
      Parameters:
      value - The value of the item, or null if no value has been assigned.