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

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

import java.util.Map;

import bibliothek.gui.DockStation;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.layout.DockConverter;
import bibliothek.gui.dock.layout.DockLayoutInfo;
import bibliothek.gui.dock.layout.DockableProperty;
import bibliothek.gui.dock.layout.LocationEstimationMap;
import bibliothek.gui.dock.perspective.Perspective;
import bibliothek.gui.dock.perspective.PerspectiveDockable;
import bibliothek.gui.dock.perspective.PerspectiveElement;
import bibliothek.gui.dock.station.support.PlaceholderStrategy;

/**
 * A {@link DockConverter} which can not only store and load the contents of an
 * element, but also create a new {@link DockElement} with the content.
 * @author Benjamin Sigg
 * @param  the type of element which can be written and read by this factory
 * @param 

the type of {@link PerspectiveElement} which can be written and read by this factory * @param the type of object that stores the contents of a D. If * clients cannot guarantee that always the same factory will be mapped * to the same identifier, then L should be set to {@link Object} * and the methods which receive a L should use * instanceof before casting the argument. */ public interface DockFactory extends DockConverter{ /** * Tries to estimate the {@link DockableProperty}s of the children of the * station which is represented by layout.
* * The children of this station are accessible through children.getChild( ... ), this * factory may also access the leafs in the tree of {@link Dockable}s through * children.getSubChild(...).
* Note: this method must not set the successor of any {@link DockableProperty}, * it is the callers responsibility to handle chains of stations. * @param layout this station * @param children the children of the station, this method should call * {@link DockLayoutInfo#setLocation(DockableProperty)} or {@link LocationEstimationMap#setLocation(int, DockableProperty)} and * {@link LocationEstimationMap#setLocation(int, int, DockableProperty)} for as many children as possible */ public void estimateLocations( L layout, LocationEstimationMap children ); /** * Creates a new {@link DockElement} and changes the layout of the new * element such that is matches layout. * @param layout the new layout * @param placeholders a strategy to detect invalid placeholders, can be null. * Factories loading only {@link Dockable}s but no {@link DockStation}s can safely ignore this argument. * @param children some children, note that the map may not contain all elements * which were present when the layout was created. * @return a new element or null if layout can't be used */ public D layout( L layout, Map children, PlaceholderStrategy placeholders ); /** * Creates a new {@link DockElement} and changes the layout of the new * element such that is matches layout. This method should * not add any children to the element. * @param layout the new layout * @param placeholders a strategy to detect invalid placeholders, can be null. * Factories loading only {@link Dockable}s but no {@link DockStation}s can safely ignore this argument. * @return a new element or null if layout can't be used */ public D layout( L layout, PlaceholderStrategy placeholders ); /** * Creates an element that can be used by a {@link Perspective} to create a layout * without creating any {@link DockElement}s. This method may return null only * if the client is guaranteed not to use a {@link Perspective}. * @param layout the new layout * @param children some children, note that the map may not contain all elements * which were present when the layout was created. Is null if the children of this * station are going to be ignored. * @return the new element, can be null, the return value of {@link PerspectiveElement#getFactoryID()} should * be equal to {@link #getID()} */ public P layoutPerspective( L layout, Map children ); /** * Updates the contents of perspective such that it reflects the contents of layout. * @param perspective the perspective that is to be updated * @param layout the layout to apply * @param children the new children of perspective, is null if the children of this * station are going to be ignored. */ public void layoutPerspective( P perspective, L layout, Map children ); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy