mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Indicate selected frame
This commit is contained in:
parent
efe90ae230
commit
590c3dda9b
@ -16,7 +16,7 @@ import javax.swing.*;
|
|||||||
simulation. It also generates run-time statistics reports for the simulation
|
simulation. It also generates run-time statistics reports for the simulation
|
||||||
jobs. It can be run with or without a GUI.
|
jobs. It can be run with or without a GUI.
|
||||||
*/
|
*/
|
||||||
public class JobPerf extends JFrame {
|
public class JobPerf {
|
||||||
ArrayList<JobExecutionEvent> jobExecEvtList;
|
ArrayList<JobExecutionEvent> jobExecEvtList;
|
||||||
JobStats jobStats;
|
JobStats jobStats;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ public class TraceViewCanvas extends JPanel {
|
|||||||
private double frameSize;
|
private double frameSize;
|
||||||
private double totalDuration;
|
private double totalDuration;
|
||||||
private FrameRecord[] frameArray;
|
private FrameRecord[] frameArray;
|
||||||
|
private int selectedFrameNumber;
|
||||||
private FrameRange frameRenderRange;
|
private FrameRange frameRenderRange;
|
||||||
private KeyedColorMap idToColorMap;
|
private KeyedColorMap idToColorMap;
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
@ -63,6 +64,7 @@ public class TraceViewCanvas extends JPanel {
|
|||||||
traceWidth = DEFAULT_TRACE_WIDTH;
|
traceWidth = DEFAULT_TRACE_WIDTH;
|
||||||
frameSize = 1.0;
|
frameSize = 1.0;
|
||||||
image = null;
|
image = null;
|
||||||
|
selectedFrameNumber = 0;
|
||||||
sToolBar = outputToolBar;
|
sToolBar = outputToolBar;
|
||||||
crossHairCursor = new Cursor( Cursor.CROSSHAIR_CURSOR );
|
crossHairCursor = new Cursor( Cursor.CROSSHAIR_CURSOR );
|
||||||
defaultCursor = new Cursor( Cursor.DEFAULT_CURSOR );
|
defaultCursor = new Cursor( Cursor.DEFAULT_CURSOR );
|
||||||
@ -230,10 +232,10 @@ public class TraceViewCanvas extends JPanel {
|
|||||||
|
|
||||||
// Determine the frame number that we clicked on from the y-
|
// Determine the frame number that we clicked on from the y-
|
||||||
// coordinate of the click position.
|
// coordinate of the click position.
|
||||||
int frameNumber = 0;
|
|
||||||
if ( y > TOP_MARGIN) {
|
if ( y > TOP_MARGIN) {
|
||||||
frameNumber = (y - TOP_MARGIN) / traceWidth + frameRenderRange.first;
|
selectedFrameNumber = (y - TOP_MARGIN) / traceWidth + frameRenderRange.first;
|
||||||
sToolBar.setFrameNumber(frameNumber);
|
sToolBar.setFrameNumber(selectedFrameNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the subframe-time where we clicked from the x-coordinate
|
// Determine the subframe-time where we clicked from the x-coordinate
|
||||||
@ -249,13 +251,14 @@ public class TraceViewCanvas extends JPanel {
|
|||||||
* times of the job, otherwise clear the start and stop fields.
|
* times of the job, otherwise clear the start and stop fields.
|
||||||
*/
|
*/
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
FrameRecord frame = frameArray[frameNumber];
|
FrameRecord frame = frameArray[selectedFrameNumber];
|
||||||
for (JobExecutionEvent jobExec : frame.jobEvents) {
|
for (JobExecutionEvent jobExec : frame.jobEvents) {
|
||||||
if (id.equals( jobExec.id)) {
|
if (id.equals( jobExec.id)) {
|
||||||
sToolBar.setJobStartTime(jobExec.start);
|
sToolBar.setJobStartTime(jobExec.start);
|
||||||
sToolBar.setJobStopTime(jobExec.stop);
|
sToolBar.setJobStopTime(jobExec.stop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repaint();
|
||||||
} else {
|
} else {
|
||||||
sToolBar.clearJobStartStopTime();
|
sToolBar.clearJobStartStopTime();
|
||||||
}
|
}
|
||||||
@ -338,6 +341,9 @@ public class TraceViewCanvas extends JPanel {
|
|||||||
int jobWidth = (int)( (jobExec.stop - jobExec.start) * pixelsPerSecond);
|
int jobWidth = (int)( (jobExec.stop - jobExec.start) * pixelsPerSecond);
|
||||||
|
|
||||||
g2d.setPaint(Color.BLACK);
|
g2d.setPaint(Color.BLACK);
|
||||||
|
if (n == selectedFrameNumber) {
|
||||||
|
g2d.setPaint(Color.GREEN);
|
||||||
|
}
|
||||||
g2d.drawString ( String.format("%d", n), 50, jobY + traceWidth/2);
|
g2d.drawString ( String.format("%d", n), 50, jobY + traceWidth/2);
|
||||||
g2d.setPaint( idToColorMap.getColor( jobExec.id ) );
|
g2d.setPaint( idToColorMap.getColor( jobExec.id ) );
|
||||||
g2d.fillRect(jobStartX, jobY, jobWidth, traceWidth-2);
|
g2d.fillRect(jobStartX, jobY, jobWidth, traceWidth-2);
|
||||||
|
Loading…
Reference in New Issue
Block a user