svn commit: r13439 - trunk/src_new/org/argouml: application application/events i18n kernel persistence ui uml/diagram/state/ui uml/diagram/static_structure/ui uml/diagram/ui uml/diagram/use_case/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-08-24 07:48:08-0700
New Revision: 13439

Added:
   trunk/src_new/org/argouml/ui/ArgoJFontChooser.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEvent.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEventListener.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/DiagramAppearance.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/FigNameWithAbstract.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/InitDiagramAppearanceUI.java   (contents, props changed)
   trunk/src_new/org/argouml/uml/diagram/ui/SettingsTabDiagramAppearance.java   (contents, props changed)
Modified:
   trunk/src_new/org/argouml/application/Main.java
   trunk/src_new/org/argouml/application/events/ArgoEventPump.java
   trunk/src_new/org/argouml/application/events/ArgoEventTypes.java
   trunk/src_new/org/argouml/i18n/dialog.properties
   trunk/src_new/org/argouml/i18n/label.properties
   trunk/src_new/org/argouml/i18n/tab.properties
   trunk/src_new/org/argouml/kernel/ProjectSettings.java
   trunk/src_new/org/argouml/persistence/ArgoParser.java
   trunk/src_new/org/argouml/persistence/ArgoTokenTable.java
   trunk/src_new/org/argouml/persistence/argo.tee
   trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java
   trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java
   trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java
   trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
   trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java
   trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
   trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
   trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java
   trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java
   trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java
   trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java
   trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java

Log:
Fix for issue 1288 and 1972: Allow persistent diagram element font type and size setting per project + system default.

Modified: trunk/src_new/org/argouml/application/Main.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/Main.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/application/Main.java&p2=trunk/src_new/org/argouml/application/Main.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/application/Main.java	(original)
+++ trunk/src_new/org/argouml/application/Main.java	2007-08-24 07:48:08-0700
@@ -82,6 +82,7 @@
 import org.argouml.uml.reveng.java.JavaImport;
 import org.argouml.util.logging.SimpleTimer;
 import org.tigris.gef.util.Util;
+import org.argouml.uml.diagram.ui.InitDiagramAppearanceUI;
 
 /**
  * This is the main class for two of the types 
@@ -271,6 +272,7 @@
         initSubsystem(new InitNotation());
         initSubsystem(new InitNotationUml());
         initSubsystem(new InitNotationJava());
+        initSubsystem(new InitDiagramAppearanceUI());
 
         if (reloadRecent && projectName == null) {
             // If no project was entered on the command line,

Modified: trunk/src_new/org/argouml/application/events/ArgoEventPump.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/events/ArgoEventPump.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/application/events/ArgoEventPump.java&p2=trunk/src_new/org/argouml/application/events/ArgoEventPump.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/application/events/ArgoEventPump.java	(original)
+++ trunk/src_new/org/argouml/application/events/ArgoEventPump.java	2007-08-24 07:48:08-0700
@@ -30,6 +30,8 @@
 
 import org.apache.log4j.Logger;
 import org.argouml.application.api.ArgoEventListener;
+import org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent;
+import org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEventListener;
 
 /**
  * ArgoEventPump is an eventhandler which handles events regarding
@@ -176,6 +178,25 @@
     }
 
     /**
+     * Handle firing a diagram appearance event.
+     *
+     * @param event The event to be fired.
+     * @param listener The listener.
+     */
+    private void handleFireDiagramAppearanceEvent(
+        ArgoDiagramAppearanceEvent event,
+        ArgoDiagramAppearanceEventListener listener) {
+        switch (event.getEventType()) {
+        case ArgoEventTypes.DIAGRAM_FONT_CHANGED :
+            listener.diagramFontChanged(event);
+            break;
+        default :
+            LOG.error("Invalid event:" + event.getEventType());
+            break;
+        }
+    }
+
+    /**
      * Handle firing a help text event.
      *
      * @param event The event to be fired.
@@ -285,6 +306,13 @@
 					(ArgoNotationEventListener) listener);
                 }
             }
+            if(event.getEventType() >= ArgoEventTypes.ANY_DIAGRAM_APPEARANCE_EVENT
+                    && event.getEventType() < ArgoEventTypes.LAST_DIAGRAM_APPEARANCE_EVENT) {
+                if(listener instanceof ArgoDiagramAppearanceEventListener) {
+                    handleFireDiagramAppearanceEvent((ArgoDiagramAppearanceEvent) event,
+                            (ArgoDiagramAppearanceEventListener) listener);
+                }
+            }
             if (event.getEventType() >= ArgoEventTypes.ANY_HELP_EVENT
                     && event.getEventType() < ArgoEventTypes.LAST_HELP_EVENT) {
                 if (listener instanceof ArgoHelpEventListener) {

Modified: trunk/src_new/org/argouml/application/events/ArgoEventTypes.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/events/ArgoEventTypes.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/application/events/ArgoEventTypes.java&p2=trunk/src_new/org/argouml/application/events/ArgoEventTypes.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/application/events/ArgoEventTypes.java	(original)
+++ trunk/src_new/org/argouml/application/events/ArgoEventTypes.java	2007-08-24 07:48:08-0700
@@ -187,6 +187,21 @@
     int LAST_STATUS_EVENT       =  1599;
 
     /**
+     * Indicating any diagram appearance event.
+     */
+    int ANY_DIAGRAM_APPEARANCE_EVENT = 1600;
+
+    /**
+     * Indicating that appearance is changed.
+     */
+    int DIAGRAM_FONT_CHANGED = 1601;
+
+    /**
+     * Last diagram appearance event.
+     */
+    int LAST_DIAGRAM_APPEARANCE_EVENT = 1699;
+
+    /**
      * Id marker for the last Argo event.
      */
     int ARGO_EVENT_END            = 99999;

Modified: trunk/src_new/org/argouml/i18n/dialog.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/dialog.properties?view=diff&rev=13439&p1=trunk/src_new/org/argouml/i18n/dialog.properties&p2=trunk/src_new/org/argouml/i18n/dialog.properties&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/i18n/dialog.properties	(original)
+++ trunk/src_new/org/argouml/i18n/dialog.properties	2007-08-24 07:48:08-0700
@@ -109,6 +109,7 @@
 dialog.find.tab.tagged-values = Tagged Values
 dialog.find.tabname = Find
 dialog.find.title = Find
+dialog.fontchooser = Choose font
 dialog.generation.chooser.approve-button-text = Choose
 dialog.generation.chooser.choose-output-dir = Choose Output Directory
 dialog.gotodiagram.title = Goto Diagram

Modified: trunk/src_new/org/argouml/i18n/label.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/label.properties?view=diff&rev=13439&p1=trunk/src_new/org/argouml/i18n/label.properties&p2=trunk/src_new/org/argouml/i18n/label.properties&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/i18n/label.properties	(original)
+++ trunk/src_new/org/argouml/i18n/label.properties	2007-08-24 07:48:08-0700
@@ -126,6 +126,11 @@
 label.deprecated = Deprecated:
 label.deprecated-p = <Deprecated>
 label.derived = Derived:
+label.diagramappearance.fontlist = Name
+label.diagramappearance.fontsize = Size
+label.diagramappearance.preview = The quick brown fox jumps over the lazy dog
+label.diagramappearance.diagramfont = Diagram font
+label.diagramappearance.changefont = Change font
 label.discriminator = Discriminator:
 label.display = Display:
 label.do-activity = Do Activity:

Modified: trunk/src_new/org/argouml/i18n/tab.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/tab.properties?view=diff&rev=13439&p1=trunk/src_new/org/argouml/i18n/tab.properties&p2=trunk/src_new/org/argouml/i18n/tab.properties&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/i18n/tab.properties	(original)
+++ trunk/src_new/org/argouml/i18n/tab.properties	2007-08-24 07:48:08-0700
@@ -32,6 +32,7 @@
 tab.constraints = Constraints
 tab.documentation = Documentation
 tab.environment = Environment
+tab.diagramappearance = Diagram Appearance
 tab.history = History
 tab.layout = Layout
 tab.notation = Notations

Modified: trunk/src_new/org/argouml/kernel/ProjectSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectSettings.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/kernel/ProjectSettings.java&p2=trunk/src_new/org/argouml/kernel/ProjectSettings.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectSettings.java	(original)
+++ trunk/src_new/org/argouml/kernel/ProjectSettings.java	2007-08-24 07:48:08-0700
@@ -24,6 +24,7 @@
 
 package org.argouml.kernel;
 
+import java.awt.Font;
 import java.beans.PropertyChangeEvent;
 
 import org.argouml.application.api.Argo;
@@ -35,6 +36,8 @@
 import org.argouml.notation.Notation;
 import org.argouml.notation.NotationName;
 import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.uml.diagram.ui.DiagramAppearance;
+import org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent;
 import org.tigris.gef.undo.Memento;
 import org.tigris.gef.undo.UndoManager;
 
@@ -66,6 +69,15 @@
     private boolean showSingularMultiplicities;
     private int defaultShadowWidth;
     
+    /* Diagram appearance settings with project scope: */
+    private String fontName;
+    private int fontSize;
+    /* Keep some fonts around depending on the above settings: */
+    private Font fontPlain;
+    private Font fontItalic;
+    private Font fontBold;
+    private Font fontBoldItalic;
+    
     /* Generation preferences: */
     private String headerComment =
         "Your copyright and other header comments";
@@ -115,6 +127,14 @@
         defaultShadowWidth = Configuration.getInteger(
                 Notation.KEY_DEFAULT_SHADOW_WIDTH, 1);
 
+        /*
+         * Diagram appearance settings:
+         */
+        fontName = DiagramAppearance.getInstance().getConfiguredFontName();
+        fontSize = Configuration.getInteger(DiagramAppearance.KEY_FONT_SIZE);
+        /* And initialise some fonts: */
+        initFonts();
+
         /* Generation preferences: */
         if (System.getProperty("file.separator").equals("/")) {
             generationOutputDir = "/tmp";
@@ -142,6 +162,8 @@
         setShowStereotypes(getShowStereotypesValue());
         setShowSingularMultiplicities(getShowSingularMultiplicitiesValue());
         setDefaultShadowWidth(getDefaultShadowWidthValue());
+        setFontName(getFontName());
+        setFontSize(getFontSize());
     }
 
     /**
@@ -174,13 +196,13 @@
             public void redo() {
                 notationLanguage = newLanguage;
                 NotationProviderFactory2.setCurrentLanguage(newLanguage);
-                fireEvent(key, oldLanguage, newLanguage);
+                fireNotationEvent(key, oldLanguage, newLanguage);
             }
 
             public void undo() {
                 notationLanguage = oldLanguage;
                 NotationProviderFactory2.setCurrentLanguage(oldLanguage);
-                fireEvent(key, newLanguage, oldLanguage);
+                fireNotationEvent(key, newLanguage, oldLanguage);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -231,12 +253,12 @@
 
             public void redo() {
                 showBoldNames = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showBoldNames = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -281,12 +303,12 @@
 
             public void redo() {
                 useGuillemots = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 useGuillemots = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -344,12 +366,12 @@
 
             public void redo() {
                 showVisibility = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showVisibility = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -393,12 +415,12 @@
 
             public void redo() {
                 showMultiplicity = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showMultiplicity = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -438,17 +460,17 @@
         if (showInitialValue == showem) return;
 
         Memento memento = new Memento() {
-            private final ConfigurationKey key = 
+            private final ConfigurationKey key =
                 Notation.KEY_SHOW_INITIAL_VALUE;
 
             public void redo() {
                 showInitialValue = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showInitialValue = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -488,17 +510,17 @@
         if (showProperties == showem) return;
 
         Memento memento = new Memento() {
-            private final ConfigurationKey key = 
+            private final ConfigurationKey key =
                 Notation.KEY_SHOW_PROPERTIES;
 
             public void redo() {
                 showProperties = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showProperties = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -542,12 +564,12 @@
 
             public void redo() {
                 showTypes = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showTypes = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -592,12 +614,12 @@
 
             public void redo() {
                 showStereotypes = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showStereotypes = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -637,17 +659,17 @@
         if (showSingularMultiplicities == showem) return;
 
         Memento memento = new Memento() {
-            private final ConfigurationKey key = 
+            private final ConfigurationKey key =
                 Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES;
 
             public void redo() {
                 showSingularMultiplicities = showem;
-                fireEvent(key, !showem, showem);
+                fireNotationEvent(key, !showem, showem);
             }
 
             public void undo() {
                 showSingularMultiplicities = !showem;
-                fireEvent(key, showem, !showem);
+                fireNotationEvent(key, showem, !showem);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -682,17 +704,17 @@
         final int oldValue = defaultShadowWidth;
 
         Memento memento = new Memento() {
-            private final ConfigurationKey key = 
+            private final ConfigurationKey key =
                 Notation.KEY_DEFAULT_SHADOW_WIDTH;
 
             public void redo() {
                 defaultShadowWidth = newWidth;
-                fireEvent(key, oldValue, newWidth);
+                fireNotationEvent(key, oldValue, newWidth);
             }
 
             public void undo() {
                 defaultShadowWidth = oldValue;
-                fireEvent(key, newWidth, oldValue);
+                fireNotationEvent(key, newWidth, oldValue);
             }
         };
         if (UndoManager.getInstance().isGenerateMementos()) {
@@ -744,8 +766,10 @@
      * @param oldValue the old value
      * @param newValue the new value
      */
