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.ObjectThis class is the root class for all widgets that take part of a preference window
-
-
Field Summary
Fields Modifier and Type Field Description private intalignmentprivate java.util.List<org.eclipse.swt.widgets.Control>controlsprotected Enablerenablerprivate booleangrabExcessSpaceprivate intheightprivate intindentprivate java.lang.Stringlabelprotected intnumberOfColumnsprivate java.lang.StringpropertyKeyprivate booleansingleWidgetprivate intwidth
-
Constructor Summary
Constructors Modifier Constructor Description protectedPWWidget(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 voidaddControl(org.eclipse.swt.widgets.Control control)Adds a control to the list of control contained in the widgetprotected abstract org.eclipse.swt.widgets.Controlbuild(org.eclipse.swt.widgets.Composite parent)Build the widgetprotected voidbuildLabel(org.eclipse.swt.widgets.Composite parent, int verticalAlignment)Build the label associated to the widgetprotected abstract voidcheck()Check if the property can be binded to the widgetorg.eclipse.swt.widgets.ControlcheckAndBuild(org.eclipse.swt.widgets.Composite parent)Check if the property can be binded to the widget, then build the widgetbooleanenableOrDisable()Enable or disable the widget, depending on the associated enablerintgetAlignment()java.util.List<org.eclipse.swt.widgets.Control>getControls()intgetHeight()intgetIndent()java.lang.StringgetLabel()intgetNumberOfColumns()(package private) java.lang.StringgetPropertyKey()intgetWidth()booleanisGrabExcessSpace()booleanisSingleWidget()PWWidgetsetAlignment(int alignment)PWWidgetsetEnabler(Enabler enabler)PWWidgetsetGrabExcessSpace(boolean grabExcessSpace)PWWidgetsetHeight(int height)PWWidgetsetIndent(int indent)PWWidgetsetWidth(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:
trueif 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:
trueif 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
-
-