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
ec402ca1
Commit
ec402ca1
authored
6 years ago
by
Irina LEE
Browse files
Options
Downloads
Patches
Plain Diff
add cluster in avatardd and test rotation in syscams component
parent
8b319c3b
No related branches found
Branches containing commit
No related tags found
1 merge request
!72
Syscams
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/ui/avatardd/ADDClusterNode.java
+59
-4
59 additions, 4 deletions
src/main/java/ui/avatardd/ADDClusterNode.java
src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
+26
-3
26 additions, 3 deletions
src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
with
85 additions
and
7 deletions
src/main/java/ui/avatardd/ADDClusterNode.java
+
59
−
4
View file @
ec402ca1
...
...
@@ -42,10 +42,13 @@ import org.w3c.dom.Element;
import
org.w3c.dom.Node
;
import
org.w3c.dom.NodeList
;
import
ui.*
;
import
ui.syscams.SysCAMSComponentTaskDiagramPanel
;
import
ui.util.IconManager
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.util.Vector
;
/**
* Class ADDClusterNode
...
...
@@ -61,6 +64,9 @@ public class ADDClusterNode extends ADDNode implements WithAttributes {
private
int
derivationx
=
2
;
private
int
derivationy
=
3
;
private
String
stereotype
=
"Cluster"
;
private
int
currentFontSize
=
-
1
;
private
int
textX
=
15
;
// border for ports
public
String
oldValue
;
private
int
index
=
0
;
...
...
@@ -98,14 +104,13 @@ public class ADDClusterNode extends ADDNode implements WithAttributes {
nbInternalTGComponent
=
0
;
moveable
=
true
;
multieditable
=
true
;
editable
=
true
;
removable
=
true
;
userResizable
=
true
;
name
=
tdp
.
findNodeName
(
"Cluster"
);
value
=
"name"
;
// myImageIcon = IconManager.imgic8006;
}
public
void
internalDrawing
(
Graphics
g
)
{
...
...
@@ -167,7 +172,57 @@ public class ADDClusterNode extends ADDNode implements WithAttributes {
return
index
;
}
public
boolean
editOndoubleClick
(
JFrame
frame
)
{
public
boolean
editOndoubleClick
(
JFrame
frame
,
int
_x
,
int
_y
)
{
int
i
;
MainGUI
mgui
=
getTDiagramPanel
().
getMainGUI
();
Vector
<
TURTLEPanel
>
listPanel
=
mgui
.
getTabs
();
// On the name ?
if
(
_y
<=
(
y
+
currentFontSize
+
textX
))
{
//TraceManager.addDev("Edit on double click x=" + _x + " y=" + _y);
oldValue
=
value
;
String
s
=
(
String
)
JOptionPane
.
showInputDialog
(
frame
,
"Name:"
,
"Setting component name"
,
JOptionPane
.
PLAIN_MESSAGE
,
IconManager
.
imgic100
,
null
,
getValue
());
if
((
s
!=
null
)
&&
(
s
.
length
()
>
0
))
{
// Check whether this name is already in use, or not
if
(!
TAttribute
.
isAValidId
(
s
,
false
,
false
))
{
JOptionPane
.
showMessageDialog
(
frame
,
"Could not change the name of the component: the new name is not a valid name"
,
"Error"
,
JOptionPane
.
INFORMATION_MESSAGE
);
return
false
;
}
// if (oldValue.compareTo(s) != 0) {
// if (((SysCAMSComponentTaskDiagramPanel)(tdp)).nameBlockTDFComponentInUse(oldValue, s)) {
// JOptionPane.showMessageDialog(frame,
// "Error: the name is already in use",
// "Name modification",
// JOptionPane.ERROR_MESSAGE);
// return false;
// }
// }
//TraceManager.addDev("Set value with change");
setComponentName
(
s
);
setValueWithChange
(
s
);
// isAttacker = s.contains("Attacker");
// rescaled = true;
//TraceManager.addDev("return true");
return
true
;
}
return
false
;
}
for
(
i
=
0
;
i
<
listPanel
.
size
();
i
++)
{
if
(
mgui
.
getTitleAt
(
listPanel
.
get
(
i
)).
equals
(
"SystemC_AMS"
))
{
mgui
.
selectMainTab
(
"SystemC_AMS"
);
}
}
return
true
;
}
...
...
@@ -233,4 +288,4 @@ public class ADDClusterNode extends ADDNode implements WithAttributes {
attr
+=
"index = "
+
index
+
"\n"
;
return
attr
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
+
26
−
3
View file @
ec402ca1
...
...
@@ -50,6 +50,7 @@ import ui.window.JDialogELNComponentResistor;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.geom.AffineTransform
;
/**
* Class ELNComponentResistor
...
...
@@ -118,7 +119,8 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent {
return
myColor
;
}
public
void
internalDrawing
(
Graphics
g
)
{
public
void
internalDrawing
(
Graphics
gr
)
{
Graphics2D
g
=
(
Graphics2D
)
gr
;
Font
f
=
g
.
getFont
();
Font
fold
=
f
;
...
...
@@ -156,11 +158,32 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent {
f
=
f
.
deriveFont
(
this
.
currentFontSize
);
}
// Zoom is assumed to be computed
// Zoom is assumed to be computed
Color
c
=
g
.
getColor
();
int
[]
ptx
=
{
x
,
x
+
width
/
4
,
x
+
width
/
4
,
x
+
3
*
width
/
4
,
x
+
3
*
width
/
4
,
x
+
width
,
x
+
3
*
width
/
4
,
x
+
3
*
width
/
4
,
x
+
width
/
4
,
x
+
width
/
4
};
int
[]
pty
=
{
y
+
height
/
2
,
y
+
height
/
2
,
y
,
y
,
y
+
height
/
2
,
y
+
height
/
2
,
y
+
height
/
2
,
y
+
height
,
y
+
height
,
y
+
height
/
2
};
g
.
drawPolygon
(
ptx
,
pty
,
10
);
Polygon
p
=
new
Polygon
(
ptx
,
pty
,
10
);
g
.
drawPolygon
(
p
);
//------------------
// Save the current transform of the graphics contexts.
AffineTransform
saveTransform
=
g
.
getTransform
();
// Create a identity affine transform, and apply to the Graphics2D context
AffineTransform
identity
=
new
AffineTransform
();
g
.
setTransform
(
identity
);
// Paint Shape (with identity transform), centered at (0, 0) as defined.
g
.
rotate
(
Math
.
toRadians
(
90
));
g
.
setTransform
(
identity
);
g
.
drawPolygon
(
p
);
g
.
fill
(
p
);
// Restore original transform before returning
g
.
setTransform
(
saveTransform
);
//------------------
//------------------
g
.
setColor
(
c
);
// Set font size
...
...
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