org.omegahat.Graphics.Layouts
Class BasicAllocator

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

public abstract class BasicAllocator
extends OrderedTable
implements EnumeratedRegionAllocator

Simple container used as an EnumeratedRegionAllocator which remembers which RegionDescriptionInts have been consumed by earlier calls (to next()) and also provides both integer- and string-based indexing.

See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  int 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
BasicAllocator()
           
 
Method Summary
 int getCursor()
          Accessor for cursor field
 java.util.List getRegionDescriptions(GraphicalContainerInt parent)
           
 java.util.List getRegions(ScaleInt sx, ScaleInt sy, int parentOrigin, double widthCM, double heightCM, double fontSize, GraphicalContainerInt parentId)
          Opportunity to compute and assign actual regions based on the current size of the specified parent.
 boolean hasNext()
          Are there any more region descriptions available in this EnumeratedRegionAllocator that have not been previously accessed via the next method.
 java.lang.Object next()
           
 RegionDescriptionInt nextDescription()
          Get the next region description that has not been given to an earlier caller of this method.
 void remove()
          Optional method that removes the current object from the iterator feed without "getting" it!
 int setCursor(int value)
          Accessor for setting cursor field
 RegionDescriptionInt setDescription(int which, GraphicalComponentInt child, GraphicalContainerInt parent)
          Get the description indexed by order/position.
 RegionDescriptionInt setDescription(java.lang.Object which, GraphicalComponentInt go, GraphicalContainerInt parent)
          Get the description indexed by arbitrary identifier to be overridden by other classes.
 RegionDescriptionInt setDescription(java.lang.String which, GraphicalComponentInt child, GraphicalContainerInt parent)
          Get the description indexed by arbitrary object.
 
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

cursor

protected int cursor
Constructor Detail

BasicAllocator

public BasicAllocator()
Method Detail

nextDescription

public RegionDescriptionInt nextDescription()
Get the next region description that has not been given to an earlier caller of this method.
Specified by:
nextDescription in interface EnumeratedRegionAllocator

next

public java.lang.Object next()
Specified by:
next in interface EnumeratedRegionAllocator

hasNext

public boolean hasNext()
Are there any more region descriptions available in this EnumeratedRegionAllocator that have not been previously accessed via the next method.
Specified by:
hasNext in interface EnumeratedRegionAllocator

remove

public void remove()
Optional method that removes the current object from the iterator feed without "getting" it!
Specified by:
remove in interface EnumeratedRegionAllocator

getCursor

public int getCursor()
Accessor for cursor field

setCursor

public int setCursor(int value)
Accessor for setting cursor field

setDescription

public RegionDescriptionInt setDescription(int which,
                                           GraphicalComponentInt child,
                                           GraphicalContainerInt parent)
Get the description indexed by order/position.
Specified by:
setDescription in interface RegionAllocator

setDescription

public RegionDescriptionInt setDescription(java.lang.Object which,
                                           GraphicalComponentInt go,
                                           GraphicalContainerInt parent)
Get the description indexed by arbitrary identifier to be overridden by other classes. For example, a GridAllocator will understand an integer array of length 2.
Specified by:
setDescription in interface RegionAllocator

setDescription

public RegionDescriptionInt setDescription(java.lang.String which,
                                           GraphicalComponentInt child,
                                           GraphicalContainerInt parent)
Get the description indexed by arbitrary object.
Specified by:
setDescription in interface RegionAllocator

getRegionDescriptions

public java.util.List getRegionDescriptions(GraphicalContainerInt parent)
Specified by:
getRegionDescriptions in interface RegionAllocator

getRegions

public java.util.List getRegions(ScaleInt sx,
                                 ScaleInt sy,
                                 int parentOrigin,
                                 double widthCM,
                                 double heightCM,
                                 double fontSize,
                                 GraphicalContainerInt parentId)
Description copied from interface: RegionAllocator
Opportunity to compute and assign actual regions based on the current size of the specified parent. An allocator can then distribute the resulting regions to its descriptions to avoid recomputing them for each one separately and the presence of the parent can allow the results to be stored by parent and be retrieved in the draw method
Specified by:
getRegions in interface RegionAllocator