java.lang.Object
org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
org.libreoffice.ide.eclipse.core.gui.rows.ChoiceRow
Direct Known Subclasses:
AbstractConfigRow

public class ChoiceRow extends LabeledRow
Row class that could managed a combo box to select a value among others

In order to use this class correctly, please add items and define the default one. As every row type, don't forget to set the Modification listener to be notified of the value changes. This class supports internationalized items since the version 1.0.3.

See Also:
  • Constructor Details

    • ChoiceRow

      public ChoiceRow(org.eclipse.swt.widgets.Composite parent, String property, String label, String browse, boolean link)
      Create a new choice row with a button on the right. The parent composite should have a grid layout with 3 horizontal spans.
      Parameters:
      parent - the parent composite where to create the row
      property - the property name of the row
      label - label the label to print on the left of the row
      browse - the label of the button
      link - true to show a link for the browse button
  • Method Details

    • setBrowseSelectionListener

      public void setBrowseSelectionListener(org.eclipse.swt.events.SelectionListener listener)
      Set the listener for the browse button action. There is only on listener, because there is generally no need for more.
      Parameters:
      listener - the browse action listener
    • addAll

      public void addAll(String[] items)
      Adds all the strings contained in items at the end of the item list.
      Parameters:
      items - Array of items to appends to the existing ones.
    • add

      public void add(String text, String value, int index)
      Adds a translated item.

      This method adds the text to the combo box and deals with its translation. If the text is already contained in the box, nothing will be done.

      Parameters:
      text - the translated item text
      value - the item value
      index - the item index
    • add

      public void add(String pText, String pValue)
      adds an internationalized item at the end of the list.
      Parameters:
      pText - the internationalized text
      pValue - the value of the item
      See Also:
    • add

      public void add(String item, int index)
      Adds the provided item at the provided position.
      Parameters:
      item - text of the item to add
      index - position where to add the item in the list
      See Also:
    • add

      public void add(String item)
      Append the item at the end of the item list.
      Parameters:
      item - text of the item to append
      See Also:
    • remove

      public void remove(String pText)
      Removes the items with the provided text.
      Parameters:
      pText - text of the items to remove
      See Also:
      • Combo.remove(java.lang.String)
    • remove

      public void remove(int index)
      Remove the item at the position corresponding to index.
      Parameters:
      index - position of the item to remove
      See Also:
      • Combo.remove(int)
    • remove

      public void remove(int start, int end)
      Removes all the items between start and end positions.
      Parameters:
      start - position of the first item to remove
      end - position of the last item to remove
      See Also:
      • Combo.remove(int, int)
    • removeAll

      public void removeAll()
      Removes all the items of the combo box.
      See Also:
      • Combo.removeAll()
    • select

      public void select(int index)
      Select the item at the position corresponding to index.
      Parameters:
      index - position of the item to select
      See Also:
      • Combo.select(int)
    • select

      public void select(String pValue)
      Set the provided text as the active item if the item is present in the choice. Otherwise, do nothing.
      Parameters:
      pValue - value of the item to select
    • getItem

      @Deprecated public String getItem(int index)
      Deprecated.
      This methods only returns the text of the item, use getValue() to get the selected value.
      Returns the index the item of the choice.
      Parameters:
      index - position of the item to fetch
      Returns:
      the index the item of the choice
      See Also:
      • Combo.getItem(int)
    • getItemCount

      public int getItemCount()
      Returns the number of items of the combo box.
      Returns:
      number of items of the combo box
      See Also:
      • Combo.getItemCount()
    • getValue

      public String getValue()
      Description copied from class: LabeledRow
      Get or calculate the value of this property.
      Specified by:
      getValue in class LabeledRow
      Returns:
      the selected value.
      Since:
      1.0.3 This method returns the language independent value of the item
    • getValue

      public String getValue(int index)
      Returns the value of the i-th item.
      Parameters:
      index - the index of the value to get
      Returns:
      the language independent value of the item