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 Object
Basic class for a property row. Subclasses will override:
  • setValue
  • getValue
Their constructor should respect the following steps:
  1. Use the property constructor
  2. Create the label and field controls to be used
  3. Call createContents
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    protected org.eclipse.swt.widgets.Control
     
    protected org.eclipse.swt.widgets.Control
     
    protected org.eclipse.swt.widgets.Control
     
     
    protected String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LabeledRow(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 Type
    Method
    Description
    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).
    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 not null and layout the controls.
    protected void
    fillRow(org.eclipse.swt.widgets.Composite pParent)
    Method organizing the different graphic components in the parent composite.
    protected void
    Fires a change of the row.
    Returns the row label.
    Property getter.
    abstract String
    Get or calculate the value of this property.
    void
    Removes the field changes listener.
    void
    setEnabled(boolean enabled)
    Set the enabled state of the field and the browse button if the latter exists.
    void
    Defines the listener that will react to the field changes.
    void
    setLabel(String newLabel)
    Replace the current label by a new one.
    void
    setTooltip(String pTooltip)
    Set the tooltip message of the row.
    void
    setVisible(boolean pVisible)
    Toggle the visibily of the line.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      protected String mProperty
    • mListener

      protected IFieldChangedListener mListener
  • Constructor Details

    • LabeledRow

      public LabeledRow(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 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 added
      property - 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. If null, the button isn't created.
      link - the browse is shown as a link if true, otherwise it is a button.
  • Method Details

    • setTooltip

      public void setTooltip(String pTooltip)
      Set the tooltip message of the row.
      Parameters:
      pTooltip - the tooltip message
    • setLabel

      public void setLabel(String newLabel)
      Replace the current label by a new one.
      Parameters:
      newLabel - New label to use
    • getLabel

      public String 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 not null and layout the controls.
      Parameters:
      parent - the parent composite where to create the controls
      label - the control for the label
      field - the control for the field
      browseText - the text to show on the right button of the row.
      browseLink - the browse is shown as a link if true, otherwise it is a button.
    • getProperty

      public String getProperty()
      Property getter.
      Returns:
      the property
    • getValue

      public abstract 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 listener)
      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

      protected void fireFieldChangedEvent(FieldEvent event)
      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 - if true the 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 - true activate the row, otherwise the row is desactivated