Package org.odftoolkit.odfdom.changes
Class Component
java.lang.Object
org.odftoolkit.odfdom.changes.Component
- Direct Known Subclasses:
Row
,Table
,TextContainer
The component is a logical modular entity, to abstract from the implementation details of the
XML.
- Author:
- svante.schubertATgmail.com
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionComponent
(OdfElement componentElement) Only being used to create the root of all components, representing the document without a parent elementprotected
Component
(OdfElement componentElement, Component parent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given component as new child component.static Component
createChildComponent
(int position, Component parentComponent, OdfElement newChildElement) Inserts a component at the given position as childcreateChildComponent
(OdfElement componentRoot) Appending a child element to the componentstatic Component
createComponent
(Component parentComponent, OdfElement newChildElement) get
(org.json.JSONArray position) protected Component
get
(org.json.JSONArray position, boolean needParent, boolean needFollowingSibling, int depth) Get descendant component by its relative position to this component.static Map<String,
OdfStylePropertiesSet> getAllStyleGroupingIdProperties
(OdfStylableElement styleElement) static Map<String,
OdfStylePropertiesSet> getAllStyleGroupingIdProperties
(OdfStyleFamily styleFamily) getChildNode
(int position) getChildNode
(int startPosition, int endPosition) static OdfElement
getCorrectStartElementOfChild
(OdfElement parentElement, OdfElement existingChildElement) Sometimes (e.g. if the child is a paragraph within list elements).static OdfStyleFamily
static String
getFamilyDisplayName
(OdfStyleFamily styleFamily) static String
getFamilyID
(OdfStylableElement styleElement) static String
getFamilyID
(OdfStyleFamily styleFamily) static String
getFamilyName
(String styleId) static String
getMainStyleGroupingId
(OdfStylableElement styleElement) static String
getMainStyleGroupingId
(OdfStyleFamily styleFamily) getNextSiblingOf
(org.json.JSONArray position) Get next sibling component of the given position.Returns the parent componentgetParentOf
(org.json.JSONArray position) Get parent component of the given positionprotected String
protected static String
static String
getStyleNamePrefix
(OdfStylableElement styleElement) static String
getStyleNamePrefix
(OdfStyleFamily styleFamily) boolean
void
hasRepeated
(boolean hasRepeated) int
static boolean
isComponentRoot
(String uri, String localName) Tests if the given element is the start of a componentstatic boolean
isComponentRoot
(Element element) Tests if the given element is the start of a componentstatic boolean
isComponentWrapper
(String uri, String localName) Tests if the given element is the wrapper around a descendant component root elementstatic boolean
isComponentWrapper
(Element element) Tests if the given element is the wrapper around a descendant component root elementstatic boolean
isCoveredComponentRoot
(String uri, String localName) static boolean
isDocumentRoot
(String uri, String localName) Tests if the given element is the start of a documentstatic boolean
static boolean
isFooterRoot
(String uri, String localName) Tests if the given element is the start of a footer within a page style.static boolean
isHeaderRoot
(String uri, String localName) Tests if the given element is the start of a header within a page style.static boolean
isRowComponentRoot
(String uri, String localName) static boolean
isRowComponentRoot
(Node textContainer) static boolean
isShapeElement
(String uri, String localName) Tests if the given element is a shape element Shapes are in general those with elements with astatic boolean
isTextComponentRoot
(String uri, String localName) static boolean
isTextComponentRoot
(Node textContainer) Returns true if the Node is an TextPElement or TextHElement.static boolean
isTextSelection
(Node textSelection) static boolean
isWhiteSpaceElement
(String uri, String localName) Tests if the given element is a whitespace elementremove
(int position) Only removes from the component list, not from the DOMint
A multiple components can be represented by a single XML elementint
size()
Returns the number of child componentstoString()
-
Field Details
-
mRootElement
-
-
Constructor Details
-
Component
Only being used to create the root of all components, representing the document without a parent element -
Component
-
-
Method Details
-
isComponentRoot
Tests if the given element is the start of a component- Returns:
- true if the given element is the root of an ODF component
-
isComponentRoot
Tests if the given element is the start of a component- Returns:
- true if the given element is the root of an ODF component
-
isComponentWrapper
Tests if the given element is the wrapper around a descendant component root element- Returns:
- true if the given element is a potential wrapper around an ODF component
-
isComponentWrapper
Tests if the given element is the wrapper around a descendant component root element- Returns:
- true if the given element is a potential wrapper around an ODF component
-
isTextComponentRoot
Returns true if the Node is an TextPElement or TextHElement. Both are the root elements of text containers. Text container have special handline of whitespace, see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#White-space_Characters -
isTextComponentRoot
-
isRowComponentRoot
-
isRowComponentRoot
-
isField
-
isDocumentRoot
Tests if the given element is the start of a document- Returns:
- true if the given element is the root of an ODF document (e.g. office:text)
-
isHeaderRoot
Tests if the given element is the start of a header within a page style. The content of a header is equal to the content of a usual ODT text file (ie. <office:text>).- Returns:
- true if the given element is the root of a header (i.e. style:header)
-
isShapeElement
Tests if the given element is a shape element Shapes are in general those with elements with a- Returns:
- true if the given element is the root of an ODF shape element
-
isWhiteSpaceElement
Tests if the given element is a whitespace element- Returns:
- true if the given element is an ODF whitespace element
-
isCoveredComponentRoot
-
isTextSelection
- Returns:
- true if the node is a text delimiter element
-
getParent
Returns the parent component -
getCorrectStartElementOfChild
public static OdfElement getCorrectStartElementOfChild(OdfElement parentElement, OdfElement existingChildElement) Sometimes (e.g. if the child is a paragraph within list elements). The parent root element of the child component root element will not be directly children. It will be checked if there is a child element or list level 10 has reached. -
getLastChild
-
getOwnerDocument
-
getChildNode
- Returns:
- the child starting from the given position and at cut at the endPosition
-
getChildNode
- Returns:
- the child at the given position
-
get
-
get
protected Component get(org.json.JSONArray position, boolean needParent, boolean needFollowingSibling, int depth) Get descendant component by its relative position to this component. Counting starts with 0.- Parameters:
position
- relative position of the desired component relative to the current componentneedParent
- if true the parent of the given position is returnedneedFollowingSibling
- if true the next sibling of the given position is returned (exclusive to getPositionsFollowingSibling)
-
getNextSiblingOf
Get next sibling component of the given position. Counting start with 0. -
getParentOf
Get parent component of the given position -
getRootComponent
-
getChildren
-
getRootElement
- Returns:
- the root element of the component
-
createChildComponent
Appending a child element to the component -
createChildComponent
public static Component createChildComponent(int position, Component parentComponent, OdfElement newChildElement) Inserts a component at the given position as child- Parameters:
position
- of the component, a -1 is going to append the element
-
createComponent
-
addChild
Adds the given component as new child component. No XML elements are being changed!- Parameters:
index
- starting with 0 representing the position of the child, if -1 the new child will be appended
-
remove
Only removes from the component list, not from the DOM -
size
public int size()Returns the number of child components -
hasRepeated
public void hasRepeated(boolean hasRepeated) -
hasRepeated
public boolean hasRepeated() -
getPosition
- Returns:
- the position as a slash separated string
-
getPositionString
- Returns:
- the position as a slash separated string
-
indexOf
-
toString
-
getAllStyleGroupingIdProperties
public static Map<String,OdfStylePropertiesSet> getAllStyleGroupingIdProperties(OdfStylableElement styleElement) -
getAllStyleGroupingIdProperties
public static Map<String,OdfStylePropertiesSet> getAllStyleGroupingIdProperties(OdfStyleFamily styleFamily) -
getFamilyID
-
getMainStyleGroupingId
-
getStyleNamePrefix
-
getMainStyleGroupingId
-
getStyleNamePrefix
-
getFamilyID
-
getFamilyDisplayName
-
getFamilyName
- Returns:
- styleFamilyValue the
String
value * * * * * * * ofStyleFamilyAttribute
,
-
getFamily
- Returns:
- styleFamily the
OdfStyleFamily
representation * * * ofStyleFamilyAttribute
,
-
repetition
public int repetition()A multiple components can be represented by a single XML element- Returns:
- the number of components the elements represents
-