|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.swt.SWTUtils
public class SWTUtils
Miscellaneous SWT utilities.
Field Summary | |
---|---|
static java.lang.String |
CONTROL_ID
|
static int |
IMG_BOTTOM
|
static int |
IMG_CENTER
|
static int |
IMG_LEFT
|
static int |
IMG_MOSAIC
|
static int |
IMG_RIGHT
|
static int |
IMG_STRETCH
|
static int |
IMG_TOP
|
static int |
PLATFORM_CARBON
|
static int |
PLATFORM_GTK
|
static int |
PLATFORM_UNKNOWN
|
static int |
PLATFORM_WIN32
|
Constructor Summary | |
---|---|
SWTUtils()
|
Method Summary | |
---|---|
static void |
disposeChilden(org.eclipse.swt.widgets.Composite parent)
Given a parent control (Composite) this utility method will get all first layer children of the parent and call the dispose method on each child Control. |
static void |
drawImage(org.eclipse.swt.graphics.GC g,
int hAlign,
int vAlign,
org.eclipse.swt.graphics.Image image,
org.eclipse.swt.graphics.Rectangle bounds,
org.eclipse.swt.graphics.Color fillColor)
|
static org.eclipse.swt.graphics.Color |
getBackgroundColor(org.eclipse.swt.widgets.Control controlViewer)
Returns a background color for a given control, depending on high contrast. |
static java.lang.String |
getControlId(org.eclipse.swt.widgets.Widget control)
Given a widget this utility method will return the programmatic ID associated with the control if one has been assigned. |
static int |
getPlatform()
Returns the platform that the code is running. |
static boolean |
isChildOf(org.eclipse.swt.widgets.Control c,
org.eclipse.swt.widgets.Control parent)
Calculates if the provided parent is in the parent hierarchy of the given Control. |
static boolean |
isInDialog(org.eclipse.swt.widgets.Control control)
Test the given control to determine if it is a in dialog or not. |
static void |
setBackgroundColor(org.eclipse.swt.widgets.Control parent)
Sets the background color of all of the control's children to the current color of the provided parent control. |
static void |
setBackgroundColor(org.eclipse.swt.widgets.Control parent,
org.eclipse.swt.graphics.Color color)
Recursively walks down through the hierarchy of controls under the given parent setting the background color provided on each control encountered. |
static void |
setBackgroundColor(org.eclipse.swt.widgets.Control parent,
org.eclipse.swt.graphics.Color color,
boolean checkEnabled)
Recursively sets the background color of all of the children of the provided parent Control. |
static void |
setControlId(org.eclipse.swt.widgets.Widget control,
java.lang.String id)
This utility method associates an ID with the provided Widget. |
static void |
setControlIdFromAttribute(org.eclipse.swt.widgets.Widget control,
java.lang.String attrName)
|
static void |
setEnabled(org.eclipse.swt.widgets.Control control,
boolean state)
Recursively walks through the children of the control provided and finally the control itself calling the Control.setEnabled(state) method on each control it encounters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONTROL_ID
public static final int PLATFORM_UNKNOWN
public static final int PLATFORM_WIN32
public static final int PLATFORM_GTK
public static final int PLATFORM_CARBON
public static final int IMG_LEFT
public static final int IMG_TOP
public static final int IMG_CENTER
public static final int IMG_RIGHT
public static final int IMG_BOTTOM
public static final int IMG_MOSAIC
public static final int IMG_STRETCH
Constructor Detail |
---|
public SWTUtils()
Method Detail |
---|
public static java.lang.String getControlId(org.eclipse.swt.widgets.Widget control)
control
-
public static void setControlId(org.eclipse.swt.widgets.Widget control, java.lang.String id)
Widget.setData(..)
method
to associate the ID with the widget.
control
- id
- public static void setControlIdFromAttribute(org.eclipse.swt.widgets.Widget control, java.lang.String attrName)
public static void disposeChilden(org.eclipse.swt.widgets.Composite parent)
parent
- Composite
A composite control that contains childrenpublic static boolean isChildOf(org.eclipse.swt.widgets.Control c, org.eclipse.swt.widgets.Control parent)
c
- Control
Control whose parent hierarchy is to be examinedparent
- Control
Control against which the provided child control will be tested
public static int getPlatform()
SWT.getPlatform()
public static final void drawImage(org.eclipse.swt.graphics.GC g, int hAlign, int vAlign, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Rectangle bounds, org.eclipse.swt.graphics.Color fillColor)
public static void setEnabled(org.eclipse.swt.widgets.Control control, boolean state)
Control.setEnabled(state)
method on each control it encounters.
control
- Control
The parent Controlstate
- boolean
The enabled state (true to enable all controls)public static boolean isInDialog(org.eclipse.swt.widgets.Control control)
control
- -
control to test, may not be null.
public static org.eclipse.swt.graphics.Color getBackgroundColor(org.eclipse.swt.widgets.Control controlViewer)
control
- Control
The control whose background color needs to be obtained
public static void setBackgroundColor(org.eclipse.swt.widgets.Control parent, org.eclipse.swt.graphics.Color color)
parent
- Control
The parent whose children we wish to set the background colorcolor
- Color
The background color we wish to setpublic static void setBackgroundColor(org.eclipse.swt.widgets.Control parent, org.eclipse.swt.graphics.Color color, boolean checkEnabled)
parent
- Control
Parent controlcolor
- Color
The new background color that we wish to setcheckEnabled
- boolean
If set to true then this method will not change the color of any control that is disabled.public static void setBackgroundColor(org.eclipse.swt.widgets.Control parent)
parent
- Control
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |