Author: mvw
Date: 2008-02-28 14:33:11-0800
New Revision: 14164
Modified:
trunk/src/app/src/org/argouml/kernel/Project.java
trunk/src/app/src/org/argouml/kernel/ProjectImpl.java
trunk/src/app/src/org/argouml/persistence/ArgoParser.java
trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java
trunk/src/app/src/org/argouml/persistence/argo.tee
trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java
Log:
Fix for issue 3208: Selection of default diagram after load.
This works by storing the name of the diagram in the project.
Modified: trunk/src/app/src/org/argouml/kernel/Project.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/kernel/Project.java?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/kernel/Project.java&p2=trunk/src/app/src/org/argouml/kernel/Project.java&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/kernel/Project.java (original)
+++ trunk/src/app/src/org/argouml/kernel/Project.java 2008-02-28 14:33:11-0800
@@ -610,7 +610,11 @@
public void setVetoSupport(VetoableChangeSupport theVetoSupport);
/**
- * Get the current viewed diagram.
+ * Get the current viewed diagram. <p>
+ *
+ * Used by "argo.tee" to save the name
+ * of this diagram, so that the same diagram
+ * can be initially shown when reloading this project..
*
* @return the current viewed diagram
*/
@@ -620,6 +624,12 @@
* @param theDiagram the ArgoDiagram
*/
public void setActiveDiagram(final ArgoDiagram theDiagram);
+
+ /**
+ * @param diagramName the name of the diagram to show
+ * by default after loading
+ */
+ public void setSavedDiagramName(String diagramName);
/**
* Remove the project.
Modified: trunk/src/app/src/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/kernel/ProjectImpl.java?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/kernel/ProjectImpl.java&p2=trunk/src/app/src/org/argouml/kernel/ProjectImpl.java&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/kernel/ProjectImpl.java (original)
+++ trunk/src/app/src/org/argouml/kernel/ProjectImpl.java 2008-02-28 14:33:11-0800
@@ -136,6 +136,9 @@
* The active diagram, pointer to a diagram in the list with diagrams.
*/
private ArgoDiagram activeDiagram;
+
+ /** The name of the diagram to show by default after loading a project. */
+ private String savedDiagramName;
/**
* Cache for the default model.
@@ -762,10 +765,19 @@
public Object getInitialTarget() {
+ if (savedDiagramName != null) {
+ /* Hence, a diagram name was saved in the project
+ * that we are loading. So, we use this name
+ * to retrieve any matching diagram. */
+ return getDiagram(savedDiagramName);
+ }
if (diagrams.size() > 0) {
+ /* Use the first diagram. */
return diagrams.get(0);
}
if (models.size() > 0) {
+ /* If there was no diagram at all,
+ * then use the (first) UML model. */
return models.iterator().next();
}
return null;
@@ -1093,7 +1105,10 @@
public void setActiveDiagram(final ArgoDiagram theDiagram) {
activeDiagram = theDiagram;
}
-
+
+ public void setSavedDiagramName(String diagramName) {
+ savedDiagramName = diagramName;
+ }
public void remove() {
for (ArgoDiagram diagram : diagrams) {
@@ -1134,6 +1149,7 @@
currentNamespace = null;
vetoSupport = null;
activeDiagram = null;
+ savedDiagramName = null;
emptyTrashCan();
}
Modified: trunk/src/app/src/org/argouml/persistence/ArgoParser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/persistence/ArgoParser.java?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/persistence/ArgoParser.java&p2=trunk/src/app/src/org/argouml/persistence/ArgoParser.java&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/persistence/ArgoParser.java (original)
+++ trunk/src/app/src/org/argouml/persistence/ArgoParser.java 2008-02-28 14:33:11-0800
@@ -238,6 +238,9 @@
case ArgoTokenTable.TOKEN_SHOWASSOCIATIONNAMES:
handleShowAssociationNames(e);
break;
+ case ArgoTokenTable.TOKEN_ACTIVE_DIAGRAM:
+ handleActiveDiagram(e);
+ break;
default:
if (DBG) {
LOG.warn("WARNING: unknown end tag:" + e.getName());
@@ -465,6 +468,12 @@
ps.setShowAssociationNames(showAssociationNames);
}
+ 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. */
+ project.setSavedDiagramName(e.getText().trim());
+ }
+
/**
* Get the number of diagram members read.
* @return the number of diagram members read.
Modified: trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java&p2=trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java (original)
+++ trunk/src/app/src/org/argouml/persistence/ArgoTokenTable.java 2008-02-28 14:33:11-0800
@@ -26,7 +26,7 @@
/**
- * These strings are saved in the final output in a zargo.
+ * These strings are used in the final output in a zargo.
*
* @author Jim Holt
*/
@@ -42,6 +42,7 @@
////////////////////////////////////////////////////////////////
// constants
+ /* These strings match the XML element names in the argo.tee exactly. */
private static final String STRING_ARGO = "argo";
private static final String STRING_AUTHORNAME = "authorname";
private static final String STRING_AUTHOREMAIL = "authoremail";
@@ -70,6 +71,7 @@
private static final String STRING_FONTSIZE = "fontsize";
private static final String STRING_GENERATION_OUTPUT_DIR
= "generationoutputdir";
+ private static final String STRING_ACTIVE_DIAGRAM = "activediagram";
/** The token for argo. */
public static final int TOKEN_ARGO = 1;
@@ -120,6 +122,8 @@
public static final int TOKEN_GENERATION_OUTPUT_DIR = 23;
/** A token for Generation Settings. */
public static final int TOKEN_SHOWASSOCIATIONNAMES = 24;
+ /** A token for the active diagram name **/
+ public static final int TOKEN_ACTIVE_DIAGRAM = 25;
/** The token for undefined. */
public static final int TOKEN_UNDEFINED = 99;
@@ -158,6 +162,8 @@
Integer.valueOf(TOKEN_GENERATION_OUTPUT_DIR));
addToken(STRING_SHOWASSOCIATIONNAMES,
Integer.valueOf(TOKEN_SHOWASSOCIATIONNAMES));
+ addToken(STRING_ACTIVE_DIAGRAM,
+ Integer.valueOf(TOKEN_ACTIVE_DIAGRAM));
}
} /* end class ArgoTokenTable */
Modified: trunk/src/app/src/org/argouml/persistence/argo.tee
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/persistence/argo.tee?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/persistence/argo.tee&p2=trunk/src/app/src/org/argouml/persistence/argo.tee&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/persistence/argo.tee (original)
+++ trunk/src/app/src/org/argouml/persistence/argo.tee 2008-02-28 14:33:11-0800
@@ -69,6 +69,7 @@
<fontsize><ocl>self.projectSettings.fontSize</ocl></fontsize>
<defaultstereotypeview><ocl>self.projectSettings.defaultStereotypeView</ocl></defaultstereotypeview>
<generationoutputdir><ocl>self.projectSettings.generationOutputDir</ocl></generationoutputdir>
+ <activediagram><ocl>self.activeDiagram.name</ocl></activediagram>
</settings>
<searchpath href="<ocl>self.searchPathList</ocl>" />
Modified: trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java?view=diff&rev=14164&p1=trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java&p2=trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java&r1=14163&r2=14164
==============================================================================
--- trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java (original)
+++ trunk/src/app/src/org/argouml/uml/diagram/ArgoDiagram.java 2008-02-28 14:33:11-0800
@@ -316,6 +316,8 @@
public void add(Fig f);
/**
+ * Used by "argo.tee".
+ *
* @return the name of the diagram
* @see org.tigris.gef.base.Diagram#getName()
*/
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.