bibliothek.gui.dock.util
Class ComponentWindowProvider

java.lang.Object
  extended by bibliothek.gui.dock.util.AbstractWindowProvider
      extended by bibliothek.gui.dock.util.ComponentWindowProvider
All Implemented Interfaces:
WindowProvider
Direct Known Subclasses:
AppletWindowProvider

public class ComponentWindowProvider
extends AbstractWindowProvider

A window provider which just returns the ancestor window of some Component

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from class bibliothek.gui.dock.util.AbstractWindowProvider
listeners
 
Constructor Summary
ComponentWindowProvider(Component component)
          Creates a new provider
 
Method Summary
 void addWindowProviderListener(WindowProviderListener listener)
          Adds a new listener to this provider.
 Component getComponent()
          Gets the Component whose ancestor window is provided.
 void removeWindowProviderListener(WindowProviderListener listener)
          Removes a listener from this provider
 Window searchWindow()
          Tries to find a window.
 void setComponent(Component component)
          Sets the component whose ancestor window will be provided.
 
Methods inherited from class bibliothek.gui.dock.util.AbstractWindowProvider
fireVisibilityChanged, fireWindowChanged, hasListeners, isShowing, listeners, updateVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentWindowProvider

public ComponentWindowProvider(Component component)
Creates a new provider

Parameters:
component - the component whose ancestor will be provided, null is valid
Method Detail

addWindowProviderListener

public void addWindowProviderListener(WindowProviderListener listener)
Description copied from interface: WindowProvider
Adds a new listener to this provider. The listener should be called when the window provided by this object changes.

Specified by:
addWindowProviderListener in interface WindowProvider
Overrides:
addWindowProviderListener in class AbstractWindowProvider
Parameters:
listener - the new listener

removeWindowProviderListener

public void removeWindowProviderListener(WindowProviderListener listener)
Description copied from interface: WindowProvider
Removes a listener from this provider

Specified by:
removeWindowProviderListener in interface WindowProvider
Overrides:
removeWindowProviderListener in class AbstractWindowProvider
Parameters:
listener - the listener to remove

getComponent

public Component getComponent()
Gets the Component whose ancestor window is provided.

Returns:
the component or null

setComponent

public void setComponent(Component component)
Sets the component whose ancestor window will be provided.

Parameters:
component - the component or null

searchWindow

public Window searchWindow()
Description copied from interface: WindowProvider
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.