public class HistoryBrowserInterface
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
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
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ATTRIBUTE_ADDED_COMMAND |
private static java.lang.String |
ATTRIBUTE_MODIFIED_COMMAND |
private static java.lang.String |
ATTRIBUTE_REMOVED_COMMAND |
private static java.lang.String |
CHAR_DATA_MODIFIED_COMMAND |
private static java.lang.String |
COMPOUND_TREE_NODE_DROP
Compound tree node dropped command name.
|
protected AbstractCompoundCommand |
currentCompoundCommand
Used to group custom number of changes into a single command.
|
protected HistoryBrowser |
historyBrowser
The history browser.
|
private static java.lang.String |
NODE_INSERTED_COMMAND |
private static java.lang.String |
NODE_REMOVED_COMMAND |
private static java.lang.String |
OUTER_EDIT_COMMAND
The changes being performed outside of the DOMViewer.
|
private static java.lang.String |
REMOVE_SELECTED_NODES
Remove selected nodes command name.
|
Constructor and Description |
---|
HistoryBrowserInterface(HistoryBrowser.CommandController commandController)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
private java.lang.String |
getAppendChildCommandName(org.w3c.dom.Node parentNode,
org.w3c.dom.Node childNode)
Generates the "Append Child" command name.
|
private java.lang.String |
getBracketedNodeName(org.w3c.dom.Node node)
Gets the node info in brackets.
|
private java.lang.String |
getChangeNodeValueCommandName(org.w3c.dom.Node contextNode,
java.lang.String newValue)
Generates the "Change Node Value" command name.
|
AbstractCompoundCommand |
getCurrentCompoundCommand()
Gets the current compound command.
|
HistoryBrowser |
getHistoryBrowser()
Gets the history browser.
|
private java.lang.String |
getInsertBeforeCommandName(org.w3c.dom.Node parentNode,
org.w3c.dom.Node childNode,
org.w3c.dom.Node siblingNode)
Generates the "Insert Child Before" command name.
|
private java.lang.String |
getNodeAsString(org.w3c.dom.Node node)
Gets the node name and the nodes id (nodeName + "nodeId").
|
private java.lang.String |
getNodeChangedCommandName(org.w3c.dom.Node node)
Generates the "Node Changed" command name.
|
private java.lang.String |
getRemoveChildCommandName(org.w3c.dom.Node parent,
org.w3c.dom.Node child)
Generates the "Remove Child" command name.
|
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.
|
private static final java.lang.String ATTRIBUTE_ADDED_COMMAND
private static final java.lang.String ATTRIBUTE_REMOVED_COMMAND
private static final java.lang.String ATTRIBUTE_MODIFIED_COMMAND
private static final java.lang.String NODE_INSERTED_COMMAND
private static final java.lang.String NODE_REMOVED_COMMAND
private static final java.lang.String CHAR_DATA_MODIFIED_COMMAND
private static final java.lang.String OUTER_EDIT_COMMAND
private static final java.lang.String COMPOUND_TREE_NODE_DROP
private static final java.lang.String REMOVE_SELECTED_NODES
protected HistoryBrowser historyBrowser
protected AbstractCompoundCommand currentCompoundCommand
public HistoryBrowserInterface(HistoryBrowser.CommandController commandController)
public void setCommmandController(HistoryBrowser.CommandController newCommandController)
newCommandController
- The commandController to setpublic HistoryBrowserInterface.CompoundUpdateCommand createCompoundUpdateCommand(java.lang.String commandName)
commandName
- Compound command namepublic HistoryBrowserInterface.CompoundUpdateCommand createNodeChangedCommand(org.w3c.dom.Node node)
public HistoryBrowserInterface.CompoundUpdateCommand createNodesDroppedCommand(java.util.ArrayList nodes)
nodes
- The list of the nodes that are being droppedpublic HistoryBrowserInterface.CompoundUpdateCommand createRemoveSelectedTreeNodesCommand(java.util.ArrayList nodes)
nodes
- The list of the nodes that are selected and should be removedpublic void performCompoundUpdateCommand(UndoableCommand command)
command
- The given compound update commandpublic HistoryBrowser getHistoryBrowser()
public void nodeInserted(org.w3c.dom.Node newParent, org.w3c.dom.Node newSibling, org.w3c.dom.Node contextNode)
newParent
- New parent nodenewSibling
- New (next) sibling nodecontextNode
- The node to be appendedpublic HistoryBrowserInterface.NodeInsertedCommand createNodeInsertedCommand(org.w3c.dom.Node newParent, org.w3c.dom.Node newSibling, org.w3c.dom.Node contextNode)
newParent
- New parent nodenewSibling
- New (next) sibling nodecontextNode
- The node to be appendedpublic void nodeRemoved(org.w3c.dom.Node oldParent, org.w3c.dom.Node oldSibling, org.w3c.dom.Node contextNode)
oldParent
- The node's old parentoldSibling
- The node's old next siblingcontextNode
- The node to be removedpublic HistoryBrowserInterface.NodeRemovedCommand createNodeRemovedCommand(org.w3c.dom.Node oldParent, org.w3c.dom.Node oldSibling, org.w3c.dom.Node contextNode)
oldParent
- The node's old parentoldSibling
- The node's old next siblingcontextNode
- The node to be removedpublic void attributeAdded(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String newAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute namenewAttributeValue
- The attribute valuenamespaceURI
- The namespaceURIpublic HistoryBrowserInterface.AttributeAddedCommand createAttributeAddedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String newAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute namenewAttributeValue
- The attribute valuenamespaceURI
- The namespaceURIpublic void attributeRemoved(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenamespaceURI
- The namespaceURIpublic HistoryBrowserInterface.AttributeRemovedCommand createAttributeRemovedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenamespaceURI
- The namespaceURIpublic void attributeModified(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String newAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenewAttributeValue
- The new attribute valuenamespaceURI
- The namespaceURIpublic HistoryBrowserInterface.AttributeModifiedCommand createAttributeModifiedCommand(org.w3c.dom.Element contextElement, java.lang.String attributeName, java.lang.String prevAttributeValue, java.lang.String newAttributeValue, java.lang.String namespaceURI)
contextElement
- The context elementattributeName
- The attribute nameprevAttributeValue
- The previous attribute valuenewAttributeValue
- The new attribute valuenamespaceURI
- The namespaceURIpublic void charDataModified(org.w3c.dom.Node contextNode, java.lang.String oldValue, java.lang.String newValue)
contextNode
- The node whose nodeValue changedoldValue
- The old node valuenewValue
- The new node valuepublic HistoryBrowserInterface.CharDataModifiedCommand createCharDataModifiedCommand(org.w3c.dom.Node contextNode, java.lang.String oldValue, java.lang.String newValue)
contextNode
- The node whose nodeValue changedoldValue
- The old node valuenewValue
- The new node valuepublic void appendChild(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- The given parentchild
- The node to be appendedpublic HistoryBrowserInterface.AppendChildCommand createAppendChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- The given parentchild
- The node to be appendedpublic void insertChildBefore(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)
parent
- The given parentsibling
- Points where to be insertedchild
- The node to insertpublic UndoableCommand createInsertChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)
parent
- The parent nodesibling
- The sibling nodechild
- The child nodepublic HistoryBrowserInterface.InsertNodeBeforeCommand createInsertNodeBeforeCommand(org.w3c.dom.Node parent, org.w3c.dom.Node sibling, org.w3c.dom.Node child)
parent
- The given parentsibling
- Points where to be insertedchild
- The node to insertpublic void replaceChild(org.w3c.dom.Node parent, org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)
parent
- The parent nodenewChild
- Points where to be insertedoldChild
- The node to be appendedpublic void removeChild(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- The given parentchild
- The given childpublic HistoryBrowserInterface.RemoveChildCommand createRemoveChildCommand(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- The parent nodechild
- The child nodepublic void setNodeValue(org.w3c.dom.Node contextNode, java.lang.String newValue)
contextNode
- The node whose nodeValue changednewValue
- The new node valuepublic HistoryBrowserInterface.ChangeNodeValueCommand createChangeNodeValueCommand(org.w3c.dom.Node contextNode, java.lang.String newValue)
contextNode
- The node whose nodeValue changednewValue
- The new node valuepublic AbstractCompoundCommand getCurrentCompoundCommand()
public void addToCurrentCompoundCommand(AbstractUndoableCommand cmd)
cmd
- The command to addpublic void performCurrentCompoundCommand()
private java.lang.String getNodeAsString(org.w3c.dom.Node node)
node
- The given nodeprivate java.lang.String getBracketedNodeName(org.w3c.dom.Node node)
node
- The given nodeprivate java.lang.String getAppendChildCommandName(org.w3c.dom.Node parentNode, org.w3c.dom.Node childNode)
parentNode
- The parent nodechildNode
- The child nodeprivate java.lang.String getInsertBeforeCommandName(org.w3c.dom.Node parentNode, org.w3c.dom.Node childNode, org.w3c.dom.Node siblingNode)
parentNode
- The parentNodechildNode
- The node being insertedsiblingNode
- The new sibling nodeprivate java.lang.String getRemoveChildCommandName(org.w3c.dom.Node parent, org.w3c.dom.Node child)
parent
- The parent nodechild
- The child nodeprivate java.lang.String getChangeNodeValueCommandName(org.w3c.dom.Node contextNode, java.lang.String newValue)
contextNode
- The node whose value is to be changednewValue
- The new node valueprivate java.lang.String getNodeChangedCommandName(org.w3c.dom.Node node)