mirror of https://github.com/rusefi/RomRaider.git
added logger tab data reset buttons + some borderfactory usages
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@477 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
798b7bed47
commit
69328c47ae
|
@ -63,6 +63,7 @@ import static enginuity.util.ParamChecker.checkNotNull;
|
|||
import static enginuity.util.ParamChecker.isNullOrEmpty;
|
||||
import static enginuity.util.ThreadUtil.sleep;
|
||||
|
||||
import static javax.swing.BorderFactory.createLoweredBevelBorder;
|
||||
import javax.swing.*;
|
||||
import static javax.swing.JLabel.RIGHT;
|
||||
import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
|
||||
|
@ -71,8 +72,6 @@ import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
|
|||
import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
|
||||
import static javax.swing.JSplitPane.VERTICAL_SPLIT;
|
||||
import static javax.swing.JTabbedPane.BOTTOM;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static javax.swing.border.BevelBorder.LOWERED;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableModel;
|
||||
import java.awt.*;
|
||||
|
@ -100,9 +99,8 @@ TODO: add better debug logging, preferably to a file and switchable (on/off)
|
|||
TODO: Clean up this class!
|
||||
So much to do, so little time....
|
||||
|
||||
TODO: add length attribute to <byte> tags in logger.xml
|
||||
TODO: add reset/disconnect buttons to interface
|
||||
TODO: add data reset button to each tab (resets max/min values, and clears graph data)
|
||||
TODO: add length attribute to <byte> tags in logger.xml
|
||||
TODO: remove duplicate addresses from queries (and resolve response values back to original requests)
|
||||
TODO: Keyboard accessibility (enable/disable parameters, select tabs, etc)
|
||||
TODO: Add ecu id and calid to ecu_defs
|
||||
|
@ -194,7 +192,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
liveDataUpdateHandler = new LiveDataUpdateHandler(dataTableModel);
|
||||
graphPanel = new JPanel(new SpringLayout());
|
||||
graphUpdateHandler = new GraphUpdateHandler(graphPanel);
|
||||
dashboardPanel = new JPanel(new GridLayout(3, 3, 4, 4));
|
||||
dashboardPanel = new JPanel(new GridLayout(4, 4, 3, 3));
|
||||
dashboardUpdateHandler = new DashboardUpdateHandler(dashboardPanel);
|
||||
}
|
||||
|
||||
|
@ -471,7 +469,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
constraints.fill = GridBagConstraints.BOTH;
|
||||
|
||||
JPanel messagePanel = new JPanel(new BorderLayout());
|
||||
messagePanel.setBorder(new BevelBorder(LOWERED));
|
||||
messagePanel.setBorder(createLoweredBevelBorder());
|
||||
messagePanel.add(messageLabel, WEST);
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy = 0;
|
||||
|
@ -483,7 +481,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
statusBar.add(messagePanel);
|
||||
|
||||
JPanel ecuIdPanel = new JPanel(new FlowLayout());
|
||||
ecuIdPanel.setBorder(new BevelBorder(LOWERED));
|
||||
ecuIdPanel.setBorder(createLoweredBevelBorder());
|
||||
ecuIdPanel.add(ecuIdLabel);
|
||||
constraints.gridx = 2;
|
||||
constraints.gridy = 0;
|
||||
|
@ -494,7 +492,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
statusBar.add(ecuIdPanel);
|
||||
|
||||
JPanel statsPanel = new JPanel(new FlowLayout());
|
||||
statsPanel.setBorder(new BevelBorder(LOWERED));
|
||||
statsPanel.setBorder(createLoweredBevelBorder());
|
||||
statsPanel.add(statsLabel);
|
||||
constraints.gridx = 3;
|
||||
constraints.gridy = 0;
|
||||
|
@ -592,17 +590,44 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
}
|
||||
|
||||
private JComponent buildDataTab() {
|
||||
return new JScrollPane(new JTable(dataTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER);
|
||||
JPanel dataPanel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
liveDataUpdateHandler.reset();
|
||||
}
|
||||
});
|
||||
dataPanel.add(resetButton, NORTH);
|
||||
dataPanel.add(new JScrollPane(new JTable(dataTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER), CENTER);
|
||||
return dataPanel;
|
||||
}
|
||||
|
||||
private JComponent buildGraphTab() {
|
||||
JScrollPane scrollPane = new JScrollPane(graphPanel, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JPanel graphPanel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
graphUpdateHandler.reset();
|
||||
}
|
||||
});
|
||||
graphPanel.add(resetButton, NORTH);
|
||||
JScrollPane scrollPane = new JScrollPane(this.graphPanel, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.getVerticalScrollBar().setUnitIncrement(40);
|
||||
return scrollPane;
|
||||
graphPanel.add(scrollPane, CENTER);
|
||||
return graphPanel;
|
||||
}
|
||||
|
||||
private JComponent buildDashboardTab() {
|
||||
return dashboardPanel;
|
||||
JPanel dashPanel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
dashboardUpdateHandler.reset();
|
||||
}
|
||||
});
|
||||
dashPanel.add(resetButton, NORTH);
|
||||
dashPanel.add(dashboardPanel, CENTER);
|
||||
return dashPanel;
|
||||
}
|
||||
|
||||
public void windowOpened(WindowEvent windowEvent) {
|
||||
|
|
|
@ -33,4 +33,6 @@ public interface DataUpdateHandler {
|
|||
|
||||
void cleanUp();
|
||||
|
||||
void reset();
|
||||
|
||||
}
|
||||
|
|
|
@ -57,4 +57,10 @@ public final class DataUpdateHandlerManagerImpl implements DataUpdateHandlerMana
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
for (DataUpdateHandler handler : handlers) {
|
||||
handler.reset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,10 @@ public final class DataUpdateHandlerThreadWrapper implements DataUpdateHandler,
|
|||
wrappee.cleanUp();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
wrappee.reset();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (!stop) {
|
||||
updateWorkingList();
|
||||
|
|
|
@ -39,30 +39,36 @@ public final class DashboardUpdateHandler implements DataUpdateHandler, Converto
|
|||
this.dashboardPanel = dashboardPanel;
|
||||
}
|
||||
|
||||
public void registerData(EcuData ecuData) {
|
||||
public synchronized void registerData(EcuData ecuData) {
|
||||
Gauge gauge = new PlainGauge(ecuData);
|
||||
gauges.put(ecuData, gauge);
|
||||
dashboardPanel.add(gauge);
|
||||
repaintDashboardPanel();
|
||||
}
|
||||
|
||||
public void handleDataUpdate(EcuData ecuData, double value, long timestamp) {
|
||||
public synchronized void handleDataUpdate(EcuData ecuData, double value, long timestamp) {
|
||||
Gauge gauge = gauges.get(ecuData);
|
||||
if (gauge != null) {
|
||||
gauge.updateValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void deregisterData(EcuData ecuData) {
|
||||
public synchronized void deregisterData(EcuData ecuData) {
|
||||
dashboardPanel.remove(gauges.get(ecuData));
|
||||
gauges.remove(ecuData);
|
||||
repaintDashboardPanel();
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
public synchronized void cleanUp() {
|
||||
}
|
||||
|
||||
public void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
public synchronized void reset() {
|
||||
for (Gauge gauge : gauges.values()) {
|
||||
gauge.resetValue();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
Gauge gauge = gauges.get(updatedEcuData);
|
||||
if (gauge != null) {
|
||||
gauge.resetValue();
|
||||
|
|
|
@ -24,10 +24,8 @@ package enginuity.logger.ui.handler.dash;
|
|||
import enginuity.logger.definition.EcuData;
|
||||
import static enginuity.util.ParamChecker.checkNotNull;
|
||||
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
import static javax.swing.border.BevelBorder.LOWERED;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import static java.awt.BorderLayout.CENTER;
|
||||
import static java.awt.BorderLayout.NORTH;
|
||||
|
@ -98,21 +96,17 @@ public final class PlainGauge extends Gauge implements ActionListener {
|
|||
private void initGaugeLayout() {
|
||||
refreshTitle();
|
||||
resetValue();
|
||||
setPreferredSize(new Dimension(60, 40));
|
||||
setPreferredSize(new Dimension(230, 200));
|
||||
setBackground(LIGHT_GREY);
|
||||
setLayout(new BorderLayout(3, 3));
|
||||
setLayout(new BorderLayout(3, 0));
|
||||
|
||||
// title
|
||||
title.setFont(getFont().deriveFont(BOLD, 12F));
|
||||
title.setForeground(WHITE);
|
||||
add(title, NORTH);
|
||||
|
||||
JPanel dataAndWarnPanel = new JPanel(new BorderLayout());
|
||||
dataAndWarnPanel.setBackground(BLACK);
|
||||
dataAndWarnPanel.setBorder(new BevelBorder(LOWERED));
|
||||
|
||||
// data panel
|
||||
JPanel data = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 3));
|
||||
JPanel data = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 1));
|
||||
data.setBackground(BLACK);
|
||||
liveValueLabel.setFont(getFont().deriveFont(PLAIN, 40F));
|
||||
liveValueLabel.setForeground(WHITE);
|
||||
|
@ -142,14 +136,15 @@ public final class PlainGauge extends Gauge implements ActionListener {
|
|||
JPanel warnPanel = new JPanel();
|
||||
warnPanel.setBackground(BLACK);
|
||||
JPanel warnFormPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
warnFormPanel.setPreferredSize(new Dimension(222, 34));
|
||||
warnFormPanel.setPreferredSize(new Dimension(226, 34));
|
||||
warnFormPanel.setBackground(BLACK);
|
||||
warnFormPanel.setBorder(new LineBorder(LIGHT_GREY, 1));
|
||||
warnFormPanel.setBorder(createLineBorder(LIGHT_GREY, 1));
|
||||
warnCheckBox.setFont(getFont().deriveFont(PLAIN, 10F));
|
||||
warnCheckBox.setBackground(BLACK);
|
||||
warnCheckBox.setForeground(LIGHTER_GREY);
|
||||
warnCheckBox.setSelected(false);
|
||||
warnCheckBox.addActionListener(this);
|
||||
warnType.setPreferredSize(new Dimension(60, 20));
|
||||
warnType.setFont(getFont().deriveFont(PLAIN, 10F));
|
||||
warnType.setBackground(BLACK);
|
||||
warnType.setForeground(LIGHTER_GREY);
|
||||
|
@ -163,9 +158,8 @@ public final class PlainGauge extends Gauge implements ActionListener {
|
|||
warnPanel.add(warnFormPanel);
|
||||
|
||||
// add panels
|
||||
dataAndWarnPanel.add(data, NORTH);
|
||||
dataAndWarnPanel.add(warnPanel, CENTER);
|
||||
add(dataAndWarnPanel, CENTER);
|
||||
add(data, CENTER);
|
||||
add(warnPanel, SOUTH);
|
||||
}
|
||||
|
||||
private JPanel buildMaxMinPanel(String title, JLabel label) {
|
||||
|
|
|
@ -91,6 +91,9 @@ public final class FileUpdateHandler implements DataUpdateHandler, ConvertorUpda
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
}
|
||||
|
||||
public synchronized void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
resetLine();
|
||||
writeHeaders();
|
||||
|
|
|
@ -55,7 +55,7 @@ public final class GraphUpdateHandler implements DataUpdateHandler, ConvertorUpd
|
|||
this.graphPanel = graphPanel;
|
||||
}
|
||||
|
||||
public void registerData(EcuData ecuData) {
|
||||
public synchronized void registerData(EcuData ecuData) {
|
||||
// add to charts
|
||||
final XYSeries series = new XYSeries(ecuData.getName());
|
||||
//TODO: Make chart max item count configurable via settings
|
||||
|
@ -76,7 +76,7 @@ public final class GraphUpdateHandler implements DataUpdateHandler, ConvertorUpd
|
|||
}
|
||||
}
|
||||
|
||||
public void deregisterData(EcuData ecuData) {
|
||||
public synchronized void deregisterData(EcuData ecuData) {
|
||||
// remove from charts
|
||||
graphPanel.remove(chartMap.get(ecuData));
|
||||
chartMap.remove(ecuData);
|
||||
|
@ -85,10 +85,16 @@ public final class GraphUpdateHandler implements DataUpdateHandler, ConvertorUpd
|
|||
repaintGraphPanel(1);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
public synchronized void cleanUp() {
|
||||
}
|
||||
|
||||
public void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
public synchronized void reset() {
|
||||
for (XYSeries series : seriesMap.values()) {
|
||||
series.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
if (chartMap.containsKey(updatedEcuData)) {
|
||||
seriesMap.get(updatedEcuData).clear();
|
||||
JFreeChart chart = chartMap.get(updatedEcuData).getChart();
|
||||
|
|
|
@ -25,6 +25,7 @@ import enginuity.logger.definition.EcuData;
|
|||
import static enginuity.util.ParamChecker.checkNotNull;
|
||||
|
||||
public final class LiveDataRow {
|
||||
private static final double ZERO = 0.0;
|
||||
private final EcuData ecuData;
|
||||
private double minValue;
|
||||
private double maxValue;
|
||||
|
@ -70,4 +71,11 @@ public final class LiveDataRow {
|
|||
}
|
||||
updated = true;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
minValue = ZERO;
|
||||
maxValue = ZERO;
|
||||
currentValue = ZERO;
|
||||
updated = false;
|
||||
}
|
||||
}
|
|
@ -93,4 +93,10 @@ public final class LiveDataTableModel extends AbstractTableModel {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
for (LiveDataRow liveDataRow : dataRowMap.values()) {
|
||||
liveDataRow.reset();
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,25 +32,29 @@ public final class LiveDataUpdateHandler implements DataUpdateHandler, Convertor
|
|||
this.dataTableModel = dataTableModel;
|
||||
}
|
||||
|
||||
public void registerData(EcuData ecuData) {
|
||||
public synchronized void registerData(EcuData ecuData) {
|
||||
// add to datatable
|
||||
dataTableModel.addParam(ecuData);
|
||||
}
|
||||
|
||||
public void handleDataUpdate(EcuData ecuData, double value, long timestamp) {
|
||||
public synchronized void handleDataUpdate(EcuData ecuData, double value, long timestamp) {
|
||||
// update data table
|
||||
dataTableModel.updateParam(ecuData, value);
|
||||
}
|
||||
|
||||
public void deregisterData(EcuData ecuData) {
|
||||
public synchronized void deregisterData(EcuData ecuData) {
|
||||
// remove from datatable
|
||||
dataTableModel.removeParam(ecuData);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
public synchronized void cleanUp() {
|
||||
}
|
||||
|
||||
public void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
public synchronized void reset() {
|
||||
dataTableModel.reset();
|
||||
}
|
||||
|
||||
public synchronized void notifyConvertorUpdate(EcuData updatedEcuData) {
|
||||
dataTableModel.fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,9 @@ public final class TableUpdateHandler implements DataUpdateHandler {
|
|||
public void cleanUp() {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
public void registerTable(Table table) {
|
||||
String logParam = table.getLogParam();
|
||||
if (!tableMap.containsKey(logParam)) {
|
||||
|
|
|
@ -23,9 +23,9 @@ package enginuity.maps;
|
|||
|
||||
import enginuity.util.JEPUtil;
|
||||
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import static java.awt.Color.BLACK;
|
||||
import static java.awt.Color.BLUE;
|
||||
|
@ -37,6 +37,9 @@ import java.text.DecimalFormat;
|
|||
|
||||
public class DataCell extends JLabel implements MouseListener, Serializable {
|
||||
|
||||
private final Border defaultBorder = createLineBorder(BLACK, 1);
|
||||
private final Border modifiedBorder = createLineBorder(RED, 3);
|
||||
private final Font defaultFont = new Font("Arial", Font.BOLD, 12);
|
||||
private double binValue = 0;
|
||||
private double originalValue = 0;
|
||||
private Scale scale = new Scale();
|
||||
|
@ -53,8 +56,6 @@ 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(BLACK, 1);
|
||||
private Font defaultFont = new Font("Arial", Font.BOLD, 12);
|
||||
|
||||
public DataCell() {
|
||||
}
|
||||
|
@ -244,7 +245,7 @@ public class DataCell extends JLabel implements MouseListener, Serializable {
|
|||
public void setOriginalValue(double originalValue) {
|
||||
this.originalValue = originalValue;
|
||||
if (binValue != getOriginalValue()) {
|
||||
this.setBorder(new LineBorder(RED, 3));
|
||||
this.setBorder(modifiedBorder);
|
||||
} else {
|
||||
this.setBorder(defaultBorder);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import enginuity.util.JEPUtil;
|
|||
import enginuity.xml.RomAttributeParser;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
|
@ -583,7 +583,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
for (int i = 0; i < getDataSize(); i++) {
|
||||
data[i].setColor(getSettings().getAxisColor());
|
||||
data[i].setOpaque(true);
|
||||
data[i].setBorder(new LineBorder(Color.BLACK, 1));
|
||||
data[i].setBorder(createLineBorder(Color.BLACK, 1));
|
||||
data[i].setHorizontalAlignment(DataCell.CENTER);
|
||||
}
|
||||
}
|
||||
|
@ -617,11 +617,11 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
|
||||
// set border
|
||||
if (data[i].getBinValue() > data[i].getOriginalValue()) {
|
||||
data[i].setBorder(new LineBorder(getSettings().getIncreaseBorder()));
|
||||
data[i].setBorder(createLineBorder(getSettings().getIncreaseBorder()));
|
||||
} else if (data[i].getBinValue() < data[i].getOriginalValue()) {
|
||||
data[i].setBorder(new LineBorder(getSettings().getDecreaseBorder()));
|
||||
data[i].setBorder(createLineBorder(getSettings().getDecreaseBorder()));
|
||||
} else {
|
||||
data[i].setBorder(new LineBorder(Color.BLACK, 1));
|
||||
data[i].setBorder(createLineBorder(Color.BLACK, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -631,11 +631,11 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
if (!isStatic) {
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
if (data[i].getBinValue() > data[i].getOriginalValue()) {
|
||||
data[i].setBorder(new LineBorder(getSettings().getIncreaseBorder()));
|
||||
data[i].setBorder(createLineBorder(getSettings().getIncreaseBorder()));
|
||||
} else if (data[i].getBinValue() < data[i].getOriginalValue()) {
|
||||
data[i].setBorder(new LineBorder(getSettings().getDecreaseBorder()));
|
||||
data[i].setBorder(createLineBorder(getSettings().getDecreaseBorder()));
|
||||
} else {
|
||||
data[i].setBorder(new LineBorder(Color.BLACK, 1));
|
||||
data[i].setBorder(createLineBorder(Color.BLACK, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import static enginuity.util.ParamChecker.isNullOrEmpty;
|
|||
import static enginuity.util.TableAxisUtil.getLiveDataRangeForAxis;
|
||||
import enginuity.xml.RomAttributeParser;
|
||||
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
|
@ -279,11 +279,11 @@ public class Table3D extends Table {
|
|||
|
||||
// set border
|
||||
if (cell.getBinValue() > cell.getOriginalValue()) {
|
||||
cell.setBorder(new LineBorder(settings.getIncreaseBorder()));
|
||||
cell.setBorder(createLineBorder(settings.getIncreaseBorder()));
|
||||
} else if (cell.getBinValue() < cell.getOriginalValue()) {
|
||||
cell.setBorder(new LineBorder(settings.getDecreaseBorder()));
|
||||
cell.setBorder(createLineBorder(settings.getDecreaseBorder()));
|
||||
} else {
|
||||
cell.setBorder(new LineBorder(Color.BLACK, 1));
|
||||
cell.setBorder(createLineBorder(Color.BLACK, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -299,11 +299,11 @@ public class Table3D extends Table {
|
|||
for (DataCell cell : column) {
|
||||
|
||||
if (cell.getBinValue() > cell.getOriginalValue()) {
|
||||
cell.setBorder(new LineBorder(settings.getIncreaseBorder()));
|
||||
cell.setBorder(createLineBorder(settings.getIncreaseBorder()));
|
||||
} else if (cell.getBinValue() < cell.getOriginalValue()) {
|
||||
cell.setBorder(new LineBorder(settings.getDecreaseBorder()));
|
||||
cell.setBorder(createLineBorder(settings.getDecreaseBorder()));
|
||||
} else {
|
||||
cell.setBorder(new LineBorder(Color.BLACK, 1));
|
||||
cell.setBorder(createLineBorder(Color.BLACK, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ package enginuity.swing;
|
|||
import enginuity.ECUEditor;
|
||||
import enginuity.maps.Rom;
|
||||
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -47,13 +47,13 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
|||
this.add(refreshImage);
|
||||
|
||||
openImage.setMaximumSize(new Dimension(58, 50));
|
||||
openImage.setBorder(new LineBorder(new Color(150, 150, 150), 0));
|
||||
openImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
||||
saveImage.setMaximumSize(new Dimension(50, 50));
|
||||
saveImage.setBorder(new LineBorder(new Color(150, 150, 150), 0));
|
||||
saveImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
||||
closeImage.setMaximumSize(new Dimension(50, 50));
|
||||
closeImage.setBorder(new LineBorder(new Color(150, 150, 150), 0));
|
||||
closeImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
||||
refreshImage.setMaximumSize(new Dimension(50, 50));
|
||||
refreshImage.setBorder(new LineBorder(new Color(150, 150, 150), 0));
|
||||
refreshImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
||||
|
||||
updateButtons();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ package enginuity.swing;
|
|||
import enginuity.maps.Rom;
|
||||
import enginuity.maps.Table;
|
||||
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
|
@ -82,10 +83,10 @@ public class RomCellRenderer implements TreeCellRenderer {
|
|||
|
||||
if (selected) {
|
||||
renderer.setBackground(new Color(220, 220, 255));
|
||||
renderer.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 225)));
|
||||
renderer.setBorder(createLineBorder(new Color(0, 0, 225)));
|
||||
|
||||
} else {
|
||||
renderer.setBorder(BorderFactory.createLineBorder(new Color(220, 0, 0)));
|
||||
renderer.setBorder(createLineBorder(new Color(220, 0, 0)));
|
||||
renderer.setBackground(new Color(255, 210, 210));
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,7 @@ public class RomCellRenderer implements TreeCellRenderer {
|
|||
|
||||
Table table = (Table) ((DefaultMutableTreeNode) value).getUserObject();
|
||||
JPanel renderer = new JPanel(new GridLayout(1, 1));
|
||||
renderer.setBorder(BorderFactory.createLineBorder(Color.WHITE));
|
||||
renderer.setBorder(createLineBorder(Color.WHITE));
|
||||
JLabel tableName = new JLabel("");
|
||||
renderer.setBackground(Color.WHITE);
|
||||
|
||||
|
@ -120,7 +121,7 @@ public class RomCellRenderer implements TreeCellRenderer {
|
|||
|
||||
if (selected) {
|
||||
renderer.setBackground(new Color(220, 220, 255));
|
||||
renderer.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 225)));
|
||||
renderer.setBorder(createLineBorder(new Color(0, 0, 225)));
|
||||
}
|
||||
|
||||
if (table.getUserLevel() == 5) {
|
||||
|
|
|
@ -23,6 +23,7 @@ package enginuity.swing;
|
|||
|
||||
import enginuity.maps.Table;
|
||||
|
||||
import static javax.swing.BorderFactory.createBevelBorder;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import javax.swing.event.InternalFrameListener;
|
||||
|
@ -38,7 +39,7 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener
|
|||
setTable(table);
|
||||
add(table);
|
||||
setFrameIcon(null);
|
||||
setBorder(BorderFactory.createBevelBorder(0));
|
||||
setBorder(createBevelBorder(0));
|
||||
setVisible(false);
|
||||
setJMenuBar(new TableMenuBar(table));
|
||||
toolBar = new TableToolBar(table, this);
|
||||
|
|
|
@ -21,18 +21,29 @@
|
|||
|
||||
package enginuity.swing;
|
||||
|
||||
import com.ecm.graphics.Graph3dFrameManager;
|
||||
import com.ecm.graphics.data.GraphData;
|
||||
import com.ecm.graphics.data.GraphDataListener;
|
||||
import enginuity.maps.DataCell;
|
||||
import enginuity.maps.Scale;
|
||||
import enginuity.maps.Table;
|
||||
import enginuity.maps.Table1D;
|
||||
import enginuity.maps.Table3D;
|
||||
|
||||
import javax.swing.*;
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
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;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.Vector;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
import com.ecm.graphics.Graph3dFrameManager;
|
||||
import com.ecm.graphics.data.GraphData;
|
||||
import com.ecm.graphics.data.GraphDataListener;
|
||||
import enginuity.maps.*;
|
||||
|
||||
public class TableToolBar extends JToolBar implements MouseListener, ItemListener, ActionListener, GraphDataListener {
|
||||
|
||||
|
@ -98,23 +109,23 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene
|
|||
}
|
||||
|
||||
incrementFine.setPreferredSize(new Dimension(33, 33));
|
||||
incrementFine.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
incrementFine.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
decrementFine.setPreferredSize(new Dimension(33, 33));
|
||||
decrementFine.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
decrementFine.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
incrementCoarse.setPreferredSize(new Dimension(33, 33));
|
||||
incrementCoarse.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
incrementCoarse.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
decrementCoarse.setPreferredSize(new Dimension(33, 33));
|
||||
decrementCoarse.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
decrementCoarse.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
enable3d.setPreferredSize(new Dimension(33, 33));
|
||||
enable3d.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
enable3d.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
setValue.setPreferredSize(new Dimension(33, 23));
|
||||
setValue.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
setValue.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
multiply.setPreferredSize(new Dimension(33, 23));
|
||||
multiply.setBorder(new LineBorder(new Color(150, 150, 150), 1));
|
||||
multiply.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
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));
|
||||
clearOverlay.setBorder(createLineBorder(new Color(150, 150, 150), 1));
|
||||
|
||||
incrementByFine.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
|
||||
incrementByFine.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
|
||||
|
@ -323,8 +334,6 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene
|
|||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
double maxV = table.getMax();
|
||||
double minV = table.getMin();
|
||||
//TODO Remove this when above is working
|
||||
|
|
Loading…
Reference in New Issue