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

bibliothek.gui.dock.common.CStation Maven / Gradle / Ivy

Go to download

DockingFrames is an open source Java Swing docking framework, licenced under LGPL 2.1. This is the same distribution as the original distribution (http://www.docking-frames.org/), only reinstalled in maven

There is a newer version: 1.1.2p20b.fix-1
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) 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.common;

import bibliothek.gui.dock.common.event.ResizeRequestListener;
import bibliothek.gui.dock.common.intern.CControlAccess;
import bibliothek.gui.dock.common.intern.CDockable;
import bibliothek.gui.dock.common.intern.station.CommonDockStation;
import bibliothek.gui.dock.common.mode.CLocationModeManager;
import bibliothek.gui.dock.common.perspective.CPerspective;
import bibliothek.gui.dock.common.perspective.CStationPerspective;
import bibliothek.gui.dock.common.perspective.MissingPerspectiveStrategy;
import bibliothek.gui.dock.facile.mode.ModeArea;
import bibliothek.util.Path;

/**
 * A {@link CStation} is an element onto which {@link CDockable}s can be dropped.
 * Each station can, but does not have to be, a {@link CDockable} itself. Stations
 * are added to the {@link CControl} through {@link CControl#addStation(CStation, boolean)}.
 * A station is either a root-station (meaning that it has no parent) or 
 * {@link CDockable}. It is possible to use a {@link CDockable} as root-station.
 * @author Benjamin Sigg
 * @param  what kind of internal implementation this station uses
 */
public interface CStation> {
    /**
     * Gets the internal representation of this {@link CStation}.
     * @return the internal representation
     */
    public S getStation();
    
    /**
     * If this station is a {@link CDockable} as well, then this method returns
     * the representation of this station as {@link CDockable}.
     * @return this as dockable or null
     */
    public CDockable asDockable();

    /**
     * Returns a new {@link CStationPerspective} that represents this station. This method
     * does not need to set any content of the new perspective. Basically this method just needs to tell
     * the framework what type of {@link CStationPerspective} is needed, not what its content is.
     * @return the new, empty perspective
     * @see #getTypeId()
     */
    public CStationPerspective createPerspective();
    
    /**
     * Tells whether this station is a special working area or not. It is not
     * possible drag a child from a working area if it is registered there, or
     * to drop a child onto a working area if it is not registered there.
* Working areas must either be registered as root-station (see {@link CControl#addStation(CStation, boolean)}) * or must be a {@link SingleCDockable}. * @return true if this is a working area, false * otherwise */ public boolean isWorkingArea(); /** * Gets a unique and constant identifier for this station * @return the unique identifier */ public String getUniqueId(); /** * Gets a unique path denoting the type of this station. This path will be given * to {@link MissingPerspectiveStrategy#createStation(String, Path)} when loading a layout * as a {@link CPerspective}. * @return the type of this station. Paths starting with "dock." are reserved for the * framework. A value of null will just be ignored. */ public Path getTypeId(); /** * Gets a location which represents directly {@link #getStation()}. * @return the location that will always represent the {@link #getStation() station} */ public CLocation getStationLocation(); /** * Creates a {@link CLocation} that can be used to drop a new {@link CDockable} on this station * or one of its children stations. This method returns the "optimal spot", where the definition * of "optimal spot" is up to the station itself. The default implementations however call * {@link CLocationModeManager#getDropLocation(CStation)}. * @return the optimal spot for dropping a new {@link CDockable} or null if this * station is not able to calculate the optimal spot (e.g. because the station is not visible) * @see CDockable#setLocationsAside(CDockable) * @see CDockable#setLocationsAsideFocused() */ public CLocation getDropLocation(); /** * Called by {@link CControl} when this {@link CStation} is added or removed. * There are two actions which most stations might want to do:
*
    *
  • Call one of the add methods for {@link ModeArea}s accessible through the {@link CLocationModeManager}. * That will ensure that the station can be used as minimize/normalize/... area.
  • *
  • Add a {@link ResizeRequestListener} to {@link CControl} in order to be * informed when resize requests are to be handled.
  • *
* @param access access to the internals of the {@link CControl} that uses * this station or null to remove all ties from a control */ public void setControlAccess( CControlAccess access ); }