com.l2fprod.common.swing
Class PercentLayout

java.lang.Object
  extended by com.l2fprod.common.swing.PercentLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2
Direct Known Subclasses:
BasicOutlookBarUI.TabLayout

public class PercentLayout
extends java.lang.Object
implements java.awt.LayoutManager2

PercentLayout.
Constraint based layout which allow the space to be splitted using percentages. The following are allowed when adding components to container:


Field Summary
static int HORIZONTAL
          Useful constant to layout the components horizontally (from left to right).
static int VERTICAL
          Useful constant to layout the components vertically (from top to bottom).
 
Constructor Summary
PercentLayout()
          Creates a new HORIZONTAL PercentLayout with a gap of 0.
PercentLayout(int orientation, int gap)
           
 
Method Summary
 void addLayoutComponent(java.awt.Component component, java.lang.Object constraints)
           
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component with the specified name to the layout.
 com.l2fprod.common.swing.PercentLayout.Constraint getConstraint(java.awt.Component component)
           
 int getGap()
           
 float getLayoutAlignmentX(java.awt.Container target)
          Returns the alignment along the x axis.
 float getLayoutAlignmentY(java.awt.Container target)
          Returns the alignment along the y axis.
 int getOrientation()
           
 void invalidateLayout(java.awt.Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
          Returns the maximum size of this component.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 void setConstraint(java.awt.Component component, java.lang.Object constraints)
           
 void setGap(int gap)
           
 void setOrientation(int orientation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Useful constant to layout the components horizontally (from left to right).

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Useful constant to layout the components vertically (from top to bottom).

See Also:
Constant Field Values
Constructor Detail

PercentLayout

public PercentLayout()
Creates a new HORIZONTAL PercentLayout with a gap of 0.


PercentLayout

public PercentLayout(int orientation,
                     int gap)
Method Detail

setGap

public void setGap(int gap)

getGap

public int getGap()

setOrientation

public void setOrientation(int orientation)

getOrientation

public int getOrientation()

getConstraint

public com.l2fprod.common.swing.PercentLayout.Constraint getConstraint(java.awt.Component component)

setConstraint

public void setConstraint(java.awt.Component component,
                          java.lang.Object constraints)

addLayoutComponent

public void addLayoutComponent(java.awt.Component component,
                               java.lang.Object constraints)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager2

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Specified by:
invalidateLayout in interface java.awt.LayoutManager2

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds the specified component with the specified name to the layout.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the component name
comp - the component to be added

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - the component ot be removed

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component to be laid out
See Also:
preferredLayoutSize(java.awt.Container)

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
Returns the maximum size of this component.

Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2
See Also:
Component.getMinimumSize(), Component.getPreferredSize(), LayoutManager

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