From 8b30328a0fc2844e45032ccf561a76d655d3b155 Mon Sep 17 00:00:00 2001 From: Flashynurav Date: Mon, 24 Feb 2020 22:33:24 -0800 Subject: [PATCH] REI V.9.1.0 Fixes to timemap. --- roboterroridentifier/OverviewManager.java | 70 +++++++++++-------- .../RobotErrorIdentifier.java | 2 +- testing/coordinateTesting.txt | 1 + 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/roboterroridentifier/OverviewManager.java b/roboterroridentifier/OverviewManager.java index 8cfb170..04729f5 100644 --- a/roboterroridentifier/OverviewManager.java +++ b/roboterroridentifier/OverviewManager.java @@ -35,31 +35,33 @@ * A class to manage overviews. */ public class OverviewManager { - private static JFrame sliderFrame; - private static JPanel jp; - private static JSlider sliderBar; - private static JLabel jlb; - private static JTextArea jta; - private static JComboBox jcb; - private static int tValue; - private static LogList mData; - private static JFrame imageFrame = new JFrame();; + private static JFrame sliderFrame = new JFrame("Slider Frame"); + private static JPanel jp = new JPanel(); + private static JSlider sliderBar = new JSlider(); + private static JLabel jlb = new JLabel(); + private static JTextArea jta = new JTextArea(); + private static JComboBox jcb = null; + private static int tValue = 0; + private static LogList mData = new LogList(); + private static JFrame imageFrame = new JFrame("Image Frame"); private static ImagePanel[] allImagePanels = new ImagePanel[0]; - private static String[] panelNames; - private static JComboBox viewChooser; + private static String[] panelNames = new String[0]; + private static JComboBox viewChooser = null; private static ArrayList activeActuators = new ArrayList<>(); - private static int xPos; - private static int yPos; + private static int xPos = 0; + private static int yPos = 0; private static JLabel pointLabel = new JLabel("Last clicked point: X, Y"); public static void createSliderWindow(final LogList data) { + sliderFrame.getContentPane().removeAll(); + imageFrame.getContentPane().removeAll(); mData = data; + allImagePanels = new ImagePanel[0]; allImagePanels = Arrays.copyOf(allImagePanels, OverviewManager.ImageStorage.values().length); for (int i = 0; i < OverviewManager.ImageStorage.values().length; i++) { allImagePanels[i] = new ImagePanel(OverviewManager.ImageStorage.values()[i].getName(), OverviewManager.ImageStorage.values()[i].getPath()); } - sliderFrame = new JFrame("Slider Frame"); jp = new JPanel(); jp.setLayout(new FlowLayout()); sliderBar = new JSlider(0, GraphManager.maxSec(data), 0); @@ -83,7 +85,7 @@ public static void createSliderWindow(final LogList data) { sliderBar.setForeground(LoggerGUI.plainWhite); jlb.setBounds(275, 25, 100, 50); - jlb.setText("@t = " + sliderBar.getValue()); + jlb.setText("@t = " + "0 - 1"); jcb.setBounds(50, 125, 300, 20); jcb.setBackground(LoggerGUI.spartaGreen); @@ -103,15 +105,18 @@ public void actionPerformed(final ActionEvent a) { } }); pointLabel.setBounds(125, 75, 400, 50); + sliderFrame.add(sliderBar); sliderFrame.add(jlb); sliderFrame.add(jcb); sliderFrame.add(tlviewer); sliderFrame.add(pointLabel); sliderFrame.add(jp); + sliderFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); sliderFrame.setSize(400, 600); sliderFrame.setResizable(false); sliderFrame.setVisible(true); + imageFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } public static int getTValue() { @@ -166,17 +171,19 @@ public static void updateErrors(final int t) { } } jta.append("Logs in " + "Other" + ":\n"); - for (int j = 0; j < subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.size(); j++) { - jta.append(subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.get(j) + " @t = " + subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).timeStamps.get(j) + "\n"); - for (int k = 0; k < LoggerFilter.ACTUATOR_NAMES.size(); k++) { - if (subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.get(j).contains("@" + LoggerFilter.ACTUATOR_NAMES.get(k) + "@")) { - if (!activeActuators.contains(LoggerFilter.ACTUATOR_NAMES.get(k))) { - activeActuators.add(LoggerFilter.ACTUATOR_NAMES.get(k)); - } - } + for (int j = 0; j < subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.size(); j++) { + jta.append(subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.get(j) + " @t = " + + subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).timeStamps.get(j) + "\n"); + for (int k = 0; k < LoggerFilter.ACTUATOR_NAMES.size(); k++) { + if (subLogs.get(LoggerFilter.SUBSYSTEM_KEYS.length).messages.get(j) + .contains("@" + LoggerFilter.ACTUATOR_NAMES.get(k) + "@")) { + if (!activeActuators.contains(LoggerFilter.ACTUATOR_NAMES.get(k))) { + activeActuators.add(LoggerFilter.ACTUATOR_NAMES.get(k)); } } - jta.append("\n"); + } + } + jta.append("\n"); } public static boolean checkAllowedDisplay(final int n) { @@ -203,13 +210,16 @@ public static void createOverview(final LogList data) { viewChooser.setBackground(LoggerGUI.spartaGreen); viewChooser.setForeground(LoggerGUI.plainWhite); imageFrame.add(viewChooser); - viewChooser.addActionListener(new ActionListener() { - @Override - public void actionPerformed(final ActionEvent e) { - updateGraphics(); - } - }); + if (viewChooser.getActionListeners().length < 1) { + viewChooser.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent e) { + updateGraphics(); + } + }); + } updateGraphics(); + updateErrors(0); } public static void updateGraphics() { diff --git a/roboterroridentifier/RobotErrorIdentifier.java b/roboterroridentifier/RobotErrorIdentifier.java index 8d3e135..0f1d8ed 100644 --- a/roboterroridentifier/RobotErrorIdentifier.java +++ b/roboterroridentifier/RobotErrorIdentifier.java @@ -8,7 +8,7 @@ * errors, and much more. Helpful for post-match diagnostics. * - * @version 9.0.0 + * @version 9.1.0 * @author Team 2976! * @see Github: https://github.com/SkylineSpartabots/RobotErrorIdentifier */ diff --git a/testing/coordinateTesting.txt b/testing/coordinateTesting.txt index 43dccd1..e03cee2 100644 --- a/testing/coordinateTesting.txt +++ b/testing/coordinateTesting.txt @@ -44,3 +44,4 @@ RANDOM_JUNK RANDOM_JUNK S_LOG !!! Error: <7.2> Limelight green light failed @Limelight@ !!! E_LOG S_LOG !!! Error: <7.6> Lmao bruh idk limelight @Limelight@ !!! E_LOG +junk