org.eparapher.rcp.tools
Class BaseWidgetUtils

java.lang.Object
  extended by org.eparapher.rcp.tools.BaseWidgetUtils

public class BaseWidgetUtils
extends Object

This class provides utility methods to create SWT widgets.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
BaseWidgetUtils()
           
 
Method Summary
static org.eclipse.swt.widgets.Button createButton(org.eclipse.swt.widgets.Composite parent, String text, org.eclipse.swt.graphics.Image img, int span)
          Creates a button under the given parent.
static org.eclipse.swt.widgets.Button createCheckbox(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a checkbox under the given parent.
static org.eclipse.swt.widgets.Composite createColumnContainer(org.eclipse.swt.widgets.Composite parent, int columnCount, int span)
          Creates a SWT Composite under the given parent.
static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, String[] items, int selectedIndex, int span)
          Creates a SWT Combo under the given parent.
static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent, String label, int span)
          Creates a SWT Group under the given parent.
static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Label under the given parent.
static org.eclipse.swt.widgets.Text createLabeledText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Text createLabeledText(org.eclipse.swt.widgets.Composite parent, String text, int span, int widthHint)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Link createLink(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Link under the given parent.
static org.eclipse.swt.widgets.Text createPasswordText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Button createRadiobutton(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a radio button under the given parent.
static void createRadioIndent(org.eclipse.swt.widgets.Composite parent, int span)
          Adds some space to indent radio buttons.
static org.eclipse.swt.widgets.Combo createReadonlyCombo(org.eclipse.swt.widgets.Composite parent, String[] items, int selectedIndex, int span)
          Creates a SWT Combo under the given parent.
static org.eclipse.swt.widgets.Text createReadonlyPasswordText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Text createReadonlyText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static void createSeparator(org.eclipse.swt.widgets.Composite parent, int span)
          Creates a separator line.
static void createSpacer(org.eclipse.swt.widgets.Composite parent, int span)
          Creates a spacer.
static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent, String text, int textWidth, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Label createWrappedLabel(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Label under the given parent.
static org.eclipse.swt.widgets.Text createWrappedLabeledText(org.eclipse.swt.widgets.Composite parent, String text, int span)
          Creates a SWT Text under the given parent.
static org.eclipse.swt.widgets.Text createWrappedLabeledText(org.eclipse.swt.widgets.Composite parent, String text, int span, int widthHint)
          Creates a SWT Text under the given parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseWidgetUtils

public BaseWidgetUtils()
Method Detail

createGroup

public static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent,
                                                        String label,
                                                        int span)
Creates a SWT Group under the given parent.

Parameters:
parent - the parent
label - the label of the group
span - the horizontal span
Returns:
the created group

createColumnContainer

public static org.eclipse.swt.widgets.Composite createColumnContainer(org.eclipse.swt.widgets.Composite parent,
                                                                      int columnCount,
                                                                      int span)
Creates a SWT Composite under the given parent. A GridLayout with the given number of columns is used.

Parameters:
parent - the parent
columnCount - the number of columns
span - the horizontal span
Returns:
the created composite

createLabel

public static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent,
                                                        String text,
                                                        int span)
Creates a SWT Label under the given parent.

Parameters:
parent - the parent
text - the label's text
span - the horizontal span
Returns:
the created label

createWrappedLabel

public static org.eclipse.swt.widgets.Label createWrappedLabel(org.eclipse.swt.widgets.Composite parent,
                                                               String text,
                                                               int span)
Creates a SWT Label under the given parent. The label is created with the SWT.WRAP style to enable line wrapping.

Parameters:
parent - the parent
text - the label's text
span - the horizontal span
Returns:
the created label

createText

public static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent,
                                                      String text,
                                                      int span)
Creates a SWT Text under the given parent. The created text control is modifyable.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createText

public static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent,
                                                      String text,
                                                      int textWidth,
                                                      int span)
Creates a SWT Text under the given parent. The created text control is modifyable.

Parameters:
parent - the parent
text - the initial text
textWidth - the width of the text control
span - the horizontal span
Returns:
the created text

createPasswordText

public static org.eclipse.swt.widgets.Text createPasswordText(org.eclipse.swt.widgets.Composite parent,
                                                              String text,
                                                              int span)
Creates a SWT Text under the given parent. The created text control is created with the SWT.PASSWORD style.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createReadonlyPasswordText

public static org.eclipse.swt.widgets.Text createReadonlyPasswordText(org.eclipse.swt.widgets.Composite parent,
                                                                      String text,
                                                                      int span)
Creates a SWT Text under the given parent. The created text control is created with the SWT.PASSWORD and SWT.READ_ONLY style. So the created controls is not modifyable.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createLabeledText

public static org.eclipse.swt.widgets.Text createLabeledText(org.eclipse.swt.widgets.Composite parent,
                                                             String text,
                                                             int span)
Creates a SWT Text under the given parent. The created text control behaves like a label: it has no border, a grayed background and is not modifyable. But the text is selectable and could be copied.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createLabeledText

public static org.eclipse.swt.widgets.Text createLabeledText(org.eclipse.swt.widgets.Composite parent,
                                                             String text,
                                                             int span,
                                                             int widthHint)
Creates a SWT Text under the given parent. The created text control behaves like a label: it has no border, a grayed background and is not modifyable. But the text is selectable and could be copied.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
widthHint - the width hint
Returns:
the created text

createWrappedLabeledText

public static org.eclipse.swt.widgets.Text createWrappedLabeledText(org.eclipse.swt.widgets.Composite parent,
                                                                    String text,
                                                                    int span)
Creates a SWT Text under the given parent. The created text control behaves like a label: it has no border, a grayed background and is not modifyable. But the text is selectable and could be copied. The label is created with the SWT.WRAP style to enable line wrapping.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createWrappedLabeledText

public static org.eclipse.swt.widgets.Text createWrappedLabeledText(org.eclipse.swt.widgets.Composite parent,
                                                                    String text,
                                                                    int span,
                                                                    int widthHint)
Creates a SWT Text under the given parent. The created text control behaves like a label: it has no border, a grayed background and is not modifyable. But the text is selectable and could be copied. The label is created with the SWT.WRAP style to enable line wrapping.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
widthHint - the width hint
Returns:
the created text

createReadonlyText

public static org.eclipse.swt.widgets.Text createReadonlyText(org.eclipse.swt.widgets.Composite parent,
                                                              String text,
                                                              int span)
Creates a SWT Text under the given parent. The text is not modifyable, but the text is selectable and could be copied.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text

createCombo

public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent,
                                                        String[] items,
                                                        int selectedIndex,
                                                        int span)
Creates a SWT Combo under the given parent. Beside the selection of an item it is also possible to type free text into the combo.

Parameters:
parent - the parent
items - the initial visible items
selectedIndex - the initial selected item, zero-based
span - the horizontal span
Returns:
the created combo

createReadonlyCombo

public static org.eclipse.swt.widgets.Combo createReadonlyCombo(org.eclipse.swt.widgets.Composite parent,
                                                                String[] items,
                                                                int selectedIndex,
                                                                int span)
Creates a SWT Combo under the given parent. It is not possible to type free text into the combo, only selection of predefined items is possible.

Parameters:
parent - the parent
items - the initial visible items
selectedIndex - the initial selected item, zero-based
span - the horizontal span
Returns:
the created combo

createCheckbox

public static org.eclipse.swt.widgets.Button createCheckbox(org.eclipse.swt.widgets.Composite parent,
                                                            String text,
                                                            int span)
Creates a checkbox under the given parent.

Parameters:
parent - the parent
text - the label of the checkbox
span - the horizontal span
Returns:
the created checkbox

createRadiobutton

public static org.eclipse.swt.widgets.Button createRadiobutton(org.eclipse.swt.widgets.Composite parent,
                                                               String text,
                                                               int span)
Creates a radio button under the given parent.

Parameters:
parent - the parent
text - the label of the radio button
span - the horizontal span
Returns:
the created radio button

createButton

public static org.eclipse.swt.widgets.Button createButton(org.eclipse.swt.widgets.Composite parent,
                                                          String text,
                                                          org.eclipse.swt.graphics.Image img,
                                                          int span)
Creates a button under the given parent. The button width is set to the default width.

Parameters:
parent - the parent
text - the label of the button
span - the horizontal span
Returns:
the created button

createRadioIndent

public static void createRadioIndent(org.eclipse.swt.widgets.Composite parent,
                                     int span)
Adds some space to indent radio buttons.

Parameters:
parent - the parent
span - the horizontal span

createSpacer

public static void createSpacer(org.eclipse.swt.widgets.Composite parent,
                                int span)
Creates a spacer.

Parameters:
parent - the parent
span - the horizontal span

createSeparator

public static void createSeparator(org.eclipse.swt.widgets.Composite parent,
                                   int span)
Creates a separator line.

Parameters:
parent - the parent
span - the horizontal span

createLink

public static org.eclipse.swt.widgets.Link createLink(org.eclipse.swt.widgets.Composite parent,
                                                      String text,
                                                      int span)
Creates a SWT Link under the given parent.

Parameters:
parent - the parent
text - the initial text
span - the horizontal span
Returns:
the created text


Copyright © 2009 eParapher Software Foundation. All Rights Reserved.