## org.apache.batik.apps.svgbrowser
Class HistoryBrowserInterface

    java.lang.Object
      org.apache.batik.apps.svgbrowser.HistoryBrowserInterface

    public class HistoryBrowserInterface

extends java.lang.Object

The wrapper for the history browser. The commands for the historyBrowser are implemented here

Nested Class Summary
`static class` `HistoryBrowserInterface.AppendChildCommand` The AppendChild command.
`static class` `HistoryBrowserInterface.AttributeAddedCommand` Adds the attribute to an element (MutationEvent.ADDITION)
`static class` `HistoryBrowserInterface.AttributeModifiedCommand` Modifies the attribute of an element (MutationEvent.MODIFICATION)
`static class` `HistoryBrowserInterface.AttributeRemovedCommand` Removes the attribute of an element (MutationEvent.REMOVAL)
`static class` `HistoryBrowserInterface.ChangeNodeValueCommand` The Change Node Value command.
`static class` `HistoryBrowserInterface.CharDataModifiedCommand` Sets the node value.
`static class` `HistoryBrowserInterface.CompoundUpdateCommand` The compound command.
`static class` `HistoryBrowserInterface.InsertNodeBeforeCommand` Inserts the given node as a child to the given parent node before the specified sibling node, or as the last child of the given parent, if the sibling node is null.
`static class` `HistoryBrowserInterface.NodeInsertedCommand` Inserts the given node as a child of another.
`static class` `HistoryBrowserInterface.NodeRemovedCommand` Removes the node from its parent node.
`static class` `HistoryBrowserInterface.RemoveChildCommand` The RemoveChild command.
`static class` `HistoryBrowserInterface.ReplaceChildCommand` insertBefore

Field Summary
`protected AbstractCompoundCommand` `currentCompoundCommand` Used to group custom number of changes into a single command.
`protected HistoryBrowser` `historyBrowser` The history browser.

Constructor Summary
`HistoryBrowserInterface(HistoryBrowser.CommandController commandController)` Constructor.

Method Summary
`void` `addToCurrentCompoundCommand(AbstractUndoableCommand cmd)` Adds the given command to current compound command.
`void` `appendChild(org.w3c.dom.Node parent, org.w3c.dom.Node child)` Adds and executes the AppendChildCommand to historyBrowser.
`void` `attributeAdded(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String newAttributeValue, java.lang.String namespaceURI)` Adds the AttributeAddedCommand to historyBrowser.
`void` `attributeModified(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String newAttributeValue, java.lang.String namespaceURI)` Adds the AttributeModifiedCommand to historyBrowser.
`void` `attributeRemoved(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String namespaceURI)` Adds the AttributeRemovedCommand to historyBrowser.
`void` `charDataModified(org.w3c.dom.Node contextNode, java.lang.String oldValue, java.lang.String newValue)` Adds CharDataModifiedCommand to historyBrowser.
`HistoryBrowserInterface.AppendChildCommand` `createAppendChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node child)` Creates and return the AppendChild command.
`HistoryBrowserInterface.AttributeAddedCommand` `createAttributeAddedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String newAttributeValue, java.lang.String namespaceURI)` Creates the AttributeAdded command.
`HistoryBrowserInterface.AttributeModifiedCommand` `createAttributeModifiedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String newAttributeValue, java.lang.String namespaceURI)` Creates the AttributeModified command.
`HistoryBrowserInterface.AttributeRemovedCommand` `createAttributeRemovedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String namespaceURI)` Creates the AttributeRemoved command.
`HistoryBrowserInterface.ChangeNodeValueCommand` `createChangeNodeValueCommand(org.w3c.dom.Node contextNode, java.lang.String newValue)` Creates and returns the ChangeNodeValue command.
`HistoryBrowserInterface.CharDataModifiedCommand` `createCharDataModifiedCommand(org.w3c.dom.Node contextNode, java.lang.String oldValue, java.lang.String newValue)` Creates the CharDataModified command.
`HistoryBrowserInterface.CompoundUpdateCommand` `createCompoundUpdateCommand(java.lang.String commandName)` Creates the compound update command, that consists of custom number of commands.
`UndoableCommand` `createInsertChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)` Creates InsertChildBefore or AppendChild command, depending on the value of siblingNode.
`HistoryBrowserInterface.InsertNodeBeforeCommand` `createInsertNodeBeforeCommand(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)` Creates and returns the InsertNodeBeforeCommand.
`HistoryBrowserInterface.CompoundUpdateCommand` `createNodeChangedCommand(org.w3c.dom.Node node)` Creates the compound NodeChangedCommand.
`HistoryBrowserInterface.NodeInsertedCommand` `createNodeInsertedCommand(org.w3c.dom.Node newParent, org.w3c.dom.Node newSibling, org.w3c.dom.Node contextNode)` Creates the NodeInserted command.
`HistoryBrowserInterface.NodeRemovedCommand` `createNodeRemovedCommand(org.w3c.dom.Node oldParent, org.w3c.dom.Node oldSibling, org.w3c.dom.Node contextNode)` Creates the NodeRemoved command.
`HistoryBrowserInterface.CompoundUpdateCommand` `createNodesDroppedCommand(java.util.ArrayList nodes)` Creates the compound NodesDroppedCommand.
`HistoryBrowserInterface.RemoveChildCommand` `createRemoveChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node child)` Creates and returns the RemoveChild command.
`HistoryBrowserInterface.CompoundUpdateCommand` `createRemoveSelectedTreeNodesCommand(java.util.ArrayList nodes)` Creates the compound RemoveSelectedTreeNodesCommand.
`AbstractCompoundCommand` `getCurrentCompoundCommand()` Gets the current compound command.
`HistoryBrowser` `getHistoryBrowser()` Gets the history browser.
`void` `insertChildBefore(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)` Adds and executes the InsertNodeBeforeCommand to historyBrowser.
`void` `nodeInserted(org.w3c.dom.Node newParent, org.w3c.dom.Node newSibling, org.w3c.dom.Node contextNode)` Adds the NodeInsertedCommand to historyBrowser.
`void` `nodeRemoved(org.w3c.dom.Node oldParent, org.w3c.dom.Node oldSibling, org.w3c.dom.Node contextNode)` Adds the NodeRemovedCommand to historyBrowser.
`void` `performCompoundUpdateCommand(UndoableCommand command)` Executes the given compound update command.
`void` `performCurrentCompoundCommand()` Adds and executes the current compound command to history browser.
`void` `removeChild(org.w3c.dom.Node parent, org.w3c.dom.Node child)` Adds and executes the RemoveChild command to the History Browser.
`void` `replaceChild(org.w3c.dom.Node parent, org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)` Adds and executes the ReplaceChild command to historyBrowser.
`void` `setCommmandController(HistoryBrowser.CommandController newCommandController)` Sets the history browser's command controller.
`void` `setNodeValue(org.w3c.dom.Node contextNode, java.lang.String newValue)` Adds and executes the ChangeNodeValueCommand to historyBrowser.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### historyBrowser

    protected HistoryBrowser historyBrowser

  The history browser.

### currentCompoundCommand

    protected AbstractCompoundCommand currentCompoundCommand

  Used to group custom number of changes into a single command.

Constructor Detail

### HistoryBrowserInterface

    public HistoryBrowserInterface(HistoryBrowser.CommandController commandController)

  Constructor. Creates the history browser.

Method Detail

### setCommmandController

    public void setCommmandController(HistoryBrowser.CommandController newCommandController)

  Sets the history browser's command controller.

  Parameters:
    `newCommandController` - The commandController to set

### createCompoundUpdateCommand

    public HistoryBrowserInterface.CompoundUpdateCommand createCompoundUpdateCommand(java.lang.String commandName)

  Creates the compound update command, that consists of custom number of commands.

  Parameters:
    `commandName` - Compound command name
  Returns:
    CompoundUpdateCommand

### createNodeChangedCommand

    public HistoryBrowserInterface.CompoundUpdateCommand createNodeChangedCommand(org.w3c.dom.Node node)

  Creates the compound NodeChangedCommand. Used to create the 'dynamic' NodeChangedCommand name

  Returns:
    the CompoundUpdateCommand

### createNodesDroppedCommand

    public HistoryBrowserInterface.CompoundUpdateCommand createNodesDroppedCommand(java.util.ArrayList nodes)

  Creates the compound NodesDroppedCommand. Used to create the 'dynamic' NodesDroppedCommand name

  Parameters:
    `nodes` - The list of the nodes that are being dropped
  Returns:
    the CompoundUpdateCommand

### createRemoveSelectedTreeNodesCommand

    public HistoryBrowserInterface.CompoundUpdateCommand createRemoveSelectedTreeNodesCommand(java.util.ArrayList nodes)

  Creates the compound RemoveSelectedTreeNodesCommand. Used to create the 'dynamic' RemoveSelectedTreeNodesCommand name

  Parameters:
    `nodes` - The list of the nodes that are selected and should be removed
  Returns:
    the RemoveSelectedTreeNodesCommand

### performCompoundUpdateCommand

    public void performCompoundUpdateCommand(UndoableCommand command)

  Executes the given compound update command.

  Parameters:
    `command` - The given compound update command

### getHistoryBrowser

    public HistoryBrowser getHistoryBrowser()

  Gets the history browser.

  Returns:
    the historyBrowser

