org.omegahat.Graphics.Layouts
Class LayoutAllocator

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--org.omegahat.Environment.Utils.OrderedTable
                    |
                    +--org.omegahat.Graphics.Layouts.BasicAllocator
                          |
                          +--org.omegahat.Graphics.Layouts.LayoutAllocator
All Implemented Interfaces:
Activable, AssignableSubset, java.lang.Cloneable, Database, EnumeratedRegionAllocator, java.util.Iterator, java.util.Map, RegionAllocator, java.io.Serializable, ShallowCopyable, Subsettable

public class LayoutAllocator
extends BasicAllocator

Component container region allocator that provides its regions as a constraint-based grid of cells of different dimensions.

See Also:
GridAllocator., Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  LayoutDescription description
           
 
Fields inherited from class org.omegahat.Graphics.Layouts.BasicAllocator
cursor
 
Fields inherited from class org.omegahat.Environment.Utils.OrderedTable
listeners, name, orderedElements, orderedKeys, state
 
Fields inherited from interface org.omegahat.Environment.Databases.Database
ALL, ASSIGN, ATTACH, DETACH, NULL_ENTRY, READ, READ_WRITE, REMOVE
 
Fields inherited from interface org.omegahat.Environment.Databases.Activable
ACTIVE, INACTIVE
 
Constructor Summary
LayoutAllocator()
           
LayoutAllocator(double[] w, double[] h, int[][] order)
           
LayoutAllocator(int numRows, int numCols, int[][] order)
           
LayoutAllocator(UDouble[] widths, UDouble[] heights, int[][] order)
           
 
Method Summary
 void add(java.lang.Object obj, int order)
           
 RegionDescriptionInt createRegionDescription(int row, int col)
           
 LayoutDescription getDescription()
           
 Region getRegion(LayoutAllocatorRegionDescription desc, ScaleInt sx, ScaleInt sy, int parentOrigin, double widthCM, double heightCM, int fontSize, GraphicalContainerInt parent)
          Used by the LayoutAllocatorRegionDescription when they compute the actual Region for rendering, based on their parents actual size.
 void makeLayoutAllocator(UDouble[] widths, UDouble[] heights, int[][] order)
           
 
Methods inherited from class org.omegahat.Graphics.Layouts.BasicAllocator
getCursor, getRegionDescriptions, getRegions, hasNext, next, nextDescription, remove, setCursor, setDescription, setDescription, setDescription
 
Methods inherited from class org.omegahat.Environment.Utils.OrderedTable
add, add, addListListener, assign, assignSubset, attach, clear, copy, copy, detach, elementAt, exists, get, getName, getState, keys, listeners, listeners, notifyListeners, objects, ordered, orderedKeys, put, put, put, remove, remove, removeElement, removeElement, removeElementAt, removeElementAt, removeListListener, setElementAt, setName, setState, subset, subset, subset
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.omegahat.Environment.Databases.Database
size
 

Field Detail

description

protected LayoutDescription description
Constructor Detail

LayoutAllocator

public LayoutAllocator()

LayoutAllocator

public LayoutAllocator(int numRows,
                       int numCols,
                       int[][] order)

LayoutAllocator

public LayoutAllocator(double[] w,
                       double[] h,
                       int[][] order)

LayoutAllocator

public LayoutAllocator(UDouble[] widths,
                       UDouble[] heights,
                       int[][] order)
Method Detail

getDescription

public LayoutDescription getDescription()

add

public void add(java.lang.Object obj,
                int order)

makeLayoutAllocator

public void makeLayoutAllocator(UDouble[] widths,
                                UDouble[] heights,
                                int[][] order)

createRegionDescription

public RegionDescriptionInt createRegionDescription(int row,
                                                    int col)

getRegion

public Region getRegion(LayoutAllocatorRegionDescription desc,
                        ScaleInt sx,
                        ScaleInt sy,
                        int parentOrigin,
                        double widthCM,
                        double heightCM,
                        int fontSize,
                        GraphicalContainerInt parent)
Used by the LayoutAllocatorRegionDescription when they compute the actual Region for rendering, based on their parents actual size. They return to the allocator so that the computations for all the regions can be done in a single step.
Need way to cache these so that the first region description can ask to compute them and they are given to each subsequent description in response without recomputation. Have to worry about clearing them when all are "consumed" as well as being thread-safe.