User: ko5tik  
  Date: 02/04/14 10:13:16

  Modified:    src/java/xdocletgui/swing/editor
                        TagParameterEditorPanel.java
  Added:       src/java/xdocletgui/swing/editor TagEditorPanel.java
  Log:
  created tageditorpanel. still not complete
  
  Revision  Changes    Path
  1.3       +2 -2      
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.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- TagParameterEditorPanel.java      14 Apr 2002 14:27:39 -0000      1.2
  +++ TagParameterEditorPanel.java      14 Apr 2002 17:13:16 -0000      1.3
  @@ -265,6 +265,7 @@
                _xdoc = _programElement.doc();
   
                _description.setText("value of \"" + _tagParameter.getName() + "\" 
parameter");
  +             _usage.setText(_tagParameter.getUsage());
   
                _removeButton.setEnabled(!_tagParameter.isMandatory());
                revert();
  @@ -296,7 +297,7 @@
                        return;
                }
   
  -             // well, xtags is not against removal. do it
  +             // well, xtag is not against removal. do it
                _xtag.removeAttribute(_tagParameter.getName());
   
                TagTreeNode ttn = (TagTreeNode)_node.getParent();
  @@ -310,7 +311,6 @@
         * set display data from parameter contens reverting all edits
         */
        public void revert() {
  -             _usage.setText(_tagParameter.getUsage());
   
                _log.debug("looking for property editor for: " + 
_tagParameter.getValueClass());
                _editor = _tagParameter.getPropertyEditor(_programElement, _xtag);
  
  
  
  1.1                  xdocletgui/src/java/xdocletgui/swing/editor/TagEditorPanel.java
  
  Index: TagEditorPanel.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 javax.swing.*;
  import javax.swing.text.*;
  import javax.swing.tree.*;
  import javax.swing.event.*;
  
  import java.awt.*;
  import java.awt.event.*;
  
  import xdocletgui.swing.TagParameterTreeNode;
  import xdocletgui.swing.ProgramElementTreeNode;
  import xdocletgui.swing.TagTreeNode;
  
  import xtags.*;
  
  import xjavadoc.XDoc;
  import xjavadoc.XProgramElement;
  import xjavadoc.XTag;
  
  /**
   * editor panel for xtag editing
   *
   * @author kostik
   * @created April 14, 2002
   * @todo-javadoc Write javadocs
   */
  public class TagEditorPanel extends UndoableEditorPanel {
  
        /**
         * reference to the tree
         */
        JTree _tree;
  
        /**
         * node holding tag
         */
        TagTreeNode _node;
  
        /**
         * formal tag description
         */
        Tag _tag;
  
        /**
         * panel for full-text editing
         */
        JPanel _editorPanel;
  
        /**
         * label describing parameter
         */
        JLabel _description;
  
        /**
         * usage description text
         */
        JTextArea _usage;
  
        /**
         * split pane fot the middle
         */
        JSplitPane _splitPane;
  
        /**
         * remove button
         */
        JButton _removeButton;
  
        /**
         * XDoc in question
         */
        XDoc _xdoc;
        /**
         * XDoc in question
         */
        XTag _xtag;
  
        /**
         * XProgramElement in question
         */
        XProgramElement _programElement;
  
        /**
         * Get static reference to Log4J Logger
         */
        private static org.apache.log4j.Category _log = 
org.apache.log4j.Category.getInstance(TagEditorPanel.class.getName());
  
  
  
        /**
         * constructor for tag editor panel
         *
         * @param tree JTree build around XDocs
         */
        public TagEditorPanel(JTree tree) {
                super(new BorderLayout());
  
                _tree = tree;
  
                setBorder(BorderFactory.createTitledBorder("Tag"));
  
                _description = new JLabel();
  
                add(_description, BorderLayout.NORTH);
  
                _usage = new JTextArea();
                _usage.setEditable(false);
  
                _removeButton = new JButton("remove");
                _removeButton.addActionListener(
                        new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                        remove();
                                }
                        });
  
                // setup butotn panel
                JPanel buttonPanel = new JPanel();
  
                buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
                buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
                buttonPanel.add(_removeButton);
  
                buttonPanel.add(Box.createHorizontalGlue());
                buttonPanel.add(_undoButton);
                buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
                buttonPanel.add(_redoButton);
                buttonPanel.add(Box.createRigidArea(new Dimension(50, 0)));
  
                buttonPanel.add(_cancelButton);
                buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
                buttonPanel.add(_setButton);
  
                add(buttonPanel, BorderLayout.SOUTH);
  
                // create split pane for edit / usage
  
                _splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  
                JScrollPane editorPane = new JScrollPane(_text);
  
                _editorPanel = new JPanel(new BorderLayout());
                _editorPanel.add(editorPane, BorderLayout.CENTER);
  
                JPanel usagePanel = new JPanel(new BorderLayout());
  
                JLabel usageLabel = new JLabel("Parameter usage:");
                usagePanel.add(usageLabel, BorderLayout.NORTH);
  
                JScrollPane scp = new JScrollPane(_usage);
                usagePanel.add(scp, BorderLayout.CENTER);
  
                _splitPane.setTopComponent(_editorPanel);
                _splitPane.setBottomComponent(usagePanel);
  
                add(_splitPane, BorderLayout.CENTER);
  
        }
  
  
        /**
         * set node to render & edit
         *
         * @param node node to render & edit
         */
        public void setNode(TagTreeNode node) {
                _node = node;
  
                _tag = _node.getTag();
                _xtag = _node.getXTag();
  
                _programElement = 
(XProgramElement)((ProgramElementTreeNode)(_node.getParent().getParent())).getProgramElement();
  
                _xdoc = _programElement.doc();
  
                _description.setText("editing \"" + _xtag.name() + "\" tag");
                _usage.setText(_tag.getUsage());
                revert();
  
        }
  
  
        /**
         * pull data from node, cancel all changes
         */
        public void revert() {
  
                _text.setText(_xtag.value());
                enableButtons(false);
        }
  
  
        /**
         * save contens into XDoc
         */
        public void save() {
                enableButtons(false);
        }
  
  
        /**
         * remove this tag
         */
        public void remove() {
        }
  }
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to