Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
testing whether can put in pluginactivitydiagram without overwriting
framework
  • Loading branch information
tms08012 committed Jun 7, 2012
1 parent d37b882 commit 44f1f09
Show file tree
Hide file tree
Showing 17 changed files with 1,680 additions and 0 deletions.
11 changes: 11 additions & 0 deletions VioletPlugin/VioletPlugin.ActivityDiagram/.project
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VioletPlugin.ActivityDiagram</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions VioletPlugin/VioletPlugin.ActivityDiagram/pom.xml
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.horstmann.violet.plugin</groupId>
<artifactId>com.horstmann.violet.plugin.activitydiagram</artifactId>
<name>Violet UML Editor Activity Diagram Plugin</name>
<version>2.0.0-SNAPSHOT</version>
<description></description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.horstmann.violet.framework</groupId>
<artifactId>com.horstmann.violet.framework</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>web.sourceforge.net</id>
<name>Violet's Maven Repository</name>
<url>
sftp://web.sourceforge.net/home/groups/v/vi/violet/htdocs/maven2/repo
</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>violet.repo</id>
<name>Violet's Maven repository (public access)</name>
<url>http://violet.sourceforge.net/maven2/repo/</url>
</repository>
</repositories>
</project>
@@ -0,0 +1,8 @@
package com.horstmann.violet.product.diagram.activity;

public interface ActivityDiagramConstant
{

public static final String ACTIVITY_DIAGRAM_STRINGS = "properties.ActivityDiagramGraphStrings";

}
@@ -0,0 +1,131 @@
/*
Violet - A program for editing UML diagrams.
Copyright (C) 2007 Cay S. Horstmann (http://horstmann.com)
Alexandre de Pellegrin (http://alexdp.free.fr);
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

package com.horstmann.violet.product.diagram.activity;

import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;

import com.horstmann.violet.product.diagram.abstracts.AbstractGraph;
import com.horstmann.violet.product.diagram.abstracts.edge.IEdge;
import com.horstmann.violet.product.diagram.abstracts.node.INode;
import com.horstmann.violet.product.diagram.abstracts.property.BentStyle;
import com.horstmann.violet.product.diagram.common.DiagramLinkNode;
import com.horstmann.violet.product.diagram.common.NoteEdge;
import com.horstmann.violet.product.diagram.common.NoteNode;

/**
* An UML activity diagram.
*/
public class ActivityDiagramGraph extends AbstractGraph
{
public List<INode> getNodePrototypes()
{
return NODE_PROTOTYPES;
}

public List<IEdge> getEdgePrototypes()
{
return EDGE_PROTOTYPES;
}

@Override
public boolean connect(IEdge e, INode start, Point2D startLocation, INode end, Point2D endLocation)
{
if (!ActivityTransitionEdge.class.isInstance(e))
{
return super.connect(e, start, startLocation, end, endLocation);
}
ActivityTransitionEdge transitionEdge = (ActivityTransitionEdge) e;
if (DecisionNode.class.isInstance(start))
{
boolean isSyncBarAtEnd = SynchronizationBarNode.class.isInstance(end);
if (isSyncBarAtEnd)
{
// For syn bar, we want to connect edge to north or south points
transitionEdge.setBentStyle(BentStyle.AUTO);
}
if (!isSyncBarAtEnd)
{
// For all the other cases, decision node are connected from east or west
transitionEdge.setBentStyle(BentStyle.HV);
}
}
return super.connect(e, start, startLocation, end, endLocation);
}

private static final List<INode> NODE_PROTOTYPES = new ArrayList<INode>();

private static final List<IEdge> EDGE_PROTOTYPES = new ArrayList<IEdge>();

static
{
ResourceBundle rs = ResourceBundle.getBundle(ActivityDiagramConstant.ACTIVITY_DIAGRAM_STRINGS, Locale.getDefault());

ScenarioStartNode node5 = new ScenarioStartNode();
node5.setToolTip(rs.getString("node5.tooltip"));
NODE_PROTOTYPES.add(node5);

ActivityNode node0 = new ActivityNode();
node0.setToolTip(rs.getString("node0.tooltip"));
NODE_PROTOTYPES.add(node0);

DecisionNode node1 = new DecisionNode();
node1.setToolTip(rs.getString("node1.tooltip"));
NODE_PROTOTYPES.add(node1);

SynchronizationBarNode node2 = new SynchronizationBarNode();
node2.setToolTip(rs.getString("node2.tooltip"));
NODE_PROTOTYPES.add(node2);

SignalSendingNode node3 = new SignalSendingNode();
node3.setToolTip(rs.getString("node3.tooltip"));
NODE_PROTOTYPES.add(node3);

SignalReceiptNode node4 = new SignalReceiptNode();
node4.setToolTip(rs.getString("node4.tooltip"));
NODE_PROTOTYPES.add(node4);

ScenarioEndNode node6 = new ScenarioEndNode();
node6.setToolTip(rs.getString("node6.tooltip"));
NODE_PROTOTYPES.add(node6);

NoteNode node7 = new NoteNode();
node7.setToolTip(rs.getString("node7.tooltip"));
NODE_PROTOTYPES.add(node7);

DiagramLinkNode node8 = new DiagramLinkNode();
node8.setToolTip(rs.getString("node8.tooltip"));
NODE_PROTOTYPES.add(node8);

ActivityTransitionEdge transition = new ActivityTransitionEdge();
transition.setToolTip(rs.getString("edge0.tooltip"));
EDGE_PROTOTYPES.add(transition);

NoteEdge noteEdge = new NoteEdge();
noteEdge.setToolTip(rs.getString("edge1.tooltip"));
EDGE_PROTOTYPES.add(noteEdge);
}

}
@@ -0,0 +1,92 @@
package com.horstmann.violet.product.diagram.activity;

import java.util.Locale;
import java.util.ResourceBundle;

import com.horstmann.violet.framework.plugin.IDiagramPlugin;
import com.horstmann.violet.product.diagram.abstracts.IGraph;

/**
* Describes activity diagram graph type
*
* @author Alexandre de Pellegrin
*
*/
public class ActivityDiagramPlugin implements IDiagramPlugin
{

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.framework.plugin.AbstractPlugin#getDescription()
*/
public String getDescription()
{
return "Activity UML diagram";
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.framework.plugin.AbstractPlugin#getProvider()
*/
public String getProvider()
{
return "Alexandre de Pellegrin / Cays S. Horstmann";
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.framework.plugin.AbstractPlugin#getVersion()
*/
public String getVersion()
{
return "1.0.0";
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.product.diagram.abstracts.GraphType#getName()
*/
public String getName()
{
return this.rs.getString("menu.activity_diagram.text");
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.product.diagram.abstracts.GraphType#getFileExtension()
*/
public String getFileExtension()
{
return this.rs.getString("files.activity.extension");
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.product.diagram.abstracts.GraphType#getFileExtensionName()
*/
public String getFileExtensionName()
{
return this.rs.getString("files.activity.name");
}

/*
* (non-Javadoc)
*
* @see com.horstmann.violet.product.diagram.abstracts.GraphType#getGraphClass()
*/
public Class<? extends IGraph> getGraphClass()
{
return ActivityDiagramGraph.class;
}


private ResourceBundle rs = ResourceBundle.getBundle(ActivityDiagramConstant.ACTIVITY_DIAGRAM_STRINGS, Locale.getDefault());


}

0 comments on commit 44f1f09

Please sign in to comment.