mirror of https://github.com/rusefi/RomRaider.git
- Added ability to change the clipboard format. Options are Default, Airboys, and Custom. Custom formats are specified in the settings.xml.
- Restructured the settings panel to use tabs. - Formatted Files. We should probably agree on some formatting standards and/or eclipse settings.
This commit is contained in:
parent
a7508828f9
commit
0d7c00b6b8
|
@ -22,9 +22,8 @@ package com.romraider;
|
|||
import static com.romraider.Version.RELEASE_NOTES;
|
||||
import static com.romraider.Version.ROM_REVISION_URL;
|
||||
import static com.romraider.Version.SUPPORT_URL;
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
import com.romraider.logger.ecu.definition.EcuDefinition;
|
||||
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
@ -34,14 +33,43 @@ import java.io.Serializable;
|
|||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
import com.romraider.logger.ecu.definition.EcuDefinition;
|
||||
|
||||
public class Settings implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1026542922680475190L;
|
||||
|
||||
public static final String NEW_LINE = System.getProperty("line.separator");
|
||||
public static final String TAB = "\t";
|
||||
|
||||
public static final String TABLE_CLIPBOARD_FORMAT_ELEMENT = "table-clipboard-format";
|
||||
public static final String TABLE_CLIPBOARD_FORMAT_ATTRIBUTE = "format-string";
|
||||
public static final String TABLE_ELEMENT = "table";
|
||||
public static final String TABLE1D_ELEMENT = "table1D";
|
||||
public static final String TABLE2D_ELEMENT = "table2D";
|
||||
public static final String TABLE3D_ELEMENT = "table3D";
|
||||
public static final String TABLE_HEADER_ATTRIBUTE = "table-header";
|
||||
|
||||
public static final String DEFAULT_CLIPBOARD_FORMAT = "Default";
|
||||
public static final String DEFAULT_TABLE_HEADER = "[Table1D]" + NEW_LINE;
|
||||
public static final String DEFAULT_TABLE1D_HEADER = "";
|
||||
public static final String DEFAULT_TABLE2D_HEADER = "[Table2D]" + NEW_LINE;
|
||||
public static final String DEFAULT_TABLE3D_HEADER = "[Table3D]" + NEW_LINE;
|
||||
|
||||
public static final String AIRBOYS_CLIPBOARD_FORMAT = "Airboys";
|
||||
public static final String AIRBOYS_TABLE_HEADER = "";
|
||||
public static final String AIRBOYS_TABLE1D_HEADER = "";
|
||||
public static final String AIRBOYS_TABLE2D_HEADER = "[Table2D]" + NEW_LINE;
|
||||
public static final String AIRBOYS_TABLE3D_HEADER = "[Table3D]" + TAB;
|
||||
|
||||
public static final String CUSTOM_CLIPBOARD_FORMAT = "Custom";
|
||||
|
||||
public static final String REPOSITORY_ELEMENT_NAME = "repository-dir";
|
||||
public static final String REPOSITORY_ATTRIBUTE_NAME = "path";
|
||||
|
||||
private Dimension windowSize = new Dimension(800, 600);
|
||||
private Point windowLocation = new Point();
|
||||
|
||||
private final Dimension windowSize = new Dimension(800, 600);
|
||||
private final Point windowLocation = new Point();
|
||||
private int splitPaneLocation = 150;
|
||||
private boolean windowMaximized = false;
|
||||
|
||||
|
@ -71,7 +99,7 @@ public class Settings implements Serializable {
|
|||
|
||||
private String loggerPort = "";
|
||||
private String loggerPortDefault = "";
|
||||
private String loggerProtocol = "SSM";
|
||||
private final String loggerProtocol = "SSM";
|
||||
private String loggerDefinitionFilePath = "";
|
||||
private String loggerProfileFilePath = "";
|
||||
private String loggerOutputDirPath = System.getProperty("user.home");
|
||||
|
@ -88,14 +116,19 @@ public class Settings implements Serializable {
|
|||
private ConnectionProperties loggerConnectionProperties;
|
||||
private Map<String, EcuDefinition> loggerEcuDefinitionMap;
|
||||
private Map<String, String> loggerPluginPorts;
|
||||
private boolean loggerRefreshMode = false;
|
||||
private byte loggerDestinationId = 0x10;
|
||||
private boolean fastPoll = true;
|
||||
private double loggerDividerLocation = 400;
|
||||
private String loggerDebuggingLevel = "info";
|
||||
private boolean loggerRefreshMode = false;
|
||||
private byte loggerDestinationId = 0x10;
|
||||
private boolean fastPoll = true;
|
||||
private double loggerDividerLocation = 400;
|
||||
private String loggerDebuggingLevel = "info";
|
||||
private static String j2534Device = null;
|
||||
private static String j2534Protocol = "ISO9141";
|
||||
|
||||
private String tableClipboardFormat = DEFAULT_CLIPBOARD_FORMAT; // Currently 2 options. Default and Airboy. Custom is not hooked up.
|
||||
private String tableHeader = DEFAULT_TABLE_HEADER;
|
||||
private String table1DHeader = DEFAULT_TABLE1D_HEADER;
|
||||
private String table2DHeader = DEFAULT_TABLE2D_HEADER;
|
||||
private String table3DHeader = DEFAULT_TABLE3D_HEADER;
|
||||
public Settings() {
|
||||
//center window by default
|
||||
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
@ -140,11 +173,11 @@ public class Settings implements Serializable {
|
|||
}
|
||||
|
||||
public File getLastRepositoryDir() {
|
||||
return lastRepositoryDir;
|
||||
return lastRepositoryDir;
|
||||
}
|
||||
|
||||
public void setLastRepositoryDir(File lastRepositoryDir) {
|
||||
this.lastRepositoryDir = lastRepositoryDir;
|
||||
this.lastRepositoryDir = lastRepositoryDir;
|
||||
}
|
||||
|
||||
public int getSplitPaneLocation() {
|
||||
|
@ -457,54 +490,110 @@ public class Settings implements Serializable {
|
|||
public void setLoggerPluginPorts(Map<String, String> loggerPluginPorts) {
|
||||
this.loggerPluginPorts = loggerPluginPorts;
|
||||
}
|
||||
|
||||
|
||||
public void setLoggerParameterListState(boolean ShowListState) {
|
||||
this.loggerParameterListState = ShowListState;
|
||||
this.loggerParameterListState = ShowListState;
|
||||
}
|
||||
|
||||
public boolean getLoggerParameterListState() {
|
||||
return loggerParameterListState;
|
||||
return loggerParameterListState;
|
||||
}
|
||||
|
||||
public void setRefreshMode(boolean selected) {
|
||||
this.loggerRefreshMode = selected;
|
||||
}
|
||||
|
||||
public boolean getRefreshMode() {
|
||||
return loggerRefreshMode;
|
||||
public void setRefreshMode(boolean selected) {
|
||||
this.loggerRefreshMode = selected;
|
||||
}
|
||||
|
||||
public void setDestinationId(byte id) {
|
||||
this.loggerDestinationId = id;
|
||||
}
|
||||
public boolean getRefreshMode() {
|
||||
return loggerRefreshMode;
|
||||
}
|
||||
|
||||
public byte getDestinationId() {
|
||||
return loggerDestinationId;
|
||||
}
|
||||
public void setDestinationId(byte id) {
|
||||
this.loggerDestinationId = id;
|
||||
}
|
||||
|
||||
public void setFastPoll(boolean state) {
|
||||
this.fastPoll = state;
|
||||
}
|
||||
public byte getDestinationId() {
|
||||
return loggerDestinationId;
|
||||
}
|
||||
|
||||
public boolean isFastPoll() {
|
||||
return fastPoll;
|
||||
}
|
||||
public void setFastPoll(boolean state) {
|
||||
this.fastPoll = state;
|
||||
}
|
||||
|
||||
public void setLogfileNameText(String text) {
|
||||
this.logfileNameText = text;
|
||||
}
|
||||
public boolean isFastPoll() {
|
||||
return fastPoll;
|
||||
}
|
||||
|
||||
public String getLogfileNameText() {
|
||||
return logfileNameText;
|
||||
}
|
||||
public void setLogfileNameText(String text) {
|
||||
this.logfileNameText = text;
|
||||
}
|
||||
|
||||
public void setLoggerDebuggingLevel(String level) {
|
||||
this.loggerDebuggingLevel = level;
|
||||
}
|
||||
public String getLogfileNameText() {
|
||||
return logfileNameText;
|
||||
}
|
||||
|
||||
public String getLoggerDebuggingLevel() {
|
||||
return loggerDebuggingLevel;
|
||||
}
|
||||
public void setLoggerDebuggingLevel(String level) {
|
||||
this.loggerDebuggingLevel = level;
|
||||
}
|
||||
|
||||
public String getLoggerDebuggingLevel() {
|
||||
return loggerDebuggingLevel;
|
||||
}
|
||||
|
||||
public void setTableClipboardFormat(String formatString) {
|
||||
this.tableClipboardFormat = formatString;
|
||||
}
|
||||
|
||||
public String getTableClipboardFormat() {
|
||||
return this.tableClipboardFormat;
|
||||
}
|
||||
|
||||
public void setTableHeader(String header) {
|
||||
this.tableHeader = header;
|
||||
}
|
||||
|
||||
public String getTableHeader() {
|
||||
return this.tableHeader;
|
||||
}
|
||||
|
||||
public void setTable1DHeader(String header) {
|
||||
this.table1DHeader = header;
|
||||
}
|
||||
|
||||
public String getTable1DHeader() {
|
||||
return this.table1DHeader;
|
||||
}
|
||||
|
||||
public void setTable2DHeader(String header) {
|
||||
this.table2DHeader = header;
|
||||
}
|
||||
|
||||
public String getTable2DHeader() {
|
||||
return this.table2DHeader;
|
||||
}
|
||||
|
||||
public void setTable3DHeader(String header) {
|
||||
this.table3DHeader = header;
|
||||
}
|
||||
|
||||
public String getTable3DHeader() {
|
||||
return this.table3DHeader;
|
||||
}
|
||||
|
||||
public void setDefaultFormat() {
|
||||
this.tableClipboardFormat = DEFAULT_CLIPBOARD_FORMAT;
|
||||
this.tableHeader = DEFAULT_TABLE_HEADER;
|
||||
this.table1DHeader = DEFAULT_TABLE1D_HEADER;
|
||||
this.table2DHeader = DEFAULT_TABLE2D_HEADER;
|
||||
this.table3DHeader = DEFAULT_TABLE3D_HEADER;
|
||||
}
|
||||
|
||||
public void setAirboysFormat() {
|
||||
this.tableClipboardFormat = AIRBOYS_CLIPBOARD_FORMAT;
|
||||
this.tableHeader = AIRBOYS_TABLE_HEADER;
|
||||
this.table1DHeader = AIRBOYS_TABLE1D_HEADER;
|
||||
this.table2DHeader = AIRBOYS_TABLE2D_HEADER;
|
||||
this.table3DHeader = AIRBOYS_TABLE3D_HEADER;
|
||||
}
|
||||
|
||||
public static void setJ2534Device(String j2534Device) {
|
||||
Settings.j2534Device = j2534Device;
|
||||
|
|
|
@ -19,11 +19,52 @@
|
|||
|
||||
package com.romraider.editor.ecu;
|
||||
|
||||
import com.centerkey.utils.BareBonesBrowserLaunch;
|
||||
import com.romraider.Settings;
|
||||
import static com.romraider.Version.ECU_DEFS_URL;
|
||||
import static com.romraider.Version.PRODUCT_NAME;
|
||||
import static com.romraider.Version.VERSION;
|
||||
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
||||
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
||||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.WARNING_MESSAGE;
|
||||
import static javax.swing.JOptionPane.showMessageDialog;
|
||||
import static javax.swing.JOptionPane.showOptionDialog;
|
||||
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
|
||||
import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
|
||||
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
|
||||
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import com.centerkey.utils.BareBonesBrowserLaunch;
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
|
||||
import com.romraider.maps.Rom;
|
||||
import com.romraider.maps.Table;
|
||||
|
@ -42,59 +83,22 @@ import com.romraider.util.SettingsManagerImpl;
|
|||
import com.romraider.xml.DOMRomUnmarshaller;
|
||||
import com.romraider.xml.RomNotFoundException;
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
import static javax.swing.JOptionPane.DEFAULT_OPTION;
|
||||
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
||||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.WARNING_MESSAGE;
|
||||
import static javax.swing.JOptionPane.showMessageDialog;
|
||||
import static javax.swing.JOptionPane.showOptionDialog;
|
||||
import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
|
||||
import static javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER;
|
||||
import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS;
|
||||
import static javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
public class ECUEditor extends AbstractFrame {
|
||||
private static final long serialVersionUID = -7826850987392016292L;
|
||||
|
||||
private String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor";
|
||||
private final String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor";
|
||||
|
||||
private static final String NEW_LINE = System.getProperty("line.separator");
|
||||
private final SettingsManager settingsManager = new SettingsManagerImpl();
|
||||
private RomTreeRootNode imageRoot = new RomTreeRootNode("Open Images");
|
||||
private RomTree imageList = new RomTree(imageRoot);
|
||||
private final RomTreeRootNode imageRoot = new RomTreeRootNode("Open Images");
|
||||
private final RomTree imageList = new RomTree(imageRoot);
|
||||
public MDIDesktopPane rightPanel = new MDIDesktopPane();
|
||||
public JProgressPane statusPanel = new JProgressPane();
|
||||
private JSplitPane splitPane = new JSplitPane();
|
||||
private Rom lastSelectedRom = null;
|
||||
private ECUEditorToolBar toolBar;
|
||||
private ECUEditorMenuBar menuBar;
|
||||
private final ECUEditorMenuBar menuBar;
|
||||
private Settings settings;
|
||||
|
||||
public ECUEditor() {
|
||||
|
@ -206,25 +210,32 @@ public class ECUEditor extends AbstractFrame {
|
|||
repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
handleExit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent e) {
|
||||
}
|
||||
|
||||
|
@ -258,11 +269,12 @@ public class ECUEditor extends AbstractFrame {
|
|||
check.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||
|
||||
check.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
settings.setObsoleteWarning(((JCheckBox) e.getSource()).isSelected());
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
infoPanel.add(check);
|
||||
showMessageDialog(this, infoPanel, "ECU Revision is Obsolete", INFORMATION_MESSAGE);
|
||||
|
@ -381,6 +393,7 @@ public class ECUEditor extends AbstractFrame {
|
|||
return images;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
imageList.updateUI();
|
||||
imageList.repaint();
|
||||
|
@ -437,9 +450,9 @@ public class ECUEditor extends AbstractFrame {
|
|||
showMessageDialog(this, "Looped \"base\" attribute in XML definitions.", "Error Loading "+inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} catch (OutOfMemoryError ome) {
|
||||
// handles Java heap space issues when loading multiple Roms.
|
||||
showMessageDialog(this, "Error loading Image. Out of memeory.", "Error Loading "+inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
// handles Java heap space issues when loading multiple Roms.
|
||||
showMessageDialog(this, "Error loading Image. Out of memeory.", "Error Loading "+inputFile.getName(), ERROR_MESSAGE);
|
||||
|
||||
} finally {
|
||||
// remove progress bar
|
||||
//progress.dispose();
|
||||
|
@ -448,12 +461,12 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public void openImages(File[] inputFiles) throws Exception {
|
||||
if(inputFiles.length < 1) {
|
||||
if(inputFiles.length < 1) {
|
||||
showMessageDialog(this, "Image Not Found", "Error Loading Image(s)", ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for(int j=0;j<inputFiles.length;j++) {
|
||||
openImage(inputFiles[j]);
|
||||
openImage(inputFiles[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,6 +486,6 @@ public class ECUEditor extends AbstractFrame {
|
|||
}
|
||||
|
||||
public SettingsManager getSettingsManager() {
|
||||
return this.settingsManager;
|
||||
return this.settingsManager;
|
||||
}
|
||||
}
|
|
@ -184,7 +184,7 @@ TODO: Keyboard accessibility (enable/disable parameters, select tabs, etc)
|
|||
TODO: Rewrite user profile application and saving to allow tab specific settings (eg. warn levels on dash tab)
|
||||
TODO: Add custom graph tab (eg. engine speed vs. boost, etc.)
|
||||
TODO: Add log analysis tab (or maybe new window?), including log playback, custom graphs, map compare, etc
|
||||
*/
|
||||
*/
|
||||
|
||||
public final class EcuLogger extends AbstractFrame implements MessageListener {
|
||||
private static final long serialVersionUID = 7145423251696282784L;
|
||||
|
@ -200,10 +200,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private static final String ECU_TEXT = "Engine Control Unit Polling";
|
||||
private static final String TCU_TEXT = "Transmission Control Unit Polling";
|
||||
private static final String[] LOG_FILE_TEXT = {"1st PT","2nd PT","3rd PT", // PT = Part Throttle
|
||||
"4th PT","5th PT","6th PT",
|
||||
"1st WOT","2nd WOT","3rd WOT",
|
||||
"4th WOT","5th WOT","6th WOT",
|
||||
"cruising"};
|
||||
"4th PT","5th PT","6th PT",
|
||||
"1st WOT","2nd WOT","3rd WOT",
|
||||
"4th WOT","5th WOT","6th WOT",
|
||||
"cruising"};
|
||||
private static final String TOGGLE_LIST_TT_TEXT = "Hides the parameter list and saves the state on exit (F11)";
|
||||
private static final String UNSELECT_ALL_TT_TEXT = "Un-select all selected parameters/switches on all tabs! (F9)";
|
||||
private static final byte ECU_ID = (byte) 0x10;
|
||||
|
@ -261,8 +261,8 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private List<EcuParameter> ecuParams;
|
||||
private SerialPortRefresher refresher;
|
||||
private JWindow startStatus;
|
||||
private JLabel startText = new JLabel(" Initializing Logger...");
|
||||
private String HOME = System.getProperty("user.home");
|
||||
private final JLabel startText = new JLabel(" Initializing Logger...");
|
||||
private final String HOME = System.getProperty("user.home");
|
||||
private StatusIndicator statusIndicator;
|
||||
|
||||
public EcuLogger(Settings settings) {
|
||||
|
@ -279,57 +279,59 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private void construct(Settings settings) {
|
||||
checkNotNull(settings);
|
||||
this.settings = settings;
|
||||
Logger.getRootLogger().setLevel((Level) Level.toLevel(settings.getLoggerDebuggingLevel()));
|
||||
Logger.getRootLogger().setLevel(Level.toLevel(settings.getLoggerDebuggingLevel()));
|
||||
if (ecuEditor == null) {
|
||||
JProgressBar progressBar = startbar();
|
||||
bootstrap();
|
||||
progressBar.setValue(20);
|
||||
startText.setText(" Loading ECU Defs...");
|
||||
loadEcuDefs();
|
||||
progressBar.setValue(40);
|
||||
startText.setText(" Loading Plugins...");
|
||||
progressBar.setIndeterminate(true);
|
||||
loadLoggerPlugins();
|
||||
progressBar.setIndeterminate(false);
|
||||
progressBar.setValue(60);
|
||||
startText.setText(" Loading ECU Parameters...");
|
||||
loadLoggerParams();
|
||||
progressBar.setValue(80);
|
||||
startText.setText(" Starting Logger...");
|
||||
initControllerListeners();
|
||||
initUserInterface();
|
||||
progressBar.setValue(100);
|
||||
initDataUpdateHandlers();
|
||||
startPortRefresherThread();
|
||||
if (!isLogging()) startLogging();
|
||||
startStatus.dispose();
|
||||
bootstrap();
|
||||
progressBar.setValue(20);
|
||||
startText.setText(" Loading ECU Defs...");
|
||||
loadEcuDefs();
|
||||
progressBar.setValue(40);
|
||||
startText.setText(" Loading Plugins...");
|
||||
progressBar.setIndeterminate(true);
|
||||
loadLoggerPlugins();
|
||||
progressBar.setIndeterminate(false);
|
||||
progressBar.setValue(60);
|
||||
startText.setText(" Loading ECU Parameters...");
|
||||
loadLoggerParams();
|
||||
progressBar.setValue(80);
|
||||
startText.setText(" Starting Logger...");
|
||||
initControllerListeners();
|
||||
initUserInterface();
|
||||
progressBar.setValue(100);
|
||||
initDataUpdateHandlers();
|
||||
startPortRefresherThread();
|
||||
if (!isLogging()) startLogging();
|
||||
startStatus.dispose();
|
||||
}
|
||||
else {
|
||||
bootstrap();
|
||||
ecuEditor.statusPanel.update("Loading ECU Defs...", 20);
|
||||
loadEcuDefs();
|
||||
ecuEditor.statusPanel.update("Loading Plugins...", 40);
|
||||
loadLoggerPlugins();
|
||||
ecuEditor.statusPanel.update("Loading ECU Parameters...", 60);
|
||||
loadLoggerParams();
|
||||
ecuEditor.statusPanel.update("Starting Logger...", 80);
|
||||
initControllerListeners();
|
||||
initUserInterface();
|
||||
ecuEditor.statusPanel.update("Complete...", 100);
|
||||
initDataUpdateHandlers();
|
||||
startPortRefresherThread();
|
||||
if (!isLogging()) startLogging();
|
||||
}
|
||||
bootstrap();
|
||||
ecuEditor.statusPanel.update("Loading ECU Defs...", 20);
|
||||
loadEcuDefs();
|
||||
ecuEditor.statusPanel.update("Loading Plugins...", 40);
|
||||
loadLoggerPlugins();
|
||||
ecuEditor.statusPanel.update("Loading ECU Parameters...", 60);
|
||||
loadLoggerParams();
|
||||
ecuEditor.statusPanel.update("Starting Logger...", 80);
|
||||
initControllerListeners();
|
||||
initUserInterface();
|
||||
ecuEditor.statusPanel.update("Complete...", 100);
|
||||
initDataUpdateHandlers();
|
||||
startPortRefresherThread();
|
||||
if (!isLogging()) startLogging();
|
||||
}
|
||||
}
|
||||
|
||||
private void bootstrap() {
|
||||
EcuInitCallback ecuInitCallback = new EcuInitCallback() {
|
||||
@Override
|
||||
public void callback(EcuInit newEcuInit) {
|
||||
final String ecuId = newEcuInit.getEcuId();
|
||||
LOGGER.info(target + " ID = " + ecuId);
|
||||
if (ecuInit == null || !ecuInit.getEcuId().equals(ecuId)) {
|
||||
ecuInit = newEcuInit;
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String calId = getCalId(ecuId);
|
||||
String carString = getCarString(ecuId);
|
||||
|
@ -493,9 +495,9 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
loadResult = String.format("%sloaded %d parameters, %d switches.",loadResult, ecuParams.size(), dataLoader.getEcuSwitches().size());
|
||||
LOGGER.info(loadResult);
|
||||
} catch (ConfigurationException cfe) {
|
||||
reportError(cfe);
|
||||
showMissingConfigDialog();
|
||||
}
|
||||
reportError(cfe);
|
||||
showMissingConfigDialog();
|
||||
}
|
||||
catch (Exception e) {
|
||||
reportError(e);
|
||||
}
|
||||
|
@ -554,6 +556,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
controller.setFileLoggerSwitchMonitor(new FileLoggerControllerSwitchMonitorImpl(fileLoggingControllerSwitch, new FileLoggerControllerSwitchHandler() {
|
||||
boolean oldDefogStatus = false;
|
||||
|
||||
@Override
|
||||
public void handleSwitch(double switchValue) {
|
||||
boolean logToFile = (int) switchValue == 1;
|
||||
if (settings.isFileLoggingControllerSwitchActive() && logToFile != oldDefogStatus) {
|
||||
|
@ -621,10 +624,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private void addExternalConvertorUpdateListeners(List<ExternalData> externalDatas) {
|
||||
for (ExternalData externalData : externalDatas) {
|
||||
externalData.addConvertorUpdateListener(fileUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(liveDataUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(graphUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(dashboardUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(fileUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(liveDataUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(graphUpdateHandler);
|
||||
externalData.addConvertorUpdateListener(dashboardUpdateHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -679,7 +682,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
try {
|
||||
List<? extends ExternalDataItem> dataItems = dataSource.getDataItems();
|
||||
for (ExternalDataItem item : dataItems) {
|
||||
externalDatas.add(new ExternalDataImpl(item, dataSource));
|
||||
externalDatas.add(new ExternalDataImpl(item, dataSource));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
reportError("Error loading plugin: " + dataSource.getName() + " v" + dataSource.getVersion(), e);
|
||||
|
@ -796,6 +799,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
button.getActionMap().put("toggleGaugeStyle", new AbstractAction() {
|
||||
private static final long serialVersionUID = 6913964758354638587L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
button.doClick();
|
||||
}
|
||||
|
@ -803,6 +807,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
button.addActionListener(new AbstractAction() {
|
||||
private static final long serialVersionUID = 123232894767995264L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dashboardUpdateHandler.toggleGaugeStyle();
|
||||
}
|
||||
|
@ -814,7 +819,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
List<ParameterRow> rows = paramListTableModel.getParameterRows();
|
||||
for (ParameterRow row : rows) {
|
||||
if (row.isSelected()) {
|
||||
row.getLoggerData().setSelected(false);
|
||||
row.getLoggerData().setSelected(false);
|
||||
row.setSelected(false);
|
||||
paramListTableModel.selectParam(row.getLoggerData(), false);
|
||||
}
|
||||
|
@ -833,6 +838,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
button.getActionMap().put("un-selectAll", new AbstractAction() {
|
||||
private static final long serialVersionUID = 4913964758354638588L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
button.doClick();
|
||||
}
|
||||
|
@ -840,24 +846,25 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
button.addActionListener(new AbstractAction() {
|
||||
private static final long serialVersionUID = 723232894767995265L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
clearAllSelectedParameters(dataTabParamListTableModel);
|
||||
clearAllSelectedParameters(dataTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(dataTabExternalListTableModel);
|
||||
clearAllSelectedParameters(graphTabParamListTableModel);
|
||||
clearAllSelectedParameters(graphTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(graphTabExternalListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabParamListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabExternalListTableModel);
|
||||
}
|
||||
catch (Exception cae) {
|
||||
LOGGER.error("Un-select ALL error: " + cae);
|
||||
}
|
||||
finally {
|
||||
LOGGER.info("Un-select all parameters by user action");
|
||||
}
|
||||
try {
|
||||
clearAllSelectedParameters(dataTabParamListTableModel);
|
||||
clearAllSelectedParameters(dataTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(dataTabExternalListTableModel);
|
||||
clearAllSelectedParameters(graphTabParamListTableModel);
|
||||
clearAllSelectedParameters(graphTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(graphTabExternalListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabParamListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabSwitchListTableModel);
|
||||
clearAllSelectedParameters(dashboardTabExternalListTableModel);
|
||||
}
|
||||
catch (Exception cae) {
|
||||
LOGGER.error("Un-select ALL error: " + cae);
|
||||
}
|
||||
finally {
|
||||
LOGGER.info("Un-select all parameters by user action");
|
||||
}
|
||||
}
|
||||
});
|
||||
return button;
|
||||
|
@ -874,6 +881,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
toggleListButton.getActionMap().put("toggleHideParams", new AbstractAction() {
|
||||
private static final long serialVersionUID = -276854997788647306L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
toggleListButton.doClick();
|
||||
}
|
||||
|
@ -883,16 +891,17 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private final int min = 1;
|
||||
public int size = splitPane.getDividerLocation();
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int current = splitPane.getDividerLocation();
|
||||
if (toggleListButton.isSelected()) {
|
||||
splitPane.setDividerLocation(size);
|
||||
settings.setLoggerParameterListState(true);
|
||||
if (toggleListButton.isSelected()) {
|
||||
splitPane.setDividerLocation(size);
|
||||
settings.setLoggerParameterListState(true);
|
||||
}
|
||||
else {
|
||||
splitPane.setDividerLocation(min);
|
||||
size = current;
|
||||
settings.setLoggerParameterListState(false);
|
||||
settings.setLoggerParameterListState(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1000,7 +1009,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
JPanel controlPanel = new JPanel(new BorderLayout());
|
||||
controlPanel.add(buildPortsComboBox(), WEST);
|
||||
//TODO: Finish log playback stuff...
|
||||
// controlPanel.add(buildPlaybackControls(), CENTER);
|
||||
// controlPanel.add(buildPlaybackControls(), CENTER);
|
||||
controlPanel.add(buildStatusIndicator(), EAST);
|
||||
return controlPanel;
|
||||
}
|
||||
|
@ -1008,8 +1017,10 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
private Component buildPlaybackControls() {
|
||||
JButton playButton = new JButton("Play");
|
||||
playButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
ThreadUtil.runAsDaemon(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PlaybackManagerImpl playbackManager = new PlaybackManagerImpl(ecuParams, liveDataUpdateHandler, graphUpdateHandler, dashboardUpdateHandler, mafUpdateHandler, dynoUpdateHandler,
|
||||
TableUpdateHandler.getInstance());
|
||||
|
@ -1025,48 +1036,53 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
|
||||
private Component buildFileNameExtention() {
|
||||
JLabel fileNameLabel = new JLabel("Logfile Text");
|
||||
final JTextField fileNameExtention = new JTextField("",8);
|
||||
fileNameExtention.setToolTipText(FILE_NAME_EXTENTION);
|
||||
fileNameExtention.addFocusListener(new FocusListener() {
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
}
|
||||
JLabel fileNameLabel = new JLabel("Logfile Text");
|
||||
final JTextField fileNameExtention = new JTextField("",8);
|
||||
fileNameExtention.setToolTipText(FILE_NAME_EXTENTION);
|
||||
fileNameExtention.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
|
||||
JPopupMenu fileNamePopup = new JPopupMenu();
|
||||
@Override
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
|
||||
JPopupMenu fileNamePopup = new JPopupMenu();
|
||||
JMenuItem ecuIdItem = new JMenuItem("Use Current " + target + " ID");
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText(ecuInit.getEcuId());
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
fileNameExtention.setText(ecuInit.getEcuId());
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
});
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
for (final String item : LOG_FILE_TEXT) {
|
||||
ecuIdItem = new JMenuItem(item);
|
||||
if (item.endsWith("PT")) ecuIdItem.setToolTipText("Part Throttle");
|
||||
if (item.endsWith("WOT")) ecuIdItem.setToolTipText("Wide Open Throttle");
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText(item.replaceAll(" ", "_"));
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
fileNameExtention.setText(item.replaceAll(" ", "_"));
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
});
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
}
|
||||
ecuIdItem = new JMenuItem("Clear Logfile Text");
|
||||
ecuIdItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fileNameExtention.setText("");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
fileNameExtention.setText("");
|
||||
settings.setLogfileNameText(fileNameExtention.getText());
|
||||
}
|
||||
});
|
||||
});
|
||||
fileNamePopup.add(ecuIdItem);
|
||||
fileNameExtention.addMouseListener(new LogFileNameFieldAction(fileNamePopup));
|
||||
fileNameExtention.addMouseListener(new LogFileNameFieldAction(fileNamePopup));
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.add(fileNameLabel);
|
||||
|
@ -1081,6 +1097,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
logToFileButton.setBackground(GREEN);
|
||||
logToFileButton.setOpaque(true);
|
||||
logToFileButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (logToFileButton.isSelected() && controller.isStarted()) {
|
||||
fileUpdateHandler.start();
|
||||
|
@ -1100,6 +1117,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private JPanel buildPortsComboBox() {
|
||||
portsComboBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
settings.setLoggerPort((String) portsComboBox.getSelectedItem());
|
||||
// this is a hack...
|
||||
|
@ -1117,30 +1135,32 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
ecuCheckBox.setToolTipText(ECU_TEXT);
|
||||
tcuCheckBox.setToolTipText(TCU_TEXT);
|
||||
ecuCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
stopLogging();
|
||||
tcuCheckBox.setSelected(false);
|
||||
setTargetEcu();
|
||||
startLogging();
|
||||
stopLogging();
|
||||
tcuCheckBox.setSelected(false);
|
||||
setTargetEcu();
|
||||
startLogging();
|
||||
}
|
||||
});
|
||||
tcuCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
stopLogging();
|
||||
ecuCheckBox.setSelected(false);
|
||||
setTargetTcu();
|
||||
startLogging();
|
||||
stopLogging();
|
||||
ecuCheckBox.setSelected(false);
|
||||
setTargetTcu();
|
||||
startLogging();
|
||||
}
|
||||
});
|
||||
if (settings.getDestinationId() == 0x10) {
|
||||
ecuCheckBox.setSelected(true);
|
||||
tcuCheckBox.setSelected(false);
|
||||
setTargetEcu();
|
||||
ecuCheckBox.setSelected(true);
|
||||
tcuCheckBox.setSelected(false);
|
||||
setTargetEcu();
|
||||
}
|
||||
else {
|
||||
tcuCheckBox.setSelected(true);
|
||||
ecuCheckBox.setSelected(false);
|
||||
setTargetTcu();
|
||||
tcuCheckBox.setSelected(true);
|
||||
ecuCheckBox.setSelected(false);
|
||||
setTargetTcu();
|
||||
}
|
||||
|
||||
comboBoxPanel.add(ecuCheckBox);
|
||||
|
@ -1150,6 +1170,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
reconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
reconnectButton.setToolTipText("Reconnect to " + target);
|
||||
reconnectButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
try {
|
||||
restartLogging();
|
||||
|
@ -1163,6 +1184,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
disconnectButton.setPreferredSize(new Dimension(25, 25));
|
||||
disconnectButton.setToolTipText("Disconnect from " + target);
|
||||
disconnectButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
try {
|
||||
stopLogging();
|
||||
|
@ -1180,17 +1202,17 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
|
||||
private void setTargetEcu() {
|
||||
settings.setDestinationId(ECU_ID);
|
||||
target = "ECU";
|
||||
settings.setDestinationId(ECU_ID);
|
||||
target = "ECU";
|
||||
}
|
||||
|
||||
private void setTargetTcu() {
|
||||
settings.setDestinationId(TCU_ID);
|
||||
target = "TCU";
|
||||
settings.setDestinationId(TCU_ID);
|
||||
target = "TCU";
|
||||
}
|
||||
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
return target;
|
||||
}
|
||||
|
||||
public void restartLogging() {
|
||||
|
@ -1209,6 +1231,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
liveDataUpdateHandler.reset();
|
||||
}
|
||||
|
@ -1224,6 +1247,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
graphUpdateHandler.reset();
|
||||
}
|
||||
|
@ -1239,6 +1263,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JButton resetButton = new JButton("Reset Data");
|
||||
resetButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
dashboardUpdateHandler.reset();
|
||||
}
|
||||
|
@ -1255,28 +1280,36 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
if (tabIndex >= 0 && tabIndex < count) tabbedPane.setSelectedIndex(tabIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosing(WindowEvent windowEvent) {
|
||||
handleExit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent windowEvent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
|
||||
}
|
||||
|
||||
|
@ -1336,7 +1369,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
settings.setLoggerSelectedTabIndex(tabbedPane.getSelectedIndex());
|
||||
settings.setLoggerPluginPorts(getPluginPorts(externalDataSources));
|
||||
try {
|
||||
new SettingsManagerImpl().save(settings);
|
||||
new SettingsManagerImpl().save(settings);
|
||||
LOGGER.debug("Logger settings saved");
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Error saving logger settings:", e);
|
||||
|
@ -1353,7 +1386,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
|
||||
private void cleanUpUpdateHandlers() {
|
||||
fileUpdateHandler.cleanUp();
|
||||
fileUpdateHandler.cleanUp();
|
||||
dataHandlerManager.cleanUp();
|
||||
graphHandlerManager.cleanUp();
|
||||
dashboardHandlerManager.cleanUp();
|
||||
|
@ -1363,9 +1396,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
return settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportMessage(final String message) {
|
||||
if (message != null) {
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
messageLabel.setText(message);
|
||||
messageLabel.setForeground(BLACK);
|
||||
|
@ -1374,13 +1409,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportMessageInTitleBar(String message) {
|
||||
if (!isNullOrEmpty(message)) setTitle(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportStats(final String message) {
|
||||
if (!isNullOrEmpty(message)) {
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
statsLabel.setText(message);
|
||||
}
|
||||
|
@ -1395,9 +1433,11 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportError(final String error) {
|
||||
if (!isNullOrEmpty(error)) {
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
messageLabel.setText("Error: " + error);
|
||||
messageLabel.setForeground(RED);
|
||||
|
@ -1406,6 +1446,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportError(Exception e) {
|
||||
if (e != null) {
|
||||
LOGGER.error("Error occurred", e);
|
||||
|
@ -1415,11 +1456,13 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportError(String error, Exception e) {
|
||||
if (e != null) LOGGER.error(error, e);
|
||||
reportError(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
if (title != null) {
|
||||
if (!title.startsWith(ECU_LOGGER_TITLE)) {
|
||||
|
@ -1429,16 +1472,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
public void setRefreshMode(boolean refreshMode) {
|
||||
settings.setRefreshMode(refreshMode);
|
||||
refresher.setRefreshMode(refreshMode);
|
||||
}
|
||||
public void setRefreshMode(boolean refreshMode) {
|
||||
settings.setRefreshMode(refreshMode);
|
||||
refresher.setRefreshMode(refreshMode);
|
||||
}
|
||||
|
||||
private JProgressBar startbar() {
|
||||
startStatus = new JWindow();
|
||||
startStatus.setAlwaysOnTop(true);
|
||||
startStatus.setLocation((int)(settings.getLoggerWindowSize().getWidth()/2 + settings.getLoggerWindowLocation().getX()),
|
||||
(int)(settings.getLoggerWindowSize().getHeight()/2 + settings.getLoggerWindowLocation().getY()));
|
||||
private JProgressBar startbar() {
|
||||
startStatus = new JWindow();
|
||||
startStatus.setAlwaysOnTop(true);
|
||||
startStatus.setLocation((int)(settings.getLoggerWindowSize().getWidth()/2 + settings.getLoggerWindowLocation().getX()),
|
||||
(int)(settings.getLoggerWindowSize().getHeight()/2 + settings.getLoggerWindowLocation().getY()));
|
||||
JProgressBar progressBar = new JProgressBar(0, 100);
|
||||
progressBar.setValue(0);
|
||||
progressBar.setIndeterminate(false);
|
||||
|
@ -1452,8 +1495,8 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
startStatus.getContentPane().add(panel);
|
||||
startStatus.pack();
|
||||
startStatus.setVisible(true);
|
||||
return progressBar;
|
||||
}
|
||||
return progressBar;
|
||||
}
|
||||
|
||||
//**********************************************************************
|
||||
|
||||
|
@ -1478,6 +1521,7 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
|
||||
private static void createAndShowGui(final int defaultCloseOperation, final EcuLogger ecuLogger, final boolean fullscreen) {
|
||||
invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doCreateAndShowGui(defaultCloseOperation, ecuLogger, fullscreen);
|
||||
}
|
||||
|
@ -1517,16 +1561,16 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
|
|||
// simulate F11 key typed based on Parameter List show setting 'showlist' in settings.xml
|
||||
// is this a hack as it may not work in X-server?
|
||||
if (settings.getLoggerSelectedTabIndex() >= 0 && settings.getLoggerSelectedTabIndex() <= 2) {
|
||||
if (!settings.getLoggerParameterListState()) { //false setting hides list
|
||||
Robot r;
|
||||
try {
|
||||
r = new Robot();
|
||||
r.keyPress(KeyEvent.VK_F11);
|
||||
r.keyRelease(KeyEvent.VK_F11);
|
||||
} catch (AWTException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!settings.getLoggerParameterListState()) { //false setting hides list
|
||||
Robot r;
|
||||
try {
|
||||
r = new Robot();
|
||||
r.keyPress(KeyEvent.VK_F11);
|
||||
r.keyRelease(KeyEvent.VK_F11);
|
||||
} catch (AWTException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,20 +19,9 @@
|
|||
|
||||
package com.romraider.maps;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import static com.romraider.util.ColorScaler.getScaledColor;
|
||||
import com.romraider.util.JEPUtil;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
@ -50,6 +39,20 @@ import java.io.Serializable;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.InputMap;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import com.romraider.util.JEPUtil;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
|
||||
public abstract class Table extends JPanel implements Serializable {
|
||||
private static final long serialVersionUID = 6559256489995552645L;
|
||||
protected static final String BLANK = "";
|
||||
|
@ -132,6 +135,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action rightAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = 1042884198300385041L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cursorRight();
|
||||
}
|
||||
|
@ -139,6 +143,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action leftAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -4970441255677214171L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cursorLeft();
|
||||
}
|
||||
|
@ -146,6 +151,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action downAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -7898502951121825984L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cursorDown();
|
||||
}
|
||||
|
@ -153,6 +159,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action upAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = 6937621541727666631L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
cursorUp();
|
||||
}
|
||||
|
@ -160,6 +167,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action incCoarseAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -8308522736529183148L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.getToolBar().incrementCoarse();
|
||||
}
|
||||
|
@ -167,6 +175,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action decCoarseAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -7407628920997400915L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.getToolBar().decrementCoarse();
|
||||
}
|
||||
|
@ -174,6 +183,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action incFineAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = 7261463425941761433L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.getToolBar().incrementFine();
|
||||
}
|
||||
|
@ -181,6 +191,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action decFineAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = 8929400237520608035L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
frame.getToolBar().decrementFine();
|
||||
}
|
||||
|
@ -188,6 +199,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num0Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -6310984176739090034L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('0');
|
||||
}
|
||||
|
@ -195,6 +207,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num1Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -6187220355403883499L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('1');
|
||||
}
|
||||
|
@ -202,6 +215,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num2Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -8745505977907325720L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('2');
|
||||
}
|
||||
|
@ -209,6 +223,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num3Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = 4694872385823448942L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('3');
|
||||
}
|
||||
|
@ -216,6 +231,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num4Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = 4005741329254221678L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('4');
|
||||
}
|
||||
|
@ -223,6 +239,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num5Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -5846094949106279884L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('5');
|
||||
}
|
||||
|
@ -230,6 +247,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num6Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = -5338656374925334150L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('6');
|
||||
}
|
||||
|
@ -237,6 +255,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num7Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = 1959983381590509303L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('7');
|
||||
}
|
||||
|
@ -244,6 +263,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num8Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = 7442763278699460648L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('8');
|
||||
}
|
||||
|
@ -251,6 +271,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action num9Action = new AbstractAction() {
|
||||
private static final long serialVersionUID = 7475171864584215094L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('9');
|
||||
}
|
||||
|
@ -258,6 +279,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action numPointAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -4729135055857591830L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('.');
|
||||
}
|
||||
|
@ -265,6 +287,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action copyAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -6978981449261938672L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
copySelection();
|
||||
}
|
||||
|
@ -272,6 +295,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action pasteAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = 2026817603236490899L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
paste();
|
||||
}
|
||||
|
@ -279,16 +303,18 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
Action multiplyAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -2350912575392447149L;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().multiply();
|
||||
}
|
||||
};
|
||||
Action numNegAction = new AbstractAction() {
|
||||
private static final long serialVersionUID = -6346750245035640773L;
|
||||
private static final long serialVersionUID = -6346750245035640773L;
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('-');
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getFrame().getToolBar().focusSetValue('-');
|
||||
}
|
||||
};
|
||||
|
||||
// set input mapping
|
||||
|
@ -458,10 +484,12 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -567,6 +595,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
return logParam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
/*String output = "\n ---- Table " + name + " ----" +
|
||||
scale +
|
||||
|
@ -918,6 +947,7 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
this.beforeRam = beforeRam;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addKeyListener(KeyListener listener) {
|
||||
super.addKeyListener(listener);
|
||||
for (DataCell cell : data) {
|
||||
|
@ -988,8 +1018,9 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
}
|
||||
|
||||
public void copyTable() {
|
||||
String newline = System.getProperty("line.separator");
|
||||
StringBuffer output = new StringBuffer("[Table1D]" + newline);
|
||||
String tableHeader = settings.getTableHeader();
|
||||
|
||||
StringBuffer output = new StringBuffer(tableHeader);
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
output.append(data[i].getText());
|
||||
if (i < getDataSize() - 1) {
|
||||
|
@ -1073,24 +1104,24 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
}
|
||||
|
||||
public void applyColorSettings(Settings settings) {
|
||||
if (this.getType() != TABLE_SWITCH) {
|
||||
this.setSettings(settings);
|
||||
|
||||
// apply settings to cells
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
this.setMaxColor(settings.getMaxColor());
|
||||
this.setMinColor(settings.getMinColor());
|
||||
data[i].setHighlightColor(settings.getHighlightColor());
|
||||
data[i].setIncreaseBorder(settings.getIncreaseBorder());
|
||||
data[i].setDecreaseBorder(settings.getDecreaseBorder());
|
||||
data[i].setFont(settings.getTableFont());
|
||||
data[i].repaint();
|
||||
}
|
||||
cellHeight = (int) settings.getCellSize().getHeight();
|
||||
cellWidth = (int) settings.getCellSize().getWidth();
|
||||
colorize();
|
||||
validateScaling();
|
||||
}
|
||||
if (this.getType() != TABLE_SWITCH) {
|
||||
this.setSettings(settings);
|
||||
|
||||
// apply settings to cells
|
||||
for (int i = 0; i < getDataSize(); i++) {
|
||||
this.setMaxColor(settings.getMaxColor());
|
||||
this.setMinColor(settings.getMinColor());
|
||||
data[i].setHighlightColor(settings.getHighlightColor());
|
||||
data[i].setIncreaseBorder(settings.getIncreaseBorder());
|
||||
data[i].setDecreaseBorder(settings.getDecreaseBorder());
|
||||
data[i].setFont(settings.getTableFont());
|
||||
data[i].repaint();
|
||||
}
|
||||
cellHeight = (int) settings.getCellSize().getHeight();
|
||||
cellWidth = (int) settings.getCellSize().getWidth();
|
||||
colorize();
|
||||
validateScaling();
|
||||
}
|
||||
}
|
||||
|
||||
public void resize() {
|
||||
|
@ -1143,11 +1174,12 @@ public abstract class Table extends JPanel implements Serializable {
|
|||
|
||||
check.addActionListener(
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
getSettings().setCalcConflictWarning(((JCheckBox) e.getSource()).isSelected());
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
JOptionPane.showMessageDialog(container.getContainer(), panel,
|
||||
"Warning", JOptionPane.ERROR_MESSAGE);
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
|
||||
package com.romraider.maps;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import com.romraider.util.AxisRange;
|
||||
import static com.romraider.util.ParamChecker.isNullOrEmpty;
|
||||
import static com.romraider.util.TableAxisUtil.getLiveDataRangeForAxis;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
@ -36,9 +33,14 @@ import java.awt.event.KeyListener;
|
|||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import com.romraider.util.AxisRange;
|
||||
|
||||
public class Table2D extends Table {
|
||||
private static final long serialVersionUID = -7684570967109324784L;
|
||||
private static final String NEW_LINE = System.getProperty("line.separator");
|
||||
private Table1D axis = new Table1D(new Settings());
|
||||
|
||||
public Table2D(Settings settings) {
|
||||
|
@ -54,21 +56,25 @@ public class Table2D extends Table {
|
|||
this.axis = axis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " (2D)";// + axis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void colorize() {
|
||||
super.colorize();
|
||||
axis.colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFrame(TableFrame frame) {
|
||||
this.frame = frame;
|
||||
axis.setFrame(frame);
|
||||
frame.setSize(getFrameSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getFrameSize() {
|
||||
int height = verticalOverhead + cellHeight * 2;
|
||||
int width = horizontalOverhead + data.length * cellWidth;
|
||||
|
@ -82,12 +88,14 @@ public class Table2D extends Table {
|
|||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyColorSettings(Settings settings) {
|
||||
this.setAxisColor(settings.getAxisColor());
|
||||
axis.applyColorSettings(settings);
|
||||
super.applyColorSettings(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateTable(byte[] input) throws ArrayIndexOutOfBoundsException {
|
||||
centerLayout.setRows(2);
|
||||
centerLayout.setColumns(this.getDataSize());
|
||||
|
@ -127,16 +135,19 @@ public class Table2D extends Table {
|
|||
//this.colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void increment(double increment) {
|
||||
super.increment(increment);
|
||||
axis.increment(increment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiply(double factor) {
|
||||
super.multiply(factor);
|
||||
axis.multiply(factor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSelection() {
|
||||
axis.clearSelection(true);
|
||||
for (DataCell aData : data) {
|
||||
|
@ -144,32 +155,38 @@ public class Table2D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRevertPoint() {
|
||||
super.setRevertPoint();
|
||||
axis.setRevertPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoAll() {
|
||||
super.undoAll();
|
||||
axis.undoAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoSelected() {
|
||||
super.undoSelected();
|
||||
axis.undoSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] saveFile(byte[] binData) {
|
||||
binData = super.saveFile(binData);
|
||||
binData = axis.saveFile(binData);
|
||||
return binData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRealValue(String realValue) {
|
||||
axis.setRealValue(realValue);
|
||||
super.setRealValue(realValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addKeyListener(KeyListener listener) {
|
||||
super.addKeyListener(listener);
|
||||
axis.addKeyListener(listener);
|
||||
|
@ -179,16 +196,19 @@ public class Table2D extends Table {
|
|||
selectCellAt(y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorUp() {
|
||||
if (!axis.isStatic() && data[highlightY].isSelected()) {
|
||||
axis.selectCellAt(highlightY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorDown() {
|
||||
axis.cursorDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorLeft() {
|
||||
if (highlightY > 0 && data[highlightY].isSelected()) {
|
||||
selectCellAt(highlightY - 1);
|
||||
|
@ -197,6 +217,7 @@ public class Table2D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorRight() {
|
||||
if (highlightY < data.length - 1 && data[highlightY].isSelected()) {
|
||||
selectCellAt(highlightY + 1);
|
||||
|
@ -205,25 +226,31 @@ public class Table2D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startHighlight(int x, int y) {
|
||||
axis.clearSelection();
|
||||
super.startHighlight(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copySelection() {
|
||||
super.copySelection();
|
||||
axis.copySelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTable() {
|
||||
String tableHeader = settings.getTable2DHeader();
|
||||
|
||||
// create string
|
||||
StringBuffer output = new StringBuffer("[Table2D]" + NEW_LINE);
|
||||
StringBuffer output = new StringBuffer(tableHeader);
|
||||
output.append(axis.getTableAsString()).append(NEW_LINE);
|
||||
output.append(super.getTableAsString());
|
||||
//copy to clipboard
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(output.toString()), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paste() {
|
||||
StringTokenizer st = new StringTokenizer("");
|
||||
String input = "";
|
||||
|
@ -259,6 +286,7 @@ public class Table2D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteCompare() {
|
||||
StringTokenizer st = new StringTokenizer("");
|
||||
String input = "";
|
||||
|
@ -287,29 +315,35 @@ public class Table2D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAxisColor(Color axisColor) {
|
||||
axis.setAxisColor(axisColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateScaling() {
|
||||
super.validateScaling();
|
||||
axis.validateScaling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleIndex(int scaleIndex) {
|
||||
super.setScaleIndex(scaleIndex);
|
||||
axis.setScaleByName(getScale().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLiveDataSupported() {
|
||||
return !isNullOrEmpty(axis.getLogParam());
|
||||
}
|
||||
|
||||
public boolean isButtonSelected() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isButtonSelected() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void highlightLiveData() {
|
||||
@Override
|
||||
protected void highlightLiveData() {
|
||||
if (overlayLog && frame.isVisible()) {
|
||||
AxisRange range = getLiveDataRangeForAxis(axis);
|
||||
clearSelection();
|
||||
|
@ -336,6 +370,7 @@ public class Table2D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLiveDataTrace() {
|
||||
for (DataCell cell : data) {
|
||||
cell.setLiveDataTrace(false);
|
||||
|
|
|
@ -19,17 +19,11 @@
|
|||
|
||||
package com.romraider.maps;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import com.romraider.util.AxisRange;
|
||||
import static com.romraider.util.ColorScaler.getScaledColor;
|
||||
import static com.romraider.util.ParamChecker.isNullOrEmpty;
|
||||
import static com.romraider.util.TableAxisUtil.getLiveDataRangeForAxis;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
import static javax.swing.BorderFactory.createLineBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
|
@ -42,6 +36,15 @@ import java.awt.event.KeyListener;
|
|||
import java.io.IOException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI;
|
||||
import com.romraider.swing.TableFrame;
|
||||
import com.romraider.util.AxisRange;
|
||||
import com.romraider.xml.RomAttributeParser;
|
||||
|
||||
public class Table3D extends Table {
|
||||
|
||||
private static final long serialVersionUID = 3103448753263606599L;
|
||||
|
@ -116,6 +119,7 @@ public class Table3D extends Table {
|
|||
return data[0].length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateTable(byte[] input) throws NullPointerException, ArrayIndexOutOfBoundsException {
|
||||
// fill first empty cell
|
||||
centerPanel.add(new JLabel());
|
||||
|
@ -211,27 +215,29 @@ public class Table3D extends Table {
|
|||
|
||||
add(new JLabel(getScale().getUnit(), JLabel.CENTER), BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public StringBuffer getTableAsString() {
|
||||
// Make a string of the table
|
||||
StringBuffer output = new StringBuffer(BLANK);
|
||||
output.append(xAxis.getTableAsString()).append(NEW_LINE);
|
||||
|
||||
for (int y = 0; y < getSizeY(); y++) {
|
||||
output.append(yAxis.getCellAsString(y)).append(TAB);
|
||||
for (int x = 0; x < getSizeX(); x++) {
|
||||
output.append(data[x][y].getText());
|
||||
if (x < getSizeX() - 1) {
|
||||
output.append(TAB);
|
||||
}
|
||||
}
|
||||
if (y < getSizeY() - 1) {
|
||||
output.append(NEW_LINE);
|
||||
}
|
||||
}
|
||||
StringBuffer output = new StringBuffer(BLANK);
|
||||
output.append(xAxis.getTableAsString()).append(NEW_LINE);
|
||||
|
||||
for (int y = 0; y < getSizeY(); y++) {
|
||||
output.append(yAxis.getCellAsString(y)).append(TAB);
|
||||
for (int x = 0; x < getSizeX(); x++) {
|
||||
output.append(data[x][y].getText());
|
||||
if (x < getSizeX() - 1) {
|
||||
output.append(TAB);
|
||||
}
|
||||
}
|
||||
if (y < getSizeY() - 1) {
|
||||
output.append(NEW_LINE);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void colorize() {
|
||||
if (compareType == COMPARE_OFF) {
|
||||
if (!isStatic && !isAxis) {
|
||||
|
@ -349,6 +355,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compare(int compareType) {
|
||||
this.compareType = compareType;
|
||||
|
||||
|
@ -365,6 +372,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFrame(TableFrame frame) {
|
||||
this.frame = frame;
|
||||
xAxis.setFrame(frame);
|
||||
|
@ -373,6 +381,7 @@ public class Table3D extends Table {
|
|||
frame.pack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getFrameSize() {
|
||||
int height = verticalOverhead + cellHeight * data[0].length;
|
||||
int width = horizontalOverhead + data.length * cellWidth;
|
||||
|
@ -386,6 +395,7 @@ public class Table3D extends Table {
|
|||
return new Dimension(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " (3D)";/* +
|
||||
"\n Flip X: " + flipX +
|
||||
|
@ -397,6 +407,7 @@ public class Table3D extends Table {
|
|||
yAxis;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void increment(double increment) {
|
||||
if (!isStatic && !locked) {
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -412,6 +423,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiply(double factor) {
|
||||
if (!isStatic && !locked) {
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -427,6 +439,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSelection() {
|
||||
xAxis.clearSelection(true);
|
||||
yAxis.clearSelection(true);
|
||||
|
@ -437,6 +450,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void highlight(int xCoord, int yCoord) {
|
||||
if (highlight) {
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -454,6 +468,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopHighlight() {
|
||||
highlight = false;
|
||||
// loop through, selected and un-highlight
|
||||
|
@ -467,6 +482,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRevertPoint() {
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
for (int y = 0; y < this.getSizeY(); y++) {
|
||||
|
@ -478,6 +494,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoAll() {
|
||||
clearLiveDataTrace();
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -490,6 +507,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoSelected() {
|
||||
clearLiveDataTrace();
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -505,6 +523,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] saveFile(byte[] binData) {
|
||||
if (!isStatic // save if table is not static
|
||||
&& // and user level is great enough
|
||||
|
@ -553,6 +572,7 @@ public class Table3D extends Table {
|
|||
return binData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRealValue(String realValue) {
|
||||
if (!isStatic && !locked) {
|
||||
for (int x = 0; x < this.getSizeX(); x++) {
|
||||
|
@ -568,6 +588,7 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addKeyListener(KeyListener listener) {
|
||||
xAxis.addKeyListener(listener);
|
||||
yAxis.addKeyListener(listener);
|
||||
|
@ -606,6 +627,7 @@ public class Table3D extends Table {
|
|||
highlightY = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorUp() {
|
||||
if (highlightY > 0 && data[highlightX][highlightY].isSelected()) {
|
||||
selectCellAt(highlightX, highlightY - 1);
|
||||
|
@ -617,6 +639,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorDown() {
|
||||
if (highlightY < getSizeY() - 1 && data[highlightX][highlightY].isSelected()) {
|
||||
selectCellAt(highlightX, highlightY + 1);
|
||||
|
@ -626,6 +649,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorLeft() {
|
||||
if (highlightX > 0 && data[highlightX][highlightY].isSelected()) {
|
||||
selectCellAt(highlightX - 1, highlightY);
|
||||
|
@ -637,6 +661,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cursorRight() {
|
||||
if (highlightX < getSizeX() - 1 && data[highlightX][highlightY].isSelected()) {
|
||||
selectCellAt(highlightX + 1, highlightY);
|
||||
|
@ -646,12 +671,14 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startHighlight(int x, int y) {
|
||||
xAxis.clearSelection();
|
||||
yAxis.clearSelection();
|
||||
super.startHighlight(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copySelection() {
|
||||
// find bounds of selection
|
||||
// coords[0] = x min, y min, x max, y max
|
||||
|
@ -709,11 +736,13 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyTable() {
|
||||
// create string
|
||||
String newline = System.getProperty("line.separator");
|
||||
StringBuffer output = new StringBuffer("[Table3D]" + newline);
|
||||
output.append(xAxis.getTableAsString()).append(newline);
|
||||
String tableHeader = settings.getTable3DHeader();
|
||||
|
||||
StringBuffer output = new StringBuffer(tableHeader);
|
||||
output.append(xAxis.getTableAsString()).append(NEW_LINE);
|
||||
|
||||
for (int y = 0; y < getSizeY(); y++) {
|
||||
output.append(yAxis.getCellAsString(y)).append(TAB);
|
||||
|
@ -731,6 +760,7 @@ public class Table3D extends Table {
|
|||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(String.valueOf(output)), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paste() {
|
||||
StringTokenizer st = new StringTokenizer("");
|
||||
String input = "";
|
||||
|
@ -777,6 +807,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteCompare() {
|
||||
StringTokenizer st = new StringTokenizer("");
|
||||
String input = "";
|
||||
|
@ -883,6 +914,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyColorSettings(Settings settings) {
|
||||
// apply settings to cells
|
||||
this.settings = settings;
|
||||
|
@ -911,17 +943,20 @@ public class Table3D extends Table {
|
|||
colorize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAxisColor(Color axisColor) {
|
||||
xAxis.setAxisColor(axisColor);
|
||||
yAxis.setAxisColor(axisColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateScaling() {
|
||||
super.validateScaling();
|
||||
xAxis.validateScaling();
|
||||
yAxis.validateScaling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshValues() {
|
||||
if (!isStatic && !isAxis) {
|
||||
for (DataCell[] column : data) {
|
||||
|
@ -932,15 +967,18 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLiveDataSupported() {
|
||||
return !isNullOrEmpty(xAxis.getLogParam()) && !isNullOrEmpty(yAxis.getLogParam());
|
||||
}
|
||||
|
||||
public boolean isButtonSelected() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isButtonSelected() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void highlightLiveData() {
|
||||
@Override
|
||||
protected void highlightLiveData() {
|
||||
if (overlayLog && frame.isVisible()) {
|
||||
AxisRange rangeX = getLiveDataRangeForAxis(xAxis);
|
||||
AxisRange rangeY = getLiveDataRangeForAxis(yAxis);
|
||||
|
@ -964,6 +1002,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLiveDataTrace() {
|
||||
for (int x = 0; x < getSizeX(); x++) {
|
||||
for (int y = 0; y < getSizeY(); y++) {
|
||||
|
@ -973,6 +1012,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleIndex(int scaleIndex) {
|
||||
super.setScaleIndex(scaleIndex);
|
||||
xAxis.setScaleByName(getScale().getName());
|
||||
|
@ -983,6 +1023,7 @@ public class Table3D extends Table {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMin() {
|
||||
if (getScale().getMin() == 0 && getScale().getMax() == 0) {
|
||||
double low = Double.MAX_VALUE;
|
||||
|
@ -1002,6 +1043,7 @@ public class Table3D extends Table {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMax() {
|
||||
if (getScale().getMin() == 0 && getScale().getMax() == 0) {
|
||||
double high = Double.MIN_VALUE;
|
||||
|
|
|
@ -19,14 +19,9 @@
|
|||
|
||||
package com.romraider.swing;
|
||||
|
||||
import ZoeloeSoft.projects.JFontChooser.JFontChooser;
|
||||
import com.romraider.Settings;
|
||||
import static com.romraider.Version.PRODUCT_NAME;
|
||||
import com.romraider.editor.ecu.ECUEditor;
|
||||
import com.romraider.util.FileAssociator;
|
||||
import static java.io.File.separator;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
@ -34,6 +29,20 @@ import java.awt.event.MouseListener;
|
|||
import java.io.File;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.JColorChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
|
||||
import ZoeloeSoft.projects.JFontChooser.JFontChooser;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.editor.ecu.ECUEditor;
|
||||
import com.romraider.util.FileAssociator;
|
||||
|
||||
public class SettingsForm extends JFrame implements MouseListener {
|
||||
|
||||
private static final long serialVersionUID = 3910602424260147767L;
|
||||
|
@ -104,6 +113,14 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
|
||||
valueLimitWarning.setSelected(settings.isValueLimitWarning());
|
||||
warningColor.setBackground(settings.getWarningColor());
|
||||
|
||||
if(settings.getTableClipboardFormat().equalsIgnoreCase(Settings.AIRBOYS_CLIPBOARD_FORMAT)) {
|
||||
this.rdbtnAirboys.setSelected(true);
|
||||
} else if(settings.getTableClipboardFormat().equalsIgnoreCase(Settings.CUSTOM_CLIPBOARD_FORMAT)) {
|
||||
this.rdbtnCustom.setSelected(true);
|
||||
} else {
|
||||
this.rdbtnDefault.setSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
|
||||
|
@ -115,7 +132,10 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
btnOk = new javax.swing.JButton();
|
||||
btnApply = new javax.swing.JButton();
|
||||
reset = new javax.swing.JButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
settingsTabbedPane = new javax.swing.JTabbedPane();
|
||||
jPanelClipboard = new javax.swing.JPanel();
|
||||
jPanelDefault = new javax.swing.JPanel();
|
||||
jPanelTableDisplay = new javax.swing.JPanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
lblAxis = new javax.swing.JLabel();
|
||||
lblHighlight = new javax.swing.JLabel();
|
||||
|
@ -149,6 +169,14 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
jLabel1 = new javax.swing.JLabel();
|
||||
tableClickCount = new javax.swing.JComboBox();
|
||||
|
||||
clipboardButtonGroup = new ButtonGroup();
|
||||
rdbtnDefault = new JRadioButton("RomRaider Default");
|
||||
rdbtnAirboys = new JRadioButton("Airboys Spreadsheet");
|
||||
rdbtnCustom = new JRadioButton("Custom (manually specify formats in settings.xml)");
|
||||
clipboardButtonGroup.add(this.rdbtnDefault);
|
||||
clipboardButtonGroup.add(this.rdbtnAirboys);
|
||||
clipboardButtonGroup.add(this.rdbtnCustom);
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle(PRODUCT_NAME + " Settings");
|
||||
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
|
@ -177,7 +205,6 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
|
||||
reset.setText("Restore Defaults");
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Table Display"));
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Background"));
|
||||
lblAxis.setText("Axis Cell:");
|
||||
|
||||
|
@ -213,50 +240,50 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
|
||||
.add(lblWarning)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(4, 4, 4)
|
||||
.add(lblMin))
|
||||
.add(lblMax)))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(maxColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE)
|
||||
.add(lblHighlight)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(highlightColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(minColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 55, Short.MAX_VALUE)
|
||||
.add(lblAxis)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(axisColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(warningColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(4, 4, 4)
|
||||
.add(lblMin))
|
||||
.add(lblMax)))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(maxColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 22, Short.MAX_VALUE)
|
||||
.add(lblHighlight)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(highlightColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(minColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 55, Short.MAX_VALUE)
|
||||
.add(lblAxis)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(axisColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(warningColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(jPanel2Layout.createSequentialGroup()
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblMax)
|
||||
.add(maxColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(highlightColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblHighlight))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblMin)
|
||||
.add(minColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(axisColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblAxis))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(warningColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblWarning)))
|
||||
);
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblMin)
|
||||
.add(minColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(axisColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblAxis))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(warningColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblWarning)))
|
||||
);
|
||||
|
||||
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Cell Borders"));
|
||||
lblIncrease.setText("Increased:");
|
||||
|
@ -275,7 +302,7 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(lblIncrease)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
|
@ -285,15 +312,15 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(decreaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(decreaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblDecrease)
|
||||
.add(lblIncrease)
|
||||
.add(increaseColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
);
|
||||
|
||||
lblCellHeight.setText("Cell Height:");
|
||||
|
||||
|
@ -332,139 +359,205 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(extensionBin)
|
||||
.add(extensionHex))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 93, Short.MAX_VALUE)
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
|
||||
.add(btnAddAssocs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(btnRemoveAssocs))
|
||||
.add(25, 25, 25))
|
||||
);
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 93, Short.MAX_VALUE)
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
|
||||
.add(btnAddAssocs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(btnRemoveAssocs))
|
||||
.add(25, 25, 25))
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel4Layout.createSequentialGroup()
|
||||
.add(jPanel4Layout.createSequentialGroup()
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(btnAddAssocs)
|
||||
.add(extensionHex))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(btnRemoveAssocs)
|
||||
.add(extensionBin)))
|
||||
);
|
||||
|
||||
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(saveDebugTables)
|
||||
.add(displayHighTables)
|
||||
.add(valueLimitWarning))
|
||||
.add(jPanel1Layout.createSequentialGroup()
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(lblCellHeight)
|
||||
.add(lblFont))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(btnChooseFont)
|
||||
.add(jPanel1Layout.createSequentialGroup()
|
||||
.add(cellHeight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 42, Short.MAX_VALUE)
|
||||
.add(lblCellWidth)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(cellWidth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
|
||||
.add(47, 47, 47))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(jPanel1Layout.createSequentialGroup()
|
||||
.add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(22, 22, 22)
|
||||
.add(saveDebugTables)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(displayHighTables)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(valueLimitWarning)
|
||||
.add(27, 27, 27)
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblCellWidth)
|
||||
.add(cellWidth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(lblCellHeight)
|
||||
.add(cellHeight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lblFont)
|
||||
.add(btnChooseFont, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
|
||||
);
|
||||
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(btnRemoveAssocs)
|
||||
.add(extensionBin)))
|
||||
);
|
||||
|
||||
jLabel1.setText("click to open tables");
|
||||
|
||||
tableClickCount.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Single", "Double"}));
|
||||
|
||||
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
initTabs();
|
||||
|
||||
settingsTabbedPane.addTab("General", jPanelDefault);
|
||||
settingsTabbedPane.addTab("Table Display", jPanelTableDisplay);
|
||||
settingsTabbedPane.addTab("Clipboard", jPanelClipboard);
|
||||
|
||||
// Content Pane Layout
|
||||
GroupLayout layout = new GroupLayout(getContentPane());
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, calcConflictWarning)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, obsoleteWarning)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
|
||||
.add(tableClickCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(jLabel1))
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, debug)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
|
||||
.add(reset)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 34, Short.MAX_VALUE)
|
||||
.add(btnApply)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(btnOk)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(btnCancel)))
|
||||
.addContainerGap())
|
||||
);
|
||||
.addGroup(layout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(settingsTabbedPane, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 432, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(reset)
|
||||
.addPreferredGap(ComponentPlacement.RELATED, 136, Short.MAX_VALUE)
|
||||
.addComponent(btnApply)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnOk)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(layout.createSequentialGroup()
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(jLabel1)
|
||||
.add(tableClickCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 18, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(obsoleteWarning)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(calcConflictWarning)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
||||
.add(debug)
|
||||
.add(17, 17, 17)
|
||||
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(22, 22, 22)
|
||||
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(btnCancel)
|
||||
.add(btnApply)
|
||||
.add(reset)
|
||||
.add(btnOk))
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
.addComponent(settingsTabbedPane, GroupLayout.PREFERRED_SIZE, 542, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(btnCancel)
|
||||
.addComponent(btnOk)
|
||||
.addComponent(btnApply)
|
||||
.addComponent(reset))
|
||||
.addContainerGap())
|
||||
);
|
||||
getContentPane().setLayout(layout);
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void initTabs() {
|
||||
// Init Default Tab Panel
|
||||
GroupLayout jPanelDefaultLayout = new GroupLayout(jPanelDefault);
|
||||
jPanelDefaultLayout.setVerticalGroup(
|
||||
jPanelDefaultLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelDefaultLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(tableClickCount, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(obsoleteWarning)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(calcConflictWarning)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(debug)
|
||||
.addGap(17)
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanelDefaultLayout.setHorizontalGroup(
|
||||
jPanelDefaultLayout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(Alignment.LEADING, jPanelDefaultLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelDefaultLayout.createSequentialGroup()
|
||||
.addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(calcConflictWarning)
|
||||
.addComponent(obsoleteWarning)
|
||||
.addGroup(jPanelDefaultLayout.createSequentialGroup()
|
||||
.addComponent(tableClickCount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1))
|
||||
.addComponent(debug))
|
||||
.addContainerGap(45, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanelDefault.setLayout(jPanelDefaultLayout);
|
||||
|
||||
// Init Table Display Tab
|
||||
GroupLayout jPanelTableDisplayLayout = new GroupLayout(jPanelTableDisplay);
|
||||
jPanelTableDisplayLayout.setHorizontalGroup(
|
||||
jPanelTableDisplayLayout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(saveDebugTables)
|
||||
.addComponent(displayHighTables)
|
||||
.addComponent(valueLimitWarning))
|
||||
.addGroup(jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(lblCellHeight)
|
||||
.addComponent(lblFont))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btnChooseFont)
|
||||
.addGroup(jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addComponent(cellHeight, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED, 139, Short.MAX_VALUE)
|
||||
.addComponent(lblCellWidth)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(cellWidth, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGap(47))
|
||||
.addGroup(Alignment.LEADING, jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addComponent(jPanel4, GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(Alignment.LEADING, jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addComponent(jPanel3, GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addComponent(jPanel2, GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE)
|
||||
);
|
||||
jPanelTableDisplayLayout.setVerticalGroup(
|
||||
jPanelTableDisplayLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelTableDisplayLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel2, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(saveDebugTables)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(displayHighTables)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(valueLimitWarning)
|
||||
.addGap(27)
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lblCellWidth)
|
||||
.addComponent(cellWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblCellHeight)
|
||||
.addComponent(cellHeight, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(jPanelTableDisplayLayout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(lblFont)
|
||||
.addComponent(btnChooseFont, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanelTableDisplay.setLayout(jPanelTableDisplayLayout);
|
||||
|
||||
// Init Clipboard Tab Panel
|
||||
GroupLayout jPanelClipboardLayout = new GroupLayout(jPanelClipboard);
|
||||
jPanelClipboardLayout.setHorizontalGroup(
|
||||
jPanelClipboardLayout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(jPanelClipboardLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanelClipboardLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelClipboardLayout.createSequentialGroup()
|
||||
.addGap(17)
|
||||
.addGroup(jPanelClipboardLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(rdbtnAirboys)
|
||||
.addComponent(rdbtnDefault)
|
||||
.addComponent(rdbtnCustom))))
|
||||
.addGap(157))
|
||||
);
|
||||
jPanelClipboardLayout.setVerticalGroup(
|
||||
jPanelClipboardLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelClipboardLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(rdbtnDefault)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(rdbtnAirboys)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(rdbtnCustom)
|
||||
.addGap(435))
|
||||
);
|
||||
jPanelClipboard.setLayout(jPanelClipboardLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getSource() == maxColor) {
|
||||
Color color = JColorChooser.showDialog(this.getContentPane(),
|
||||
|
@ -511,7 +604,10 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
} else if (e.getSource() == btnApply) {
|
||||
applySettings();
|
||||
} else if (e.getSource() == btnOk) {
|
||||
// Apply settings to Settings object.
|
||||
applySettings();
|
||||
// Write settings to file.
|
||||
saveSettings();
|
||||
this.dispose();
|
||||
} else if (e.getSource() == btnCancel) {
|
||||
this.dispose();
|
||||
|
@ -592,18 +688,35 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
settings.setValueLimitWarning(valueLimitWarning.isSelected());
|
||||
settings.setWarningColor(warningColor.getBackground());
|
||||
|
||||
parent.setSettings(settings);
|
||||
if(rdbtnAirboys.isSelected())
|
||||
{
|
||||
settings.setAirboysFormat();
|
||||
} else if(rdbtnCustom.isSelected()) {
|
||||
settings.setTableClipboardFormat(Settings.CUSTOM_CLIPBOARD_FORMAT);
|
||||
// Table Header settings need to be manually edited in the settings.xml file;
|
||||
} else {
|
||||
settings.setDefaultFormat();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveSettings()
|
||||
{
|
||||
parent.getSettingsManager().save(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
|
@ -626,7 +739,10 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
private javax.swing.JLabel highlightColor;
|
||||
private javax.swing.JLabel increaseColor;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JTabbedPane settingsTabbedPane;
|
||||
private javax.swing.JPanel jPanelDefault;
|
||||
private javax.swing.JPanel jPanelClipboard;
|
||||
private javax.swing.JPanel jPanelTableDisplay;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
|
@ -648,6 +764,8 @@ public class SettingsForm extends JFrame implements MouseListener {
|
|||
private javax.swing.JComboBox tableClickCount;
|
||||
private javax.swing.JCheckBox valueLimitWarning;
|
||||
private javax.swing.JLabel warningColor;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private ButtonGroup clipboardButtonGroup;
|
||||
private javax.swing.JRadioButton rdbtnDefault;
|
||||
private javax.swing.JRadioButton rdbtnAirboys;
|
||||
private javax.swing.JRadioButton rdbtnCustom;
|
||||
}
|
|
@ -19,24 +19,28 @@
|
|||
|
||||
package com.romraider.util;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import static com.romraider.Version.VERSION;
|
||||
import com.romraider.swing.JProgressPane;
|
||||
import com.romraider.xml.DOMSettingsBuilder;
|
||||
import com.romraider.xml.DOMSettingsUnmarshaller;
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.showMessageDialog;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.JProgressPane;
|
||||
import com.romraider.xml.DOMSettingsBuilder;
|
||||
import com.romraider.xml.DOMSettingsUnmarshaller;
|
||||
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
|
||||
|
||||
public final class SettingsManagerImpl implements SettingsManager {
|
||||
private static final String SETTINGS_FILE = "/.RomRaider/settings.xml";
|
||||
private static final String HOME = System.getProperty("user.home");
|
||||
private static final String HOME = System.getProperty("user.home");
|
||||
|
||||
@Override
|
||||
public Settings load() {
|
||||
try {
|
||||
InputSource src = new InputSource(new FileInputStream(new File(HOME + SETTINGS_FILE)));
|
||||
|
@ -54,17 +58,19 @@ public final class SettingsManagerImpl implements SettingsManager {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Settings settings) {
|
||||
save(settings, new JProgressPane());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Settings settings, JProgressPane progress) {
|
||||
DOMSettingsBuilder builder = new DOMSettingsBuilder();
|
||||
try {
|
||||
new File(HOME + "/.RomRaider/").mkdir(); // Creates directory if it does not exist
|
||||
builder.buildSettings(settings, new File(HOME + SETTINGS_FILE), progress, VERSION);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,17 +19,19 @@
|
|||
|
||||
package com.romraider.xml;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.JProgressPane;
|
||||
import com.sun.org.apache.xml.internal.serialize.OutputFormat;
|
||||
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
|
||||
import javax.imageio.metadata.IIOMetadataNode;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.imageio.metadata.IIOMetadataNode;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import com.romraider.swing.JProgressPane;
|
||||
import com.sun.org.apache.xml.internal.serialize.OutputFormat;
|
||||
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
|
||||
|
||||
public final class DOMSettingsBuilder {
|
||||
|
||||
public void buildSettings(Settings settings, File output, JProgressPane progress, String versionNumber) throws IOException {
|
||||
|
@ -47,6 +49,8 @@ public final class DOMSettingsBuilder {
|
|||
settingsNode.appendChild(buildTableDisplay(settings));
|
||||
progress.update("Saving logger settings...", 75);
|
||||
settingsNode.appendChild(buildLogger(settings));
|
||||
progress.update("Saving table clipboard format settings...", 80);
|
||||
settingsNode.appendChild(buildTableClipboardFormat(settings));
|
||||
|
||||
OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true);
|
||||
of.setIndent(1);
|
||||
|
@ -99,7 +103,7 @@ public final class DOMSettingsBuilder {
|
|||
IIOMetadataNode imageDir = new IIOMetadataNode("image_dir");
|
||||
imageDir.setAttribute("path", settings.getLastImageDir().getAbsolutePath());
|
||||
files.appendChild(imageDir);
|
||||
|
||||
|
||||
// repository directory
|
||||
IIOMetadataNode repositoryDir = new IIOMetadataNode(Settings.REPOSITORY_ELEMENT_NAME);
|
||||
repositoryDir.setAttribute(Settings.REPOSITORY_ATTRIBUTE_NAME, settings.getLastRepositoryDir().getAbsolutePath());
|
||||
|
@ -313,4 +317,31 @@ public final class DOMSettingsBuilder {
|
|||
|
||||
return loggerSettings;
|
||||
}
|
||||
|
||||
private IIOMetadataNode buildTableClipboardFormat(Settings settings) {
|
||||
// Head Node
|
||||
IIOMetadataNode tableClipboardFormatSetting = new IIOMetadataNode(Settings.TABLE_CLIPBOARD_FORMAT_ELEMENT);
|
||||
tableClipboardFormatSetting.setAttribute(Settings.TABLE_CLIPBOARD_FORMAT_ATTRIBUTE, settings.getTableClipboardFormat());
|
||||
|
||||
// Table Child
|
||||
IIOMetadataNode tableFormatSetting = new IIOMetadataNode(Settings.TABLE_ELEMENT);
|
||||
// Table1D Child
|
||||
IIOMetadataNode table1DFormatSetting = new IIOMetadataNode(Settings.TABLE1D_ELEMENT);
|
||||
// Table2D Child
|
||||
IIOMetadataNode table2DFormatSetting = new IIOMetadataNode(Settings.TABLE2D_ELEMENT);
|
||||
// Table3D Child
|
||||
IIOMetadataNode table3DFormatSetting = new IIOMetadataNode(Settings.TABLE3D_ELEMENT);
|
||||
|
||||
tableFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTableHeader());
|
||||
table1DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable1DHeader());
|
||||
table2DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable2DHeader());
|
||||
table3DFormatSetting.setAttribute(Settings.TABLE_HEADER_ATTRIBUTE, settings.getTable3DHeader());
|
||||
|
||||
tableClipboardFormatSetting.appendChild(tableFormatSetting);
|
||||
tableClipboardFormatSetting.appendChild(table1DFormatSetting);
|
||||
tableClipboardFormatSetting.appendChild(table2DFormatSetting);
|
||||
tableClipboardFormatSetting.appendChild(table3DFormatSetting);
|
||||
|
||||
return tableClipboardFormatSetting;
|
||||
}
|
||||
}
|
|
@ -19,12 +19,10 @@
|
|||
|
||||
package com.romraider.xml;
|
||||
|
||||
import com.romraider.Settings;
|
||||
import static com.romraider.xml.DOMHelper.unmarshallAttribute;
|
||||
import static java.awt.Font.BOLD;
|
||||
import org.w3c.dom.Node;
|
||||
import static org.w3c.dom.Node.ELEMENT_NODE;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
@ -33,6 +31,11 @@ import java.io.File;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.romraider.Settings;
|
||||
|
||||
public final class DOMSettingsUnmarshaller {
|
||||
|
||||
public Settings unmarshallSettings(Node rootNode) {
|
||||
|
@ -58,6 +61,8 @@ public final class DOMSettingsUnmarshaller {
|
|||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("logger")) {
|
||||
settings = unmarshallLogger(n, settings);
|
||||
|
||||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase(Settings.TABLE_CLIPBOARD_FORMAT_ELEMENT)) {
|
||||
settings = this.unmarshallClipboardFormat(n, settings);
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
|
@ -105,8 +110,8 @@ public final class DOMSettingsUnmarshaller {
|
|||
settings.setLastImageDir(new File(unmarshallAttribute(n, "path", "ecu_defs.xml")));
|
||||
|
||||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase(Settings.REPOSITORY_ELEMENT_NAME)) {
|
||||
settings.setLastRepositoryDir(new File(unmarshallAttribute(n, Settings.REPOSITORY_ATTRIBUTE_NAME, "repositories")));
|
||||
|
||||
settings.setLastRepositoryDir(new File(unmarshallAttribute(n, Settings.REPOSITORY_ATTRIBUTE_NAME, "repositories")));
|
||||
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
|
@ -231,7 +236,7 @@ public final class DOMSettingsUnmarshaller {
|
|||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("size")) {
|
||||
settings.setLoggerWindowSize(new Dimension(unmarshallAttribute(n, "y", 600),
|
||||
unmarshallAttribute(n, "x", 1000)));
|
||||
settings.setLoggerDividerLocation((double) unmarshallAttribute(n, "divider", 500));
|
||||
settings.setLoggerDividerLocation(unmarshallAttribute(n, "divider", 500));
|
||||
|
||||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("location")) {
|
||||
settings.setLoggerWindowLocation(new Point(unmarshallAttribute(n, "x", 150),
|
||||
|
@ -254,7 +259,7 @@ public final class DOMSettingsUnmarshaller {
|
|||
settings.setFileLoggingAbsoluteTimestamp(unmarshallAttribute(n, "absolutetimestamp", false));
|
||||
|
||||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("debug")) {
|
||||
settings.setLoggerDebuggingLevel(unmarshallAttribute(n, "level", "info"));
|
||||
settings.setLoggerDebuggingLevel(unmarshallAttribute(n, "level", "info"));
|
||||
|
||||
} else if (n.getNodeType() == ELEMENT_NODE && n.getNodeName().equalsIgnoreCase("plugins")) {
|
||||
Map<String, String> pluginPorts = new HashMap<String, String>();
|
||||
|
@ -281,4 +286,34 @@ public final class DOMSettingsUnmarshaller {
|
|||
unmarshallAttribute(colorNode, "b", 155));
|
||||
}
|
||||
|
||||
private Settings unmarshallClipboardFormat(Node formatNode, Settings settings) {
|
||||
String tableClipboardFormat = unmarshallAttribute(formatNode, Settings.TABLE_CLIPBOARD_FORMAT_ATTRIBUTE, Settings.DEFAULT_CLIPBOARD_FORMAT);
|
||||
if(tableClipboardFormat.equalsIgnoreCase(Settings.CUSTOM_CLIPBOARD_FORMAT)) {
|
||||
settings.setTableClipboardFormat(Settings.CUSTOM_CLIPBOARD_FORMAT);
|
||||
} else if (tableClipboardFormat.equalsIgnoreCase(Settings.AIRBOYS_CLIPBOARD_FORMAT)) {
|
||||
settings.setAirboysFormat();
|
||||
return settings;
|
||||
} else {
|
||||
settings.setDefaultFormat();
|
||||
return settings;
|
||||
}
|
||||
|
||||
NodeList tableFormats = formatNode.getChildNodes();
|
||||
for( int i = 0; i < tableFormats.getLength(); i++) {
|
||||
Node tableNode = tableFormats.item(i);
|
||||
if(tableNode.getNodeType() == ELEMENT_NODE) {
|
||||
if(tableNode.getNodeName().equalsIgnoreCase(Settings.TABLE_ELEMENT)) {
|
||||
settings.setTableHeader(unmarshallAttribute(tableNode, Settings.TABLE_HEADER_ATTRIBUTE, Settings.DEFAULT_TABLE_HEADER));
|
||||
} else if(tableNode.getNodeName().equalsIgnoreCase(Settings.TABLE1D_ELEMENT)) {
|
||||
settings.setTable1DHeader(unmarshallAttribute(tableNode, Settings.TABLE_HEADER_ATTRIBUTE, Settings.DEFAULT_TABLE1D_HEADER));
|
||||
} else if(tableNode.getNodeName().equalsIgnoreCase(Settings.TABLE2D_ELEMENT)) {
|
||||
settings.setTable2DHeader(unmarshallAttribute(tableNode, Settings.TABLE_HEADER_ATTRIBUTE, Settings.DEFAULT_TABLE2D_HEADER));
|
||||
} else if(tableNode.getNodeName().equalsIgnoreCase(Settings.TABLE3D_ELEMENT)) {
|
||||
settings.setTable3DHeader(unmarshallAttribute(tableNode, Settings.TABLE_HEADER_ATTRIBUTE, Settings.DEFAULT_TABLE3D_HEADER));
|
||||
}
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue