mirror of https://github.com/rusefi/RomRaider.git
Add a simple -logger.touch commandline parameter, when passed it sets a
flag. This flag is then used to update a few spots in the logger UI so that it is more 'touch' friendly. Code Clean Up - * Make uiscale -> touchEnabled * Expose this via isTouchEnabled * Restore non-touch paths ui size(s) * Remove keyboard code that I was starting to add (not needed)
This commit is contained in:
parent
cf800db796
commit
d5108389f8
|
@ -49,6 +49,7 @@ public class ECUExec {
|
|||
private static final Logger LOGGER = getLogger(ECUExec.class);
|
||||
private static final String START_LOGGER_ARG = "-logger";
|
||||
private static final String START_LOGGER_FULLSCREEN_ARG = "-logger.fullscreen";
|
||||
private static final String LOGGER_TOUCH_ARG = "-logger.touch";
|
||||
|
||||
private ECUExec() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
@ -106,7 +107,7 @@ public class ECUExec {
|
|||
|
||||
private static boolean containsLoggerArg(String[] args) {
|
||||
for (String arg : args) {
|
||||
if (arg.equalsIgnoreCase(START_LOGGER_ARG) || arg.equalsIgnoreCase(START_LOGGER_FULLSCREEN_ARG)) {
|
||||
if (arg.equalsIgnoreCase(START_LOGGER_ARG) || arg.equalsIgnoreCase(START_LOGGER_FULLSCREEN_ARG) || arg.equalsIgnoreCase(LOGGER_TOUCH_ARG)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,6 +206,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private static final Logger LOGGER = Logger.getLogger(EcuLogger.class);
|
||||
private static final String ECU_LOGGER_TITLE = PRODUCT_NAME + " v" + VERSION + " | ECU/TCU Logger";
|
||||
private static final String LOGGER_FULLSCREEN_ARG = "-logger.fullscreen";
|
||||
private static final String LOGGER_TOUCH_ARG = "-logger.touch";
|
||||
private static final URL ICON_PATH = Settings.class.getClass().getResource("/graphics/romraider-ico.gif");
|
||||
private static final String HEADING_PARAMETERS = "Parameters";
|
||||
private static final String HEADING_SWITCHES = "Switches";
|
||||
|
@ -223,7 +224,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private static final String LOG_TO_FILE_ICON = "/graphics/logger_log_to_file.png";
|
||||
private static final String LOG_TO_FILE_START = "Start file log";
|
||||
private static final String LOG_TO_FILE_STOP = "Stop file log";
|
||||
private static final String LOG_TO_FILE_TT_TEXT = "Start/stop file logging (F1)";
|
||||
private static final String LOG_TO_FILE_TT_TEXT = "Start/stop file logging (F1)";
|
||||
private static String target = "ECU";
|
||||
private static String loadResult = "";
|
||||
private String defVersion;
|
||||
|
@ -284,7 +285,8 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private Map<String, Map<Transport, Collection<Module>>> protocolList =
|
||||
new HashMap<String, Map<Transport, Collection<Module>>>();
|
||||
private Map<String, Object> componentList = new HashMap<String, Object>();
|
||||
|
||||
private static boolean touchEnabled = false;
|
||||
|
||||
public EcuLogger() {
|
||||
super(ECU_LOGGER_TITLE);
|
||||
construct();
|
||||
|
@ -895,41 +897,81 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
dashboardHandlerManager.addHandler(TableUpdateHandler.getInstance());
|
||||
}
|
||||
|
||||
private JComponent buildTabbedPane() {
|
||||
addSplitPaneTab(
|
||||
"Data",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dataTabParamListTableModel,
|
||||
dataTabSwitchListTableModel,
|
||||
dataTabExternalListTableModel),
|
||||
buildDataTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"Graph",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
graphTabParamListTableModel,
|
||||
graphTabSwitchListTableModel,
|
||||
graphTabExternalListTableModel),
|
||||
buildGraphTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"Dashboard",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dashboardTabParamListTableModel,
|
||||
dashboardTabSwitchListTableModel,
|
||||
dashboardTabExternalListTableModel),
|
||||
buildDashboardTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton(),
|
||||
buildToggleGaugeStyleButton());
|
||||
tabbedPane.add("MAF", mafTab.getPanel());
|
||||
tabbedPane.add("Injector", injectorTab.getPanel());
|
||||
tabbedPane.add("Dyno", dynoTab.getPanel());
|
||||
private JComponent buildTabbedPane() {
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
addSplitPaneTab(
|
||||
"Data",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dataTabParamListTableModel,
|
||||
dataTabSwitchListTableModel,
|
||||
dataTabExternalListTableModel),
|
||||
buildDataTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"Graph",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
graphTabParamListTableModel,
|
||||
graphTabSwitchListTableModel,
|
||||
graphTabExternalListTableModel),
|
||||
buildGraphTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"Dashboard",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dashboardTabParamListTableModel,
|
||||
dashboardTabSwitchListTableModel,
|
||||
dashboardTabExternalListTableModel),
|
||||
buildDashboardTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton(),
|
||||
buildToggleGaugeStyleButton());
|
||||
tabbedPane.add("MAF", mafTab.getPanel());
|
||||
tabbedPane.add("Injector", injectorTab.getPanel());
|
||||
tabbedPane.add("Dyno", dynoTab.getPanel());
|
||||
}
|
||||
else
|
||||
{
|
||||
addSplitPaneTab(
|
||||
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Data" + "</body></html>",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dataTabParamListTableModel,
|
||||
dataTabSwitchListTableModel,
|
||||
dataTabExternalListTableModel),
|
||||
buildDataTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Graph" + "</body></html>",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
graphTabParamListTableModel,
|
||||
graphTabSwitchListTableModel,
|
||||
graphTabExternalListTableModel),
|
||||
buildGraphTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton());
|
||||
addSplitPaneTab(
|
||||
"<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dashboard" + "</body></html>",
|
||||
buildSplitPane(
|
||||
buildParamListPane(
|
||||
dashboardTabParamListTableModel,
|
||||
dashboardTabSwitchListTableModel,
|
||||
dashboardTabExternalListTableModel),
|
||||
buildDashboardTab()),
|
||||
buildUnselectAllButton(),
|
||||
buildLtvButton(),
|
||||
buildToggleGaugeStyleButton());
|
||||
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "MAF"+ "</body></html>", mafTab.getPanel());
|
||||
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Injector"+ "</body></html>", injectorTab.getPanel());
|
||||
tabbedPane.add("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + "Dyno" + "</body></html>", dynoTab.getPanel());
|
||||
}
|
||||
return tabbedPane;
|
||||
}
|
||||
|
||||
|
@ -938,7 +980,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
SetFont.plain(button);
|
||||
VerticalTextIcon textIcon = new VerticalTextIcon(button, "Gauge Style", ROTATE_LEFT);
|
||||
button.setIcon(textIcon);
|
||||
button.setPreferredSize(new Dimension(25, 80));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
button.setPreferredSize(new Dimension(25, 80));
|
||||
}
|
||||
else
|
||||
{
|
||||
button.setPreferredSize(new Dimension(56, 80));
|
||||
}
|
||||
button.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F12"), "toggleGaugeStyle");
|
||||
button.getActionMap().put("toggleGaugeStyle", new AbstractAction() {
|
||||
private static final long serialVersionUID = 6913964758354638587L;
|
||||
|
@ -978,7 +1027,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
VerticalTextIcon textIcon = new VerticalTextIcon(button, "Un-select ALL", ROTATE_LEFT);
|
||||
button.setToolTipText(UNSELECT_ALL_TT_TEXT);
|
||||
button.setIcon(textIcon);
|
||||
button.setPreferredSize(new Dimension(25, 85));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
button.setPreferredSize(new Dimension(25, 85));
|
||||
}
|
||||
else
|
||||
{
|
||||
button.setPreferredSize(new Dimension(56, 85));
|
||||
}
|
||||
button.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F9"), "un-selectAll");
|
||||
button.getActionMap().put("un-selectAll", new AbstractAction() {
|
||||
private static final long serialVersionUID = 4913964758354638588L;
|
||||
|
@ -1021,7 +1077,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
VerticalTextIcon textIcon =
|
||||
new VerticalTextIcon(button, "LTV (F6)", ROTATE_LEFT);
|
||||
button.setIcon(textIcon);
|
||||
button.setPreferredSize(new Dimension(25, 60));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
button.setPreferredSize(new Dimension(25, 60));
|
||||
}
|
||||
else
|
||||
{
|
||||
button.setPreferredSize(new Dimension(56, 60));
|
||||
}
|
||||
button.addActionListener(new LearningTableValuesAction(this));
|
||||
return button;
|
||||
}
|
||||
|
@ -1033,7 +1096,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
toggleListButton.setSelected(true);
|
||||
VerticalTextIcon textIcon = new VerticalTextIcon(toggleListButton, "Parameter List", ROTATE_LEFT);
|
||||
toggleListButton.setIcon(textIcon);
|
||||
toggleListButton.setPreferredSize(new Dimension(25, 95));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
toggleListButton.setPreferredSize(new Dimension(25, 95));
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleListButton.setPreferredSize(new Dimension(56, 95));
|
||||
}
|
||||
toggleListButton.getInputMap(WHEN_IN_FOCUSED_WINDOW).put(getKeyStroke("F11"), "toggleHideParams");
|
||||
toggleListButton.getActionMap().put("toggleHideParams", new AbstractAction() {
|
||||
private static final long serialVersionUID = -276854997788647306L;
|
||||
|
@ -1068,7 +1138,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
|
||||
JPanel tabControlPanel = new JPanel(new BetterFlowLayout(FlowLayout.CENTER, 1, 1));
|
||||
tabControlPanel.setPreferredSize(new Dimension(25, 25));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
tabControlPanel.setPreferredSize(new Dimension(25, 25));
|
||||
}
|
||||
else
|
||||
{
|
||||
tabControlPanel.setPreferredSize(new Dimension(56, 25));
|
||||
}
|
||||
tabControlPanel.add(toggleListButton);
|
||||
for (JComponent control : extraControls) tabControlPanel.add(control);
|
||||
|
||||
|
@ -1084,16 +1161,35 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
JScrollPane externalList = new JScrollPane(buildParamListTable(externalListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JScrollPane switchList = new JScrollPane(buildParamListTable(switchListTableModel), VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
tabs.addTab(HEADING_PARAMETERS, paramList);
|
||||
tabs.addTab(HEADING_SWITCHES, switchList);
|
||||
tabs.addTab("External Sensors", externalList);
|
||||
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
tabs.addTab(HEADING_PARAMETERS, paramList);
|
||||
tabs.addTab(HEADING_SWITCHES, switchList);
|
||||
tabs.addTab("External Sensors", externalList);
|
||||
}
|
||||
else
|
||||
{
|
||||
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_PARAMETERS + "</body></html>", paramList);
|
||||
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>" + HEADING_SWITCHES + "</body></html>", switchList);
|
||||
tabs.addTab("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>External Sensors</body></html>", externalList);
|
||||
}
|
||||
return tabs;
|
||||
}
|
||||
|
||||
private JTable buildParamListTable(ParameterListTableModel tableModel) {
|
||||
JTable paramListTable = new ParameterListTable(tableModel);
|
||||
changeColumnWidth(paramListTable, 0, 20, 55, 55);
|
||||
changeColumnWidth(paramListTable, 2, 50, 250, 130);
|
||||
|
||||
if( touchEnabled == false)
|
||||
{
|
||||
changeColumnWidth(paramListTable, 0, 20, 55, 55);
|
||||
changeColumnWidth(paramListTable, 2, 50, 250, 130);
|
||||
}
|
||||
else
|
||||
{
|
||||
changeColumnWidth(paramListTable, 0, 20, 75, 75);
|
||||
changeColumnWidth(paramListTable, 2, 50, 75, 75);
|
||||
}
|
||||
return paramListTable;
|
||||
}
|
||||
|
||||
|
@ -1157,7 +1253,15 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private JSplitPane buildSplitPane(JComponent leftComponent, JComponent rightComponent) {
|
||||
splitPane = new JSplitPane(HORIZONTAL_SPLIT, leftComponent, rightComponent);
|
||||
splitPane.setDividerSize(5);
|
||||
splitPane.setDividerLocation((int) getSettings().getDividerLocation());
|
||||
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
splitPane.setDividerLocation((int) getSettings().getDividerLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
splitPane.setDividerLocation((int) getSettings().getDividerLocation()+200);
|
||||
}
|
||||
splitPane.addPropertyChangeListener(this);
|
||||
return splitPane;
|
||||
}
|
||||
|
@ -1168,6 +1272,12 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private JPanel buildControlToolbar() {
|
||||
JPanel controlPanel = new JPanel(new BorderLayout());
|
||||
|
||||
if (touchEnabled == true)
|
||||
{
|
||||
portsComboBox.setPreferredSize(new Dimension(100,50));
|
||||
}
|
||||
|
||||
controlPanel.add(buildPortsComboBox(), WEST);
|
||||
//TODO: Finish log playback stuff...
|
||||
// controlPanel.add(buildPlaybackControls(), CENTER);
|
||||
|
@ -1199,6 +1309,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private Component buildFileNameExtention() {
|
||||
JLabel fileNameLabel = new JLabel("Logfile Text");
|
||||
final JTextField fileNameExtention = new JTextField("",8);
|
||||
if (touchEnabled == true)
|
||||
{
|
||||
fileNameExtention.setPreferredSize(new Dimension(200, 50));
|
||||
}
|
||||
fileNameExtention.setToolTipText(FILE_NAME_EXTENTION);
|
||||
fileNameExtention.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
|
@ -1257,6 +1371,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
LOG_TO_FILE_START,
|
||||
new ImageIcon(getClass().getResource(LOG_TO_FILE_ICON)));
|
||||
SetFont.plain(logToFileButton);
|
||||
if (touchEnabled == true)
|
||||
{
|
||||
logToFileButton.setPreferredSize(new Dimension(200, 50));
|
||||
}
|
||||
logToFileButton.setToolTipText(LOG_TO_FILE_TT_TEXT);
|
||||
logToFileButton.setBackground(GREEN);
|
||||
logToFileButton.setOpaque(true);
|
||||
|
@ -1305,6 +1423,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
final CustomButtonGroup moduleGroup = new CustomButtonGroup();
|
||||
for (Module module : getModuleList()) {
|
||||
final JCheckBox cb = new JCheckBox(module.getName().toUpperCase());
|
||||
if (touchEnabled == true)
|
||||
{
|
||||
cb.setPreferredSize(new Dimension(75, 50));
|
||||
}
|
||||
final String tipText = String.format(
|
||||
"%s Polling. Uncheck all boxes for Externals logging only.",
|
||||
module.getDescription());
|
||||
|
@ -1335,7 +1457,14 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
JButton reconnectButton = new JButton(new ImageIcon( getClass().getResource("/graphics/logger_restart.png")));
|
||||
componentList.put("reconnectButton", reconnectButton);
|
||||
reconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
reconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
}
|
||||
else
|
||||
{
|
||||
reconnectButton.setPreferredSize(new Dimension(75, 50));
|
||||
}
|
||||
reconnectButton.setToolTipText("Reconnect to " + target);
|
||||
reconnectButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
|
@ -1350,7 +1479,15 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
comboBoxPanel.add(reconnectButton);
|
||||
JButton disconnectButton = new JButton(new ImageIcon( getClass().getResource("/graphics/logger_stop.png")));
|
||||
componentList.put("disconnectButton", disconnectButton);
|
||||
disconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
disconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnectButton.setPreferredSize(new Dimension(75, 50));
|
||||
}
|
||||
|
||||
disconnectButton.setToolTipText("Disconnect from " + target);
|
||||
disconnectButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
|
@ -1461,7 +1598,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private JComponent buildDataTab() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
JButton resetButton;
|
||||
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
resetButton = new JButton("Reset Data");
|
||||
}
|
||||
else
|
||||
{
|
||||
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
|
||||
}
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
|
@ -1477,7 +1623,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private JComponent buildGraphTab() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
JButton resetButton;
|
||||
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
resetButton = new JButton("Reset Data");
|
||||
}
|
||||
else
|
||||
{
|
||||
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
|
||||
}
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
|
@ -1493,7 +1648,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private JComponent buildDashboardTab() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
JButton resetButton;
|
||||
|
||||
if (touchEnabled == false)
|
||||
{
|
||||
resetButton = new JButton("Reset Data");
|
||||
}
|
||||
else
|
||||
{
|
||||
resetButton = new JButton("<html><body leftmargin=15 topmargin=15 marginwidth=15 marginheight=15>Reset Data</body></html>");
|
||||
}
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
|
@ -1760,6 +1924,15 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isTouchEnabled()
|
||||
{
|
||||
if( touchEnabled == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public void setRefreshMode(boolean refreshMode) {
|
||||
getSettings().setRefreshMode(refreshMode);
|
||||
refresher.setRefreshMode(refreshMode);
|
||||
|
@ -1796,8 +1969,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
|
||||
public static void startLogger(int defaultCloseOperation, String... args) {
|
||||
EcuLogger ecuLogger = new EcuLogger();
|
||||
touchEnabled = setTouchEnabled(args);
|
||||
EcuLogger ecuLogger = new EcuLogger();
|
||||
boolean fullscreen = containsFullScreenArg(args);
|
||||
|
||||
createAndShowGui(defaultCloseOperation, ecuLogger, fullscreen);
|
||||
}
|
||||
|
||||
|
@ -1808,6 +1983,13 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static boolean setTouchEnabled(String... args) {
|
||||
for (String arg : args) {
|
||||
if (LOGGER_TOUCH_ARG.equalsIgnoreCase(arg)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void createAndShowGui(final int defaultCloseOperation, final EcuLogger ecuLogger, final boolean fullscreen) {
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -19,15 +19,18 @@
|
|||
|
||||
package com.romraider.logger.ecu.ui.paramlist;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.ecu.definition.EcuData;
|
||||
import com.romraider.logger.ecu.definition.ExternalData;
|
||||
|
||||
import static com.romraider.util.ParamChecker.isNullOrEmpty;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -49,8 +52,15 @@ public final class ParameterListTable extends JTable {
|
|||
setColumnSortable(column, true);
|
||||
}
|
||||
}
|
||||
if (EcuLogger.isTouchEnabled() == true)
|
||||
{
|
||||
this.setRowHeight(40);
|
||||
|
||||
Font font = new Font("Tahoma", Font.PLAIN, 16);
|
||||
this.setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TableCellRenderer getCellRenderer(int row, int col) {
|
||||
return displayComboBox(row, col) ? comboBoxRenderer : super.getCellRenderer(row, col);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.romraider.logger.ecu.ui.paramlist;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.ecu.definition.EcuDataConvertor;
|
||||
import com.romraider.logger.ecu.definition.LoggerData;
|
||||
|
||||
|
@ -26,7 +27,9 @@ import javax.swing.AbstractCellEditor;
|
|||
import javax.swing.JComboBox;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
@ -42,7 +45,13 @@ public final class UnitsComboBoxEditor extends AbstractCellEditor implements Tab
|
|||
public Component getTableCellEditorComponent(JTable table, Object ecuData, boolean isSelected, int row, int column) {
|
||||
currentEcuData = (LoggerData) ecuData;
|
||||
EcuDataConvertor[] convertors = currentEcuData.getConvertors();
|
||||
JComboBox comboBox = new JComboBox();
|
||||
JComboBox<EcuDataConvertor> comboBox = new JComboBox<EcuDataConvertor>();
|
||||
if (EcuLogger.isTouchEnabled() == true)
|
||||
{
|
||||
comboBox.setRenderer(new FontCellRenderer());
|
||||
Font font = new Font("Tahoma", Font.PLAIN, 18);
|
||||
comboBox.setFont(font);
|
||||
}
|
||||
for (EcuDataConvertor convertor : convertors) {
|
||||
comboBox.addItem(convertor);
|
||||
}
|
||||
|
@ -58,7 +67,7 @@ public final class UnitsComboBoxEditor extends AbstractCellEditor implements Tab
|
|||
if (EDIT_COMMAND.equals(actionEvent.getActionCommand())) {
|
||||
Object source = actionEvent.getSource();
|
||||
if (source != null && JComboBox.class.isAssignableFrom(source.getClass())) {
|
||||
JComboBox comboBox = (JComboBox) source;
|
||||
JComboBox<?> comboBox = (JComboBox<?>) source;
|
||||
currentEcuData.selectConvertor((EcuDataConvertor) comboBox.getSelectedItem());
|
||||
fireEditingStopped();
|
||||
}
|
||||
|
|
|
@ -19,13 +19,20 @@
|
|||
|
||||
package com.romraider.logger.ecu.ui.paramlist;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.ecu.definition.EcuDataConvertor;
|
||||
import com.romraider.logger.ecu.definition.LoggerData;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
||||
public final class UnitsComboBoxRenderer extends JComboBox implements TableCellRenderer {
|
||||
|
||||
|
@ -34,11 +41,37 @@ public final class UnitsComboBoxRenderer extends JComboBox implements TableCellR
|
|||
public Component getTableCellRendererComponent(JTable table, Object ecuData, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
LoggerData currentEcuData = (LoggerData) ecuData;
|
||||
EcuDataConvertor[] convertors = currentEcuData.getConvertors();
|
||||
JComboBox comboBox = new JComboBox();
|
||||
JComboBox<EcuDataConvertor> comboBox = new JComboBox();
|
||||
|
||||
if (EcuLogger.isTouchEnabled() == true)
|
||||
{
|
||||
comboBox.setPreferredSize(new Dimension(75, 100));
|
||||
comboBox.setRenderer(new FontCellRenderer());
|
||||
}
|
||||
|
||||
for (EcuDataConvertor convertor : convertors) {
|
||||
comboBox.addItem(convertor);
|
||||
}
|
||||
|
||||
comboBox.setSelectedItem(currentEcuData.getSelectedConvertor());
|
||||
return comboBox;
|
||||
}
|
||||
}
|
||||
|
||||
class FontCellRenderer extends DefaultListCellRenderer {
|
||||
|
||||
private static final long serialVersionUID = 5963151264549169227L;
|
||||
|
||||
public Component getListCellRendererComponent(
|
||||
JList list,
|
||||
Object value,
|
||||
int index,
|
||||
boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
JLabel label = (JLabel)super.getListCellRendererComponent(
|
||||
list,value,index,isSelected,cellHasFocus);
|
||||
Font font = new Font("Tahoma", Font.PLAIN, 18);
|
||||
label.setFont(font);
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue