Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.batik.dom.svg
Class AbstractSVGList

    java.lang.Object
      org.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`, 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 SVGList.

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 SVGList.

Method Detail

### getItemSeparator

    protected abstract java.lang.String getItemSeparator()

  Return the separator for the item is the list.

  Returns:
    separator of items in 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.

  Parameters:
    `newItem` - paramter of the modification method of the list
  Returns:
    an item to be placed in the list.

### doParse

    protected abstract void doParse(java.lang.String value,
                                    ListHandler builder)
                             throws 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.

  Parameters:
    `value` - value of the attribute to be parsed
    `builder` - list handler to create the list
  Throws:
    `ParseException`

### checkItemType

    protected abstract void checkItemType(java.lang.Object newItem)
                                   throws SVGException

  Check the type of the element added to the list.

  Parameters:
    `newItem` - object to test
  Throws:
    `SVGException`

### getValueAsString

    protected abstract java.lang.String getValueAsString()

  Return the `String` value associated to the attribute in the DOM.

  Returns:
    value of the attribute

### setAttributeValue

    protected abstract void setAttributeValue(java.lang.String value)

  Apply the changes of the list to the attribute this list represents.

  Parameters:
    `value` - new value of the attribute the value can be null if no item are present in the list.

### 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.

  Returns:
    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.

  Throws:
    `org.w3c.dom.DOMException` - NO_MODIFICATION_ALLOWED_ERR: Raised when the listcannot be modified.

### initializeImpl

    protected SVGItem initializeImpl(java.lang.Object newItem)
                              throws org.w3c.dom.DOMException,
                                     SVGException

  Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.

  Parameters:
    `newItem` - The item which should become the only member of the list.
  Returns:
    The item being inserted into the list.
  Throws:
    `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.

### getItemImpl

    protected SVGItem getItemImpl(int index)
                           throws org.w3c.dom.DOMException

  Returns the specified item from the list.

  Parameters:
    `index` - The index of the item from the list which is to be returned. The first item is number 0.
  Returns:
    The selected item.
  Throws:
    `org.w3c.dom.DOMException` - INDEX_SIZE_ERR: Raised if the index number is negative or greater than or equal to numberOfItems.

### insertItemBeforeImpl

    protected SVGItem insertItemBeforeImpl(java.lang.Object newItem,
                                           int index)
                                    throws org.w3c.dom.DOMException,
                                           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.

  Parameters:
    `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.
  Returns:
    The inserted item.
  Throws:
    `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.

### replaceItemImpl

    protected SVGItem replaceItemImpl(java.lang.Object newItem,
                                      int index)
                               throws org.w3c.dom.DOMException,
                                      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.

  Parameters:
    `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.
  Returns:
    The inserted item.
  Throws:
    `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.

### removeItemImpl

    protected SVGItem removeItemImpl(int index)
                              throws org.w3c.dom.DOMException

  Removes an existing item from the list.

  Parameters:
    `index` - The index of the item which is to be removed. The first item is number 0.
  Returns:
    The removed item.
  Throws:
    `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.

### appendItemImpl

    protected SVGItem appendItemImpl(java.lang.Object newItem)
                              throws org.w3c.dom.DOMException,
                                     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.

  Parameters:
    `newItem` - The item which is to be inserted into the list. The first item is number 0.
  Returns:
    The inserted item.
  Throws:
    `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.

### 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.

  Parameters:
    `newItem` - : item to be removed from its parent list potentially
  Returns:
    item to be inserted in the list.

### 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.

  Parameters:
    `value` - list of item to be used as the new attribute value.
  Throws:
    `org.w3c.dom.DOMException`

### 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.

  Parameters:
    `item` - : last item appended

### 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.

  Parameters:
    `item` - the item to be removed from this list

### clear

    protected void clear(java.util.List list)

  Clear the list and set the parent of the items to null.

  Parameters:
    `list` - to be cleared

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Apache Software Foundation. All Rights Reserved.