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:
Jared Gould 2006-07-04 04:22:08 +00:00
parent 28d4d25b6c
commit 4c1fe98d50
4 changed files with 71 additions and 60 deletions

View File

@ -45,8 +45,8 @@ public class ECUEditor extends JFrame implements WindowListener {
private RomTree imageList = new RomTree(imageRoot);
private Vector<Rom> images = new Vector<Rom>();
private Settings settings = new Settings();
private String version = new String("0.3.0 Beta");
private String versionDate = new String("7/2/2006");
private String version = new String("0.3.1 Beta");
private String versionDate = new String("7/4/2006");
private String titleText = new String("Enginuity v" + version);
private MDIDesktopPane rightPanel = new MDIDesktopPane();
private Rom lastSelectedRom = null;
@ -143,7 +143,9 @@ public class ECUEditor extends JFrame implements WindowListener {
imageList.expandRow(imageList.getRowCount() - 1);
imageList.updateUI();
System.out.println(romNode);
setLastSelectedRom(input);
System.out.println(romNode);
if (input.getRomID().isObsolete() && settings.isObsoleteWarning()) {
JPanel infoPanel = new JPanel();
@ -156,11 +158,11 @@ public class ECUEditor extends JFrame implements WindowListener {
check.setHorizontalAlignment(JCheckBox.RIGHT);
check.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
settings.setObsoleteWarning(((JCheckBox)e.getSource()).isSelected());
}
new ActionListener() {
public void actionPerformed(ActionEvent e) {
settings.setObsoleteWarning(((JCheckBox)e.getSource()).isSelected());
}
}
);
infoPanel.add(check);
@ -189,16 +191,16 @@ public class ECUEditor extends JFrame implements WindowListener {
public void closeImage() {
for (int i = 0; i < imageRoot.getChildCount(); i++) {
RomTreeNode romTreeNode = (RomTreeNode)imageRoot.getChildAt(i);
Rom rom = romTreeNode.getRom();
RomTreeNode romTreeNode = (RomTreeNode)imageRoot.getChildAt(i);
Rom rom = romTreeNode.getRom();
if (rom == lastSelectedRom) {
imageRoot.remove(romTreeNode);
Vector<Table> romTables = rom.getTables();
for (Iterator j = romTables.iterator(); j.hasNext();) {
Table t = (Table)j.next();
rightPanel.remove(t.getFrame());
t.finalize();
}
Vector<Table> romTables = rom.getTables();
for (Iterator j = romTables.iterator(); j.hasNext();) {
Table t = (Table)j.next();
rightPanel.remove(t.getFrame());
t.finalize();
}
rom.finalize();
romTreeNode.finalize();
break;
@ -206,12 +208,11 @@ public class ECUEditor extends JFrame implements WindowListener {
}
imageList.updateUI();
if (imageRoot.getChildCount() > 0) {
setLastSelectedRom(((RomTreeNode)imageRoot.getChildAt(0)).getRom());
}
else {
// no other images open
setLastSelectedRom(null);
}
setLastSelectedRom(((RomTreeNode)imageRoot.getChildAt(0)).getRom());
} else {
// no other images open
setLastSelectedRom(null);
}
rightPanel.repaint();
}
@ -233,9 +234,9 @@ public class ECUEditor extends JFrame implements WindowListener {
public void setLastSelectedRom(Rom lastSelectedRom) {
this.lastSelectedRom = lastSelectedRom;
if (lastSelectedRom == null) {
this.setTitle(titleText);
setTitle(titleText);
} else {
this.setTitle(titleText + " - " + lastSelectedRom.getFileName());
setTitle(titleText + " - " + lastSelectedRom.getFileName());
}
// update filenames
@ -259,7 +260,7 @@ public class ECUEditor extends JFrame implements WindowListener {
public void setSettings(Settings settings) {
this.settings = settings;
for (int i = 0; i < imageRoot.getChildCount(); i++) {
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
rtn.getRom().setContainer(this);
}
}
@ -278,8 +279,8 @@ public class ECUEditor extends JFrame implements WindowListener {
public Vector<Rom> getImages() {
Vector<Rom> images = new Vector<Rom>();
for (int i = 0; i < imageRoot.getChildCount(); i++) {
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
images.add(rtn.getRom());
RomTreeNode rtn = (RomTreeNode)imageRoot.getChildAt(i);
images.add(rtn.getRom());
}
return images;
}

View File

@ -2,7 +2,6 @@ package enginuity.maps;
import enginuity.ECUEditor;
import enginuity.swing.JProgressPane;
import enginuity.swing.RomTreeNode;
import enginuity.xml.TableNotFoundException;
import java.io.File;
import java.io.Serializable;

View File

@ -3,6 +3,8 @@ package enginuity.swing;
import enginuity.ECUEditor;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

View File

@ -3,6 +3,8 @@ package enginuity.swing;
import enginuity.maps.Rom;
import enginuity.maps.Table;
import java.util.Vector;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
public class RomTreeNode extends DefaultMutableTreeNode {
@ -10,9 +12,9 @@ public class RomTreeNode extends DefaultMutableTreeNode {
private Rom rom = new Rom();
public RomTreeNode(Rom rom, int userLevel) {
super(rom.getFileName());
setRom(rom);
refresh(userLevel);
updateFileName();
}
public void refresh(int userLevel) {
@ -49,7 +51,14 @@ public class RomTreeNode extends DefaultMutableTreeNode {
}
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) {