org.argouml.uml.diagram
Class DiagramSettings

java.lang.Object
  extended by org.argouml.uml.diagram.DiagramSettings

public class DiagramSettings
extends java.lang.Object

Diagram appearance settings. This includes basic things like colors and fonts, as well as the NotationSettings which contain all the settings that control text formatting.

The settings are designed to work in a hierarchical fashion with any settings that are defaulted at the current level inheriting from the next level in the hierarchy. A typical hierarchy would be Fig->StyleSheet->Project where a style sheet is a named set of attributes that can be applied as a set to a fig (perhaps in conjunction with a stereotype). The hierarchy which is currently used in ArgoUML is Fig->Diagram->Project, although there's no support for changing anything but the Project (and a few of the attributes managed directly by GEF).

Notation settings have a semantic meaning in the UML, which defines the difference between notation settings and diagram appearance settings.


Nested Class Summary
static class DiagramSettings.StereotypeStyle
          Enumeration representing different stereotype presentation styles
 
Constructor Summary
DiagramSettings()
          Construct an empty diagram settings with no parent and all values defaulted.
DiagramSettings(DiagramSettings parentSettings)
          Construct a DiagramSettings object which inherits from the given parent settings (e.g.
 
Method Summary
 int getDefaultShadowWidth()
           
 DiagramSettings.StereotypeStyle getDefaultStereotypeView()
           
 int getDefaultStereotypeViewInt()
          Deprecated. for 0.27.2 by tfmorris. For backward compatibility only.
 java.awt.Font getFont(int fontStyle)
          Utility function to convert a font style integer into a Font.
 java.awt.Font getFontBold()
          Returns the Bold diagram font which corresponds to selected parameters.
 java.awt.Font getFontBoldItalic()
          Returns the Bold-Italic diagram font which corresponds to selected parameters.
 java.awt.Font getFontItalic()
          Returns the Italic diagram font which corresponds to selected parameters.
 java.lang.String getFontName()
          Diagram font name.
 java.awt.Font getFontPlain()
          Returns the Plain diagram font which corresponds to selected parameters.
 int getFontSize()
          Diagram font size.
 NotationSettings getNotationSettings()
           
 void initFromConfiguration()
          Initialize the diagram settings with application default values from the Configuration retrieved from disk.
 boolean isShowBidirectionalArrows()
           
 boolean isShowBoldNames()
           
 void notifyOfChangedSettings()
          Send all events when the settings are changed to refresh anything rendered with these settings.
 void setDefaultShadowWidth(int newWidth)
           
 void setDefaultStereotypeView(DiagramSettings.StereotypeStyle newView)
           
 void setDefaultStereotypeView(int newView)
          Deprecated. for 0.27.2 by tfmorris. Not for use in new code. Only for help in transitioning to enum based methods. Use setDefaultStereotypeView(StereotypeStyle).
 void setFontName(java.lang.String newFontName)
          Diagram font name.
 void setFontSize(int newFontSize)
          Diagram font size.
 void setNotationSettings(NotationSettings notationSettings)
           
 void setShowBidirectionalArrows(boolean showem)
           
 void setShowBoldNames(boolean showem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramSettings

public DiagramSettings()
Construct an empty diagram settings with no parent and all values defaulted.


DiagramSettings

public DiagramSettings(DiagramSettings parentSettings)
Construct a DiagramSettings object which inherits from the given parent settings (e.g. project default diagram settings).

Parameters:
parentSettings - settings to inherit from if default values aren't overridden.
Method Detail

notifyOfChangedSettings

public void notifyOfChangedSettings()
Send all events when the settings are changed to refresh anything rendered with these settings.


initFromConfiguration

public void initFromConfiguration()
Initialize the diagram settings with application default values from the Configuration retrieved from disk.


getNotationSettings

public NotationSettings getNotationSettings()
Returns:
Returns the notationSettings.

setNotationSettings

public void setNotationSettings(NotationSettings notationSettings)
Parameters:
notationSettings - The notationSettings to set.

isShowBoldNames

public boolean isShowBoldNames()
Returns:
Returns true if we show bold names.

setShowBoldNames

public void setShowBoldNames(boolean showem)
Parameters:
showem - true if names are to be shown in bold font.

isShowBidirectionalArrows

public boolean isShowBidirectionalArrows()
Returns:
Returns true if we show the arrows when both association ends of an association are navigable.

setShowBidirectionalArrows

public void setShowBidirectionalArrows(boolean showem)
Parameters:
showem - true if both arrows are to be shown when both association ends of an association are navigable.

getDefaultShadowWidth

public int getDefaultShadowWidth()
Returns:
Returns the shadow width.

setDefaultShadowWidth

public void setDefaultShadowWidth(int newWidth)
Parameters:
newWidth - The Shadow Width.

getDefaultStereotypeView

public DiagramSettings.StereotypeStyle getDefaultStereotypeView()
Returns:
Returns the default stereotype view TODO: Enumeration here?

getDefaultStereotypeViewInt

public int getDefaultStereotypeViewInt()
Deprecated. for 0.27.2 by tfmorris. For backward compatibility only.

Returns:
Returns the default stereotype view as an int compatible with old users of DiagramAppearance-defined ints.

setDefaultStereotypeView

public void setDefaultStereotypeView(int newView)
Deprecated. for 0.27.2 by tfmorris. Not for use in new code. Only for help in transitioning to enum based methods. Use setDefaultStereotypeView(StereotypeStyle).

Parameters:
newView - the default stereotype view

setDefaultStereotypeView

public void setDefaultStereotypeView(DiagramSettings.StereotypeStyle newView)
Parameters:
newView - the default stereotype view

getFontName

public java.lang.String getFontName()
Diagram font name.

Returns:
diagram font name.

setFontName

public void setFontName(java.lang.String newFontName)
Diagram font name.

Parameters:
newFontName - diagram font name.

getFontSize

public int getFontSize()
Diagram font size.

Returns:
diagram font size.

setFontSize

public void setFontSize(int newFontSize)
Diagram font size.

Parameters:
newFontSize - diagram font size.

getFontPlain

public java.awt.Font getFontPlain()
Returns the Plain diagram font which corresponds to selected parameters.

Returns:
plain diagram font

getFontItalic

public java.awt.Font getFontItalic()
Returns the Italic diagram font which corresponds to selected parameters.

Returns:
italic diagram font

getFontBold

public java.awt.Font getFontBold()
Returns the Bold diagram font which corresponds to selected parameters.

Returns:
bold diagram font

getFontBoldItalic

public java.awt.Font getFontBoldItalic()
Returns the Bold-Italic diagram font which corresponds to selected parameters.

Returns:
bold-italic diagram font

getFont

public java.awt.Font getFont(int fontStyle)
Utility function to convert a font style integer into a Font.

Parameters:
fontStyle - the style; see the predefined constants in Font
Returns:
the Font that corresponds to the style


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook