org.springframework.richclient.application
Class WindowManager

java.lang.Object
  extended by java.util.Observable
      extended by org.springframework.richclient.application.WindowManager
All Implemented Interfaces:
PropertyChangePublisher

public class WindowManager
extends Observable
implements PropertyChangePublisher

A manager for a group of windows. Window managers are needed in applications which create many different windows in addition to a main window. A window manager can be used to remember all the windows that an application has created (independent of whether they are presently open or closed). There can be several window managers, and they can be arranged into a tree. This kind of organization makes it simple to close whole subgroupings of windows.

Associating a window with a window manager is done with WindowManager.add(Window). A window is automatically removed from its window manager as a side effect of closing the window.

See Also:
Window

Constructor Summary
WindowManager()
          Creates an empty window manager without a parent window manager (that is, a root window manager).
WindowManager(WindowManager parent)
          Creates an empty window manager with the given window manager as parent.
 
Method Summary
 void add(ApplicationWindow window)
          Adds the given window to the set of windows managed by this window manager.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Register a listener to all properties of this publisher.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Register a listener to a specific property.
 boolean close()
          Attempts to close all windows managed by this window manager, as well as windows managed by any descendent window managers.
 ApplicationWindow getActiveWindow()
           
protected  PropertyChangeSupport getChangeSupport()
           
 WindowManager getParent()
           
 ApplicationWindow[] getWindows()
          Returns this window manager's set of windows.
 void remove(ApplicationWindow window)
          Removes the given window from the set of windows managed by this window manager.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove the listener from all properties of this publisher.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove the listener from a specific property.
 void setActiveWindow(ApplicationWindow window)
          Set the currently active window.
 int size()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowManager

public WindowManager()
Creates an empty window manager without a parent window manager (that is, a root window manager).


WindowManager

public WindowManager(WindowManager parent)
Creates an empty window manager with the given window manager as parent.

Parameters:
parent - the parent window manager
Method Detail

add

public void add(ApplicationWindow window)
Adds the given window to the set of windows managed by this window manager. Does nothing is this window is already managed by this window manager.

Parameters:
window - the window

close

public boolean close()
Attempts to close all windows managed by this window manager, as well as windows managed by any descendent window managers.

Returns:
true if all windows were sucessfully closed, and false if any window refused to close

getWindows

public ApplicationWindow[] getWindows()
Returns this window manager's set of windows.

Returns:
a possibly empty list of window

getParent

public WindowManager getParent()
Returns:
the parent of this WindowManager

remove

public final void remove(ApplicationWindow window)
Removes the given window from the set of windows managed by this window manager. Does nothing is this window is not managed by this window manager.

Parameters:
window - the window

setActiveWindow

public final void setActiveWindow(ApplicationWindow window)
Set the currently active window. When a window gets focus, it will set itself as the current window of it's manager.

Parameters:
window -

getActiveWindow

public final ApplicationWindow getActiveWindow()
Returns:
the active window.

size

public int size()
Returns:
Number of windows managed by this instance.

getChangeSupport

protected PropertyChangeSupport getChangeSupport()

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Register a listener to all properties of this publisher.

Specified by:
addPropertyChangeListener in interface PropertyChangePublisher
Parameters:
listener - the PropertyChangeListener to register.

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Register a listener to a specific property.

Specified by:
addPropertyChangeListener in interface PropertyChangePublisher
Parameters:
propertyName - the property to monitor.
listener - the PropertyChangeListener to register.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Remove the listener from all properties of this publisher.

Specified by:
removePropertyChangeListener in interface PropertyChangePublisher
Parameters:
listener - the PropertyChangeListener to remove.

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Description copied from interface: PropertyChangePublisher
Remove the listener from a specific property.

Specified by:
removePropertyChangeListener in interface PropertyChangePublisher
Parameters:
propertyName - the property that was being monitored.
listener - the PropertyChangeListener to remove.


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.