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
d32e1382
Commit
d32e1382
authored
6 years ago
by
Irina LEE
Browse files
Options
Downloads
Patches
Plain Diff
add condition to connector (eln)
parent
d71a0a3a
No related branches found
No related tags found
1 merge request
!72
Syscams
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/ui/eln/ELNConnector.java
+101
-33
101 additions, 33 deletions
src/main/java/ui/eln/ELNConnector.java
with
101 additions
and
33 deletions
src/main/java/ui/eln/ELNConnector.java
+
101
−
33
View file @
d32e1382
...
@@ -45,6 +45,7 @@ import ui.window.JDialogELNConnector;
...
@@ -45,6 +45,7 @@ import ui.window.JDialogELNConnector;
import
java.awt.*
;
import
java.awt.*
;
import
java.util.*
;
import
java.util.*
;
import
javax.swing.JFrame
;
import
javax.swing.JFrame
;
import
myutil.GraphicLib
;
/**
/**
* Class ELNConnector
* Class ELNConnector
...
@@ -83,50 +84,117 @@ public class ELNConnector extends TGConnector implements ScalableTGComponent {
...
@@ -83,50 +84,117 @@ public class ELNConnector extends TGConnector implements ScalableTGComponent {
return
true
;
return
true
;
}
}
protected
void
drawLastSegment
(
Graphics
g
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
protected
void
drawLastSegment
(
Graphics
gr
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
Graphics2D
g
=
(
Graphics2D
)
gr
;
int
w
=
g
.
getFontMetrics
().
stringWidth
(
value
);
int
w
=
g
.
getFontMetrics
().
stringWidth
(
value
);
Font
fold
=
g
.
getFont
();
Font
fold
=
g
.
getFont
();
Font
f
=
fold
.
deriveFont
(
Font
.
ITALIC
,
(
float
)
(
tdp
.
getFontSize
()));
Font
f
=
fold
.
deriveFont
(
Font
.
ITALIC
,
(
float
)
(
tdp
.
getFontSize
()));
g
.
setFont
(
f
);
g
.
setFont
(
f
);
if
(
get_p1
().
getFather
()
instanceof
ELNComponent
)
{
if
(
get_p2
().
getFather
()
instanceof
ELNComponent
)
{
ELNConnectingPoint
pt1
=
(
ELNConnectingPoint
)
p1
;
editable
=
true
;
ELNConnectingPoint
pt2
=
(
ELNConnectingPoint
)
p2
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
if
(
pt1
.
getFather
()
instanceof
ELNComponent
&&
pt2
.
getFather
()
instanceof
ELNComponent
)
{
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt1
.
getFather
()
instanceof
ELNComponent
&&
pt2
.
getFather
()
instanceof
ELNMidPortTerminal
)
{
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
pt2
.
getFather
()).
getFather
();
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
if
(
connector
.
getValue
().
equals
(
""
))
{
value
=
searchName
(
connector
);
}
}
if
(
get_p2
().
getFather
()
instanceof
ELNMidPortTerminal
)
{
}
else
if
(
pt1
.
getFather
()
instanceof
ELNMidPortTerminal
&&
pt2
.
getFather
()
instanceof
ELNComponent
)
{
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
get_p2
().
getFather
()).
getFather
();
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
if
(!
connector
.
getValue
().
equals
(
""
))
{
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
pt1
.
getFather
()).
getFather
();
value
=
connector
.
getValue
();
if
(
connector
.
getValue
().
equals
(
""
))
{
}
else
{
value
=
searchName
(
connector
);
value
=
searchName
(
connector
);
}
}
}
}
}
else
if
(
pt1
.
getFather
()
instanceof
ELNModuleTerminal
&&
pt2
.
getFather
()
instanceof
ELNModuleTerminal
)
{
if
(
get_p1
().
getFather
()
instanceof
ELNMidPortTerminal
)
{
String
name1
=
((
ELNModuleTerminal
)
pt1
.
getFather
()).
getValue
();
if
(
get_p2
().
getFather
()
instanceof
ELNComponent
)
{
String
name2
=
((
ELNModuleTerminal
)
pt2
.
getFather
()).
getValue
();
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
get_p1
().
getFather
()).
getFather
();
if
(
name1
.
equals
(
name2
))
{
if
(!
connector
.
getValue
().
equals
(
""
))
{
value
=
name1
;
value
=
connector
.
getValue
();
}
}
else
{
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
value
=
searchName
(
connector
);
editable
=
true
;
}
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt1
.
getFather
()
instanceof
ELNModuleTerminal
&&
pt2
.
getFather
()
instanceof
ELNClusterTerminal
)
{
String
name1
=
((
ELNModuleTerminal
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNClusterTerminal
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt2
.
getFather
()
instanceof
ELNModuleTerminal
&&
pt1
.
getFather
()
instanceof
ELNClusterTerminal
)
{
String
name1
=
((
ELNClusterTerminal
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNModuleTerminal
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt1
.
getFather
()
instanceof
ELNModulePortDE
&&
pt2
.
getFather
()
instanceof
ELNClusterPortDE
)
{
String
name1
=
((
ELNModulePortDE
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNClusterPortDE
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
Stroke
dashed
=
new
BasicStroke
(
1
,
BasicStroke
.
CAP_BUTT
,
BasicStroke
.
JOIN_BEVEL
,
0
,
new
float
[]
{
9
},
0
);
g
.
setStroke
(
dashed
);
GraphicLib
.
arrowWithLine
(
g
,
1
,
0
,
10
,
x1
,
y1
,
x2
,
y2
,
true
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt2
.
getFather
()
instanceof
ELNModulePortDE
&&
pt1
.
getFather
()
instanceof
ELNClusterPortDE
)
{
String
name1
=
((
ELNClusterPortDE
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNModulePortDE
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
}
Stroke
dashed
=
new
BasicStroke
(
1
,
BasicStroke
.
CAP_BUTT
,
BasicStroke
.
JOIN_BEVEL
,
0
,
new
float
[]
{
9
},
0
);
g
.
setStroke
(
dashed
);
GraphicLib
.
arrowWithLine
(
g
,
1
,
0
,
10
,
x1
,
y1
,
x2
,
y2
,
true
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt1
.
getFather
()
instanceof
ELNModulePortTDF
&&
pt2
.
getFather
()
instanceof
ELNClusterPortTDF
)
{
String
name1
=
((
ELNModulePortTDF
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNClusterPortTDF
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
GraphicLib
.
arrowWithLine
(
g
,
1
,
0
,
10
,
x1
,
y1
,
x2
,
y2
,
true
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
if
(
pt2
.
getFather
()
instanceof
ELNModulePortTDF
&&
pt1
.
getFather
()
instanceof
ELNClusterPortTDF
)
{
String
name1
=
((
ELNClusterPortTDF
)
pt1
.
getFather
()).
getValue
();
String
name2
=
((
ELNModulePortTDF
)
pt2
.
getFather
()).
getValue
();
if
(
name1
.
equals
(
name2
))
{
value
=
name1
;
}
GraphicLib
.
arrowWithLine
(
g
,
1
,
0
,
10
,
x1
,
y1
,
x2
,
y2
,
true
);
editable
=
true
;
g
.
drawString
(
value
,
(
x1
+
x2
-
w
)
/
2
,
(
y1
+
y2
)
/
2
);
}
else
{
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
}
}
g
.
setFont
(
fold
);
g
.
setFont
(
fold
);
g
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
}
}
private
String
searchName
(
ELNConnector
c
)
{
private
String
searchName
(
ELNConnector
c
)
{
if
(
c
.
get_p1
()
.
getFather
()
instanceof
ELNComponent
)
{
if
(
c
.
p1
.
getFather
()
instanceof
ELNComponent
)
{
if
(
c
.
get_p2
()
.
getFather
()
instanceof
ELNComponent
)
{
if
(
c
.
p2
.
getFather
()
instanceof
ELNComponent
)
{
return
c
.
getValue
();
return
c
.
getValue
();
}
}
if
(
c
.
get_p2
()
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
get_p2
()
.
getFather
()
instanceof
ELNModuleTerminal
Inout
)
{
if
(
c
.
p2
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
p2
.
getFather
()
instanceof
ELNModuleTerminal
)
{
return
""
;
return
""
;
}
}
if
(
c
.
get_p2
()
.
getFather
()
instanceof
ELNMidPortTerminal
)
{
if
(
c
.
p2
.
getFather
()
instanceof
ELNMidPortTerminal
)
{
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
c
.
get_p2
()
.
getFather
()).
getFather
();
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
c
.
p2
.
getFather
()).
getFather
();
if
(!
connector
.
getValue
().
equals
(
""
))
{
if
(!
connector
.
getValue
().
equals
(
""
))
{
return
connector
.
getValue
();
return
connector
.
getValue
();
}
else
{
}
else
{
...
@@ -134,15 +202,15 @@ public class ELNConnector extends TGConnector implements ScalableTGComponent {
...
@@ -134,15 +202,15 @@ public class ELNConnector extends TGConnector implements ScalableTGComponent {
}
}
}
}
}
}
if
(
c
.
get_p1
()
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
get_p1
()
.
getFather
()
instanceof
ELNModuleTerminal
Inout
)
{
if
(
c
.
p1
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
p1
.
getFather
()
instanceof
ELNModuleTerminal
)
{
return
""
;
return
""
;
}
}
if
(
c
.
get_p1
()
.
getFather
()
instanceof
ELNMidPortTerminal
)
{
if
(
c
.
p1
.
getFather
()
instanceof
ELNMidPortTerminal
)
{
if
(
c
.
get_p2
()
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
get_p2
()
.
getFather
()
instanceof
ELNModuleTerminal
Inout
)
{
if
(
c
.
p2
.
getFather
()
instanceof
ELNComponentNodeRef
||
c
.
p2
.
getFather
()
instanceof
ELNModuleTerminal
)
{
return
""
;
return
""
;
}
}
if
(
c
.
get_p2
()
.
getFather
()
instanceof
ELNComponent
)
{
if
(
c
.
p2
.
getFather
()
instanceof
ELNComponent
)
{
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
c
.
get_p1
()
.
getFather
()).
getFather
();
ELNConnector
connector
=
(
ELNConnector
)
((
ELNMidPortTerminal
)
c
.
p1
.
getFather
()).
getFather
();
if
(!
connector
.
getValue
().
equals
(
""
))
{
if
(!
connector
.
getValue
().
equals
(
""
))
{
return
connector
.
getValue
();
return
connector
.
getValue
();
}
else
{
}
else
{
...
...
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