org.apache.batik.apps.svgbrowser

Class HistoryBrowserInterface

public class HistoryBrowserInterface extends Object

The wrapper for the history browser. The commands for the historyBrowser are implemented here
Nested Class Summary
static classHistoryBrowserInterface.AppendChildCommand
The AppendChild command.
static classHistoryBrowserInterface.AttributeAddedCommand
Adds the attribute to an element (MutationEvent.ADDITION)
static classHistoryBrowserInterface.AttributeModifiedCommand
Modifies the attribute of an element (MutationEvent.MODIFICATION)
static classHistoryBrowserInterface.AttributeRemovedCommand
Removes the attribute of an element (MutationEvent.REMOVAL)
static classHistoryBrowserInterface.ChangeNodeValueCommand
The Change Node Value command.
static classHistoryBrowserInterface.CharDataModifiedCommand
Sets the node value.
static classHistoryBrowserInterface.CompoundUpdateCommand
The compound command.
static classHistoryBrowserInterface.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 classHistoryBrowserInterface.NodeInsertedCommand
Inserts the given node as a child of another.
static classHistoryBrowserInterface.NodeRemovedCommand
Removes the node from its parent node.
static classHistoryBrowserInterface.RemoveChildCommand
The RemoveChild command.
static classHistoryBrowserInterface.ReplaceChildCommand
insertBefore
Field Summary
protected AbstractCompoundCommandcurrentCompoundCommand
Used to group custom number of changes into a single command.
protected HistoryBrowserhistoryBrowser
The history browser.
Constructor Summary
HistoryBrowserInterface(HistoryBrowser.CommandController commandController)
Constructor.
Method Summary
voidaddToCurrentCompoundCommand(AbstractUndoableCommand cmd)
Adds the given command to current compound command.
voidappendChild(Node parent, Node child)
Adds and executes the AppendChildCommand to historyBrowser.
voidattributeAdded(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI)
Adds the AttributeAddedCommand to historyBrowser.
voidattributeModified(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, String namespaceURI)
Adds the AttributeModifiedCommand to historyBrowser.
voidattributeRemoved(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI)
Adds the AttributeRemovedCommand to historyBrowser.
voidcharDataModified(Node contextNode, String oldValue, String newValue)
Adds CharDataModifiedCommand to historyBrowser.
HistoryBrowserInterface.AppendChildCommandcreateAppendChildCommand(Node parent, Node child)
Creates and return the AppendChild command.
HistoryBrowserInterface.AttributeAddedCommandcreateAttributeAddedCommand(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI)
Creates the AttributeAdded command.
HistoryBrowserInterface.AttributeModifiedCommandcreateAttributeModifiedCommand(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, String namespaceURI)
Creates the AttributeModified command.
HistoryBrowserInterface.AttributeRemovedCommandcreateAttributeRemovedCommand(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI)
Creates the AttributeRemoved command.
HistoryBrowserInterface.ChangeNodeValueCommandcreateChangeNodeValueCommand(Node contextNode, String newValue)
Creates and returns the ChangeNodeValue command.
HistoryBrowserInterface.CharDataModifiedCommandcreateCharDataModifiedCommand(Node contextNode, String oldValue, String newValue)
Creates the CharDataModified command.
HistoryBrowserInterface.CompoundUpdateCommandcreateCompoundUpdateCommand(String commandName)
Creates the compound update command, that consists of custom number of commands.
UndoableCommandcreateInsertChildCommand(Node parent, Node sibling, Node child)
Creates InsertChildBefore or AppendChild command, depending on the value of siblingNode.
HistoryBrowserInterface.InsertNodeBeforeCommandcreateInsertNodeBeforeCommand(Node parent, Node sibling, Node child)
Creates and returns the InsertNodeBeforeCommand.
HistoryBrowserInterface.CompoundUpdateCommandcreateNodeChangedCommand(Node node)
Creates the compound NodeChangedCommand.
HistoryBrowserInterface.NodeInsertedCommandcreateNodeInsertedCommand(Node newParent, Node newSibling, Node contextNode)
Creates the NodeInserted command.
HistoryBrowserInterface.NodeRemovedCommandcreateNodeRemovedCommand(Node oldParent, Node oldSibling, Node contextNode)
Creates the NodeRemoved command.
HistoryBrowserInterface.CompoundUpdateCommandcreateNodesDroppedCommand(ArrayList nodes)
Creates the compound NodesDroppedCommand.
HistoryBrowserInterface.RemoveChildCommandcreateRemoveChildCommand(Node parent, Node child)
Creates and returns the RemoveChild command.
HistoryBrowserInterface.CompoundUpdateCommandcreateRemoveSelectedTreeNodesCommand(ArrayList nodes)
Creates the compound RemoveSelectedTreeNodesCommand.
AbstractCompoundCommandgetCurrentCompoundCommand()
Gets the current compound command.
HistoryBrowsergetHistoryBrowser()
Gets the history browser.
voidinsertChildBefore(Node parent, Node sibling, Node child)
Adds and executes the InsertNodeBeforeCommand to historyBrowser.
voidnodeInserted(Node newParent, Node newSibling, Node contextNode)
Adds the NodeInsertedCommand to historyBrowser.
voidnodeRemoved(Node oldParent, Node oldSibling, Node contextNode)
Adds the NodeRemovedCommand to historyBrowser.
voidperformCompoundUpdateCommand(UndoableCommand command)
Executes the given compound update command.
voidperformCurrentCompoundCommand()
Adds and executes the current compound command to history browser.
voidremoveChild(Node parent, Node child)
Adds and executes the RemoveChild command to the History Browser.
voidreplaceChild(Node parent, Node newChild, Node oldChild)
Adds and executes the ReplaceChild command to historyBrowser.
voidsetCommmandController(HistoryBrowser.CommandController newCommandController)
Sets the history browser's command controller.
voidsetNodeValue(Node contextNode, String newValue)
Adds and executes the ChangeNodeValueCommand to historyBrowser.

Field Detail

currentCompoundCommand

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

historyBrowser

protected HistoryBrowser historyBrowser
The history browser.

Constructor Detail

HistoryBrowserInterface

public HistoryBrowserInterface(HistoryBrowser.CommandController commandController)
Constructor. Creates the history browser.

Method Detail

addToCurrentCompoundCommand

public void addToCurrentCompoundCommand(AbstractUndoableCommand cmd)
Adds the given command to current compound command.

Parameters: cmd The command to add

appendChild

public void appendChild(Node parent, Node child)
Adds and executes the AppendChildCommand to historyBrowser.

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

attributeAdded

public void attributeAdded(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI)
Adds the AttributeAddedCommand to historyBrowser.

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

attributeModified

public void attributeModified(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, 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

attributeRemoved

public void attributeRemoved(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI)
Adds the AttributeRemovedCommand to historyBrowser.

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

charDataModified

public void charDataModified(Node contextNode, String oldValue, String newValue)
Adds CharDataModifiedCommand to historyBrowser.

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

createAppendChildCommand

public HistoryBrowserInterface.AppendChildCommand createAppendChildCommand(Node parent, Node child)
Creates and return the AppendChild command.

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

Returns: the AppendChild command

createAttributeAddedCommand

public HistoryBrowserInterface.AttributeAddedCommand createAttributeAddedCommand(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI)
Creates the AttributeAdded command.

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

createAttributeModifiedCommand

public HistoryBrowserInterface.AttributeModifiedCommand createAttributeModifiedCommand(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, 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

createAttributeRemovedCommand

public HistoryBrowserInterface.AttributeRemovedCommand createAttributeRemovedCommand(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI)
Creates the AttributeRemoved command.

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

createChangeNodeValueCommand

public HistoryBrowserInterface.ChangeNodeValueCommand createChangeNodeValueCommand(Node contextNode, String newValue)
Creates and returns the ChangeNodeValue command.

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

Returns: the ChangeNodeValue command

createCharDataModifiedCommand

public HistoryBrowserInterface.CharDataModifiedCommand createCharDataModifiedCommand(Node contextNode, String oldValue, String newValue)
Creates the CharDataModified command.

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

createCompoundUpdateCommand

public HistoryBrowserInterface.CompoundUpdateCommand createCompoundUpdateCommand(String commandName)
Creates the compound update command, that consists of custom number of commands.

Parameters: commandName Compound command name

Returns: CompoundUpdateCommand

createInsertChildCommand

public UndoableCommand createInsertChildCommand(Node parent, Node sibling, 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(Node parent, Node sibling, 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

createNodeChangedCommand

public HistoryBrowserInterface.CompoundUpdateCommand createNodeChangedCommand(Node node)
Creates the compound NodeChangedCommand. Used to create the 'dynamic' NodeChangedCommand name

Returns: the CompoundUpdateCommand

createNodeInsertedCommand

public HistoryBrowserInterface.NodeInsertedCommand createNodeInsertedCommand(Node newParent, Node newSibling, Node contextNode)
Creates the NodeInserted command.

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

createNodeRemovedCommand

public HistoryBrowserInterface.NodeRemovedCommand createNodeRemovedCommand(Node oldParent, Node oldSibling, 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

createNodesDroppedCommand

public HistoryBrowserInterface.CompoundUpdateCommand createNodesDroppedCommand(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

createRemoveChildCommand

public HistoryBrowserInterface.RemoveChildCommand createRemoveChildCommand(Node parent, Node child)
Creates and returns the RemoveChild command.

Parameters: parent The parent node child The child node

Returns: The RemoveChild command

createRemoveSelectedTreeNodesCommand

public HistoryBrowserInterface.CompoundUpdateCommand createRemoveSelectedTreeNodesCommand(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

getCurrentCompoundCommand

public AbstractCompoundCommand getCurrentCompoundCommand()
Gets the current compound command.

Returns: the currentCompoundCommand

getHistoryBrowser

public HistoryBrowser getHistoryBrowser()
Gets the history browser.

Returns: the historyBrowser

insertChildBefore

public void insertChildBefore(Node parent, Node sibling, 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

nodeInserted

public void nodeInserted(Node newParent, Node newSibling, Node contextNode)
Adds the NodeInsertedCommand to historyBrowser.

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

nodeRemoved

public void nodeRemoved(Node oldParent, Node oldSibling, 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

performCompoundUpdateCommand

public void performCompoundUpdateCommand(UndoableCommand command)
Executes the given compound update command.

Parameters: command The given compound update command

performCurrentCompoundCommand

public void performCurrentCompoundCommand()
Adds and executes the current compound command to history browser.

removeChild

public void removeChild(Node parent, Node child)
Adds and executes the RemoveChild command to the History Browser.

Parameters: parent The given parent child The given child

replaceChild

public void replaceChild(Node parent, Node newChild, 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

setCommmandController

public void setCommmandController(HistoryBrowser.CommandController newCommandController)
Sets the history browser's command controller.

Parameters: newCommandController The commandController to set

setNodeValue

public void setNodeValue(Node contextNode, String newValue)
Adds and executes the ChangeNodeValueCommand to historyBrowser.

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

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.