All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bibliothek.gui.dock.util.WindowProvider Maven / Gradle / Ivy

There is a newer version: 1.1.2p6a
Show newest version
/*
 * Bibliothek - DockingFrames
 * Library built on Java/Swing, allows the user to "drag and drop"
 * panels containing any Swing-Component the developer likes to add.
 * 
 * Copyright (C) 2008 Benjamin Sigg
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Benjamin Sigg
 * [email protected]
 * CH - Switzerland
 */
package bibliothek.gui.dock.util;

import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;

/**
 * A window provider has somehow access to one or many {@link Window}s and can
 * provide anyone which needs a window with one.
 * @author Benjamin Sigg
 */
public interface WindowProvider {
    /**
     * Tries to find a window. The result should either be a {@link Frame}
     * or a {@link Dialog}, and a plain {@link 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 {@link WindowProviderListener}s
     * should be informed when the result changes.
     * @return if possible a visible {@link 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. 
     */
    public Window searchWindow();
    
    /**
     * Tells whether this window 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. * @return whether this providers window is visible or not */ public boolean isShowing(); /** * Adds a new listener to this provider. The listener should be called * when the window provided by this object changes. * @param listener the new listener */ public void addWindowProviderListener( WindowProviderListener listener ); /** * Removes a listener from this provider * @param listener the listener to remove */ public void removeWindowProviderListener( WindowProviderListener listener ); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy