Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
VioletPluginStateDiagram
- Loading branch information
tms08012
committed
Jun 7, 2012
1 parent
c2ab93d
commit 4a4bd29
Showing
14 changed files
with
985 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
VioletPluginStateDiagram/VioletPlugin.StateDiagram/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry excluding="src/main/java/" kind="src" path=""/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="lib" path="/VioletProduct.eclipse-plugin/trunk/lib/com.horstmann.violet-2.0.0-SNAPSHOT.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
17 changes: 17 additions & 0 deletions
17
VioletPluginStateDiagram/VioletPlugin.StateDiagram/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>VioletPlugin.StateDiagram</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
246 changes: 246 additions & 0 deletions
246
VioletPluginStateDiagram/VioletPlugin.StateDiagram/horstmann.eclipse.code.formatter.xml
Large diffs are not rendered by default.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
VioletPluginStateDiagram/VioletPlugin.StateDiagram/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.statediagram</artifactId> | ||
<name>Violet UML Editor State 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> |
74 changes: 74 additions & 0 deletions
74
...gram/src/main/java/com/horstmann/violet/product/diagram/state/CircularFinalStateNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
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.state; | ||
|
||
import java.awt.Graphics2D; | ||
import java.awt.geom.Ellipse2D; | ||
import java.awt.geom.Point2D; | ||
import java.awt.geom.Rectangle2D; | ||
|
||
import com.horstmann.violet.product.diagram.abstracts.node.EllipticalNode; | ||
|
||
/** | ||
* An initial or final node (bull's eye) in a state or activity diagram. | ||
*/ | ||
public class CircularFinalStateNode extends EllipticalNode | ||
{ | ||
|
||
@Override | ||
public Rectangle2D getBounds() | ||
{ | ||
Point2D currentLocation = getLocation(); | ||
double x = currentLocation.getX(); | ||
double y = currentLocation.getY(); | ||
double w = DEFAULT_DIAMETER + 2 * DEFAULT_GAP; | ||
double h = DEFAULT_DIAMETER + 2 * DEFAULT_GAP; | ||
Rectangle2D currentBounds = new Rectangle2D.Double(x, y, w, h); | ||
Rectangle2D snappedBounds = getGraph().getGrid().snap(currentBounds); | ||
return snappedBounds; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see com.horstmann.violet.framework.Node#draw(java.awt.Graphics2D) | ||
*/ | ||
public void draw(Graphics2D g2) | ||
{ | ||
super.draw(g2); | ||
Ellipse2D circle = new Ellipse2D.Double(getBounds().getX(), getBounds().getY(), getBounds().getWidth(), getBounds() | ||
.getHeight()); | ||
|
||
Rectangle2D bounds = getBounds(); | ||
Ellipse2D inside = new Ellipse2D.Double(bounds.getX() + DEFAULT_GAP, bounds.getY() + DEFAULT_GAP, bounds.getWidth() - 2 | ||
* DEFAULT_GAP, bounds.getHeight() - 2 * DEFAULT_GAP); | ||
g2.fill(inside); | ||
g2.draw(circle); | ||
} | ||
|
||
/** default node diameter */ | ||
private static int DEFAULT_DIAMETER = 14; | ||
|
||
/** default gap between the main circle and the ring for a final node */ | ||
private static int DEFAULT_GAP = 3; | ||
|
||
} |
71 changes: 71 additions & 0 deletions
71
...am/src/main/java/com/horstmann/violet/product/diagram/state/CircularInitialStateNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
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.state; | ||
|
||
import java.awt.Graphics2D; | ||
import java.awt.geom.Ellipse2D; | ||
import java.awt.geom.Point2D; | ||
import java.awt.geom.Rectangle2D; | ||
|
||
import com.horstmann.violet.product.diagram.abstracts.node.EllipticalNode; | ||
|
||
/** | ||
* An initial or final node (bull's eye) in a state or activity diagram. | ||
*/ | ||
public class CircularInitialStateNode extends EllipticalNode | ||
{ | ||
|
||
@Override | ||
public Rectangle2D getBounds() | ||
{ | ||
Point2D currentLocation = getLocation(); | ||
double x = currentLocation.getX(); | ||
double y = currentLocation.getY(); | ||
double w = DEFAULT_DIAMETER; | ||
double h = DEFAULT_DIAMETER; | ||
Rectangle2D currentBounds = new Rectangle2D.Double(x, y, w, h); | ||
Rectangle2D snappedBounds = getGraph().getGrid().snap(currentBounds); | ||
return snappedBounds; | ||
} | ||
|
||
public void draw(Graphics2D g2) | ||
{ | ||
super.draw(g2); | ||
Rectangle2D bounds = getBounds(); | ||
Ellipse2D circle = new Ellipse2D.Double(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight()); | ||
g2.fill(circle); | ||
} | ||
|
||
/** | ||
* Kept for compatibility with old versions | ||
* | ||
* @param dummy | ||
*/ | ||
public void setFinal(boolean dummy) | ||
{ | ||
// Nothing to do | ||
} | ||
|
||
/** default node diameter */ | ||
private static int DEFAULT_DIAMETER = 20; | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
...iagram/src/main/java/com/horstmann/violet/product/diagram/state/StateDiagramConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.horstmann.violet.product.diagram.state; | ||
|
||
public interface StateDiagramConstant | ||
{ | ||
|
||
public static final String STATE_DIAGRAM_STRINGS = "properties.StateDiagramGraphStrings"; | ||
|
||
} |
88 changes: 88 additions & 0 deletions
88
...teDiagram/src/main/java/com/horstmann/violet/product/diagram/state/StateDiagramGraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
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.state; | ||
|
||
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.common.DiagramLinkNode; | ||
import com.horstmann.violet.product.diagram.common.NoteEdge; | ||
import com.horstmann.violet.product.diagram.common.NoteNode; | ||
|
||
/** | ||
* An UML state diagram. | ||
*/ | ||
public class StateDiagramGraph extends AbstractGraph | ||
{ | ||
public List<INode> getNodePrototypes() | ||
{ | ||
return NODE_PROTOTYPES; | ||
} | ||
|
||
public List<IEdge> getEdgePrototypes() | ||
{ | ||
return EDGE_PROTOTYPES; | ||
} | ||
|
||
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(StateDiagramConstant.STATE_DIAGRAM_STRINGS, Locale.getDefault()); | ||
|
||
CircularInitialStateNode circularInitialStateNode = new CircularInitialStateNode(); | ||
circularInitialStateNode.setToolTip(rs.getString("node1.tooltip")); | ||
NODE_PROTOTYPES.add(circularInitialStateNode); | ||
|
||
StateNode stateNode = new StateNode(); | ||
stateNode.setToolTip(rs.getString("node0.tooltip")); | ||
NODE_PROTOTYPES.add(stateNode); | ||
|
||
CircularFinalStateNode circularFinalStateNode = new CircularFinalStateNode(); | ||
circularFinalStateNode.setToolTip(rs.getString("node2.tooltip")); | ||
NODE_PROTOTYPES.add(circularFinalStateNode); | ||
|
||
NoteNode noteNode = new NoteNode(); | ||
noteNode.setToolTip(rs.getString("node3.tooltip")); | ||
NODE_PROTOTYPES.add(noteNode); | ||
|
||
DiagramLinkNode diagramLinkNode = new DiagramLinkNode(); | ||
diagramLinkNode.setToolTip(rs.getString("node4.tooltip")); | ||
NODE_PROTOTYPES.add(diagramLinkNode); | ||
|
||
StateTransitionEdge stateTransitionEdge = new StateTransitionEdge(); | ||
stateTransitionEdge.setToolTip(rs.getString("edge0.tooltip")); | ||
EDGE_PROTOTYPES.add(stateTransitionEdge); | ||
|
||
NoteEdge noteEdge = new NoteEdge(); | ||
noteEdge.setToolTip(rs.getString("edge1.tooltip")); | ||
EDGE_PROTOTYPES.add(noteEdge); | ||
} | ||
|
||
} |
Oops, something went wrong.