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
public class ChoiceRow extends LabeledRow
Row class that could managed a combo box to select a value among othersIn 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:
LabeledRow
-
-
Field Summary
-
Fields inherited from class org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
LAYOUT_COLUMNS, mBrowse, mField, mLabel, mListener, mProperty
-
-
Constructor Summary
Constructors Constructor Description ChoiceRow(org.eclipse.swt.widgets.Composite pParent, java.lang.String pProperty, java.lang.String pLabel, java.lang.String pBrowse, boolean pLink)Create a new choice row with a button on the right.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(java.lang.String pItem)Append the item at the end of the item list.voidadd(java.lang.String pItem, int pIndex)Adds the provided item at the provided position.voidadd(java.lang.String pText, java.lang.String pValue)adds an internationalized item at the end of the list.voidadd(java.lang.String pText, java.lang.String pValue, int pIndex)Adds a translated item.voidaddAll(java.lang.String[] pItems)Adds all the strings contained in items at the end of the item list.java.lang.StringgetItem(int pIndex)Deprecated.This methods only returns the text of the item, usegetValue()to get the selected value.intgetItemCount()Returns the number of items of the combo box.java.lang.StringgetValue()Get or calculate the value of this property.java.lang.StringgetValue(int pIndex)Returns the value of the i-th item.voidremove(int pIndex)Remove the item at the position corresponding to index.voidremove(int pStart, int pEnd)Removes all the items between start and end positions.voidremove(java.lang.String pText)Removes the items with the provided text.voidremoveAll()Removes all the items of the combo box.voidselect(int pIndex)Select the item at the position corresponding to index.voidselect(java.lang.String pValue)Set the provided text as the active item if the item is present in the choice.voidsetBrowseSelectionListener(org.eclipse.swt.events.SelectionListener pListener)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 Detail
-
ChoiceRow
public ChoiceRow(org.eclipse.swt.widgets.Composite pParent, java.lang.String pProperty, java.lang.String pLabel, java.lang.String pBrowse, boolean pLink)Create a new choice row with a button on the right. The parent composite should have a grid layout with 3 horizontal spans.- Parameters:
pParent- the parent composite where to create the rowpProperty- the property name of the rowpLabel- label the label to print on the left of the rowpBrowse- the label of the buttonpLink-trueto show a link for the browse button
-
-
Method Detail
-
setBrowseSelectionListener
public void setBrowseSelectionListener(org.eclipse.swt.events.SelectionListener pListener)
Set the listener for the browse button action. There is only on listener, because there is generally no need for more.- Parameters:
pListener- the browse action listener
-
addAll
public void addAll(java.lang.String[] pItems)
Adds all the strings contained in items at the end of the item list.- Parameters:
pItems- Array of items to appends to the existing ones.
-
add
public void add(java.lang.String pText, java.lang.String pValue, int pIndex)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:
pText- the translated item textpValue- the item valuepIndex- the item index
-
add
public void add(java.lang.String pText, java.lang.String pValue)adds an internationalized item at the end of the list.- Parameters:
pText- the internationalized textpValue- the value of the item- See Also:
add(String, String, int)
-
add
public void add(java.lang.String pItem, int pIndex)Adds the provided item at the provided position.- Parameters:
pItem- text of the item to addpIndex- position where to add the item in the list- See Also:
add(java.lang.String, java.lang.String, int)
-
add
public void add(java.lang.String pItem)
Append the item at the end of the item list.- Parameters:
pItem- text of the item to append- See Also:
add(java.lang.String, java.lang.String, int)
-
remove
public void remove(java.lang.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 pIndex)
Remove the item at the position corresponding to index.- Parameters:
pIndex- position of the item to remove- See Also:
Combo.remove(int)
-
remove
public void remove(int pStart, int pEnd)Removes all the items between start and end positions.- Parameters:
pStart- position of the first item to removepEnd- 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 pIndex)
Select the item at the position corresponding to index.- Parameters:
pIndex- position of the item to select- See Also:
Combo.select(int)
-
select
public void select(java.lang.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 java.lang.String getItem(int pIndex)
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:
pIndex- 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 java.lang.String 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
public java.lang.String getValue(int pIndex)
Returns the value of the i-th item.- Parameters:
pIndex- the index of the value to get- Returns:
- the language independent value of the item
-
-