### nodeInserted

    public void nodeInserted(org.w3c.dom.Node newParent,
                             org.w3c.dom.Node newSibling,
                             org.w3c.dom.Node contextNode)

  Adds the NodeInsertedCommand to historyBrowser.

  Parameters:
    `newParent` - New parent node
    `newSibling` - New (next) sibling node
    `contextNode` - The node to be appended

### createNodeInsertedCommand

    public HistoryBrowserInterface.NodeInsertedCommand createNodeInsertedCommand(org.w3c.dom.Node newParent,
                                                                                 org.w3c.dom.Node newSibling,
                                                                                 org.w3c.dom.Node contextNode)

  Creates the NodeInserted command.

  Parameters:
    `newParent` - New parent node
    `newSibling` - New (next) sibling node
    `contextNode` - The node to be appended

### nodeRemoved

    public void nodeRemoved(org.w3c.dom.Node oldParent,
                            org.w3c.dom.Node oldSibling,
                            org.w3c.dom.Node contextNode)

  Adds the NodeRemovedCommand to historyBrowser.

  Parameters:
    `oldParent` - The node's old parent
    `oldSibling` - The node's old next sibling
    `contextNode` - The node to be removed

### createNodeRemovedCommand

    public HistoryBrowserInterface.NodeRemovedCommand createNodeRemovedCommand(org.w3c.dom.Node oldParent,
                                                                               org.w3c.dom.Node oldSibling,
                                                                               org.w3c.dom.Node contextNode)

  Creates the NodeRemoved command.

  Parameters:
    `oldParent` - The node's old parent
    `oldSibling` - The node's old next sibling
    `contextNode` - The node to be removed

### attributeAdded

    public void attributeAdded(org.w3c.dom.Element contextElement,
                               java.lang.String attributeName,
                               java.lang.String newAttributeValue,
                               java.lang.String namespaceURI)

  Adds the AttributeAddedCommand to historyBrowser.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `newAttributeValue` - The attribute value
    `namespaceURI` - The namespaceURI

### createAttributeAddedCommand

    public HistoryBrowserInterface.AttributeAddedCommand createAttributeAddedCommand(org.w3c.dom.Element contextElement,
                                                                                     java.lang.String attributeName,
                                                                                     java.lang.String newAttributeValue,
                                                                                     java.lang.String namespaceURI)

  Creates the AttributeAdded command.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `newAttributeValue` - The attribute value
    `namespaceURI` - The namespaceURI

### attributeRemoved

    public void attributeRemoved(org.w3c.dom.Element contextElement,
                                 java.lang.String attributeName,
                                 java.lang.String prevAttributeValue,
                                 java.lang.String namespaceURI)

  Adds the AttributeRemovedCommand to historyBrowser.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `prevAttributeValue` - The previous attribute value
    `namespaceURI` - The namespaceURI

### createAttributeRemovedCommand

    public HistoryBrowserInterface.AttributeRemovedCommand createAttributeRemovedCommand(org.w3c.dom.Element contextElement,
                                                                                         java.lang.String attributeName,
                                                                                         java.lang.String prevAttributeValue,
                                                                                         java.lang.String namespaceURI)

  Creates the AttributeRemoved command.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `prevAttributeValue` - The previous attribute value
    `namespaceURI` - The namespaceURI

### attributeModified

    public void attributeModified(org.w3c.dom.Element contextElement,
                                  java.lang.String attributeName,
                                  java.lang.String prevAttributeValue,
                                  java.lang.String newAttributeValue,
                                  java.lang.String namespaceURI)

  Adds the AttributeModifiedCommand to historyBrowser.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `prevAttributeValue` - The previous attribute value
    `newAttributeValue` - The new attribute value
    `namespaceURI` - The namespaceURI

### createAttributeModifiedCommand

    public HistoryBrowserInterface.AttributeModifiedCommand createAttributeModifiedCommand(org.w3c.dom.Element contextElement,
                                                                                           java.lang.String attributeName,
                                                                                           java.lang.String prevAttributeValue,
                                                                                           java.lang.String newAttributeValue,
                                                                                           java.lang.String namespaceURI)

  Creates the AttributeModified command.

  Parameters:
    `contextElement` - The context element
    `attributeName` - The attribute name
    `prevAttributeValue` - The previous attribute value
    `newAttributeValue` - The new attribute value
    `namespaceURI` - The namespaceURI

### charDataModified

    public void charDataModified(org.w3c.dom.Node contextNode,
                                 java.lang.String oldValue,
                                 java.lang.String newValue)

  Adds CharDataModifiedCommand to historyBrowser.

  Parameters:
    `contextNode` - The node whose nodeValue changed
    `oldValue` - The old node value
    `newValue` - The new node value

