bibliothek.gui.dock.util
Interface WindowProvider

All Known Implementing Classes:
AbstractWindowProvider, AppletWindowProvider, ComponentWindowProvider, DirectWindowProvider, FocusedWindowProvider, NullWindowProvider, WindowProviderWrapper

public interface WindowProvider

A window provider has somehow access to one or many Windows and can provide anyone which needs a window with one.

Author:
Benjamin Sigg

Method Summary
 void addWindowProviderListener(WindowProviderListener listener)
          Adds a new listener to this provider.
 boolean isShowing()
          Tells whether this WindowProvider represents a window that is visible.
 void removeWindowProviderListener(WindowProviderListener listener)
          Removes a listener from this provider
 Window searchWindow()
          Tries to find a window.
 

Method Detail

searchWindow

Window searchWindow()
Tries to find a window. The result should either be a Frame or a Dialog, and a plain Window only as last resort. If possible the main-frame or another important window that will not be closed soon should be returned. Visible windows are preferred over non visible ones. This method is not guaranteed to have success, null is a valid result. This method is not required to return always the same window, however the WindowProviderListeners should be informed when the result changes.

Returns:
if possible a visible Frame which won't be closed in the near future, any window which does not fulfill the requirements or null if no window is available at all.

isShowing

boolean isShowing()
Tells whether this WindowProvider represents a window that is visible. Under normal circumstances this method would return:
Window window = sarchWindow();
return window == null ? false : window.isShowing();

This method is explicitly allowed to return any value it likes. The result of this method does not have to correspond with reality.

Returns:
whether this providers window is visible or not

addWindowProviderListener

void addWindowProviderListener(WindowProviderListener listener)
Adds a new listener to this provider. The listener should be called when the window provided by this object changes.

Parameters:
listener - the new listener

removeWindowProviderListener

void removeWindowProviderListener(WindowProviderListener listener)
Removes a listener from this provider

Parameters:
listener - the listener to remove