com.levigo.jadice.document
Class DocumentLayer

java.lang.Object
  extended by com.levigo.jadice.document.DocumentLayer
All Implemented Interfaces:
Comparable<DocumentLayer>

public class DocumentLayer
extends Object
implements Comparable<DocumentLayer>

Class representing a layer of a Document. The layers represent the z-axis of a document. Each Page in the document consists of a stack of AbstractPageSegments which correspond to DocumentLayers. In other words, a DocumentLayer represents a virtual slot in the stack of layers that make up the document whereas the PageSegments fill these slots.

Please note: the layers pertain to the whole document, therefore not all layers of a page need to be occupied with page segments.


Field Summary
static DocumentLayer ANNOTATIONS
          A layer typically used for annotations.
static DocumentLayer BACKGROUND
          A layer typically used for a document backdrop, e.g.
static DocumentLayer DEFAULT
          A layer typically used for the document itself.
HINT:
This layer is installed by default in the default layer cache.
static DocumentLayer EMBEDDED_ANNOTATIONS
          A layer typically used for format specific inline annotations.
static DocumentLayer FORM
          A layer typically used for form elements.
HINT:
This layer is installed by default in the default layer cache.
static List<DocumentLayer> STANDARD_LAYERS
          A list of the standard layers defined as constants in this class.
 
Method Summary
 int compareTo(DocumentLayer o)
          Compare two DocumentLayers.
 boolean equals(Object obj)
           
static DocumentLayer get(String name)
          Return the document layer with the given name.
static DocumentLayer get(String name, int priority)
          Return the document layer with the given name and priority.
 String getName()
          Gets the name.
 int getPriority()
          Return this layer's default ordering priority.
 int hashCode()
           
static void setDocumentLayerCache(DocumentLayerCache documentLayerCache)
          This method replaces the currently used layer cache.
 String toString()
          Return text representation of the layer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANNOTATIONS

public static final DocumentLayer ANNOTATIONS
A layer typically used for annotations.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well.


FORM

public static final DocumentLayer FORM
A layer typically used for form elements.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well.


EMBEDDED_ANNOTATIONS

public static final DocumentLayer EMBEDDED_ANNOTATIONS
A layer typically used for format specific inline annotations.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well.


DEFAULT

public static final DocumentLayer DEFAULT
A layer typically used for the document itself.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well.


BACKGROUND

public static final DocumentLayer BACKGROUND
A layer typically used for a document backdrop, e.g. a form image behind plain-text form-contents.
HINT:
This layer is installed by default in the default layer cache. If the layer cache implementation is replaced by another layer cache, it is up to that cache implementation to provide this layer as well.


STANDARD_LAYERS

public static final List<DocumentLayer> STANDARD_LAYERS
A list of the standard layers defined as constants in this class.

Method Detail

get

public static DocumentLayer get(String name)
Return the document layer with the given name. All layers with the same name will share the same instance as long as the default DocumentLayerCache is not replaced. If the layer does not already exist, a new layer will be created with its default priority being the same as DEFAULT.

Parameters:
name -
Returns:
the document layer for the given name.
Throws:
IllegalArgumentException - if name is null
See Also:
setDocumentLayerCache(DocumentLayerCache)

get

public static DocumentLayer get(String name,
                                int priority)
Return the document layer with the given name and priority. All layers with the same name will share the same instance as long as the default DocumentLayerCache is not replaced. If the layer does not already exist, a new layer will be created the given priority. If the layer does already exist, but the requested priority differs from the one of the existing layer, an IllegalArgumentException is thrown.

Parameters:
name - the layer name
priority - the priority.
Returns:
the document layer for the given name.
Throws:
IllegalArgumentException - if name is null or there is already a document layer with the given name, but the requested priority differs from the existing one's.
See Also:
setDocumentLayerCache(DocumentLayerCache)

setDocumentLayerCache

public static void setDocumentLayerCache(DocumentLayerCache documentLayerCache)
This method replaces the currently used layer cache.
HINT:
This method is intended for very special purposes only if the default cache implementations does not meet the application's requirements.

Parameters:
documentLayerCache - the new layer cache to be used, this parameter must not be null

getName

public String getName()
Gets the name.

Returns:
Returns a String

compareTo

public int compareTo(DocumentLayer o)
Compare two DocumentLayers. Comparison is done by comparing default priorities. For identical priorities the comparison falls back to the layers' names.

Specified by:
compareTo in interface Comparable<DocumentLayer>
See Also:
Comparable.compareTo(Object)

toString

public String toString()
Return text representation of the layer.

Overrides:
toString in class Object
See Also:
Object.toString()

getPriority

public int getPriority()
Return this layer's default ordering priority.

Ordering priorities indicate the layer position within the layer stack. Higher priorities indicating a position closer to the top of the layer stack, lower priorities positions closer to the bottom.

Returns:
priority the layer's ordering priority

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.