-    private void fireEvent(ConfigurationKey key, int oldValue, int newValue) {
-        fireEvent(key, Integer.toString(oldValue), Integer.toString(newValue));
+    private void fireNotationEvent(
+            ConfigurationKey key, int oldValue, int newValue) {
+        fireNotationEvent(key, Integer.toString(oldValue), 
+                Integer.toString(newValue));
     }
 
     /**
@@ -755,11 +779,12 @@
      * @param oldValue the old value
      * @param newValue the new value
      */
-    private void fireEvent(ConfigurationKey key, boolean oldValue,
+    private void fireNotationEvent(ConfigurationKey key, boolean oldValue,
             boolean newValue) {
-        fireEvent(key, Boolean.toString(oldValue), Boolean.toString(newValue));
+        fireNotationEvent(key, Boolean.toString(oldValue), 
+                Boolean.toString(newValue));
     }
-    
+
     /**
      * Convenience methods to fire notation configuration change events.
      *
@@ -767,10 +792,171 @@
      * @param oldValue the old value
      * @param newValue the new value
      */
-    private void fireEvent(ConfigurationKey key, String oldValue,
+    private void fireNotationEvent(ConfigurationKey key, String oldValue,
             String newValue) {
         ArgoEventPump.fireEvent(new ArgoNotationEvent(
                 ArgoEventTypes.NOTATION_CHANGED, new PropertyChangeEvent(this,
                         key.getKey(), oldValue, newValue)));
     }
+
+    /**
+     * Convenience methods to fire diagram appearance 
+     * configuration change events.
+     *
+     * @param key the ConfigurationKey that is related to the change
+     * @param oldValue the old value
+     * @param newValue the new value
+     */
+    private void fireDiagramAppearanceEvent(ConfigurationKey key, int oldValue,
+            int newValue) {
+        fireDiagramAppearanceEvent(key, Integer.toString(oldValue), Integer
+                .toString(newValue));
+    }
+
+    /**
+     * Convenience methods to fire diagram appearance 
+     * configuration change events.
+     *
+     * @param key the ConfigurationKey that is related to the change
+     * @param oldValue the old value
+     * @param newValue the new value
+     */
+    private void fireDiagramAppearanceEvent(ConfigurationKey key,
+            boolean oldValue, boolean newValue) {
+        fireDiagramAppearanceEvent(key, Boolean.toString(oldValue), Boolean
+                .toString(newValue));
+    }
+
+    /**
+     * Convenience methods to fire diagram appearance 
+     * configuration change events.
+     *
+     * @param key the ConfigurationKey that is related to the change
+     * @param oldValue the old value
+     * @param newValue the new value
+     */
+    private void fireDiagramAppearanceEvent(ConfigurationKey key,
+            String oldValue, String newValue) {
+        ArgoEventPump.fireEvent(new ArgoDiagramAppearanceEvent(
+                ArgoEventTypes.DIAGRAM_FONT_CHANGED, new PropertyChangeEvent(
+                        this, key.getKey(), oldValue, newValue)));
+    }
+
+    /**
+     * Diagram font name. <p>
+     * 
+     * Used by "argo.tee".
+     * 
+     * @return diagram font name.
+     */
+    public String getFontName() {
+        return fontName;
+    }
+
+    /**
+     * Diagram font name.
+     * @param newFontName diagram font name.
+     */
+    public void setFontName(String newFontName) {
+        String old = fontName;
+        fontName = newFontName;
+        initFonts();
+
+        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_NAME, old,
+                this.fontName);
+    }
+
+    /**
+     * Diagram font size. <p>
+     * 
+     * Used by "argo.tee".
+     * 
+     * @return diagram font size.
+     */
+    public int getFontSize() {
+        return fontSize;
+    }
+
+    /**
+     * Diagram font size.
+     * @param newFontSize diagram font size.
+     */
+    public void setFontSize(int newFontSize) {
+        int old = fontSize;
+        fontSize = newFontSize;
+        initFonts();
+
+        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_SIZE, old,
+                this.fontSize);
+    }
+
+    private void initFonts() {
+        fontPlain = new Font(fontName, Font.PLAIN, fontSize);
+        fontItalic = new Font(fontName, Font.ITALIC, fontSize + 2);
+        fontBold = new Font(fontName, Font.BOLD, fontSize + 2);
+        fontBoldItalic = new Font(fontName, 
+                Font.BOLD | Font.ITALIC, fontSize + 2);
+    }
+
+    /**
+     * Returns the Plain diagram font which corresponds 
+     * to selected parameters.
+     * 
+     * @return plain diagram font
+     */
+    public Font getFontPlain() {
+        return fontPlain;
+    }
+
+    /**
+     * Returns the Italic diagram font which corresponds 
+     * to selected parameters.
+     * 
+     * @return italic diagram font
+     */
+    public Font getFontItalic() {
+        return fontItalic;
+    }
+
+    /**
+     * Returns the Bold diagram font which corresponds 
+     * to selected parameters.
+     * 
+     * @return bold diagram font
+     */
+    public Font getFontBold() {
+        return fontBold;
+    }
+
+    /**
+     * Returns the Bold-Italic diagram font which corresponds 
+     * to selected parameters.
+     * 
+     * @return bold-italic diagram font
+     */
+    public Font getFontBoldItalic() {
+        return fontBoldItalic;
+    }
+    
+    /**
+     * Utility function to convert a font style integer into a Font.
+     * 
+     * @param fontStyle the style; see the predefined constants in Font
+     * @return the Font that corresponds to the style
+     */
+    public Font getFont(int fontStyle) {
+        if ((fontStyle & Font.ITALIC) != 0) {
+            if ((fontStyle & Font.BOLD) != 0) {
+                return fontBoldItalic;
+            } else {
+                return fontItalic;
+            }
+        } else {
+            if ((fontStyle & Font.BOLD) != 0) {
+                return fontBold;
+            } else {
+                return fontPlain;
+            }
+        }
+    }
 }

Modified: trunk/src_new/org/argouml/persistence/ArgoParser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ArgoParser.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/persistence/ArgoParser.java&p2=trunk/src_new/org/argouml/persistence/ArgoParser.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/persistence/ArgoParser.java	(original)
+++ trunk/src_new/org/argouml/persistence/ArgoParser.java	2007-08-24 07:48:08-0700
@@ -226,6 +226,12 @@
         case ArgoTokenTable.TOKEN_DEFAULTSHADOWWIDTH:
             handleDefaultShadowWidth(e);
             break;
+        case ArgoTokenTable.TOKEN_FONTNAME:
+            handleFontName(e);
+            break;
+        case ArgoTokenTable.TOKEN_FONTSIZE:
+            handleFontSize(e);
+            break;
         case ArgoTokenTable.TOKEN_GENERATION_OUTPUT_DIR:
             handleGenerationOutputDir(e);
             break;
@@ -418,6 +424,26 @@
     /**
      * @param e the element
      */
+    protected void handleFontName(XMLElement e) {
+        String dsw = e.getText().trim();
+        ps.setFontName(dsw);
+    }
+
+    /**
+     * @param e the element
+     */
+    protected void handleFontSize(XMLElement e) {
+        String dsw = e.getText().trim();
+        try {
+            ps.setFontSize(Integer.parseInt(dsw));
+        } catch (NumberFormatException e1) {
+            LOG.error("NumberFormatException while parsing Font Size", e1);
+        }
+    }
+
+    /**
+     * @param e the element
+     */
     protected void handleGenerationOutputDir(XMLElement e) {
         String dsw = e.getText().trim();
         ps.setGenerationOutputDir(dsw);

Modified: trunk/src_new/org/argouml/persistence/ArgoTokenTable.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ArgoTokenTable.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/persistence/ArgoTokenTable.java&p2=trunk/src_new/org/argouml/persistence/ArgoTokenTable.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/persistence/ArgoTokenTable.java	(original)
+++ trunk/src_new/org/argouml/persistence/ArgoTokenTable.java	2007-08-24 07:48:08-0700
@@ -64,6 +64,8 @@
     private static final String STRING_SHOWSTEREOTYPES = "showstereotypes";
     private static final String STRING_DEFAULTSHADOWWIDTH 
         = "defaultshadowwidth";
+    private static final String STRING_FONTNAME = "fontname";
+    private static final String STRING_FONTSIZE = "fontsize";
     private static final String STRING_GENERATION_OUTPUT_DIR 
         = "generationoutputdir";
 
@@ -108,8 +110,12 @@
     public static final int    TOKEN_DEFAULTSHADOWWIDTH           = 19;
     /** A token for Notation Settings. */
     public static final int    TOKEN_SHOWBOLDNAMES           = 20;
+    /** A token for Font Settings. */
+    public static final int    TOKEN_FONTNAME           = 21;
+    /** A token for Font Settings. */
+    public static final int    TOKEN_FONTSIZE           = 22;
     /** A token for Generation Settings. */
-    public static final int    TOKEN_GENERATION_OUTPUT_DIR     = 21;
+    public static final int    TOKEN_GENERATION_OUTPUT_DIR     = 23;
 
     /** The token for undefined. */
     public static final int    TOKEN_UNDEFINED               = 99;
@@ -142,6 +148,8 @@
         addToken(STRING_SHOWSTEREOTYPES, new Integer(TOKEN_SHOWSTEREOTYPES));
         addToken(STRING_DEFAULTSHADOWWIDTH, 
                 new Integer(TOKEN_DEFAULTSHADOWWIDTH));
+        addToken(STRING_FONTNAME, new Integer(TOKEN_FONTNAME));
+        addToken(STRING_FONTSIZE, new Integer(TOKEN_FONTSIZE));
         addToken(STRING_GENERATION_OUTPUT_DIR, 
                 new Integer(TOKEN_GENERATION_OUTPUT_DIR));
     }

Modified: trunk/src_new/org/argouml/persistence/argo.tee
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/argo.tee?view=diff&rev=13439&p1=trunk/src_new/org/argouml/persistence/argo.tee&p2=trunk/src_new/org/argouml/persistence/argo.tee&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/persistence/argo.tee	(original)
+++ trunk/src_new/org/argouml/persistence/argo.tee	2007-08-24 07:48:08-0700
@@ -7,8 +7,8 @@
   <!ATTLIST template class CDATA #REQUIRED
                      guard CDATA #IMPLIED>
 ]>
-<!-- This is argo.tee, for ArgoUML to save project -->
-<!-- files.  "tee" = Template with Embedded Expressions. -->
+<!-- This is argo.tee, for ArgoUML to save project files.-->
+<!-- "tee" = Template with Embedded Expressions. -->
 
 <!-- Original Author: [email protected] -->
 <!-- $Id$ -->
@@ -41,6 +41,8 @@
     <showstereotypes><ocl>self.projectSettings.showStereotypes</ocl></showstereotypes>
     <showsingularmultiplicities><ocl>self.projectSettings.showSingularMultiplicities</ocl></showsingularmultiplicities>
     <defaultshadowwidth><ocl>self.projectSettings.defaultShadowWidth</ocl></defaultshadowwidth>
