mirror of https://github.com/rusefi/RomRaider.git
Improved filename display method for rom tree
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@82 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
28d4d25b6c
commit
4c1fe98d50
|
@ -45,8 +45,8 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
private RomTree imageList = new RomTree(imageRoot);
|
private RomTree imageList = new RomTree(imageRoot);
|
||||||
private Vector<Rom> images = new Vector<Rom>();
|
private Vector<Rom> images = new Vector<Rom>();
|
||||||
private Settings settings = new Settings();
|
private Settings settings = new Settings();
|
||||||
private String version = new String("0.3.0 Beta");
|
private String version = new String("0.3.1 Beta");
|
||||||
private String versionDate = new String("7/2/2006");
|
private String versionDate = new String("7/4/2006");
|
||||||
private String titleText = new String("Enginuity v" + version);
|
private String titleText = new String("Enginuity v" + version);
|
||||||
private MDIDesktopPane rightPanel = new MDIDesktopPane();
|
private MDIDesktopPane rightPanel = new MDIDesktopPane();
|
||||||
private Rom lastSelectedRom = null;
|
private Rom lastSelectedRom = null;
|
||||||
|
@ -143,7 +143,9 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
|
|
||||||
imageList.expandRow(imageList.getRowCount() - 1);
|
imageList.expandRow(imageList.getRowCount() - 1);
|
||||||
imageList.updateUI();
|
imageList.updateUI();
|
||||||
|
System.out.println(romNode);
|
||||||
setLastSelectedRom(input);
|
setLastSelectedRom(input);
|
||||||
|
System.out.println(romNode);
|
||||||
|
|
||||||
if (input.getRomID().isObsolete() && settings.isObsoleteWarning()) {
|
if (input.getRomID().isObsolete() && settings.isObsoleteWarning()) {
|
||||||
JPanel infoPanel = new JPanel();
|
JPanel infoPanel = new JPanel();
|
||||||
|
@ -156,11 +158,11 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
check.setHorizontalAlignment(JCheckBox.RIGHT);
|
check.setHorizontalAlignment(JCheckBox.RIGHT);
|
||||||
|
|
||||||
check.addActionListener(
|
check.addActionListener(
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
settings.setObsoleteWarning(((JCheckBox)e.getSource()).isSelected());
|
settings.setObsoleteWarning(((JCheckBox)e.getSource()).isSelected());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
infoPanel.add(check);
|
infoPanel.add(check);
|
||||||
|
@ -189,16 +191,16 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
|
|
||||||
public void closeImage() {
|
public void closeImage() {
|
||||||
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
||||||
RomTreeNode romTreeNode = (RomTreeNode)imageRoot.getChildAt(i);
|
RomTreeNode romTreeNode = (RomTreeNode)imageRoot.getChildAt(i);
|
||||||
Rom rom = romTreeNode.getRom();
|
Rom rom = romTreeNode.getRom();
|
||||||
if (rom == lastSelectedRom) {
|
if (rom == lastSelectedRom) {
|
||||||
imageRoot.remove(romTreeNode);
|
imageRoot.remove(romTreeNode);
|
||||||
Vector<Table> romTables = rom.getTables();
|
Vector<Table> romTables = rom.getTables();
|
||||||
for (Iterator j = romTables.iterator(); j.hasNext();) {
|
for (Iterator j = romTables.iterator(); j.hasNext();) {
|
||||||
Table t = (Table)j.next();
|
Table t = (Table)j.next();
|
||||||
rightPanel.remove(t.getFrame());
|
rightPanel.remove(t.getFrame());
|
||||||
t.finalize();
|
t.finalize();
|
||||||
}
|
}
|
||||||
rom.finalize();
|
rom.finalize();
|
||||||
romTreeNode.finalize();
|
romTreeNode.finalize();
|
||||||
break;
|
break;
|
||||||
|
@ -206,12 +208,11 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
}
|
}
|
||||||
imageList.updateUI();
|
imageList.updateUI();
|
||||||
if (imageRoot.getChildCount() > 0) {
|
if (imageRoot.getChildCount() > 0) {
|
||||||
setLastSelectedRom(((RomTreeNode)imageRoot.getChildAt(0)).getRom());
|
setLastSelectedRom(((RomTreeNode)imageRoot.getChildAt(0)).getRom());
|
||||||
}
|
} else {
|
||||||
else {
|
// no other images open
|
||||||
// no other images open
|
setLastSelectedRom(null);
|
||||||
setLastSelectedRom(null);
|
}
|
||||||
}
|
|
||||||
rightPanel.repaint();
|
rightPanel.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +234,9 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
public void setLastSelectedRom(Rom lastSelectedRom) {
|
public void setLastSelectedRom(Rom lastSelectedRom) {
|
||||||
this.lastSelectedRom = lastSelectedRom;
|
this.lastSelectedRom = lastSelectedRom;
|
||||||
if (lastSelectedRom == null) {
|
if (lastSelectedRom == null) {
|
||||||
this.setTitle(titleText);
|
setTitle(titleText);
|
||||||
} else {
|
} else {
|
||||||
this.setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
setTitle(titleText + " - " + lastSelectedRom.getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update filenames
|
// update filenames
|
||||||
|
@ -259,7 +260,7 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
public void setSettings(Settings settings) {
|
public void setSettings(Settings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
||||||
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
|
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
|
||||||
rtn.getRom().setContainer(this);
|
rtn.getRom().setContainer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,8 +279,8 @@ public class ECUEditor extends JFrame implements WindowListener {
|
||||||
public Vector<Rom> getImages() {
|
public Vector<Rom> getImages() {
|
||||||
Vector<Rom> images = new Vector<Rom>();
|
Vector<Rom> images = new Vector<Rom>();
|
||||||
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
for (int i = 0; i < imageRoot.getChildCount(); i++) {
|
||||||
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
|
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
|
||||||
images.add(rtn.getRom());
|
images.add(rtn.getRom());
|
||||||
}
|
}
|
||||||
return images;
|
return images;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package enginuity.maps;
|
||||||
|
|
||||||
import enginuity.ECUEditor;
|
import enginuity.ECUEditor;
|
||||||
import enginuity.swing.JProgressPane;
|
import enginuity.swing.JProgressPane;
|
||||||
import enginuity.swing.RomTreeNode;
|
|
||||||
import enginuity.xml.TableNotFoundException;
|
import enginuity.xml.TableNotFoundException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
@ -3,6 +3,8 @@ package enginuity.swing;
|
||||||
import enginuity.ECUEditor;
|
import enginuity.ECUEditor;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.tree.DefaultMutableTreeNode;
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package enginuity.swing;
|
||||||
import enginuity.maps.Rom;
|
import enginuity.maps.Rom;
|
||||||
import enginuity.maps.Table;
|
import enginuity.maps.Table;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
import javax.swing.tree.DefaultMutableTreeNode;
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
|
||||||
public class RomTreeNode extends DefaultMutableTreeNode {
|
public class RomTreeNode extends DefaultMutableTreeNode {
|
||||||
|
@ -10,9 +12,9 @@ public class RomTreeNode extends DefaultMutableTreeNode {
|
||||||
private Rom rom = new Rom();
|
private Rom rom = new Rom();
|
||||||
|
|
||||||
public RomTreeNode(Rom rom, int userLevel) {
|
public RomTreeNode(Rom rom, int userLevel) {
|
||||||
super(rom.getFileName());
|
|
||||||
setRom(rom);
|
setRom(rom);
|
||||||
refresh(userLevel);
|
refresh(userLevel);
|
||||||
|
updateFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh(int userLevel) {
|
public void refresh(int userLevel) {
|
||||||
|
@ -49,7 +51,14 @@ public class RomTreeNode extends DefaultMutableTreeNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFileName() {
|
public void updateFileName() {
|
||||||
this.setUserObject(rom.getFileName());
|
/*JPanel panel = new JPanel();
|
||||||
|
JLabel fileName = new JLabel(rom.getFileName());
|
||||||
|
JLabel info = new JLabel("info");
|
||||||
|
panel.add(fileName);
|
||||||
|
panel.add(info);
|
||||||
|
setUserObject(panel);*/
|
||||||
|
|
||||||
|
setUserObject(rom.getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Table table) {
|
public void add(Table table) {
|
||||||
|
|
Loading…
Reference in New Issue