Author: bobtarling
Date: 2010-01-09 00:39:10-0800
New Revision: 17739

Modified:
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBoxWithAttributes.java
   
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java

Log:
Get FigClassifierBox WithAttributes into a state where it can be deleted after 
deprecation period.

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java?view=diff&pathrev=17739&r1=17738&r2=17739
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
 (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
 2010-01-09 00:39:10-0800
@@ -12,7 +12,6 @@
  *
  * Some portions of this file was previously release using the BSD License:
  */
-
 // $Id$
 // Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
@@ -58,7 +57,7 @@
  * A Class may show stereotypes, a name and compartments for
  * attributes and operations.
  */
-public class FigClass extends FigClassifierBoxWithAttributes {
+public class FigClass extends FigClassifierBox {
 
     /**
      * Constructor for a {...@link FigClass} during file load.<p>

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java?view=diff&pathrev=17739&r1=17738&r2=17739
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
 (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
 2010-01-09 00:39:10-0800
@@ -1,3 +1,18 @@
+/* $Id$
+ 
*******************************************************************************
+ * Copyright (c) 2010 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Bob Tarling
+ *    Michiel van der Wulp
+ 
*******************************************************************************
+ *
+ * Some portions of this file were previously release using the BSD License:
+ */
 // $Id$
 // Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
@@ -27,8 +42,10 @@
 import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.swing.Action;
@@ -135,9 +152,9 @@
         // TODO: Taken from FigClassifierBoxWithAttribute to handle events
         // on an attribute. All this event handling should eventually be moved
         // to the compartment Fig for attributes
-        if (Model.getFacade().isAAttribute(getOwner())) {
+        if (isAttributesVisible()) {
             // TODO: We shouldn't actually have to do all this work
-            updateAttributes();
+            updateCompartment(Model.getMetaTypes().getAttribute());
         }
     }
     
@@ -195,7 +212,7 @@
                     // event here. The FigFeature (or its notation) should be
                     // listen for change and the FigFeature should be update
                     // from that.
-                    updateAttributes();
+                    updateCompartment(Model.getMetaTypes().getAttribute());
                 }
             } else if (event instanceof AssociationChangeEvent 
                     && getOwner().equals(event.getSource())) {
@@ -209,27 +226,62 @@
                     // TODO: Bob says - we should not be listening here for
                     // addition and removal of attributes. This should be done 
in
                     // FigAttributesCompartment.
-                    updateAttributes();
+                    updateCompartment(Model.getMetaTypes().getAttribute());
                 }
             }
         }
     }
+    
+    @Override
+    protected void updateListeners(Object oldOwner, Object newOwner) {
+       
+        if (isAttributesVisible()) {
+            Set<Object[]> listeners = new HashSet<Object[]>();
+
+            // Collect the set of model elements that we want to listen to
+            if (newOwner != null) {
+                // TODO: Because we get called on each and every change event, 
when
+                // the model is in a state of flux, we'll often get an
+                // InvalidElementException before we finish this collection. 
The
+                // only saving grace is that we're called SO many times that 
on the
+                // last time, things should be stable again and we'll get a 
good set
+                // of elements for the final update.  We need a better 
mechanism.
+                
+                // add the listeners to the newOwner
+                listeners.add(new Object[] {newOwner, null});
+                
+                // and its stereotypes
+                // TODO: Aren't stereotypes handled elsewhere?
+                for (Object stereotype 
+                        : Model.getFacade().getStereotypes(newOwner)) {
+                    listeners.add(new Object[] {stereotype, null});
+                }
 
-    /**
-     * @deprecated by Bob Tarling in 0.29.3 use
-     * updateCompartment(Model.getMetaTypes().getAttribute())
-     */
-    protected void updateAttributes() {
-        FigCompartment fc = 
getCompartment(Model.getMetaTypes().getAttribute());
-        if (!fc.isVisible()) {
-            return;
+                // and its features
+                for (Object feat : Model.getFacade().getFeatures(newOwner)) {
+                    listeners.add(new Object[] {feat, null});
+                    // and the stereotypes of its features
+                    for (Object stereotype 
+                            : Model.getFacade().getStereotypes(feat)) {
+                        listeners.add(new Object[] {stereotype, null});
+                    }
+                    // and the parameter of its operations
+                    if (Model.getFacade().isAOperation(feat)) {
+                        for (Object param : 
Model.getFacade().getParameters(feat)) {
+                            listeners.add(new Object[] {param, null});
+                        }
+                    }
+                }
+            }
+            
+            // Update the listeners to match the desired set using the minimal
+            // update facility
+            updateElementListeners(listeners);
+        } else {
+            super.updateListeners(oldOwner, newOwner);
         }
-        fc.populate();
-    
-        // TODO: make setBounds, calcBounds and updateBounds consistent
-        setBounds(getBounds());
     }
-
+    
     /**
      * Updates a compartment box. Called from updateLayout if there is
      * a model event effecting the attributes/operations and from

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBoxWithAttributes.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBoxWithAttributes.java?view=diff&pathrev=17739&r1=17738&r2=17739
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBoxWithAttributes.java
   (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClassifierBoxWithAttributes.java
   2010-01-09 00:39:10-0800
@@ -1,3 +1,18 @@
+/* $Id$
+ 
*******************************************************************************
+ * Copyright (c) 2010 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Michiel van der Wulp
+ *    Bob Tarling
+ 
*******************************************************************************
+ *
+ * Some portions of this file were previously release using the BSD License:
+ */
 // $Id$
 // Copyright (c) 2008-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
@@ -25,29 +40,17 @@
 package org.argouml.uml.diagram.static_structure.ui;
 
 import java.awt.Rectangle;
-import java.util.HashSet;
-import java.util.Set;
 
-import javax.swing.Action;
-
-import org.argouml.model.AddAssociationEvent;
-import org.argouml.model.AssociationChangeEvent;
-import org.argouml.model.AttributeChangeEvent;
-import org.argouml.model.Model;
-import org.argouml.model.RemoveAssociationEvent;
-import org.argouml.model.UmlChangeEvent;
-import org.argouml.ui.ArgoJMenu;
 import org.argouml.uml.diagram.AttributesCompartmentContainer;
 import org.argouml.uml.diagram.DiagramSettings;
-import org.argouml.uml.diagram.ui.FigAttributesCompartment;
-import org.argouml.uml.diagram.ui.FigCompartment;
-import org.argouml.uml.ui.foundation.core.ActionAddAttribute;
 
 /**
  * A Fig for a ClassifierBox that adds an attributes compartment.
  *
  * @author Michiel
+ * @deprecated in 0.29.3 by Bob Tarling use FigClassifierBox.
  */
+...@deprecated
 public abstract class FigClassifierBoxWithAttributes extends FigClassifierBox 
     implements AttributesCompartmentContainer {
     
@@ -62,116 +65,4 @@
             DiagramSettings settings) {
         super(owner, bounds, settings);
     }
-
-    /**
-     * USED BY PGML.tee.
-     * @return the class name and bounds together with compartment
-     * visibility.
-     */
-    @Override
-    public String classNameAndBounds() {
-        return super.classNameAndBounds()
-            + "attributesVisible=" + isAttributesVisible() + ";";
-    }
-
-    @Override
-    protected void updateListeners(Object oldOwner, Object newOwner) {
-        Set<Object[]> listeners = new HashSet<Object[]>();
-
-        // Collect the set of model elements that we want to listen to
-        if (newOwner != null) {
-            // TODO: Because we get called on each and every change event, when
-            // the model is in a state of flux, we'll often get an
-            // InvalidElementException before we finish this collection. The
-            // only saving grace is that we're called SO many times that on the
-            // last time, things should be stable again and we'll get a good 
set
-            // of elements for the final update.  We need a better mechanism.
-            
-            // add the listeners to the newOwner
-            listeners.add(new Object[] {newOwner, null});
-            
-            // and its stereotypes
-            // TODO: Aren't stereotypes handled elsewhere?
-            for (Object stereotype 
-                    : Model.getFacade().getStereotypes(newOwner)) {
-                listeners.add(new Object[] {stereotype, null});
-            }
-
-            // and its features
-            for (Object feat : Model.getFacade().getFeatures(newOwner)) {
-                listeners.add(new Object[] {feat, null});
-                // and the stereotypes of its features
-                for (Object stereotype 
-                        : Model.getFacade().getStereotypes(feat)) {
-                    listeners.add(new Object[] {stereotype, null});
-                }
-                // and the parameter of its operations
-                if (Model.getFacade().isAOperation(feat)) {
-                    for (Object param : Model.getFacade().getParameters(feat)) 
{
-                        listeners.add(new Object[] {param, null});
-                    }
-                }
-            }
-        }
-        
-        // Update the listeners to match the desired set using the minimal
-        // update facility
-        updateElementListeners(listeners);
-    }
-    
-    @Override
-    public void renderingChanged() {
-        super.renderingChanged();
-        if (getOwner() != null) {
-            // TODO: We shouldn't actually have to do all this work
-            updateAttributes();
-        }
-    }
-    
-    /*
-     * TODO: Based on my comments below, with that work done,
-     * this method can be removed - Bob.
-     */
-    @Override
-    protected void updateLayout(UmlChangeEvent event) {
-        super.updateLayout(event);
-
-        if (event instanceof AttributeChangeEvent) {
-            Object source = event.getSource();
-            if (Model.getFacade().isAAttribute(source)) {
-                // TODO: We just need to get someone to rerender a single line
-                // of text which represents the element here, but I'm not sure
-                // how to do that. - tfm
-                // TODO: Bob replies - we shouldn't be interested in this event
-                // here. The FigFeature (or its notation) should be listen for
-                // change and the FigFeature should be update from that.
-                updateAttributes();
-            }
-        } else if (event instanceof AssociationChangeEvent 
-                && getOwner().equals(event.getSource())) {
-            Object o = null;
-            if (event instanceof AddAssociationEvent) {
-                o = event.getNewValue();
-            } else if (event instanceof RemoveAssociationEvent) {
-                o = event.getOldValue();
-            }
-            if (Model.getFacade().isAAttribute(o)) {
-                // TODO: Bob says - we should not be listening here for
-                // addition and removal of attributes. This should be done in
-                // FigAttributesCompartment.
-                updateAttributes();
-            }
-        }
-    }
-    
-    protected void updateAttributes() {
-        FigCompartment fc = 
getCompartment(Model.getMetaTypes().getAttribute());
-        if (!fc.isVisible()) {
-            return;
-        }
-        fc.populate();
-
-        // TODO: make setBounds, calcBounds and updateBounds consistent
-        setBounds(getBounds());
-    }
 }

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java?view=diff&pathrev=17739&r1=17738&r2=17739
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
        (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
        2010-01-09 00:39:10-0800
@@ -57,7 +57,7 @@
  * 
  * @author Tom Morris
  */
-public class FigSignal extends FigClassifierBoxWithAttributes {
+public class FigSignal extends FigClassifierBox {
 
     /**
      * Construct a Fig representing a Signal.

Modified: 
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java?view=diff&pathrev=17739&r1=17738&r2=17739
==============================================================================
--- 
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java   
    (original)
+++ 
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociationClass.java   
    2010-01-09 00:39:10-0800
@@ -1,3 +1,18 @@
+/* $Id$
+ 
*******************************************************************************
+ * Copyright (c) 2010 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Bob Tarling
+ *    Michiel van der Wulp
+ 
*******************************************************************************
+ *
+ * Some portions of this file were previously release using the BSD License:
+ */
 // $Id$
 // Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
@@ -29,10 +44,8 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.argouml.uml.diagram.AttributesCompartmentContainer;
 import org.argouml.uml.diagram.DiagramEdgeSettings;
 import org.argouml.uml.diagram.DiagramSettings;
-import org.argouml.uml.diagram.OperationsCompartmentContainer;
 import org.argouml.uml.diagram.PathContainer;
 import org.tigris.gef.presentation.Fig;
 import org.tigris.gef.presentation.FigNode;
@@ -61,9 +74,8 @@
  *
  * @author [email protected]
  */
-public class FigAssociationClass extends FigAssociation implements
-        AttributesCompartmentContainer, PathContainer,
-        OperationsCompartmentContainer {
+public class FigAssociationClass
+        extends FigAssociation implements PathContainer {
 
     private static final long serialVersionUID = 3643715304027095083L;
 
@@ -168,32 +180,6 @@
         return null;
     }
 
-    /**
-     * @return the bounds of the operations compartment for the associated
-     *         FigClassAssociationClass.
-     */
-    public Rectangle getAttributesBounds() {
-        if (getAssociationClass() != null) {
-            return getAssociationClass().getAttributesBounds();
-        } else {
-            return new Rectangle(0, 0, 0, 0);
-        }
-    }
-
-    public boolean isAttributesVisible() {
-        if (getAssociationClass() != null) {
-            return getAssociationClass().isAttributesVisible();
-        } else {
-            return true;
-        }
-    }
-
-    public void setAttributesVisible(boolean visible) {
-        if (getAssociationClass() != null) {
-            getAssociationClass().setAttributesVisible(visible);
-        }
-    }
-
     /*
      * Overridden in order to implement PathCompartmentContainer.
      */
@@ -230,12 +216,6 @@
         }
     }
 
-    public void setOperationsVisible(boolean visible) {
-        if (getAssociationClass() != null) {
-            getAssociationClass().setOperationsVisible(visible);
-        }
-    }
-
     /**
      * Set fill color of contained FigClassAssociationClass.
      *

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2435911

To unsubscribe from this discussion, e-mail: 
[[email protected]].

Reply via email to