svn commit: r15217 - branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels: panel ui xml

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2008-07-09 10:06:48-0700
New Revision: 15217

Added:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/ActionDeleteAnnotatedElement.java   (contents, props changed)
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/UMLCommentBodyDocument.java   (contents, props changed)
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Comment.xml   (contents, props changed)
Modified:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java

Log:
A panel for Comment.

Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java?view=diff&rev=15217&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&r1=15216&r2=15217
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	(original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	2008-07-09 10:06:48-0700
@@ -38,9 +38,11 @@
 
 import org.apache.log4j.Logger;
 import org.argouml.core.propertypanels.ui.ActionAddStereotypeBaseClass;
+import org.argouml.core.propertypanels.ui.ActionDeleteAnnotatedElement;
 import org.argouml.core.propertypanels.ui.ActionDeleteStereotypeBaseClass;
 import org.argouml.core.propertypanels.ui.EnumerationListModel;
 import org.argouml.core.propertypanels.ui.UMLClassifierPackageImportsListModel;
+import org.argouml.core.propertypanels.ui.UMLCommentBodyDocument;
 import org.argouml.core.propertypanels.ui.UMLDefaultValueExpressionModel;
 import org.argouml.core.propertypanels.ui.UMLExpressionModel3;
 import org.argouml.core.propertypanels.ui.UMLExpressionPanel;
@@ -93,6 +95,7 @@
 import org.argouml.uml.ui.foundation.core.UMLClassifierAssociationEndListModel;
 import org.argouml.uml.ui.foundation.core.UMLClassifierFeatureListModel;
 import org.argouml.uml.ui.foundation.core.UMLClassifierParameterListModel;
+import org.argouml.uml.ui.foundation.core.UMLCommentAnnotatedElementListModel;
 import org.argouml.uml.ui.foundation.core.UMLDependencyClientListModel;
 import org.argouml.uml.ui.foundation.core.UMLDependencySupplierListModel;
 import org.argouml.uml.ui.foundation.core.UMLDiscriminatorNameDocument;
@@ -235,7 +238,14 @@
             osta.setRows(3);
             control = new JScrollPane(osta);
         }
-        
+        else if ("body".equals(prop.getName())) {
+            UMLPlainTextDocument document = new UMLCommentBodyDocument();
+            document.setTarget(target);
+            UMLTextArea2 text = new UMLTextArea2(document);
+            text.setLineWrap(true);
+            text.setRows(5);
+            control = new JScrollPane(text);
+        }
         if (control != null) {
             // if the control is a panel, add it
             if (control == p) {
@@ -452,6 +462,14 @@
             model.setTarget(target);
             list = new ScrollList(model);
         }
+        else if ("annotated_elements".equals(prop.getName())) {
+            model = new UMLCommentAnnotatedElementListModel();
+            model.setTarget(target);
+            UMLMutableLinkedList l = new UMLMutableLinkedList(
+                    model, null, null);            
+            l.setDeleteAction(new ActionDeleteAnnotatedElement());
+            list = new ScrollList(l);
+        }
         if (list != null) {
             String name = prop.getName();
 

Added: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/ActionDeleteAnnotatedElement.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/ActionDeleteAnnotatedElement.java?view=auto&rev=15217
==============================================================================
--- (empty file)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/ActionDeleteAnnotatedElement.java	2008-07-09 10:06:48-0700
@@ -0,0 +1,51 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import java.awt.event.ActionEvent;
+
+import org.argouml.i18n.Translator;
+import org.argouml.model.Model;
+import org.argouml.uml.ui.AbstractActionRemoveElement;
+
+public class ActionDeleteAnnotatedElement extends AbstractActionRemoveElement {
+    /**
+     * Constructor.
+     */
+    public ActionDeleteAnnotatedElement() {
+        super(Translator.localize("menu.popup.remove"));
+    }
+
+    /*
+     * @see org.tigris.gef.undo.UndoableAction#actionPerformed(java.awt.event.ActionEvent)
+     */
+    @Override
+    public void actionPerformed(ActionEvent arg0) {
+        super.actionPerformed(arg0);
+        Model.getCoreHelper().removeAnnotatedElement(
+                getTarget(), getObjectToRemove());
+    }
+    
+}
\ No newline at end of file

Added: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/UMLCommentBodyDocument.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/UMLCommentBodyDocument.java?view=auto&rev=15217
==============================================================================
--- (empty file)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/ui/UMLCommentBodyDocument.java	2008-07-09 10:06:48-0700
@@ -0,0 +1,63 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import org.argouml.model.Model;
+import org.argouml.uml.ui.UMLPlainTextDocument;
+
+public class UMLCommentBodyDocument extends UMLPlainTextDocument {
+    
+    /**
+     * Constructor for UMLCommentBodyDocument.
+     */
+    public UMLCommentBodyDocument() {
+        super("body"); 
+        /*
+         * TODO: This is probably not the right location
+         * for switching off the "filterNewlines".
+         * The setting gets lost after selecting a different
+         * ModelElement in the diagram.
+         * BTW, see how it is used in
+         * javax.swing.text.PlainDocument.
+         * See issue 1812.
+         */
+        putProperty("filterNewlines", Boolean.FALSE);
+    }
+    
+    /*
+     * @see org.argouml.uml.ui.UMLPlainTextDocument#setProperty(java.lang.String)
+     */
+    protected void setProperty(String text) {
+        Model.getCoreHelper().setBody(getTarget(), text);
+    }
+    
+    /*
+     * @see org.argouml.uml.ui.UMLPlainTextDocument#getProperty()
+     */
+    protected String getProperty() {
+        return (String) Model.getFacade().getBody(getTarget());
+    }
+    
+}
\ No newline at end of file

Added: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Comment.xml
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Comment.xml?view=auto&rev=15217
==============================================================================
--- (empty file)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Comment.xml	2008-07-09 10:06:48-0700
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<panel>	
+	<text name='name' />	
+	<list name='annotated_elements' />
+	<separator />
+	<textarea name='body' />
+</panel>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.