org.eclipse.ocl.examples.debug.ui.pages
Class SWTFactory

java.lang.Object
  extended by org.eclipse.ocl.examples.debug.ui.pages.SWTFactory

public class SWTFactory
extends java.lang.Object

Based on the SWTFactory from JDT.


Constructor Summary
SWTFactory()
           
 
Method Summary
static org.eclipse.swt.widgets.Button createCheckButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label, org.eclipse.swt.graphics.Image image, boolean checked, int hspan)
          Creates a check box button using the parents' font
static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Font font, int columns, int hspan, int fill, int marginwidth, int marginheight)
          Creates a Composite widget
static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int columns, int hspan, int fill)
          Creates a Group widget
static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int hspan)
          Creates a new label widget
static org.eclipse.swt.widgets.Button createRadioButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int hspan)
          Creates and returns a new radio button with the given label.
static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent, int style, int hspan, java.lang.String text)
          Creates a new text widget
static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
          Returns a width hint for a button control.
static void setButtonDimensionHint(org.eclipse.swt.widgets.Button button)
          Sets width and height hint for the button control.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTFactory

public SWTFactory()
Method Detail

createText

public static org.eclipse.swt.widgets.Text createText(org.eclipse.swt.widgets.Composite parent,
                                                      int style,
                                                      int hspan,
                                                      java.lang.String text)
Creates a new text widget

Parameters:
parent - the parent composite to add this text widget to
style - the style bits for the text widget
hspan - the horizontal span to take up on the parent composite
text - the initial text, not null
Returns:
the new text widget

createComposite

public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent,
                                                                org.eclipse.swt.graphics.Font font,
                                                                int columns,
                                                                int hspan,
                                                                int fill,
                                                                int marginwidth,
                                                                int marginheight)
Creates a Composite widget

Parameters:
parent - the parent composite to add this composite to
columns - the number of columns within the composite
hspan - the horizontal span the composite should take up on the parent
fill - the style for how this composite should fill into its parent Can be one of GridData.FILL_HORIZONAL, GridData.FILL_BOTH or GridData.FILL_VERTICAL
marginwidth - the width of the margin to place around the composite (default is 5, specified by GridLayout)
marginheight - the height of the margin to place around the composite (default is 5, specified by GridLayout)
Returns:
the new group

createCheckButton

public static org.eclipse.swt.widgets.Button createCheckButton(org.eclipse.swt.widgets.Composite parent,
                                                               java.lang.String label,
                                                               org.eclipse.swt.graphics.Image image,
                                                               boolean checked,
                                                               int hspan)
Creates a check box button using the parents' font

Parameters:
parent - the parent to add the button to
label - the label for the button
image - the image for the button
checked - the initial checked state of the button
hspan - the horizontal span to take up in the parent composite
Returns:
a new checked button set to the initial checked state

createLabel

public static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent,
                                                        java.lang.String text,
                                                        int hspan)
Creates a new label widget

Parameters:
parent - the parent composite to add this label widget to
text - the text for the label
hspan - the horizontal span to take up in the parent composite
Returns:
the new label

createRadioButton

public static org.eclipse.swt.widgets.Button createRadioButton(org.eclipse.swt.widgets.Composite parent,
                                                               java.lang.String label,
                                                               int hspan)
Creates and returns a new radio button with the given label.

Parameters:
parent - parent control
label - button label or null
hspan - the number of columns to span in the parent composite
Returns:
a new radio button

createGroup

public static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent,
                                                        java.lang.String text,
                                                        int columns,
                                                        int hspan,
                                                        int fill)
Creates a Group widget

Parameters:
parent - the parent composite to add this group to
text - the text for the heading of the group
columns - the number of columns within the group
hspan - the horizontal span the group should take up on the parent
fill - the style for how this composite should fill into its parent Can be one of GridData.FILL_HORIZONAL, GridData.FILL_BOTH or GridData.FILL_VERTICAL
Returns:
the new group

setButtonDimensionHint

public static void setButtonDimensionHint(org.eclipse.swt.widgets.Button button)
Sets width and height hint for the button control. Note: This is a NOP if the button's layout data is not an instance of GridData.

Parameters:
button - button for which to set the dimension hint

getButtonWidthHint

public static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
Returns a width hint for a button control.