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 private int
alignment
private java.util.List<org.eclipse.swt.widgets.Control>
controls
protected Enabler
enabler
private boolean
grabExcessSpace
private int
height
private int
indent
private java.lang.String
label
protected int
numberOfColumns
private java.lang.String
propertyKey
private boolean
singleWidget
private int
width
-
Constructor Summary
Constructors Modifier Constructor Description protected
PWWidget(java.lang.String label, java.lang.String propertyKey, int numberOfColumns, boolean singleWidget)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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 widgetprotected abstract org.eclipse.swt.widgets.Control
build(org.eclipse.swt.widgets.Composite parent)
Build the widgetprotected void
buildLabel(org.eclipse.swt.widgets.Composite parent, int verticalAlignment)
Build the label associated to the widgetprotected abstract void
check()
Check if the property can be binded to the widgetorg.eclipse.swt.widgets.Control
checkAndBuild(org.eclipse.swt.widgets.Composite parent)
Check if the property can be binded to the widget, then build the widgetboolean
enableOrDisable()
Enable or disable the widget, depending on the associated enablerint
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)
-
-
-
Field Detail
-
propertyKey
private final java.lang.String propertyKey
-
label
private final java.lang.String label
-
enabler
protected Enabler enabler
-
controls
private final java.util.List<org.eclipse.swt.widgets.Control> controls
-
alignment
private int alignment
-
indent
private int indent
-
width
private int width
-
height
private int height
-
numberOfColumns
protected int numberOfColumns
-
grabExcessSpace
private boolean grabExcessSpace
-
singleWidget
private boolean singleWidget
-
-
Constructor Detail
-
PWWidget
protected PWWidget(java.lang.String label, java.lang.String propertyKey, int numberOfColumns, boolean singleWidget)
Constructor- Parameters:
label
- label associated to the widgetpropertyKey
- property key binded to the widgetnumberOfColumns
- number of columns taken by the widgetsingleWidget
- if true, the widget is supposed to be "alone" (used for placement)
-
-
Method Detail
-
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 compositeverticalAlignment
- 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
-
-