dsto.dfc.swt.controls
Class NiceWindow

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by dsto.dfc.swt.controls.NiceWindow
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
Direct Known Subclasses:
AbstractDashboardPanel

public class NiceWindow
extends org.eclipse.jface.window.Window

Base class for "nice" windows that remember their last location and/or size. Subclasses can set "sizeProperty" and/or "locationProperty" to be the name of the properties used to store size and location (null means no save). Subclasses may also override savePreferences() to store other persistent window properties.

Version:
$Revision$
Author:
mpp

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
protected static DataBean GLOBAL_PREFERENCES
          The global preferences store used by all windows that don't have an explicit preferences set.
protected  String locationProperty
          The name of the property in the preferences that stores the window size (null = no save).
protected  IDataBean preferences
          The window's preferences store.
protected  String sizeProperty
          The name of the property in the preferences that stores the window location (null = no save).
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
NiceWindow(org.eclipse.swt.widgets.Shell parentShell)
           
NiceWindow(org.eclipse.swt.widgets.Shell parentShell, IDataBean preferences)
           
 
Method Summary
 boolean close()
           
protected  org.eclipse.swt.graphics.Point getDefaultLocation(org.eclipse.swt.graphics.Point initialSize)
           
protected  org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point initialSize)
           
protected  org.eclipse.swt.graphics.Point getInitialSize()
           
protected  void initializeBounds()
          Override superclass version since it "optimizes" the initial position/size logic away after first call.
protected  void savePreferences()
          Save the window preferences.
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, configureShell, constrainShellSize, create, createContents, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_PREFERENCES

protected static final DataBean GLOBAL_PREFERENCES
The global preferences store used by all windows that don't have an explicit preferences set.


preferences

protected IDataBean preferences
The window's preferences store. Initialized to GLOBAL_PREFERENCES if none set.


sizeProperty

protected String sizeProperty
The name of the property in the preferences that stores the window location (null = no save).


locationProperty

protected String locationProperty
The name of the property in the preferences that stores the window size (null = no save).

Constructor Detail

NiceWindow

public NiceWindow(org.eclipse.swt.widgets.Shell parentShell)

NiceWindow

public NiceWindow(org.eclipse.swt.widgets.Shell parentShell,
                  IDataBean preferences)
Method Detail

getInitialSize

protected org.eclipse.swt.graphics.Point getInitialSize()
Overrides:
getInitialSize in class org.eclipse.jface.window.Window

getInitialLocation

protected org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point initialSize)
Overrides:
getInitialLocation in class org.eclipse.jface.window.Window

getDefaultLocation

protected org.eclipse.swt.graphics.Point getDefaultLocation(org.eclipse.swt.graphics.Point initialSize)

close

public boolean close()
Overrides:
close in class org.eclipse.jface.window.Window

initializeBounds

protected void initializeBounds()
Override superclass version since it "optimizes" the initial position/size logic away after first call. This version works correctly over an open/close cycle.

Overrides:
initializeBounds in class org.eclipse.jface.window.Window

savePreferences

protected void savePreferences()
Save the window preferences. Subclasses may override.



Copyright © 2008 Commonwealth of Australia