Package org.apache.batik.apps.svgbrowser
Class HistoryBrowserInterface
java.lang.Object
org.apache.batik.apps.svgbrowser.HistoryBrowserInterface
The wrapper for the history browser. The commands for the historyBrowser
are implemented here
- Version:
- $Id: HistoryBrowserInterface.java 1733416 2016-03-03 07:07:13Z gadams $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The AppendChild command.static class
Adds the attribute to an element (MutationEvent.ADDITION)static class
Modifies the attribute of an element (MutationEvent.MODIFICATION)static class
Removes the attribute of an element (MutationEvent.REMOVAL)static class
The Change Node Value command.static class
Sets the node value.static class
The compound command.static class
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
Inserts the given node as a child of another.static class
Removes the node from its parent node.static class
The RemoveChild command.static class
insertBefore -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
Compound tree node dropped command name.protected AbstractCompoundCommand
Used to group custom number of changes into a single command.protected HistoryBrowser
The history browser.private static final String
private static final String
private static final String
The changes being performed outside of the DOMViewer.private static final String
Remove selected nodes command name. -
Constructor Summary
ConstructorsConstructorDescriptionHistoryBrowserInterface
(HistoryBrowser.CommandController commandController) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given command to current compound command.void
appendChild
(Node parent, Node child) Adds and executes the AppendChildCommand to historyBrowser.void
attributeAdded
(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI) Adds the AttributeAddedCommand to historyBrowser.void
attributeModified
(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, String namespaceURI) Adds the AttributeModifiedCommand to historyBrowser.void
attributeRemoved
(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI) Adds the AttributeRemovedCommand to historyBrowser.void
charDataModified
(Node contextNode, String oldValue, String newValue) Adds CharDataModifiedCommand to historyBrowser.createAppendChildCommand
(Node parent, Node child) Creates and return the AppendChild command.createAttributeAddedCommand
(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI) Creates the AttributeAdded command.createAttributeModifiedCommand
(Element contextElement, String attributeName, String prevAttributeValue, String newAttributeValue, String namespaceURI) Creates the AttributeModified command.createAttributeRemovedCommand
(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI) Creates the AttributeRemoved command.createChangeNodeValueCommand
(Node contextNode, String newValue) Creates and returns the ChangeNodeValue command.createCharDataModifiedCommand
(Node contextNode, String oldValue, String newValue) Creates the CharDataModified command.createCompoundUpdateCommand
(String commandName) Creates the compound update command, that consists of custom number of commands.createInsertChildCommand
(Node parent, Node sibling, Node child) Creates InsertChildBefore or AppendChild command, depending on the value of siblingNode.createInsertNodeBeforeCommand
(Node parent, Node sibling, Node child) Creates and returns the InsertNodeBeforeCommand.createNodeChangedCommand
(Node node) Creates the compound NodeChangedCommand.createNodeInsertedCommand
(Node newParent, Node newSibling, Node contextNode) Creates the NodeInserted command.createNodeRemovedCommand
(Node oldParent, Node oldSibling, Node contextNode) Creates the NodeRemoved command.Creates the compound NodesDroppedCommand.createRemoveChildCommand
(Node parent, Node child) Creates and returns the RemoveChild command.Creates the compound RemoveSelectedTreeNodesCommand.private String
getAppendChildCommandName
(Node parentNode, Node childNode) Generates the "Append Child" command name.private String
getBracketedNodeName
(Node node) Gets the node info in brackets.private String
getChangeNodeValueCommandName
(Node contextNode, String newValue) Generates the "Change Node Value" command name.Gets the current compound command.Gets the history browser.private String
getInsertBeforeCommandName
(Node parentNode, Node childNode, Node siblingNode) Generates the "Insert Child Before" command name.private String
getNodeAsString
(Node node) Gets the node name and the nodes id (nodeName + "nodeId").private String
Generates the "Node Changed" command name.private String
getRemoveChildCommandName
(Node parent, Node child) Generates the "Remove Child" command name.void
insertChildBefore
(Node parent, Node sibling, Node child) Adds and executes the InsertNodeBeforeCommand to historyBrowser.void
nodeInserted
(Node newParent, Node newSibling, Node contextNode) Adds the NodeInsertedCommand to historyBrowser.void
nodeRemoved
(Node oldParent, Node oldSibling, Node contextNode) Adds the NodeRemovedCommand to historyBrowser.void
Executes the given compound update command.void
Adds and executes the current compound command to history browser.void
removeChild
(Node parent, Node child) Adds and executes the RemoveChild command to the History Browser.void
replaceChild
(Node parent, Node newChild, Node oldChild) Adds and executes the ReplaceChild command to historyBrowser.void
setCommmandController
(HistoryBrowser.CommandController newCommandController) Sets the history browser's command controller.void
setNodeValue
(Node contextNode, String newValue) Adds and executes the ChangeNodeValueCommand to historyBrowser.
-
Field Details
-
ATTRIBUTE_ADDED_COMMAND
- See Also:
-
ATTRIBUTE_REMOVED_COMMAND
- See Also:
-
ATTRIBUTE_MODIFIED_COMMAND
- See Also:
-
NODE_INSERTED_COMMAND
- See Also:
-
NODE_REMOVED_COMMAND
- See Also:
-
CHAR_DATA_MODIFIED_COMMAND
- See Also:
-
OUTER_EDIT_COMMAND
The changes being performed outside of the DOMViewer.- See Also:
-
COMPOUND_TREE_NODE_DROP
Compound tree node dropped command name.- See Also:
-
REMOVE_SELECTED_NODES
Remove selected nodes command name.- See Also:
-
historyBrowser
The history browser. -
currentCompoundCommand
Used to group custom number of changes into a single command.
-
-
Constructor Details
-
HistoryBrowserInterface
Constructor. Creates the history browser.
-
-
Method Details
-
setCommmandController
Sets the history browser's command controller.- Parameters:
newCommandController
- The commandController to set
-
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
-
createNodeChangedCommand
Creates the compound NodeChangedCommand. Used to create the 'dynamic' NodeChangedCommand name- Returns:
- the CompoundUpdateCommand
-
createNodesDroppedCommand
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(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
Executes the given compound update command.- Parameters:
command
- The given compound update command
-
getHistoryBrowser
Gets the history browser.- Returns:
- the historyBrowser
-
nodeInserted
Adds the NodeInsertedCommand to historyBrowser.- Parameters:
newParent
- New parent nodenewSibling
- New (next) sibling nodecontextNode
- The node to be appended
-
createNodeInsertedCommand
public HistoryBrowserInterface.NodeInsertedCommand createNodeInsertedCommand(Node newParent, Node newSibling, Node contextNode) Creates the NodeInserted command.- Parameters:
newParent
- New parent nodenewSibling
- New (next) sibling nodecontextNode
- The node to be appended
-
nodeRemoved
Adds the NodeRemovedCommand to historyBrowser.- Parameters:
oldParent
- The node's old parentoldSibling
- The node's old next siblingcontextNode
- The node to be removed
-
createNodeRemovedCommand
public HistoryBrowserInterface.NodeRemovedCommand createNodeRemovedCommand(Node oldParent, Node oldSibling, Node contextNode) Creates the NodeRemoved command.- Parameters:
oldParent
- The node's old parentoldSibling
- The node's old next siblingcontextNode
- The node to be removed
-
attributeAdded
public void attributeAdded(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI) Adds the AttributeAddedCommand to historyBrowser.- Parameters:
contextElement
- The context elementattributeName
- The attribute namenewAttributeValue
- The attribute valuenamespaceURI
- The namespaceURI
-
createAttributeAddedCommand
public HistoryBrowserInterface.AttributeAddedCommand createAttributeAddedCommand(Element contextElement, String attributeName, String newAttributeValue, String namespaceURI) Creates the AttributeAdded command.- Parameters:
contextElement
- The context elementattributeName
- The attribute namenewAttributeValue
- The attribute valuenamespaceURI
- The namespaceURI
-
attributeRemoved
public void attributeRemoved(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI) Adds the AttributeRemovedCommand to historyBrowser.- Parameters:
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenamespaceURI
- The namespaceURI
-
createAttributeRemovedCommand
public HistoryBrowserInterface.AttributeRemovedCommand createAttributeRemovedCommand(Element contextElement, String attributeName, String prevAttributeValue, String namespaceURI) Creates the AttributeRemoved command.- Parameters:
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenamespaceURI
- 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 elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenewAttributeValue
- The new attribute valuenamespaceURI
- 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 elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenewAttributeValue
- The new attribute valuenamespaceURI
- The namespaceURI
-
charDataModified
Adds CharDataModifiedCommand to historyBrowser.- Parameters:
contextNode
- The node whose nodeValue changedoldValue
- The old node valuenewValue
- The new node value
-
createCharDataModifiedCommand
public HistoryBrowserInterface.CharDataModifiedCommand createCharDataModifiedCommand(Node contextNode, String oldValue, String newValue) Creates the CharDataModified command.- Parameters:
contextNode
- The node whose nodeValue changedoldValue
- The old node valuenewValue
- The new node value
-
appendChild
Adds and executes the AppendChildCommand to historyBrowser.- Parameters:
parent
- The given parentchild
- The node to be appended
-
createAppendChildCommand
Creates and return the AppendChild command.- Parameters:
parent
- The given parentchild
- The node to be appended- Returns:
- the AppendChild command
-
insertChildBefore
Adds and executes the InsertNodeBeforeCommand to historyBrowser.- Parameters:
parent
- The given parentsibling
- Points where to be insertedchild
- The node to insert
-
createInsertChildCommand
Creates InsertChildBefore or AppendChild command, depending on the value of siblingNode.- Parameters:
parent
- The parent nodesibling
- The sibling nodechild
- 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 parentsibling
- Points where to be insertedchild
- The node to insert- Returns:
- the InsertNodeBeforeCommand
-
replaceChild
Adds and executes the ReplaceChild command to historyBrowser.- Parameters:
parent
- The parent nodenewChild
- Points where to be insertedoldChild
- The node to be appended
-
removeChild
Adds and executes the RemoveChild command to the History Browser.- Parameters:
parent
- The given parentchild
- The given child
-
createRemoveChildCommand
Creates and returns the RemoveChild command.- Parameters:
parent
- The parent nodechild
- The child node- Returns:
- The RemoveChild command
-
setNodeValue
Adds and executes the ChangeNodeValueCommand to historyBrowser.- Parameters:
contextNode
- The node whose nodeValue changednewValue
- The new node value
-
createChangeNodeValueCommand
public HistoryBrowserInterface.ChangeNodeValueCommand createChangeNodeValueCommand(Node contextNode, String newValue) Creates and returns the ChangeNodeValue command.- Parameters:
contextNode
- The node whose nodeValue changednewValue
- The new node value- Returns:
- the ChangeNodeValue command
-
getCurrentCompoundCommand
Gets the current compound command.- Returns:
- the currentCompoundCommand
-
addToCurrentCompoundCommand
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. -
getNodeAsString
Gets the node name and the nodes id (nodeName + "nodeId").- Parameters:
node
- The given node- Returns:
- e.g. node name with quoted node id or node name if id is empty String
-
getBracketedNodeName
Gets the node info in brackets.- Parameters:
node
- The given node- Returns:
- e.g (rect "23")
-
getAppendChildCommandName
Generates the "Append Child" command name.- Parameters:
parentNode
- The parent nodechildNode
- The child node- Returns:
- The command name
-
getInsertBeforeCommandName
Generates the "Insert Child Before" command name.- Parameters:
parentNode
- The parentNodechildNode
- The node being insertedsiblingNode
- The new sibling node- Returns:
- The command name
-
getRemoveChildCommandName
Generates the "Remove Child" command name.- Parameters:
parent
- The parent nodechild
- The child node- Returns:
- The command name
-
getChangeNodeValueCommandName
Generates the "Change Node Value" command name.- Parameters:
contextNode
- The node whose value is to be changednewValue
- The new node value- Returns:
- The command name
-
getNodeChangedCommandName
Generates the "Node Changed" command name.- Returns:
- The command name
-