Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
f4259e3e
Commit
f4259e3e
authored
8 years ago
by
Letitia Li
Browse files
Options
Downloads
Patches
Plain Diff
DIPLODOCUS spies
parent
23c9caea
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ui/tmldd/TMLArchiConnectorNode.java
+47
-4
47 additions, 4 deletions
src/ui/tmldd/TMLArchiConnectorNode.java
with
47 additions
and
4 deletions
src/ui/tmldd/TMLArchiConnectorNode.java
+
47
−
4
View file @
f4259e3e
...
...
@@ -50,6 +50,7 @@ package ui.tmldd;
import
java.awt.*
;
import
java.awt.geom.*
;
import
java.awt.event.*
;
import
javax.swing.*
;
import
java.util.*
;
...
...
@@ -63,8 +64,10 @@ import ui.window.*;
public
class
TMLArchiConnectorNode
extends
TGConnector
implements
WithAttributes
{
protected
int
arrowLength
=
10
;
protected
int
widthValue
,
heightValue
,
maxWidthValue
,
h
;
protected
int
priority
=
0
;
// Between 0 and 10
public
static
final
String
NO_SPY
=
"Remove spy"
;
public
static
final
String
ADD_SPY
=
"Add spy"
;
protected
boolean
hasASpy
;
protected
int
priority
=
0
;
// Between 0 and 10
public
TMLArchiConnectorNode
(
int
_x
,
int
_y
,
int
_minX
,
int
_minY
,
int
_maxX
,
int
_maxY
,
boolean
_pos
,
TGComponent
_father
,
TDiagramPanel
_tdp
,
TGConnectingPoint
_p1
,
TGConnectingPoint
_p2
,
Vector
_listPoint
)
{
super
(
_x
,
_y
,
_minX
,
_minY
,
_maxX
,
_maxY
,
_pos
,
_father
,
_tdp
,
_p1
,
_p2
,
_listPoint
);
...
...
@@ -89,6 +92,9 @@ public class TMLArchiConnectorNode extends TGConnector implements WithAttribute
}
protected
void
drawLastSegment
(
Graphics
g
,
int
x1
,
int
y1
,
int
x2
,
int
y2
){
if
(
hasASpy
)
{
g
.
drawImage
(
IconManager
.
img5200
,
(
x1
+
x2
)/
2
,
(
y1
+
y2
)/
2
,
null
);
}
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
/*if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
g.drawLine(x1, y1, x2, y2);
...
...
@@ -97,7 +103,23 @@ public class TMLArchiConnectorNode extends TGConnector implements WithAttribute
}*/
}
public
boolean
hasASpy
()
{
return
hasASpy
;
}
public
void
addActionToPopupMenu
(
JPopupMenu
componentMenu
,
ActionListener
menuAL
,
int
x
,
int
y
)
{
componentMenu
.
addSeparator
();
JMenuItem
generate
=
null
;
// Should verify first whether it is connected to a formal requirement with a verify relation, or not
if
(
hasASpy
)
{
generate
=
new
JMenuItem
(
NO_SPY
);
}
else
{
generate
=
new
JMenuItem
(
ADD_SPY
);
}
generate
.
addActionListener
(
menuAL
);
componentMenu
.
add
(
generate
);
}
public
int
getType
()
{
return
TGComponentManager
.
CONNECTOR_NODE_TMLARCHI
;
}
...
...
@@ -107,6 +129,7 @@ public class TMLArchiConnectorNode extends TGConnector implements WithAttribute
sb
.
append
(
"<info priority=\""
);
sb
.
append
(
priority
);
sb
.
append
(
"\" />\n"
);
sb
.
append
(
"<spy value=\""
+
hasASpy
+
"\" />\n"
);
sb
.
append
(
"</extraparam>\n"
);
return
new
String
(
sb
);
}
...
...
@@ -137,6 +160,13 @@ public class TMLArchiConnectorNode extends TGConnector implements WithAttribute
priority
=
Integer
.
decode
(
prio
).
intValue
();
}
}
if
(
elt
.
getTagName
().
equals
(
"spy"
))
{
String
tmp
=
elt
.
getAttribute
(
"value"
).
trim
();
//TraceManager.addDev("[DD] value=" + tmp);
if
(
tmp
.
compareTo
(
"true"
)
==
0
)
{
hasASpy
=
true
;
}
}
}
}
}
...
...
@@ -147,7 +177,20 @@ public class TMLArchiConnectorNode extends TGConnector implements WithAttribute
}
}
public
boolean
eventOnPopup
(
ActionEvent
e
)
{
String
s
=
e
.
getActionCommand
();
TraceManager
.
addDev
(
"action: "
+
s
);
if
(
s
.
indexOf
(
NO_SPY
)
>
-
1
)
{
hasASpy
=
false
;
tdp
.
repaint
();
}
if
(
s
.
indexOf
(
ADD_SPY
)
>
-
1
)
{
hasASpy
=
true
;
tdp
.
repaint
();
}
return
true
;
}
public
TMLArchiCPUNode
getOriginNode
()
{
TGComponent
tgc
=
tdp
.
getComponentToWhichBelongs
(
getTGConnectingPointP1
());
if
(
tgc
instanceof
TMLArchiCPUNode
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment