Class LabeledRow
java.lang.Object
org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
- Direct Known Subclasses:
BooleanRow,ChoiceRow,DialogRow,FileRow,TextRow
Basic class for a property row. Subclasses will override:
- setValue
- getValue
- Use the property constructor
- Create the label and field controls to be used
- Call createContents
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected org.eclipse.swt.widgets.Controlprotected org.eclipse.swt.widgets.Controlprotected org.eclipse.swt.widgets.Controlprotected IFieldChangedListenerprotected String -
Constructor Summary
ConstructorsConstructorDescriptionLabeledRow(String pProperty) Simple constructor only defining the property.LabeledRow(org.eclipse.swt.widgets.Composite parent, String property, org.eclipse.swt.widgets.Control label, org.eclipse.swt.widgets.Control field, String browseText, boolean link) Create a field base. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBrowseSelectionListener(org.eclipse.swt.events.SelectionListener listener) Add a selection listener to the browse link or button (depends on the arguments of the constructor).protected voidcreateContent(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control label, org.eclipse.swt.widgets.Control field, String browseText, boolean browseLink) Stores the row controls, creates the button if its text is notnulland layout the controls.protected voidfillRow(org.eclipse.swt.widgets.Composite pParent) Method organizing the different graphic components in the parent composite.protected voidfireFieldChangedEvent(FieldEvent event) Fires a change of the row.getLabel()Returns the row label.Property getter.abstract StringgetValue()Get or calculate the value of this property.voidRemoves the field changes listener.voidsetEnabled(boolean enabled) Set the enabled state of the field and the browse button if the latter exists.voidsetFieldChangedListener(IFieldChangedListener listener) Defines the listener that will react to the field changes.voidReplace the current label by a new one.voidsetTooltip(String pTooltip) Set the tooltip message of the row.voidsetVisible(boolean pVisible) Toggle the visibily of the line.
-
Field Details
-
LAYOUT_COLUMNS
public static final int LAYOUT_COLUMNS- See Also:
-
mLabel
protected org.eclipse.swt.widgets.Control mLabel -
mField
protected org.eclipse.swt.widgets.Control mField -
mBrowse
protected org.eclipse.swt.widgets.Control mBrowse -
mProperty
-
mListener
-
-
Constructor Details
-
LabeledRow
Simple constructor only defining the property. This constructor should only be called by the subclasses.- Parameters:
pProperty- property value given in the field changed event.
-
LabeledRow
public LabeledRow(org.eclipse.swt.widgets.Composite parent, String property, org.eclipse.swt.widgets.Control label, org.eclipse.swt.widgets.Control field, String browseText, boolean link) Create a field base. This constructor may not be used by subclasses.- Parameters:
parent- Composite in which the row will be addedproperty- Property value given in the field changed event.label- Control to use for the label. The most common is a text control, but it could be something else like an hyperlink.field- Control containing the field data.browseText- Button text. Ifnull, the button isn't created.link- the browse is shown as a link iftrue, otherwise it is a button.
-
-
Method Details
-
setTooltip
Set the tooltip message of the row.- Parameters:
pTooltip- the tooltip message
-
setLabel
Replace the current label by a new one.- Parameters:
newLabel- New label to use
-
getLabel
Returns the row label.- Returns:
- the row label
-
addBrowseSelectionListener
public void addBrowseSelectionListener(org.eclipse.swt.events.SelectionListener listener) Add a selection listener to the browse link or button (depends on the arguments of the constructor).- Parameters:
listener- the listener to add
-
createContent
protected void createContent(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control label, org.eclipse.swt.widgets.Control field, String browseText, boolean browseLink) Stores the row controls, creates the button if its text is notnulland layout the controls.- Parameters:
parent- the parent composite where to create the controlslabel- the control for the labelfield- the control for the fieldbrowseText- the text to show on the right button of the row.browseLink- the browse is shown as a link iftrue, otherwise it is a button.
-
getProperty
Property getter.- Returns:
- the property
-
getValue
Get or calculate the value of this property.- Returns:
- the property value
-
fillRow
protected void fillRow(org.eclipse.swt.widgets.Composite pParent) Method organizing the different graphic components in the parent composite.- Parameters:
pParent- Parent composite.
-
setFieldChangedListener
Defines the listener that will react to the field changes.- Parameters:
listener- field changes listener
-
removeFieldChangedlistener
public void removeFieldChangedlistener()Removes the field changes listener. -
fireFieldChangedEvent
Fires a change of the row.- Parameters:
event- the event to throw for the change
-
setVisible
public void setVisible(boolean pVisible) Toggle the visibily of the line.- Parameters:
pVisible- iftruethe components will visible, otherwise they will be hidden.
-
setEnabled
public void setEnabled(boolean enabled) Set the enabled state of the field and the browse button if the latter exists.- Parameters:
enabled-trueactivate the row, otherwise the row is desactivated
-