svn commit: r16642 - trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2009-01-17 14:19:24-0800
New Revision: 16642

Modified:
   trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java

Log:
Issue 5636: Don't throw IllegalArgumentException when Fig is partially off screen 
http://argouml.tigris.org/issues/show_bug.cgi?id=5636

Modified: trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java?view=diff&pathrev=16642&r1=16641&r2=16642
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/ui/StylePanelFig.java	2009-01-17 14:19:24-0800
@@ -40,12 +40,12 @@
 import javax.swing.JTextField;
 import javax.swing.text.Document;
 
+import org.apache.log4j.Logger;
 import org.argouml.i18n.Translator;
 import org.argouml.swingext.SpacerPanel;
 import org.argouml.uml.diagram.DiagramSettings.StereotypeStyle;
 import org.argouml.uml.diagram.ui.ArgoFig;
 import org.argouml.uml.diagram.ui.FigEdgeModelElement;
-import org.argouml.uml.diagram.ui.FigNodeModelElement;
 import org.argouml.uml.diagram.ui.StereotypeStyled;
 import org.argouml.util.ArgoFrame;
 import org.tigris.gef.presentation.Fig;
@@ -64,6 +64,9 @@
     extends StylePanel
     implements ItemListener,
         FocusListener, KeyListener {
+    
+    private static final Logger LOG = Logger.getLogger(StylePanelFig.class);
+    
     private static final String CUSTOM_ITEM =
         Translator.localize("label.stylepane.custom") + "...";
 
@@ -391,11 +394,18 @@
                 res.height = 6000 - res.y;
                 changed = true;
             }
-            if (res.x < 0 || res.y < 0 || res.width < 0 || res.height < 0) {
+            if (res.x < 0 || res.y < 0) {
+                // TODO: This exception will be thrown during autoscrolling
+                // when the edge of the canvas is reached causing either
+                // the width or height to be "adjusted" to a negative value
+                LOG.warn("Part of bounding box is off screen " + res);
+            }
+            if (res.width < 0 || res.height < 0) {
                 // TODO: This exception will be thrown during autoscrolling
                 // when the edge of the canvas is reached causing either
                 // the width or height to be "adjusted" to a negative value
-                throw new IllegalArgumentException();
+                throw new IllegalArgumentException(
+                        "Bounding box has negative size " + res);
             }
             if (changed) {
                 StringBuffer sb = new StringBuffer();

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

To unsubscribe from this discussion, e-mail: [[email protected]].
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.