com.alee.extended.layout
Class ToolbarLayout

java.lang.Object
  extended by com.alee.extended.layout.AbstractLayoutManager
      extended by com.alee.extended.layout.ToolbarLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, javax.swing.SwingConstants

public class ToolbarLayout
extends AbstractLayoutManager
implements javax.swing.SwingConstants

This layout allows you to quickly and easily place components in a toolbar-like components without overloading interface with lots of panels and different layouts.

Author:
Mikle Garin

Field Summary
protected  java.util.Map<java.awt.Component,java.lang.String> constraints
           
static java.lang.String END
           
static java.lang.String FILL
           
protected  java.awt.Insets margin
           
static java.lang.String MIDDLE
           
protected  int orientation
           
protected  int partsSpacing
           
protected  int spacing
           
static java.lang.String START
           
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
ToolbarLayout()
          Some extended constructors
ToolbarLayout(int spacing)
           
ToolbarLayout(int spacing, int orientation)
           
ToolbarLayout(int spacing, int partsSpacing, int orientation)
           
 
Method Summary
 void addComponent(java.awt.Component component, java.lang.Object constraints)
          Caled when component added into container with this layout.
protected  java.awt.Insets getActualInsets(java.awt.Container container)
           
 java.util.Map<java.awt.Component,java.lang.String> getConstraints()
          Layout constraints
 java.awt.Insets getMargin()
          Layout sides margin In case this value is null component border is taken into account instead
 int getOrientation()
          Layout orientation
 int getPartsSpacing()
          Start-end parts spacing This one does not affect layout if there are any components in FILL part
 int getSpacing()
          Layout cells spacing
protected  boolean hasElement(java.lang.String element)
           
 void layoutContainer(java.awt.Container parent)
          
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          
 void removeComponent(java.awt.Component component)
          Called when component removed from container with this layout.
 void setConstraints(java.util.Map<java.awt.Component,java.lang.String> constraints)
           
 void setMargin(java.awt.Insets margin)
           
 void setOrientation(int orientation)
           
 void setPartsSpacing(int partsSpacing)
           
 void setSpacing(int spacing)
           
 
Methods inherited from class com.alee.extended.layout.AbstractLayoutManager
addLayoutComponent, addLayoutComponent, getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, maximumLayoutSize, minimumLayoutSize, removeLayoutComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START

public static final java.lang.String START
See Also:
Constant Field Values

MIDDLE

public static final java.lang.String MIDDLE
See Also:
Constant Field Values

FILL

public static final java.lang.String FILL
See Also:
Constant Field Values

END

public static final java.lang.String END
See Also:
Constant Field Values

constraints

protected java.util.Map<java.awt.Component,java.lang.String> constraints

spacing

protected int spacing

partsSpacing

protected int partsSpacing

orientation

protected int orientation

margin

protected java.awt.Insets margin
Constructor Detail

ToolbarLayout

public ToolbarLayout()
Some extended constructors


ToolbarLayout

public ToolbarLayout(int spacing)

ToolbarLayout

public ToolbarLayout(int spacing,
                     int orientation)

ToolbarLayout

public ToolbarLayout(int spacing,
                     int partsSpacing,
                     int orientation)
Method Detail

getConstraints

public java.util.Map<java.awt.Component,java.lang.String> getConstraints()
Layout constraints


setConstraints

public void setConstraints(java.util.Map<java.awt.Component,java.lang.String> constraints)

getSpacing

public int getSpacing()
Layout cells spacing


setSpacing

public void setSpacing(int spacing)

getPartsSpacing

public int getPartsSpacing()
Start-end parts spacing This one does not affect layout if there are any components in FILL part


setPartsSpacing

public void setPartsSpacing(int partsSpacing)

getOrientation

public int getOrientation()
Layout orientation


setOrientation

public void setOrientation(int orientation)

getMargin

public java.awt.Insets getMargin()
Layout sides margin In case this value is null component border is taken into account instead


setMargin

public void setMargin(java.awt.Insets margin)

addComponent

public void addComponent(java.awt.Component component,
                         java.lang.Object constraints)
Caled when component added into container with this layout.

Overrides:
addComponent in class AbstractLayoutManager
Parameters:
component - added component
constraints - component constraints

removeComponent

public void removeComponent(java.awt.Component component)
Called when component removed from container with this layout.

Overrides:
removeComponent in class AbstractLayoutManager
Parameters:
component - removed component

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager

layoutContainer

public void layoutContainer(java.awt.Container parent)

Specified by:
layoutContainer in interface java.awt.LayoutManager

hasElement

protected boolean hasElement(java.lang.String element)

getActualInsets

protected java.awt.Insets getActualInsets(java.awt.Container container)