User: ko5tik
Date: 02/04/16 03:38:58
Modified: src/java/xdocletgui/swing/editor TagEditorPanel.java
TagParameterEditorPanel.java UnknownTagPanel.java
UnknownTagsPanel.java
Added: src/java/xdocletgui/swing/editor TagFamilyEditorPanel.java
Log:
added "unique" param to ctag indicating it can be contained
only one in program element
solved fucking race condition in nodes removal.
Guys: first select parent node, then remove undesired stuff...
Revision Changes Path
1.3 +11 -1 xdocletgui/src/java/xdocletgui/swing/editor/TagEditorPanel.java
Index: TagEditorPanel.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/editor/TagEditorPanel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- TagEditorPanel.java 15 Apr 2002 17:33:20 -0000 1.2
+++ TagEditorPanel.java 16 Apr 2002 10:38:58 -0000 1.3
@@ -46,7 +46,7 @@
import xdocletgui.swing.TagParameterTreeNode;
import xdocletgui.swing.ProgramElementTreeNode;
import xdocletgui.swing.TagTreeNode;
-
+import xdocletgui.swing.TagFamilyTreeNode;
import xtags.*;
import java.util.Iterator;
@@ -276,6 +276,8 @@
/**
* save contens into XDoc
+ *
+ * @todo fix save for unstructured
*/
public void save() {
enableButtons(false);
@@ -286,6 +288,14 @@
* remove this tag
*/
public void remove() {
+ _xdoc.removeTag(_xtag);
+ TagFamilyTreeNode parent = (TagFamilyTreeNode)_node.getParent();
+ _log.debug("parent is of class: " +
_node.getParent().getClass().getName());
+ _log.debug("node is of class: " + _node.getClass().getName());
+
+ _log.debug("parent path: " + new TreePath(parent.getPath()));
+ _tree.setSelectionPath(new TreePath(parent.getPath()));
+ ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(_node);
}
1.5 +1 -1
xdocletgui/src/java/xdocletgui/swing/editor/TagParameterEditorPanel.java
Index: TagParameterEditorPanel.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/editor/TagParameterEditorPanel.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- TagParameterEditorPanel.java 15 Apr 2002 17:33:20 -0000 1.4
+++ TagParameterEditorPanel.java 16 Apr 2002 10:38:58 -0000 1.5
@@ -301,8 +301,8 @@
_xtag.removeAttribute(_tagParameter.getName());
TagTreeNode ttn = (TagTreeNode)_node.getParent();
- ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(_node);
_tree.setSelectionPath(new TreePath(ttn.getPath()));
+ ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(_node);
}
1.2 +1 -1 xdocletgui/src/java/xdocletgui/swing/editor/UnknownTagPanel.java
Index: UnknownTagPanel.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/editor/UnknownTagPanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- UnknownTagPanel.java 14 Apr 2002 14:27:39 -0000 1.1
+++ UnknownTagPanel.java 16 Apr 2002 10:38:58 -0000 1.2
@@ -204,7 +204,7 @@
UnknownTagsTreeNode parent = (UnknownTagsTreeNode)_node.getParent();
- ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(_node);
_tree.setSelectionPath(new TreePath(parent.getPath()));
+ ((DefaultTreeModel)_tree.getModel()).removeNodeFromParent(_node);
}
}
1.4 +0 -1
xdocletgui/src/java/xdocletgui/swing/editor/UnknownTagsPanel.java
Index: UnknownTagsPanel.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdocletgui/src/java/xdocletgui/swing/editor/UnknownTagsPanel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- UnknownTagsPanel.java 12 Apr 2002 17:01:17 -0000 1.3
+++ UnknownTagsPanel.java 16 Apr 2002 10:38:58 -0000 1.4
@@ -136,7 +136,6 @@
XDoc doc = _progNode.getProgramElement().doc();
- XTagFactory xTagFactory = XTagFactory.getInstance();
XTag tag = doc.addTag(_tagName.getText(), "");
UnknownTagTreeNode newNode = new UnknownTagTreeNode(tag);
1.1
xdocletgui/src/java/xdocletgui/swing/editor/TagFamilyEditorPanel.java
Index: TagFamilyEditorPanel.java
===================================================================
/*
* Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of BEKK Consulting nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Change log
*
*/
package xdocletgui.swing.editor;
import xdocletgui.swing.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import javax.swing.undo.*;
import java.awt.*;
import java.awt.event.*;
import xdocletgui.swing.TagFamilyTreeNode;
import xdocletgui.swing.TagTreeNode;
import xdocletgui.swing.TagParameterTreeNode;
import xjavadoc.XTag;
import xjavadoc.XDoc;
import xjavadoc.XTagFactory;
import xjavadoc.XProgramElement;
import xtags.TagFamily;
import xtags.Tag;
import xtags.TagParameter;
/**
* Describe what this class does
*
* @author kostik
* @created April 16, 2002
* @todo-javadoc Write javadocs
*/
public class TagFamilyEditorPanel extends JPanel {
/**
* XDoc in question
*/
XDoc _xdoc;
/**
* program element in question
*/
XProgramElement _programElement;
/**
* tag family
*/
TagFamily _tagFamily;
/**
* tree node
*/
TagFamilyTreeNode _node;
/**
* combo box for tags choosing
*/
JComboBox _tagChoice;
/**
* tree reference
*/
JTree _tree;
/**
* text tpane for family description
*/
JTextPane _description;
/**
* Get static reference to Log4J Logger
*/
private static org.apache.log4j.Category _log =
org.apache.log4j.Category.getInstance(TagFamilyEditorPanel.class.getName());
/**
* Describe what the TagFamilyEditorPanel constructor does
*
* @param tree Describe what the parameter does
* @todo-javadoc Write javadocs for constructor
* @todo-javadoc Write javadocs for method parameter
*/
public TagFamilyEditorPanel(JTree tree) {
super(new BorderLayout());
_tree = tree;
JPanel newPanel = new JPanel();
newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.X_AXIS));
newPanel.setBorder(BorderFactory.createTitledBorder("Create new tag"));
JButton newButton = new JButton("create");
newButton.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
create();
}
});
_tagChoice = new JComboBox();
newPanel.add(new JLabel("Tag:"));
newPanel.add(Box.createRigidArea(new Dimension(10, 0)));
newPanel.add(_tagChoice);
newPanel.add(Box.createRigidArea(new Dimension(10, 0)));
newPanel.add(newButton);
add(newPanel, BorderLayout.NORTH);
_description = new JTextPane();
JScrollPane scrollPane = new JScrollPane(_description);
add(scrollPane, BorderLayout.CENTER);
}
/**
* set node
*
* @param node tree node selected
*/
public void setNode(TagFamilyTreeNode node) {
_node = node;
// populate family etc.
_tagFamily = _node.getTagFamily();
ProgramElementTreeNode parent =
(ProgramElementTreeNode)_node.getParent();
_programElement = parent.getProgramElement();
_xdoc = _programElement.doc();
_description.setText(_tagFamily.getUsage());
fillTagPanel();
}
/**
* create desired tag
*/
public void create() {
}
/**
* fill tag panel with valid tags
*/
public void fillTagPanel() {
_tagChoice.removeAllItems();
// wal through tag family
for (int i = 0; i < _tagFamily.size(); i++) {
Tag tag = _tagFamily.getTag(i);
_log.debug("tag " + tag.getName() + " is unique:" +
tag.isUnique());
_log.debug("doc has tag: " + _xdoc.hasTag(tag.getName()));
if (!(tag.isUnique() && _xdoc.hasTag(tag.getName()))) {
// add to list
_log.debug("added");
_tagChoice.addItem(tag.getName());
}
}
}
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel