org.softsmithy.lib.awt.layout
Class AbstractTableLayout

java.lang.Object
  extended by org.softsmithy.lib.awt.layout.AbstractTableLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2, TableLayout, CustomizerLayout
Direct Known Subclasses:
InfiniteTableLayout

public abstract class AbstractTableLayout
extends Object
implements TableLayout


Nested Class Summary
protected static class AbstractTableLayout.AbstractAxis
           
 
Constructor Summary
AbstractTableLayout()
           
 
Method Summary
 void addComponentLayoutListener(Component component, ComponentLayoutListener listener)
           
 void addComponentLayoutListener(ComponentLayoutListener listener)
           
 void addLayoutComponent(Component comp, Object constr)
          Adds the specified component to the layout, using the specified constraint object.
 void addLayoutComponent(String name, Component comp)
          If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.
 void ensureValidity(Container container)
           
 void ensureValidity(Rectangle innerArea)
           
protected abstract  AbstractTableLayout.AbstractAxis getColumns()
          Indicates whether or not the size of the cells are known for the last known size of the container.
 Component[] getComponents(Container parent)
           
 float getLayoutAlignmentX(Container parent)
          Returns the alignment along the x axis.
 float getLayoutAlignmentY(Container parent)
          Returns the alignment along the y axis.
protected abstract  AbstractTableLayout.AbstractAxis getRows()
           
 void invalidateLayout(Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
protected  boolean isValid(Rectangle innerArea)
           
 void layoutComponent(Container parent, Component comp)
           
 void layoutContainer(Container parent)
          Lays out the specified container.
 Dimension maximumLayoutSize(Container target)
          Returns the maximum dimensions for this layout given the components in the specified target container.
 void removeComponentLayoutListener(Component component, ComponentLayoutListener listener)
           
 void removeComponentLayoutListener(ComponentLayoutListener listener)
           
protected  void validateLayout(Rectangle innerArea)
          Calculates the sizes of the rows and columns based on the absolute and relative sizes specified in rowSpec and columnSpec and the size of the container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.softsmithy.lib.awt.layout.TableLayout
adjustBounds, adjustHeight, adjustWidth, adjustX, adjustY, colSpan, columnIndex, deleteColumn, deleteRow, drawGrid, getColumnWidth, getRowHeight, getTableConstraints, height, insertColumn, insertRow, rowIndex, rowSpan, setColumnWidth, setRelativeBounds, setRowHeight, setTableConstraints, width, xLocation, yLocation
 
Methods inherited from interface org.softsmithy.lib.swing.customizer.CustomizerLayout
drawLayoutHelp, getCustomizerConstraints, setAbsoluteBounds, setCustomizerConstraints
 
Methods inherited from interface java.awt.LayoutManager
minimumLayoutSize, preferredLayoutSize, removeLayoutComponent
 

Constructor Detail

AbstractTableLayout

public AbstractTableLayout()
Method Detail

getColumns

protected abstract AbstractTableLayout.AbstractAxis getColumns()
Indicates whether or not the size of the cells are known for the last known size of the container. If valid is false or the container has been resized, the cell sizes must be recalculated using calculateSize.


getRows

protected abstract AbstractTableLayout.AbstractAxis getRows()

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
name - the string to be associated with the component
comp - the component to be added

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constr)
Adds the specified component to the layout, using the specified constraint object.

Specified by:
addLayoutComponent in interface LayoutManager2
Parameters:
comp - the component to be added
constraints - where/how the component is added to the layout.

validateLayout

protected void validateLayout(Rectangle innerArea)
Calculates the sizes of the rows and columns based on the absolute and relative sizes specified in rowSpec and columnSpec and the size of the container. The result is stored in rowSize and columnSize.

Parameters:
container - container using this TableLayout

invalidateLayout

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

Specified by:
invalidateLayout in interface LayoutManager2

isValid

protected boolean isValid(Rectangle innerArea)

getLayoutAlignmentX

public float getLayoutAlignmentX(Container parent)
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 LayoutManager2
Returns:
unconditionally, 0.5

getLayoutAlignmentY

public float getLayoutAlignmentY(Container parent)
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 LayoutManager2
Returns:
unconditionally, 0.5

maximumLayoutSize

public Dimension maximumLayoutSize(Container target)
Returns the maximum dimensions for this layout given the components in the specified target container.

Specified by:
maximumLayoutSize in interface LayoutManager2
Parameters:
target - the component which needs to be laid out
Returns:
unconditionally, a Dimension of Integer.MAX_VALUE by Integer.MAX_VALUE since TableLayout does not limit the maximum size of a container

ensureValidity

public void ensureValidity(Container container)

ensureValidity

public void ensureValidity(Rectangle innerArea)

layoutContainer

public void layoutContainer(Container parent)
Lays out the specified container.

Specified by:
layoutContainer in interface LayoutManager
Parameters:
parent - the container to be laid out

layoutComponent

public void layoutComponent(Container parent,
                            Component comp)
Specified by:
layoutComponent in interface TableLayout
Specified by:
layoutComponent in interface CustomizerLayout

getComponents

public Component[] getComponents(Container parent)

addComponentLayoutListener

public void addComponentLayoutListener(ComponentLayoutListener listener)
Specified by:
addComponentLayoutListener in interface CustomizerLayout

addComponentLayoutListener

public void addComponentLayoutListener(Component component,
                                       ComponentLayoutListener listener)
Specified by:
addComponentLayoutListener in interface CustomizerLayout

removeComponentLayoutListener

public void removeComponentLayoutListener(ComponentLayoutListener listener)
Specified by:
removeComponentLayoutListener in interface CustomizerLayout

removeComponentLayoutListener

public void removeComponentLayoutListener(Component component,
                                          ComponentLayoutListener listener)
Specified by:
removeComponentLayoutListener in interface CustomizerLayout


Copyright © 2002-2011 SoftSmithy. All Rights Reserved.