| org.itsnat.core.domutil.ElementListBase
All known Subclasses: org.itsnat.impl.core.domutil.ElementListBaseImpl,
ElementListBase | public interface ElementListBase extends ElementGroup,NodeList(Code) | | This utility interface represents and manages an integer indexed DOM Element list, a list
of consecutive elements with a single parent element.
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
ElementListBase.getElementAt(int) and NodeList.getLength() return the number of child DOM Elements
in the list.
author: Jose Maria Arranz Santamaria |
Method Summary | |
public Element | getElementAt(int index) Returns the element at the specified index.
Parameters: index - index of the element to search. | public Element | getElementFromNode(Node node) Returns the child element of the list containing the specified node. | public Element[] | getElements() Returns the element list as an array. | public Element | getFirstElement() Returns the first child element (element at position 0). | public Element | getLastElement() Returns the last child element (element at position getLength() - 1 ). | public ListElementInfo | getListElementInfoAt(int index) Returns an object info of the child element at the specified position.
Parameters: index - index of the element to search for. | public ListElementInfo | getListElementInfoFromNode(Node node) Returns an object info of the child element containing the specified node (or the node
is itself an element of the list).
Parameters: node - the node to search for. | public int | indexOfElement(Element elem) Returns the position of the specified element.
Parameters: elem - the element to search. | public boolean | isEmpty() Informs whether the list is empty (no elements). | public int | lastIndexOfElement(Element elem) Returns the position of the specified element searching backwards.
The result must be the same as
ElementListBase.indexOfElement(Element) because
there is no "duplicated" elements. | public 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. | public void | removeAllElements() Removes all elements. | public Element | removeElementAt(int index) Removes the specified element.
Parameters: index - index of the element to remove. | public void | removeElementRange(int fromIndex, int toIndex) Removes the elements between the specified indexes. |
getElementAt | public Element getElementAt(int index)(Code) | | Returns the element at the specified index.
Parameters: index - index of the element to search. the element in this position or null if index is out of range. |
getElements | public Element[] getElements()(Code) | | Returns the element list as an array.
the element array. |
getFirstElement | public Element getFirstElement()(Code) | | Returns the first child element (element at position 0).
the first child element or null is the list is empty. |
getLastElement | public Element getLastElement()(Code) | | Returns the last child element (element at position getLength() - 1 ).
the last child element or null is the list is empty. |
getListElementInfoAt | public ListElementInfo getListElementInfoAt(int index)(Code) | | Returns an object info of the child element at the specified position.
Parameters: index - index of the element to search for. the object info of the matched child element. Null if index is out of range. See Also: ElementListBase.getElementFromNode(Node) |
getListElementInfoFromNode | public ListElementInfo getListElementInfoFromNode(Node node)(Code) | | Returns an object info of the child element containing the specified node (or the node
is itself an element of the list).
Parameters: node - the node to search for. the object info of the matched child element. Null if this node is not contained by the list. See Also: ElementListBase.getListElementInfoAt(int) |
indexOfElement | public int indexOfElement(Element elem)(Code) | | Returns the position of the specified element.
Parameters: elem - the element to search. the position or -1 if the specified element is not in the list. |
isEmpty | public boolean isEmpty()(Code) | | Informs whether the list is empty (no elements).
true if the list is empty. |
lastIndexOfElement | public int lastIndexOfElement(Element elem)(Code) | | Returns the position of the specified element searching backwards.
The result must be the same as
ElementListBase.indexOfElement(Element) because
there is no "duplicated" elements. Use this method if the specified
element is near to the end of the list.
Parameters: elem - the element to search. the element position or -1 if the specified element is not in the list. |
moveElement | public void moveElement(int start, int end, int to)(Code) | | Moves one or more elements from the inclusive range 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)
Parameters: start - the starting element index to be moved Parameters: end - the ending element index to be moved Parameters: to - the destination of the elements to be moved |
removeAllElements | public void removeAllElements()(Code) | | Removes all elements. The list is now empty.
|
removeElementAt | public Element removeElementAt(int index)(Code) | | Removes the specified element.
Parameters: index - index of the element to remove. the removed element or null if index is out of bounds. |
removeElementRange | public void removeElementRange(int fromIndex, int toIndex)(Code) | | Removes the elements between the specified indexes.
Parameters: fromIndex - low index (inclusive). Parameters: toIndex - high index (inclusive). |
|
|