Class PWWidget

java.lang.Object
org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget
Direct Known Subclasses:
PWButton, PWCheckbox, PWChooser, PWColorChooser, PWCombo, PWLabel, PWRadio, PWScale, PWSeparator, PWSpinner, PWText, PWTextarea

public abstract class PWWidget
extends java.lang.Object
This class is the root class for all widgets that take part of a preference window
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Enabler enabler  
    protected int numberOfColumns  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected PWWidget​(java.lang.String label, java.lang.String propertyKey, int numberOfColumns, boolean singleWidget)
    Constructor
  • Method Summary

    Modifier and Type Method Description
    protected void addControl​(org.eclipse.swt.widgets.Control control)
    Adds a control to the list of control contained in the widget
    protected abstract org.eclipse.swt.widgets.Control build​(org.eclipse.swt.widgets.Composite parent)
    Build the widget
    protected void buildLabel​(org.eclipse.swt.widgets.Composite parent, int verticalAlignment)
    Build the label associated to the widget
    protected abstract void check()
    Check if the property can be binded to the widget
    org.eclipse.swt.widgets.Control checkAndBuild​(org.eclipse.swt.widgets.Composite parent)
    Check if the property can be binded to the widget, then build the widget
    boolean enableOrDisable()
    Enable or disable the widget, depending on the associated enabler
    int getAlignment()  
    java.util.List<org.eclipse.swt.widgets.Control> getControls()  
    int getHeight()  
    int getIndent()  
    java.lang.String getLabel()  
    int getNumberOfColumns()  
    (package private) java.lang.String getPropertyKey()  
    int getWidth()  
    boolean isGrabExcessSpace()  
    boolean isSingleWidget()  
    PWWidget setAlignment​(int alignment)  
    PWWidget setEnabler​(Enabler enabler)  
    PWWidget setGrabExcessSpace​(boolean grabExcessSpace)  
    PWWidget setHeight​(int height)  
    PWWidget setIndent​(int indent)  
    PWWidget setWidth​(int width)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • PWWidget

      protected PWWidget​(java.lang.String label, java.lang.String propertyKey, int numberOfColumns, boolean singleWidget)
      Constructor
      Parameters:
      label - label associated to the widget
      propertyKey - property key binded to the widget
      numberOfColumns - number of columns taken by the widget
      singleWidget - if true, the widget is supposed to be "alone" (used for placement)
  • Method Details

    • build

      protected abstract org.eclipse.swt.widgets.Control build​(org.eclipse.swt.widgets.Composite parent)
      Build the widget
      Parameters:
      parent - parent composite
      Returns:
      the created control
    • buildLabel

      protected void buildLabel​(org.eclipse.swt.widgets.Composite parent, int verticalAlignment)
      Build the label associated to the widget
      Parameters:
      parent - parent composite
      verticalAlignment - vertical alignment
    • check

      protected abstract void check()
      Check if the property can be binded to the widget
      Throws:
      java.lang.UnsupportedOperationException - if the property could not be binded to the widget
    • checkAndBuild

      public org.eclipse.swt.widgets.Control checkAndBuild​(org.eclipse.swt.widgets.Composite parent)
      Check if the property can be binded to the widget, then build the widget
      Parameters:
      parent - parent composite
      Returns:
      the created control
    • enableOrDisable

      public boolean enableOrDisable()
      Enable or disable the widget, depending on the associated enabler
    • getAlignment

      public int getAlignment()
      Returns:
      the alignment (GridData.BEGINNING, GridData.CENTER, GridData.END, GridData.FILL)
    • getControls

      public java.util.List<org.eclipse.swt.widgets.Control> getControls()
      Returns:
      the list of controls contained in the widget
    • isGrabExcessSpace

      public boolean isGrabExcessSpace()
      Returns:
      true if the widget should grab the excess space
    • getHeight

      public int getHeight()
      Returns:
      the height of the widget
    • getIndent

      public int getIndent()
      Returns:
      the indentation space of the widget
    • getLabel

      public java.lang.String getLabel()
      Returns:
      the label associated to the widget (may be null)
    • getNumberOfColumns

      public int getNumberOfColumns()
      Returns:
      the number of columns associated to the widget
    • getPropertyKey

      java.lang.String getPropertyKey()
      Returns:
      the propertyKey associated to the widget
    • getWidth

      public int getWidth()
      Returns:
      the width of the widget
    • isSingleWidget

      public boolean isSingleWidget()
      Returns:
      true if the widget is "alone"
    • addControl

      protected void addControl​(org.eclipse.swt.widgets.Control control)
      Adds a control to the list of control contained in the widget
      Parameters:
      control - control to add
    • setAlignment

      public PWWidget setAlignment​(int alignment)
      Parameters:
      alignment - the alignment to set (GridData.BEGINNING, GridData.CENTER, GridData.END, GridData.FILL)
      Returns:
      the widget
    • setEnabler

      public PWWidget setEnabler​(Enabler enabler)
      Parameters:
      enabler - the enabler to set
      Returns:
      the widget
    • setGrabExcessSpace

      public PWWidget setGrabExcessSpace​(boolean grabExcessSpace)
      Parameters:
      grabExcessSpace - true if you want the widget to grab the excess space
      Returns:
      the widget
    • setHeight

      public PWWidget setHeight​(int height)
      Parameters:
      height - the height to set
      Returns:
      the widget
    • setIndent

      public PWWidget setIndent​(int indent)
      Parameters:
      indent - the indentation space to set
      Returns:
      the widget
    • setWidth

      public PWWidget setWidth​(int width)
      Parameters:
      width - the width to set
      Returns:
      the widget