4 * Copyright 2010 Codist Monk.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 package net
.sourceforge
.aprog
.markups
;
27 import static javax
.swing
.KeyStroke
.getKeyStroke
;
29 import static net
.sourceforge
.aprog
.i18n
.Messages
.*;
30 import static net
.sourceforge
.aprog
.markups
.MarkupsConstants
.Variables
.*;
31 import static net
.sourceforge
.aprog
.markups
.MarkupsTools
.*;
32 import static net
.sourceforge
.aprog
.subtitlesadjuster
.SubtitlesAdjusterTools
.*;
33 import static net
.sourceforge
.aprog
.swing
.SwingTools
.checkAWT
;
34 import static net
.sourceforge
.aprog
.swing
.SwingTools
.menuBar
;
35 import static net
.sourceforge
.aprog
.swing
.SwingTools
.packAndCenter
;
36 import static net
.sourceforge
.aprog
.swing
.SwingTools
.scrollable
;
37 import static net
.sourceforge
.aprog
.tools
.Tools
.*;
38 import static net
.sourceforge
.aprog
.xml
.XMLTools
.*;
40 import java
.awt
.BorderLayout
;
41 import java
.awt
.Color
;
42 import java
.awt
.dnd
.DropTarget
;
43 import java
.awt
.dnd
.DropTargetAdapter
;
44 import java
.awt
.dnd
.DropTargetDragEvent
;
45 import java
.awt
.dnd
.DropTargetDropEvent
;
46 import java
.awt
.dnd
.DropTargetEvent
;
47 import java
.awt
.event
.WindowListener
;
49 import java
.util
.List
;
50 import java
.util
.WeakHashMap
;
52 import javax
.swing
.BorderFactory
;
53 import javax
.swing
.DefaultListModel
;
54 import javax
.swing
.JButton
;
55 import javax
.swing
.JFrame
;
56 import javax
.swing
.JList
;
57 import javax
.swing
.JMenuBar
;
58 import javax
.swing
.JMenuItem
;
59 import javax
.swing
.JPanel
;
60 import javax
.swing
.JSplitPane
;
61 import javax
.swing
.JTabbedPane
;
62 import javax
.swing
.JTextArea
;
63 import javax
.swing
.JTextField
;
64 import javax
.swing
.JTree
;
65 import javax
.swing
.SwingUtilities
;
66 import javax
.swing
.WindowConstants
;
67 import javax
.swing
.border
.TitledBorder
;
68 import javax
.swing
.event
.DocumentEvent
;
69 import javax
.swing
.event
.DocumentListener
;
70 import javax
.swing
.event
.TreeSelectionEvent
;
71 import javax
.swing
.event
.TreeSelectionListener
;
72 import javax
.swing
.tree
.DefaultMutableTreeNode
;
73 import javax
.swing
.tree
.DefaultTreeModel
;
74 import javax
.swing
.tree
.TreePath
;
76 import net
.sourceforge
.aprog
.context
.Context
;
77 import net
.sourceforge
.aprog
.events
.Variable
;
78 import net
.sourceforge
.aprog
.events
.Variable
.ValueChangedEvent
;
79 import net
.sourceforge
.aprog
.i18n
.Translator
;
80 import net
.sourceforge
.aprog
.subtitlesadjuster
.SubtitlesAdjusterActions
;
81 import net
.sourceforge
.aprog
.subtitlesadjuster
.SubtitlesAdjusterComponents
;
82 import net
.sourceforge
.aprog
.swing
.SwingTools
;
83 import net
.sourceforge
.aprog
.tools
.IllegalInstantiationException
;
84 import net
.sourceforge
.jmacadapter
.MacAdapterTools
;
86 import org
.w3c
.dom
.Node
;
87 import org
.w3c
.dom
.NodeList
;
88 import org
.w3c
.dom
.events
.Event
;
89 import org
.w3c
.dom
.events
.EventListener
;
93 * @author codistmonk (creation 2010-07-03)
95 public final class MarkupsComponents
{
98 * @throws IllegalInstantiationException To prevent instantiation
100 private MarkupsComponents() {
101 throw new IllegalInstantiationException();
113 public static final JFrame
newMainFrame(final Context context
) {
114 final JFrame result
= new JFrame();
116 context
.set(MAIN_FRAME
, result
);
118 result
.setJMenuBar(newMenuBar(context
));
119 result
.add(newMainPanel(context
));
120 result
.setDefaultCloseOperation(WindowConstants
.DO_NOTHING_ON_CLOSE
);
122 result
.addWindowListener(newListener(WindowListener
.class, "windowClosing",
123 MarkupsActions
.class, "quit", context
));
125 invokeOnVariableChanged(context
, FILE
,
126 SubtitlesAdjusterActions
.class, "updateMainFrameTitle", context
);
127 invokeOnVariableChanged(context
, FILE_MODIFIED
,
128 SubtitlesAdjusterActions
.class, "updateMainFrameTitle", context
);
130 Translator
.getDefaultTranslator().addListener(newListener(Translator
.Listener
.class, "localeChanged",
131 SwingTools
.class, "packAndUpdateMinimumSize", result
));
133 return packAndCenter(result
);
145 public static final JMenuBar
newMenuBar(final Context context
) {
148 if (MacAdapterTools
.isMacOSX()) {
149 MacAdapterTools
.setUseScreenMenuBar(true);
154 newAboutMenuItem(context
),
156 newPreferencesMenuItem(context
),
158 newQuitMenuItem(context
)
161 newNewMenuItem(context
),
163 newOpenMenuItem(context
),
165 newSaveMenuItem(context
),
166 newSaveAsMenuItem(context
)
169 newUndoMenuItem(context
),
170 newRedoMenuItem(context
),
172 newCopyMenuItem(context
),
173 newCutMenuItem(context
),
174 newPasteMenuItem(context
)
177 newAppendNewNodeMenuItem(context
),
179 newMoveUpMenuItem(context
),
180 newMoveDownMenuItem(context
)
183 newManualMenuItem(context
)
196 public static final JMenuItem
newAboutMenuItem(final Context context
) {
199 return SubtitlesAdjusterComponents
.newAboutMenuItem(context
);
211 public static final JMenuItem
newPreferencesMenuItem(final Context context
) {
214 return SubtitlesAdjusterComponents
.newPreferencesMenuItem(context
);
226 public static final JMenuItem
newQuitMenuItem(final Context context
) {
229 if (MacAdapterTools
.isMacOSX() && MacAdapterTools
.getUseScreenMenuBar()) {
230 if (registerMacOSXApplicationListener("handleQuit",
231 MarkupsActions
.class, "quit", context
)) {
236 return item("Quit", getKeyStroke(META
+ " Q"),
237 MarkupsActions
.class, "quit", context
);
249 public static final JMenuItem
newNewMenuItem(final Context context
) {
250 return item("New", getKeyStroke(META
+ " N"),
251 MarkupsActions
.class, "newFile", context
);
263 public static final JMenuItem
newOpenMenuItem(final Context context
) {
264 return item("Open...", getKeyStroke(META
+ " O"),
265 MarkupsActions
.class, "open", context
);
277 public static final JMenuItem
newSaveMenuItem(final Context context
) {
278 final JMenuItem result
= item("Save", getKeyStroke(META
+ " S"),
279 MarkupsActions
.class, "save", context
);
280 final Variable
<Boolean
> fileModifiedVariable
= context
.getVariable(FILE_MODIFIED
);
282 fileModifiedVariable
.addListener(new Variable
.Listener
<Boolean
>() {
285 public final void valueChanged(final ValueChangedEvent
<Boolean
, ?
> event
) {
286 result
.setEnabled(event
.getNewValue());
303 public static final JMenuItem
newSaveAsMenuItem(final Context context
) {
304 final JMenuItem result
= item("Save As...", getKeyStroke(META
+ " shift S"),
305 MarkupsActions
.class, "saveAs", context
);
319 public static final JMenuItem
newUndoMenuItem(final Context context
) {
320 final JMenuItem result
= item("Undo", getKeyStroke(META
+ " Z"),
321 MarkupsActions
.class, "undo", context
);
335 public static final JMenuItem
newRedoMenuItem(final Context context
) {
336 final JMenuItem result
= item("Redo", getKeyStroke(META
+ " Y"),
337 MarkupsActions
.class, "redo", context
);
351 public static final JMenuItem
newCopyMenuItem(final Context context
) {
352 final JMenuItem result
= item("Copy", getKeyStroke(META
+ " C"),
353 MarkupsActions
.class, "copy", context
);
367 public static final JMenuItem
newCutMenuItem(final Context context
) {
368 final JMenuItem result
= item("Cut", getKeyStroke(META
+ " X"),
369 MarkupsActions
.class, "cut", context
);
383 public static final JMenuItem
newPasteMenuItem(final Context context
) {
384 final JMenuItem result
= item("Paste", getKeyStroke(META
+ " V"),
385 MarkupsActions
.class, "paste", context
);
399 public static final JMenuItem
newAppendNewNodeMenuItem(final Context context
) {
400 final JMenuItem result
= item("Append New Node",
401 MarkupsActions
.class, "appendNewNode", context
);
415 public static final JMenuItem
newMoveUpMenuItem(final Context context
) {
416 final JMenuItem result
= item("Move Up",
417 MarkupsActions
.class, "moveUp", context
);
431 public static final JMenuItem
newMoveDownMenuItem(final Context context
) {
432 final JMenuItem result
= item("Move Down",
433 MarkupsActions
.class, "moveDown", context
);
447 public static final JMenuItem
newManualMenuItem(final Context context
) {
449 "Manual", getKeyStroke("F1"),
450 SubtitlesAdjusterActions
.class, "showManual", context
);
461 public static final JPanel
newMainPanel(final Context context
) {
462 final JPanel result
= new JPanel(new BorderLayout());
464 result
.add(newMainSplitPane(context
));
466 new DropTarget(result
, new DropTargetAdapter() {
469 public final void dragEnter(final DropTargetDragEvent event
) {
470 result
.setBorder(BorderFactory
.createLineBorder(Color
.GREEN
, 2));
474 public final void dragExit(final DropTargetEvent event
) {
475 result
.setBorder(null);
479 public final void drop(final DropTargetDropEvent event
) {
480 result
.setBorder(null);
482 final List
<File
> files
= SwingTools
.getFiles(event
);
484 if (!files
.isEmpty() && MarkupsActions
.confirm(context
)) {
485 MarkupsActions
.open(context
, files
.get(0));
491 final EventListener domListener
= new EventListener() {
494 public final void handleEvent(final Event event
) {
500 addListener(context
, DOM
, new AbstractDOMListenerReattacher(domListener
) {
501 // Deliberately left empty
515 public static final JSplitPane
newMainSplitPane(final Context context
) {
516 return new JSplitPane(JSplitPane
.HORIZONTAL_SPLIT
,
517 scrollable(newDOMTreeView(context
)),
518 newContextualSplitPane(context
));
529 public static final JSplitPane
newContextualSplitPane(final Context context
) {
530 return new JSplitPane(JSplitPane
.VERTICAL_SPLIT
,
531 newNodePanel(context
),
532 newXPathPanel(context
));
543 public static final JPanel
newNodePanel(final Context context
) {
544 final JPanel result
= new JPanel(new BorderLayout());
546 result
.add(newNodeNamePanel(context
), BorderLayout
.NORTH
);
547 result
.add(newNodeValuePanel(context
), BorderLayout
.CENTER
);
560 public static final JPanel
newNodeNamePanel(final Context context
) {
561 return newTitledPanel("Name", newNodeNameTextField(context
));
572 public static final JTextField
newNodeNameTextField(final Context context
) {
573 final JTextField result
= new JTextField();
574 final Variable
<Node
> selectedNodeVariable
= context
.getVariable(SELECTED_NODE
);
575 final EventListener nodeListener
= new EventListener() {
578 public final void handleEvent(final Event event
) {
579 final Node node
= selectedNodeVariable
.getValue();
581 result
.setText(node
== null ?
"" : node
.getNodeName());
586 selectedNodeVariable
.addListener(new Variable
.Listener
<Node
>() {
589 public final void valueChanged(final ValueChangedEvent
<Node
, ?
> event
) {
590 if (event
.getOldValue() != null) {
591 removeDOMEventListener(event
.getOldValue(), nodeListener
);
594 final Node node
= event
.getNewValue();
597 addDOMEventListener(node
, nodeListener
);
600 result
.setEditable(node
!= null && set(Node
.ATTRIBUTE_NODE
,
601 Node
.ELEMENT_NODE
).contains(node
.getNodeType()));
603 result
.setText(node
== null ?
"" : node
.getNodeName());
608 result
.getDocument().addDocumentListener(new AbstractDocumentHandler() {
611 protected final void eventReceived(final DocumentEvent event
) {
612 SwingUtilities
.invokeLater(new Runnable() {
615 public final void run() {
616 final Node node
= selectedNodeVariable
.getValue();
617 final String text
= result
.getText();
619 if (node
== null || node
.getNodeName().equals(text
)) {
626 node
.getNamespaceURI(),
627 node
.getNamespaceURI() == null ? text
: node
.getPrefix() + ":" + text
);
628 } catch (final Exception exception
) {
629 exception
.printStackTrace();
630 result
.setText(node
.getNodeName());
650 public static final JPanel
newNodeValuePanel(final Context context
) {
651 return newTitledPanel("Value", scrollable(newNodeValueTextArea(context
)));
662 public static final JTextArea
newNodeValueTextArea(final Context context
) {
663 final Variable
<Node
> selectedNodeVariable
= context
.getVariable(SELECTED_NODE
);
664 final JTextArea result
= new JTextArea();
666 final EventListener nodeListener
= new EventListener() {
669 public final void handleEvent(final Event event
) {
670 final Node node
= selectedNodeVariable
.getValue();
672 if (event
.getTarget() == node
) {
673 result
.setText(node
== null ?
"" : node
.getNodeValue());
679 selectedNodeVariable
.addListener(new Variable
.Listener
<Node
>() {
682 public final void valueChanged(final ValueChangedEvent
<Node
, ?
> event
) {
683 if (event
.getOldValue() != null) {
684 removeDOMEventListener(event
.getOldValue(), nodeListener
);
687 final Node node
= event
.getNewValue();
690 addDOMEventListener(node
, nodeListener
);
693 result
.setEditable(node
!= null && set(Node
.ATTRIBUTE_NODE
, Node
.CDATA_SECTION_NODE
, Node
.COMMENT_NODE
,
694 Node
.PROCESSING_INSTRUCTION_NODE
, Node
.TEXT_NODE
).contains(node
.getNodeType()));
696 result
.setText(node
== null ?
"" : node
.getNodeValue());
701 result
.getDocument().addDocumentListener(new AbstractDocumentHandler() {
704 protected final void eventReceived(final DocumentEvent event
) {
705 SwingUtilities
.invokeLater(new Runnable() {
708 public final void run() {
709 final Node node
= selectedNodeVariable
.getValue();
710 final String text
= result
.getText();
712 if (node
== null || emptyIfNull(node
.getNodeValue()).equals(emptyIfNull(text
))) {
717 node
.setNodeValue(text
);
718 } catch (final Exception exception
) {
719 exception
.printStackTrace();
720 result
.setText(node
.getNodeValue());
740 public static final JPanel
newXPathPanel(final Context context
) {
741 final JPanel result
= new JPanel(new BorderLayout());
743 result
.setBorder(BorderFactory
.createTitledBorder(
744 BorderFactory
.createEtchedBorder(),
749 result
.add(newTitledPanel("Context", newContextTextField(context
)), BorderLayout
.NORTH
);
750 result
.add(newXPathTabbedPane(context
), BorderLayout
.CENTER
);
763 public static final JTextField
newContextTextField(final Context context
) {
764 final Variable
<Node
> selectedNodeVariable
= context
.getVariable(SELECTED_NODE
);
765 final JTextField result
= new JTextField();
767 final EventListener nodeListener
= new EventListener() {
770 public final void handleEvent(final Event event
) {
771 final Node node
= selectedNodeVariable
.getValue();
773 if (event
.getTarget() == node
) {
774 result
.setText(node
== null ?
"" : getIdentifyingXPath(node
));
780 selectedNodeVariable
.addListener(new Variable
.Listener
<Node
>() {
783 public final void valueChanged(final ValueChangedEvent
<Node
, ?
> event
) {
784 if (event
.getOldValue() != null) {
785 removeDOMEventListener(event
.getOldValue(), nodeListener
);
788 final Node node
= event
.getNewValue();
791 addDOMEventListener(node
, nodeListener
);
794 result
.setText(node
== null ?
"" : getIdentifyingXPath(node
));
799 result
.setEditable(false);
812 public static final JTabbedPane
newXPathTabbedPane(final Context context
) {
813 final JTabbedPane result
= new JTabbedPane();
815 result
.add("List", newXPathListSplitPane(context
));
816 result
.add("Create", newQuasiXPathPanel(context
));
829 public static final JSplitPane
newXPathListSplitPane(final Context context
) {
830 return new JSplitPane(JSplitPane
.VERTICAL_SPLIT
,
831 newTitledPanel("XPath Expression", scrollable(newXPathExpressionTextArea(context
))),
832 newTitledPanel("Matches", scrollable(newXPathList(context
))));
843 public static final JTextArea
newXPathExpressionTextArea(final Context context
) {
844 final JTextArea result
= new JTextArea();
846 updateVariableOnTextChanged(context
, XPATH_EXPRESSION
, result
);
848 highlightBackgroundOnError(context
, XPATH_ERROR
, result
);
861 public static final JList
newXPathList(final Context context
) {
862 final DefaultListModel model
= new DefaultListModel();
863 final JList result
= new JList(model
);
865 addListener(context
, XPATH_RESULT
, new Variable
.Listener
<NodeList
>() {
868 public final void valueChanged(final ValueChangedEvent
<NodeList
, ?
> event
) {
871 if (event
.getNewValue() != null) {
872 for (final Node node
: toList(event
.getNewValue())) {
873 model
.addElement(node
);
891 public static final JPanel
newQuasiXPathPanel(final Context context
) {
892 final JPanel result
= new JPanel(new BorderLayout());
894 result
.add(newTitledPanel("Quasi-XPath Expression", newQuasiXPathExpressionTextArea(context
)), BorderLayout
.CENTER
);
895 result
.add(newQuasiXPathCreateButton(context
), BorderLayout
.SOUTH
);
908 public static final JTextArea
newQuasiXPathExpressionTextArea(final Context context
) {
909 final JTextArea result
= new JTextArea();
911 updateVariableOnTextChanged(context
, QUASI_XPATH_EXPRESSION
, result
);
913 highlightBackgroundOnError(context
, QUASI_XPATH_ERROR
, result
);
926 public static final JButton
newQuasiXPathCreateButton(final Context context
) {
927 final JButton result
= translate(new JButton("Create Node"));
929 result
.addActionListener(SwingTools
.action(
930 MarkupsActions
.class, "evaluateQuasiXPathExpression", context
));
943 public static final JTree
newDOMTreeView(final Context context
) {
944 final Variable
<Node
> domVariable
= context
.getVariable(DOM
);
945 final JTree result
= new JTree(new DOMTreeModel(domVariable
.getValue()));
947 domVariable
.addListener(new Variable
.Listener
<Node
>() {
950 public final void valueChanged(final ValueChangedEvent
<Node
, ?
> event
) {
951 result
.setModel(new DOMTreeModel(event
.getNewValue()));
956 result
.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
959 public final void valueChanged(final TreeSelectionEvent event
) {
960 if (event
.getNewLeadSelectionPath() == null) {
961 context
.set(SELECTED_NODE
, null);
966 final DefaultMutableTreeNode selectedTreeNode
= (DefaultMutableTreeNode
) event
.getNewLeadSelectionPath().getLastPathComponent();
968 if (selectedTreeNode
!= null) {
969 context
.set(SELECTED_NODE
, (Node
) selectedTreeNode
.getUserObject());
975 addListener(context
, SELECTED_NODE
, new Variable
.Listener
<Node
>() {
978 public final void valueChanged(final ValueChangedEvent
<Node
, ?
> event
) {
979 final DOMTreeModel treeModel
= (DOMTreeModel
) result
.getModel();
980 final DOMTreeModel
.DOMTreeNode treeNode
= treeModel
.get(event
.getNewValue());
982 if (treeNode
!= null) {
983 result
.setSelectionPath(new TreePath(treeModel
.getPathToRoot(treeNode
)));
985 result
.setSelectionPath(null);
996 * @author codistmonk (creation 2010-07-04)
998 public static final class DOMTreeModel
extends DefaultTreeModel
{
1000 private final WeakHashMap
<Node
, DOMTreeNode
> xmlTreeNodes
;
1008 public DOMTreeModel(final Node domNode
) {
1009 super(new DefaultMutableTreeNode());
1010 this.xmlTreeNodes
= new WeakHashMap
<Node
, DOMTreeNode
>();
1012 this.setRoot(this.new DOMTreeNode(domNode
));
1021 public final Node
getDOMNode() {
1022 return (Node
) ((DefaultMutableTreeNode
) this.getRoot()).getUserObject();
1030 * @param xmlTreeNode
1034 final void put(final Node domNode
, final DOMTreeNode xmlTreeNode
) {
1035 this.xmlTreeNodes
.put(domNode
, xmlTreeNode
);
1046 final DOMTreeNode
get(final Node domNode
) {
1047 return this.xmlTreeNodes
.get(domNode
);
1050 private static final long serialVersionUID
= 4264388285566053331L;
1054 * @author codistmonk (creation 2010-07-10)
1056 public final class DOMTreeNode
extends DefaultMutableTreeNode
{
1064 public DOMTreeNode(final Node domNode
) {
1067 this.getTreeModel().put(domNode
, this);
1069 addDOMEventListener(domNode
, new EventListener() {
1072 public final void handleEvent(final Event event
) {
1073 debugPrint("\ntype", event
.getType(), "\ntarget", event
.getTarget());
1074 if (event
.getTarget() == domNode
) {
1075 if (DOM_EVENT_NODE_REMOVED
.equals(event
.getType())) {
1076 DOMTreeNode
.this.getTreeModel().removeNodeFromParent(DOMTreeNode
.this);
1077 } else if (DOM_EVENT_NODE_INSERTED
.equals(event
.getType())) {
1078 final Node domParent
= getNode(domNode
, "..");
1079 final DOMTreeNode parent
= DOMTreeNode
.this.getTreeModel().get(domParent
);
1080 final List
<Node
> siblings
= getChildren(domParent
);
1082 DOMTreeNode
.this.getTreeModel().insertNodeInto(DOMTreeNode
.this, parent
, siblings
.indexOf(domNode
));
1084 DOMTreeNode
.this.refresh();
1091 for (final Node domChild
: getChildren(domNode
)) {
1092 this.add(new DOMTreeNode(domChild
));
1096 final void refresh() {
1099 for (final Node domChild
: getChildren(this.getDomNode())) {
1100 DOMTreeModel
.this.insertNodeInto(this.getOrCreate(domChild
), DOMTreeNode
.this, i
++);
1113 private final DOMTreeNode
getOrCreate(final Node domNode
) {
1114 DOMTreeNode result
= DOMTreeModel
.this.get(domNode
);
1116 if (result
== null) {
1117 result
= DOMTreeModel
.this.new DOMTreeNode(domNode
);
1129 public final Node
getDomNode() {
1130 return (Node
) this.getUserObject();
1139 public final DOMTreeModel
getTreeModel() {
1140 return DOMTreeModel
.this;
1144 public final String
toString() {
1145 switch (this.getDomNode().getNodeType()) {
1146 case Node
.ATTRIBUTE_NODE
:
1147 return this.getDomNode().getNodeName() +
1148 (this.getDomNode().getNodeValue() == null ?
"" : "=\"" + this.getDomNode().getNodeValue() + "\"");
1150 return this.getDomNode().getNodeName() +
1151 (this.getDomNode().getNodeValue() == null ?
"" : "[" + this.getDomNode().getNodeValue() + "]");
1155 private static final long serialVersionUID
= 8090552131823122052L;
1163 * @author codistmonk (creation 2010-07-07)
1165 public static abstract class AbstractDocumentHandler
implements DocumentListener
{
1168 public final void insertUpdate(final DocumentEvent event
) {
1169 this.doInsertUpdate(event
);
1173 public final void removeUpdate(final DocumentEvent event
) {
1174 this.doRemoveUpdate(event
);
1178 public final void changedUpdate(final DocumentEvent event
) {
1179 this.doChangedUpdate(event
);
1187 protected void doInsertUpdate(final DocumentEvent event
) {
1188 this.eventReceived(event
);
1196 protected void doRemoveUpdate(final DocumentEvent event
) {
1197 this.eventReceived(event
);
1205 protected void doChangedUpdate(final DocumentEvent event
) {
1206 this.eventReceived(event
);
1214 protected abstract void eventReceived(DocumentEvent event
);