+    <fontname><ocl>self.projectSettings.fontName</ocl></fontname>
+    <fontsize><ocl>self.projectSettings.fontSize</ocl></fontsize>
     <generationoutputdir><ocl>self.projectSettings.generationOutputDir</ocl></generationoutputdir>
   </settings>
   

Added: trunk/src_new/org/argouml/ui/ArgoJFontChooser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/ArgoJFontChooser.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/ui/ArgoJFontChooser.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,353 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.ui;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.argouml.i18n.Translator;
+
+/**
+ * A font chooser dialog for selecting font family, size and style.
+ *
+ * @author Aleksandar
+ */
+public class ArgoJFontChooser extends JDialog {
+
+    private JPanel jContentPane = null;
+
+    private JList jlstFamilies = null;
+
+    private JList jlstSizes = null;
+
+//    private JCheckBox jchbBold = null;
+
+//    private JCheckBox jchbItalic = null;
+
+    private JLabel jlblFamilies = null;
+
+    private JLabel jlblSize = null;
+
+    private JLabel jlblPreview = null;
+
+    private JButton jbtnOk = null;
+
+    private JButton jbtnCancel = null;
+
+    private int resultSize;
+
+    private String resultName;
+
+    private boolean isOk = false;
+
+    /**
+     * @param owner the <code>Frame</code> from which the dialog is displayed
+     * @param parent determines the position of the chooser
+     * @param name the initial font name value
+     * @param size the initial font size value
+     */
+    public ArgoJFontChooser(Frame owner, JComponent parent, String name,
+            int size) {
+        super(owner, true);
+        setLocationRelativeTo(parent);
+
+        this.resultName = name;
+        this.resultSize = size;
+
+        initialize();
+    }
+
+    /**
+     * This method initializes this
+     */
+    private void initialize() {
+        this.setSize(299, 400);
+        this.setTitle(Translator.localize("dialog.fontchooser"));
+        this.setContentPane(getJContentPane());
+
+        updatePreview();
+    }
+
+    /**
+     * This method initializes jContentPane
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getJContentPane() {
+        if (jContentPane == null) {
+            GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
+            gridBagConstraints8.gridx = 4;
+            gridBagConstraints8.anchor = GridBagConstraints.NORTHEAST;
+            gridBagConstraints8.insets = new Insets(0, 0, 5, 5);
+            gridBagConstraints8.weightx = 0.0;
+            gridBagConstraints8.ipadx = 0;
+            gridBagConstraints8.gridy = 5;
+            GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
+            gridBagConstraints7.gridx = 3;
+            gridBagConstraints7.fill = GridBagConstraints.NONE;
+            gridBagConstraints7.weightx = 1.0;
+            gridBagConstraints7.anchor = GridBagConstraints.NORTHEAST;
+            gridBagConstraints7.insets = new Insets(0, 0, 5, 5);
+            gridBagConstraints7.weighty = 0.0;
+            gridBagConstraints7.gridwidth = 1;
+            gridBagConstraints7.ipadx = 0;
+            gridBagConstraints7.gridy = 5;
+            GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
+            gridBagConstraints6.gridx = 0;
+            gridBagConstraints6.gridwidth = 5;
+            gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
+            gridBagConstraints6.weightx = 1.0;
+            gridBagConstraints6.insets = new Insets(5, 5, 5, 5);
+            gridBagConstraints6.anchor = GridBagConstraints.NORTHWEST;
+            gridBagConstraints6.gridy = 4;
+            jlblPreview = new JLabel();
+            jlblPreview.setText(Translator
+                    .localize("label.diagramappearance.preview"));
+            jlblPreview.setPreferredSize(new Dimension(52, 50));
+            GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
+            gridBagConstraints5.gridx = 4;
+            gridBagConstraints5.anchor = GridBagConstraints.NORTHWEST;
+            gridBagConstraints5.insets = new Insets(5, 5, 0, 0);
+            gridBagConstraints5.gridy = 0;
+            jlblSize = new JLabel();
+            jlblSize.setText(Translator
+                    .localize("label.diagramappearance.fontsize"));
+            GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
+            gridBagConstraints4.gridx = 0;
+            gridBagConstraints4.anchor = GridBagConstraints.NORTHWEST;
+            gridBagConstraints4.insets = new Insets(5, 5, 0, 0);
+            gridBagConstraints4.gridy = 0;
+            jlblFamilies = new JLabel();
+            jlblFamilies.setText(Translator
+                    .localize("label.diagramappearance.fontlist"));
+//            GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
+//            gridBagConstraints3.gridx = 2;
+//            gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST;
+//            gridBagConstraints3.insets = new Insets(5, 5, 0, 0);
+//            gridBagConstraints3.gridy = 3;
+//            GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
+//            gridBagConstraints2.gridx = 0;
+//            gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST;
+//            gridBagConstraints2.insets = new Insets(5, 5, 0, 0);
+//            gridBagConstraints2.gridy = 3;
+            GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
+            gridBagConstraints1.fill = GridBagConstraints.BOTH;
+            gridBagConstraints1.gridy = 2;
+            gridBagConstraints1.weightx = 0.0;
+            gridBagConstraints1.weighty = 1.0;
+            gridBagConstraints1.insets = new Insets(5, 0, 0, 5);
+            gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
+            gridBagConstraints1.gridwidth = 2;
+            gridBagConstraints1.gridx = 4;
+            GridBagConstraints gridBagConstraints = new GridBagConstraints();
+            gridBagConstraints.fill = GridBagConstraints.BOTH;
+            gridBagConstraints.gridy = 2;
+            gridBagConstraints.weightx = 1.0;
+            gridBagConstraints.weighty = 1.0;
+            gridBagConstraints.insets = new Insets(5, 5, 0, 5);
+            gridBagConstraints.gridwidth = 4;
+            gridBagConstraints.gridheight = 1;
+            gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
+            gridBagConstraints.gridx = 0;
+            jContentPane = new JPanel();
+            jContentPane.setLayout(new GridBagLayout());
+
+            JScrollPane jscpFamilies = new JScrollPane();
+            jscpFamilies.setViewportView(getJlstFamilies());
+            JScrollPane jscpSizes = new JScrollPane();
+            jscpSizes.setViewportView(getJlstSizes());
+            jContentPane.add(jscpFamilies, gridBagConstraints);
+            jContentPane.add(jscpSizes, gridBagConstraints1);
+//            jContentPane.add(getJchbBold(), gridBagConstraints2);
+//            jContentPane.add(getJchbItalic(), gridBagConstraints3);
+            jContentPane.add(jlblFamilies, gridBagConstraints4);
+            jContentPane.add(jlblSize, gridBagConstraints5);
+            jContentPane.add(jlblPreview, gridBagConstraints6);
+            jContentPane.add(getJbtnOk(), gridBagConstraints7);
+            jContentPane.add(getJbtnCancel(), gridBagConstraints8);
+        }
+        return jContentPane;
+    }
+
+    /**
+     * This method initializes jlstFamilies
+     *
+     * @return javax.swing.JList
+     */
+    private JList getJlstFamilies() {
+        if (jlstFamilies == null) {
+            jlstFamilies = new JList();
+            jlstFamilies.setModel(new DefaultListModel());
+
+            String[] fontNames = GraphicsEnvironment
+                    .getLocalGraphicsEnvironment()
+                    .getAvailableFontFamilyNames();
+            for (String fontName : fontNames) {
+                ((DefaultListModel) jlstFamilies.getModel())
+                        .addElement(fontName);
+            }
+            jlstFamilies.setSelectedValue(resultName, true);
+
+            jlstFamilies.getSelectionModel().addListSelectionListener(
+                    new ListSelectionListener() {
+                        public void valueChanged(ListSelectionEvent e) {
+                            if (jlstFamilies.getSelectedValue() != null) {
+                                resultName = (String) jlstFamilies
+                                        .getSelectedValue();
+                                updatePreview();
+                            }
+                        }
+                    });
+        }
+        return jlstFamilies;
+    }
+
+    /**
+     * This method initializes jlstSizes
+     *
+     * @return javax.swing.JList
+     */
+    private JList getJlstSizes() {
+        if (jlstSizes == null) {
+            jlstSizes = new JList(new Integer[] {new Integer(8),
+                new Integer(9), new Integer(10), new Integer(11),
+                new Integer(12), new Integer(14), new Integer(16),
+                new Integer(18), new Integer(20), new Integer(22),
+                new Integer(24), new Integer(26), new Integer(28),
+                new Integer(36), new Integer(48), new Integer(72) });
+            jlstSizes.setSelectedValue(resultSize, true);
+
+            jlstSizes.getSelectionModel().addListSelectionListener(
+                    new ListSelectionListener() {
+                        public void valueChanged(ListSelectionEvent e) {
+                            if (jlstSizes.getSelectedValue() != null) {
+                                resultSize = (Integer) jlstSizes
+                                        .getSelectedValue();
+                                updatePreview();
+                            }
+                        }
+                    });
+        }
+        return jlstSizes;
+    }
+
+
+    /**
+     * Updates preview label.
+     */
+    private void updatePreview() {
+        int style = 0;
+
+        Font previewFont = new Font(resultName, style, resultSize);
+        jlblPreview.setFont(previewFont);
+    }
+
+    /**
+     * This method initializes jbtnOk
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getJbtnOk() {
+        if (jbtnOk == null) {
+            jbtnOk = new JButton();
+            jbtnOk.setText(Translator.localize("button.ok"));
+
+            jbtnOk.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    isOk = true;
+                    dispose();
+                    setVisible(false);
+                }
+            });
+        }
+        return jbtnOk;
+    }
+
+    /**
+     * This method initializes jbtnCancel
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getJbtnCancel() {
+        if (jbtnCancel == null) {
+            jbtnCancel = new JButton();
+            jbtnCancel.setText(Translator.localize("button.cancel"));
+
+            jbtnCancel.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    isOk = false;
+                    dispose();
+                    setVisible(false);
+                }
+            });
+        }
+        return jbtnCancel;
+    }
+
+    /**
+     * Returns true if dilaog result is OK.
+     *
+     * @return dialog result
+     */
+    public boolean isOk() {
+        return isOk;
+    }
+
+    /**
+     * Result.
+     *
+     * @return result
+     */
+    public String getResultName() {
+        return resultName;
+    }
+
+    /**
+     * Result.
+     *
+     * @return result
+     */
+    public int getResultSize() {
+        return resultSize;
+    }
+}

Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigState.java	2007-08-24 07:48:08-0700
@@ -25,6 +25,7 @@
 package org.argouml.uml.diagram.state.ui;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyVetoException;
 
@@ -83,7 +84,6 @@
                     getInitialY() + 2 + 21 + 4,
                     getInitialWidth() - 4,
                     getInitialHeight() - (getInitialY() + 2 + 21 + 4));
-        internal.setFont(getLabelFont());
         internal.setTextColor(Color.black);
         internal.setLineWidth(0);
         internal.setFilled(false);
@@ -228,4 +228,15 @@
         }
     }
 
+    /**
+     * 
+     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateFont()
+     */
+    @Override
+    protected void updateFont() {
+        super.updateFont();
+        Font f = getProject().getProjectSettings().getFont(Font.PLAIN);
+        internal.setFont(f);
+    }
+
 }

Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java	2007-08-24 07:48:08-0700
@@ -25,6 +25,7 @@
 package org.argouml.uml.diagram.state.ui;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Rectangle;
 import java.beans.PropertyChangeEvent;
 import java.util.Iterator;
@@ -88,7 +89,6 @@
                 Color.black);
 
         referenceFig = new FigText(0, 0, width, height, true);
-        referenceFig.setFont(getLabelFont());
         referenceFig.setTextColor(Color.black);
         referenceFig.setReturnAction(FigText.END_EDITING);
         referenceFig.setTabAction(FigText.END_EDITING);
@@ -432,4 +432,15 @@
         }
         updateListeners(getOwner(), newOwner);
     }
+
+    /**
+     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateFont()
+     */
+    @Override
+    protected void updateFont() {
+        super.updateFont();
+        Font f = getProject().getProjectSettings().getFont(Font.PLAIN);
+        referenceFig.setFont(f);
+    }
+
 } /* end class FigStubState */

Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigSynchState.java	2007-08-24 07:48:08-0700
@@ -25,6 +25,7 @@
 package org.argouml.uml.diagram.state.ui;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
 import java.util.Iterator;
