bibliothek.gui.dock.station.screen.ScreenDockStationExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docking-frames-core Show documentation
Show all versions of docking-frames-core Show documentation
A window docking framework for Swing
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) 2012 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.station.screen;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.ScreenDockStation;
/**
* This extension is used by {@link ScreenDockStation} and changes the functionality of some
* methods.
* @author Benjamin Sigg
*/
public interface ScreenDockStationExtension {
/**
* Tells whether replacing old
with next
is possible on station
.
* @param station the source of the call
* @param old a child of station
* @param next a possible replacement of old
* @return whether replacing old
with next
is allowed
*/
public boolean canReplace( ScreenDockStation station, Dockable old, Dockable next );
/**
* Called by {@link ScreenDockStation#drop(Dockable, ScreenDockProperty, boolean)}. This method may modify
* the arguments in any way it likes.
* @param station the source of the event
* @param arguments the arguments of the method, can be modified
*/
public void drop( ScreenDockStation station, DropArguments arguments );
/**
* Called after a (modified) call to {@link ScreenDockStation#drop(Dockable, ScreenDockProperty, boolean)}
* ended.
* @param station the source of the event
* @param arguments the arguments that were used by the method, should not be modified
* @param successfull whether the call was successfull
*/
public void dropped( ScreenDockStation station, DropArguments arguments, boolean successfull );
/**
* A class offering all the arguments of the method {@link ScreenDockStation#drop(Dockable, ScreenDockProperty, boolean)}
* @author Benjamin Sigg
*/
public static class DropArguments {
private Dockable dockable;
private ScreenDockProperty property;
private boolean boundsIncludeWindow;
private ScreenDockWindow window;
/**
* Sets the dockable which is to be dropped.
* @param dockable the dockable, must not be null
*/
public void setDockable( Dockable dockable ){
if( dockable == null ) {
throw new IllegalArgumentException( "dockable must not be null" );
}
this.dockable = dockable;
}
/**
* Gets the element which is about to be dropped
* @return the element to drop
*/
public Dockable getDockable(){
return dockable;
}
/**
* Sets the location at which the element is to be dropped.
* @param property the new location at which to drop the element, not null
*/
public void setProperty( ScreenDockProperty property ){
if( property == null ) {
throw new IllegalArgumentException( "property must not be null" );
}
this.property = property;
}
/**
* Gets the location at which the element will be dropped
* @return the location, not null
*/
public ScreenDockProperty getProperty(){
return property;
}
/**
* Sets whether the boundaries of the location include the entire window.
* @param boundsIncludeWindow whether the entire window is included
* @see #isBoundsIncludeWindow()
*/
public void setBoundsIncludeWindow( boolean boundsIncludeWindow ){
this.boundsIncludeWindow = boundsIncludeWindow;
}
/**
* If true
, the bounds describe the size
* of the resulting window. Otherwise the size of the window will be a bit larger
* such that the title can be shown in the new space
* @return whether the bounds include the window
*/
public boolean isBoundsIncludeWindow(){
return boundsIncludeWindow;
}
/**
* Sets the window with which the element will be merged
* @param window the merging window, can be null
*/
public void setWindow( ScreenDockWindow window ){
this.window = window;
}
/**
* Gets the window with which the element will be merged
* @return the merging window
*/
public ScreenDockWindow getWindow(){
return window;
}
}
}