thinwire.ui.layout
Class SplitLayout

java.lang.Object
  extended by thinwire.ui.layout.AbstractLayout
      extended by thinwire.ui.layout.SplitLayout
All Implemented Interfaces:
Layout

public final class SplitLayout
extends AbstractLayout

SplitLayout divides a Container into two sections placing one component on each side and provides a dragable divider allowing the user to adjust the split. The split can be either vertical (splitting the Components left and right) or horizontal (splitting the Components top and bottom).

Example:

 Panel p = new Panel();
 p.getChildren().add(new Button("Top"));
 p.getChildren().add(new Button("Bottom"));
 p.setLayout(new SplitLayout(.5));
 


Nested Class Summary
static class SplitLayout.Maximize
           
 
Field Summary
 
Fields inherited from class thinwire.ui.layout.AbstractLayout
autoLayout, autoLayoutProps, container, limitLayout, margin, spacing
 
Constructor Summary
SplitLayout(double split)
          Constructs a horizontal SplitLayout with the first Component having the specified height, 0px margin and 4px spacing.
SplitLayout(double split, boolean splitVertical)
          Constructs a SplitLayout with the first Component having the specified size, 0px margin and 4px spacing
SplitLayout(double split, boolean splitVertical, int margin)
          Constructs a SplitLayout with the first Component having the specified size, specified margin and 4px spacing
SplitLayout(double split, boolean splitVertical, int margin, int spacing)
          Constructs a SplitLayout with the first Component having the specified size, specified margin and specified spacing
 
Method Summary
 SplitLayout.Maximize getMaximize()
          Returns an enum constant telling whether the first, second or neither component is currently maximized.
 Style getSpacerStyle()
           
 double getSplit()
           
 boolean isMaximized()
           
 boolean isSplitVertical()
           
 void setContainer(Container<Component> container)
          Associates the specified Container to this layout.
 void setMargin(int margin)
           
 void setMaximize(SplitLayout.Maximize maximize)
          Set either the first or second component to be maximized.
 void setSplit(double split)
          Set the size of the first Component in the Container
 void setSplitVertical(boolean splitVertical)
          Sets whether the split is vertical (Components are left and right) or horizontal (Components are top and bottom)
protected  void update()
           
 
Methods inherited from class thinwire.ui.layout.AbstractLayout
addComponent, apply, getContainer, getFormalLimit, getMargin, getSpacing, isAutoApply, limitChanged, removeComponent, setAutoApply, setSpacing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitLayout

public SplitLayout(double split)
Constructs a horizontal SplitLayout with the first Component having the specified height, 0px margin and 4px spacing.

Parameters:
split -

SplitLayout

public SplitLayout(double split,
                   boolean splitVertical)
Constructs a SplitLayout with the first Component having the specified size, 0px margin and 4px spacing

Parameters:
split -
splitVertical -

SplitLayout

public SplitLayout(double split,
                   boolean splitVertical,
                   int margin)
Constructs a SplitLayout with the first Component having the specified size, specified margin and 4px spacing

Parameters:
split -
splitVertical -
margin -

SplitLayout

public SplitLayout(double split,
                   boolean splitVertical,
                   int margin,
                   int spacing)
Constructs a SplitLayout with the first Component having the specified size, specified margin and specified spacing

Parameters:
split -
splitVertical -
margin -
spacing -
Method Detail

setContainer

public void setContainer(Container<Component> container)
Associates the specified Container to this layout. (NOTE: This method should only be called from Container.setLayout())

Specified by:
setContainer in interface Layout
Overrides:
setContainer in class AbstractLayout

getSplit

public double getSplit()
Returns:
the size of the first Component in the Container

setSplit

public void setSplit(double split)
Set the size of the first Component in the Container

Parameters:
split -

isSplitVertical

public boolean isSplitVertical()
Returns:
true if the split is vertical (Components are left and right)

setSplitVertical

public void setSplitVertical(boolean splitVertical)
Sets whether the split is vertical (Components are left and right) or horizontal (Components are top and bottom)

Parameters:
splitVertical -

setMargin

public void setMargin(int margin)
Specified by:
setMargin in interface Layout
Overrides:
setMargin in class AbstractLayout

getSpacerStyle

public Style getSpacerStyle()
Returns:
the Stle object for the spacer

isMaximized

public boolean isMaximized()
Returns:
true if one of the components is currently maximized

getMaximize

public SplitLayout.Maximize getMaximize()
Returns an enum constant telling whether the first, second or neither component is currently maximized.

Returns:

setMaximize

public void setMaximize(SplitLayout.Maximize maximize)
Set either the first or second component to be maximized. Passing Maximize.NONE or null will restore the layout to the last state.

Parameters:
maximize -

update

protected void update()
Overrides:
update in class AbstractLayout


ThinWire® is a registered of Custom Credit Systems  Copyright © 2007 All rights reserved.
ThinWire_is_Open_Source_under_the_terms_of_the_LGPLv2.1 SourceForge.net_Project_Page java.net_Member Support_ThinWire,_Digg_our_Story