@@ -36,7 +37,9 @@
 import org.tigris.gef.presentation.FigText;
 
 /**
- * Class to display graphics for a UML MSynchState in a diagram.
+ * Class to display graphics for a UML SynchState in a diagram. <p>
+ * 
+ * TODO: If the font increases, the circle should grow, too.
  *
  * @author [email protected]
  */
@@ -72,7 +75,6 @@
         bound = new FigText(X - 2, Y + 2, 0, 0, true);
         bound.setFilled(false);
         bound.setLineWidth(0);
-        bound.setFont(getLabelFont());
         bound.setTextColor(Color.black);
         bound.setReturnAction(FigText.END_EDITING);
         bound.setTabAction(FigText.END_EDITING);
@@ -210,7 +212,13 @@
     }
 
     /**
-     * The UID.
+     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateFont()
      */
-    private static final long serialVersionUID = -7025279430656399031L;
+    @Override
+    protected void updateFont() {
+        super.updateFont();
+        Font f = getProject().getProjectSettings().getFont(Font.PLAIN);
+        bound.setFont(f);
+    }
+
 } /* end class FigSynchState */

Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClassifierBox.java	2007-08-24 07:48:08-0700
@@ -26,6 +26,7 @@
 
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.Font;
 import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
@@ -138,33 +139,11 @@
         damage();
     }
     
-    /**
-     * Updates the name if modelchanged receives an "isAbstract" event.
-     * 
-     * TODO:  This really belongs in (the non-existent) FigGeneralizableElement.
-     */
-    protected void updateAbstract() {
-        Rectangle rect = getBounds();
-        if (getOwner() == null) {
-            return;
-        }
-        Object cls = getOwner();
-        if (Model.getFacade().isAbstract(cls)) {
-            getNameFig().setFont(getItalicLabelFont());
-        } else {
-            getNameFig().setFont(getLabelFont());
-        }
-        super.updateNameText();
-        setBounds(rect.x, rect.y, rect.width, rect.height);
-    }
-
-
     /*
      * @see org.argouml.uml.diagram.ui.FigNodeModelElement#renderingChanged()
      */
     public void renderingChanged() {
         updateOperations();
-        updateAbstract();
         super.renderingChanged();
     }
 
@@ -180,9 +159,6 @@
                 // of text which represents the element here, but I'm not sure
                 // how to do that, so redraw the whole compartment. - tfm
                 updateOperations();
-            } else if (source.equals(getOwner()) 
-                    && "isAbstract".equals(mee.getPropertyName())) {
-                updateAbstract();
             }
         } else if (mee instanceof AssociationChangeEvent 
                 && getOwner().equals(mee.getSource())) {

Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInstance.java	2007-08-24 07:48:08-0700
@@ -50,12 +50,6 @@
 
     private FigText attr;
 
-    // add other Figs here aes needed
-
-
-    ////////////////////////////////////////////////////////////////
-    // constructors
-
     /**
      * Constructor
      */
@@ -66,7 +60,6 @@
 
 	// initialize any other Figs here
 	attr = new FigText(10, 30, 90, 40, Color.black, "Times", 10);
-	attr.setFont(getLabelFont());
 	attr.setExpandOnly(true);
 	attr.setTextColor(Color.black);
 	attr.setTabAction(FigText.END_EDITING);

Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigOperation.java	2007-08-24 07:48:08-0700
@@ -24,11 +24,11 @@
 
 package org.argouml.uml.diagram.static_structure.ui;
 
+import java.awt.Font;
 import java.beans.PropertyChangeEvent;
 
 import org.argouml.model.Model;
 import org.argouml.notation.NotationProvider;
-import org.argouml.uml.diagram.ui.FigNodeModelElement;
 import org.tigris.gef.presentation.Fig;
 
 /**
@@ -52,7 +52,7 @@
         super.setOwner(owner);
 
         if (owner != null) {
-            updateAbstract(Model.getFacade().isAbstract(getOwner()));
+            diagramFontChanged(null);
             Model.getPump().addModelEventListener(this, owner, "isAbstract");
         }
     }
@@ -72,22 +72,17 @@
     public void propertyChange(PropertyChangeEvent pce) {
         super.propertyChange(pce);
         if ("isAbstract".equals(pce.getPropertyName())) {
-            if (pce.getNewValue() instanceof Boolean)
-                updateAbstract(
-                        ((Boolean) pce.getNewValue()).booleanValue());    
+            diagramFontChanged(null);    
         }
     }
 
     /**
      * If the Operation is abstract, then the text will be set to italics.
-     * 
-     * @param isAbstract true will cause italic text
      */
-    protected void updateAbstract(boolean isAbstract) {
-        if (isAbstract) {
-            setFont(FigNodeModelElement.getItalicLabelFont());
-        } else {
-            setFont(FigNodeModelElement.getLabelFont());
-        }
+    @Override
+    protected int getFigFontStyle() {
+        return Model.getFacade().isAbstract(getOwner()) 
+            ? Font.ITALIC : Font.PLAIN;
     }
+
 }

Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java	2007-08-24 07:48:08-0700
@@ -251,17 +251,6 @@
         return fc;
     }
 
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#renderingChanged()
-     */
-    public void renderingChanged() {
-        if (getOwner() != null) {
-            // TODO: Update Tags and Constraints
-            updateAbstract();
-        }
-        super.renderingChanged();
-    }
-
     /**
      * Handles changes to the model. Takes into account the event that
      * occurred. If you need to update the whole fig, consider using
@@ -299,24 +288,4 @@
             /* TODO: constraints, ... */
         }
     }
-    
-    /**
-     * Updates the name if modelchanged receives an "isAbstract" event.
-     * TODO: method has been copied from FigClass. We need something common to
-     * FigGeneralizableElement or a decorator. (mk)
-     */
-    protected void updateAbstract() {
-        Rectangle rect = getBounds();
-        if (getOwner() == null) {
-            return;
-        }
-        Object cls =  getOwner();
-        if (Model.getFacade().isAbstract(cls)) {
-            getNameFig().setFont(getItalicLabelFont());
-        } else {
-            getNameFig().setFont(getLabelFont());
-        }
-        super.updateNameText();
-        setBounds(rect.x, rect.y, rect.width, rect.height);
-    }
 } /* end class FigClass */

Added: trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEvent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEvent.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEvent.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,52 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.diagram.ui;
+
+import org.argouml.application.events.ArgoEvent;
+
+/**
+ * ArgoDiagramAppearanceEvent is used to notify interested parties that the
+ * module which is the event source has been changed.
+ * @author Aleksandar
+ */
+public class ArgoDiagramAppearanceEvent extends ArgoEvent {
+
+    /**
+     * @param eventType reported by this event.
+     * @param src object that caused the event.
+     */
+    public ArgoDiagramAppearanceEvent(int eventType, Object src) {
+        super(eventType, src);
+    }
+
+    /**
+     * Indicates the start of the 100-digit range for diagram appearance events.
+     *
+     * @return the first id reserved for events.
+     */
+    public int getEventStartRange() {
+        return ANY_DIAGRAM_APPEARANCE_EVENT;
+    }
+}

Added: trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEventListener.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEventListener.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ArgoDiagramAppearanceEventListener.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,43 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.diagram.ui;
+import org.argouml.application.api.ArgoEventListener;
+
+/** 
+ * An interface that objects interested in ArgoDiagramAppearanceEvent
+ *  notifications must extend.
+ *
+ *  @author Aleksandar
+ */
+
+public interface ArgoDiagramAppearanceEventListener extends ArgoEventListener {
+
+    /**
+     * Invoked when any aspect of the notation has been changed.
+     * @param e <code>ArgoNotationEvent</code> describing the change.
+     */
+    public void diagramFontChanged(ArgoDiagramAppearanceEvent e);
+}
+

Modified: trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java	2007-08-24 07:48:08-0700
@@ -24,6 +24,9 @@
 
 package org.argouml.uml.diagram.ui;
 
+import java.awt.Font;
+import java.beans.PropertyChangeEvent;
+
 import javax.management.ListenerNotFoundException;
 import javax.management.MBeanNotificationInfo;
 import javax.management.Notification;
@@ -34,6 +37,7 @@
 
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
 import org.argouml.uml.diagram.UMLMutableGraphSupport;
 import org.tigris.gef.base.Editor;
 import org.tigris.gef.base.Globals;
@@ -135,9 +139,76 @@
                 layer = (LayerPerspective) lay;
             }
         }
+        if (layer == null) {
+            return null;
+        }
         UMLMutableGraphSupport gm = 
             (UMLMutableGraphSupport) layer.getGraphModel();
         return gm.getProject();
     }
 
+    /**
+     * Handles diagram font changing.
+     * @param e the event
+     * @see org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEventListener#diagramFontChanged(org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent)
+     */
+    public void diagramFontChanged(ArgoDiagramAppearanceEvent e) {
+        updateFont();
+        setBounds(getBounds());
+        damage();
+    }
+
+    /**
+     * This function should, for all FigTexts, 
+     * recalculate the font-style (plain, bold, italic, bold/italic),
+     * and apply it by calling FigText.setFont().
+     */
+    protected void updateFont() {
+        int style = getFigFontStyle();
+        Project p = getProject();
+        if (p != null) {
+            Font f = getProject().getProjectSettings().getFont(style);
+            setFont(f);
+        }
+    }
+
+    /**
+     * Determines the font style based on the UML model. 
+     * Overrule this in Figs that have to show bold or italic based on the 
+     * UML model they represent. 
+     * E.g. abstract classes show their name in italic.
+     * 
+     * @return the font style for the nameFig.
+     */
+    protected int getFigFontStyle() {
+        return Font.PLAIN;
+    }
+
+    @Override
+    public void setOwner(Object own) {
+        super.setOwner(own);
+        updateListeners(null, own);
+    }
+    
+    protected void updateListeners(Object oldOwner, Object newOwner) {
+        if (oldOwner == newOwner) {
+            return;
+        }
+        if (oldOwner != null) {
+            Model.getPump().removeModelEventListener(this, oldOwner);
+        }
+        if (newOwner != null) {
+            Model.getPump().addModelEventListener(this, newOwner, "remove");
+        }
+    }
+
+    @Override
+    public void propertyChange(PropertyChangeEvent pce) {
+        super.propertyChange(pce);
+        if ("remove".equals(pce.getPropertyName()) 
+                && (pce.getSource() == getOwner())) {
+            deleteFromModel();
+        }
+    }
+
 }

