Class LabeledRow
- java.lang.Object
-
- org.libreoffice.ide.eclipse.core.gui.rows.LabeledRow
-
- Direct Known Subclasses:
BooleanRow,ChoiceRow,DialogRow,FileRow,TextRow
public abstract class LabeledRow extends java.lang.ObjectBasic 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
Fields Modifier and Type Field Description static intLAYOUT_COLUMNSprotected org.eclipse.swt.widgets.ControlmBrowseprotected org.eclipse.swt.widgets.ControlmFieldprotected org.eclipse.swt.widgets.ControlmLabelprotected IFieldChangedListenermListenerprotected java.lang.StringmProperty
-
Constructor Summary
Constructors Constructor Description LabeledRow(java.lang.String pProperty)Simple constructor only defining the property.LabeledRow(org.eclipse.swt.widgets.Composite pParent, java.lang.String pProperty, org.eclipse.swt.widgets.Control pLabel, org.eclipse.swt.widgets.Control pField, java.lang.String pBrowseText, boolean pLink)Create a field base.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddBrowseSelectionListener(org.eclipse.swt.events.SelectionListener pListener)Add a selection listener to the browse link or button (depends on the arguments of the constructor).protected voidcreateContent(org.eclipse.swt.widgets.Composite pParent, org.eclipse.swt.widgets.Control pLabel, org.eclipse.swt.widgets.Control pField, java.lang.String pBrowseText, boolean pLink)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 pEvent)Fires a change of the row.java.lang.StringgetLabel()Returns the row label.java.lang.StringgetProperty()Property getter.abstract java.lang.StringgetValue()Get or calculate the value of this property.voidremoveFieldChangedlistener()Removes the field changes listener.voidsetEnabled(boolean pEnabled)Set the enabled state of the field and the browse button if the latter exists.voidsetFieldChangedListener(IFieldChangedListener pListener)Defines the listener that will react to the field changes.voidsetLabel(java.lang.String pNewLabel)Replace the current label by a new one.voidsetTooltip(java.lang.String pTooltip)Set the tooltip message of the row.voidsetVisible(boolean pVisible)Toggle the visibily of the line.
-
-
-
Field Detail
-
LAYOUT_COLUMNS
public static final int LAYOUT_COLUMNS
- See Also:
- Constant Field Values
-
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
protected java.lang.String mProperty
-
mListener
protected IFieldChangedListener mListener
-
-
Constructor Detail
-
LabeledRow
public LabeledRow(java.lang.String pProperty)
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 pParent, java.lang.String pProperty, org.eclipse.swt.widgets.Control pLabel, org.eclipse.swt.widgets.Control pField, java.lang.String pBrowseText, boolean pLink)Create a field base. This constructor may not be used by subclasses.- Parameters:
pParent- Composite in which the row will be addedpProperty- Property value given in the field changed event.pLabel- Control to use for the label. The most common is a text control, but it could be something else like an hyperlink.pField- Control containing the field data.pBrowseText- Button text. Ifnull, the button isn't created.pLink- the browse is shown as a link iftrue, otherwise it is a button.
-
-
Method Detail
-
setTooltip
public void setTooltip(java.lang.String pTooltip)
Set the tooltip message of the row.- Parameters:
pTooltip- the tooltip message
-
setLabel
public void setLabel(java.lang.String pNewLabel)
Replace the current label by a new one.- Parameters:
pNewLabel- New label to use
-
getLabel
public java.lang.String getLabel()
Returns the row label.- Returns:
- the row label
-
addBrowseSelectionListener
public void addBrowseSelectionListener(org.eclipse.swt.events.SelectionListener pListener)
Add a selection listener to the browse link or button (depends on the arguments of the constructor).- Parameters:
pListener- the listener to add
-
createContent
protected void createContent(org.eclipse.swt.widgets.Composite pParent, org.eclipse.swt.widgets.Control pLabel, org.eclipse.swt.widgets.Control pField, java.lang.String pBrowseText, boolean pLink)Stores the row controls, creates the button if its text is notnulland layout the controls.- Parameters:
pParent- the parent composite where to create the controlspLabel- the control for the labelpField- the control for the fieldpBrowseText- the text to show on the right button of the row.pLink- the browse is shown as a link iftrue, otherwise it is a button.
-
getProperty
public java.lang.String getProperty()
Property getter.- Returns:
- the property
-
getValue
public abstract java.lang.String 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
public void setFieldChangedListener(IFieldChangedListener pListener)
Defines the listener that will react to the field changes.- Parameters:
pListener- field changes listener
-
removeFieldChangedlistener
public void removeFieldChangedlistener()
Removes the field changes listener.
-
fireFieldChangedEvent
protected void fireFieldChangedEvent(FieldEvent pEvent)
Fires a change of the row.- Parameters:
pEvent- 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 pEnabled)
Set the enabled state of the field and the browse button if the latter exists.- Parameters:
pEnabled-trueactivate the row, otherwise the row is desactivated
-
-