diff --git a/src/enginuity/ECUEditor.java b/src/enginuity/ECUEditor.java index 8f5f81ea..f84b6bb5 100644 --- a/src/enginuity/ECUEditor.java +++ b/src/enginuity/ECUEditor.java @@ -55,6 +55,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL private JSplitPane splitPane = new JSplitPane(); private ECUEditorToolBar toolBar; private ECUEditorMenuBar menuBar; + private JProgressPane statusPanel = new JProgressPane(); public ECUEditor() { @@ -144,6 +145,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL this.setJMenuBar(menuBar); toolBar = new ECUEditorToolBar(this); this.add(toolBar, BorderLayout.NORTH); + this.add(statusPanel, BorderLayout.SOUTH); //set remaining window properties setIconImage(new ImageIcon("./graphics/enginuity-ico.gif").getImage()); @@ -166,9 +168,13 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL DOMSettingsBuilder builder = new DOMSettingsBuilder(); try { - JProgressPane progress = new JProgressPane(this, "Saving settings...", "Saving settings..."); - builder.buildSettings(settings, new File("./settings.xml"), progress, version); - } catch (IOException ex) { } + //JProgressPane progress = new JProgressPane(this, "Saving settings...", "Saving settings..."); + builder.buildSettings(settings, new File("./settings.xml"), statusPanel, version); + } catch (IOException ex) { + } finally { + statusPanel.update("Ready...", 0); + repaint(); + } } public void windowClosing(WindowEvent e) { @@ -317,11 +323,6 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL } } - public void repaintPanel() { - rightPanel.repaint(); - rightPanel.update(rightPanel.getGraphics()); - } - public void setUserLevel(int userLevel) { settings.setUserLevel(userLevel); imageRoot.setUserLevel(userLevel, settings.isDisplayHighTables()); @@ -343,15 +344,17 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL } public void openImage(File inputFile) throws XMLParseException, Exception { - JProgressPane progress = new JProgressPane(this, "Opening file...", "Parsing ECU definitions..."); + try { - repaintPanel(); - progress.update("Parsing ECU definitions...", 0); + update(getGraphics()); + statusPanel.update("Parsing ECU definitions...", 0); + repaint(); byte[] input = readFile(inputFile); DOMRomUnmarshaller domUms = new DOMRomUnmarshaller(settings, this); DOMParser parser = new DOMParser(); - progress.update("Finding ECU definition...", 10); + statusPanel.update("Finding ECU definition...", 10); + repaint(); Rom rom; // parse ecu definition files until result found @@ -362,12 +365,14 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL Document doc = parser.getDocument(); try { - rom = domUms.unmarshallXMLDefinition(doc.getDocumentElement(), input, progress); - progress.update("Populating tables...", 50); - rom.populateTables(input, progress); + rom = domUms.unmarshallXMLDefinition(doc.getDocumentElement(), input, statusPanel); + statusPanel.update("Populating tables...", 50); + repaint(); + rom.populateTables(input, statusPanel); rom.setFileName(inputFile.getName()); - progress.update("Finalizing...", 90); + statusPanel.update("Finalizing...", 90); + repaint(); addRom(rom); rom.setFullFileName(inputFile); return; @@ -386,7 +391,8 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL } finally { // remove progress bar - progress.dispose(); + //progress.dispose(); + statusPanel.update("Ready...", 0); } } diff --git a/src/enginuity/maps/Rom.java b/src/enginuity/maps/Rom.java index e9935381..356fb746 100644 --- a/src/enginuity/maps/Rom.java +++ b/src/enginuity/maps/Rom.java @@ -52,7 +52,7 @@ public class Rom implements Serializable { // update progress int currProgress = (int)((double)i / (double)getTables().size() * 40); - progress.update("Populating " + tables.get(i).getName() + " table...", 40 + currProgress); + progress.update("Populating tables...", 40 + currProgress); try { // if storageaddress has not been set (or is set to 0) omit table diff --git a/src/enginuity/swing/JProgressPane.java b/src/enginuity/swing/JProgressPane.java index 420064fe..8c9cff6f 100644 --- a/src/enginuity/swing/JProgressPane.java +++ b/src/enginuity/swing/JProgressPane.java @@ -1,43 +1,36 @@ package enginuity.swing; -import java.awt.Component; -import java.awt.GridLayout; - -import javax.swing.JFrame; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Font; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; -import javax.swing.border.LineBorder; -public class JProgressPane extends JFrame { +public class JProgressPane extends JPanel { JLabel label = new JLabel(); JProgressBar progressBar = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); - public JProgressPane(Component component, String title, String status) { + public JProgressPane() { - JPanel panel = new JPanel(); - panel.setLayout(new GridLayout(2, 1)); + this.setPreferredSize(new Dimension(500, 18)); + this.setLayout(new BorderLayout(1, 2)); label.setHorizontalAlignment(JLabel.CENTER); - label.setText(status); - panel.add(label); - panel.add(progressBar); - panel.setBorder(new LineBorder(getBackground(), 12)); + label.setText(" Ready..."); + label.setFont(new Font("Tahoma", Font.PLAIN, 11)); + label.setHorizontalAlignment(JLabel.LEFT); + progressBar.setMinimumSize(new Dimension(200, 50)); - setSize(400,60); - setLocationRelativeTo(component); - setTitle(title); - setUndecorated(true); - getContentPane().add(panel); + this.add(progressBar, BorderLayout.WEST); + this.add(label, BorderLayout.CENTER); - setVisible(true); - requestFocus(); } public void update(String status, int percent) { - label.setText(status); + label.setText(" " + status); progressBar.setValue(percent); - //update(getGraphics()); - //requestFocus(); + repaint(); + this.update(this.getGraphics()); } } \ No newline at end of file