Modified: trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/CompartmentFigText.java	2007-08-24 07:48:08-0700
@@ -29,6 +29,7 @@
 import org.apache.log4j.Logger;
 import org.argouml.notation.NotationProvider;
 import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigGroup;
 import org.tigris.gef.presentation.FigText;
 
 /**
@@ -182,6 +183,19 @@
     }
 
     /**
+     * @see org.argouml.uml.diagram.ui.FigSingleLineText#removeFromDiagram()
+     */
+    @Override
+    public void removeFromDiagram() {
+        super.removeFromDiagram();
+        Fig fg = getGroup();
+        if (fg instanceof FigGroup) {
+            ((FigGroup) fg).removeFig(this);
+            setGroup(null);
+        }
+    }
+
+    /**
      * Override for correct graphical behaviour.<p>
      *
      * @return  Current fill status&mdash;always <code>true</code>.

Added: trunk/src_new/org/argouml/uml/diagram/ui/DiagramAppearance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/DiagramAppearance.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/DiagramAppearance.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,115 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+package org.argouml.uml.diagram.ui;
+
+import java.awt.Font;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.apache.log4j.Logger;
+import org.argouml.configuration.Configuration;
+import org.argouml.configuration.ConfigurationKey;
+import org.argouml.ui.LookAndFeelMgr;
+
+/**
+ * Provides centralized methods dealing with diagram appearance.
+ *
+ * @stereotype singleton
+ * @author Aleksandar
+ */
+public final class DiagramAppearance implements PropertyChangeListener {
+
+    /**
+     * Define a static log4j category variable for ArgoUML diagram appearance.
+     */
+    private static final Logger LOG = Logger.getLogger(DiagramAppearance.class);
+
+    /**
+     * The configuration key for the font name.
+     */
+    public static final ConfigurationKey KEY_FONT_NAME = Configuration.makeKey(
+            "diagramappearance", "fontname");
+
+    /**
+     * The configuration key for the font size.
+     */
+    public static final ConfigurationKey KEY_FONT_SIZE = Configuration.makeKey(
+            "diagramappearance", "fontsize");
+
+    /**
+     * The instance.
+     */
+    private static final DiagramAppearance SINGLETON = new DiagramAppearance();
+
+    /**
+     * The constructor.
+     */
+    private DiagramAppearance() {
+        Configuration.addListener(DiagramAppearance.KEY_FONT_NAME, this);
+        Configuration.addListener(DiagramAppearance.KEY_FONT_SIZE, this);
+//        Configuration.addListener(DiagramAppearance.KEY_FONT_BOLD, this);
+//        Configuration.addListener(DiagramAppearance.KEY_FONT_ITALLIC, this);
+    }
+
+    /**
+     * @return the singleton
+     */
+    public static DiagramAppearance getInstance() {
+        return SINGLETON;
+    }
+
+    /*
+     * Called after the notation default property gets changed.
+     *
+     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+     */
+    public void propertyChange(PropertyChangeEvent pce) {
+        LOG.info("Diagram appearance change:" + pce.getOldValue() + " to "
+                + pce.getNewValue());
+    }
+
+    /**
+     * Gets font name. If it doesn't exist in configuration it creates new
+     * entries in configuration for appearance.
+     * 
+     * TODO: Why create in a getter?
+     *
+     * @return the name of the configured font
+     */
+    public String getConfiguredFontName() {
+        String fontName = Configuration
+                .getString(DiagramAppearance.KEY_FONT_NAME);
+        if (fontName.equals("")) {
+            Font f = LookAndFeelMgr.getInstance().getStandardFont();
+            fontName = f.getName();
+
+            Configuration.setString(DiagramAppearance.KEY_FONT_NAME, f
+                    .getName());
+            Configuration.setInteger(DiagramAppearance.KEY_FONT_SIZE, f
+                    .getSize());
+        }
+
+        return fontName;
+    }
+}

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java	2007-08-24 07:48:08-0700
@@ -24,6 +24,7 @@
 
 package org.argouml.uml.diagram.ui;
 
+import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Rectangle;
@@ -242,38 +243,6 @@
         }
     }
 
-    /*
-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#modelChanged(java.beans.PropertyChangeEvent)
-     */
-    @Override
-    protected void modelChanged(PropertyChangeEvent e) {
-        if (getOwner() == null || getLayer() == null) {
-            return;
-        }
-        super.modelChanged(e);
-        if (e instanceof AttributeChangeEvent) {
-            if (e.getPropertyName().equals("isAbstract")/*
-                    || e.getPropertyName().equals("name")*/) {
-                updateAbstract();
-            }
-        }
-    }
-
-    /*
-     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#renderingChanged()
-     */
-    @Override
-    protected void renderingChanged() {
-        // We don't want to redraw everything everytime 
-        // one things changes - Bob.
-        // So, do not call this unless really needed! We need 
-        // this for e.g. when the Notation Language changes,
-        // and this is called by setOwner() - Michiel.
-        updateAbstract();
-        updateMultiplicity();
-        super.renderingChanged();
-    }
-
     /**
      * Choose the arrowhead style for each end. <p>
      * 
@@ -422,27 +391,6 @@
         }
     }
 
-    /**
-     * Updates the name if modelchanged receives an "isAbstract" event.
-     */
-    protected void updateAbstract() {
-        if (getNameFig() == null) {
-            return;
-        }
-        Rectangle rect = getBounds();
-        if (getOwner() == null) {
-            return;
-        }
-        Object assoc =  getOwner();
-        if (Model.getFacade().isAbstract(assoc)) {
-            getNameFig().setFont(getItalicLabelFont());
-        } else {
-            getNameFig().setFont(getLabelFont());
-        }
-        super.updateNameText();
-        setBounds(rect.x, rect.y, rect.width, rect.height);
-    }
-
     /*
      * @see org.tigris.gef.presentation.Fig#paint(java.awt.Graphics)
      */
@@ -575,7 +523,12 @@
 /**
  * A textual Fig representing the ordering of some model element,
  * i.e. "{ordered}" or "{sorted}".
- * This has potential reuse for other edges showing ordering.
+ * This has potential reuse for other edges showing ordering. <p>
+ * 
+ * This Fig is not editable by the user. <p>
+ * 
+ * TODO: How can the user make it "sorted"?
+ * 
  * @author Bob Tarling
  */
 class FigOrdering extends FigSingleLineText {
@@ -586,6 +539,7 @@
         super(10, 10, 90, 20, false, "ordering");
         setTextFilled(false);
         setJustification(FigText.JUSTIFY_CENTER);
+        setEditable(false);
     }
 
     @Override
@@ -689,8 +643,10 @@
     @Override
     public void propertyChange(PropertyChangeEvent pce) {
         notationProviderRole.updateListener(this, getOwner(), pce);
-        setText();
-        damage();
+        if (!"remove".equals(pce.getPropertyName())) {
+            setText();
+            damage();
+        }
         super.propertyChange(pce);  // do we need this?
     }
 

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigAssociationEnd.java	2007-08-24 07:48:08-0700
@@ -78,7 +78,6 @@
         super();
 
         srcMult = new FigText(10, 10, 90, 20);
-        srcMult.setFont(getLabelFont());
         srcMult.setTextColor(Color.black);
         srcMult.setTextFilled(false);
         srcMult.setFilled(false);
@@ -87,7 +86,6 @@
         srcMult.setJustification(FigText.JUSTIFY_CENTER);
 
         srcOrdering = new FigText(10, 10, 90, 20);
-        srcOrdering.setFont(getLabelFont());
         srcOrdering.setTextColor(Color.black);
         srcOrdering.setTextFilled(false);
         srcOrdering.setFilled(false);

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java	2007-08-24 07:48:08-0700
@@ -80,6 +80,7 @@
 import org.argouml.ui.ProjectActions;
 import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.StereotypeUtility;
+import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.IItemUID;
 import org.argouml.uml.diagram.UMLMutableGraphSupport;
 import org.argouml.uml.ui.ActionDeleteModelElements;
@@ -90,7 +91,9 @@
 import org.tigris.gef.base.PathConvPercent;
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigEdgePoly;
+import org.tigris.gef.presentation.FigGroup;
 import org.tigris.gef.presentation.FigNode;
 import org.tigris.gef.presentation.FigPoly;
 import org.tigris.gef.presentation.FigText;
@@ -110,6 +113,7 @@
         KeyListener,
         PropertyChangeListener,
         ArgoNotationEventListener,
