Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
TTool
Commits
b22d8bfd
Commit
b22d8bfd
authored
Jul 28, 2017
by
Letitia Li
Browse files
latency backtracing updated
parent
27b5c7bb
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/main/java/ui/MainGUI.java
View file @
b22d8bfd
...
...
@@ -308,7 +308,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
private
ArrayList
<
RunningInfo
>
runningIDs
;
private
ArrayList
<
LoadInfo
>
loadIDs
;
private
ConcurrentHashMap
<
Integer
,
ArrayList
<
SimulationTransaction
>>
transactionMap
=
new
ConcurrentHashMap
<
Integer
,
ArrayList
<
SimulationTransaction
>>();
private
ConcurrentHashMap
<
Integer
,
String
[]
>
latencyMap
=
new
ConcurrentHashMap
<
Integer
,
String
[]
>();
private
ConcurrentHashMap
<
Integer
,
ConcurrentHashMap
<
String
,
String
>
>
latencyMap
=
new
ConcurrentHashMap
<
Integer
,
ConcurrentHashMap
<
String
,
String
>
>();
private
ConcurrentHashMap
<
String
,
String
>
statusMap
=
new
ConcurrentHashMap
<
String
,
String
>();
private
JFrameInteractiveSimulation
jfis
;
private
JFrameAvatarInteractiveSimulation
jfais
;
...
...
@@ -3569,6 +3569,16 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
return
tmlcomp
.
getAllOutEvents
(
name
);
}
public
ArrayList
<
TGComponent
>
getAllLatencyChecks
(){
TURTLEPanel
tp
;
ArrayList
<
TGComponent
>
list
=
new
ArrayList
<
TGComponent
>();
for
(
int
i
=
0
;
i
<
tabs
.
size
();
i
++)
{
tp
=
tabs
.
elementAt
(
i
);
tp
.
getAllLatencyChecks
(
list
);
}
return
list
;
}
public
String
[]
getAllInEvents
()
{
TURTLEPanel
tp
=
getCurrentTURTLEPanel
();
if
(
tp
==
null
)
{
return
null
;}
...
...
@@ -7650,12 +7660,18 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe
public
synchronized
void
addLatencyVals
(
int
id
,
String
[]
latency
){
if
(
latencyMap
!=
null
){
latencyMap
.
put
(
id
,
latency
);
//System.out.println("Adding latency...");
if
(!
latencyMap
.
containsKey
(
id
)){
ConcurrentHashMap
<
String
,
String
>
map
=
new
ConcurrentHashMap
<
String
,
String
>();
latencyMap
.
put
(
id
,
map
);
}
latencyMap
.
get
(
id
).
put
(
latency
[
0
],
latency
[
1
]);
//System.out.println(latencyMap);
}
// System.out.println(latencyMap);
}
public
synchronized
String
[]
getLatencyVals
(
int
id
){
public
synchronized
ConcurrentHashMap
<
String
,
String
>
getLatencyVals
(
int
id
){
// System.out.println(id + " " + latencyMap);
if
(
latencyMap
!=
null
){
return
latencyMap
.
get
(
id
);
...
...
src/main/java/ui/TURTLEPanel.java
View file @
b22d8bfd
...
...
@@ -96,6 +96,12 @@ public abstract class TURTLEPanel implements GenericTree {
panelAt
(
i
).
getAllCheckableTGComponent
(
_list
);
}
}
public
void
getAllLatencyChecks
(
ArrayList
<
TGComponent
>
_list
){
for
(
int
i
=
0
;
i
<
panels
.
size
();
i
++)
{
panelAt
(
i
).
getAllLatencyChecks
(
_list
);
}
}
public
void
removeElementAt
(
int
index
)
{
panels
.
removeElementAt
(
index
);
...
...
src/main/java/ui/avatarsmd/AvatarSMDReceiveSignal.java
View file @
b22d8bfd
...
...
@@ -47,11 +47,17 @@ import ui.*;
import
ui.util.IconManager
;
import
ui.window.JDialogAvatarSignal
;
import
java.util.concurrent.ConcurrentHashMap
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.geom.Line2D
;
import
java.util.LinkedList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Vector
;
import
ui.tmlad.TMLADReadChannel
;
/**
* Class AvatarSMDReceiveSignal
* Action of receiving a signal
...
...
@@ -67,8 +73,9 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C
protected
int
linebreak
=
10
;
protected
int
textX1
=
2
;
private
HashMap
<
String
,
String
>
latencyVals
;
private
ConcurrentHashMap
<
String
,
String
>
latencyVals
;
private
TGComponent
reference
;
protected
int
latencyX
=
30
;
protected
int
latencyY
=
10
;
protected
int
textWidth
=
10
;
...
...
@@ -99,7 +106,7 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C
//makeValue();
myImageIcon
=
IconManager
.
imgic908
;
latencyVals
=
new
HashMap
<
String
,
String
>();
latencyVals
=
new
Concurrent
HashMap
<
String
,
String
>();
//latencyVals.put("sendChannel: sensorData", "15");
}
...
...
@@ -168,27 +175,46 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C
g
.
drawString
(
value
,
x
+
linebreak
+
textX1
,
y
+
textY
);
//System.out.println(getDIPLOID());
if
(
getCheckLatency
()){
String
[]
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getAVATARID
());
ConcurrentHashMap
<
String
,
String
>
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getAVATARID
());
if
(
latency
!=
null
){
addL
atency
(
latency
[
0
],
latency
[
1
])
;
l
atency
Vals
=
latency
;
drawLatencyInformation
(
g
);
}
}
}
public
void
drawLatencyInformation
(
Graphics
g
){
int
index
=
1
;
for
(
String
s:
latencyVals
.
keySet
()){
int
w
=
g
.
getFontMetrics
().
stringWidth
(
s
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
*
index
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
*
index
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
*
index
);
Color
c
=
g
.
getColor
();
g
.
setColor
(
Color
.
RED
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
/
2
);
if
(
reference
instanceof
TMLADReadChannel
){
// System.out.println("ref " + reference.toString().split(": ")[1].split("\\(")[0] + " " + s.split("-")[1].split(":")[0]);
TMLADReadChannel
rc
=
(
TMLADReadChannel
)
reference
;
ConcurrentHashMap
<
String
,
String
>
refLats
=
rc
.
getLatencyMap
();
//System.out.println("referencelats " + refLats);
for
(
String
checkpoint:
refLats
.
keySet
()){
if
(
s
.
split
(
"\\-"
)[
1
].
split
(
":"
)[
0
].
equals
(
checkpoint
.
split
(
"channel:"
)[
1
].
split
(
" "
)[
0
])){
String
time
=
refLats
.
get
(
checkpoint
);
int
tdip
=
Integer
.
valueOf
(
time
);
int
tav
=
Integer
.
valueOf
(
latencyVals
.
get
(
s
));
if
(
Math
.
abs
(
tdip
-
tav
)>
tdip
){
g
.
setColor
(
Color
.
RED
);
}
else
{
g
.
setColor
(
Color
.
GREEN
);
}
}
}
}
System
.
out
.
println
(
"drawing..."
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
*
index
/
2
);
g
.
setColor
(
c
);
}
}
public
TGComponent
isOnMe
(
int
_x
,
int
_y
)
{
if
(
GraphicLib
.
isInRectangle
(
_x
,
_y
,
x
,
y
,
width
,
height
))
{
...
...
@@ -259,9 +285,17 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C
LinkedList
<
AvatarSignal
>
signals
=
tdp
.
getMGUI
().
getAllSignals
();
TraceManager
.
addDev
(
"Nb of signals:"
+
signals
.
size
());
JDialogAvatarSignal
jdas
=
new
JDialogAvatarSignal
(
frame
,
"Setting receive signal"
,
value
,
signals
,
false
);
ArrayList
<
TGComponent
>
comps
=
tdp
.
getMGUI
().
getAllLatencyChecks
();
Vector
<
TGComponent
>
refs
=
new
Vector
<
TGComponent
>();
for
(
TGComponent
tg:
comps
){
if
(
tg
instanceof
TMLADReadChannel
){
refs
.
add
(
tg
);
}
}
JDialogAvatarSignal
jdas
=
new
JDialogAvatarSignal
(
frame
,
"Setting receive signal"
,
value
,
signals
,
false
,
reference
,
refs
);
//jdas.setSize(350, 300);
GraphicLib
.
centerOnParent
(
jdas
,
3
50
,
300
);
GraphicLib
.
centerOnParent
(
jdas
,
5
50
,
300
);
jdas
.
setVisible
(
true
);
// blocked until dialog has been closed
if
(
jdas
.
hasBeenCancelled
())
{
...
...
@@ -269,7 +303,9 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C
}
String
val
=
jdas
.
getSignal
();
if
(
jdas
.
getReference
()!=
null
){
reference
=
jdas
.
getReference
();
}
if
(
val
.
indexOf
(
'('
)
==
-
1
)
{
val
+=
"()"
;
}
...
...
src/main/java/ui/avatarsmd/AvatarSMDSendSignal.java
View file @
b22d8bfd
...
...
@@ -50,8 +50,12 @@ import javax.swing.*;
import
java.awt.*
;
import
java.awt.geom.Line2D
;
import
java.util.LinkedList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.Vector
;
import
ui.tmlad.TMLADWriteChannel
;
/**
* Class AvatarSMDSendSignal
* Action of sending a signal
...
...
@@ -66,8 +70,9 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec
protected
int
arc
=
5
;
protected
int
linebreak
=
10
;
private
HashMap
<
String
,
String
>
latencyVals
;
private
ConcurrentHashMap
<
String
,
String
>
latencyVals
;
private
TGComponent
reference
;
protected
int
latencyX
=
30
;
protected
int
latencyY
=
10
;
protected
int
textWidth
=
10
;
...
...
@@ -98,7 +103,7 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec
//makeValue();
myImageIcon
=
IconManager
.
imgic904
;
latencyVals
=
new
HashMap
<
String
,
String
>();
latencyVals
=
new
Concurrent
HashMap
<
String
,
String
>();
}
public
void
addLatency
(
String
name
,
String
num
){
latencyVals
.
put
(
name
,
num
);
...
...
@@ -161,26 +166,44 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec
//g.drawString("sig()", x+(width-w) / 2, y);
g
.
drawString
(
value
,
x
+
(
width
-
w
)
/
2
,
y
+
textY
);
//g.drawString("Reference " + reference, x-latencyX/2, y+latencyY/2);
if
(
getCheckLatency
()){
String
[]
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getAVATARID
());
ConcurrentHashMap
<
String
,
String
>
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getAVATARID
());
if
(
latency
!=
null
){
addL
atency
(
latency
[
0
],
latency
[
1
])
;
l
atency
Vals
=
latency
;
drawLatencyInformation
(
g
);
}
}
}
public
void
drawLatencyInformation
(
Graphics
g
){
int
index
=
1
;
for
(
String
s:
latencyVals
.
keySet
()){
int
w
=
g
.
getFontMetrics
().
stringWidth
(
s
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
*
index
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
*
index
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
*
index
);
Color
c
=
g
.
getColor
();
g
.
setColor
(
Color
.
RED
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
/
2
);
if
(
reference
instanceof
TMLADWriteChannel
){
// System.out.println("ref " + reference.toString().split(": ")[1].split("\\(")[0] + " " + s.split("-")[1].split(":")[0]);
TMLADWriteChannel
rc
=
(
TMLADWriteChannel
)
reference
;
ConcurrentHashMap
<
String
,
String
>
refLats
=
rc
.
getLatencyMap
();
//System.out.println("referencelats " + refLats);
for
(
String
checkpoint:
refLats
.
keySet
()){
if
(
s
.
split
(
"\\-"
)[
1
].
split
(
":"
)[
0
].
equals
(
checkpoint
.
split
(
":"
)[
1
].
split
(
" "
)[
0
])){
String
time
=
refLats
.
get
(
checkpoint
);
int
tdip
=
Integer
.
valueOf
(
time
);
int
tav
=
Integer
.
valueOf
(
latencyVals
.
get
(
s
));
if
(
Math
.
abs
(
tdip
-
tav
)>
tdip
){
g
.
setColor
(
Color
.
RED
);
}
else
{
g
.
setColor
(
Color
.
GREEN
);
}
}
}
}
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
*
index
/
2
);
g
.
setColor
(
c
);
}
}
...
...
@@ -252,10 +275,17 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec
public
boolean
editOndoubleClick
(
JFrame
frame
)
{
LinkedList
<
AvatarSignal
>
signals
=
tdp
.
getMGUI
().
getAllSignals
();
//TraceManager.addDev("Nb of signals:" + signals.size());
JDialogAvatarSignal
jdas
=
new
JDialogAvatarSignal
(
frame
,
"Setting send signal"
,
value
,
signals
,
true
);
ArrayList
<
TGComponent
>
comps
=
tdp
.
getMGUI
().
getAllLatencyChecks
();
Vector
<
TGComponent
>
refs
=
new
Vector
<
TGComponent
>();
refs
.
add
(
null
);
for
(
TGComponent
tg:
comps
){
if
(
tg
instanceof
TMLADWriteChannel
){
refs
.
add
(
tg
);
}
}
JDialogAvatarSignal
jdas
=
new
JDialogAvatarSignal
(
frame
,
"Setting send signal"
,
value
,
signals
,
true
,
reference
,
refs
);
// jdas.setSize(350, 300);
GraphicLib
.
centerOnParent
(
jdas
,
3
50
,
300
);
GraphicLib
.
centerOnParent
(
jdas
,
5
50
,
300
);
jdas
.
setVisible
(
true
);
// blocked until dialog has been closed
if
(
jdas
.
hasBeenCancelled
())
{
...
...
@@ -263,6 +293,9 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec
}
String
val
=
jdas
.
getSignal
();
if
(
jdas
.
getReference
()!=
null
){
reference
=
jdas
.
getReference
();
}
if
(
val
.
indexOf
(
'('
)
==
-
1
)
{
val
+=
"()"
;
...
...
src/main/java/ui/tmlad/TMLADReadChannel.java
View file @
b22d8bfd
...
...
@@ -54,6 +54,8 @@ import java.awt.*;
import
java.awt.geom.Line2D
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Class TMLADReadChannel
* Action of writting data in channel
...
...
@@ -62,7 +64,7 @@ import java.util.HashMap;
* @author Ludovic APVRILLE
*/
public
class
TMLADReadChannel
extends
TGCWithoutInternalComponent
implements
CheckableAccessibility
,
CheckableLatency
,
EmbeddedComment
,
AllowedBreakpoint
,
BasicErrorHighlight
{
private
HashMap
<
String
,
String
>
latencyVals
;
private
Concurrent
HashMap
<
String
,
String
>
latencyVals
;
protected
int
lineLength
=
5
;
protected
int
textX
=
5
;
protected
int
textX0
=
2
;
...
...
@@ -107,7 +109,7 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che
name
=
"read channel"
;
myImageIcon
=
IconManager
.
imgic906
;
latencyVals
=
new
HashMap
<
String
,
String
>();
latencyVals
=
new
Concurrent
HashMap
<
String
,
String
>();
//latencyVals.put("sendChannel: sensorData", "3");
}
...
...
@@ -115,6 +117,11 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che
public
void
addLatency
(
String
name
,
String
num
){
latencyVals
.
put
(
name
,
num
);
}
public
ConcurrentHashMap
<
String
,
String
>
getLatencyMap
(){
return
latencyVals
;
}
public
void
internalDrawing
(
Graphics
g
)
{
int
w
=
g
.
getFontMetrics
().
stringWidth
(
value
);
int
w1
=
Math
.
max
(
minWidth
,
w
+
2
*
textX
);
...
...
@@ -171,21 +178,24 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che
}
drawReachabilityInformation
(
g
);
if
(
getCheckLatency
()){
String
[]
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getDIPLOID
());
ConcurrentHashMap
<
String
,
String
>
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getDIPLOID
());
//System.out.println(latency);
if
(
latency
!=
null
){
addL
atency
(
latency
[
0
],
latency
[
1
])
;
drawLatencyInformation
(
g
);
l
atency
Vals
=
latency
;
drawLatencyInformation
(
g
);
}
}
}
public
void
drawLatencyInformation
(
Graphics
g
){
int
index
=
1
;
for
(
String
s:
latencyVals
.
keySet
()){
int
w
=
g
.
getFontMetrics
().
stringWidth
(
s
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
/
2
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
*
index
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
*
index
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
*
index
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
*
index
/
2
);
index
++;
}
}
...
...
src/main/java/ui/tmlad/TMLADWriteChannel.java
View file @
b22d8bfd
...
...
@@ -56,6 +56,8 @@ import java.awt.geom.Line2D;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Class TMLADWriteChannel
* Action of writting data in channel
...
...
@@ -71,7 +73,7 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch
protected
int
linebreak
=
10
;
private
HashMap
<
String
,
String
>
latencyVals
;
private
Concurrent
HashMap
<
String
,
String
>
latencyVals
;
protected
int
latencyX
=
30
;
protected
int
latencyY
=
10
;
...
...
@@ -112,9 +114,13 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch
name
=
"write channel"
;
myImageIcon
=
IconManager
.
imgic900
;
latencyVals
=
new
HashMap
<
String
,
String
>();
latencyVals
=
new
Concurrent
HashMap
<
String
,
String
>();
}
public
ConcurrentHashMap
<
String
,
String
>
getLatencyMap
(){
return
latencyVals
;
}
public
void
internalDrawing
(
Graphics
g
)
{
int
w
=
g
.
getFontMetrics
().
stringWidth
(
value
);
int
w1
=
Math
.
max
(
minWidth
,
w
+
2
*
textX
);
...
...
@@ -170,22 +176,25 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch
}
if
(
getCheckLatency
()){
String
[]
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getDIPLOID
());
ConcurrentHashMap
<
String
,
String
>
latency
=
tdp
.
getMGUI
().
getLatencyVals
(
getDIPLOID
());
//System.out.println(latency);
if
(
latency
!=
null
){
addL
atency
(
latency
[
0
],
latency
[
1
])
;
drawLatencyInformation
(
g
);
l
atency
Vals
=
latency
;
drawLatencyInformation
(
g
);
}
}
drawReachabilityInformation
(
g
);
}
public
void
drawLatencyInformation
(
Graphics
g
){
int
index
=
1
;
for
(
String
s:
latencyVals
.
keySet
()){
int
w
=
g
.
getFontMetrics
().
stringWidth
(
s
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
/
2
);
g
.
drawString
(
s
,
x
-
latencyX
-
w
+
1
,
y
-
latencyY
*
index
-
2
);
g
.
drawRect
(
x
-
latencyX
-
w
,
y
-
latencyY
*
index
-
textHeight
,
w
+
4
,
textHeight
);
g
.
drawLine
(
x
,
y
,
x
-
latencyX
,
y
-
latencyY
*
index
);
g
.
drawString
(
latencyVals
.
get
(
s
),
x
-
latencyX
/
2
,
y
-
latencyY
*
index
/
2
);
index
++;
}
}
...
...
src/main/java/ui/window/JDialogAvatarSignal.java
View file @
b22d8bfd
...
...
@@ -43,13 +43,15 @@ package ui.window;
import
ui.AvatarSignal
;
import
ui.util.IconManager
;
import
ui.TGComponent
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Vector
;
/**
* Class JDialogAvatarSignal
* Dialog for managing several string components
...
...
@@ -63,9 +65,14 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
private
LinkedList
<
String
>
showSignals
;
private
String
currentSignal
;
private
boolean
isOut
;
private
TGComponent
reference
;
private
Vector
<
TGComponent
>
refs
;
private
boolean
cancelled
=
false
;
private
JComboBox
<
TGComponent
>
refChecks
;
private
JPanel
panel1
;
// Panel1
...
...
@@ -79,18 +86,22 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
/** Creates new form */
public
JDialogAvatarSignal
(
Frame
_f
,
String
_title
,
String
_currentSignal
,
LinkedList
<
AvatarSignal
>
_signals
,
boolean
_isOut
)
{
public
JDialogAvatarSignal
(
Frame
_f
,
String
_title
,
String
_currentSignal
,
LinkedList
<
AvatarSignal
>
_signals
,
boolean
_isOut
,
TGComponent
_reference
,
Vector
<
TGComponent
>
_refs
)
{
super
(
_f
,
_title
,
true
);
signals
=
_signals
;
currentSignal
=
_currentSignal
;
isOut
=
_isOut
;
reference
=
_reference
;
refs
=
_refs
;
makeSignals
();
initComponents
();
myInitComponents
();
pack
();
}
...
...
@@ -126,7 +137,7 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
panel1
.
setBorder
(
new
javax
.
swing
.
border
.
TitledBorder
(
"Signals"
));
panel1
.
setPreferredSize
(
new
Dimension
(
3
00
,
1
50
));
panel1
.
setPreferredSize
(
new
Dimension
(
5
00
,
2
50
));
// first line panel1
c1
.
weighty
=
1.0
;
...
...
@@ -162,6 +173,16 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
panel1
.
add
(
signal
,
c1
);
//panel1.setEditable(true);
//Reference to DIPLODOCUS signal
c1
.
gridwidth
=
1
;
c1
.
fill
=
GridBagConstraints
.
HORIZONTAL
;
c1
.
anchor
=
GridBagConstraints
.
CENTER
;
panel1
.
add
(
new
JLabel
(
"Reference Requirement"
),
c1
);
c1
.
gridwidth
=
GridBagConstraints
.
REMAINDER
;
//end row
refChecks
=
new
JComboBox
<
TGComponent
>(
refs
);
panel1
.
add
(
refChecks
,
c1
);
// main panel;
c0
.
gridwidth
=
1
;
c0
.
gridheight
=
10
;
...
...
@@ -171,6 +192,9 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
c
.
add
(
panel1
,
c0
);
c0
.
gridwidth
=
1
;
c0
.
gridheight
=
1
;
c0
.
fill
=
GridBagConstraints
.
HORIZONTAL
;
...
...
@@ -209,6 +233,11 @@ public class JDialogAvatarSignal extends javax.swing.JDialog implements ActionLi
public
String
getSignal
()
{
return
signal
.
getText
();
}
public
TGComponent
getReference
(){
return
(
TGComponent
)
refChecks
.
getSelectedItem
();
}
public
boolean
hasValidString
()
{
return
signal
.
getText
().
length
()
>
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment