svn commit: r15356 - branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml: i18n profile/internal/ocl profile/internal/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-07-23 02:39:20-0700
New Revision: 15356

Modified:
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java

Log:

fixing issue 5254



Modified: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties?view=diff&rev=15356&p1=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties&p2=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties&r1=15355&r2=15356
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/i18n/label.properties	2008-07-23 02:39:20-0700
@@ -144,6 +144,7 @@
 label.deprecated = Deprecated:
 label.deprecated-p = <Deprecated>
 label.derived = Derived:
+label.description = Description:
 label.destroy-action = DestroyAction
 label.diagramappearance.fontlist = Name
 label.diagramappearance.fontsize = Size
@@ -219,6 +220,7 @@
 label.interaction-title = Interaction
 label.interface = Interface
 label.internal-transitions = Internal transitions:
+label.knowledge_types = Knowledge Types:
 label.language = Language:
 label.language.tooltip = Language
 label.leaf = Leaf
@@ -258,6 +260,7 @@
 label.notation-language = Notation Language:
 label.object = Object
 label.object-flow-state = ObjectFlowState
+label.ocl = Ocl:
 label.off = Off
 label.offenders = Offenders:
 label.operations = Operations:

Modified: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java?view=diff&rev=15356&p1=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java&p2=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java&r1=15355&r2=15356
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java	2008-07-23 02:39:20-0700
@@ -50,9 +50,14 @@
     private OclInterpreter interpreter = null;
 
     /**
+     * the OCL string
+     */
+    private String ocl = null;
+    
+    /**
      * Creates a new OCL critic
      * 
-     * @param ocl ocl expression
+     * @param oclConstraint ocl expression
      * @param headline headline
      * @param description description
      * @param moreInfoURL the info url
@@ -61,12 +66,14 @@
      * @param priority the priority
      * @throws InvalidOclException if the ocl is not valid
      */
-    public CrOCL(String ocl, String headline, String description,
+    public CrOCL(String oclConstraint, String headline, String description,
             Integer priority, Vector<Decision> supportedDecisions,
             Vector<String> knowledgeTypes, String moreInfoURL)
         throws InvalidOclException {
-        interpreter = new OclInterpreter(ocl, new Uml14ModelInterpreter());
-
+        interpreter = 
+            new OclInterpreter(oclConstraint, new Uml14ModelInterpreter());
+        this.ocl = oclConstraint;
+        
         addSupportedDecision(UMLDecision.PLANNED_EXTENSIONS);
         setPriority(ToDoItem.HIGH_PRIORITY);
 
@@ -83,7 +90,7 @@
         }
 
         if (description == null) {
-            super.setDescription(ocl);
+            super.setDescription("");
         } else {
             super.setDescription(description);
         }
@@ -127,4 +134,11 @@
         }
     }
 
+    /**
+     * @return the ocl constraint
+     */
+    public String getOCL() {
+        return ocl;
+    }
+
 }

Modified: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java?view=diff&rev=15356&p1=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java&p2=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java&r1=15355&r2=15356
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java	2008-07-23 02:39:20-0700
@@ -24,11 +24,16 @@
 
 package org.argouml.profile.internal.ui;
 
+import java.util.Collection;
+import java.util.Set;
+
 import javax.swing.ImageIcon;
+import javax.swing.JLabel;
 import javax.swing.JTextArea;
 import javax.swing.JTextField;
 
 import org.argouml.cognitive.Critic;
+import org.argouml.profile.internal.ocl.CrOCL;
 import org.argouml.uml.ui.PropPanel;
 
 /**
@@ -48,6 +53,10 @@
 
     private JTextArea description;
 
+    private JTextArea ocl;
+    
+    private JLabel oclLabel;
+    
     private JTextField supportedDecision;
 
     private JTextField knowledgeType;
@@ -70,15 +79,20 @@
         addField("label.headline", headline);
         headline.setEditable(false);
 
-        priority = new JTextField();
-        addField("label.priority", priority);
-        priority.setEditable(false);
-
         description = new JTextArea(5, 30);
         addField("label.description", description);
         description.setEditable(false);
         description.setLineWrap(true);
-
+        
+        priority = new JTextField();
+        addField("label.priority", priority);
+        priority.setEditable(false);
+        
+        ocl = new JTextArea(5, 30);
+        oclLabel = addField("label.ocl", ocl);
+        ocl.setEditable(false);
+        ocl.setLineWrap(true);
+        
         supportedDecision = new JTextField();
         addField("label.decision", supportedDecision);
         supportedDecision.setEditable(false);
@@ -101,9 +115,30 @@
         name.setText(c.getCriticName());
         headline.setText(c.getHeadline());
         description.setText(c.getDescriptionTemplate());
-        supportedDecision.setText("" + c.getSupportedDecisions());
-
+        supportedDecision.setText("" + colToString(c.getSupportedDecisions()));
+        if (c instanceof CrOCL) {
+            oclLabel.setVisible(true);
+            ocl.setVisible(true);
+            ocl.setText(((CrOCL) c).getOCL());
+        } else {
+            oclLabel.setVisible(false);
+            ocl.setVisible(false);
+        }
+        
         priority.setText("" + c.getPriority());
-        knowledgeType.setText("" + c.getKnowledgeTypes());
+        knowledgeType.setText("" + colToString(c.getKnowledgeTypes()));
+    }
+
+    private String colToString(Collection set) {
+        String r = "";
+        int count = 0;
+        for (Object obj : set) {
+            if (count > 0) {
+                r += ", ";
+            }
+            r += obj;
+            ++count;
+        }        
+        return r;
     }
 }
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.