### createCharDataModifiedCommand

    public HistoryBrowserInterface.CharDataModifiedCommand createCharDataModifiedCommand(org.w3c.dom.Node contextNode,
                                                                                         java.lang.String oldValue,
                                                                                         java.lang.String newValue)

  Creates the CharDataModified command.

  Parameters:
    `contextNode` - The node whose nodeValue changed
    `oldValue` - The old node value
    `newValue` - The new node value

### appendChild

    public void appendChild(org.w3c.dom.Node parent,
                            org.w3c.dom.Node child)

  Adds and executes the AppendChildCommand to historyBrowser.

  Parameters:
    `parent` - The given parent
    `child` - The node to be appended

### createAppendChildCommand

    public HistoryBrowserInterface.AppendChildCommand createAppendChildCommand(org.w3c.dom.Node parent,
                                                                               org.w3c.dom.Node child)

  Creates and return the AppendChild command.

  Parameters:
    `parent` - The given parent
    `child` - The node to be appended
  Returns:
    the AppendChild command

### insertChildBefore

    public void insertChildBefore(org.w3c.dom.Node parent,
                                  org.w3c.dom.Node sibling,
                                  org.w3c.dom.Node child)

  Adds and executes the InsertNodeBeforeCommand to historyBrowser.

  Parameters:
    `parent` - The given parent
    `sibling` - Points where to be inserted
    `child` - The node to insert

### createInsertChildCommand

    public UndoableCommand createInsertChildCommand(org.w3c.dom.Node parent,
                                                    org.w3c.dom.Node sibling,
                                                    org.w3c.dom.Node child)

  Creates InsertChildBefore or AppendChild command, depending on the value of siblingNode.

  Parameters:
    `parent` - The parent node
    `sibling` - The sibling node
    `child` - The child node
  Returns:
    AppendChild command if sibling node is null, InsertChildBefore otherwise

### createInsertNodeBeforeCommand

    public HistoryBrowserInterface.InsertNodeBeforeCommand createInsertNodeBeforeCommand(org.w3c.dom.Node parent,
                                                                                         org.w3c.dom.Node sibling,
                                                                                         org.w3c.dom.Node child)

  Creates and returns the InsertNodeBeforeCommand.

  Parameters:
    `parent` - The given parent
    `sibling` - Points where to be inserted
    `child` - The node to insert
  Returns:
    the InsertNodeBeforeCommand

### replaceChild

    public void replaceChild(org.w3c.dom.Node parent,
                             org.w3c.dom.Node newChild,
                             org.w3c.dom.Node oldChild)

  Adds and executes the ReplaceChild command to historyBrowser.

  Parameters:
    `parent` - The parent node
    `newChild` - Points where to be inserted
    `oldChild` - The node to be appended

### removeChild

    public void removeChild(org.w3c.dom.Node parent,
                            org.w3c.dom.Node child)

  Adds and executes the RemoveChild command to the History Browser.

  Parameters:
    `parent` - The given parent
    `child` - The given child

### createRemoveChildCommand

    public HistoryBrowserInterface.RemoveChildCommand createRemoveChildCommand(org.w3c.dom.Node parent,
                                                                               org.w3c.dom.Node child)

  Creates and returns the RemoveChild command.

  Parameters:
    `parent` - The parent node
    `child` - The child node
  Returns:
    The RemoveChild command

### setNodeValue

    public void setNodeValue(org.w3c.dom.Node contextNode,
                             java.lang.String newValue)

  Adds and executes the ChangeNodeValueCommand to historyBrowser.

  Parameters:
    `contextNode` - The node whose nodeValue changed
    `newValue` - The new node value

### createChangeNodeValueCommand

    public HistoryBrowserInterface.ChangeNodeValueCommand createChangeNodeValueCommand(org.w3c.dom.Node contextNode,
                                                                                       java.lang.String newValue)

  Creates and returns the ChangeNodeValue command.

  Parameters:
    `contextNode` - The node whose nodeValue changed
    `newValue` - The new node value
  Returns:
    the ChangeNodeValue command

### getCurrentCompoundCommand

    public AbstractCompoundCommand getCurrentCompoundCommand()

  Gets the current compound command.

  Returns:
    the currentCompoundCommand

### addToCurrentCompoundCommand

    public void addToCurrentCompoundCommand(AbstractUndoableCommand cmd)

  Adds the given command to current compound command.

  Parameters:
    `cmd` - The command to add

### performCurrentCompoundCommand

    public void performCurrentCompoundCommand()

  Adds and executes the current compound command to history browser.

Copyright © 2008 Apache Software Foundation. All Rights Reserved.