Author: penyaskito
Date: 2008-04-08 07:29:51-0700
New Revision: 14304
Added:
trunk/src/argouml-core-diagrams-sequence2/
trunk/src/argouml-core-diagrams-sequence2/.classpath
trunk/src/argouml-core-diagrams-sequence2/.project
trunk/src/argouml-core-diagrams-sequence2/.settings/
trunk/src/argouml-core-diagrams-sequence2/.settings/de.mvmsoft.checkclipse.prefs
trunk/src/argouml-core-diagrams-sequence2/.settings/org.eclipse.jdt.core.prefs
trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2 tests.launch
trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2.launch
trunk/src/argouml-core-diagrams-sequence2/src/
trunk/src/argouml-core-diagrams-sequence2/src/.settings/
trunk/src/argouml-core-diagrams-sequence2/src/.settings/org.eclipse.jdt.ui.prefs
trunk/src/argouml-core-diagrams-sequence2/src/META-INF/
trunk/src/argouml-core-diagrams-sequence2/src/META-INF/MANIFEST.MF
trunk/src/argouml-core-diagrams-sequence2/src/org/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/Images/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/Images/buttonbroommessages.gif (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/i18n/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/i18n/button.properties (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSequenceDiagram.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSetAddMessageMode.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/SequenceDiagramGraphModel.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramFactory.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ActionAddClassifierRole.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigActivation.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigDestroy.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigHead.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigLifeLine.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessage.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageComparator.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageSpline.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeBroomMessages.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModePlaceClassifierRole.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SelectionMessage.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/UMLSequenceDiagram.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/
trunk/src/argouml-core-diagrams-sequence2/tests/org/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/model/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/model/InitializeModel.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramFactory.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramModule.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigClassifierRole.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigMessageSpline.java (contents, props changed)
trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestUMLSequenceDiagram.java (contents, props changed)
Log:
Committing the sequence2 diagram module.
Added: trunk/src/argouml-core-diagrams-sequence2/.classpath
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/.classpath?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/.classpath 2008-04-08 07:29:51-0700
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="tests"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/argouml-core-model"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/argouml-core-model-mdr"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/argouml-core-tools"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/argouml-app"/>
+ <classpathentry kind="src" path="/argouml-core-infra"/>
+ <classpathentry kind="lib" path="/argouml-app/lib/toolbar-1.4.1-20071227.jar" sourcepath="/toolbar/src"/>
+ <classpathentry kind="lib" path="/argouml-core-infra/lib/log4j-1.2.6.jar"/>
+ <classpathentry kind="output" path="build-eclipse"/>
+</classpath>
Added: trunk/src/argouml-core-diagrams-sequence2/.project
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/.project?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/.project 2008-04-08 07:29:51-0700
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>argouml-core-diagrams-sequence2</name>
+ <comment></comment>
+ <projects>
+ <project>argouml</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>de.mvmsoft.checkclipse.CheckclipseBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>de.mvmsoft.checkclipse.CheckclipseNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/src/argouml-core-diagrams-sequence2/.settings/de.mvmsoft.checkclipse.prefs
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/.settings/de.mvmsoft.checkclipse.prefs?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/.settings/de.mvmsoft.checkclipse.prefs 2008-04-08 07:29:51-0700
@@ -0,0 +1,4 @@
+#Mon Apr 16 04:15:54 CEST 2007
+filenames.properties=/argouml-core-tools/checkstyle/checkstyle.properties
+enabled=true
+filenames.config=/argouml-core-tools/checkstyle/checkstyle_argouml.xml
Added: trunk/src/argouml-core-diagrams-sequence2/.settings/org.eclipse.jdt.core.prefs
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/.settings/org.eclipse.jdt.core.prefs?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/.settings/org.eclipse.jdt.core.prefs 2008-04-08 07:29:51-0700
@@ -0,0 +1,66 @@
+#Thu Oct 11 04:26:20 EDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2 tests.launch
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/ArgoUML%20sequence2%20tests.launch?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2 tests.launch 2008-04-08 07:29:51-0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/argouml-core-diagrams-sequence2"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=argouml-core-diagrams-sequence2/tests"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="argouml-core-diagrams-sequence2"/>
+</launchConfiguration>
Added: trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2.launch
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/ArgoUML%20sequence2.launch?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/ArgoUML sequence2.launch 2008-04-08 07:29:51-0700
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/argouml-app/src/org/argouml/application/Main.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="argouml" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-diagrams-sequence2" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-app" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/antlrall-2.7.2.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/commons-logging-1.0.2.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/toolbar-1.4.1-20071227.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/gef-0.12.4BETA.jar" path="3" sourceAttachmentPath="/gef/src" sourceRootPath="" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/ocl-argo-1.1.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-app/lib/swidgets-0.1.4.jar" path="3" sourceAttachmentPath="/swidgets/src" sourceRootPath="" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-infra" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-infra/lib/log4j-1.2.6.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-tools" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-tools/junit-3.8.2/junit.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-tools/lib/easymock12.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-tools/apache-ant-1.7.0/lib/ant.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-tools/checkstyle-4.3/commons-logging.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-model" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-model-euml" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.common_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.ecore_2.3.1.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.ecore.change_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.ecore.change.edit_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.ecore.edit_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.ecore.xmi_2.3.1.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.edit_2.3.1.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.mapping_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/emf/org.eclipse.emf.mapping.ecore2xml_2.3.0.v200708072030.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/uml2/org.eclipse.uml2.common_1.3.1.v200707311200.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/uml2/org.eclipse.uml2.common.edit_1.3.0.v200706251652.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/uml2/org.eclipse.uml2.uml_2.1.1.v200707311200.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/uml2/org.eclipse.uml2.uml.edit_2.1.0.v200706251652.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-euml/lib/uml2/org.eclipse.uml2.uml.resources_2.1.0.v200706251652.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="argouml-core-model-mdr" type="1"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/jmi.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/jmiutils.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/mdrapi.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/mof.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/nbmdr.jar" path="3" type="2"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/argouml-core-model-mdr/lib/openide-util.jar" path="3" type="2"/> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.argouml.application.Main"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="argouml-core-diagrams-sequence2"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx400M -ea -Dlog4j.configuration=org/argouml/resource/info_console.lcf -Dargouml.modules=org.argouml.uml.diagram.sequence2.module.SequenceDiagramModule"/>
+</launchConfiguration>
Added: trunk/src/argouml-core-diagrams-sequence2/src/.settings/org.eclipse.jdt.ui.prefs
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/.settings/org.eclipse.jdt.ui.prefs?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/.settings/org.eclipse.jdt.ui.prefs 2008-04-08 07:29:51-0700
@@ -0,0 +1,3 @@
+#Sun Apr 15 03:41:15 CEST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
Added: trunk/src/argouml-core-diagrams-sequence2/src/META-INF/MANIFEST.MF
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/META-INF/MANIFEST.MF?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/META-INF/MANIFEST.MF 2008-04-08 07:29:51-0700
@@ -0,0 +1,12 @@
+Manifest-Version: 2.0
+Class-Path: argouml.jar
+Created-By: 1.2 (Sun Microsystems Inc.)
+
+Name: org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.class
+Extension-name: org.argouml.uml.diagram.sequence2.module.SequenceDiagramModule
+Specification-Title: Sequence Diagram Module
+Specification-Version: 0.1
+Specification-Vendor: ArgoUML Team
+Implementation-Title: Sequence Diagram Module
+Implementation-Version: 0.1
+Implementation-Vendor: ArgoUML Team
\ No newline at end of file
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/Images/buttonbroommessages.gif
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/Images/buttonbroommessages.gif?view=auto&rev=14304
==============================================================================
Binary file. No diff available.
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/i18n/button.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/i18n/button.properties?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/i18n/button.properties 2008-04-08 07:29:51-0700
@@ -0,0 +1,27 @@
+# $Id: button.properties 97 2007-07-29 00:45:28Z penyaskito $
+# Copyright (c) 2003-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.
+#
+# Keys in alphabetical order.
+#
+button.broom-messages = Broom Messages
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSequenceDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSequenceDiagram.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSequenceDiagram.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,66 @@
+// $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.sequence2;
+
+import org.apache.log4j.Logger;
+import org.argouml.uml.diagram.ArgoDiagram;
+import org.argouml.uml.diagram.sequence2.module.SequenceDiagramFactory;
+import org.argouml.uml.diagram.sequence2.ui.UMLSequenceDiagram;
+import org.argouml.uml.ui.ActionNewDiagram;
+
+/**
+ * This action creates a new Sequence Diagram.
+ * @author penyaskito
+ */
+
+public class ActionSequenceDiagram extends ActionNewDiagram {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(ActionSequenceDiagram.class);
+
+
+ /**
+ * Constructor.
+ */
+ public ActionSequenceDiagram() {
+ super("action.sequence-diagram");
+ }
+
+ /*
+ * Creates a Sequence Diagram
+ * @return The new Sequence Diagram.
+ * @see org.argouml.uml.ui.ActionNewDiagram#createDiagram()
+ */
+ @Override
+ protected ArgoDiagram createDiagram(Object namespace) {
+ LOG.debug("Creating Sequence Diagram");
+ Object c = createCollaboration(namespace);
+ return SequenceDiagramFactory.getInstance().createDiagram(
+ UMLSequenceDiagram.class, c, c);
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSetAddMessageMode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSetAddMessageMode.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ActionSetAddMessageMode.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,50 @@
+// $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.sequence2;
+
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.sequence2.ui.ModeCreateMessage;
+import org.argouml.uml.diagram.ui.ActionSetMode;
+
+/**
+ * An extension of ActionSetMode to set the parameters for an association.
+ *
+ * @author Bob Tarling
+ */
+public class ActionSetAddMessageMode extends ActionSetMode {
+
+ /**
+ * Construct a new ActionSetAddMessageMode<p>
+ *
+ * @param action the UML meta type of the UML action to associate
+ * to the new message
+ * @param name the i18n code for the action name
+ */
+ public ActionSetAddMessageMode(Object action, String name) {
+ super(ModeCreateMessage.class, "edgeClass",
+ Model.getMetaTypes().getMessage(), name);
+ modeArgs.put("action", action);
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/SequenceDiagramGraphModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/SequenceDiagramGraphModel.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/SequenceDiagramGraphModel.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,430 @@
+// $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.sequence2;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.uml.CommentEdge;
+import org.argouml.uml.diagram.UMLMutableGraphSupport;
+import org.tigris.gef.base.Editor;
+import org.tigris.gef.base.Globals;
+import org.tigris.gef.base.Mode;
+import org.tigris.gef.base.ModeManager;
+import org.tigris.gef.graph.MutableGraphModel;
+
+/**
+ * The sequence graph model is the bridge between the UML meta-model
+ * representation of the design and the graph model of GEF.
+ * @author penyaskito
+ */
+public class SequenceDiagramGraphModel extends UMLMutableGraphSupport implements
+ VetoableChangeListener, PropertyChangeListener, MutableGraphModel {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(SequenceDiagramGraphModel.class);
+
+ /**
+ * The collaboration this sequence diagram belongs too.
+ */
+ private Object collaboration;
+
+ /**
+ * The interaction that is shown on the sequence diagram.
+ */
+ private Object interaction;
+
+ /**
+ * State for actions in sequence diagram.
+ */
+ private Object defaultState;
+
+ /**
+ * State machine for default state.
+ */
+ private Object defaultStateMachine;
+
+
+
+ /**
+ * Default constructor. Constructs a model and a collaboration in
+ * the root of the current project.
+ */
+ public SequenceDiagramGraphModel() {
+ super();
+ // TODO: Auto-generated constructor stub
+ }
+
+ /**
+ * @param element The Fig that we want his available ports.
+ * @return The available ports for a given element
+ * @see org.tigris.gef.graph.GraphModel#getPorts(java.lang.Object)
+ */
+ public List getPorts(Object element) {
+ List ports = new LinkedList();
+ // if is a classifier role, it must return all the related messages.
+ if (Model.getFacade().isAClassifierRole(element)) {
+ ports.addAll(Model.getFacade().getReceivedMessages(element));
+ ports.addAll(Model.getFacade().getSentMessages(element));
+ }
+ // if is a message, it must return the sender
+ // and the receiver of the message.
+ else if (Model.getFacade().isAMessage(element)) {
+ ports.add(Model.getFacade().getSender(element));
+ ports.add(Model.getFacade().getReceiver(element));
+ }
+ return ports;
+ }
+
+ /**
+ * @param element
+ * @return The outcoming edges.
+ * @see org.tigris.gef.graph.GraphModel#getInEdges(java.lang.Object)
+ */
+ public List getInEdges(Object element) {
+ List ports = new LinkedList();
+ // If is a classifier role, it must return the sent messages.
+ // In other cases, returns an empty list.
+ // TODO: Must be the incoming messages or the sent ones?
+ if (Model.getFacade().isAClassifierRole(element)) {
+ ports.addAll(Model.getFacade().getSentMessages(element));
+ }
+ return ports;
+ }
+
+ /**
+ * @param element
+ * @return The incoming edges.
+ * @see org.tigris.gef.graph.GraphModel#getOutEdges(java.lang.Object)
+ */
+ public List getOutEdges(Object element) {
+ List ports = new LinkedList();
+ // If is a classifier role, it must return the received messages.
+ // In other cases, returns an empty list.
+ // TODO: Must be the outgoing messages or the received ones?
+ if (Model.getFacade().isAClassifierRole(element)) {
+ ports.addAll(Model.getFacade().getReceivedMessages(element));
+ }
+ return ports;
+ }
+
+ /**
+ * @param port
+ * @return
+ * @see org.tigris.gef.graph.BaseGraphModel#getOwner(java.lang.Object)
+ */
+ public Object getOwner(Object port) {
+ return port;
+ }
+
+ /**
+ * Gets the collaboration that is shown on the sequence diagram.<p>
+ *
+ * @return the collaboration of the diagram.
+ */
+ public Object getCollaboration() {
+ if (collaboration == null) {
+ collaboration =
+ Model.getCollaborationsFactory().buildCollaboration(
+ ProjectManager.getManager().getCurrentProject()
+ .getRoot());
+ }
+
+ return collaboration;
+ }
+
+ /**
+ * Sets the collaboration that is shown at the sequence diagram.
+ * @param c the collaboration
+ */
+ public void setCollaboration(Object c) {
+ collaboration = c;
+ Collection interactions = Model.getFacade().getInteractions(c);
+ if (!interactions.isEmpty()) {
+ interaction = interactions.iterator().next();
+ }
+ }
+
+ /**
+ * Gets the interaction that is shown on the sequence diagram.
+ * @return the interaction of the diagram.
+ */
+ private Object getInteraction() {
+ if (interaction == null) {
+ interaction =
+ Model.getCollaborationsFactory().buildInteraction(
+ collaboration);
+ LOG.debug("Interaction built.");
+ Model.getPump().addModelEventListener(this, interaction);
+ }
+ return interaction;
+ }
+
+ /*
+ * @see org.tigris.gef.graph.MutableGraphModel#canAddNode(java.lang.Object)
+ */
+ public boolean canAddNode(Object node) {
+ if (node == null) {
+ return false;
+ }
+ return !getNodes().contains(node)
+ && Model.getFacade().isAModelElement(node)
+ && Model.getFacade().getNamespace(node) == getCollaboration();
+ }
+
+ /*
+ * @see org.tigris.gef.graph.MutableGraphModel#canAddEdge(java.lang.Object)
+ */
+ public boolean canAddEdge(Object edge) {
+ if (edge == null) {
+ return false;
+ }
+
+ if (getEdges().contains(edge)) {
+ return false;
+ }
+
+ Object end0 = null;
+ Object end1 = null;
+
+ if (Model.getFacade().isAMessage(edge)) {
+ end0 = Model.getFacade().getSender(edge);
+ end1 = Model.getFacade().getReceiver(edge);
+ } else if (edge instanceof CommentEdge) {
+ end0 = ((CommentEdge) edge).getSource();
+ end1 = ((CommentEdge) edge).getDestination();
+ } else {
+ return false;
+ }
+
+ // Both ends must be defined and nodes that are on the graph already.
+ if (end0 == null || end1 == null) {
+ LOG.error("Edge rejected. Its ends are not attached to anything");
+ return false;
+ }
+
+ if (!containsNode(end0) && !containsEdge(end0)) {
+ LOG.error("Edge rejected. Its source end is attached to "
+ + end0
+ + " but this is not in the graph model");
+ return false;
+ }
+ if (!containsNode(end1) && !containsEdge(end1)) {
+ LOG.error("Edge rejected. Its destination end is attached to "
+ + end1
+ + " but this is not in the graph model");
+ return false;
+ }
+
+ return true;
+ }
+
+ /*
+ * @see org.tigris.gef.graph.MutableGraphModel#addNode(java.lang.Object)
+ */
+ public void addNode(Object node) {
+ if (canAddNode(node)) {
+ getNodes().add(node);
+ fireNodeAdded(node);
+ }
+ }
+
+
+ public void vetoableChange(PropertyChangeEvent pce)
+ throws PropertyVetoException {
+ // TODO: Auto-generated method stub
+
+ }
+
+ public void propertyChange(PropertyChangeEvent pce) {
+ // TODO: Auto-generated method stub
+
+ }
+
+ /**
+ * Creates a link based on the given from and toPort. The fromPort
+ * should allways point to a MessageCoordinates instance. The toPort
+ * can point to a MessageCoordinates instance or to a Object
+ * instance. On a sequence diagram you can only draw Messages. So
+ * other edgeClasses then links are not supported.
+ *
+ * @see org.tigris.gef.graph.MutableGraphModel#connect(
+ * Object, Object, Class)
+ */
+ public Object connect(Object fromPort, Object toPort, Object edgeType) {
+ if (!canConnect(fromPort, toPort, edgeType)) {
+ return null;
+ }
+ if (edgeType == CommentEdge.class) {
+ return super.connect(fromPort, toPort, edgeType);
+ }
+ Object edge = null;
+ Object action = null;
+ Editor curEditor = Globals.curEditor();
+ ModeManager modeManager = curEditor.getModeManager();
+ Mode mode = modeManager.top();
+ Hashtable args = mode.getArgs();
+ Object actionType = args.get("action");
+ return connect(fromPort, toPort, edgeType, actionType);
+ }
+
+ /**
+ * Creates a link based on the given from and toPort. The fromPort
+ * should allways point to a MessageCoordinates instance. The toPort
+ * can point to a MessageCoordinates instance or to a Object
+ * instance. On a sequence diagram you can only draw Messages. So
+ * other edgeClasses then links are not supported.
+ *
+ * @see org.tigris.gef.graph.MutableGraphModel#connect(
+ * Object, Object, Class)
+ */
+ public Object connect(Object fromPort, Object toPort, Object edgeType, Object actionType) {
+ Object edge = null;
+ Object action = null;
+ if (Model.getMetaTypes().getCallAction().equals(actionType)) {
+ action = Model.getCommonBehaviorFactory().createCallAction();
+ } else if (Model.getMetaTypes().getCreateAction()
+ .equals(actionType)) {
+ action = Model.getCommonBehaviorFactory().createCreateAction();
+ } else if (Model.getMetaTypes().getReturnAction()
+ .equals(actionType)) {
+ action = Model.getCommonBehaviorFactory().createReturnAction();
+ } else if (Model.getMetaTypes().getDestroyAction()
+ .equals(actionType)) {
+ action = Model.getCommonBehaviorFactory().createDestroyAction();
+ } else if (Model.getMetaTypes().getSendAction()
+ .equals(actionType)) {
+ // no implementation, not of importance to sequence diagrams
+ } else if (Model.getMetaTypes().getTerminateAction()
+ .equals(actionType)) {
+ // not implemented yet
+ }
+ if (fromPort != null && toPort != null && action != null) {
+ Object associationRole =
+ Model.getCollaborationsHelper().getAssociationRole(
+ fromPort,
+ toPort);
+ if (associationRole == null) {
+ associationRole =
+ Model.getCollaborationsFactory().buildAssociationRole(
+ fromPort, toPort);
+ }
+
+ Object message =
+ Model.getCollaborationsFactory().buildMessage(
+ getInteraction(),
+ associationRole);
+ if (action != null) {
+ Model.getCollaborationsHelper().setAction(message, action);
+ Model.getStateMachinesHelper().setDoActivity(
+ Model.getStateMachinesFactory().buildSimpleState(
+ getDefaultState()),
+ action);
+ }
+ Model.getCollaborationsHelper()
+ .setSender(message, fromPort);
+ Model.getCommonBehaviorHelper()
+ .setReceiver(message, toPort);
+
+ addEdge(message);
+ edge = message;
+ }
+ if (edge == null) {
+ LOG.debug("Incorrect edge");
+ }
+ return edge;
+
+ }
+
+ /*
+ * @see org.tigris.gef.graph.MutableGraphModel#addEdge(java.lang.Object)
+ */
+ public void addEdge(Object edge) {
+ if (canAddEdge(edge)) {
+ getEdges().add(edge);
+ fireEdgeAdded(edge);
+ }
+ }
+
+
+
+ private Object getDefaultStateMachine() {
+ if (defaultStateMachine == null) {
+ Object clsfr =
+ Model.getFacade().getRepresentedClassifier(getCollaboration());
+ if (clsfr == null) {
+ Object oper = Model.getFacade().getRepresentedOperation(
+ getCollaboration());
+ if (oper != null) clsfr = Model.getFacade().getOwner(oper);
+ }
+ if (clsfr == null) {
+ Object ns = Model.getFacade().getNamespace(getCollaboration());
+ clsfr = Model.getCoreFactory().buildClass(ns);
+ }
+ if (clsfr == null) {
+ throw new IllegalStateException("Can not create a Classifier");
+ }
+ Collection c = Model.getFacade().getOwnedElements(clsfr);
+ Iterator it = c.iterator();
+ while (it.hasNext()) {
+ Object child = it.next();
+ if (Model.getFacade().isAStateMachine(child)) {
+ defaultStateMachine = child;
+ break;
+ }
+ }
+ if (defaultStateMachine == null) {
+ defaultStateMachine =
+ Model.getStateMachinesFactory().buildStateMachine(clsfr);
+ Model.getStateMachinesFactory()
+ .buildCompositeStateOnStateMachine(defaultStateMachine);
+ }
+ }
+ return defaultStateMachine;
+ }
+
+ private Object getDefaultState() {
+ if (defaultState == null) {
+ defaultState =
+ Model.getStateMachinesHelper()
+ .getTop(getDefaultStateMachine());
+ }
+ return defaultState;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramFactory.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramFactory.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,124 @@
+// $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.sequence2.module;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.DiDiagram;
+import org.argouml.model.Model;
+import org.argouml.model.SequenceDiagram;
+import org.argouml.uml.diagram.ArgoDiagram;
+import org.argouml.uml.diagram.DiagramFactory;
+import org.argouml.uml.diagram.GraphChangeAdapter;
+import org.argouml.uml.diagram.sequence2.ui.UMLSequenceDiagram;
+
+/**
+ * This factory creates a sequence2 Sequence Diagram if needed, otherwise
+ * it delegates on the ArgoUML core DiagramFactory.
+ * @see org.argouml.uml.diagram.DiagramFactory
+ * @author penyaskito
+ */
+public class SequenceDiagramFactory {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = Logger
+ .getLogger(SequenceDiagramFactory.class);
+
+
+ private static SequenceDiagramFactory diagramFactory =
+ new SequenceDiagramFactory();
+
+ private List<ArgoDiagram> diagrams = new LinkedList<ArgoDiagram>();
+
+ private SequenceDiagramFactory() {
+ }
+
+ /**
+ * @return the singleton
+ */
+ public static SequenceDiagramFactory getInstance() {
+ return diagramFactory;
+ }
+
+ /**
+ * Factory method to create a new instance of an ArgoDiagram,
+ * including the sequence2 Sequence Diagram
+ *
+ * @param type The class of rendering diagram to create
+ * @param namespace The namespace that (in)directly
+ * owns the elements on the diagram
+ * @param machine The StateMachine for the diagram
+ * (only: statemachine - activitygraph)
+ * @return the newly instantiated class diagram
+ */
+ public ArgoDiagram createDiagram(Class type, Object namespace,
+ Object machine) {
+
+ ArgoDiagram diagram = null;
+ Class diType = null;
+
+ if (type == UMLSequenceDiagram.class) {
+ diagram = new UMLSequenceDiagram(namespace);
+ diType = SequenceDiagram.class;
+ LOG.debug("New Sequence Diagram created");
+ }
+ else {
+ // if is not the UML Sequence Diagram, we delegate
+ // on the core DiagramFactory
+ // This method is deprecated, but we'll keep using it
+ // because this code will be deleted with the integration
+ // of sequence diagrams in the trunk of argouml.
+ return DiagramFactory.getInstance().createDiagram(type,
+ namespace, machine);
+ }
+
+
+ if (diagram == null) {
+ throw new IllegalArgumentException ("Unknown diagram type");
+ }
+
+ if (Model.getDiagramInterchangeModel() != null) {
+ diagram.getGraphModel().addGraphEventListener(
+ GraphChangeAdapter.getInstance());
+ /*
+ * The diagram are always owned by the model
+ * in this first implementation.
+ */
+ DiDiagram dd = GraphChangeAdapter.getInstance()
+ .createDiagram(diType, namespace);
+ // ((UMLMutableGraphSupport) diagram.getGraphModel()).
+ // setDiDiagram(dd);
+ }
+
+ //keep a reference on it in the case where we must add all the diagrams
+ //as project members (loading)
+ diagrams.add(diagram);
+ return diagram;
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/module/SequenceDiagramModule.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,113 @@
+// $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.sequence2.module;
+
+import javax.swing.JMenu;
+import javax.swing.JToolBar;
+
+import org.apache.log4j.Logger;
+import org.argouml.moduleloader.ModuleInterface;
+import org.argouml.ui.ProjectBrowser;
+import org.argouml.ui.cmd.GenericArgoMenuBar;
+import org.argouml.uml.diagram.sequence2.ActionSequenceDiagram;
+
+/**
+ * The Sequence Diagram Module description.
+ *
+ * @see org.argouml.moduleloader.ModuleInterface
+ * @author penyaskito
+ */
+public class SequenceDiagramModule implements ModuleInterface {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = Logger
+ .getLogger(SequenceDiagramModule.class);
+
+ private ActionSequenceDiagram newSequence;
+
+ private JMenu menuSequence;
+
+ /**
+ * This is creatable from the module loader.
+ */
+ public SequenceDiagramModule() {
+ super();
+ menuSequence = new JMenu("Sequence Module");
+ newSequence = new ActionSequenceDiagram();
+ menuSequence.add(newSequence);
+ }
+
+ public boolean enable() {
+ // Register into the menu.
+// GenericArgoMenuBar.registerMenuItem(menuSequence);
+// GenericArgoMenuBar.registerCreateDiagramAction(newSequence);
+ // add a element to the toolbar.
+ JToolBar toolbar = ((GenericArgoMenuBar) ProjectBrowser.getInstance()
+ .getJMenuBar()).getCreateDiagramToolbar();
+ toolbar.add(newSequence);
+ toolbar.updateUI();
+
+ LOG.info("SequenceDiagram Module enabled.");
+ return true;
+ }
+
+ public boolean disable() {
+ GenericArgoMenuBar menubar = (GenericArgoMenuBar) ProjectBrowser
+ .getInstance().getJMenuBar();
+ menubar.remove(menuSequence);
+ menubar.updateUI();
+
+ // remove it from the toolbar.
+ JToolBar toolbar = ((GenericArgoMenuBar) ProjectBrowser.getInstance()
+ .getJMenuBar()).getCreateDiagramToolbar();
+ // remove the last one...
+ toolbar.remove(toolbar.getComponentCount() - 1);
+ toolbar.updateUI();
+
+ LOG.info("SequenceDiagram Module disabled.");
+ return true;
+ }
+
+ public String getName() {
+ return "ArgoUML-Sequence";
+ }
+
+ public String getInfo(int type) {
+ switch (type) {
+ case DESCRIPTION:
+ return "The new sequence diagram implementation";
+ case AUTHOR:
+ return "Christian López Espínola";
+ case VERSION:
+ return "0.1";
+ case DOWNLOADSITE:
+ return "http://argouml-sequence.tigris.org";
+ default:
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ActionAddClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ActionAddClassifierRole.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ActionAddClassifierRole.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,83 @@
+// $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.sequence2.ui;
+
+import org.argouml.model.Model;
+import org.argouml.ui.CmdCreateNode;
+import org.argouml.uml.diagram.sequence2.SequenceDiagramGraphModel;
+import org.tigris.gef.base.Editor;
+import org.tigris.gef.base.Globals;
+import org.tigris.gef.base.Mode;
+import org.tigris.gef.graph.GraphFactory;
+import org.tigris.gef.graph.GraphModel;
+
+/**
+ * Action to add an object to a sequence diagram.
+ *
+ * @author penyaskito
+ */
+public class ActionAddClassifierRole extends CmdCreateNode {
+
+ private static final long serialVersionUID = 1824497910678123381L;
+
+ /**
+ * The constructor.
+ */
+ public ActionAddClassifierRole() {
+ super(Model.getMetaTypes().getClassifierRole(),
+ "button.new-classifierrole");
+ }
+
+ @Override
+ protected Mode createMode(String instructions) {
+ return new ModePlaceClassifierRole(this, instructions);
+ }
+
+ /*
+ * @see org.tigris.gef.graph.GraphFactory#makeNode()
+ */
+ public Object makeNode() {
+ Object node = null;
+ Editor ce = Globals.curEditor();
+ GraphModel gm = ce.getGraphModel();
+ if (gm instanceof SequenceDiagramGraphModel) {
+ Object collaboration =
+ ((SequenceDiagramGraphModel) gm).getCollaboration();
+ node =
+ Model.getCollaborationsFactory().buildClassifierRole(
+ collaboration);
+ /*
+ Model.getCoreHelper().setNamespace(
+ node,
+ Model.getFacade().getNamespace( collaboration));
+ */
+ } else {
+ throw new IllegalStateException("Graphmodel is not a "
+ + "sequence diagram graph model");
+ }
+ return node;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigActivation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigActivation.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigActivation.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,83 @@
+// $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.sequence2.ui;
+
+import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigRect;
+
+/**
+ *
+ * @author penyaskito
+ */
+class FigActivation extends FigGroup {
+
+
+ private FigRect rectFig;
+ private FigDestroy destroyFig;
+
+ static final int DEFAULT_HEIGHT = 40;
+ static final int DEFAULT_WIDTH = 20;
+
+ /**
+ * @param x
+ * @param y
+ * @param destroy
+ */
+ public FigActivation(int x, int y, boolean destroy) {
+ rectFig = new FigRect(x - DEFAULT_WIDTH / 2, y,
+ DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ addFig(rectFig);
+ setDestroy(destroy);
+ }
+
+ /**
+ * @param isDestroy
+ */
+ public void setDestroy (boolean isDestroy) {
+ if (isDestroy) {
+ if (destroyFig == null) {
+ destroyFig =
+ new FigDestroy(getX() + DEFAULT_WIDTH / 2,
+ getY() + getHeight());
+ addFig(destroyFig);
+ }
+ }
+ else {
+ if (destroyFig != null) {
+ removeFig(destroyFig);
+ }
+ destroyFig = null;
+ }
+ }
+
+ /**
+ * Checks if ends with a destroy message.
+ * @return true if ends with a destroy message, false otherwise
+ */
+ public boolean isDestroy () {
+ return destroyFig != null;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,359 @@
+// $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.sequence2.ui;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyVetoException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.AddAssociationEvent;
+import org.argouml.model.AttributeChangeEvent;
+import org.argouml.model.Model;
+import org.argouml.model.RemoveAssociationEvent;
+import org.argouml.notation.NotationProvider;
+import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.uml.diagram.ui.FigEmptyRect;
+import org.argouml.uml.diagram.ui.FigNodeModelElement;
+import org.tigris.gef.base.Geometry;
+import org.tigris.gef.presentation.FigEdge;
+import org.tigris.gef.presentation.FigRect;
+import org.tigris.gef.presentation.FigText;
+
+/**
+ * The Fig that represents a Classifier Role
+ * @author penyaskito
+ */
+public class FigClassifierRole extends FigNodeModelElement {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(FigClassifierRole.class);
+
+ /**
+ * The NotationProvider for the ClassifierRole. <p>
+ *
+ * The syntax is for UML is:
+ * <pre>
+ * baselist := [base] [, base]*
+ * classifierRole := [name] [/ role] [: baselist]
+ * </pre></p>
+ *
+ * The <code>name</code> is the Instance name, not used currently.
+ * See ClassifierRoleNotationUml for details.<p>
+ *
+ * This syntax is compatible with the UML 1.4 specification.
+ *
+ */
+ private NotationProvider notationProvider;
+
+ /**
+ * This is an empty rectangle needed to keep the size of the CR.
+ */
+ private FigEmptyRect emptyFig;
+ private FigHead headFig;
+ private FigLifeLine lifeLineFig;
+
+ private int offset = 0;
+
+ /**
+ * Constructor
+ */
+ public FigClassifierRole() {
+ super();
+ setBigPort(new FigClassifierRolePort());
+
+ emptyFig = new FigEmptyRect(getX(), getY(), getWidth(), offset);
+
+ headFig = new FigHead(getStereotypeFig(), getNameFig());
+ headFig.setBounds(getX(), getY() + offset,
+ getWidth(), headFig.getHeight());
+ lifeLineFig = new FigLifeLine(headFig.getX(),
+ getY() + offset + headFig.getHeight());
+
+ addFig(getBigPort());
+ getBigPort().setVisible(false);
+
+ emptyFig.setLineWidth(0);
+
+ addFig(emptyFig);
+ addFig(lifeLineFig);
+ addFig(headFig);
+
+ createActivations();
+ }
+
+ /**
+ * Constructor.
+ * @param node The model element
+ */
+ public FigClassifierRole(Object node) {
+ this();
+ setOwner(node);
+ }
+
+ /*
+ * @see org.argouml.uml.diagram.ui.FigNodeModelElement#initNotationProviders(java.lang.Object)
+ */
+ protected void initNotationProviders(Object own) {
+ super.initNotationProviders(own);
+ if (Model.getFacade().isAClassifierRole(own)) {
+ notationProvider =
+ NotationProviderFactory2.getInstance().getNotationProvider(
+ NotationProviderFactory2.TYPE_CLASSIFIERROLE, own);
+ }
+ }
+
+ /*
+ * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)
+ */
+ protected synchronized void modelChanged(PropertyChangeEvent mee) {
+ super.modelChanged(mee);
+ if (mee instanceof AddAssociationEvent
+ || mee instanceof RemoveAssociationEvent
+ || mee instanceof AttributeChangeEvent) {
+ renderingChanged();
+ updateListeners(getOwner(), getOwner());
+ notationProvider.updateListener(this, getOwner(), mee);
+ damage();
+ }
+ }
+
+ /**
+ * Called after text has been edited directly on the screen.<p>
+ *
+ * @param ft The text that was edited.
+ * @throws PropertyVetoException by the parser
+ * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
+ */
+ protected void textEdited(FigText ft) throws PropertyVetoException {
+ if (ft == getNameFig()) {
+ notationProvider.parse(getOwner(), ft.getText());
+ ft.setText(notationProvider.toString(getOwner(), null));
+ }
+ }
+
+ /*
+ * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)
+ */
+ protected void textEditStarted(FigText ft) {
+ if (ft == getNameFig()) {
+ showHelp(notationProvider.getParsingHelp());
+ }
+ }
+
+ /**
+ * Adjust the fig in the light of some change to the model.<p>
+ *
+ * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText()
+ */
+ protected void updateNameText() {
+ if (notationProvider != null) {
+ getNameFig().setText(notationProvider.toString(getOwner(), null));
+ }
+ }
+
+ protected void setBoundsImpl(final int x, final int y,
+ final int w, final int h) {
+
+ Rectangle oldBounds = getBounds();
+
+ int ww = w;
+ if (ww < headFig.getMinimumSize().width)
+ ww = headFig.getMinimumSize().width;
+
+ updateHeadOffset();
+ emptyFig.setBounds(x, y, ww, offset);
+ headFig.setBounds(x, y + offset, ww, headFig.getMinimumHeight());
+ lifeLineFig.setBounds(x, y + offset + headFig.getHeight(),
+ ww, h - offset - headFig.getHeight());
+ createActivations();
+ // set bounds of big box
+ getBigPort().setBounds(x, y, ww, h);
+
+ calcBounds();
+ updateEdges();
+ firePropChange("bounds", oldBounds, getBounds());
+ }
+
+ /**
+ * Updates the head offset, looking for the create messages.
+ */
+ protected void updateHeadOffset() {
+ FigMessage createMessage = getFirstCreateFigMessage();
+ if (createMessage != null) {
+ int y = createMessage.getFirstPoint().y;
+ if (y > 0)
+ offset = y - headFig.getHeight();
+ } else {
+ offset = 0;
+ }
+ }
+
+ /**
+ * Gets the first create message received by the classifier role
+ * @return a figmessage.
+ */
+ private FigMessage getFirstCreateFigMessage() {
+ List<FigMessage> messages = getCompleteMessages();
+ FigMessage createMessage = null;
+ for (FigMessage message : messages) {
+ if (message.getDestFigNode().equals(this)
+ && Model.getFacade().isACreateAction(message.getAction())) {
+
+ createMessage = message;
+ break;
+ }
+ }
+ return createMessage;
+ }
+
+ @Override
+ public void addFigEdge(FigEdge edge) {
+ super.addFigEdge(edge);
+ if (edge instanceof FigMessage) {
+ FigMessage mess = (FigMessage) edge;
+ if (mess.isSelfMessage()) {
+ mess.convertToArc();
+ }
+ if (equals(mess.getDestFigNode())
+ && !equals(mess.getSourceFigNode())
+ && Model.getFacade().isACreateAction(mess.getAction())) {
+
+ LOG.info("Added a create message");
+ relocate();
+ }
+ }
+ }
+ /**
+ * Return all message edges that are complete (ie the user has finished
+ * drawing).
+ * @return A list with all the messages that are complete
+ */
+ private List<FigMessage> getCompleteMessages() {
+ List<FigMessage> completeMessages = new ArrayList<FigMessage>(10);
+ for (Object o : getFigEdges()) {
+ if (o instanceof FigMessage) {
+ FigMessage fm = (FigMessage) o;
+ if (fm.getPoints().length > 1
+ && fm.getDestFigNode() != null
+ && fm.getSourceFigNode() != null) {
+ completeMessages.add(fm);
+ }
+ }
+ }
+ return completeMessages;
+ }
+ /**
+ * Updates the position of the classifier role.
+ * Called when a create message is added or moved.
+ */
+ protected void relocate() {
+ updateHeadOffset();
+ emptyFig.setBounds(getX(), getY(), getWidth(), offset);
+ headFig.setBounds(getX(), getY() + offset,
+ getWidth(), headFig.getHeight());
+ lifeLineFig.setBounds(getX(), getY() + headFig.getHeight() + offset,
+ getWidth(), getHeight() - headFig.getHeight() - offset);
+
+ updateEdges();
+ forceRepaintShadow();
+ }
+
+ void createActivations() {
+ lifeLineFig.createActivations(getCompleteMessages());
+ forceRepaintShadow();
+ }
+
+ @Override
+ public void setFillColor(Color color) {
+ headFig.setFillColor(color);
+ }
+
+ @Override
+ public void setFilled(boolean filled) {
+ headFig.setFilled(filled);
+ }
+
+ @Override
+ public void setLineWidth(int w) {
+ headFig.setLineWidth(w);
+ getBigPort().setLineWidth(0);
+ }
+
+ /**
+ * This class represents the port of the FigClassifierRole.
+ * It has the logic for locating the messages.
+ *
+ * @author penyaskito
+ */
+ class FigClassifierRolePort extends FigRect {
+
+ /**
+ *
+ */
+ FigClassifierRolePort() {
+ super(0, 0, 0, 0, null, null);
+ }
+
+ @Override
+ public Point getClosestPoint(Point anotherPt) {
+ int width = FigActivation.DEFAULT_WIDTH;
+ int y = anotherPt.y;
+
+ // the initial x is the left side of the activation
+ int x = getX() + getWidth() / 2 - width / 2;
+ // put the x at the right side of the activation if needed
+ if (anotherPt.x > x + width) {
+ x = x + width;
+ }
+ // if the y coordinate is before the classifier role y,
+ // we place the start in the corner of the fighead.
+ if (y < getY()) {
+ y = getY();
+ x = Geometry.ptClosestTo(headFig.getBounds(), anotherPt).x;
+ }
+ // if the y coordinate is inside the head,
+ // the x must be in the border of the headFig.
+ else if (y < lifeLineFig.getY()) {
+ x = Geometry.ptClosestTo(headFig.getBounds(), anotherPt).x;
+ }
+ // else if the y coordinate is outside of the classifier role,
+ // we fix the y in the max y of the classifier role.
+ // FIXME: We should increase the height of the classifier role,
+ // don't???
+ else if (y > getY() + getHeight()) {
+ y = headFig.getY() + FigClassifierRole.this.getHeight();
+ }
+ return new Point(x, y);
+ }
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigDestroy.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigDestroy.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigDestroy.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,47 @@
+// $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.sequence2.ui;
+
+import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigLine;
+
+/**
+ *
+ * @author penyaskito
+ */
+public class FigDestroy extends FigGroup {
+
+ FigDestroy(int x, int y) {
+ addFig(new FigLine(x - 10,
+ y - 10,
+ x + 10,
+ y + 10));
+ addFig(
+ new FigLine(x + 10,
+ y - 10,
+ x - 10,
+ y + 10));
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigHead.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigHead.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigHead.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,118 @@
+// $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.sequence2.ui;
+
+import java.awt.Color;
+import java.awt.Dimension;
+
+import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigRect;
+import org.tigris.gef.presentation.FigText;
+
+class FigHead extends FigGroup {
+
+ private final FigText nameFig;
+ private final Fig stereotypeFig;
+ private final FigRect rectFig;
+
+ static final int DEFAULT_WIDTH = 150;
+ static final int DEFAULT_HEIGHT = 50;
+
+ /**
+ * Constructor.
+ *
+ * @param stereotypeFigure
+ * @param nameFigure
+ */
+ FigHead(Fig stereotypeFigure, FigText nameFigure) {
+ this.stereotypeFig = stereotypeFigure;
+ this.nameFig = nameFigure;
+ rectFig =
+ new FigRect(0, 0,
+ DEFAULT_WIDTH,
+ DEFAULT_HEIGHT,
+ Color.black, Color.white);
+ addFig(rectFig);
+ addFig(nameFig);
+ addFig(stereotypeFig);
+ }
+
+
+ /**
+ * @param x The x coordinate.
+ * @param y The y coordinate.
+ * @param w The width
+ * @param h The height
+ * @see org.tigris.gef.presentation.FigGroup#setBoundsImpl(int, int, int, int)
+ */
+ @Override
+ protected void setBoundsImpl(int x, int y, int w, int h) {
+ rectFig.setBounds(x, y, w, h);
+ int yy = y;
+ if (stereotypeFig.isVisible()) {
+ stereotypeFig.setBounds(x, yy, w,
+ stereotypeFig.getMinimumSize().height);
+ yy += stereotypeFig.getMinimumSize().height;
+ }
+ nameFig.setFilled(false);
+ nameFig.setLineWidth(0);
+ nameFig.setTextColor(Color.black);
+ nameFig.setBounds(x, yy, w, nameFig.getHeight());
+ _x = x;
+ _y = y;
+ _w = w;
+ _h = h;
+ }
+
+ @Override
+ public Dimension getMinimumSize() {
+ Dimension d = null;
+ int minWidth = stereotypeFig.getMinimumSize().width;
+ if (minWidth < nameFig.getWidth()) {
+ minWidth = nameFig.getWidth();
+ }
+ d = new Dimension(minWidth, getMinimumHeight());
+ return d;
+ }
+
+ int getMinimumHeight() {
+ int h = stereotypeFig.getMinimumSize().height
+ + nameFig.getMinimumHeight() + 4;
+ if (h < DEFAULT_HEIGHT)
+ h = DEFAULT_HEIGHT;
+ return h;
+ }
+
+ @Override
+ public void setFilled (boolean filled) {
+ rectFig.setFilled(filled);
+ }
+
+ @Override
+ public void setLineWidth(int w) {
+ rectFig.setLineWidth(w);
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigLifeLine.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigLifeLine.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigLifeLine.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,278 @@
+// $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.sequence2.ui;
+
+import java.awt.Color;
+import java.awt.Rectangle;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.argouml.model.Model;
+import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigLine;
+import org.tigris.gef.presentation.FigRect;
+
+
+/**
+ * This fig is the LifeLine of a ClassifierRole.
+ * @author penyaskito
+ */
+class FigLifeLine extends FigGroup {
+
+ private static final long serialVersionUID = 466925040550356L;
+
+ private final FigLine lineFig;
+ private final FigRect rectFig;
+
+ private List<FigActivation> activations;
+ private List<FigActivation> stackedActivations;
+
+ static final int WIDTH = 150;
+ static final int HEIGHT = 500;
+
+ /**
+ * Creates a FigLifeLine that starts in (x,y)
+ * @param x The x coordinate of the FigLifeLine
+ * @param y The y coordinate of the FigLifeLine
+ */
+ FigLifeLine(int x, int y) {
+ super();
+
+ activations = new LinkedList<FigActivation>();
+ stackedActivations = new LinkedList<FigActivation>();
+
+ rectFig = new FigRect(x, y, WIDTH, HEIGHT);
+ rectFig.setFilled(false);
+ rectFig.setLineWidth(0);
+ lineFig = new FigLine(x + WIDTH / 2, y,
+ x + WIDTH / 2, y + HEIGHT, Color.BLACK);
+ lineFig.setDashed(true);
+
+ addFig(rectFig);
+ addFig(lineFig);
+ }
+
+ synchronized void createActivations(final List<FigMessage> messages) {
+ clearActivations();
+ Collections.sort(messages, new FigMessageComparator());
+
+ activations = createStandardActivations(messages);
+ stackedActivations = createStackedActivations(messages);
+
+ for (FigActivation figAct : activations) {
+ addFig(figAct);
+ }
+ for (FigActivation figAct : stackedActivations) {
+ addFig(figAct);
+ }
+ calcBounds();
+ }
+
+ private List<FigActivation> createStandardActivations(
+ final List<FigMessage> messages) {
+
+ List<FigActivation> newActivations =
+ new LinkedList<FigActivation>();
+
+ final FigClassifierRole cr =
+ (FigClassifierRole) getGroup();
+ FigActivation currentAct = null;
+
+ // Check here if there are no incoming call actions
+ // if not then create an activation at the top of the lifeline
+ if (!hasIncomingCallActions(messages)
+ && !hasOutgoingDestroyActions(messages)) {
+ currentAct =
+ new FigActivation(lineFig.getX(), lineFig.getY(), false);
+ currentAct.setHeight(getHeight());
+ newActivations.add(currentAct);
+ currentAct = null;
+ }
+
+ for (FigMessage message : messages) {
+ int ySender = 0;
+ final Object action = message.getAction();
+ // if we are the dest and is a call action, create the
+ // activation, but don't add it until the height is set.
+ if (currentAct == null
+ && cr.equals(message.getDestFigNode())
+ && !cr.equals(message.getSourceFigNode())
+ && Model.getFacade().isACallAction(action)) {
+ ySender = message.getFinalY();
+ currentAct =
+ new FigActivation(lineFig.getX(), ySender, false);
+ }
+ // if we are the dest of a create action, create the
+ // entire activation, because we should need the destroy X
+ else if (currentAct == null
+ && cr.equals(message.getDestFigNode())
+ && !cr.equals(message.getSourceFigNode())
+ && Model.getFacade().isACreateAction(action)) {
+ currentAct =
+ new FigActivation(lineFig.getX(), lineFig.getY(), false);
+ }
+ // if we are the source of a return action
+ // the figlifeline ends here.
+ else if (currentAct != null
+ && cr.equals(message.getSourceFigNode())
+ && !cr.equals(message.getDestFigNode())
+ && Model.getFacade().isAReturnAction(action)) {
+ ySender = message.getStartY();
+ currentAct.setHeight(ySender - currentAct.getY());
+ newActivations.add(currentAct);
+ currentAct = null;
+ }
+ // if we are the source of a destroy actionm
+ // the figlifeline ends here and we add the activation
+ else if (currentAct != null
+ && cr.equals(message.getSourceFigNode())
+ && !cr.equals(message.getDestFigNode())
+ && Model.getFacade().isADestroyAction(action)) {
+ ySender = message.getFinalY();
+ currentAct.setHeight(ySender - currentAct.getY());
+ currentAct.setDestroy(true);
+ this.setHeight(ySender - getY());
+ newActivations.add(currentAct);
+ currentAct = null;
+ }
+ }
+
+ // TODO: Check if currentAct != null
+ // If we have a currentAct object that means have reached the end
+ // of the lifeline with a call or a create not returned.
+ // Add the activation to the list after setting its height to end
+ // at the end of the lifeline.
+ if (currentAct != null) {
+ currentAct.setHeight(getHeight() - currentAct.getY());
+ newActivations.add(currentAct);
+ }
+
+ return newActivations;
+ }
+
+ private List<FigActivation> createStackedActivations(
+ final List<FigMessage> messages) {
+
+ List<FigActivation> newActivations =
+ new LinkedList<FigActivation>();
+
+ FigActivation currentAct = null;
+
+ for (FigMessage message : messages) {
+ int ySender = 0;
+ final Object action = message.getAction();
+ // if we are the dest and is a call action, create the
+ // activation, but don't add it until the height is set.
+ if (message.isSelfMessage()
+ && Model.getFacade().isACallAction(action)) {
+ ySender = message.getFinalY();
+ currentAct = new FigActivation(
+ lineFig.getX() + FigActivation.DEFAULT_WIDTH / 2,
+ ySender,
+ false);
+ }
+ else if (currentAct != null
+ && message.isSelfMessage()
+ && Model.getFacade().isAReturnAction(action)) {
+ ySender = message.getStartY();
+ currentAct.setHeight(ySender - currentAct.getY());
+ newActivations.add(currentAct);
+ currentAct = null;
+ }
+ }
+ return newActivations;
+ }
+
+
+ private boolean hasIncomingCallActions(List<FigMessage> messages) {
+ boolean found = false;
+ final FigClassifierRole cr =
+ (FigClassifierRole) getGroup();
+ for (FigMessage message : messages) {
+ if (message.getDestFigNode().equals(cr)
+ && !message.getSourceFigNode().equals(cr)
+ && Model.getFacade().isACallAction(message.getAction())) {
+ found = true;
+ break;
+ }
+ }
+ return found;
+ }
+
+ private boolean hasOutgoingDestroyActions(List<FigMessage> messages) {
+ boolean found = false;
+ final FigClassifierRole cr =
+ (FigClassifierRole) getGroup();
+ for (FigMessage message : messages) {
+ Object action = message.getAction();
+ if (message.getSourceFigNode().equals(cr)
+ && !message.getDestFigNode().equals(cr)
+ && Model.getFacade().isADestroyAction(action)) {
+ found = true;
+ break;
+ }
+ }
+ return found;
+ }
+
+ private void clearActivations() {
+ for (FigActivation oldActivation : activations) {
+ removeFig(oldActivation);
+ }
+ for (FigActivation oldActivation : stackedActivations) {
+ removeFig(oldActivation);
+ }
+ activations.clear();
+ stackedActivations.clear();
+ }
+
+ @Override
+ public void setFilled(boolean filled) {
+ // we do nothing. No call to the parent
+ }
+
+ @Override
+ protected void setBoundsImpl(int x, int y, int w, int h) {
+ Rectangle oldBounds = getBounds();
+
+ rectFig.setBounds(x, y, w, h);
+ lineFig.setBounds(x + w / 2, y,
+ w, h);
+
+ for (FigActivation act : activations) {
+ removeFig(act);
+ act.setX(lineFig.getX() - FigActivation.DEFAULT_WIDTH / 2);
+ if (activations.size() == 1
+ && act.getHeight() == oldBounds.height) {
+ act.setHeight(getHeight());
+ }
+ addFig(act);
+ }
+ damage();
+ calcBounds();
+ firePropChange("bounds", oldBounds, getBounds());
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessage.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessage.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,223 @@
+// $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.sequence2.ui;
+
+import java.awt.Color;
+import java.awt.Point;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.FigEdgeModelElement;
+import org.argouml.uml.diagram.ui.FigTextGroup;
+import org.tigris.gef.base.PathConvPercent;
+import org.tigris.gef.base.Selection;
+import org.tigris.gef.presentation.ArrowHead;
+import org.tigris.gef.presentation.ArrowHeadGreater;
+import org.tigris.gef.presentation.ArrowHeadTriangle;
+import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.presentation.FigSpline;
+
+/**
+ * The Fig that represents a message between two classifier roles.
+ * TODO: In the future, it should be a message between only one classifier role
+ * (recursion in sequence diagrams)
+ * @author penyaskito
+ */
+public class FigMessage extends FigEdgeModelElement {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(FigMessage.class);
+
+ private static final long serialVersionUID = -2961220746360335159L;
+ private FigTextGroup textGroup;
+
+ /**
+ * The arrow head. It depends on the owner attached action.
+ */
+ private ArrowHead arrowHead;
+
+ /**
+ * Contructs a new figlink and sets the owner of the figlink.
+ *
+ * @param owner is the owner.
+ */
+ public FigMessage(Object owner) {
+ super();
+ textGroup = new FigTextGroup();
+ textGroup.addFig(getNameFig());
+ textGroup.addFig(getStereotypeFig());
+ addPathItem(textGroup, new PathConvPercent(this, 50, 10));
+ setOwner(owner);
+ }
+
+ @Override
+ public void setOwner(Object owner) {
+ super.setOwner(owner);
+ Object action = getAction();
+ if (Model.getFacade().isAReturnAction(action)) {
+ arrowHead = new ArrowHeadGreater();
+ getFig().setDashed(true);
+ }
+ else if (Model.getFacade().isADestroyAction(action)) {
+ arrowHead = new ArrowHeadGreater();
+ getFig().setDashed(true);
+ }
+ else if (Model.getFacade().isACreateAction(action)) {
+ arrowHead = new ArrowHeadTriangle();
+ // dashed it's false by default.
+ }
+ else if (Model.getFacade().isACallAction(action)) {
+ arrowHead = new ArrowHeadTriangle();
+ // dashed it's false by default.
+ }
+ else {
+ String message = "The owner must be a message with an "
+ + "action - got a " + owner.getClass().getName();
+ LOG.error(message);
+ throw new IllegalArgumentException(message);
+ }
+ setDestArrowHead(arrowHead);
+ }
+
+ /**
+ * Constructor here for saving and loading purposes.
+ *
+ */
+ public FigMessage() {
+ this(null);
+ }
+
+ /**
+ * Gets the action attached to the message.
+ * @return the action
+ */
+ public Object getAction() {
+ Object owner = getOwner();
+ Object action = null;
+ if (Model.getFacade().isAMessage(owner)) {
+ action = Model.getFacade().getAction(owner);
+ }
+ return action;
+ }
+
+ @Override
+ public Selection makeSelection() {
+ return new SelectionMessage(this);
+ }
+
+ /*
+ * @see org.tigris.gef.presentation.FigEdge#setFig(org.tigris.gef.presentation.Fig)
+ */
+ public void setFig(Fig f) {
+ super.setFig(f);
+ Object action = getAction();
+ if (Model.getFacade().isAReturnAction(action)) {
+ getFig().setDashed(true);
+ }
+ else if (Model.getFacade().isADestroyAction(action)) {
+ getFig().setDashed(true);
+ }
+ // in other cases there isn't a dashed line, default is false.
+ }
+
+ int getFinalY() {
+ int finalY = 0;
+ Point[] points = getFig().getPoints();
+ if (points.length > 0)
+ finalY = points[points.length - 1].y;
+ return finalY;
+ }
+
+ int getStartY() {
+ int finalY = 0;
+ Point[] points = getFig().getPoints();
+ if (points.length > 0)
+ finalY = points[0].y;
+ return finalY;
+ }
+
+
+ /**
+ * Checks if the message source and dest are the same.
+ * @return true if they are the same, otherwise false.
+ */
+ boolean isSelfMessage() {
+ return getDestination().equals(getSource());
+ }
+
+ /**
+ * Converts the message into a spline.
+ * This is needed for self-referencing messages.
+ */
+ public void convertToArc() {
+ if (getPoints().length > 0) {
+ FigMessageSpline spline = new FigMessageSpline(getPoint(0));
+ super.setFig(spline);
+ computeRoute();
+ }
+ }
+
+ @Override
+ public void computeRouteImpl() {
+ super.computeRouteImpl();
+ updateActivations();
+ }
+
+ private synchronized void updateActivations() {
+ // we update the activations...
+ FigClassifierRole source = (FigClassifierRole) getSourceFigNode();
+ if (source != null)
+ source.createActivations();
+
+ // for performance, we check if this is a selfmessage
+ // if it is, we have just updated the activations
+ if (!isSelfMessage()) {
+ FigClassifierRole dest = (FigClassifierRole) getDestFigNode();
+ if (dest != null)
+ dest.createActivations();
+ }
+ }
+
+ @Override
+ public void setLineColor(Color c) {
+ super.setLineColor(c);
+ arrowHead.setFillColor(c);
+ }
+
+ @Override
+ public void deleteFromModel() {
+ ((FigClassifierRole) getSourceFigNode()).createActivations();
+ if (!isSelfMessage()) {
+ ((FigClassifierRole) getDestFigNode()).createActivations();
+ }
+ super.deleteFromModel();
+ }
+
+
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageComparator.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageComparator.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageComparator.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,55 @@
+// $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.sequence2.ui;
+
+import java.util.Comparator;
+
+/**
+ * Compares two figmessages.
+ * The bigger one is that which Y start is lowest.
+ * @author penyaskito
+ */
+public class FigMessageComparator implements Comparator<FigMessage> {
+
+ /**
+ * @param m1 The first FigMessage
+ * @param m2 The second one
+ * @return x > 0, if m1.y < m2.y
+ * x < 0, if m1.y > m2.y
+ * x = 0, if m1.y = m2.y
+ * @see java.util.Comparator#compare
+ */
+ public int compare(FigMessage m1, FigMessage m2) {
+ int result = 0;
+ if (m1.getFinalY() < m2.getFinalY()) {
+ result = -1;
+ }
+ else if (m1.getFinalY() > m2.getFinalY()) {
+ result = 1;
+ }
+ return result;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageSpline.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageSpline.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigMessageSpline.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,56 @@
+// $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.sequence2.ui;
+
+import java.awt.Point;
+
+import org.tigris.gef.presentation.FigSpline;
+
+/**
+ * FigMessageSpline refines the behaviour of a Spline for a self-message
+ * in the sequence diagram.
+ * @author penyaskito
+ */
+public class FigMessageSpline extends FigSpline {
+
+ FigMessageSpline (Point start) {
+ assert (start != null) : "Point can't be null";
+
+ Point end = new Point(start.x, start.y + 20);
+
+ Point middle = new Point();
+ middle.x = start.x + 100;
+ middle.y = (start.y + end.y) / 2;
+
+ super.setFilled(false);
+ super.setComplete(false);
+ super.addPoint(start);
+ super.addPoint(new Point(start.x + 20, start.y));
+ super.addPoint(middle);
+ super.addPoint(new Point(end.x + 20, end.y));
+ super.addPoint(end);
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeBroomMessages.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeBroomMessages.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeBroomMessages.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,232 @@
+// $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.sequence2.ui;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.tigris.gef.base.FigModifyingModeImpl;
+import org.tigris.gef.base.Globals;
+import org.tigris.gef.presentation.FigNode;
+
+/**
+ * Brooms all the message which y coordinate is upper than the position
+ * of the broom.
+ * @author penyaskito
+ */
+public class ModeBroomMessages extends FigModifyingModeImpl {
+
+ private static final int DIRECTION_UNDEFINED = 0;
+ private static final int DIRECTION_UPWARD = 1;
+ private static final int DIRECTION_DOWNWARD = 2;
+
+ private int currentDirection;
+
+ private boolean shouldDraw = true;
+
+ private int x1, x2, y;
+ private int lastX1, lastX2, lastY;
+
+ /**
+ *
+ */
+ public ModeBroomMessages() {
+ currentDirection = DIRECTION_UNDEFINED;
+ }
+
+ /**
+ * Handle mouse down events by preparing for a drag.
+ * @param me The mouse event.
+ */
+ public void mousePressed(MouseEvent me) {
+ if (me.isConsumed()) {
+ return;
+ }
+
+ // we initialize the coordinates.
+ x1 = me.getX();
+ x2 = me.getX();
+ y = me.getY();
+ lastX1 = x1 - 100;
+ lastY = y;
+ lastX2 = x1 + 100;
+
+ editor.damageAll();
+ me.consume();
+ start();
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent me) {
+ me.consume();
+ editor.getSelectionManager().deselectAll();
+
+ int crY = 0;
+ List nodes = editor.getGraphModel().getNodes();
+ if (nodes.size() > 0) {
+ crY = (editor.getLayerManager().
+ getActiveLayer().presentationFor(nodes.get(0))).getY();
+ }
+
+ Point snapPt = me.getPoint();
+ snapPt.x = Math.max(0, snapPt.x);
+ snapPt.y = Math.max(crY, snapPt.y);
+ editor.snap(snapPt);
+
+ int dy = snapPt.y - lastY;
+
+ if (dy == 0) {
+ // we do nothing
+ x1 = me.getX();
+ x2 = me.getX();
+ editor.damageAll();
+ return;
+ }
+
+ // manage if cursor x is less than lastX1
+ lastX1 = Math.min(snapPt.x, lastX1);
+ // manage if cursor x is more than lastX2
+ lastX2 = Math.max(snapPt.x, lastX2);
+
+ // manage changes of direction...
+ if (currentDirection == DIRECTION_UPWARD
+ && dy > 0) {
+ currentDirection = DIRECTION_DOWNWARD;
+ }
+ else if (currentDirection == DIRECTION_DOWNWARD
+ && dy > 0) {
+ currentDirection = DIRECTION_UPWARD;
+ }
+ // I have no direction yet
+ if (currentDirection == DIRECTION_UNDEFINED) {
+ if (dy < 0) {
+ currentDirection = DIRECTION_UPWARD;
+ } else if (dy > 0) {
+ currentDirection = DIRECTION_DOWNWARD;
+ }
+ }
+
+ x1 = lastX1;
+ x2 = lastX2;
+
+ // we move down or up the messages that are downward the broom
+ if (currentDirection == DIRECTION_DOWNWARD
+ || currentDirection == DIRECTION_UPWARD) {
+ List<FigMessage> messages = getAllFigMessagesDownward(lastY);
+ for (FigMessage message : messages) {
+ message.translate(0, dy);
+ // we recalculate all the activations
+ FigNode source = message.getSourceFigNode();
+ if (source != null && source instanceof FigClassifierRole) {
+ ((FigClassifierRole) source).createActivations();
+ }
+ FigNode dest = message.getDestFigNode();
+ if (dest != null && !message.isSelfMessage()
+ && dest instanceof FigClassifierRole) {
+ ((FigClassifierRole) dest).createActivations();
+ }
+ }
+ }
+ lastY = snapPt.y;
+ editor.damageAll();
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent me) {
+ // in this event we do nothing,
+ // only stop drawing the broom.
+ shouldDraw = false;
+ me.consume();
+ editor.damageAll();
+ done();
+ }
+
+ /**
+ * Gets all the messages that are downward to a y position
+ * @param position the coordinate
+ * @return the list with all the messages.
+ */
+ private List<FigMessage> getAllFigMessagesDownward(int position) {
+ final List<FigMessage> messages = getAllFigMessages();
+ List<FigMessage> dMessages = new LinkedList<FigMessage>();
+ for (FigMessage message : messages) {
+ if (message.getY() > position) {
+ dMessages.add(message);
+ }
+ }
+ return dMessages;
+ }
+
+ /**
+ * Gets all the figmessages of the diagram.
+ * @return the list of FigMessages
+ */
+ private List<FigMessage> getAllFigMessages() {
+ List edges = editor.getGraphModel().getEdges();
+ List<FigMessage> messages = new ArrayList<FigMessage>(edges.size());
+ for (Object message : edges) {
+ Object figM =
+ (editor.getLayerManager().
+ getActiveLayer().presentationFor(message));
+ messages.add((FigMessage) figM);
+ }
+ return messages;
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ if (!shouldDraw) {
+ return;
+ }
+
+ Color selectRectColor = Globals.getPrefs().getRubberbandColor();
+ g.setColor(selectRectColor);
+
+
+ switch(currentDirection) {
+
+ case DIRECTION_UNDEFINED:
+ // we draw a cross
+ g.fillRect(x1 - 10, y - 2, 20, 4);
+ g.fillRect((x1 + x2) / 2 - 2, y - 10, 4, 20);
+ break;
+
+ case DIRECTION_UPWARD:
+ g.fillRect(lastX1, lastY - 2, lastX2 - lastX1, 4);
+ g.fillRect((lastX1 + lastX2) / 2 - 2, lastY, 4, 10);
+ break;
+
+ case DIRECTION_DOWNWARD:
+ g.fillRect(lastX1, lastY - 2, lastX2 - lastX1, 4);
+ g.fillRect((lastX1 + lastX2) / 2 - 2, lastY - 10, 4, 10);
+ break;
+ }
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,135 @@
+// $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.sequence2.ui;
+
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.sequence2.SequenceDiagramGraphModel;
+import org.tigris.gef.base.Editor;
+import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.ModeCreatePolyEdge;
+
+/**
+ * Mode to create a link between two figclassifierroles.
+ * @author penyaskito
+ */
+public class ModeCreateMessage extends ModeCreatePolyEdge {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(ModeCreateMessage.class);
+
+ /**
+ * The constructor.
+ *
+ * @param par the editor
+ */
+ public ModeCreateMessage(Editor par) {
+ super(par);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("ModeCreateMessage created with editor:" + editor);
+ }
+ }
+
+ /**
+ * The constructor.
+ */
+ public ModeCreateMessage() {
+ super();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("ModeCreateMessage created without editor.");
+ }
+ }
+ @Override
+ public void mouseReleased(MouseEvent me) {
+ // the parent will create the message
+ super.mouseReleased(me);
+
+ final SequenceDiagramGraphModel gm =
+ (SequenceDiagramGraphModel) getEditor().getGraphModel();
+
+ final Object edge = getNewEdge();
+ if (Model.getFacade().isAMessage(edge)) {
+ final Object action = Model.getFacade().getAction(edge);
+ if (Model.getFacade().isACallAction(action)) {
+
+ // we need to create a ModeCreateMessage for adding
+ // a new message
+// ModeManager modeManager = editor.getModeManager();
+// ModeCreateMessage mode = new ModeCreateMessage(editor);
+// mode.getArgs().put("action",
+// Model.getMetaTypes().getReturnAction());
+// modeManager.push(mode);
+
+ // get the source of the return message
+ final Object returnMessageSource =
+ Model.getFacade().getReceiver(edge);
+ // get the dest of the return message
+ final Object returnMessageDest =
+ Model.getFacade().getSender(edge);
+
+ // create the return message modelelement with the interaction
+ // and the collaboration
+ final Object returnMessage = gm.connect(
+ returnMessageSource,
+ returnMessageDest,
+ Model.getMetaTypes().getMessage(),
+ Model.getMetaTypes().getReturnAction());
+
+ final Layer layer = editor.getLayerManager().getActiveLayer();
+
+ final FigMessage callEdge = (FigMessage)
+ layer.presentationFor(edge);
+
+ final FigMessage returnEdge = new FigMessage(returnMessage);
+
+ returnEdge.setSourcePortFig(callEdge.getDestPortFig());
+ returnEdge.setSourceFigNode(callEdge.getDestFigNode());
+ returnEdge.setDestPortFig(callEdge.getSourcePortFig());
+ returnEdge.setDestFigNode(callEdge.getSourceFigNode());
+
+ final Point[] points = returnEdge.getPoints();
+ for (int i=0; i < points.length; ++i) {
+ // TODO: this shouldn't be hardcoded
+ // 20 is the height of the spline
+ // 50 is the default activation height
+ points[i].y = callEdge.getY() + 50 + 20;
+ }
+ returnEdge.setPoints(points);
+
+ if (returnEdge.isSelfMessage()) {
+ returnEdge.convertToArc();
+ }
+
+ layer.add(returnEdge);
+ }
+ }
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModePlaceClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModePlaceClassifierRole.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModePlaceClassifierRole.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,75 @@
+// $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.sequence2.ui;
+
+import java.awt.event.MouseEvent;
+import java.util.List;
+
+import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.ModePlace;
+import org.tigris.gef.graph.GraphFactory;
+import org.tigris.gef.presentation.Fig;
+
+/**
+ *
+ * @author penyaskito
+ */
+public class ModePlaceClassifierRole extends ModePlace {
+
+ /**
+ * @param gf The GraphFactory
+ * @param instructions A string with the instructions for the tooltip
+ */
+ public ModePlaceClassifierRole(GraphFactory gf, String instructions) {
+ super(gf, instructions);
+ }
+
+ @Override
+ public void mousePressed(MouseEvent me) {
+ super.mousePressed(me);
+ postProcessing();
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent me) {
+ super.mouseDragged(me);
+ postProcessing();
+ }
+
+
+ private void postProcessing() {
+ int y = _pers.getY();
+ Layer lay = editor.getLayerManager().getActiveLayer();
+ List nodes = lay.getContentsNoEdges();
+ // It's 1 because super has created the node
+ if (nodes.size() > 0) {
+ Fig fig = (Fig) nodes.get(0);
+ if (fig != _pers) {
+ y = fig.getY();
+ _pers.setY(y);
+ }
+ }
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SelectionMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SelectionMessage.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SelectionMessage.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,120 @@
+// $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.sequence2.ui;
+
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.ui.FigEdgeModelElement;
+import org.argouml.uml.diagram.ui.SelectionRerouteEdge;
+import org.tigris.gef.presentation.FigNode;
+import org.tigris.gef.presentation.Handle;
+
+/**
+ * A custom select object to handle the special requirements of
+ * rerouting, reshaping or dragging a message.
+ * @author penyaskito
+ */
+public class SelectionMessage extends SelectionRerouteEdge {
+
+
+ /**
+ * The constructor
+ * @param feme the fig.
+ */
+ public SelectionMessage(FigEdgeModelElement feme) {
+ super(feme);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent ke) {
+ if (ke.getKeyCode() == KeyEvent.VK_LEFT
+ || ke.getKeyCode() == KeyEvent.VK_RIGHT) {
+ // we don't let the user move the messages horizontally.
+ ke.consume();
+ } else {
+ handleMovement();
+ }
+ }
+
+ /**
+ * @param me
+ * @see org.argouml.uml.diagram.ui.SelectionRerouteEdge#mousePressed(java.awt.event.MouseEvent)
+ */
+ @Override
+ public void mousePressed(MouseEvent me) {
+ FigMessage message = (FigMessage) getContent();
+ if (!message.isSelfMessage()) {
+ super.mousePressed(me);
+ }
+ me.consume();
+ }
+
+ /**
+ * @param me
+ * @see org.argouml.uml.diagram.ui.SelectionRerouteEdge#mouseDragged(java.awt.event.MouseEvent)
+ */
+ @Override
+ public void mouseDragged(MouseEvent me) {
+ FigMessage message = (FigMessage) getContent();
+ if (message.isSelfMessage()) {
+ message.translate(0, me.getY() - message.getY());
+ }
+ else {
+ super.mouseDragged(me);
+ }
+ handleMovement();
+ me.consume();
+
+ }
+
+ @Override
+ public void dragHandle(int x, int y, int w, int h, Handle handle) {
+ super.dragHandle(x, y, w, h, handle);
+ handleMovement();
+ }
+
+ private void handleMovement() {
+ FigMessage message = (FigMessage) getContent();
+
+ // if it is a create action, relocate its dest node.
+ if (Model.getFacade().isACreateAction(message.getAction())) {
+ ((FigClassifierRole) message.getDestFigNode()).relocate();
+ }
+
+ // we recalculate all the activations
+ FigNode source = message.getSourceFigNode();
+ if (source != null && source instanceof FigClassifierRole) {
+ ((FigClassifierRole) source).createActivations();
+ }
+ FigNode dest = message.getDestFigNode();
+ if (dest != null && !message.isSelfMessage()
+ && dest instanceof FigClassifierRole) {
+ ((FigClassifierRole) dest).createActivations();
+ }
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,93 @@
+// $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.sequence2.ui;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.argouml.model.Model;
+import org.argouml.uml.CommentEdge;
+import org.argouml.uml.diagram.UmlDiagramRenderer;
+import org.argouml.uml.diagram.static_structure.ui.FigComment;
+import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
+import org.tigris.gef.base.Layer;
+import org.tigris.gef.graph.GraphModel;
+import org.tigris.gef.presentation.FigEdge;
+import org.tigris.gef.presentation.FigNode;
+
+/**
+ *
+ * @author penyaskito
+ */
+public class SequenceDiagramRenderer extends UmlDiagramRenderer {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(SequenceDiagramRenderer.class);
+
+ /*
+ * @see org.tigris.gef.graph.GraphNodeRenderer#getFigNodeFor(
+ * org.tigris.gef.graph.GraphModel, org.tigris.gef.base.Layer,
+ * java.lang.Object, java.util.Map)
+ */
+ public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node,
+ Map styleAttributes) {
+ FigNode result = null;
+ if (Model.getFacade().isAClassifierRole(node)) {
+ result = new FigClassifierRole(node);
+ } else if (Model.getFacade().isAComment(node)) {
+ result = new FigComment(gm, node);
+ }
+ LOG.debug("SequenceDiagramRenderer getFigNodeFor " + result);
+ lay.add(result);
+ return result;
+ }
+
+
+
+ /*
+ * @see org.tigris.gef.graph.GraphEdgeRenderer#getFigEdgeFor(
+ * org.tigris.gef.graph.GraphModel, org.tigris.gef.base.Layer,
+ * java.lang.Object, java.util.Map)
+ */
+ public FigEdge getFigEdgeFor(GraphModel gm, Layer lay, Object edge,
+ Map styleAttributes) {
+ FigEdge figEdge = null;
+
+ if (edge instanceof CommentEdge) {
+ figEdge = new FigEdgeNote(edge, lay);
+ } else if (Model.getFacade().isAMessage(edge)) {
+ figEdge = new FigMessage(edge);
+ } else {
+ figEdge = getFigEdgeFor(edge, styleAttributes);
+ }
+ setPorts(lay, figEdge);
+ lay.add(figEdge);
+ return figEdge;
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/UMLSequenceDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/UMLSequenceDiagram.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/UMLSequenceDiagram.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,176 @@
+// $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.sequence2.ui;
+
+import java.beans.PropertyVetoException;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.apache.log4j.Logger;
+import org.argouml.i18n.Translator;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.uml.diagram.sequence2.ActionSetAddMessageMode;
+import org.argouml.uml.diagram.sequence2.SequenceDiagramGraphModel;
+import org.argouml.uml.diagram.ui.ActionSetMode;
+import org.argouml.uml.diagram.ui.RadioAction;
+import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.LayerPerspective;
+import org.tigris.gef.base.LayerPerspectiveMutable;
+import org.tigris.gef.graph.MutableGraphModel;
+import org.tigris.gef.presentation.FigNode;
+
+/**
+ *
+ * @author penyaskito
+ */
+public class UMLSequenceDiagram extends UMLDiagram {
+
+ private Object[] actions;
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = Logger
+ .getLogger(UMLSequenceDiagram.class);
+
+ /**
+ *
+ */
+ public UMLSequenceDiagram() {
+ super();
+ // Create the graph model
+ MutableGraphModel gm = new SequenceDiagramGraphModel();
+ setGraphModel(gm);
+
+ // Create the layer
+ LayerPerspective lay = new
+ LayerPerspectiveMutable(this.getName(), gm);
+ setLayer(lay);
+
+ // Create the renderer
+ SequenceDiagramRenderer renderer = new SequenceDiagramRenderer();
+ lay.setGraphNodeRenderer(renderer);
+ lay.setGraphEdgeRenderer(renderer);
+
+ LOG.debug("Created sequence diagram");
+ }
+ /**
+ * Creates a new UmlSequenceDiagram with a collaboration.
+ * @param collaboration The collaboration
+ *
+ */
+ public UMLSequenceDiagram(Object collaboration) {
+ this();
+ try {
+ this.setName(getNewDiagramName());
+ } catch (PropertyVetoException e) {
+ LOG.error("Exception", e);
+ }
+ ((SequenceDiagramGraphModel) getGraphModel()).
+ setCollaboration(collaboration);
+ setNamespace(collaboration);
+ }
+
+ /**
+ * Get the Uml actions that can be performed in the diagram
+ * @return An array with the Uml actions
+ * @see org.argouml.uml.diagram.ui.UMLDiagram#getUmlActions()
+ */
+ @Override
+ protected Object[] getUmlActions() {
+ if (actions == null) {
+ actions = new Object[7];
+ actions[0] = new RadioAction(new ActionAddClassifierRole());
+ actions[1] = new RadioAction(new ActionSetAddMessageMode(
+ Model.getMetaTypes().getCallAction(),
+ "button.new-callaction"));
+ actions[2] = new RadioAction(new ActionSetAddMessageMode(
+ Model.getMetaTypes().getReturnAction(),
+ "button.new-returnaction"));
+ actions[3] = new RadioAction(new ActionSetAddMessageMode(
+ Model.getMetaTypes().getCreateAction(),
+ "button.new-createaction"));
+ actions[4] = new RadioAction(new ActionSetAddMessageMode(
+ Model.getMetaTypes().getDestroyAction(),
+ "button.new-destroyaction"));
+ actions[5] = new RadioAction(new ActionSetMode(
+ ModeBroomMessages.class,
+ "button.broom-messages"));
+ }
+ return actions;
+ }
+
+ /**
+ * Get the localized label name for the diagram
+ * @return The localized label name for the diagram
+ * @see org.argouml.uml.diagram.ui.UMLDiagram#getLabelName()
+ */
+ @Override
+ public String getLabelName() {
+ return Translator.localize("label.sequence-diagram");
+ }
+
+ @Override
+ public void encloserChanged(FigNode enclosed, FigNode oldEncloser,
+ FigNode newEncloser) {
+ // Do nothing.
+ }
+
+ /**
+ * Creates a new diagramname.
+ *
+ * @return a new unique name.
+ */
+ protected String getNewDiagramName() {
+ String name = getLabelName() + " " + getNextDiagramSerial();
+ if (!(ProjectManager.getManager().getCurrentProject()
+ .isValidDiagramName(name))) {
+ name = getNewDiagramName();
+ }
+ return name;
+ }
+
+ @Override
+ public boolean isRelocationAllowed(Object base) {
+ return Model.getFacade().isACollaboration(base);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection getRelocationCandidates(Object root) {
+ return
+ Model.getModelManagementHelper().getAllModelElementsOfKindWithModel(
+ root, Model.getMetaTypes().getCollaboration());
+ }
+
+ @Override
+ public boolean relocate(Object base) {
+ ((SequenceDiagramGraphModel) getGraphModel())
+ .setCollaboration(base);
+ setNamespace(base);
+ damage();
+ return true;
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/model/InitializeModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/model/InitializeModel.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/model/InitializeModel.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,91 @@
+// $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.model;
+
+import junit.framework.TestCase;
+
+/**
+ * Class to initialize the model.
+ *
+ * @author lito
+ */
+public final class InitializeModel {
+
+ /**
+ * The default model implementation to start.
+ */
+ private static final String DEFAULT_MODEL_IMPLEMENTATION =
+ "org.argouml.model.mdr.MDRModelImplementation";
+
+
+ /**
+ * This is never instantiated.
+ */
+ private InitializeModel() {
+ }
+
+ /**
+ * Initialize the Model subsystem with the default ModelImplementation.
+ */
+ public static void initializeDefault() {
+ String className =
+ System.getProperty(
+ "argouml.model.implementation",
+ DEFAULT_MODEL_IMPLEMENTATION);
+ initializeModelImplementation(className);
+ }
+
+ /**
+ * Initialize the Model subsystem with the MDR ModelImplementation.
+ */
+ public static void initializeMDR() {
+ initializeModelImplementation(
+ "org.argouml.model.mdr.MDRModelImplementation");
+ }
+
+ private static ModelImplementation initializeModelImplementation(
+ String name) {
+ ModelImplementation impl = null;
+
+ Class implType;
+ try {
+ implType =
+ Class.forName(name);
+ } catch (ClassNotFoundException e) {
+ TestCase.fail(e.toString());
+ return null;
+ }
+
+ try {
+ impl = (ModelImplementation) implType.newInstance();
+ } catch (InstantiationException e) {
+ TestCase.fail(e.toString());
+ } catch (IllegalAccessException e) {
+ TestCase.fail(e.toString());
+ }
+ Model.setImplementation(impl);
+ return impl;
+ }
+}
\ No newline at end of file
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramFactory.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramFactory.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,72 @@
+// $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.sequence2.module;
+
+
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.InitializeModel;
+import org.argouml.model.Model;
+import org.argouml.profile.init.InitProfileSubsystem;
+import org.argouml.uml.diagram.ArgoDiagram;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the TestSequenceDiagramFactory class.
+ * @author penyaskito
+ */
+public class TestSequenceDiagramFactory extends TestCase {
+
+ private Class sequence2DiagramClass =
+ org.argouml.uml.diagram.sequence2.ui.UMLSequenceDiagram.class;
+ private Class sequenceDiagramClass =
+ org.argouml.uml.diagram.sequence.ui.UMLSequenceDiagram.class;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ InitializeModel.initializeDefault();
+ (new InitProfileSubsystem()).init();
+ }
+
+ /**
+ * Tests than the created diagrams are of the correct type
+ * @see org.argouml.uml.diagram.sequence2.module.SequenceDiagramFactory#createDiagram(Class, Object, Object)
+ */
+ public void testCreateDiagram() {
+ Object col = null;
+ Object ns = ProjectManager.getManager().getCurrentProject().
+ getCurrentNamespace();
+ col = Model.getCollaborationsFactory().buildCollaboration(ns);
+
+ ArgoDiagram newDiagram = SequenceDiagramFactory.getInstance().
+ createDiagram(sequence2DiagramClass, col, col);
+ assertEquals(newDiagram.getClass(), sequence2DiagramClass);
+
+ ArgoDiagram oldDiagram = SequenceDiagramFactory.getInstance().
+ createDiagram(sequenceDiagramClass, col, col);
+ assertEquals(oldDiagram.getClass(), sequenceDiagramClass);
+
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramModule.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramModule.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/module/TestSequenceDiagramModule.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,68 @@
+// $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.sequence2.module;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests the SequenceDiagramModule class.
+ * @author penyaskito
+ */
+public class TestSequenceDiagramModule extends TestCase {
+
+ private SequenceDiagramModule theModule;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ theModule = new SequenceDiagramModule();
+ }
+
+ /**
+ * Tests than the name of the module is correct
+ * @see SequenceDiagramModule#getName()
+ */
+ public void testGetName() {
+ assertEquals("The name of the module is incorrect",
+ theModule.getName(),
+ "ArgoUML-Sequence");
+ }
+
+ /**
+ * Tests than the name of the module is correct
+ * @see SequenceDiagramModule#getName()
+ */
+ public void testGetInfo() {
+ assertEquals("The version of the module is incorrect",
+ theModule.getInfo(SequenceDiagramModule.VERSION),
+ "0.1");
+ assertEquals("The version of the module is incorrect",
+ theModule.getInfo(SequenceDiagramModule.DOWNLOADSITE),
+ "http://argouml-sequence.tigris.org");
+
+ }
+
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigClassifierRole.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigClassifierRole.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,99 @@
+// $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.sequence2.ui;
+
+import java.awt.event.ActionEvent;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.InitializeModel;
+import org.argouml.model.Model;
+import org.argouml.notation.InitNotation;
+import org.argouml.notation.providers.uml.InitNotationUml;
+import org.argouml.profile.init.InitProfileSubsystem;
+import org.argouml.ui.ProjectBrowser;
+import org.argouml.uml.diagram.sequence2.ActionSequenceDiagram;
+import org.argouml.uml.diagram.sequence2.module.SequenceDiagramFactory;
+import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.omg.uml.behavioralelements.collaborations.ClassifierRole;
+import org.tigris.gef.base.LayerPerspective;
+import org.tigris.gef.graph.GraphModel;
+import org.tigris.gef.graph.GraphNodeRenderer;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the FigClassifierRole class.
+ * @author penyaskito
+ */
+
+public class TestFigClassifierRole extends TestCase {
+
+ /**
+ * @throws Exception
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ InitializeModel.initializeDefault();
+ (new InitNotationUml()).init();
+ (new InitProfileSubsystem()).init();
+ }
+
+ /**
+ * Test the updateNameText method.
+ * @see FigClassifierRole#updateNameText()
+ */
+ public void testUpdateNameText()
+ {
+ UMLSequenceDiagram diagram = new UMLSequenceDiagram();
+ GraphModel gm = diagram.getGraphModel();
+ LayerPerspective layer = diagram.getLayer();
+ GraphNodeRenderer renderer = layer.getGraphNodeRenderer();
+
+ assertEquals(1, 1);
+
+// Object cr = Model.getUmlFactory().buildNode(
+// Model.getMetaTypes().getClassifierRole());
+//
+// Object figCR = renderer.getFigNodeFor(gm, layer, cr, null);
+//
+// Object clazz = Model.getUmlFactory().buildNode(
+// Model.getMetaTypes().getUMLClass());
+//
+// Model.getCollaborationsHelper().setBase(cr, clazz);
+//
+// FigClassifierRole fig = new FigClassifierRole(cr);
+//
+// int count = 0;
+// count = diagram.getLayer().getContents().size();
+// assertTrue(count == 0);
+// diagram.add(fig);
+// count = diagram.getLayer().getContents().size();
+// assertTrue(count + "", count == 1);
+
+ }
+}
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigMessageSpline.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigMessageSpline.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestFigMessageSpline.java 2008-04-08 07:29:51-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.sequence2.ui;
+
+import java.awt.Point;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the FigMessageSpline class.
+ * @author penyaskito
+ */
+public class TestFigMessageSpline extends TestCase {
+
+ private FigMessageSpline spline = null;
+ private Point start = new Point(15, 15);
+ private Point end = new Point(15, 35);
+
+ /**
+ * Test the constructor that receives a point
+ */
+ public void testConstructor() {
+ spline = new FigMessageSpline(start);
+ assertEquals("The spline start point is incorrect",
+ start, spline.getPoint(0));
+ assertEquals("The spline has not the correct number of points",
+ 5, spline.getPoints().length);
+ assertEquals("The spline end point is incorrect",
+ end, spline.getPoint(4));
+ }
+
+}
Added: trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestUMLSequenceDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestUMLSequenceDiagram.java?view=auto&rev=14304
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-diagrams-sequence2/tests/org/argouml/uml/diagram/sequence2/ui/TestUMLSequenceDiagram.java 2008-04-08 07:29:51-0700
@@ -0,0 +1,87 @@
+// $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.sequence2.ui;
+
+import org.argouml.uml.diagram.sequence2.SequenceDiagramGraphModel;
+import org.tigris.gef.base.LayerPerspectiveMutable;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the UMLSequenceDiagram class.
+ * @author penyaskito
+ */
+public class TestUMLSequenceDiagram extends TestCase {
+
+ private UMLSequenceDiagram theDiagram;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ theDiagram = new UMLSequenceDiagram();
+ }
+
+ /**
+ * Tests if the graph model is from the correct type.
+ * @see UMLSequenceDiagram
+ * @see SequenceDiagramRenderer
+ */
+ public void testSequenceDiagramGraphModel() {
+ assertEquals("Invalid graphModel",
+ SequenceDiagramGraphModel.class,
+ theDiagram.getGraphModel().getClass()
+
+ );
+ }
+
+ /**
+ * Tests if the renderer is from the correct type.
+ * @see UMLSequenceDiagram
+ * @see SequenceDiagramRenderer
+ */
+ public void testSequenceDiagramRenderer() {
+ assertEquals("Invalid nodes renderer",
+ SequenceDiagramRenderer.class,
+ theDiagram.getLayer().getGraphNodeRenderer().getClass()
+
+ );
+ assertEquals("Invalid edges renderer",
+ SequenceDiagramRenderer.class,
+ theDiagram.getLayer().
+ getGraphEdgeRenderer().getClass()
+ );
+ }
+ /**
+ * Tests if the layer is from the correct type.
+ * @see UMLSequenceDiagram
+ * @see org.tigris.gef.base.LayerPerspectiveMutable
+ */
+ public void testSequenceDiagramLayer() {
+ assertEquals("The layer must be a mutable perspective",
+ LayerPerspectiveMutable.class,
+ theDiagram.getLayer().getClass()
+ );
+ }
+
+}
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.