com.miginfocom.ashape.layout
Class LayoutUtil

java.lang.Object
  extended by com.miginfocom.ashape.layout.LayoutUtil

public class LayoutUtil
extends java.lang.Object

Static utility class for AShapeLayouts.


Constructor Summary
LayoutUtil()
           
 
Method Summary
static java.lang.Integer getLayoutSizeParallel(AShape[] subShapes, int startIx, int endIx, int type, int dim, java.lang.Integer otherDimSizeHint)
          Returns the biggest non-null size for minimum and preferred layout size and the smallest for maximum size.
static java.lang.Integer getLayoutSizeSerial(AShape[] subShapes, int startIx, int endIx, int type, int dim, java.lang.Integer otherDimSizeHint, AtRefNumber[] overrideSizes, float refSize)
          Returns the biggest non-null size for minimum and preferred layout size and the smallest for maximum size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutUtil

public LayoutUtil()
Method Detail

getLayoutSizeParallel

public static java.lang.Integer getLayoutSizeParallel(AShape[] subShapes,
                                                      int startIx,
                                                      int endIx,
                                                      int type,
                                                      int dim,
                                                      java.lang.Integer otherDimSizeHint)
Returns the biggest non-null size for minimum and preferred layout size and the smallest for maximum size. If no preferred size exist for a shape, but there is a minimum size, that is used as the preferred size for that shape. This ensures that the returned preferred size is at least as large as the biggest if the minimums sizes. This is not true, though, for shapes that have a preferred size less than minimum size, but that should normally be the case anyway.

Parameters:
subShapes - The subshapes array to use
startIx - Start index in the array
endIx - End index in the array
type - The type of size to return. E.g. Distributor.MIN.
dim - The dimension for which to return the size. E.g SwingConstants.HORIZONTAL
otherDimSizeHint - On optional size in the not-asked-for dimension. Useful for text shapes that wraps for instance.
Returns:
The size or null if all subshapes returned null.

getLayoutSizeSerial

public static java.lang.Integer getLayoutSizeSerial(AShape[] subShapes,
                                                    int startIx,
                                                    int endIx,
                                                    int type,
                                                    int dim,
                                                    java.lang.Integer otherDimSizeHint,
                                                    AtRefNumber[] overrideSizes,
                                                    float refSize)
Returns the biggest non-null size for minimum and preferred layout size and the smallest for maximum size. If no preferred size exist for a shape, but there is a minimum size, that is used as the preferred size for that shape. This ensures that the returned preferred size is at least as large as the biggest if the minimums sizes. This is not true, though, for shapes that have a preferred size less than minimum size, but that should normally be the case anyway.

Parameters:
subShapes - The subshapes array to use
startIx - Start index in the array
endIx - End index in the array, inclusive.
type - The type of size to return. E.g. Distributor.MIN.
dim - The dimension for which to return the size. E.g SwingConstants.HORIZONTAL
otherDimSizeHint - On optional size in the not-asked-for dimension. Useful for text shapes that wraps for instance.
Returns:
The size or null if all subshapes returned null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.