svn commit: r13883 - trunk/src_new/org/argouml/uml/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-12-08 02:39:17-0800
New Revision: 13883

Modified:
   trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java
   trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java

Log:
Issue 4936 - Add TODOs for TagDef types other than String.  Minor cleanups too.

Modified: trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java?view=diff&rev=13883&p1=trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java&p2=trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java&r1=13882&r2=13883
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java	(original)
+++ trunk/src_new/org/argouml/uml/ui/TabTaggedValues.java	2007-12-08 02:39:17-0800
@@ -29,7 +29,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ComponentEvent;
 import java.awt.event.ComponentListener;
-import java.util.ArrayList;
+import java.util.Collection;
 
 import javax.swing.Action;
 import javax.swing.DefaultCellEditor;
@@ -217,12 +217,16 @@
     /*
      * @see org.argouml.ui.TabTarget#getTarget()
      */
-    public Object getTarget() { return target; }
+    public Object getTarget() {
+        return target;
+    }
 
     /*
      * @see org.argouml.ui.TabTarget#refresh()
      */
-    public void refresh() { setTarget(target); }
+    public void refresh() {
+        setTarget(target);
+    }
 
     /*
      * @see org.argouml.ui.TabTarget#shouldBeEnabled(java.lang.Object)
@@ -282,12 +286,12 @@
         if (!e.getValueIsAdjusting()) {
             DefaultListSelectionModel sel = 
                 (DefaultListSelectionModel) e.getSource();
-            ArrayList tvs = new ArrayList(Model.getFacade()
-                    .getTaggedValuesCollection(target));
+            Collection tvs =
+                    Model.getFacade().getTaggedValuesCollection(target);
             int index = sel.getLeadSelectionIndex();
             if (index >= 0 && index < tvs.size()) {
                 Object tagDef = Model.getFacade().getTagDefinition(
-                        tvs.get(index));
+                        TabTaggedValuesModel.getFromCollection(tvs, index));
                 tagDefinitionsComboBoxModel.setSelectedItem(tagDef);
             }
         }
@@ -350,6 +354,7 @@
     /*
      * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
      */
+    @Override
     public void actionPerformed(ActionEvent e) {
         super.actionPerformed(e);
         TabTaggedValuesModel model = (TabTaggedValuesModel) table.getModel();

Modified: trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java?view=diff&rev=13883&p1=trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java&p2=trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java&r1=13882&r2=13883
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java	(original)
+++ trunk/src_new/org/argouml/uml/ui/TabTaggedValuesModel.java	2007-12-08 02:39:17-0800
@@ -46,13 +46,13 @@
 /**
  * The model for the table with the tagged values. Implementation for UML 1.4
  * and TagDefinitions.
+ * 
+ * TODO: This currently only supports TaggedValues with a TagDefinition which
+ * has a type of String.
  */
 public class TabTaggedValuesModel extends AbstractTableModel implements
         VetoableChangeListener, DelayedVChangeListener, PropertyChangeListener {
 
-    /**
-     * Logger.
-     */
     private static final Logger LOG =
         Logger.getLogger(TabTaggedValuesModel.class);
 
@@ -106,6 +106,7 @@
     /*
      * @see javax.swing.table.TableModel#getColumnName(int)
      */
+    @Override
     public String getColumnName(int c) {
         if (c == 0) {
             return Translator.localize("label.taggedvaluespane.tag");
@@ -124,6 +125,7 @@
             return (Class) Model.getMetaTypes().getTagDefinition();
         }
         if (c == 1) {
+            // TODO: This will vary based on the type of the TagDefinition
             return String.class;
         }
         return null;
@@ -188,11 +190,13 @@
     /*
      * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
      */
+    @Override
     public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
         if (columnIndex != 0 && columnIndex != 1) {
             return;
         }
         if (columnIndex == 1 && aValue == null) {
+            // TODO: Use default value of appropriate type here
             aValue = "";
         }
         
@@ -236,12 +240,14 @@
             tagType = "";
         }
         if (tagValue == null) {
+            // TODO: Use default value of appropriate type for TD
             tagValue = "";
+//            tagValue = true;
         }
         Object tv = Model.getExtensionMechanismsFactory().createTaggedValue();
         
         // We really shouldn't add it until after it is set up, but we
-        // need it to have an owner for the following methods
+        // need it to have an owner for the following method calls
         Model.getExtensionMechanismsHelper().addTaggedValue(target, tv);
 
         Model.getExtensionMechanismsHelper().setTag(tv, tagType);
@@ -272,7 +278,7 @@
      * @param index index of the element to be returned
      * @return the object
      */
-    private Object getFromCollection(Collection collection, int index) {
+    static Object getFromCollection(Collection collection, int index) {
         if (collection instanceof List) {
             return ((List) collection).get(index);
         }
@@ -319,4 +325,4 @@
      * The UID.
      */
     private static final long serialVersionUID = -5711005901444956345L;
-} /* end class TableModelTaggedValues */
+}
\ No newline at end of file
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.