bibliothek.gui.dock.facile.station.split.ResizeRoot 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.facile.station.split;
import bibliothek.gui.dock.station.split.Root;
/**
* Represents a {@link Root}.
* @author Benjamin Sigg
* @param the kind of meta-data clients use
*/
public class ResizeRoot extends ResizeElement{
/** the root which is represented by this root-element */
private Root root;
/** the one child of this root */
@SuppressWarnings( "unchecked" )
private ResizeElement[] child = new ResizeElement[1];
/**
* Creates a new root-element
* @param layout the layout that uses this root
* @param root the root which is represented by this root-element
*/
public ResizeRoot( LockedResizeLayoutManager layout, Root root ){
super( null, layout );
this.root = root;
this.child[0] = layout.toElement( this, root.getChild() );
}
/**
* Gets the root which is represented by this root-element.
* @return the root
*/
public Root getRoot() {
return root;
}
@Override
public ResizeRoot getResizeRoot() {
return this;
}
/**
* Gets the one child of this root
* @return the child or null
*/
public ResizeElement getChild() {
return child[0];
}
@Override
protected ResizeElement[] getChildren() {
if( child[0] == null )
return null;
return child;
}
@Override
protected ResizeRequest createRequest() {
if( child[0] == null )
return null;
return child[0].getRequest();
}
@Override
public void adapt( double deltaWidth, double deltaHeight ) {
if( child[0] != null )
child[0].adapt( deltaWidth, deltaHeight );
}
}