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

bibliothek.gui.dock.station.Combiner 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.station;

import bibliothek.gui.DockController;
import bibliothek.gui.DockStation;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.control.relocator.Inserter;
import bibliothek.gui.dock.control.relocator.Merger;
import bibliothek.gui.dock.layout.DockableProperty;
import bibliothek.gui.dock.layout.location.AsideRequest;
import bibliothek.gui.dock.station.support.CombinerSource;
import bibliothek.gui.dock.station.support.CombinerTarget;
import bibliothek.gui.dock.station.support.Enforcement;

/**
 * A Combiner merges two {@link Dockable Dockables} into
 * one {@link Dockable}. How this is done, is up to the Combiner, but
 * most Combiners will create a new {@link DockStation} and put the Dockables
 * onto this new station.
 * @see Merger
 * @see Inserter
 */
public interface Combiner {
    /**
     * Prepares information telling how two {@link Dockable}s may be combined.
     * @param source the {@link Dockable}s which may be combined, their parent station and
     * other helpful information.
     * @param force how much the caller of this method would like the method not to return a 
     * value of null. Implementations should read the {@link Enforcement#getForce() force}
     * property, where a value of 1 means that this method must success, while 0
     * means that this method may or may not success. In general the modules in the framework expect that a value below
     * 0.5 results in null, while a value above 0.5f results in a non-null
     * value.
     * @return How to combine the {@link Dockable}s, may be null to indicate that
     * a combination is not desired
     */
    public CombinerTarget prepare( CombinerSource source, Enforcement force );
	
	/**
     * Merges two {@link Dockable}s into a new Dockable. This method may
     * set the {@link DockController} of the created element in order to initialize 
     * it more efficiently.
     * @param source information about the two {@link Dockable}s that are going to be merged, not null. This 
     * object may or may not have been created by this {@link Combiner}, some sanity checks are advised before using it
     * @param target information that was created by {@link #prepare(CombinerSource, Enforcement)} using source, not null
     * @return the combined {@link Dockable}, not null
     */
    public Dockable combine( CombinerSource source, CombinerTarget target );
    
	/**
	 * Prepares the layout of the {@link DockStation}s that are created by this {@link Combiner} to
	 * keep track of a new {@link DockableProperty} with its own placeholder. The new property
	 * is set "aside" an existing location. For more information please read the documentation
	 * of {@link DockStation#asDockable()}.
	 * @param request information about a location and methods to create the neighbor location
	 * @see DockStation#aside(AsideRequest)
	 */
	public void aside( AsideRequest request );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy