public interface ElementListBase extends ElementGroup, org.w3c.dom.NodeList
Objects implementing this interface are attached to a real DOM element list with a single parent element, this "initial" list may be not empty, in fact it is automatically synchronized with the "real" DOM element list to show the current state when the utility object is created.
This interface only manages DOM Element objects as list elements, other node types like text nodes are ignored (filtered).
Indexes are zero-based.
When a DOM element is added or removed using this interface, this element is added/removed to/from the DOM list too.
The interface inherits from org.w3c.dom.NodeList
, the method
NodeList.item(int)
is equivalent to getElementAt(int)
and NodeList.getLength()
return the number of child DOM Elements
in the list.
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Element |
getElementAt(int index)
Returns the element at the specified index.
|
org.w3c.dom.Element |
getElementFromNode(org.w3c.dom.Node node)
Returns the child element of the list containing the specified node.
|
org.w3c.dom.Element[] |
getElements()
Returns the element list as an array.
|
org.w3c.dom.Element |
getFirstElement()
Returns the first child element (element at position 0).
|
org.w3c.dom.Element |
getLastElement()
Returns the last child element (element at position
getLength() - 1 ). |
ListElementInfo |
getListElementInfoAt(int index)
Returns an object info of the child element at the specified position.
|
ListElementInfo |
getListElementInfoFromNode(org.w3c.dom.Node node)
Returns an object info of the child element containing the specified node (or the node
is itself an element of the list).
|
int |
indexOfElement(org.w3c.dom.Element elem)
Returns the position of the specified element.
|
boolean |
isEmpty()
Informs whether the list is empty (no elements).
|
int |
lastIndexOfElement(org.w3c.dom.Element elem)
Returns the position of the specified element searching backwards.
|
void |
moveElement(int start,
int end,
int to)
Moves one or more elements from the inclusive range
start to
end to the to position in the list. |
void |
removeAllElements()
Removes all elements.
|
org.w3c.dom.Element |
removeElementAt(int index)
Removes the specified element.
|
void |
removeElementRange(int fromIndex,
int toIndex)
Removes the elements between the specified indexes.
|
getItsNatDocument, getParentElement
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
boolean isEmpty()
org.w3c.dom.Element removeElementAt(int index)
index
- index of the element to remove.void removeElementRange(int fromIndex, int toIndex)
fromIndex
- low index (inclusive).toIndex
- high index (inclusive).void removeAllElements()
void moveElement(int start, int end, int to)
start
to
end
to the to
position in the list.
After the move, the element that was at index start
will be at index to
.
Examples of moves:1. moveRow(1,3,5); a|B|C|D|e|f|g|h|i|j|k - before a|e|f|g|h|B|C|D|i|j|k - after
2. moveRow(6,7,1); a|b|c|d|e|f|G|H|i|j|k - before a|G|H|b|c|d|e|f|i|j|k - after
Behavior and documentation is based on DefaultTableModel.moveRow(int,int,int)
start
- the starting element index to be movedend
- the ending element index to be movedto
- the destination of the elements to be movedorg.w3c.dom.Element[] getElements()
org.w3c.dom.Element getElementAt(int index)
index
- index of the element to search.org.w3c.dom.Element getFirstElement()
org.w3c.dom.Element getLastElement()
getLength() - 1
).int indexOfElement(org.w3c.dom.Element elem)
elem
- the element to search.int lastIndexOfElement(org.w3c.dom.Element elem)
The result must be the same as indexOfElement(Element)
because
there is no "duplicated" elements. Use this method if the specified
element is near to the end of the list.
elem
- the element to search.org.w3c.dom.Element getElementFromNode(org.w3c.dom.Node node)
node
- the node to search for.indexOfElement(Element)
,
getListElementInfoFromNode(Node)
ListElementInfo getListElementInfoAt(int index)
index
- index of the element to search for.getElementFromNode(Node)
ListElementInfo getListElementInfoFromNode(org.w3c.dom.Node node)
node
- the node to search for.getListElementInfoAt(int)
Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.