svn commit: r16632 - trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java
Tom Morris <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: tfmorris
Date: 2009-01-16 07:54:40-0800
New Revision: 16632
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java
Log:
RESOLVED - Issue 5616: Default font (10 pt Dialog) always used instead of selected fonts
http://argouml.tigris.org/issues/show_bug.cgi?id=5616
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java?view=diff&pathrev=16632&r1=16631&r2=16632
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramSettings.java 2009-01-16 07:54:40-0800
@@ -144,10 +144,7 @@
* defaulted. <p>
*/
public DiagramSettings() {
- super();
- notationSettings = new NotationSettings();
- recomputeFonts();
- parent = null;
+ this(null);
}
@@ -159,10 +156,14 @@
* overridden.
*/
public DiagramSettings(DiagramSettings parentSettings) {
- this();
+ super();
parent = parentSettings;
- // We just created one of these and now we're throwing it away, oh well
- notationSettings = new NotationSettings(getNotationSettings());
+ if (parentSettings == null) {
+ notationSettings = new NotationSettings();
+ } else {
+ notationSettings = new NotationSettings(getNotationSettings());
+ }
+ recomputeFonts();
}
@@ -412,17 +413,21 @@
}
private void recomputeFonts() {
- String name = getFontName();
- int size = getFontSize();
-// if (size == 0) {
-// size = 10;
-// }
-
- if (name != null && !"".equals(name) && size > 0) {
+ // If we've got a local (uninherited) font name or size or if we've got
+ // no parent to inherit from recompute our cached fonts
+ if ((fontName != null && !"".equals(fontName) && fontSize != null)
+ || parent == null) {
+ String name = getFontName();
+ int size = getFontSize();
fontPlain = new Font(name, Font.PLAIN, size);
fontItalic = new Font(name, Font.ITALIC, size);
fontBold = new Font(name, Font.BOLD, size);
fontBoldItalic = new Font(name, Font.BOLD | Font.ITALIC, size);
+ } else {
+ fontPlain = null;
+ fontItalic = null;
+ fontBold = null;
+ fontBoldItalic = null;
}
}
@@ -433,6 +438,9 @@
* @return plain diagram font
*/
public Font getFontPlain() {
+ if (fontPlain == null) {
+ return parent.getFontPlain();
+ }
return fontPlain;
}
@@ -443,6 +451,9 @@
* @return italic diagram font
*/
public Font getFontItalic() {
+ if (fontItalic == null) {
+ return parent.getFontItalic();
+ }
return fontItalic;
}
@@ -453,6 +464,9 @@
* @return bold diagram font
*/
public Font getFontBold() {
+ if (fontBold == null) {
+ return parent.getFontBold();
+ }
return fontBold;
}
@@ -463,6 +477,9 @@
* @return bold-italic diagram font
*/
public Font getFontBoldItalic() {
+ if (fontBoldItalic == null) {
+ return parent.getFontBoldItalic();
+ }
return fontBoldItalic;
}
@@ -475,15 +492,15 @@
public Font getFont(int fontStyle) {
if ((fontStyle & Font.ITALIC) != 0) {
if ((fontStyle & Font.BOLD) != 0) {
- return fontBoldItalic;
+ return getFontBoldItalic();
} else {
- return fontItalic;
+ return getFontItalic();
}
} else {
if ((fontStyle & Font.BOLD) != 0) {
- return fontBold;
+ return getFontBold();
} else {
- return fontPlain;
+ return getFontPlain();
}
}
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1028999
To unsubscribe from this discussion, e-mail: [[email protected]].