|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.gui.swt.SwtUtil
This class consists of common swt utility methods. This is the place for small convenience methods, which should not be reimplemtented each time they are used.
| Nested Class Summary | |
static interface |
SwtUtil.CommandItem
The CommandItem encapsulates the basic behavior for an
item which is associated to a Command. |
static class |
SwtUtil.ItemCommand
TODO AH: Comment |
| Field Summary | |
static int |
SWT_VERSION_3_0
Supported Versions of SWT are 3.0 and 3.1 |
static int |
SWT_VERSION_3_1
Supported Versions of SWT are 3.0 and 3.1 |
static int |
SWT_VERSION_NOT_SUPPORTED
Supported Versions of SWT are 3.0 and 3.1 |
| Method Summary | |
static org.eclipse.swt.widgets.ToolItem |
addToToolBar(UIManager uiManager,
org.eclipse.swt.widgets.ToolBar toolbar,
Command command,
org.eclipse.swt.graphics.Image icon)
TODO AH: Comment method |
static boolean |
canWriteFormat(java.lang.String formatName)
Returns true if the specified format name can be written |
static void |
center(org.eclipse.swt.widgets.Control control)
Centers the given control relative to its display's monitor. |
static java.lang.String |
filterHtml(java.lang.String txt)
Filters out any html tags in the given String |
static int |
getKeyMask(org.eclipse.swt.events.MouseEvent event)
This routine returns the mask
corresponding to the passed .
|
static int |
getMouseButton(org.eclipse.swt.events.MouseEvent event)
Returns the mouse button from the given MouseEvent |
static int |
getSWTVersion()
Returns the version of SWT which is currently running. |
static boolean |
isXMLFile(java.io.File file)
Method isXMLFile reads the first line of the file and checks whether it starts with the typical xml definition. |
static boolean |
isXMLFile(java.io.InputStream is)
Method isXMLFile reads the first line of the file and checks whether it starts with the typical xml definition. |
static org.eclipse.swt.graphics.ImageData |
loadImage(java.lang.Class referenceClass,
java.lang.String imagepath)
|
static org.eclipse.swt.graphics.ImageData |
loadImage(java.net.URL url)
|
static boolean |
saveImageAs(org.eclipse.swt.graphics.Image image,
java.io.File file,
int format)
Saves image in file with format
format.
|
static boolean |
saveImageAs(org.eclipse.swt.graphics.Image image,
java.io.OutputStream os,
int format)
This method saves the passed image into an
.
|
static void |
showError(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title)
Shows a modal error dialog. |
static int |
showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message)
Method showYesNo shows a MessageBox with a Yes/No button
bar. |
static int |
showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title)
Method showYesNo shows a MessageBox with a Yes/No button
bar. |
static int |
showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title,
int messageType)
Method showYesNo shows a MessageBox with a Yes/No button
bar. |
static int |
showYesNoCancel(org.eclipse.swt.widgets.Shell parent,
java.lang.String message)
Method showYesNoCancel shows a messagebox with a
Yes/No/Cancel button bar. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int SWT_VERSION_3_0
public static final int SWT_VERSION_3_1
public static final int SWT_VERSION_NOT_SUPPORTED
| Method Detail |
public static final int getMouseButton(org.eclipse.swt.events.MouseEvent event)
MouseEvent
event - the given MouseEvent
MouseInfo.public static final int getKeyMask(org.eclipse.swt.events.MouseEvent event)
This routine returns the mask
corresponding to the passed KeyStroke.
MouseEvent
event - the MouseEvent from which the keymask
must be retrieved.
public static final boolean saveImageAs(org.eclipse.swt.graphics.Image image,
java.io.OutputStream os,
int format)
This method saves the passed image into an
.
OutputStream
image - this is the image to save.os - the OutputStream where the image is
saved.format - the file format. One of:
SWT.IMAGE_BMP
SWT.IMAGE_GIF
SWT.IMAGE_JPEG
SWT.IMAGE_PNG
true if the the operation was successful,
false otherwise.
public static final boolean saveImageAs(org.eclipse.swt.graphics.Image image,
java.io.File file,
int format)
Saves image in file with format
format.
image - this is the image to save.file - the destination fileformat - the file format. One of:
SWT.IMAGE_BMP
SWT.IMAGE_GIF
SWT.IMAGE_JPEG
SWT.IMAGE_PNG
true if the the operation was successful,
false otherwise.
public static final org.eclipse.swt.graphics.ImageData loadImage(java.lang.Class referenceClass,
java.lang.String imagepath)
public static final org.eclipse.swt.graphics.ImageData loadImage(java.net.URL url)
public static boolean canWriteFormat(java.lang.String formatName)
true if the specified format name can be written
formatName - the name of the format, for example gif.
true iff the format can be written.
public static final void showError(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title)
parent - the parent Shell for this message box.
If parent is null, the method tries to use a default shell.message - the message string to display in the dialog.title - The title string to display in the dialog.
public static int showYesNoCancel(org.eclipse.swt.widgets.Shell parent,
java.lang.String message)
showYesNoCancel shows a messagebox with a
Yes/No/Cancel button bar.
parent - the parent Shell for this message box.message - the message as String
SWT.YES
SWT.NO
SWT.CANCEL
public static int showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message)
showYesNo shows a MessageBox with a Yes/No button
bar.
parent - the parent Shell for this message box.message - the message as String
SWT.YES
SWT.NO
public static int showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title)
showYesNo shows a MessageBox with a Yes/No button
bar.
parent - the parent Shell for this message box.message - the message as String.title - the title for the MessageBox.
SWT.YES
SWT.NO
public static int showYesNo(org.eclipse.swt.widgets.Shell parent,
java.lang.String message,
java.lang.String title,
int messageType)
showYesNo shows a MessageBox with a Yes/No button
bar. This method allows you to change the icon, which is displayed on the
MessageBox.
parent - the parent component for this message box.message - the message as String.title - the title for the MessageBox.messageType - one of the following constants:
SWT.ICON_ERROR
SWT.ICON_INFORMATION
SWT.ICON_QUESTION
SWT.ICON_WARNING
SWT.ICON_WORKING
SWT.YES
SWT.NO
public static boolean isXMLFile(java.io.File file)
file - the File to examine.
true iff the file is an xml file.public static boolean isXMLFile(java.io.InputStream is)
is - the InputStream to examine
true iff the file is an xml file.
public static org.eclipse.swt.widgets.ToolItem addToToolBar(UIManager uiManager,
org.eclipse.swt.widgets.ToolBar toolbar,
Command command,
org.eclipse.swt.graphics.Image icon)
TODO AH: Comment method
uiManager - toolbar - command - icon -
public static final java.lang.String filterHtml(java.lang.String txt)
String
txt - a String probably containing html tags
String without html tagspublic static int getSWTVersion()
public static final void center(org.eclipse.swt.widgets.Control control)
control - the Control to be centered
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||