bibliothek.gui.dock.common.MissingCDockableStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docking-frames-common Show documentation
Show all versions of docking-frames-common Show documentation
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
/*
* 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.intern.CDockable;
/**
* A strategy that tells what to do if {@link CControl} finds a description of
* a {@link CDockable} that it does not know while reading a layout.
* @author Benjamin Sigg
*/
public interface MissingCDockableStrategy {
/**
* A strategy that will always throw away information.
*/
public static final MissingCDockableStrategy PURGE = new MissingCDockableStrategy(){
public boolean shouldStoreSingle( String id ) {
return false;
}
public boolean shouldStoreMulti( String arg0 ){
return false;
}
public boolean shouldCreate( String id, MultipleCDockableFactory, ?> factory ) {
return false;
}
public boolean shouldCreate(
String id, MultipleCDockableFactory, L> factory,
String uniqueId, L data ) {
return false;
}
};
/**
* A strategy that will always throw away information for {@link MultipleCDockable}s
* but store information for {@link SingleCDockable}.
*/
public static final MissingCDockableStrategy SINGLE = new MissingCDockableStrategy(){
public boolean shouldStoreSingle( String id ) {
return true;
}
public boolean shouldStoreMulti( String arg0 ){
return false;
}
public boolean shouldCreate( String id, MultipleCDockableFactory, ?> factory ) {
return false;
}
public boolean shouldCreate(
String id, MultipleCDockableFactory, L> factory,
String uniqueId, L data ) {
return false;
}
};
/**
* A strategy that will always store any information
*/
public static final MissingCDockableStrategy STORE = new MissingCDockableStrategy(){
public boolean shouldStoreSingle( String id ) {
return true;
}
public boolean shouldStoreMulti( String arg0 ){
return true;
}
public boolean shouldCreate( String id, MultipleCDockableFactory, ?> factory ) {
return true;
}
public boolean shouldCreate(
String id, MultipleCDockableFactory, L> factory,
String uniqueId, L data ) {
return true;
}
};
/**
* Tells whether layout information for the missing {@link SingleCDockable}
* with identifier id
should be stored.
* @param id the identifier of the missing {@link SingleCDockable}
* @return true
if layout information should remain available,
* false
if the information should be purged.
*/
public boolean shouldStoreSingle( String id );
/**
* Tells whether layout information for the missing {@link MultipleCDockable}
* with identifier id
should be stored.
* @param id the identifier of the missing {@link MultipleCDockable}
* @return true
if layout information should remain available,
* false
if the information should be purged.
*/
public boolean shouldStoreMulti( String id );
/**
* Tells whether the factory factory
should be used to create
* {@link MultipleCDockable}s for which location information is available.
* @param id the identifier of the factory
* @param factory the factory to use
* @return true
if dockables can be restored by factory
*/
public boolean shouldCreate( String id, MultipleCDockableFactory,?> factory );
/**
* Tells whether the {@link MultipleCDockable} with identifier uniqueId
* should automatically be created outside the normal setup-phase. This method
* is not called when applying a new layout through the normal ways, only
* when factory
has become available after the layout was already
* set.
* @param the kind of data factory
uses
* @param id the identifier of factory
* @param factory the factory which would create the new element
* @param uniqueId the identifier of the element that would be created
* @param data the data that would be given to factory
to create
* the new element
* @return true
if a new element should be created
*/
public boolean shouldCreate( String id, MultipleCDockableFactory, L> factory, String uniqueId, L data );
}