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

bibliothek.gui.dock.common.MultipleCDockableFactory 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.CVetoClosingListener;
import bibliothek.gui.dock.common.intern.CDockable;

/**
 * A factory that can create and store {@link MultipleCDockable}s. This factory
 * converts a {@link MultipleCDockable} in a {@link MultipleCDockableLayout} and
 * then writes the layout in various forms (like xml).
 * @author Benjamin Sigg
 * @param  the kind of dockable that is managed by this factory
 * @param  the kind of meta-data this factory reads and writes about F
 */
public interface MultipleCDockableFactory {
    /**
     * Collects all the properties of dockable and writes them
     * into a new {@link MultipleCDockableLayout}.
     * @param dockable the element whose properties should be collected
     * @return the layout that has been written
     */
    public L write( F dockable );
    
    /**
     * Creates a {@link MultipleCDockable} that gets its layout from layout.
     * @param layout the set of properties that can be used to create the new
     * {@link CDockable}.
     * @return the new dockable or null if the layout can't be read
     */
    public F read( L layout );
    
    /**
     * Tells whether the meta-data layout belongs to dockable, meaning
     * write( dockable ) would produce layout and read( layout )
     * would produce dockable.
* This method is used to create a pairing of dockables and meta-data. Dockables without partner are * most likely deleted. If a dockable or some meta-data has more than one potential partner, then one * pair is randomly chosen.
* This method is primarily used for optimization: assume dockable is shown or known * to the view and layout has been read from a file. Normally all dockables produced * by this factory would be removed and replaced by newly created dockables. If however this method * finds a match between a layout and a dockable, then the dockable can be reused.
* The second goal of this method is to help prevent unnecessary events to the {@link CVetoClosingListener} * for dockables that just get replaced by a "clone".
* @param dockable some element that is shown or known to the view * @param layout some layout that will be applied * @return true if dockable would be produced by {@link #read(MultipleCDockableLayout) read(layout)}. */ public boolean match( F dockable, L layout ); /** * Creates a new, empty layout. The contents of the layout will be set * using one of the read-methods of {@link MultipleCDockableLayout}. * @return the new empty layout */ public L create(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy