svn commit: r12894 - branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-06-22 14:57:41-0700
New Revision: 12894

Modified:
   branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java

Log:
Resizing BigPort when the Big Icon mode is activated

Modified: branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=12894&p1=branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=12893&r2=12894
==============================================================================
--- branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2007-06-22 14:57:41-0700
@@ -246,7 +246,6 @@
     private static final int ICON_WIDTH = 16;
     
     private FigText originalNameFig;
-    private Fig     originalBigPort;
     
     /**
      * EnclosedFigs are the Figs that are enclosed by this figure. Say that
@@ -1470,11 +1469,6 @@
 	    this.setNameFig(originalNameFig);
 	    originalNameFig = null;
 	}
-
-	if (originalBigPort != null) {
-	    this.setBigPort(originalBigPort);
-	    originalBigPort = null;
-	}
 	
 	if (!floatingStereotypes.isEmpty()) {
 	    for (Object icon : floatingStereotypes) {
@@ -1483,14 +1477,9 @@
 	    floatingStereotypes.clear();
 	}
 	
-	int practicalView = getStereotypeView();
+	int practicalView = getPracticalView();
 	Object modelElement = getOwner();
 	Collection stereos = Model.getFacade().getStereotypes(modelElement);
-
-	if (getStereotypeView() == STEREOTYPE_VIEW_BIG_ICON && 
-		(stereos == null || stereos.size() != 1)) {
-	    practicalView = STEREOTYPE_VIEW_TEXTUAL;
-	}	
 	 
 	Fig stereoFig = getStereotypeFig();
 	if (stereoFig instanceof FigStereotypesCompartment) {
@@ -1522,8 +1511,7 @@
 		    originalNameFig = this.getNameFig();
 		    this.setNameFig(stereotypeFigProfileIcon.getLabelFig());
 
-		    originalBigPort = this.getBigPort();
-		    this.setBigPort(stereotypeFigProfileIcon);
+		    getBigPort().setBounds(stereotypeFigProfileIcon.getBounds());
 		    
 		    for (Object fig : getFigs()) {
 			((Fig) fig).setVisible(fig == stereotypeFigProfileIcon);
@@ -1926,6 +1914,18 @@
         return stereotypeView;
     }
 
+    public int getPracticalView() {
+	int practicalView = getStereotypeView();
+	Object modelElement = getOwner();
+	Collection stereos = Model.getFacade().getStereotypes(modelElement);
+
+	if (getStereotypeView() == STEREOTYPE_VIEW_BIG_ICON && 
+		(stereos == null || stereos.size() != 1)) {
+	    practicalView = STEREOTYPE_VIEW_TEXTUAL;
+	}	
+	return practicalView;
+    }
+    
     public void setStereotypeView(int s) {
         this.stereotypeView = s;
         renderingChanged();
@@ -1937,7 +1937,7 @@
     protected final void setBoundsImpl(final int x, final int y, final int w,
 	    final int h) {
 
-	if (getStereotypeView() == STEREOTYPE_VIEW_BIG_ICON) {
+	if (getPracticalView() == STEREOTYPE_VIEW_BIG_ICON) {
 	    if (stereotypeFigProfileIcon != null) {
 		    stereotypeFigProfileIcon.setBounds(stereotypeFigProfileIcon
 			.getX(), stereotypeFigProfileIcon.getY(), w, h);
@@ -1947,11 +1947,11 @@
 	} else {
 	    setStandardBounds(x, y, w, h);
 	    if (getStereotypeView() == STEREOTYPE_VIEW_SMALL_ICON) {
-		int i = this.getWidth() + this.getX() - ICON_WIDTH - 2;
+		int i = w + x - ICON_WIDTH - 2;
 
 		for (Object ficon : this.floatingStereotypes) {
 		    ((FigImage) ficon).setLocation(i,
-			    this.getBigPort().getY() + 2);
+			    y + 2);
 		    i -= ICON_WIDTH - 2;
 		}
 	    }
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.