org.argouml.swingext
Class NewspaperLayout

java.lang.Object
  |
  +--org.argouml.swingext.GridLayout2
        |
        +--org.argouml.swingext.NewspaperLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.io.Serializable

public class NewspaperLayout
extends GridLayout2

Similar to GridLayout2 but once the components fill the height of the container they flow into another grid on the right until the full width of the container is filled. Once the containers width is full it flows to the right no more, the grid depths increase instead so that the user scrolls up/down instead of left/right.

See Also:
Serialized Form

Field Summary
protected static Logger cat
           
private  int gridGap
           
private  int gridWidth
           
private  boolean horizontalScrollRequired
           
private  int preferredX
           
private  int preferredY
           
private  boolean verticalScrollRequired
           
 
Fields inherited from class org.argouml.swingext.GridLayout2
BOTH, cellSizing, CENTER, colWidth, EAST, FITPARENT, HORIZONTAL, largestHeight, largestWidth, MAXPREFERRED, NONE, NORTH, NORTHEAST, NORTHWEST, ROWCOLPREFERRED, rowHeight, SOUTH, SOUTHEAST, SOUTHWEST, VERTICAL, WEST
 
Constructor Summary
NewspaperLayout()
           
NewspaperLayout(int rows, int cols)
           
NewspaperLayout(int rows, int cols, int hgap, int vgap, int gridGap)
           
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component with the specified name to the layout.
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
private  boolean positionComponentsExternal(java.awt.Container parent, int[] colWidth, int[] rowHeight, int gridHeight, int nrows, int ncols, int maxGrids)
           
private  int positionComponentsInternal(java.awt.Container parent, int[] colWidth, int[] rowHeight, int gridHeight, int nrows, int ncols)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Determines the preferred size of the container argument using this grid layout.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component with the specified name from the layout.
 
Methods inherited from class org.argouml.swingext.GridLayout2
calculateSizes, getColumns, getComponentCellHeight, getComponentCellWidth, getHgap, getRows, getVgap, positionComponentInCell, setCols, setHgap, setRows, setVgap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected static Logger cat

gridGap

private int gridGap

preferredX

private int preferredX

preferredY

private int preferredY

gridWidth

private int gridWidth

verticalScrollRequired

private boolean verticalScrollRequired

horizontalScrollRequired

private boolean horizontalScrollRequired
Constructor Detail

NewspaperLayout

public NewspaperLayout()

NewspaperLayout

public NewspaperLayout(int rows,
                       int cols)

NewspaperLayout

public NewspaperLayout(int rows,
                       int cols,
                       int hgap,
                       int vgap,
                       int gridGap)
Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Description copied from class: GridLayout2
Adds the specified component with the specified name to the layout. This is included to satisfy the LayoutManager interface but is not actually used in this layout implementation.

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

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Description copied from class: GridLayout2
Removes the specified component with the specified name from the layout. This is included to satisfy the LayoutManager interface but is not actually used in this layout implementation.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Overrides:
removeLayoutComponent in class GridLayout2
Parameters:
comp - the name of the component

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Description copied from class: GridLayout2
Determines the preferred size of the container argument using this grid layout. The preferred size of a grid layout is dependant on the cellSizing scheme.

MAXPREFERRED and FITPARENT use the same formula to calculate prefered size.

The prefered width using MAXPREFERRED or FITPARENT is the largest preferred width of any of the widths in the container times the number of columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.

The preferred height using MAXPREFERRED or FITPARENT is the largest preferred height of any of the heights in the container times the number of rows, plus the vertical padding times the number of rows plus one, plus the top and bottom insets of the target container.

The prefered width using ROWCOLPREFERRED is the largest preferred is the sum of the widths of of all columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.

The prefered height using ROWCOLPREFERRED is the largest preferred is the sum of the heights of of all columns, plus the horizontal padding times the number of columns plus one, plus the left and right insets of the target container.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Overrides:
preferredLayoutSize in class GridLayout2
Parameters:
parent - the container to be laid out
Returns:
the preferred dimensions to lay out the subcomponents of the specified container

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Overrides:
minimumLayoutSize in class GridLayout2

maximumLayoutSize

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

layoutContainer

public void layoutContainer(java.awt.Container parent)
Specified by:
layoutContainer in interface java.awt.LayoutManager
Overrides:
layoutContainer in class GridLayout2

positionComponentsInternal

private int positionComponentsInternal(java.awt.Container parent,
                                       int[] colWidth,
                                       int[] rowHeight,
                                       int gridHeight,
                                       int nrows,
                                       int ncols)

positionComponentsExternal

private boolean positionComponentsExternal(java.awt.Container parent,
                                           int[] colWidth,
                                           int[] rowHeight,
                                           int gridHeight,
                                           int nrows,
                                           int ncols,
                                           int maxGrids)


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook