org.jfree.layouting.layouter.model
Class LayoutElement

java.lang.Object
  extended by org.jfree.layouting.layouter.model.LayoutNode
      extended by org.jfree.layouting.layouter.model.LayoutElement
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LayoutRoot

public class LayoutElement
extends LayoutNode

Represents a DOM element. The tree is only backward-traversable; non-element nodes are not traversable at all.

All nodes hold a reference to their parent and all elements also hold a reference to their preceeding silbling nodes. This structure guarantees a minimal memory footprint, as nodes automaticly get garbage collected as soon as they have been fully processed. Manual cleaning is not needed.

This theory vanishes as soon as we enter the 'pinned' mode. In that mode, each element holds strong references to all of its childs. These childs do not go out of context unless the first pinned element does.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
LayoutElement(LayoutElement parent, LayoutElement previous, LayoutContext layoutContext)
           
 
Method Summary
 LayoutContext detachLayoutContext()
           
 int getCounterValue(java.lang.String counterName)
          Returns the value for the given counter.
 LayoutContext getLayoutContext()
           
 LayoutElement getPrevious()
           
 java.lang.String getString(java.lang.String name)
          Retrieves the value for a given string.
 void incrementCounter(java.lang.String name, int value)
          Increments the counter with the given name.
 boolean isAlternateOpen()
           
 boolean isContentsConsumed()
           
 boolean isCounterDefined(java.lang.String counterName)
           
 void openAlternate()
           
 void resetCounter(java.lang.String name, int value)
          Reseting an counter creates a new Counter-Instance.
 void setContentsConsumed(boolean contentsConsumed)
           
 void setString(java.lang.String name, java.lang.String value, boolean define)
          Sets a named string.
 
Methods inherited from class org.jfree.layouting.layouter.model.LayoutNode
getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutElement

public LayoutElement(LayoutElement parent,
                     LayoutElement previous,
                     LayoutContext layoutContext)
Method Detail

getPrevious

public LayoutElement getPrevious()

getLayoutContext

public LayoutContext getLayoutContext()

detachLayoutContext

public LayoutContext detachLayoutContext()

isContentsConsumed

public boolean isContentsConsumed()

setContentsConsumed

public void setContentsConsumed(boolean contentsConsumed)

getCounterValue

public int getCounterValue(java.lang.String counterName)
Returns the value for the given counter. If no counter exists under that name, this method returns 0.

Parameters:
counterName -
Returns:
the value for the given counter.

incrementCounter

public void incrementCounter(java.lang.String name,
                             int value)
Increments the counter with the given name. If no counter is known under that name, the root node will create one.

Parameters:
name -
value -

resetCounter

public void resetCounter(java.lang.String name,
                         int value)
Reseting an counter creates a new Counter-Instance. Counters from parent elements are not affected and remain unchanged. All further operations issued by all sub-elements will now work with this counter.

Parameters:
name -
value -

isCounterDefined

public boolean isCounterDefined(java.lang.String counterName)

setString

public void setString(java.lang.String name,
                      java.lang.String value,
                      boolean define)
Sets a named string.

Parameters:
name - the name
value - the value
define - if set to true, this defines a new nesting context.

getString

public java.lang.String getString(java.lang.String name)
Retrieves the value for a given string. The value returned always represents the *actual* value, ignoring any possibly defined page-policies.

Parameters:
name -
Returns:

openAlternate

public void openAlternate()

isAlternateOpen

public boolean isAlternateOpen()