+        ArgoDiagramAppearanceEventListener,
         Highlightable,
         IItemUID,
         ArgoFig {
@@ -125,24 +129,6 @@
      */
     private boolean removeFromDiagram = true;
 
-    ////////////////////////////////////////////////////////////////
-    // constants
-
-    private static final Font LABEL_FONT;
-    private static final Font ITALIC_LABEL_FONT;
-
-    static {
-        LABEL_FONT =
-        /* TODO: Why is this different from the FigNodeModelElement?
-         * Should we not use one of the following? 
-         * LookAndFeelMgr.getInstance().getStandardFont();
-         * new javax.swing.plaf.metal.DefaultMetalTheme().getSubTextFont();
-         * new javax.swing.plaf.metal.DefaultMetalTheme().getUserTextFont(); */
-            new Font("Dialog", Font.PLAIN, 10);
-        ITALIC_LABEL_FONT =
-            new Font(LABEL_FONT.getFamily(), Font.ITALIC, LABEL_FONT.getSize());
-    }
-
     /**
      * Offset from the end of the set of popup actions at which new items
      * should be inserted by concrete figures.
@@ -185,7 +171,7 @@
      */
     public FigEdgeModelElement() {
 
-        nameFig = new FigSingleLineText(10, 30, 90, 20, false);
+        nameFig = new FigNameWithAbstract(10, 30, 90, 20, false);
         nameFig.setTextFilled(false);
 
         stereotypeFig = new FigStereotypesCompartment(10, 10, 90, 15);
@@ -193,6 +179,8 @@
         setBetweenNearestPoints(true);
 
         ArgoEventPump.addListener(ArgoEventTypes.ANY_NOTATION_EVENT, this);
+        ArgoEventPump.addListener(
+                ArgoEventTypes.ANY_DIAGRAM_APPEARANCE_EVENT, this);
     }
 
     /**
@@ -828,6 +816,10 @@
             String nameStr = notationProviderName.toString(
                     getOwner(), npArguments);
             nameFig.setText(nameStr);
+            Project p = getProject();
+            if (p != null) {
+                updateFont();
+            }
             calcBounds();
             setBounds(getBounds());
         }
@@ -878,6 +870,7 @@
                     + owner.getClass().getName());
         }
         super.setOwner(owner);
+        nameFig.setOwner(owner); // for setting abstract
         if (edgePort != null) {
             edgePort.setOwner(getOwner());
         }
@@ -1252,17 +1245,19 @@
     }
 
     /**
-     * @return Returns the LABEL_FONT.
+     * @deprecated
+     * @return Returns the plain font.
      */
-    public static Font getLabelFont() {
-        return LABEL_FONT;
+    public Font getLabelFont() {
+        return getProject().getProjectSettings().getFontPlain();
     }
 
     /**
-     * @return Returns the ITALIC_LABEL_FONT.
+     * @deprecated
+     * @return Returns the italic font.
      */
-    public static Font getItalicLabelFont() {
-        return ITALIC_LABEL_FONT;
+    public Font getItalicLabelFont() {
+        return getProject().getProjectSettings().getFontItalic();
     }
 
     /**
@@ -1405,4 +1400,73 @@
         return gm.getProject();
     }
     
+    /**
+     * Handles diagram font changing.
+     * @param e the event
+     * @see org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEventListener#diagramFontChanged(org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent)
+     */
+    public void diagramFontChanged(ArgoDiagramAppearanceEvent e) {
+        updateFont();
+        calcBounds(); //TODO: Does this help?
+        redraw();
+    }
+    
+    /**
+     * This function should, for all FigTexts, 
+     * recalculate the font-style (plain, bold, italic, bold/italic),
+     * and apply it by calling FigText.setFont().
+     */
+    protected void updateFont() {
+        Project p = getProject();
+        if (p == null) {
+            return;
+        }
+        int style = getNameFigFontStyle();
+        Font f = p.getProjectSettings().getFont(style);
+        nameFig.setFont(f);
+        deepUpdateFont(this);
+    }
+
+    /**
+     * Determines the font style based on the UML model. 
+     * Overrule this in Figs that have to show bold or italic based on the 
+     * UML model they represent. 
+     * E.g. abstract classes show their name in italic.
+     * 
+     * @return the font style for the nameFig.
+     */
+    protected int getNameFigFontStyle() {
+        return Font.PLAIN;
+    }
+
+    private void deepUpdateFont(FigEdge fe) {
+        Font f = getProject().getProjectSettings().getFont(Font.PLAIN);
+        for (Object pathFig : fe.getPathItemFigs()) {
+            deepUpdateFontRecursive(f, pathFig);
+        }
+        fe.calcBounds();
+    }
+
+    /**
+     * Changes the font for all Figs contained in the given FigGroup. <p>
+     * 
+     *  TODO: In fact, there is a design error in this method:
+     *  E.g. for a class, if the name is Italic since the class is abstract,
+     *  then the classes features should be in Plain font.
+     *  This problem can be fixed by implementing 
+     *  the updateFont() method in all subclasses.
+     *  
+     * @param fg the FigGroup to change the font of.
+     */
+    private void deepUpdateFontRecursive(Font f, Object pathFig) {
+        if (pathFig instanceof ArgoFigText) {
+            ((ArgoFigText) pathFig).updateFont();
+        } else if (pathFig instanceof FigText) {
+            ((FigText) pathFig).setFont(f);
+        } else if (pathFig instanceof FigGroup) {
+            for (Object fge : ((FigGroup) pathFig).getFigs()) {
+                deepUpdateFontRecursive(f, fge);
+            }
+        }
+    }
 }

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigGeneralization.java	2007-08-24 07:48:08-0700
@@ -25,9 +25,11 @@
 package org.argouml.uml.diagram.ui;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Graphics;
 import java.beans.PropertyChangeEvent;
 
+import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.AttributeChangeEvent;
 import org.argouml.model.Model;
@@ -62,7 +64,6 @@
     public FigGeneralization() {
         // UML spec for Generalizations doesn't call for name or stereotype
 
-	discriminator.setFont(getLabelFont());
 	discriminator.setFilled(false);
 	discriminator.setLineWidth(0);
 	discriminator.setReturnAction(FigText.END_EDITING);
@@ -140,6 +141,11 @@
   	if (disc == null) {
 	    disc = "";
   	}
+        Project p = getProject();
+        if (p != null) {
+            Font f = getProject().getProjectSettings().getFont(Font.PLAIN);
+            discriminator.setFont(f);
+        }
   	discriminator.setText(disc);
     }
 

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigMultiLineText.java	2007-08-24 07:48:08-0700
@@ -49,7 +49,7 @@
      */
     public FigMultiLineText(int x, int y, int w, int h, boolean expandOnly) {
         super(x, y, w, h, expandOnly);
-        setFont(FigNodeModelElement.getLabelFont());
+        setFont(getProject().getProjectSettings().getFontPlain());
         setTextColor(Color.black);
         setReturnAction(FigText.INSERT);
         setLineSeparator("\n");

Added: trunk/src_new/org/argouml/uml/diagram/ui/FigNameWithAbstract.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNameWithAbstract.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNameWithAbstract.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,54 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.diagram.ui;
+
+import java.awt.Font;
+
+import org.argouml.model.Model;
+
+/**
+ * A FigSingleLineText that represents the name of a modelelement,
+ * which handles italic font if the element is abstract. <p>
+ * 
+ * For this to work, the owner of this FigText needs to be set!
+ *
+ * @author Michiel
+ */
+class FigNameWithAbstract extends FigSingleLineText {
+
+    public FigNameWithAbstract(int x, int y, int w, int h, boolean expandOnly) {
+        super(x, y, w, h, expandOnly);
+    }
+
+    @Override
+    protected int getFigFontStyle() {
+        int style = 0;
+        if (getOwner() != null) {
+            style = Model.getFacade().isAbstract(getOwner()) 
+                ? Font.ITALIC : Font.PLAIN;
+        }
+        return super.getFigFontStyle() | style;
+    }
+}
\ No newline at end of file

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java	2007-08-24 07:48:08-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2005-2006 The Regents of the University of California. All
+// Copyright (c) 2005-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -25,6 +25,7 @@
 package org.argouml.uml.diagram.ui;
 
 import java.awt.Color;
+import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.beans.PropertyChangeEvent;
 import java.util.Iterator;
@@ -76,15 +77,11 @@
         setEditable(false);
         setBigPort(new FigDiamond(0, 0, 70, 70, Color.cyan, Color.cyan));
         head = new FigDiamond(0, 0, 70, 70, Color.black, Color.white);
-        // Add the following to allow name editing on the diagram
-        setNameFig(new FigText(X + 10, Y + 22, 0, 21, true));
+
         getNameFig().setFilled(false);
         getNameFig().setLineWidth(0);
-        getNameFig().setFont(getLabelFont());
-        getNameFig().setTextColor(Color.black);
-        getNameFig().setReturnAction(FigText.END_EDITING);
-        getNameFig().setTabAction(FigText.END_EDITING);
-        getNameFig().setJustificationByName("center");
+//      The following does not seem to work - centered the Fig instead.
+//        getNameFig().setJustificationByName("center");
 
         getStereotypeFig().setBounds(X + 10, Y + 22, 0, 21);
         getStereotypeFig().setFilled(false);
@@ -133,10 +130,6 @@
      */
     protected void modelChanged(PropertyChangeEvent mee) {
         super.modelChanged(mee);
-        if (mee == null || "isAbstract".equals(mee.getPropertyName())) {
-            updateAbstract();
-            damage();
-        }
         if ("connection".equals(mee.getPropertyName())) {
             if (mee instanceof RemoveAssociationEvent) {
                 Object association =
@@ -182,24 +175,6 @@
         });
     }
     
-    /**
-     * Updates the name if modelchanged receives an "isAbstract" event.
-     */
-    protected void updateAbstract() {
-        Rectangle rect = getBounds();
-        if (getOwner() == null) {
-            return;
-        }
-        Object assoc =  getOwner();
-        if (Model.getFacade().isAbstract(assoc)) {
-            getNameFig().setFont(getItalicLabelFont());
-        } else {
-            getNameFig().setFont(getLabelFont());
-        }
-        super.updateNameText();
-        setBounds(rect.x, rect.y, rect.width, rect.height);
-    }
-
     /*
      * Makes sure that the edges stick to the outline of the fig.
      * @see org.tigris.gef.presentation.Fig#getGravityPoints()
@@ -266,16 +241,52 @@
     /*
      * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
      */
-    protected void setBoundsImpl(int x, int y, int w, int h) {
+    protected void setBoundsImpl(final int x, final int y, 
+            final int w, final int h) {
         Rectangle oldBounds = getBounds();
-        getBigPort().setBounds(x, y, w, h);
+
+        Rectangle nm = getNameFig().getBounds();
+        /* Center the NameFig, since center justification 
+         * does not seem to work. */
+        getNameFig().setBounds(x + (w - nm.width) / 2, 
+                y + h / 2 - nm.height / 2, 
+                nm.width, nm.height);
+        
+        if (getStereotypeFig().isVisible()) {
+            /* TODO: Test this. */
+            getStereotypeFig().setBounds(x, y + h / 2 - 20, w, 15);
+            int stereotypeHeight = getStereotypeFig().getMinimumSize().height;
+            getStereotypeFig().setBounds(
+                    x,
+                    y,
+                    w,
+                    stereotypeHeight);
+        }
+        
         head.setBounds(x, y, w, h);
-        getNameFig().setBounds(x, y + h / 2 - 8, w, 15);
-        getStereotypeFig().setBounds(x, y + h / 2 - 20, w, 15);
+        getBigPort().setBounds(x, y, w, h);
+
         calcBounds(); //_x = x; _y = y; _w = w; _h = h;
         firePropChange("bounds", oldBounds, getBounds());
         updateEdges();
     }
+
+    @Override
+    public Dimension getMinimumSize() {
+        Dimension aSize = getNameFig().getMinimumSize();
+        if (getStereotypeFig().isVisible()) {
+            Dimension stereoMin = getStereotypeFig().getMinimumSize();
+            aSize.width = Math.max(aSize.width, stereoMin.width);
+            aSize.height += stereoMin.height;
+        }
+        aSize.width = Math.max(70, aSize.width);
+        int size = Math.max(aSize.width, aSize.height);
+        aSize.width = size;
+        aSize.height = size;
+        
+        return aSize;
+    }
+
 } /* end class FigNodeAssociation */
 
 

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2007-08-24 07:48:08-0700
@@ -43,6 +43,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.Action;
@@ -117,6 +118,7 @@
         KeyListener,
         PropertyChangeListener,
         PathContainer,
+        ArgoDiagramAppearanceEventListener,
         ArgoNotationEventListener,
         Highlightable,
         IItemUID,
@@ -131,14 +133,6 @@
 
     private DiElement diElement;
 
-    ////////////////////////////////////////////////////////////////
-    // constants
-
-    private static final Font LABEL_FONT;
-    private static final Font ITALIC_LABEL_FONT;
-    private static final Font BOLD_LABEL_FONT;
-    private static final Font BOLD_ITALIC_LABEL_FONT;
-
     private NotationProvider notationProviderName;
     private HashMap<String, Object> npArguments = new HashMap<String, Object>();
     
@@ -173,24 +167,6 @@
      */
     private static int popupAddOffset;
 
-    static {
-        LABEL_FONT =
-        /* TODO: Why is this different from the FigEdgeModelElement?
-         * Should we not use one of the following? 
-         * LookAndFeelMgr.getInstance().getStandardFont();
-         * new javax.swing.plaf.metal.DefaultMetalTheme().getUserTextFont(); */
-            new javax.swing.plaf.metal.DefaultMetalTheme().getSubTextFont();
-        ITALIC_LABEL_FONT =
-            new Font(LABEL_FONT.getFamily(), Font.ITALIC, LABEL_FONT.getSize());
-        BOLD_LABEL_FONT =
-            new Font(LABEL_FONT.getFamily(), Font.BOLD, 
-                    LABEL_FONT.getSize() + 2);
-        BOLD_ITALIC_LABEL_FONT =
-            new Font(LABEL_FONT.getFamily(), Font.BOLD | Font.ITALIC, 
-                    LABEL_FONT.getSize() + 2);
-
-    }
-
     /**
      * Used for #buildModifierPopUp().
      */
@@ -281,7 +257,7 @@
         // is inside it:
         bigPort = new FigRect(10, 10, 0, 0, Color.cyan, Color.cyan);
 
-        nameFig = new FigSingleLineText(10, 10, 90, 21, true);
+        nameFig = new FigNameWithAbstract(10, 10, 90, 21, true);
         nameFig.setLineWidth(1);
         nameFig.setFilled(true);
         nameFig.setText(placeString());
@@ -293,18 +269,13 @@
 
         readyToEdit = false;
         ArgoEventPump.addListener(ArgoEventTypes.ANY_NOTATION_EVENT, this);
+        ArgoEventPump.addListener(
+                ArgoEventTypes.ANY_DIAGRAM_APPEARANCE_EVENT, this);
         
 
         Project project = getProject();
         ProjectSettings ps = project.getProjectSettings();
 
-        showBoldName = ps.getShowBoldNamesValue();
-        if ((nameFig.getFont().getStyle() & Font.ITALIC) != 0) {
-            nameFig.setFont(showBoldName ? BOLD_ITALIC_LABEL_FONT
-                    : ITALIC_LABEL_FONT);
-        } else {
-            nameFig.setFont(showBoldName ? BOLD_LABEL_FONT : LABEL_FONT);
-        }
         setShadowSize(ps.getDefaultShadowWidthValue());
         /* TODO: how to handle changes in shadowsize 
          * from the project properties? */
@@ -346,6 +317,8 @@
      */
     protected void finalize() throws Throwable {
         ArgoEventPump.removeListener(ArgoEventTypes.ANY_NOTATION_EVENT, this);
+        ArgoEventPump.removeListener(
+                ArgoEventTypes.ANY_DIAGRAM_APPEARANCE_EVENT, this);
         super.finalize();
     }
 
@@ -443,12 +416,7 @@
     protected void setNameFig(FigText fig) {
         nameFig = fig;
         if (nameFig != null) {
-            if ((nameFig.getFont().getStyle() & Font.ITALIC) != 0) {
-                nameFig.setFont(showBoldName ? BOLD_ITALIC_LABEL_FONT
-                        : ITALIC_LABEL_FONT);
-            } else {
-                nameFig.setFont(showBoldName ? BOLD_LABEL_FONT : LABEL_FONT);
-            }
+            updateFont();
         }
     }
 
@@ -888,7 +856,12 @@
     }
 
     /**
-     * set some new bounds.
+     * Determine new bounds. <p>
+     * 
+     * This algorithm makes the box grow 
+     * (if the calculated minimum size grows), 
+     * but then it can never shrink again 
+     * (not even if the calculated minimum size is smaller).
      */
     protected void updateBounds() {
         if (!checkSize) {
@@ -1253,8 +1226,12 @@
         initNotationProviders(owner);
         readyToEdit = true;
         renderingChanged();
-        updateBounds();
+//        updateBounds(); // included in the previous line.
+        /* This next line presumes that the 1st fig with this owner 
+         * is the previous port - and consequently nullifies the owner 
+         * of this 1st fig. */
         bindPort(owner, bigPort);
+        nameFig.setOwner(owner); // for setting abstract
         updateListeners(null, owner);
     }
 
@@ -1293,7 +1270,6 @@
         if (getOwner() == null) {
             LOG.warn("Owner of [" + this.toString() + "/" + this.getClass()
                     + "] is null.");
-            LOG.warn("I return...");
             return;
         }
 
@@ -1314,16 +1290,7 @@
                         getOwner(), npArguments));
                 Project p = getProject();
                 if (p != null) {
-                    ProjectSettings ps = p.getProjectSettings();
-                    showBoldName = ps.getShowBoldNamesValue();
-                    if ((nameFig.getFont().getStyle() & Font.ITALIC) != 0) {
-                        nameFig.setFont(showBoldName ? BOLD_ITALIC_LABEL_FONT
-                                : ITALIC_LABEL_FONT);
-                    } else {
-                        nameFig
-                        .setFont(showBoldName ? BOLD_LABEL_FONT
-                                : LABEL_FONT);
-                    }
+                    updateFont();
                 }
                 updateBounds();
             }
