|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.batik.dom.svg.AbstractSVGList
This class is a base implementation for a live
list representation of SVG attributes.
This classe provides support for a SVG List
representation of an attribute. It implements
the basic functionnalities.
For a specific attribute, it requires a
attribute value
,
a parser
,
and the item creation
Whenever the attribute changes outside of
the control of the list, this list must be
invalidated
Nested Class Summary | |
protected class |
AbstractSVGList.ListBuilder
Local list handler implementation. |
Field Summary | |
protected java.util.List |
itemList
List of item |
protected boolean |
valid
Whether this list is valid. |
Constructor Summary | |
protected |
AbstractSVGList()
Creates a new AbstractSVGList. |
Method Summary | |
protected SVGItem |
appendItemImpl(java.lang.Object newItem)
Inserts a new item at the end of the list. |
protected abstract void |
checkItemType(java.lang.Object newItem)
Check the type of the element added to the list. |
void |
clear()
Clears all existing current items from the list, with the result being an empty list. |
protected void |
clear(java.util.List list)
Clear the list and set the parent of the items to null. |
protected abstract org.w3c.dom.DOMException |
createDOMException(short type,
java.lang.String key,
java.lang.Object[] args)
Create a DOM Exception. |
protected abstract SVGItem |
createSVGItem(java.lang.Object newItem)
Return the item to be placed in the list. |
protected abstract void |
doParse(java.lang.String value,
ListHandler builder)
Parse the value of the attribute and build a list. |
protected SVGItem |
getItemImpl(int index)
Returns the specified item from the list. |
protected abstract java.lang.String |
getItemSeparator()
Return the separator for the item is the list. |
int |
getNumberOfItems()
Return the number of items in the list. |
protected abstract java.lang.String |
getValueAsString()
Return the String value associated
to the attribute in the DOM. |
protected SVGItem |
initializeImpl(java.lang.Object newItem)
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. |
protected SVGItem |
insertItemBeforeImpl(java.lang.Object newItem,
int index)
Inserts a new item into the list at the specified position. |
void |
invalidate()
Invalidates this list. |
void |
itemChanged()
|
protected SVGItem |
removeIfNeeded(java.lang.Object newItem)
If the itemis already in another list, then remove the item from its parent list. |
protected void |
removeItem(SVGItem item)
Remove an item from the list. |
protected SVGItem |
removeItemImpl(int index)
Removes an existing item from the list. |
protected SVGItem |
replaceItemImpl(java.lang.Object newItem,
int index)
Replaces an existing item in the list with a new item. |
protected void |
resetAttribute()
Resets the value of the associated attribute. |
protected void |
resetAttribute(SVGItem item)
Resets the value of the associated attribute. |
protected void |
revalidate()
Initializes the list, if needed. |
protected abstract void |
setAttributeValue(java.lang.String value)
Apply the changes of the list to the attribute this list represents. |
protected void |
setValueAsString(java.util.List value)
Set the attribute value in the DOM. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean valid
protected java.util.List itemList
Constructor Detail |
protected AbstractSVGList()
Method Detail |
protected abstract java.lang.String getItemSeparator()
protected abstract SVGItem createSVGItem(java.lang.Object newItem)
Object
the implementation provide an item to be placed
in the list.
newItem
- paramter of the modification method
of the list
protected abstract void doParse(java.lang.String value, ListHandler builder) throws ParseException
value
- value of the attribute to be parsedbuilder
- list handler to create the list
ParseException
protected abstract void checkItemType(java.lang.Object newItem) throws SVGException
newItem
- object to test
SVGException
protected abstract java.lang.String getValueAsString()
String
value associated
to the attribute in the DOM.
protected abstract void setAttributeValue(java.lang.String value)
value
- new value of the attribute
the value can be null if no item
are present in the list.protected abstract org.w3c.dom.DOMException createDOMException(short type, java.lang.String key, java.lang.Object[] args)
public int getNumberOfItems()
public void clear() throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the listcannot be modified.protected SVGItem initializeImpl(java.lang.Object newItem) throws org.w3c.dom.DOMException, SVGException
newItem
- The item which should
become the only member of the list.
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the list cannot be modified.
SVGException
- SVG_WRONG_TYPE_ERR:
Raised if parameter newItem is the wrong
type of object for the given list.protected SVGItem getItemImpl(int index) throws org.w3c.dom.DOMException
index
- The index of the item
from the list which is to be returned.
The first item is number 0.
org.w3c.dom.DOMException
- INDEX_SIZE_ERR:
Raised if the index number is negative or
greater than or equal to numberOfItems.protected SVGItem insertItemBeforeImpl(java.lang.Object newItem, int index) throws org.w3c.dom.DOMException, SVGException
newItem
- The item which is to be inserted
into the list.index
- The index of the item before which
the new item is to be inserted. The first item
is number 0. If the index is equal to 0, then
the new item is inserted at the front of the
list. If the index is greater than or equal to
numberOfItems, then the new item is appended
to the end of the list.
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the list cannot be modified.
SVGException
- SVG_WRONG_TYPE_ERR:
Raised if parameter newItem is the wrong type of
object for the given list.protected SVGItem replaceItemImpl(java.lang.Object newItem, int index) throws org.w3c.dom.DOMException, SVGException
newItem
- The item which is to be inserted
into the list.index
- The index of the item which is to
be replaced. The first item is number 0.
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the list cannot be modified.
INDEX_SIZE_ERR:
Raised if the index number is negative or greater
than or equal to numberOfItems.
SVGException
- SVG_WRONG_TYPE_ERR:
Raised if parameter newItem is the wrong type
of object for the given list.protected SVGItem removeItemImpl(int index) throws org.w3c.dom.DOMException
index
- The index of the item which
is to be removed. The first item is number 0.
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the list cannot be modified.
INDEX_SIZE_ERR:
Raised if the index number is negative or greater
than or equal to numberOfItems.protected SVGItem appendItemImpl(java.lang.Object newItem) throws org.w3c.dom.DOMException, SVGException
newItem
- The item which is to be inserted
into the list. The first item is number 0.
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR:
Raised when the list cannot be modified.
SVGException
- SVG_WRONG_TYPE_ERR:
Raised if parameter newItem is the wrong type
of object for the given list.protected SVGItem removeIfNeeded(java.lang.Object newItem)
newItem
- : item to be removed
from its parent list potentially
protected void revalidate()
protected void setValueAsString(java.util.List value) throws org.w3c.dom.DOMException
value
- list of item to be used as
the new attribute value.
org.w3c.dom.DOMException
public void itemChanged()
protected void resetAttribute()
protected void resetAttribute(SVGItem item)
item
- : last item appendedpublic void invalidate()
protected void removeItem(SVGItem item)
item
- the item to be removed from
this listprotected void clear(java.util.List list)
list
- to be cleared
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |