### org.jfree.layouting.layouter.model

# Class LayoutElement

- `java.lang.Object`
- - `org.jfree.layouting.layouter.model.LayoutNode`
  - - `org.jfree.layouting.layouter.model.LayoutElement`

Implemented Interfaces:
  Serializable

Known Direct 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

  ## Constructor Summary

  `LayoutElement(LayoutElement parent, LayoutElement previous, LayoutContext layoutContext)`

  ## Method Summary

  `LayoutContext`

  `detachLayoutContext()`

  `int`

  `getCounterValue(String counterName)`
    Returns the value for the given counter.

  `LayoutContext`

  `getLayoutContext()`

  `LayoutElement`

  `getPrevious()`

  `String`

  `getString(String name)`
    Retrieves the value for a given string.

  `void`

  `incrementCounter(String name, int value)`
    Increments the counter with the given name.

  `boolean`

  `isAlternateOpen()`

  `boolean`

  `isContentsConsumed()`

  `boolean`

  `isCounterDefined(String counterName)`

  `void`

  `openAlternate()`

  `void`

  `resetCounter(String name, int value)`
    Reseting an counter creates a new Counter-Instance.

  `void`

  `setContentsConsumed(boolean contentsConsumed)`

  `void`

  `setString(String name, String value, boolean define)`
    Sets a named string.

  ### Methods inherited from class org.jfree.layouting.layouter.model.LayoutNode

  `getParent`

## Constructor Details

### LayoutElement

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

## Method Details

### detachLayoutContext

    public LayoutContext detachLayoutContext()

### getCounterValue

    public int getCounterValue(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.

### getLayoutContext

    public LayoutContext getLayoutContext()

### getPrevious

    public LayoutElement getPrevious()

### getString

    public String getString(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:

### incrementCounter

    public void incrementCounter(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` -

### isAlternateOpen

    public boolean isAlternateOpen()

### isContentsConsumed

    public boolean isContentsConsumed()

### isCounterDefined

    public boolean isCounterDefined(String counterName)

### openAlternate

    public void openAlternate()

### resetCounter

    public void resetCounter(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` -

### setContentsConsumed

    public void setContentsConsumed(boolean contentsConsumed)

### setString

    public void setString(String name,
                          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.