public abstract class FormattingObject extends AbstractNodeWithAttributes
Modifier and Type | Field and Description |
---|---|
static FormattingObject[] |
EMPTY_ARRAY |
MAP_TYPE_FLYWEIGHT, MAP_TYPE_HASH
Modifier | Constructor and Description |
---|---|
protected |
FormattingObject(java.lang.String tag) |
protected |
FormattingObject(java.lang.String tag,
FormattingObject parent) |
Modifier and Type | Method and Description |
---|---|
void |
addElement(int index,
java.lang.Object e)
Adds a node element at
index to this node. |
void |
addElement(java.lang.Object e)
Adds a node element to this node.
|
boolean |
addUnsafe(int idx,
java.lang.Object element)
Adds a NodeElement to this FormattingObject at a given index.
|
boolean |
addUnsafe(java.lang.Object element)
Adds a NodeElement to this FormattingObject.
|
java.lang.Object |
clone()
Clones this element.
|
protected static FormattingObject |
cloned(FormattingObject o,
Node cloneParent)
Clones a formatting object and sets it's parent node.
|
protected java.util.List |
clonedList(java.util.List list,
Node parent)
Clones a list of nodes and formatting objects and sets the parent
of cloned nodes.
|
java.lang.String |
createUniqueID()
Creates and sets an unique ID for this formatting object.
|
java.lang.String |
createUniqueID(java.lang.String prefix)
Creates and sets an unique ID for this formatting object.
|
protected java.lang.Object |
doGetAttribute(java.lang.String name)
Overrides doGetAttribute of AbstractNode.
|
protected boolean |
doSetAttribute(java.lang.String name,
java.lang.Object value)
Overrides doSetAttribute of AbstractNode.
|
int |
elementCount()
Gets the number of elements in content.
|
java.lang.Object |
get(int idx)
Gets an element of the content.
|
protected AbsolutePosition |
getAbsolutePosition()
Gets the absolute position of this fo.
|
protected Accessibility |
getAccessibility()
Gets the accessibilty of this fo.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributeMap()
Gets a map of all defined attributes.
|
protected Background |
getBackground()
Gets the background of this fo.
|
protected Border |
getBorder()
Gets the border of this fo.
|
java.util.Set<java.lang.String> |
getDefinedAttributes() |
Document |
getDocument()
Returns the document that contains this formatting object or NULL if
this object is not assigned to a document.
|
FontSupport |
getFont()
Gets the font-support of this fo.
|
java.lang.String |
getID()
Gets the ID of this formatting object.
|
java.lang.String |
getLanguage() |
protected org.apache.commons.logging.Log |
getLogger()
Gets the core logger of jFO.
|
protected Margin |
getMargin()
Gets the margin of this fo.
|
protected Measure |
getMeasureValue(java.lang.String name)
Gets a value as a measure.
|
protected java.lang.Object |
getObjectValue(java.lang.String key,
boolean deep,
java.lang.Class<?> objClass) |
protected java.lang.Object |
getObjectValue(java.lang.String key,
boolean deep,
java.lang.Class<?> objClass,
java.lang.Object defaultObject) |
protected java.lang.Object |
getObjectValue(java.lang.String key,
java.lang.Class<?> objClass) |
protected java.lang.Object |
getObjectValue(java.lang.String key,
java.lang.Class<?> objClass,
java.lang.Object defaultObject) |
int |
getOrphans()
Gets the number of orphans.
|
protected Padding |
getPadding()
Gets the padding of this fo.
|
FormattingObject |
getParentFO()
Gets the parent formatting object of this.
|
protected RelativePosition |
getRelativePosition()
Gets the relative position of this fo.
|
int |
getWidows()
Gets the number of widows.
|
protected boolean |
hasBorder()
Returns true if at least one border attribute is set.
|
boolean |
hasID()
Determinates, if this formatting object. has an ID.
|
protected boolean |
hasPadding()
Returns true if at least one padding attribute is set.
|
boolean |
isEmpty()
Tests, if the content is empty (has no elements).
|
boolean |
isHyphenation() |
java.lang.Object |
removeElement(int i)
Removes an element from this node.
|
boolean |
removeElement(java.lang.Object e)
Removes an element from this node.
|
boolean |
replaceElement(java.lang.Object oldElement,
java.lang.Object newElement)
Replaces an element.
|
protected void |
setAbsolutePosition(AbsolutePosition pos)
Sets the absolute position of this fo.
|
protected void |
setAccessibility(Accessibility access)
Sets the accessibility of this fo.
|
protected void |
setAttribute(boolean enabled,
java.lang.String name,
java.lang.String value) |
void |
setAttribute(java.lang.String name,
boolean value)
Sets a value.
|
void |
setAttribute(java.lang.String name,
java.awt.Color value)
Sets a value.
|
void |
setAttribute(java.lang.String name,
double value)
Sets an attribute.
|
void |
setAttribute(java.lang.String name,
int value)
Sets an attribute.
|
protected void |
setBackground(Background bg)
Sets the background of this fo.
|
protected void |
setBorder(Border border)
Sets the border of this fo.
|
java.lang.Object |
setElement(int index,
java.lang.Object e)
Replaces a node element at
index of this node. |
void |
setFont(FontSupport fs)
Sets the FontSupport of this fo.
|
void |
setHyphenation(boolean hyphenate) |
void |
setID(java.lang.String id)
Sets the ID of this formatting object.
|
void |
setLanguage(java.util.Locale locale) |
void |
setLanguage(java.lang.String lang) |
protected void |
setMargin(Margin margin)
Sets the margin of this fo.
|
void |
setOrphans(int orphans)
Sets the number of orphans.
|
protected void |
setPadding(Padding padding)
Sets the padding of this fo.
|
protected void |
setRelativePosition(RelativePosition pos)
Sets the relative position of this fo.
|
void |
setWidows(int widows)
Sets the number of widows.
|
getDefaultMapType, setDefaultMapType
addAttributeChangeListener, addElements, addElements, clearEqualAttributes, clearInheratedAttribute, clearInheratedAttributes, clearValue, contains, contains, copyAttributes, createID, findFirstNodeWithText, findNode, findNodesWithText, fire, fireSaxEvents, firstElement, getAttrAsBoolean, getAttrAsInteger, getAttrAsString, getAttrAsString, getAttribute, getAttribute, getAttributeMap, getContentText, getContentText, getDefinedAttributes, getElements, getElements, getElements, getElements, getFirstElement, getIndex, getLocalName, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getParent, getParent, getParent, getParentOrThis, getQName, getRoot, hasEqualAttrs, indexOf, lastElement, liftInheritedAttribute, removeAttributeChangeListener, setAttribute, setAttributes, setAttrIfNotNull, setEnableAttributeChangeEvent, setNamespace, setParent, setQName, setUndefinedAttributes, writeTo, writeTo, writeTo, writeTo
public static final FormattingObject[] EMPTY_ARRAY
protected FormattingObject(java.lang.String tag)
protected FormattingObject(java.lang.String tag, FormattingObject parent)
public java.util.Set<java.lang.String> getDefinedAttributes()
getDefinedAttributes
in class AbstractNodeWithAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
AbstractNode
getAttributeMap
in interface Node
getAttributeMap
in class AbstractNodeWithAttributes
public boolean isEmpty()
isEmpty
in interface Node
isEmpty
in class AbstractNode
public int elementCount()
public java.lang.Object get(int idx)
idx
- Index of element.public FormattingObject getParentFO()
public void setAttribute(java.lang.String name, double value)
name
- Name of Attribute.value
- Value.public void setAttribute(java.lang.String name, int value)
name
- Name of Attribute.value
- Value.public void setAttribute(java.lang.String name, boolean value)
name
- Name of Attribute.value
- Value.public void setAttribute(java.lang.String name, java.awt.Color value)
name
- Name of Attribute.value
- Value.public boolean hasID()
public java.lang.String getID()
public void setID(java.lang.String id)
id
- New ID.public java.lang.String createUniqueID()
public java.lang.String createUniqueID(java.lang.String prefix)
public void addElement(java.lang.Object e)
e
- Node element.java.lang.UnsupportedOperationException
- is throws if no childreen are allowed.java.lang.NullPointerException
- is thrown if e==null
public void addElement(int index, java.lang.Object e)
index
to this node.index
- Index of element.e
- Node element.java.lang.IndexOutOfBoundsException
- is thrown if index
is out of bounds.java.lang.UnsupportedOperationException
- is throws if no childreen are allowed.java.lang.NullPointerException
- is thrown if e==null
public java.lang.Object setElement(int index, java.lang.Object e)
index
of this node.index
- Index of element.e
- Node element.java.lang.IndexOutOfBoundsException
- is thrown if index
is out of bounds.java.lang.UnsupportedOperationException
- is throws if no childreen are allowed.java.lang.NullPointerException
- is thrown if e==null
public boolean removeElement(java.lang.Object e)
e
- NodeElementpublic java.lang.Object removeElement(int i)
i
- Index of element.java.lang.IndexOutOfBoundsException
- is thrown if index
is out of bounds.public boolean replaceElement(java.lang.Object oldElement, java.lang.Object newElement)
oldElement
- Old element.newElement
- New element.true
if this node contained oldElementpublic boolean addUnsafe(java.lang.Object element)
element
- Element.false
if this FO is unable to add object.java.lang.UnsupportedOperationException
- if not supported by this object.public boolean addUnsafe(int idx, java.lang.Object element)
idx
- Index.element
- Element.false
if this FO is unable to add object.java.lang.UnsupportedOperationException
- if not supported by this object.public Document getDocument()
public void setLanguage(java.lang.String lang)
public void setLanguage(java.util.Locale locale)
public java.lang.String getLanguage()
public void setHyphenation(boolean hyphenate)
public boolean isHyphenation()
public void setOrphans(int orphans)
orphans
- Number of orphans.Attributes.ORPHANS
public int getOrphans()
Attributes.ORPHANS
public void setWidows(int widows)
widows
- Number of widows.Attributes.WIDOWS
public int getWidows()
Attributes.WIDOWS
public final FontSupport getFont()
public final void setFont(FontSupport fs)
fs
- FontSupport.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
NodeElement
clone
in interface NodeElement
clone
in class AbstractNodeWithAttributes
java.lang.CloneNotSupportedException
protected void setAttribute(boolean enabled, java.lang.String name, java.lang.String value)
protected java.lang.Object getObjectValue(java.lang.String key, boolean deep, java.lang.Class<?> objClass)
protected java.lang.Object getObjectValue(java.lang.String key, java.lang.Class<?> objClass)
protected java.lang.Object getObjectValue(java.lang.String key, java.lang.Class<?> objClass, java.lang.Object defaultObject)
protected java.lang.Object getObjectValue(java.lang.String key, boolean deep, java.lang.Class<?> objClass, java.lang.Object defaultObject)
protected Measure getMeasureValue(java.lang.String name)
name
- Name of value.protected final boolean doSetAttribute(java.lang.String name, java.lang.Object value)
doSetAttribute
in class AbstractNodeWithAttributes
name
- Name of value.value
- Value.true
, if value was set.protected final java.lang.Object doGetAttribute(java.lang.String name)
doGetAttribute
in class AbstractNodeWithAttributes
name
- Name of attribute.protected Border getBorder()
protected void setBorder(Border border)
border
- Border.protected boolean hasBorder()
protected Padding getPadding()
protected boolean hasPadding()
protected void setPadding(Padding padding)
padding
- Padding.protected Margin getMargin()
protected void setMargin(Margin margin)
margin
- Margin.protected AbsolutePosition getAbsolutePosition()
protected RelativePosition getRelativePosition()
protected Background getBackground()
protected void setBackground(Background bg)
bg
- Background.protected void setAccessibility(Accessibility access)
access
- Accessibility.protected Accessibility getAccessibility()
protected void setAbsolutePosition(AbsolutePosition pos)
pos
- AbsolutePosition.protected void setRelativePosition(RelativePosition pos)
pos
- RelativePosition.protected org.apache.commons.logging.Log getLogger()
protected static FormattingObject cloned(FormattingObject o, Node cloneParent)
o
- Formatting object.cloneParent
- Parent of formatting object.protected java.util.List clonedList(java.util.List list, Node parent) throws java.lang.CloneNotSupportedException
list
- List.parent
- Parent of cloned nodes.java.lang.CloneNotSupportedException
© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.