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

bibliothek.gui.dock.action.ActionOffer Maven / Gradle / Ivy

The 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) 2007 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.action;

import bibliothek.gui.DockController;
import bibliothek.gui.Dockable;

/**
 * An ActionOffer creates a {@link DockActionSource} for a {@link Dockable}. An ActionOffer
 * is {@link DockController#addActionOffer(ActionOffer) added} to the {@link DockController}. When the {@link Dockable}s method
 * {@link Dockable#getGlobalActionOffers()} is called, the Dockable most often will call
 * {@link DockController#listOffers(Dockable)} to create the list of actions. This method in return will call
 * {@link #getSource(Dockable, DockActionSource, DockActionSource[], DockActionSource, DockActionSource[])} on the first
 * {@link ActionOffer} which is {@link #interested(Dockable)} in the {@link Dockable}.
 * @author Benjamin Sigg
 * @see DockController#addActionOffer(ActionOffer)
 * @see DockController#removeActionOffer(ActionOffer)
 */
public interface ActionOffer {
    /**
     * Tells whether this ActionOffer wants to collect the 
     * actions for the dockable, or if this ActionOffer
     * is not interested in the {@link Dockable}.
     * @param dockable The {@link Dockable} to test
     * @return true if this ActionOffer should tell which
     * {@link DockAction actions} will be associated with the dockable,
     * false otherwise. 
     */
    public boolean interested( Dockable dockable );
    
    /**
     * Generates one {@link DockActionSource source} of {@link DockAction actions}
     * for the given {@link Dockable}. The ActionOffer is free how to use the
     * actions that are created by other parts of the system, but it is a good
     * idea to use all of them. Note that each argument, and each element in
     * an array, can be null.
     * @param dockable The {@link Dockable} for which the the {@link DockActionSource source}
     * has to be created. An invocation of {@link #interested(Dockable) interested}
     * should return true, otherwise the behavior of this method
     * is not specified.
     * @param source the DockActionSource derived from dockable
     * @param guards a list of DockActionSources derived from {@link ActionGuard ActionGuards} 
     * @param parent the DockActionSource derived from the parent of dockable
     * @param parents a list of DockActionSources derived from all parents of dockable
     * @return The source that was created.
     */
    public DockActionSource getSource( Dockable dockable, DockActionSource source, DockActionSource[] guards, DockActionSource parent, DockActionSource[] parents );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy