Class ChoiceRow
java.lang.Object
org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
org.libreoffice.ide.eclipse.core.gui.rows.ChoiceRow
- Direct Known Subclasses:
AbstractConfigRow
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:
-
Field Summary
Fields inherited from class org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
LAYOUT_COLUMNS, mBrowse, mField, mLabel, mListener, mProperty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend the item at the end of the item list.voidAdds the provided item at the provided position.voidadds an internationalized item at the end of the list.voidAdds a translated item.voidAdds all the strings contained in items at the end of the item list.getItem(int index) Deprecated.intReturns the number of items of the combo box.getValue()Get or calculate the value of this property.getValue(int index) Returns the value of the i-th item.voidremove(int index) Remove the item at the position corresponding to index.voidremove(int start, int end) Removes all the items between start and end positions.voidRemoves the items with the provided text.voidRemoves all the items of the combo box.voidselect(int index) Select the item at the position corresponding to index.voidSet the provided text as the active item if the item is present in the choice.voidsetBrowseSelectionListener(org.eclipse.swt.events.SelectionListener listener) Set the listener for the browse button action.Methods inherited from class org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
addBrowseSelectionListener, createContent, fillRow, fireFieldChangedEvent, getLabel, getProperty, removeFieldChangedlistener, setEnabled, setFieldChangedListener, setLabel, setTooltip, setVisible
-
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 rowproperty- the property name of the rowlabel- label the label to print on the left of the rowbrowse- the label of the buttonlink-trueto 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
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
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 textvalue- the item valueindex- the item index
-
add
adds an internationalized item at the end of the list.- Parameters:
pText- the internationalized textpValue- the value of the item- See Also:
-
add
Adds the provided item at the provided position.- Parameters:
item- text of the item to addindex- position where to add the item in the list- See Also:
-
add
Append the item at the end of the item list.- Parameters:
item- text of the item to append- See Also:
-
remove
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 removeend- 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
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.This methods only returns the text of the item, usegetValue()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
Description copied from class:LabeledRowGet or calculate the value of this property.- Specified by:
getValuein classLabeledRow- Returns:
- the selected value.
- Since:
- 1.0.3 This method returns the language independent value of the item
-
getValue
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
-
getValue()to get the selected value.