Author: penyaskito Date: 2008-08-26 10:39:31-0700 New Revision: 15611 Modified: trunk/src/argouml-app/src/org/argouml/i18n/label.properties trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java trunk/src/argouml-app/src/org/argouml/notation/Notation.java trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java trunk/src/argouml-app/src/org/argouml/persistence/argo.tee trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Log: Fixes Issue 535: Allow the user to set if he wants to see the arrows when both ends of an association are navigable. Modified: trunk/src/argouml-app/src/org/argouml/i18n/label.properties Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/label.properties?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/i18n/label.properties&p2=trunk/src/argouml-app/src/org/argouml/i18n/label.properties&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/i18n/label.properties (original) +++ trunk/src/argouml-app/src/org/argouml/i18n/label.properties 2008-08-26 10:39:31-0700 @@ -199,6 +199,7 @@ higher than standard<br> are very experimental. Use at your own risk.</html> label.guard = Guard: label.headline = Headline: +label.hide-bidirectional-arrows = Hide arrows when both association ends from an association are navigable label.high = High label.home-model = Home Model: label.implementations = Implementations: Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java&p2=trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java (original) +++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java 2008-08-26 10:39:31-0700 @@ -74,6 +74,7 @@ /* Diagram appearance settings with project scope: */ private String fontName; private int fontSize; + private boolean hideBidirectionalArrows; /* Keep some fonts around depending on the above settings: */ private Font fontPlain; private Font fontItalic; @@ -118,10 +119,13 @@ showProperties = Configuration.getBoolean( Notation.KEY_SHOW_PROPERTIES); /* - * The next one defaults to TRUE, to stay compatible with older + * The next ones defaults to TRUE, to stay compatible with older * ArgoUML versions that did not have this setting: */ showTypes = Configuration.getBoolean(Notation.KEY_SHOW_TYPES, true); + hideBidirectionalArrows = Configuration.getBoolean( + Notation.KEY_HIDE_BIDIRECTIONAL_ARROWS, true); + showStereotypes = Configuration.getBoolean( Notation.KEY_SHOW_STEREOTYPES); /* @@ -369,6 +373,7 @@ public boolean getUseGuillemotsValue() { return useGuillemots; } + /** * @param showem <code>true</code> if guillemots are to be shown. @@ -818,6 +823,62 @@ /** * Used by "argo.tee". * + * @return Returns "true" if we show the arrows when + * both association ends of an association are navigable. + */ + public String getHideBidirectionalArrows() { + return Boolean.toString(hideBidirectionalArrows); + } + + /** + * @return Returns <code>true</code> if we show the arrows when + * both association ends of an association are navigable. + + */ + public boolean getHideBidirectionalArrowsValue() { + return hideBidirectionalArrows; + } + + /** + * @param hideem <code>true</code> if both arrows are to be shown when + * both association ends of an association are navigable. + */ + public void setHideBidirectionalArrows(String hideem) { + setHideBidirectionalArrows(Boolean.valueOf(hideem).booleanValue()); + } + + /** + * @param hideem <code>true</code> if both arrows are to be shown when + * both association ends of an association are navigable. + + */ + public void setHideBidirectionalArrows(final boolean hideem) { + if (hideBidirectionalArrows == hideem) return; + + Memento memento = new Memento() { + private final ConfigurationKey key = + Notation.KEY_HIDE_BIDIRECTIONAL_ARROWS; + + public void redo() { + hideBidirectionalArrows = hideem; + fireNotationEvent(key, !hideem, hideem); + } + + public void undo() { + hideBidirectionalArrows = !hideem; + fireNotationEvent(key, hideem, !hideem); + } + }; + if (UndoManager.getInstance().isGenerateMementos()) { + UndoManager.getInstance().addMemento(memento); + } + memento.redo(); + ProjectManager.getManager().setSaveEnabled(true); + } + + /** + * Used by "argo.tee". + * * @return Returns the shadow width. */ public String getDefaultShadowWidth() { Modified: trunk/src/argouml-app/src/org/argouml/notation/Notation.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/Notation.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/notation/Notation.java&p2=trunk/src/argouml-app/src/org/argouml/notation/Notation.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/Notation.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/Notation.java 2008-08-26 10:39:31-0700 @@ -150,6 +150,13 @@ Configuration.makeKey("notation", "default", "shadow-width"); /** + * Indicates if the user wants to see the arrows when both + * association ends in an association are navigable. + */ + public static final ConfigurationKey KEY_HIDE_BIDIRECTIONAL_ARROWS = + Configuration.makeKey("notation", "hide", "bidirectional-arrows"); + + /** * The instance. */ private static final Notation SINGLETON = new Notation(); @@ -169,6 +176,7 @@ Configuration.addListener(KEY_SHOW_ASSOCIATION_NAMES, this); Configuration.addListener(KEY_SHOW_VISIBILITY, this); Configuration.addListener(KEY_SHOW_INITIAL_VALUE, this); + Configuration.addListener(KEY_HIDE_BIDIRECTIONAL_ARROWS, this); } /** Modified: trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java&p2=trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/ui/SettingsTabNotation.java 2008-08-26 10:39:31-0700 @@ -79,6 +79,7 @@ private JCheckBox showTypes; private JCheckBox showStereotypes; private JCheckBox showSingularMultiplicities; + private JCheckBox hideBidirectionalArrows; private ShadowComboBox defaultShadowWidth; private int scope; @@ -176,6 +177,10 @@ showSingularMultiplicities = createCheckBox("label.show-singular-multiplicities"); settings.add(showSingularMultiplicities, constraints); + + hideBidirectionalArrows = + createCheckBox("label.hide-bidirectional-arrows"); + settings.add(hideBidirectionalArrows, constraints); constraints.insets = new Insets(5, 30, 0, 4); JPanel defaultShadowWidthPanel = new JPanel(new FlowLayout( @@ -229,6 +234,14 @@ */ showSingularMultiplicities.setSelected(Configuration.getBoolean( Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES, true)); + /* + * The next one defaults to TRUE, despite that this is + * NOT compatible with older ArgoUML versions + * (before 0.28?) that did + * not have this setting - see issue 535 + */ + hideBidirectionalArrows.setSelected(Configuration.getBoolean( + Notation.KEY_HIDE_BIDIRECTIONAL_ARROWS, true)); defaultShadowWidth.setSelectedIndex(Configuration.getInteger( Notation.KEY_DEFAULT_SHADOW_WIDTH, 1)); } @@ -249,6 +262,8 @@ showStereotypes.setSelected(ps.getShowStereotypesValue()); showSingularMultiplicities.setSelected( ps.getShowSingularMultiplicitiesValue()); + hideBidirectionalArrows.setSelected( + ps.getHideBidirectionalArrowsValue()); defaultShadowWidth.setSelectedIndex( ps.getDefaultShadowWidthValue()); } @@ -291,6 +306,8 @@ showStereotypes.isSelected()); Configuration.setBoolean(Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES, showSingularMultiplicities.isSelected()); + Configuration.setBoolean(Notation.KEY_HIDE_BIDIRECTIONAL_ARROWS, + hideBidirectionalArrows.isSelected()); Configuration.setInteger(Notation.KEY_DEFAULT_SHADOW_WIDTH, defaultShadowWidth.getSelectedIndex()); } @@ -311,6 +328,7 @@ ps.setShowSingularMultiplicities( showSingularMultiplicities.isSelected()); ps.setDefaultShadowWidth(defaultShadowWidth.getSelectedIndex()); + ps.setHideBidirectionalArrows(hideBidirectionalArrows.isSelected()); } } @@ -347,6 +365,8 @@ Notation.KEY_SHOW_STEREOTYPES)); showSingularMultiplicities.setSelected(Configuration.getBoolean( Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES)); + hideBidirectionalArrows.setSelected(Configuration.getBoolean( + Notation.KEY_HIDE_BIDIRECTIONAL_ARROWS, true)); defaultShadowWidth.setSelectedIndex(Configuration.getInteger( Notation.KEY_DEFAULT_SHADOW_WIDTH, 1)); } Modified: trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java&p2=trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java (original) +++ trunk/src/argouml-app/src/org/argouml/persistence/ArgoParser.java 2008-08-26 10:39:31-0700 @@ -237,6 +237,9 @@ case ArgoTokenTable.TOKEN_SHOWASSOCIATIONNAMES: handleShowAssociationNames(e); break; + case ArgoTokenTable.TOKEN_HIDEBIDIRECTIONALARROWS: + handleHideBidirectionalArrows(e); + break; case ArgoTokenTable.TOKEN_ACTIVE_DIAGRAM: handleActiveDiagram(e); break; @@ -469,6 +472,15 @@ ps.setShowAssociationNames(showAssociationNames); } + /** + * @param e the element + */ + protected void handleHideBidirectionalArrows(XMLElement e) { + String hideBidirectionalArrows = e.getText().trim(); + ps.setHideBidirectionalArrows(hideBidirectionalArrows); + } + + protected void handleActiveDiagram(XMLElement e) { /* At this stage during loading, the diagrams are * not created yet - so we have to store this name for later use. */ Modified: trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java&p2=trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java (original) +++ trunk/src/argouml-app/src/org/argouml/persistence/ArgoTokenTable.java 2008-08-26 10:39:31-0700 @@ -67,6 +67,8 @@ private static final String STRING_SHOWSTEREOTYPES = "showstereotypes"; private static final String STRING_SHOWSINGULARMULTIPLICITIES = "showsingularmultiplicities"; + private static final String STRING_HIDEBIDIRECTIONALARROWS + = "hidebidirectionalarrows"; private static final String STRING_DEFAULTSHADOWWIDTH = "defaultshadowwidth"; private static final String STRING_FONTNAME = "fontname"; @@ -129,6 +131,8 @@ /** A token for Notation Settings **/ public static final int TOKEN_SHOWSINGULARMULTIPLICITIES = 26; + public static final int TOKEN_HIDEBIDIRECTIONALARROWS = 27; + /** The token for undefined. */ public static final int TOKEN_UNDEFINED = 99; @@ -154,6 +158,7 @@ addToken(STRING_USEGUILLEMOTS, Integer.valueOf(TOKEN_USEGUILLEMOTS)); addToken(STRING_SHOWVISIBILITY, Integer.valueOf(TOKEN_SHOWVISIBILITY)); addToken(STRING_SHOWMULTIPLICITY, Integer.valueOf(TOKEN_SHOWMULTIPLICITY)); + addToken(STRING_HIDEBIDIRECTIONALARROWS, Integer.valueOf(TOKEN_HIDEBIDIRECTIONALARROWS)); addToken(STRING_SHOWINITIALVALUE, Integer.valueOf(TOKEN_SHOWINITIALVALUE)); addToken(STRING_SHOWPROPERTIES, Integer.valueOf(TOKEN_SHOWPROPERTIES)); addToken(STRING_SHOWTYPES, Integer.valueOf(TOKEN_SHOWTYPES)); Modified: trunk/src/argouml-app/src/org/argouml/persistence/argo.tee Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/argo.tee?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/persistence/argo.tee&p2=trunk/src/argouml-app/src/org/argouml/persistence/argo.tee&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/persistence/argo.tee (original) +++ trunk/src/argouml-app/src/org/argouml/persistence/argo.tee 2008-08-26 10:39:31-0700 @@ -65,6 +65,7 @@ <showstereotypes><ocl>self.projectSettings.showStereotypes</ocl></showstereotypes> <showsingularmultiplicities><ocl>self.projectSettings.showSingularMultiplicities</ocl></showsingularmultiplicities> <defaultshadowwidth><ocl>self.projectSettings.defaultShadowWidth</ocl></defaultshadowwidth> + <hidebidirectionalarrows><ocl>self.projectSettings.hideBidirectionalArrows</ocl></hidebidirectionalarrows> <fontname><ocl>self.projectSettings.fontName</ocl></fontname> <fontsize><ocl>self.projectSettings.fontSize</ocl></fontsize> <defaultstereotypeview><ocl>self.projectSettings.defaultStereotypeView</ocl></defaultstereotypeview> Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&rev=15611&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java&r1=15610&r2=15611 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java (original) +++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java 2008-08-26 10:39:31-0700 @@ -44,6 +44,7 @@ import org.argouml.i18n.Translator; import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; +import org.argouml.kernel.ProjectSettings; import org.argouml.model.AddAssociationEvent; import org.argouml.model.AttributeChangeEvent; import org.argouml.model.Model; @@ -69,17 +70,6 @@ */ public class FigAssociation extends FigEdgeModelElement { - /** - * We suppress the arrow heads if both ends of an association - * are navigable. This means that we support presentation option 3 - * for Association Ends from the UML standard. <p> - * - * If this member is set to false, then we have presentation option 1. - * <p> - * TODO: See issue 535: make this a user setting. - */ - private static final boolean SUPPRESS_BIDIRECTIONAL_ARROWS = true; - private static final Logger LOG = Logger.getLogger(FigAssociation.class); /** @@ -275,7 +265,10 @@ int sourceArrowType = srcGroup.getArrowType(); int destArrowType = destGroup.getArrowType(); - if (SUPPRESS_BIDIRECTIONAL_ARROWS + Project p = ProjectManager.getManager().getCurrentProject(); + ProjectSettings ps = p.getProjectSettings(); + + if (ps.getHideBidirectionalArrowsValue() && sourceArrowType > 2 && destArrowType > 2) { sourceArrowType -= 3; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