@@ -1601,21 +1568,23 @@
     }
 
     /**
-     * @return Returns the lABEL_FONT.
+     * @deprecated by MVW in V0.25.4. Use ProjectSettings instead.
+     * @return the diagram font
      */
-    public static Font getLabelFont() {
-        return LABEL_FONT;
+    public Font getLabelFont() {
+        return getProject().getProjectSettings().getFontPlain();
     }
 
     /**
-     * @return Returns the iTALIC_LABEL_FONT.
+     * @deprecated by MVW in V0.25.4. Use ProjectSettings instead.
+     * @return the italic diagram font
      */
-    public static Font getItalicLabelFont() {
-        return ITALIC_LABEL_FONT;
+    public Font getItalicLabelFont() {
+        return getProject().getProjectSettings().getFontItalic();
     }
 
     /**
-     * @param bp The _bigPort to set.
+     * @param bp the bigPort, which is the port where edges connect to this node
      */
     protected void setBigPort(Fig bp) {
         this.bigPort = bp;
@@ -1670,6 +1639,8 @@
     }
 
     /**
+     * TODO: Move this in FigGroup (in GEF).
+     * 
      * @param scb The suppressCalcBounds to set.
      */
     protected void setSuppressCalcBounds(boolean scb) {
@@ -1841,15 +1812,23 @@
         }
     }
 
-    /**
+    /*
      * This optional method is not implemented.  It will throw an
      * {@link UnsupportedOperationException} if used.  Figs are 
-     * added to a GraphModel which is, in turn, owned by a project.
+     * added to a GraphModel which is, in turn, owned by a project.<p>
+     * 
+     * This method is identical to the one in ArgoFigGroup.
      */
     public void setProject(Project project) {
         throw new UnsupportedOperationException();
     }
     
+    /**
+     * This method is identical to the one in ArgoFigGroup.
+     * 
+     * @return the project
+     * @see org.argouml.uml.diagram.ui.ArgoFig#getProject()
+     */
     public Project getProject() {
 	LayerPerspective layer = (LayerPerspective) getLayer();
         if (layer == null) {
@@ -1882,7 +1861,73 @@
 	return TargetManager.getInstance().getSingleModelTarget()
 		== getOwner();
     }
-    
+
+    /**
+     * Handles diagram font changing.
+     * @param e the event or null
+     * @see org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEventListener#diagramFontChanged(org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent)
+     */
+    public void diagramFontChanged(ArgoDiagramAppearanceEvent e) {
+        updateFont();
+//      calcBounds(); // Don't do this! Causes e.g. FigActor to not center properly.
+        updateBounds();
+        damage();
+    }
+
+    /**
+     * This function should, for all FigTexts, 
+     * recalculate the font-style (plain, bold, italic, bold/italic),
+     * and apply it by calling FigText.setFont(). <p>
+     * 
+     * If the "deepUpdateFont" function does not 
+     * work for a subclass, then override this method.
+     */
+    protected void updateFont() {
+        int style = getNameFigFontStyle();
+        Font f = getProject().getProjectSettings().getFont(style);
+        nameFig.setFont(f);
+        deepUpdateFont(this);
+    }
+
+    /**
+     * Determines the font style based on the UML model. 
+     * Overrule this in Figs that have to show bold or italic based on the 
+     * UML model they represent. 
+     * E.g. abstract classes show their name in italic.
+     * 
+     * @return the font style for the nameFig.
+     */
+    protected int getNameFigFontStyle() {
+        ProjectSettings ps = getProject().getProjectSettings();
+        showBoldName = ps.getShowBoldNamesValue();
+        
+        return showBoldName ? Font.BOLD : Font.PLAIN;
+    }
+
+    /**
+     * Changes the font for all Figs contained in the given FigGroup. <p>
+     * 
+     *  TODO: In fact, there is a design error in this method:
+     *  E.g. for a class, if the name is Italic since the class is abstract,
+     *  then the classes features should be in Plain font.
+     *  This problem can be fixed by implementing 
+     *  the updateFont() method in all subclasses.
+     *  
+     * @param fg the FigGroup to change the font of.
+     */
+    private void deepUpdateFont(FigGroup fg) {
+        List<Fig> figs = fg.getFigs();
+        for (Fig f : figs) {
+            if (f instanceof ArgoFigText) {
+                ((ArgoFigText) f).diagramFontChanged(null);
+                fg.calcBounds();
+            }
+            if (f instanceof FigGroup) {
+                deepUpdateFont((FigGroup) f);
+                f.calcBounds();
+            }
+        }
+    }
 }
 
 /**

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigSingleLineText.java	2007-08-24 07:48:08-0700
@@ -72,7 +72,6 @@
     public FigSingleLineText(int x, int y, int w, int h, boolean expandOnly) {
         super(x, y, w, h, expandOnly);
 
-        setFont(FigNodeModelElement.getLabelFont());
         setTextColor(Color.black);
         setFilled(false);
         setTabAction(FigText.END_EDITING);
@@ -109,13 +108,13 @@
         if (font == null) {
             return d;
         }
-        int maxW = getFontMetrics().stringWidth(getText());
+        int maxW = 0;
         int maxH = 0;
-        //int maxDescent = _fm.getMaxDescent();
         if (getFontMetrics() == null) {
             maxH = font.getSize();
         } else {
             maxH = getFontMetrics().getHeight();
+            maxW = getFontMetrics().stringWidth(getText());
         }
         int overallH = (maxH + getTopMargin() + getBotMargin());
         int overallW = maxW + getLeftMargin() + getRightMargin();
@@ -154,8 +153,9 @@
     }
     
     public void propertyChange(PropertyChangeEvent pce) {
-        if (getOwner() != null
+        if (getOwner() == pce.getSource()
                 && properties != null
+                && Arrays.asList(properties).contains(pce.getPropertyName())
                 && pce instanceof AttributeChangeEvent) {
             /* TODO: Why does it fail for changing 
              * the name of an associationend?
@@ -164,6 +164,11 @@
             //  : pce.getPropertyName(); 
             setText();
         }
+        if ("remove".equals(pce.getPropertyName()) 
+                && (pce.getSource() == getOwner())) {
+            deleteFromModel();
+        }
+//        super.propertyChange(pce); // Adding this gives loads of problems!!!
     }
 
     /**

Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigStereotype.java	2007-08-24 07:48:08-0700
@@ -62,7 +62,7 @@
 
         setFilled(false);
         setLineWidth(0);
-        setFont(FigNodeModelElement.getLabelFont());
+        setFont(getProject().getProjectSettings().getFontPlain());
         setTextColor(Color.black);
         setTextFilled(false);
         setJustification(FigText.JUSTIFY_LEFT);

Added: trunk/src_new/org/argouml/uml/diagram/ui/InitDiagramAppearanceUI.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/InitDiagramAppearanceUI.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/InitDiagramAppearanceUI.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,59 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.diagram.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.argouml.application.api.Argo;
+import org.argouml.application.api.GUISettingsTabInterface;
+import org.argouml.application.api.InitSubsystem;
+
+/**
+ * Initialise this subsystem.
+ *
+ * @author Aleksandar
+ */
+public class InitDiagramAppearanceUI implements InitSubsystem {
+
+    public void init() {
+
+    }
+
+    public List<GUISettingsTabInterface> getProjectSettingsTabs() {
+        List<GUISettingsTabInterface> result =
+            new ArrayList<GUISettingsTabInterface>();
+        result.add(new SettingsTabDiagramAppearance(Argo.SCOPE_PROJECT));
+        return result;
+    }
+
+    public List<GUISettingsTabInterface> getSettingsTabs() {
+        List<GUISettingsTabInterface> result =
+            new ArrayList<GUISettingsTabInterface>();
+        result.add(new SettingsTabDiagramAppearance(Argo.SCOPE_APPLICATION));
+        return result;
+    }
+
+}

Added: trunk/src_new/org/argouml/uml/diagram/ui/SettingsTabDiagramAppearance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/SettingsTabDiagramAppearance.java?view=auto&rev=13439
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/uml/diagram/ui/SettingsTabDiagramAppearance.java	2007-08-24 07:48:08-0700
@@ -0,0 +1,259 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+package org.argouml.uml.diagram.ui;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.argouml.application.api.Argo;
+import org.argouml.application.api.GUISettingsTabInterface;
+import org.argouml.configuration.Configuration;
+import org.argouml.configuration.ConfigurationKey;
+import org.argouml.i18n.Translator;
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.kernel.ProjectSettings;
+import org.argouml.ui.ArgoFrame;
+import org.argouml.ui.ArgoJFontChooser;
+
+/**
+ * Settings tab panel for handling diagram appearance settings.
+ * <p>
+ * It supports different scopes: application and project. The former is stored
+ * in the properties file in the user-directory, the latter in the project file
+ * (.zargo,...).
+ * <p>
+ * This class is written in a way that supports adding more scopes easily.
+ *
+ * @author Aleksandar
+ */
+public class SettingsTabDiagramAppearance extends JPanel implements
+        GUISettingsTabInterface {
+
+    private JButton jbtnDiagramFont;
+
+    private String selectedDiagramFontName;
+
+    private int selectedDiagramFontSize;
+
+    private int scope;
+
+    private JLabel jlblDiagramFont = null;
+
+    /**
+     * The constructor. We currently support 2 scopes, but this class is written
+     * in a way to easily extend that.
+     *
+     * @param settingsScope the scope of the settings
+     */
+    public SettingsTabDiagramAppearance(int settingsScope) {
+        super();
+        scope = settingsScope;
+        initialize();
+    }
+
+    /**
+     * This method initializes this
+     */
+    private void initialize() {
+        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
+        gridBagConstraints2.gridx = 0;
+        gridBagConstraints2.fill = GridBagConstraints.BOTH;
+        gridBagConstraints2.weightx = 1.0;
+        gridBagConstraints2.weighty = 1.0;
+        gridBagConstraints2.gridy = 2;
+        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
+        gridBagConstraints1.gridx = 0;
+        gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST;
+        gridBagConstraints1.insets = new Insets(5, 5, 0, 0);
+        gridBagConstraints1.gridy = 0;
+        jlblDiagramFont = new JLabel();
+        jlblDiagramFont.setText(
+                Translator.localize("label.diagramappearance.diagramfont"));
+        GridBagConstraints gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+        gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.insets = new Insets(5, 5, 0, 5);
+        gridBagConstraints.gridy = 1;
+        this.setLayout(new GridBagLayout());
+        this.setSize(new Dimension(296, 169));
+        this.add(getJbtnDiagramFont(), gridBagConstraints);
+        this.add(jlblDiagramFont, gridBagConstraints1);
+        this.add(new JPanel(), gridBagConstraints2);
+
+    }
+
+    private JButton getJbtnDiagramFont() {
+        if (jbtnDiagramFont == null) {
+            jbtnDiagramFont = new JButton(
+                    Translator.localize("label.diagramappearance.changefont"));
+
+            jbtnDiagramFont.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    ArgoJFontChooser jFontChooser = new ArgoJFontChooser(
+                            ArgoFrame.getInstance(), jbtnDiagramFont,
+                            selectedDiagramFontName, selectedDiagramFontSize);
+                    jFontChooser.setVisible(true);
+
+                    if (jFontChooser.isOk()) {
+                        selectedDiagramFontName = jFontChooser.getResultName();
+                        selectedDiagramFontSize = jFontChooser.getResultSize();
+                    }
+                }
+            });
+
+        }
+        return jbtnDiagramFont;
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#handleSettingsTabRefresh()
+     */
+    public void handleSettingsTabRefresh() {
+        if (scope == Argo.SCOPE_APPLICATION) {
+            selectedDiagramFontName = DiagramAppearance.getInstance()
+                    .getConfiguredFontName();
+            selectedDiagramFontSize = Configuration
+                    .getInteger(DiagramAppearance.KEY_FONT_SIZE);
+        }
+        if (scope == Argo.SCOPE_PROJECT) {
+            Project p = ProjectManager.getManager().getCurrentProject();
+            ProjectSettings ps = p.getProjectSettings();
+
+            selectedDiagramFontName = ps.getFontName();
+            selectedDiagramFontSize = ps.getFontSize();
+        }
+    }
+
+    /**
+     * Get a boolean from the configuration.
+     *
+     * @param key a notation key.
+     * @return a boolean
+     */
+    protected static boolean getBoolean(ConfigurationKey key) {
+        return Configuration.getBoolean(key, false);
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#handleSettingsTabSave()
+     */
+    public void handleSettingsTabSave() {
+        if (scope == Argo.SCOPE_APPLICATION) {
+            Configuration.setString(DiagramAppearance.KEY_FONT_NAME,
+                    selectedDiagramFontName);
+            Configuration.setInteger(DiagramAppearance.KEY_FONT_SIZE,
+                    selectedDiagramFontSize);
+        }
+        if (scope == Argo.SCOPE_PROJECT) {
+            Project p = ProjectManager.getManager().getCurrentProject();
+            ProjectSettings ps = p.getProjectSettings();
+
+            ps.setFontName(selectedDiagramFontName);
+            ps.setFontSize(selectedDiagramFontSize);
+        }
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#handleSettingsTabCancel()
+     */
+    public void handleSettingsTabCancel() {
+        handleSettingsTabRefresh();
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#handleResetToDefault()
+     */
+    public void handleResetToDefault() {
+        if (scope == Argo.SCOPE_PROJECT) {
+            selectedDiagramFontName = DiagramAppearance.getInstance()
+                    .getConfiguredFontName();
+            selectedDiagramFontSize = Configuration
+                    .getInteger(DiagramAppearance.KEY_FONT_SIZE);
+        }
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#getTabKey()
+     */
+    public String getTabKey() {
+        return "tab.diagramappearance";
+    }
+
+    /*
+     * @see org.argouml.ui.GUISettingsTabInterface#getTabPanel()
+     */
+    public JPanel getTabPanel() {
+        return this;
+    }
+
+    /**
+     * Create a localized JButton.
+     *
+     * @param key the key for the string to be localized
+     * @return a new checkbox with localized text
+     */
+    protected JButton createCheckBox(String key) {
+        JButton j = new JButton(Translator.localize(key));
+        return j;
+    }
+
+    /**
+     * Create a localized JLabel.
+     *
+     * @param key the key of the text for the label
+     * @return a new label with a localized text for the given key
+     */
+    protected JLabel createLabel(String key) {
+        return new JLabel(Translator.localize(key));
+    }
+
+    /**
+     * Create a localized JButton.
+     *
+     * @param key the key for the string to be localized
+     * @return a new checkbox with localized text
+     */
+    protected JButton createButton(String key) {
+        return new JButton(Translator.localize(key));
+    }
+
+    /*
+     * @see javax.swing.JComponent#setVisible(boolean)
+     */
+    public void setVisible(boolean arg0) {
+        super.setVisible(arg0);
+        if (arg0) handleSettingsTabRefresh();
+    }
+} // @jve:decl-index=0:visual-constraint="10,10"

Modified: trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java&p2=trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigActor.java	2007-08-24 07:48:08-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -26,6 +26,7 @@
 
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.Font;
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
@@ -35,6 +36,7 @@
 import java.util.Vector;
 
 import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.ArgoDiagramAppearanceEvent;
 import org.argouml.uml.diagram.ui.FigNodeModelElement;
 import org.tigris.gef.base.Selection;
 import org.tigris.gef.graph.GraphModel;
@@ -69,23 +71,19 @@
     private static final int LEFT_LEG_POSN = 5;
     private static final int RIGHT_LEG_POSN = 6;
 
-    ////////////////////////////////////////////////////////////////
-    // constructors
-
     /**
      * Main Constructor for the creation of a new Actor.
      */
     public FigActor() {
         // Put this rectangle behind the rest, so it goes first
-        FigRect bigPort = new ActorPortFigRect(10, 10, 15, 60, this);
-        bigPort.setVisible(false);
+        FigRect bigPort = new ActorPortFigRect(10, 10, 0, 0, this);
         FigCircle head =
-            new FigCircle(10, 10, 15, 15, Color.black, Color.white);
+            new FigCircle(12, 10, 16, 15, Color.black, Color.white);
         FigLine body = new FigLine(20, 25, 20, 40, Color.black);
         FigLine arms = new FigLine(10, 30, 30, 30, Color.black);
         FigLine leftLeg = new FigLine(20, 40, 15, 55, Color.black);
         FigLine rightLeg = new FigLine(20, 40, 25, 55, Color.black);
-        getNameFig().setBounds(5, 55, 35, 20);
+        getNameFig().setBounds(10, 55, 20, 20);
 
         getNameFig().setTextFilled(false);
         getNameFig().setFilled(false);
@@ -94,7 +92,7 @@
         getStereotypeFig().setBounds(getBigPort().getCenter().x,
                                      getBigPort().getCenter().y,
                                      0, 0);
-
+        setSuppressCalcBounds(true);
         // add Figs to the FigNode in back-to-front order
         addFig(bigPort);
         addFig(getNameFig());
@@ -105,6 +103,7 @@
         addFig(rightLeg);
         addFig(getStereotypeFig());
         setBigPort(bigPort);
+        setSuppressCalcBounds(false);
     }
 
     /**
@@ -181,41 +180,67 @@
      */
     public Dimension getMinimumSize() {
         Dimension nameDim = getNameFig().getMinimumSize();
-        int w = nameDim.width;
-        int h = nameDim.height + 65;
+        int w = Math.max(nameDim.width, 40);
+        int h = nameDim.height + 55;
+        if (getStereotypeFig().isVisible()) {
+            Dimension stereoDim = getStereotypeFig().getMinimumSize();
+            w = Math.max(stereoDim.width, w);
+            h = h + stereoDim.height;
+        }
         return new Dimension(w, h);
     }
 
     /*
      * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
      */
-    protected void setBoundsImpl(int x, int y, int w, int h) {
-        int middle = w / 2;
-        h = _h;
+    protected void setBoundsImpl(final int x, final int y, 
+            final int w, final int h) {
+        int middle = x + w / 2;
+
         Rectangle oldBounds = getBounds();
-        getBigPort().setLocation(
-                x + middle - getBigPort().getWidth() / 2, y + h - 65);
+        getBigPort().setBounds(x, y, w, h);
+
         getFigAt(HEAD_POSN).setLocation(
-                x + middle - getFigAt(HEAD_POSN).getWidth() / 2, y + h - 65);
-        getFigAt(BODY_POSN).setLocation(x + middle, y + h - 50);
+                middle - getFigAt(HEAD_POSN).getWidth() / 2, y + 10);
+        getFigAt(BODY_POSN).setLocation(middle, y + 25);
         getFigAt(ARMS_POSN).setLocation(
-                x + middle - getFigAt(ARMS_POSN).getWidth() / 2, y + h - 45);
+                middle - getFigAt(ARMS_POSN).getWidth() / 2, y + 30);
         getFigAt(LEFT_LEG_POSN).setLocation(
-                x + middle - getFigAt(LEFT_LEG_POSN).getWidth(), y + h - 35);
-        getFigAt(RIGHT_LEG_POSN).setLocation(x + middle, y + h - 35);
+                middle - getFigAt(LEFT_LEG_POSN).getWidth(), y + 40);
+        getFigAt(RIGHT_LEG_POSN).setLocation(middle, y +  40);
 
         Dimension minTextSize = getNameFig().getMinimumSize();
-        getNameFig().setBounds(x + middle - minTextSize.width / 2,
-			       y + h - minTextSize.height,
-			       minTextSize.width,
-			       minTextSize.height);
-//        updateStereotypeText();
-        updateEdges();
-        _x = x;
-        _y = y;
-        _w = w;
-        // do not set height
+        getNameFig().setBounds(middle - minTextSize.width / 2,
+	        y +  55,
+	        minTextSize.width,
+	        minTextSize.height);
+
+        if (getStereotypeFig().isVisible()) {
+            Dimension minStereoSize = getStereotypeFig().getMinimumSize();
+            assert minStereoSize.width <= w;
+            getStereotypeFig().setBounds(middle - minStereoSize.width / 2,
+                    y + 55 + getNameFig().getHeight(),
+                    minStereoSize.width, 
+                    minStereoSize.height);
+        }
+        calcBounds(); //Accumulate a bounding box for all the Figs in the group.
         firePropChange("bounds", oldBounds, getBounds());
+        updateEdges();
+    }
+
+    /**
+     * Overruled the parent implementation, to always use the minimum size.
+     * 
+     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateBounds()
+     */
+    @Override
+    protected void updateBounds() {
+        if (!isCheckSize()) {
+            return;
+        }
+        Rectangle bbox = getBounds();
+        Dimension minSize = getMinimumSize();
+        setBounds(bbox.x, bbox.y, minSize.width, minSize.height);
     }
 
     /*
@@ -274,10 +299,6 @@
             return;
         }
 
-        if (mee == null || mee.getPropertyName().equals("isAbstract")) {
-            updateAbstract();
-            damage = true;
-        }
         if (mee == null 
                 || mee.getPropertyName().equals("stereotype") 
                 || Model.getFacade().getStereotypes(getOwner())
@@ -291,59 +312,9 @@
         }
     }
 
-    /**
-     * Rerenders the fig if needed. This functionality was originally
-     * the functionality of modelChanged but modelChanged takes the
-     * event now into account.
-     */
-    public void renderingChanged() {
-        if (getOwner() != null) {
-            updateAbstract();
-        }
-        super.renderingChanged();
-        damage();
-    }
-
-
-    /**
-     * Updates the name if modelchanged receives an "isAbstract" event.
-     */
-    protected void updateAbstract() {
-        Rectangle rect = getBounds();
-        if (getOwner() == null) {
-            return;
-        }
+    protected int getNameFigFontStyle() {
         Object cls = getOwner();
-        if (Model.getFacade().isAbstract(cls)) {
-            getNameFig().setFont(getItalicLabelFont());
-	} else {
-            getNameFig().setFont(getLabelFont());
-	}
-        super.updateNameText();
-        setBounds(rect.x, rect.y, rect.width, rect.height);
-    }
-
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateStereotypeText()
-     */
-    protected void updateStereotypeText() {
-        super.updateStereotypeText();
-        if (!Model.getFacade().getStereotypes(getOwner()).isEmpty()) {
-            Dimension stereoMin = getStereotypeFig().getMinimumSize();
-            getStereotypeFig().setBounds(
-                (getBigPort().getCenter().x
-                                     - getStereotypeFig().getWidth() / 2),
-                (getBigPort().getY() + getBigPort().getHeight()
-                                     + MIN_VERT_PADDING),
-                stereoMin.width,
-                stereoMin.height);
-        } else {
-            getStereotypeFig().setBounds(getBigPort().getCenter().x,
-                                         getBigPort().getCenter().y,
-                                         0,
-                                         0);
-        }
-        damage();
+        return Model.getFacade().isAbstract(cls) ? Font.ITALIC : Font.PLAIN;
     }
 
     /**

Modified: trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java?view=diff&rev=13439&p1=trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java&p2=trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java&r1=13438&r2=13439
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java	(original)
+++ trunk/src_new/org/argouml/uml/diagram/use_case/ui/FigUseCase.java	2007-08-24 07:48:08-0700
@@ -26,6 +26,7 @@
 
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.Font;
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.event.InputEvent;
@@ -1260,14 +1261,8 @@
         // Now things to do with the use case itself. Put the use case in
         // italics if it is abstract, otherwise ordinary font.
 
-        if (Model.getFacade().isAbstract(useCase)) {
-            getNameFig().setFont(getItalicLabelFont());
-        } else {
-            getNameFig().setFont(getLabelFont());
-        }
         super.updateNameText();
         setBounds(oldBounds.x, oldBounds.y, oldBounds.width, oldBounds.height);
-
     }
 
     /*
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.