* Dialog field describing a separator.
*/
public class Separator extends DialogField {
-
+
private Label fSeparator;
+
private int fStyle;
-
+
public Separator() {
this(SWT.NONE);
- }
-
+ }
+
/**
- * @param style of the separator. See <code>Label</code> for possible
- * styles.
+ * @param style
+ * of the separator. See <code>Label</code> for possible
+ * styles.
*/
public Separator(int style) {
super();
- fStyle= style;
+ fStyle = style;
}
-
+
// ------- layout helpers
/**
* Creates the separator and fills it in a MGridLayout.
- * @param height The heigth of the separator
- */
+ *
+ * @param height
+ * The heigth of the separator
+ */
public Control[] doFillIntoGrid(Composite parent, int nColumns, int height) {
assertEnoughColumns(nColumns);
-
- Control separator= getSeparator(parent);
+
+ Control separator = getSeparator(parent);
separator.setLayoutData(gridDataForSeperator(nColumns, height));
-
+
return new Control[] { separator };
}
/*
* @see DialogField#doFillIntoGrid
- */
+ */
public Control[] doFillIntoGrid(Composite parent, int nColumns) {
return doFillIntoGrid(parent, nColumns, 4);
}
/*
* @see DialogField#getNumberOfControls
- */
+ */
public int getNumberOfControls() {
- return 1;
+ return 1;
}
-
+
protected static GridData gridDataForSeperator(int span, int height) {
- GridData gd= new GridData();
- gd.horizontalAlignment= GridData.FILL;
- gd.verticalAlignment= GridData.BEGINNING;
- gd.heightHint= height;
- gd.horizontalSpan= span;
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.BEGINNING;
+ gd.heightHint = height;
+ gd.horizontalSpan = span;
return gd;
}
-
- // ------- ui creation
+
+ // ------- ui creation
/**
* Creates or returns the created separator.
- * @param parent The parent composite or <code>null</code> if the widget has
- * already been created.
- */
+ *
+ * @param parent
+ * The parent composite or <code>null</code> if the widget has
+ * already been created.
+ */
public Control getSeparator(Composite parent) {
if (fSeparator == null) {
assertCompositeNotNull(parent);
- fSeparator= new Label(parent, fStyle);
- }
+ fSeparator = new Label(parent, fStyle);
+ }
return fSeparator;
}