Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.batik.dom.svg
Class AbstractSVGList  view AbstractSVGList download AbstractSVGList.java

java.lang.Object
  extended byorg.apache.batik.dom.svg.AbstractSVGList
Direct Known Subclasses:
AbstractSVGLengthList, AbstractSVGNumberList, AbstractSVGPathSegList, AbstractSVGPointList, AbstractSVGTransformList

public abstract class AbstractSVGList
extends java.lang.Object

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 55 , a parser 55 , and the item creation 55 Whenever the attribute changes outside of the control of the list, this list must be invalidated 55

Version:
$Id: AbstractSVGList.java,v 1.7 2005/03/27 08:58:32 cam Exp $

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

valid

protected boolean valid
Whether this list is valid.


itemList

protected java.util.List itemList
List of item

Constructor Detail

AbstractSVGList

protected AbstractSVGList()
Creates a new AbstractSVGList.

Method Detail

getItemSeparator

protected abstract java.lang.String getItemSeparator()
Return the separator for the item is the list.


createSVGItem

protected abstract SVGItem createSVGItem(java.lang.Object newItem)
Return the item to be placed in the list. According to the parameter of the real SVGList represented here by an Object the implementation provide an item to be placed in the list.


doParse

protected abstract void doParse(java.lang.String value,
                                ListHandler builder)
                         throws org.apache.batik.parser.ParseException
Parse the value of the attribute and build a list. Use a dedicated parser for the attribute and the list handler to build the list.


checkItemType

protected abstract void checkItemType(java.lang.Object newItem)
                               throws org.w3c.dom.svg.SVGException
Check the type of the element added to the list.


getValueAsString

protected abstract java.lang.String getValueAsString()
Return the String value associated to the attribute in the DOM.


setAttributeValue

protected abstract void setAttributeValue(java.lang.String value)
Apply the changes of the list to the attribute this list represents.


createDOMException

protected abstract org.w3c.dom.DOMException createDOMException(short type,
                                                               java.lang.String key,
                                                               java.lang.Object[] args)
Create a DOM Exception.


getNumberOfItems

public int getNumberOfItems()
Return the number of items in the list.


clear

public void clear()
           throws org.w3c.dom.DOMException
Clears all existing current items from the list, with the result being an empty list.


initializeImpl

protected SVGItem initializeImpl(java.lang.Object newItem)
                          throws org.w3c.dom.DOMException,
                                 org.w3c.dom.svg.SVGException
Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.


getItemImpl

protected SVGItem getItemImpl(int index)
                       throws org.w3c.dom.DOMException
Returns the specified item from the list.


insertItemBeforeImpl

protected SVGItem insertItemBeforeImpl(java.lang.Object newItem,
                                       int index)
                                throws org.w3c.dom.DOMException,
                                       org.w3c.dom.svg.SVGException
Inserts a new item into the list at the specified position. The first item is number 0. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.


replaceItemImpl

protected SVGItem replaceItemImpl(java.lang.Object newItem,
                                  int index)
                           throws org.w3c.dom.DOMException,
                                  org.w3c.dom.svg.SVGException
Replaces an existing item in the list with a new item. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.


removeItemImpl

protected SVGItem removeItemImpl(int index)
                          throws org.w3c.dom.DOMException
Removes an existing item from the list.


appendItemImpl

protected SVGItem appendItemImpl(java.lang.Object newItem)
                          throws org.w3c.dom.DOMException,
                                 org.w3c.dom.svg.SVGException
Inserts a new item at the end of the list. If newItem is already in a list, it is removed from its previous list before it is inserted into this list.


removeIfNeeded

protected SVGItem removeIfNeeded(java.lang.Object newItem)
If the itemis already in another list, then remove the item from its parent list. If not, create a proper item for the object representing the type of item the list contains checkItemItem was preformed previously.


revalidate

protected void revalidate()
Initializes the list, if needed.


setValueAsString

protected void setValueAsString(java.util.List value)
                         throws org.w3c.dom.DOMException
Set the attribute value in the DOM.


itemChanged

public void itemChanged()

resetAttribute

protected void resetAttribute()
Resets the value of the associated attribute.


resetAttribute

protected void resetAttribute(SVGItem item)
Resets the value of the associated attribute.


invalidate

public void invalidate()
Invalidates this list.


removeItem

protected void removeItem(SVGItem item)
Remove an item from the list. This operation takes place when an item was already in one list and is being added to another one.


clear

protected void clear(java.util.List list)
Clear the list and set the parent of the items to null.