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

bibliothek.gui.dock.common.group.CGroupBehavior Maven / Gradle / Ivy

/*
 * 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) 2010 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.common.group;

import bibliothek.gui.DockStation;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.common.intern.CDockable;
import bibliothek.gui.dock.common.mode.ExtendedMode;
import bibliothek.gui.dock.facile.mode.LocationMode;
import bibliothek.gui.dock.facile.mode.LocationModeManager;

/**
 * A {@link CGroupBehavior} allows to define groups of {@link CDockable}. Groups normally
 * act together when changing the {@link LocationMode}: e.g. if one {@link CDockable} is minimized, all the other 
 * {@link CDockable}s follow.
 * @author Benjamin Sigg
 */
public interface CGroupBehavior {
	/**
	 * A behavior that moves only one {@link Dockable} at a time.
	 */
	public static final CGroupBehavior TOPMOST = new TopMostGroupBehavior();
	
	/**
	 * A behavior that moves around entire stacks of {@link Dockable}s.
	 */
	public static final CGroupBehavior STACKED = new StackGroupBehavior();
	
	/**
	 * Calculates how the mode of dockable has to be changed such that it matches target. 
	 * Please note that some modules use directly {@link #getGroupElement(LocationModeManager, Dockable, ExtendedMode)} and do never call
	 * this method. 
	 * @param manager a manager which may be asked for additional information
	 * @param dockable the element that was clicked by the user
	 * @param target the extended mode intended for dockable
	 * @return the operation to execute, may be null
	 */
	public CGroupMovement prepare( LocationModeManager manager, Dockable dockable, ExtendedMode target );

    /**
     * Gets the element whose location or mode must be changed in order to apply
     * mode to dockable. Normally dockable itself
     * is returned, or a parent {@link DockStation} of dockable.
     * @param manager a manager which may be asked for additional information
     * @param dockable some element, not null
     * @param mode the target mode
     * @return the element that must be repositioned, might be dockable
     * itself, not null
     */
	public Dockable getGroupElement( LocationModeManager manager, Dockable dockable, ExtendedMode mode );
	
    /**
     * Gets the element which would replace old if old is currently
     * in mode, and dockable is or will not be in mode.
* @param manager a manager which may be asked for additional information * @param old some element * @param dockable some element, might be old * @param mode the mode in which old is * @return the element which would be maximized if dockable is * no longer in mode, can be null */ public Dockable getReplaceElement( LocationModeManager manager, Dockable old, Dockable dockable, ExtendedMode mode ); /** * Tells whether the actions of dockable for mode mode should be * shown on station too. * @param manager a manager which may be asked for additional information * @param station the parent of dockable * @param dockable the element whose actions will be shown * @param mode the mode for which the actions are requested * @return true if the actions should be forwarded */ public boolean shouldForwardActions( LocationModeManager manager, DockStation station, Dockable dockable, ExtendedMode mode ); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy