org.opensubsystems.core.application.swt
Class ShellUtils

java.lang.Object
  extended by org.opensubsystems.core.application.swt.ShellUtils

public final class ShellUtils
extends java.lang.Object

Set of utility methods to work with SWT shells.

Version:
$Id: ShellUtils.java,v 1.4 2007/01/07 06:14:22 bastafidli Exp $
Author:
Miro Halas
Code reviewer:
Miro Halas
Code reviewed:
1.2 2006/02/16 14:41:45 bastafidli

Field Summary
static int SPACE_BETWEEN_DIALOGS
          How mach space to put between this and parent dialog when positioned next to each other.
 
Method Summary
static org.eclipse.swt.graphics.Point centerParentChilShells(org.eclipse.swt.widgets.Shell parent, org.eclipse.swt.widgets.Shell dialog, org.eclipse.swt.graphics.Rectangle outsideBoundingArea)
          Center one shell in the bounding area while the other shell is also visible.
static void centerShell(org.eclipse.swt.widgets.Shell client, org.eclipse.swt.graphics.Rectangle parentRect)
          Center one shell above another
static void centerShell(org.eclipse.swt.widgets.Shell client, org.eclipse.swt.widgets.Shell parent)
          Center one shell above another
static org.eclipse.swt.graphics.Rectangle getAdjustedClientArea(org.eclipse.swt.widgets.Shell client)
          The client area given by SWT method doesn't reflect position.
static int getTableClientWidth(org.eclipse.swt.widgets.Table source)
          Compute the width of the table client area taking into account scrollbar and OS deficiencies.
static void runAfterOpened(org.eclipse.swt.widgets.Shell window, java.lang.Runnable startupCode)
          Run some code immidiately after the shell was opened and displayed on the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_BETWEEN_DIALOGS

public static final int SPACE_BETWEEN_DIALOGS
How mach space to put between this and parent dialog when positioned next to each other.

See Also:
Constant Field Values
Method Detail

getAdjustedClientArea

public static org.eclipse.swt.graphics.Rectangle getAdjustedClientArea(org.eclipse.swt.widgets.Shell client)
The client area given by SWT method doesn't reflect position. This method returns client area with position (x, y) adjusted to real position.

Parameters:
client - - shell for which we want to get the area
Returns:
Rectangle - client area with real position

centerShell

public static void centerShell(org.eclipse.swt.widgets.Shell client,
                               org.eclipse.swt.widgets.Shell parent)
Center one shell above another

Parameters:
client - - shell to center
parent - - shell to center above

centerShell

public static void centerShell(org.eclipse.swt.widgets.Shell client,
                               org.eclipse.swt.graphics.Rectangle parentRect)
Center one shell above another

Parameters:
client - - shell to center
parentRect - - rectangle bounding parent area

runAfterOpened

public static void runAfterOpened(org.eclipse.swt.widgets.Shell window,
                                  java.lang.Runnable startupCode)
Run some code immidiately after the shell was opened and displayed on the screen.

Parameters:
window - - window for which we are waiting to open
startupCode - - code which should be run

centerParentChilShells

public static org.eclipse.swt.graphics.Point centerParentChilShells(org.eclipse.swt.widgets.Shell parent,
                                                                    org.eclipse.swt.widgets.Shell dialog,
                                                                    org.eclipse.swt.graphics.Rectangle outsideBoundingArea)
Center one shell in the bounding area while the other shell is also visible.

Parameters:
parent - - shell which should be also visible when the dialog is centered in the bounded area
dialog - - dialog which should be visible while also parent should be made visible
outsideBoundingArea - - this is the area to which the parent dialog and this dialog should be bounded. In that case this dialog will position the parent and itself so that both are visible
Returns:
Point - original location of the parent shell

getTableClientWidth

public static int getTableClientWidth(org.eclipse.swt.widgets.Table source)
Compute the width of the table client area taking into account scrollbar and OS deficiencies.

Parameters:
source - - table to calculate
Returns:
int - width of client area


Copyright © 2003 - 2006 OpenSubsystems s.r.o.