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 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 Details
-
enabler
-
numberOfColumns
protected int numberOfColumns
-
-
Constructor Details
-
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 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 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
- Parameters:
alignment
- the alignment to set (GridData.BEGINNING, GridData.CENTER, GridData.END, GridData.FILL)- Returns:
- the widget
-
setEnabler
- Parameters:
enabler
- the enabler to set- Returns:
- the widget
-
setGrabExcessSpace
- Parameters:
grabExcessSpace
- true if you want the widget to grab the excess space- Returns:
- the widget
-
setHeight
- Parameters:
height
- the height to set- Returns:
- the widget
-
setIndent
- Parameters:
indent
- the indentation space to set- Returns:
- the widget
-
setWidth
- Parameters:
width
- the width to set- Returns:
- the widget
-