From 843851bd91f9f70e645cde605ee86d531e1fde22 Mon Sep 17 00:00:00 2001 From: kascade Date: Sun, 14 Jan 2007 14:06:27 +0000 Subject: [PATCH] logger overlay updated git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@430 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d --- src/enginuity/logger/ui/EcuLoggerMenuBar.java | 1 - .../ui/handler/table/TableUpdateHandler.java | 4 +- src/enginuity/maps/DataCell.java | 21 +++- src/enginuity/maps/Table.java | 48 +++++---- src/enginuity/maps/Table1D.java | 4 + src/enginuity/maps/Table2D.java | 15 ++- src/enginuity/maps/Table3D.java | 39 +++++--- src/enginuity/maps/TableSwitch.java | 12 ++- src/enginuity/swing/TableFrame.java | 2 +- src/enginuity/swing/TableMenuBar.java | 11 +-- src/enginuity/swing/TableToolBar.java | 97 ++++++++++++------- 11 files changed, 168 insertions(+), 86 deletions(-) diff --git a/src/enginuity/logger/ui/EcuLoggerMenuBar.java b/src/enginuity/logger/ui/EcuLoggerMenuBar.java index acd7c314..ba8735b6 100644 --- a/src/enginuity/logger/ui/EcuLoggerMenuBar.java +++ b/src/enginuity/logger/ui/EcuLoggerMenuBar.java @@ -82,7 +82,6 @@ public class EcuLoggerMenuBar extends JMenuBar implements ActionListener { add(settingsMenu); settingsMenu.setMnemonic('E'); logFileLocation.setMnemonic('F'); - settingsMenu.add(new JSeparator()); settingsMenu.add(logFileLocation); logFileLocation.addActionListener(this); diff --git a/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java b/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java index 6871751e..3872e9a2 100644 --- a/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java +++ b/src/enginuity/logger/ui/handler/table/TableUpdateHandler.java @@ -26,14 +26,14 @@ import enginuity.logger.ui.handler.DataUpdateHandler; import enginuity.maps.Table; import java.util.ArrayList; -import java.util.Collections; +import static java.util.Collections.synchronizedMap; import java.util.HashMap; import java.util.List; import java.util.Map; public final class TableUpdateHandler implements DataUpdateHandler { private static final TableUpdateHandler INSTANCE = new TableUpdateHandler(); - private final Map> tableMap = Collections.synchronizedMap(new HashMap>()); + private final Map> tableMap = synchronizedMap(new HashMap>()); private TableUpdateHandler() { } diff --git a/src/enginuity/maps/DataCell.java b/src/enginuity/maps/DataCell.java index 6027916a..ea607e3d 100644 --- a/src/enginuity/maps/DataCell.java +++ b/src/enginuity/maps/DataCell.java @@ -24,6 +24,8 @@ package enginuity.maps; import enginuity.util.JEPUtil; import javax.swing.*; +import javax.swing.border.BevelBorder; +import javax.swing.border.Border; import javax.swing.border.LineBorder; import java.awt.*; import java.awt.event.MouseEvent; @@ -49,6 +51,9 @@ public class DataCell extends JLabel implements MouseListener, Serializable { private double compareValue = 0; private int compareType = Table.COMPARE_OFF; private int compareDisplay = Table.COMPARE_ABSOLUTE; + private Border defaultBorder = new LineBorder(Color.BLACK, 1); + private Font defaultFont = new Font("Arial", Font.BOLD, 12); + private Border liveDataTraceBorder = new BevelBorder(BevelBorder.RAISED); public DataCell() { } @@ -57,8 +62,8 @@ public class DataCell extends JLabel implements MouseListener, Serializable { this.scale = scale; this.setHorizontalAlignment(CENTER); this.setVerticalAlignment(CENTER); - this.setFont(new Font("Arial", Font.BOLD, 12)); - this.setBorder(new LineBorder(Color.BLACK, 1)); + this.setFont(defaultFont); + this.setBorder(defaultBorder); this.setOpaque(true); this.setVisible(true); this.addMouseListener(this); @@ -238,7 +243,7 @@ public class DataCell extends JLabel implements MouseListener, Serializable { if (binValue != getOriginalValue()) { this.setBorder(new LineBorder(Color.RED, 3)); } else { - this.setBorder(new LineBorder(Color.BLACK, 1)); + this.setBorder(defaultBorder); } } @@ -332,4 +337,14 @@ public class DataCell extends JLabel implements MouseListener, Serializable { public double getValue() { return calcDisplayValue(binValue, table.getScale().getExpression()); } + + public void setLiveDataTrace(boolean trace) { + if (trace) { + setBorder(liveDataTraceBorder); + setForeground(Color.RED); + } else { + setBorder(defaultBorder); + setForeground(Color.BLACK); + } + } } \ No newline at end of file diff --git a/src/enginuity/maps/Table.java b/src/enginuity/maps/Table.java index a4f6c260..79286f66 100644 --- a/src/enginuity/maps/Table.java +++ b/src/enginuity/maps/Table.java @@ -89,7 +89,8 @@ public abstract class Table extends JPanel implements Serializable { protected int cellHeight = 18; protected int cellWidth = 42; protected int minHeight = 100; - protected int minWidth = 425; + protected int minWidthNoOverlay = 465; + protected int minWidthOverlay = 640; protected Rom container; protected int highlightX; protected int highlightY; @@ -651,6 +652,7 @@ public abstract class Table extends JPanel implements Serializable { if (height < minHeight) { height = minHeight; } + int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; if (width < minWidth) { width = minWidth; } @@ -669,10 +671,10 @@ public abstract class Table extends JPanel implements Serializable { } } } else if (userLevel > settings.getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + + userLevel + " or greater. Click View->User Level to change your userlevel.", + "Table cannot be modified", + JOptionPane.INFORMATION_MESSAGE); } } @@ -684,10 +686,10 @@ public abstract class Table extends JPanel implements Serializable { } } } else if (userLevel > settings.getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + + userLevel + " or greater. Click View->User Level to change your userlevel.", + "Table cannot be modified", + JOptionPane.INFORMATION_MESSAGE); } colorize(); } @@ -700,10 +702,10 @@ public abstract class Table extends JPanel implements Serializable { } } } else if (userLevel > settings.getUserLevel()) { - JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + - userLevel + " or greater. Click View->User Level to change your userlevel.", - "Table cannot be modified", - JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(this, "This table can only be modified by users with a userlevel of \n" + + userLevel + " or greater. Click View->User Level to change your userlevel.", + "Table cannot be modified", + JOptionPane.INFORMATION_MESSAGE); } colorize(); } @@ -1160,6 +1162,9 @@ public abstract class Table extends JPanel implements Serializable { public void setOverlayLog(boolean overlayLog) { this.overlayLog = overlayLog; + if (overlayLog) { + clearLiveDataTrace(); + } } public void setLiveValue(double liveValue) { @@ -1170,9 +1175,14 @@ public abstract class Table extends JPanel implements Serializable { return liveValue; } + public abstract boolean isLiveDataSupported(); + protected void highlightLiveData() { } - + + public void clearLiveDataTrace() { + } + public double getMin() { if (getScale().getMin() == 0 && getScale().getMax() == 0) { double low = Double.MAX_VALUE; @@ -1181,13 +1191,13 @@ public abstract class Table extends JPanel implements Serializable { if (Double.parseDouble(data[i].getText()) < low) { low = Double.parseDouble(data[i].getText()); } - } - return low; + } + return low; } else { return getScale().getMin(); } } - + public double getMax() { if (getScale().getMin() == 0 && getScale().getMax() == 0) { double high = Double.MIN_VALUE; @@ -1196,8 +1206,8 @@ public abstract class Table extends JPanel implements Serializable { if (Double.parseDouble(data[i].getText()) > high) { high = Double.parseDouble(data[i].getText()); } - } - return high; + } + return high; } else { return getScale().getMax(); } diff --git a/src/enginuity/maps/Table1D.java b/src/enginuity/maps/Table1D.java index c5241ced..acdba34b 100644 --- a/src/enginuity/maps/Table1D.java +++ b/src/enginuity/maps/Table1D.java @@ -178,4 +178,8 @@ public class Table1D extends Table { parent.highlightLiveData(); } } + + public boolean isLiveDataSupported() { + return false; + } } \ No newline at end of file diff --git a/src/enginuity/maps/Table2D.java b/src/enginuity/maps/Table2D.java index 68a4c00f..50fb5f80 100644 --- a/src/enginuity/maps/Table2D.java +++ b/src/enginuity/maps/Table2D.java @@ -24,6 +24,7 @@ package enginuity.maps; import enginuity.Settings; import enginuity.swing.TableFrame; import enginuity.util.AxisRange; +import static enginuity.util.ParamChecker.isNullOrEmpty; import static enginuity.util.TableAxisUtil.getLiveDataRangeForAxis; import javax.swing.*; @@ -73,6 +74,7 @@ public class Table2D extends Table { if (height < minHeight) { height = minHeight; } + int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; if (width < minWidth) { width = minWidth; } @@ -290,7 +292,11 @@ public class Table2D extends Table { axis.setScaleByName(getScale().getName()); } - public void highlightLiveData() { + public boolean isLiveDataSupported() { + return !isNullOrEmpty(axis.getLogParam()); + } + + protected void highlightLiveData() { if (overlayLog && frame.isVisible()) { AxisRange range = getLiveDataRangeForAxis(axis); clearSelection(); @@ -308,8 +314,15 @@ public class Table2D extends Table { } else { highlight(x, y); } + data[i].setLiveDataTrace(true); } stopHighlight(); } } + + public void clearLiveDataTrace() { + for (DataCell cell : data) { + cell.setLiveDataTrace(false); + } + } } \ No newline at end of file diff --git a/src/enginuity/maps/Table3D.java b/src/enginuity/maps/Table3D.java index d2bad2d8..f715f689 100644 --- a/src/enginuity/maps/Table3D.java +++ b/src/enginuity/maps/Table3D.java @@ -26,6 +26,7 @@ import enginuity.swing.TableFrame; import enginuity.swing.VTextIcon; import enginuity.util.AxisRange; import static enginuity.util.ColorScaler.getScaledColor; +import static enginuity.util.ParamChecker.isNullOrEmpty; import static enginuity.util.TableAxisUtil.getLiveDataRangeForAxis; import enginuity.xml.RomAttributeParser; @@ -338,6 +339,7 @@ public class Table3D extends Table { if (height < minHeight) { height = minHeight; } + int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; if (width < minWidth) { width = minWidth; } @@ -875,7 +877,11 @@ public class Table3D extends Table { } } - public void highlightLiveData() { + public boolean isLiveDataSupported() { + return !isNullOrEmpty(xAxis.getLogParam()) && !isNullOrEmpty(yAxis.getLogParam()); + } + + protected void highlightLiveData() { if (overlayLog && frame.isVisible()) { AxisRange rangeX = getLiveDataRangeForAxis(xAxis); AxisRange rangeY = getLiveDataRangeForAxis(yAxis); @@ -889,12 +895,21 @@ public class Table3D extends Table { } else { highlight(x, y); } + data[x][y].setLiveDataTrace(true); } } stopHighlight(); } } + public void clearLiveDataTrace() { + for (int x = 0; x < getSizeX(); x++) { + for (int y = 0; y < getSizeY(); y++) { + data[x][y].setLiveDataTrace(false); + } + } + } + public void setScaleIndex(int scaleIndex) { super.setScaleIndex(scaleIndex); xAxis.setScaleByName(getScale().getName()); @@ -904,40 +919,40 @@ public class Table3D extends Table { public DataCell[][] get3dData() { return data; } - + public double getMin() { if (getScale().getMin() == 0 && getScale().getMax() == 0) { double low = Double.MAX_VALUE; - + for (DataCell[] column : data) { for (DataCell cell : column) { if (Double.parseDouble(cell.getText()) < low) { low = Double.parseDouble(cell.getText()); } } - } - - return low; + } + + return low; } else { return getScale().getMin(); } } - + public double getMax() { if (getScale().getMin() == 0 && getScale().getMax() == 0) { double high = Double.MIN_VALUE; - + for (DataCell[] column : data) { for (DataCell cell : column) { if (Double.parseDouble(cell.getText()) > high) { high = Double.parseDouble(cell.getText()); } } - } - - return high; + } + + return high; } else { return getScale().getMax(); } - } + } } \ No newline at end of file diff --git a/src/enginuity/maps/TableSwitch.java b/src/enginuity/maps/TableSwitch.java index d910b8f7..2b0e1500 100644 --- a/src/enginuity/maps/TableSwitch.java +++ b/src/enginuity/maps/TableSwitch.java @@ -70,7 +70,7 @@ public class TableSwitch extends Table { add(checkbox, BorderLayout.NORTH); } - + public int getType() { return TABLE_SWITCH; } @@ -113,11 +113,11 @@ public class TableSwitch extends Table { off[i] = (byte) RomAttributeParser.parseHexString(tokens.nextToken()); } } - + public byte[] getOnValues() { return on; } - + public byte[] getOffValues() { return off; } @@ -128,10 +128,10 @@ public class TableSwitch extends Table { if (height < minHeight) { height = minHeight; } + int minWidth = isLiveDataSupported() ? minWidthOverlay : minWidthNoOverlay; if (width < minWidth) { width = minWidth; } - return new Dimension(width, height); } @@ -152,4 +152,8 @@ public class TableSwitch extends Table { public void setAxisColor(Color color) { } + + public boolean isLiveDataSupported() { + return false; + } } \ No newline at end of file diff --git a/src/enginuity/swing/TableFrame.java b/src/enginuity/swing/TableFrame.java index 917faf66..dd06b1fe 100644 --- a/src/enginuity/swing/TableFrame.java +++ b/src/enginuity/swing/TableFrame.java @@ -40,9 +40,9 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener setFrameIcon(null); setBorder(BorderFactory.createBevelBorder(0)); setVisible(false); + setJMenuBar(new TableMenuBar(table)); toolBar = new TableToolBar(table, this); add(toolBar, BorderLayout.NORTH); - setJMenuBar(new TableMenuBar(table)); setDefaultCloseOperation(HIDE_ON_CLOSE); table.setFrame(this); addInternalFrameListener(this); diff --git a/src/enginuity/swing/TableMenuBar.java b/src/enginuity/swing/TableMenuBar.java index f56c006f..7c4a7f9e 100644 --- a/src/enginuity/swing/TableMenuBar.java +++ b/src/enginuity/swing/TableMenuBar.java @@ -32,7 +32,7 @@ public class TableMenuBar extends JMenuBar implements ActionListener { private Table table; private JMenu fileMenu = new JMenu("Table"); private JMenuItem graph = new JMenuItem("View Graph"); - private JRadioButtonMenuItem overlay = new JRadioButtonMenuItem("Overlay Log"); + //private JRadioButtonMenuItem overlay = new JRadioButtonMenuItem("Overlay Log"); private JMenu compareMenu = new JMenu("Compare"); private JRadioButtonMenuItem compareOriginal = new JRadioButtonMenuItem("Show Changes"); @@ -57,11 +57,9 @@ public class TableMenuBar extends JMenuBar implements ActionListener { private ButtonGroup compareDisplayGroup = new ButtonGroup(); public TableMenuBar(Table table) { - super(); this.table = table; this.add(fileMenu); fileMenu.add(graph); - fileMenu.add(overlay); fileMenu.add(compareMenu); compareMenu.add(compareOriginal); compareMenu.add(compareMap); @@ -121,7 +119,6 @@ public class TableMenuBar extends JMenuBar implements ActionListener { tableProperties.addActionListener(this); graph.addActionListener(this); - overlay.addActionListener(this); undoSel.addActionListener(this); undoAll.addActionListener(this); revert.addActionListener(this); @@ -130,7 +127,6 @@ public class TableMenuBar extends JMenuBar implements ActionListener { fileMenu.setMnemonic('F'); fileMenu.setMnemonic('T'); graph.setMnemonic('G'); - overlay.setMnemonic('L'); undoSel.setMnemonic('U'); undoAll.setMnemonic('A'); revert.setMnemonic('R'); @@ -173,7 +169,7 @@ public class TableMenuBar extends JMenuBar implements ActionListener { } else if (e.getSource() == compareMap) { JTableChooser chooser = new JTableChooser(); - if (chooser.showChooser(table.getRom().getContainer().getImages(), table.getRom().getContainer(), table) == true) { + if (chooser.showChooser(table.getRom().getContainer().getImages(), table.getRom().getContainer(), table)) { table.pasteCompare(); table.compare(Table.COMPARE_TABLE); } @@ -184,9 +180,6 @@ public class TableMenuBar extends JMenuBar implements ActionListener { } else if (e.getSource() == comparePercent) { table.setCompareDisplay(Table.COMPARE_PERCENT); - } else if (e.getSource() == overlay) { - table.setOverlayLog(overlay.isSelected()); - } } } \ No newline at end of file diff --git a/src/enginuity/swing/TableToolBar.java b/src/enginuity/swing/TableToolBar.java index 7f1fab35..582d0ba5 100644 --- a/src/enginuity/swing/TableToolBar.java +++ b/src/enginuity/swing/TableToolBar.java @@ -34,6 +34,7 @@ import javax.swing.*; import javax.swing.border.LineBorder; import java.awt.*; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; @@ -44,7 +45,7 @@ import java.text.DecimalFormat; import java.text.ParseException; import java.util.Vector; -public class TableToolBar extends JToolBar implements MouseListener, ItemListener, GraphDataListener { +public class TableToolBar extends JToolBar implements MouseListener, ItemListener, ActionListener, GraphDataListener { private JButton incrementFine = new JButton(new ImageIcon("./graphics/icon-incfine.png")); private JButton decrementFine = new JButton(new ImageIcon("./graphics/icon-decfine.png")); @@ -61,6 +62,9 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene private JComboBox scaleSelection = new JComboBox(); + private JCheckBox overlayLog = new JCheckBox("Overlay Log"); + private JButton clearOverlay = new JButton("Clear Overlay"); + private Table table; private TableFrame frame; @@ -68,56 +72,68 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene this.table = table; this.setFrame(frame); this.setFloatable(false); - this.add(incrementFine); - this.add(decrementFine); - this.add(incrementByFine); - this.add(new JLabel(" ")); - this.add(incrementCoarse); - this.add(decrementCoarse); + this.setLayout(new FlowLayout(FlowLayout.LEFT)); - this.add(new JLabel(" ")); - this.add(incrementByCoarse); - this.add(new JLabel(" ")); - this.add(setValueText); - this.add(new JLabel(" ")); - this.add(setValue); - this.add(multiply); - this.add(new JLabel(" ")); + JPanel finePanel = new JPanel(); + finePanel.add(incrementFine); + finePanel.add(decrementFine); + finePanel.add(incrementByFine); + this.add(finePanel); + + JPanel coarsePanel = new JPanel(); + coarsePanel.add(incrementCoarse); + coarsePanel.add(decrementCoarse); + coarsePanel.add(incrementByCoarse); + this.add(coarsePanel); + + JPanel setValuePanel = new JPanel(); + setValuePanel.add(setValueText); + setValuePanel.add(setValue); + setValuePanel.add(multiply); + this.add(setValuePanel); //Only add the 3d button if table includes 3d data if (table.getType() == Table.TABLE_3D) { this.add(enable3d); } - this.add(new JLabel(" ")); //this.add(scaleSelection); - incrementFine.setMaximumSize(new Dimension(33, 33)); + if (table.isLiveDataSupported()) { + JPanel liveDataPanel = new JPanel(); + liveDataPanel.add(overlayLog); + liveDataPanel.add(clearOverlay); + this.add(liveDataPanel); + } + + incrementFine.setPreferredSize(new Dimension(33, 33)); incrementFine.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - decrementFine.setMaximumSize(new Dimension(33, 33)); + decrementFine.setPreferredSize(new Dimension(33, 33)); decrementFine.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - incrementCoarse.setMaximumSize(new Dimension(33, 33)); + incrementCoarse.setPreferredSize(new Dimension(33, 33)); incrementCoarse.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - decrementCoarse.setMaximumSize(new Dimension(33, 33)); + decrementCoarse.setPreferredSize(new Dimension(33, 33)); decrementCoarse.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - enable3d.setMaximumSize(new Dimension(33, 33)); + enable3d.setPreferredSize(new Dimension(33, 33)); enable3d.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - setValue.setMaximumSize(new Dimension(33, 23)); + setValue.setPreferredSize(new Dimension(33, 23)); setValue.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - multiply.setMaximumSize(new Dimension(33, 23)); + multiply.setPreferredSize(new Dimension(33, 23)); multiply.setBorder(new LineBorder(new Color(150, 150, 150), 1)); - scaleSelection.setMaximumSize(new Dimension(80, 23)); + scaleSelection.setPreferredSize(new Dimension(80, 23)); scaleSelection.setFont(new Font("Tahoma", Font.PLAIN, 11)); + clearOverlay.setPreferredSize(new Dimension(75, 23)); + clearOverlay.setBorder(new LineBorder(new Color(150, 150, 150), 1)); incrementByFine.setAlignmentX(JTextArea.CENTER_ALIGNMENT); incrementByFine.setAlignmentY(JTextArea.CENTER_ALIGNMENT); - incrementByFine.setMaximumSize(new Dimension(45, 23)); + incrementByFine.setPreferredSize(new Dimension(45, 23)); incrementByCoarse.setAlignmentX(JTextArea.CENTER_ALIGNMENT); incrementByCoarse.setAlignmentY(JTextArea.CENTER_ALIGNMENT); - incrementByCoarse.setMaximumSize(new Dimension(45, 23)); + incrementByCoarse.setPreferredSize(new Dimension(45, 23)); setValueText.setAlignmentX(JTextArea.CENTER_ALIGNMENT); setValueText.setAlignmentY(JTextArea.CENTER_ALIGNMENT); - setValueText.setMaximumSize(new Dimension(45, 23)); + setValueText.setPreferredSize(new Dimension(45, 23)); incrementFine.setToolTipText("Increment Value (Fine)"); decrementFine.setToolTipText("Decrement Value (Fine)"); @@ -129,6 +145,8 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene incrementByFine.setToolTipText("Fine Value Adjustment"); incrementByCoarse.setToolTipText("Coarse Value Adjustment"); multiply.setToolTipText("Multiply Value"); + overlayLog.setToolTipText("Enable Overlay Of Real Time Log Data"); + clearOverlay.setToolTipText("Clear Log Data Overlay Highlights"); incrementFine.addMouseListener(this); decrementFine.addMouseListener(this); @@ -138,6 +156,8 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene setValue.addMouseListener(this); multiply.addMouseListener(this); scaleSelection.addItemListener(this); + overlayLog.addItemListener(this); + clearOverlay.addActionListener(this); try { incrementByFine.setValue(Math.abs(table.getScale().getFineIncrement())); @@ -310,10 +330,10 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene graphFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE); ECUEditorManager.getECUEditor().rightPanel.add(graphFrame); */ - - - - + + + + double maxV = table.getMax(); double minV = table.getMin(); //TODO Remove this when above is working @@ -322,8 +342,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene maxV = 13.01;*/ System.out.println("Scale: " + maxV + "," + minV); //*********** - - + //Render 3d Graph3dFrameManager.openGraph3dFrame(graphValues, minV, maxV, xValues, yValues, xLabel, yLabel, zLabel, table.getName()); GraphData.addGraphDataListener(this); @@ -380,9 +399,19 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene } public void itemStateChanged(ItemEvent e) { - // scale changed if (e.getSource() == scaleSelection) { + // scale changed table.setScaleIndex(scaleSelection.getSelectedIndex()); + } else if (e.getSource() == overlayLog) { + // enable/disable log overlay and live data display + table.setOverlayLog(overlayLog.isSelected()); + } + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == clearOverlay) { + // clear log overlay + table.clearLiveDataTrace(); } }