From 4c16c44c510557fef1382fd0f73c33ff44c7c67c Mon Sep 17 00:00:00 2001 From: Robin K Date: Thu, 23 Sep 2021 22:45:48 +0200 Subject: [PATCH] 1D,2D,3D Table open --- ...le3D.properties => Table3DView.properties} | 4 +- ...{Table.properties => TableView.properties} | 14 +-- .../java/com/romraider/maps/DataCell.java | 2 +- .../java/com/romraider/maps/DataCellView.java | 4 +- src/main/java/com/romraider/maps/Rom.java | 7 +- src/main/java/com/romraider/maps/Table.java | 10 +- .../java/com/romraider/maps/Table1DView.java | 14 +-- src/main/java/com/romraider/maps/Table2D.java | 2 + .../java/com/romraider/maps/Table2DView.java | 24 ++-- src/main/java/com/romraider/maps/Table3D.java | 2 - .../java/com/romraider/maps/Table3DView.java | 109 ++++++++++-------- .../java/com/romraider/maps/TableView.java | 39 ++++--- .../com/romraider/swing/RomCellRenderer.java | 2 +- .../java/com/romraider/swing/RomTree.java | 25 +++- .../java/com/romraider/swing/TableFrame.java | 19 +-- .../com/romraider/swing/TableTreeNode.java | 2 +- 16 files changed, 165 insertions(+), 114 deletions(-) rename i18n/com/romraider/maps/{Table3D.properties => Table3DView.properties} (98%) rename i18n/com/romraider/maps/{Table.properties => TableView.properties} (98%) diff --git a/i18n/com/romraider/maps/Table3D.properties b/i18n/com/romraider/maps/Table3DView.properties similarity index 98% rename from i18n/com/romraider/maps/Table3D.properties rename to i18n/com/romraider/maps/Table3DView.properties index c837c2d7..9136dbe7 100644 --- a/i18n/com/romraider/maps/Table3D.properties +++ b/i18n/com/romraider/maps/Table3DView.properties @@ -1,2 +1,2 @@ -USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. -TBLNOTMODIFY = Table cannot be modified +USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. +TBLNOTMODIFY = Table cannot be modified diff --git a/i18n/com/romraider/maps/Table.properties b/i18n/com/romraider/maps/TableView.properties similarity index 98% rename from i18n/com/romraider/maps/Table.properties rename to i18n/com/romraider/maps/TableView.properties index ab399fbb..0bb7f545 100644 --- a/i18n/com/romraider/maps/Table.properties +++ b/i18n/com/romraider/maps/TableView.properties @@ -1,7 +1,7 @@ -USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. -TBLNOTMODIFY = Table cannot be modified -REALBYTEINVALID = The real value and byte value conversion expressions for table {0} are invalid. -REALVALUE = To real value: {0} -BYTEVALUE = To byte: {0} -DISPLAYMSG = Always display this message -WARNING = Warning +USERLVLTOLOW = This table can only be modified by users with a userlevel of \n{0} or greater. Click View->User Level to change your userlevel. +TBLNOTMODIFY = Table cannot be modified +REALBYTEINVALID = The real value and byte value conversion expressions for table {0} are invalid. +REALVALUE = To real value: {0} +BYTEVALUE = To byte: {0} +DISPLAYMSG = Always display this message +WARNING = Warning diff --git a/src/main/java/com/romraider/maps/DataCell.java b/src/main/java/com/romraider/maps/DataCell.java index f27eb784..4510af18 100644 --- a/src/main/java/com/romraider/maps/DataCell.java +++ b/src/main/java/com/romraider/maps/DataCell.java @@ -294,7 +294,7 @@ public class DataCell { private void updateView() { if(view != null) - view.drawCell(); + view.repaint(); } public Table getTable() { diff --git a/src/main/java/com/romraider/maps/DataCellView.java b/src/main/java/com/romraider/maps/DataCellView.java index fc2186d8..df663c0d 100644 --- a/src/main/java/com/romraider/maps/DataCellView.java +++ b/src/main/java/com/romraider/maps/DataCellView.java @@ -126,8 +126,8 @@ public class DataCellView extends JLabel implements MouseListener, Serializable setBackground(getCellBackgroundColor()); setForeground(getCellTextColor()); setBorder(getCellBorder()); - this.validate(); - this.repaint(); + this.validate(); + super.repaint(); } private Color getCellBackgroundColor() { diff --git a/src/main/java/com/romraider/maps/Rom.java b/src/main/java/com/romraider/maps/Rom.java index d0c6c4d9..903e0083 100644 --- a/src/main/java/com/romraider/maps/Rom.java +++ b/src/main/java/com/romraider/maps/Rom.java @@ -410,10 +410,6 @@ public class Rom extends DefaultMutableTreeNode implements Serializable { public void setFullFileName(File fullFileName) { this.fullFileName = fullFileName; this.setFileName(fullFileName.getName()); - for (TableTreeNode tableNode : tableNodes) { - String frameTitle = this.getFileName() + " - " + tableNode.getTable().getName(); - tableNode.getFrame().setTitle(frameTitle); - } } public boolean isAbstract() { @@ -426,7 +422,8 @@ public class Rom extends DefaultMutableTreeNode implements Serializable { public void refreshTableCompareMenus() { for(TableTreeNode tableNode : getTableNodes()) { - tableNode.getFrame().refreshSimilarOpenTables(); + TableFrame f = tableNode.getFrame(); + if(f != null) f.refreshSimilarOpenTables(); } } diff --git a/src/main/java/com/romraider/maps/Table.java b/src/main/java/com/romraider/maps/Table.java index 39e85d30..a4113157 100644 --- a/src/main/java/com/romraider/maps/Table.java +++ b/src/main/java/com/romraider/maps/Table.java @@ -126,10 +126,8 @@ public abstract class Table implements Serializable { this.ramOffset = romRamOffset; } - for (int i = 0; i < data.length; i++) { - if (data[i] == null) { - data[i] = new DataCell(this, i, input); - } + for (int i = 0; i < data.length; i++) { + data[i] = new DataCell(this, i, input); } // reset locked status @@ -290,7 +288,7 @@ public abstract class Table implements Serializable { } public String getName() { - return toString(); + return name; } public StringBuffer getTableAsString() { @@ -634,6 +632,8 @@ public abstract class Table implements Serializable { public void setCurrentScale(Scale curScale) { this.curScale = curScale; + + if(tableView!=null) tableView.repaint(); } public Settings getSettings() diff --git a/src/main/java/com/romraider/maps/Table1DView.java b/src/main/java/com/romraider/maps/Table1DView.java index 012217d3..d6bf3995 100644 --- a/src/main/java/com/romraider/maps/Table1DView.java +++ b/src/main/java/com/romraider/maps/Table1DView.java @@ -24,7 +24,6 @@ import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.border.EmptyBorder; -import com.romraider.swing.TableFrame; import com.romraider.util.NumberUtil; public class Table1DView extends TableView { @@ -32,9 +31,10 @@ public class Table1DView extends TableView { private static final long serialVersionUID = -8747180767803835631L; private Table1D table; - protected Table1DView(Table1D table, TableFrame frame) { - super(table, frame); + public Table1DView(Table1D table) { + super(table); this.table = table; + populateTableVisual(); } public void addStaticDataCell(DataCellView input) { @@ -47,12 +47,11 @@ public class Table1DView extends TableView { } } - @Override - public void populateTable(byte[] input, int romRamOffset) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + public void populateTableVisual() { centerLayout.setRows(1); centerLayout.setColumns(table.getDataSize()); - + super.populateTableVisual(); // add to table for (int i = 0; i < table.getDataSize(); i++) { @@ -223,8 +222,7 @@ public class Table1DView extends TableView { } } - @Override - public void clearSelection() { + public void clearSelectionInParent() { // Call to the axis parent. The axis parent should then call to clear this data. Table p = table.getAxisParent(); diff --git a/src/main/java/com/romraider/maps/Table2D.java b/src/main/java/com/romraider/maps/Table2D.java index 62c46351..f1278c2e 100644 --- a/src/main/java/com/romraider/maps/Table2D.java +++ b/src/main/java/com/romraider/maps/Table2D.java @@ -163,6 +163,8 @@ public class Table2D extends Table { } } this.curScale = curScale; + + if(tableView != null) tableView.repaint(); } @Override diff --git a/src/main/java/com/romraider/maps/Table2DView.java b/src/main/java/com/romraider/maps/Table2DView.java index 9ef17653..60ebe73e 100644 --- a/src/main/java/com/romraider/maps/Table2DView.java +++ b/src/main/java/com/romraider/maps/Table2DView.java @@ -38,7 +38,6 @@ import javax.swing.border.EmptyBorder; import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.swing.TableFrame; public class Table2DView extends TableView { private static final long serialVersionUID = -7684570967109324784L; @@ -48,11 +47,11 @@ public class Table2DView extends TableView { private CopyTable2DWorker copyTable2DWorker; private CopySelection2DWorker copySelection2DWorker; - protected Table2DView(Table2D table, TableFrame frame) { - super(table, frame); - axis = new Table1DView(table.getAxis(), frame); + public Table2DView(Table2D table) { + super(table); + axis = new Table1DView(table.getAxis()); verticalOverhead += 18; - + populateTableVisual(); } public Table1DView getAxis() { @@ -87,9 +86,10 @@ public class Table2DView extends TableView { } @Override - public void populateTable(byte[] input, int romRamOffset) throws ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + public void populateTableVisual(){ centerLayout.setRows(2); centerLayout.setColumns(table.getDataSize()); + super.populateTableVisual(); // add to table for (int i = 0; i < axis.getTable().getDataSize(); i++) { @@ -118,8 +118,10 @@ public class Table2DView extends TableView { } tableLabel = new JLabel(table.getCurrentScale().getUnit(), JLabel.CENTER); - add(tableLabel, BorderLayout.SOUTH); - axisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + add(tableLabel, BorderLayout.SOUTH); + + if(axisLabel != null) + axisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); if(presetPanel != null) presetPanel.populatePanel(); repaint(); @@ -183,7 +185,7 @@ public class Table2DView extends TableView { @Override public void clearSelection() { axis.clearSelection(); - clearSelection(); + super.clearSelection(); } @@ -203,7 +205,9 @@ public class Table2DView extends TableView { @Override public void drawTable() { super.drawTable(); - axis.drawTable(); + + if(axis !=null) + axis.drawTable(); } @Override diff --git a/src/main/java/com/romraider/maps/Table3D.java b/src/main/java/com/romraider/maps/Table3D.java index 09e97cb9..746d4a71 100644 --- a/src/main/java/com/romraider/maps/Table3D.java +++ b/src/main/java/com/romraider/maps/Table3D.java @@ -91,7 +91,6 @@ public class Table3D extends Table { public void setSizeX(int size) { data = new DataCell[size][data[0].length]; - // centerLayout.setColumns(size + 1); } public int getSizeX() { @@ -100,7 +99,6 @@ public class Table3D extends Table { public void setSizeY(int size) { data = new DataCell[data.length][size]; - //centerLayout.setRows(size + 1); } public int getSizeY() { diff --git a/src/main/java/com/romraider/maps/Table3DView.java b/src/main/java/com/romraider/maps/Table3DView.java index bd1b09bf..79363815 100644 --- a/src/main/java/com/romraider/maps/Table3DView.java +++ b/src/main/java/com/romraider/maps/Table3DView.java @@ -19,9 +19,11 @@ package com.romraider.maps; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; - +import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.Window; import java.awt.datatransfer.DataFlavor; @@ -34,38 +36,42 @@ import java.util.ResourceBundle; import java.util.StringTokenizer; import javax.swing.JLabel; +import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; - +import javax.swing.border.EmptyBorder; import com.romraider.Settings; import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.swing.TableFrame; +import com.romraider.logger.ecu.ui.swing.vertical.VerticalLabelUI; import com.romraider.util.NumberUtil; import com.romraider.util.ResourceUtil; public class Table3DView extends TableView { private static final long serialVersionUID = 3103448753263606599L; - private static final ResourceBundle rb = new ResourceUtil().getBundle(Table3D.class.getName()); + private static final ResourceBundle rb = new ResourceUtil().getBundle(Table3DView.class.getName()); private Table3D table; private Table1DView xAxis; private Table1DView yAxis; private JLabel xAxisLabel; private JLabel yAxisLabel; - DataCellView[][] data = new DataCellView[1][1]; + DataCellView[][] data; CopyTable3DWorker copyTable3DWorker; CopySelection3DWorker copySelection3DWorker; - public Table3DView(Table3D table, TableFrame frame) { - super(table, frame); - xAxis = new Table1DView(table.getXAxis(), frame); - yAxis = new Table1DView(table.getYAxis(), frame); + public Table3DView(Table3D table) { + super(table); + this.table = table; + xAxis = new Table1DView(table.getXAxis()); + yAxis = new Table1DView(table.getYAxis()); verticalOverhead += 39; horizontalOverhead += 10; + + populateTableVisual(); } @Override @@ -75,30 +81,38 @@ public class Table3DView extends TableView { @Override public void drawTable() { - for(DataCellView[] column : data) { - for(DataCellView cell : column) { - if(null != cell) { - cell.drawCell(); - } - } - } - xAxis.drawTable(); + if(data!=null) { + for(DataCellView[] column : data) { + for(DataCellView cell : column) { + if(null != cell) { + cell.repaint(); + } + } + } + } + + if(xAxis!=null) + xAxis.drawTable(); + + if(yAxis!=null) yAxis.drawTable(); } @Override - public void populateTable(byte[] input, int romRamOffset) throws NullPointerException, ArrayIndexOutOfBoundsException, IndexOutOfBoundsException { + public void populateTableVisual() { // fill first empty cell centerPanel.add(new JLabel()); - /* + centerLayout.setColumns(xAxis.getTable().getDataSize()); + centerLayout.setRows(yAxis.getTable().getDataSize()); + // temporarily remove lock boolean tempLock = table.locked; table.locked = false; // populate axes try { - xAxis.populateTable(input, romRamOffset); - yAxis.populateTable(input, romRamOffset); + xAxis.populateTableVisual(); + yAxis.populateTableVisual(); } catch (ArrayIndexOutOfBoundsException ex) { throw new ArrayIndexOutOfBoundsException(); } @@ -107,16 +121,17 @@ public class Table3DView extends TableView { centerPanel.add(xAxis.getDataCell(x)); } - int offset = 0; - - int iMax = swapXY ? xAxis.getTable().getDataSize() : yAxis.getTable().getDataSize(); - int jMax = swapXY ? yAxis.getTable().getDataSize() : xAxis.getTable().getDataSize(); + + data = new DataCellView[xAxis.getTable().getDataSize()][yAxis.getTable().getDataSize()]; + + int iMax = table.getSwapXY() ? xAxis.getTable().getDataSize() : yAxis.getTable().getDataSize(); + int jMax = table.getSwapXY() ? yAxis.getTable().getDataSize() : xAxis.getTable().getDataSize(); for (int i = 0; i < iMax; i++) { for (int j = 0; j < jMax; j++) { - int x = flipY ? jMax - j - 1 : j; - int y = flipX ? iMax - i - 1 : i; - if (swapXY) { + int x = table.getFlipY() ? jMax - j - 1 : j; + int y = table.getFlipX() ? iMax - i - 1 : i; + if (table.getSwapXY()) { int z = x; x = y; y = z; @@ -127,21 +142,20 @@ public class Table3DView extends TableView { data[x][y].setForeground(Color.GRAY); } - DataCell c = new DataCell(this, offset); - data[x][y] = new DataCellView(c,x,y); - offset++; + + data[x][y] = new DataCellView(table.get3dData()[x][y], this, x,y); } } - for (int y = 0; y < yAxis.getDataSize(); y++) { + for (int y = 0; y < yAxis.getTable().getDataSize(); y++) { centerPanel.add(yAxis.getDataCell(y)); - for (int x = 0; x < xAxis.getDataSize(); x++) { + for (int x = 0; x < xAxis.getTable().getDataSize(); x++) { centerPanel.add(data[x][y]); } } // reset locked status - locked = tempLock; + table.locked = tempLock; GridLayout topLayout = new GridLayout(2, 1); JPanel topPanel = new JPanel(topLayout); @@ -150,37 +164,38 @@ public class Table3DView extends TableView { if(null == xAxis.getName() || xAxis.getName().length() < 1 || Settings.BLANK == xAxis.getName()) { ;// Do not add label. - } else if(null == xAxis.getCurrentScale() || "0x" == xAxis.getCurrentScale().getUnit()) { + } else if(null == xAxis.getTable().getCurrentScale() || "0x" == xAxis.getTable().getCurrentScale().getUnit()) { // static or no scale exists. xAxisLabel = new JLabel(xAxis.getName(), JLabel.CENTER); topPanel.add(xAxisLabel, BorderLayout.NORTH); } else { - xAxisLabel = new JLabel(xAxis.getName() + " (" + xAxis.getCurrentScale().getUnit() + ")", JLabel.CENTER); + xAxisLabel = new JLabel(xAxis.getName() + " (" + xAxis.getTable().getCurrentScale().getUnit() + ")", JLabel.CENTER); topPanel.add(xAxisLabel, BorderLayout.NORTH); } yAxisLabel = null; if(null == yAxis.getName() || yAxis.getName().length() < 1 || Settings.BLANK == yAxis.getName()) { ;// Do not add label. - } else if(null == yAxis.getCurrentScale() || "0x" == yAxis.getCurrentScale().getUnit()) { + } else if(null == yAxis.getTable().getCurrentScale() || "0x" == yAxis.getTable().getCurrentScale().getUnit()) { // static or no scale exists. yAxisLabel = new JLabel(yAxis.getName()); } else { - yAxisLabel = new JLabel(yAxis.getName() + " (" + yAxis.getCurrentScale().getUnit() + ")"); + yAxisLabel = new JLabel(yAxis.getName() + " (" + yAxis.getTable().getCurrentScale().getUnit() + ")"); } - - yAxisLabel.setUI(new VerticalLabelUI(false)); - add(yAxisLabel, BorderLayout.WEST); - - tableLabel = new JLabel(getCurrentScale().getUnit(), JLabel.CENTER); + + if(yAxisLabel!=null) { + yAxisLabel.setUI(new VerticalLabelUI(false)); + add(yAxisLabel, BorderLayout.WEST); + yAxisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); + } + + tableLabel = new JLabel(table.getCurrentScale().getUnit(), JLabel.CENTER); add(tableLabel, BorderLayout.SOUTH); - - yAxisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); - + if(xAxisLabel!=null) xAxisLabel.setBorder(new EmptyBorder(2, 4, 2, 4)); - if(presetPanel != null) presetPanel.populatePanel();*/ + if(presetPanel != null) presetPanel.populatePanel(); } @Override diff --git a/src/main/java/com/romraider/maps/TableView.java b/src/main/java/com/romraider/maps/TableView.java index de62bb79..c9e612fa 100644 --- a/src/main/java/com/romraider/maps/TableView.java +++ b/src/main/java/com/romraider/maps/TableView.java @@ -66,7 +66,6 @@ public abstract class TableView extends JPanel implements Serializable { protected Table table; protected PresetPanel presetPanel; protected DataCellView[] data; - protected TableFrame frame; protected BorderLayout borderLayout = new BorderLayout(); protected GridLayout centerLayout = new GridLayout(1, 1, 0, 0); @@ -91,17 +90,14 @@ public abstract class TableView extends JPanel implements Serializable { protected CopySelectionWorker copySelectionWorker; protected Settings.CompareDisplay compareDisplay = Settings.CompareDisplay.ABSOLUTE; - protected TableView(Table table, TableFrame frame) { - this.frame = frame; + protected TableView(Table table) { this.table = table; table.setTableView(this); - - //Populate Views from table here - + this.setLayout(borderLayout); this.add(centerPanel, BorderLayout.CENTER); centerPanel.setVisible(true); - + // key binding actions Action rightAction = new AbstractAction() { private static final long serialVersionUID = 1042884198300385041L; @@ -495,7 +491,7 @@ public abstract class TableView extends JPanel implements Serializable { } public TableFrame getFrame() { - return frame; + return table.getTableFrame(); } public Table getTable() { @@ -520,12 +516,13 @@ public abstract class TableView extends JPanel implements Serializable { } public void drawTable() { - - for(DataCellView cell : data) { - if(null != cell) { - cell.drawCell(); - } - } + if(data!=null) { + for(DataCellView cell : data) { + if(null != cell) { + cell.drawCell(); + } + } + } } public void verticalInterpolate() throws UserLevelException{ @@ -542,7 +539,14 @@ public abstract class TableView extends JPanel implements Serializable { return (x1 == x2) ? 0.0 : (y1 + (x - x1) * (y2 - y1) / (x2 - x1)); } - public abstract void populateTable(byte[] input, int romRamOffset); + public void populateTableVisual() { + //Populate Views from table here + data = new DataCellView[table.getDataSize()]; + + for(int i= 0; i < table.getDataSize(); i++) { + data[i] = new DataCellView(table.getData()[i], this); + } + } public Dimension getFrameSize() { int height = verticalOverhead + cellHeight; @@ -562,6 +566,11 @@ public abstract class TableView extends JPanel implements Serializable { cell.setSelected(false); } } + + @Override + public void repaint() { + drawTable(); + } public void startHighlight(int x, int y) { this.highlightY = y; diff --git a/src/main/java/com/romraider/swing/RomCellRenderer.java b/src/main/java/com/romraider/swing/RomCellRenderer.java index 807dbe36..5ff19840 100644 --- a/src/main/java/com/romraider/swing/RomCellRenderer.java +++ b/src/main/java/com/romraider/swing/RomCellRenderer.java @@ -100,7 +100,7 @@ public class RomCellRenderer implements TreeCellRenderer { returnValue = renderer; } else if (value != null && value instanceof TableTreeNode) { - Table table = ((TableFrame)((DefaultMutableTreeNode) value).getUserObject()).getTable(); + Table table = (Table) (((TableTreeNode)(value)).getUserObject()); JPanel renderer = new JPanel(new GridLayout(1, 1)); renderer.setBorder(createLineBorder(Color.WHITE)); JLabel tableName = new JLabel(""); diff --git a/src/main/java/com/romraider/swing/RomTree.java b/src/main/java/com/romraider/swing/RomTree.java index 3f5e6050..086456e2 100644 --- a/src/main/java/com/romraider/swing/RomTree.java +++ b/src/main/java/com/romraider/swing/RomTree.java @@ -35,6 +35,13 @@ import javax.swing.tree.TreePath; import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditorManager; import com.romraider.maps.Rom; +import com.romraider.maps.Table1D; +import com.romraider.maps.Table1DView; +import com.romraider.maps.Table2D; +import com.romraider.maps.Table2DView; +import com.romraider.maps.Table3D; +import com.romraider.maps.Table3DView; +import com.romraider.maps.TableView; import com.romraider.util.SettingsManager; public class RomTree extends JTree implements MouseListener { @@ -101,7 +108,23 @@ public class RomTree extends JTree implements MouseListener { private void showTable(TableTreeNode selectedRow) { TableTreeNode node = (TableTreeNode) selectedRow; if (null != node) { - getEditor().displayTable(node.getFrame()); + TableFrame f = node.getFrame(); + + if(f == null) { + TableView v; + + if(node.getTable() instanceof Table1D) + v = new Table1DView((Table1D)node.getTable()); + else if(node.getTable() instanceof Table2D) + v = new Table2DView((Table2D)node.getTable()); + else if(node.getTable() instanceof Table3D) + v = new Table3DView((Table3D)node.getTable()); + else + return; + + f = new TableFrame("Title", v); + } + getEditor().displayTable(f); } } diff --git a/src/main/java/com/romraider/swing/TableFrame.java b/src/main/java/com/romraider/swing/TableFrame.java index 4d06db6f..6a3329a6 100644 --- a/src/main/java/com/romraider/swing/TableFrame.java +++ b/src/main/java/com/romraider/swing/TableFrame.java @@ -48,13 +48,18 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener, private static final long serialVersionUID = -2651279694660392351L; private static final ResourceBundle rb = new ResourceUtil().getBundle( TableFrame.class.getName()); - private final TableView table; + private final TableView tableView; private TableMenuBar tableMenuBar = null; - public TableFrame(String title, TableView table) { + public TableFrame(String title, TableView tableView) { super(title, true, true); - this.table = table; - add(table); + this.tableView = tableView; + Table t = tableView.getTable(); + t.setTableFrame(this); + + add(tableView); + tableView.repaint(); + setFrameIcon(null); setBorder(createBevelBorder(0)); if (System.getProperty("os.name").startsWith("Mac OS")) @@ -109,10 +114,10 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener, } public Table getTable() { - return table.getTable(); + return tableView.getTable(); } public TableView getTableView() { - return table; + return tableView; } public ECUEditor getEditor() { @@ -229,7 +234,7 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener, for(TableTreeNode tableNode : rom.getTableNodes()) { if(tableNode.getTable().getName().equalsIgnoreCase(getTable().getName())) { JRadioButtonMenuItem similarTable = new TableMenuItem(rom.getFileName()); - similarTable.setToolTipText(tableNode.getFrame().getTable().getName()); + similarTable.setToolTipText(tableNode.getTable().getName()); similarTable.addActionListener(this); similarTables.add(similarTable); break; diff --git a/src/main/java/com/romraider/swing/TableTreeNode.java b/src/main/java/com/romraider/swing/TableTreeNode.java index 44242365..506afbbe 100644 --- a/src/main/java/com/romraider/swing/TableTreeNode.java +++ b/src/main/java/com/romraider/swing/TableTreeNode.java @@ -35,7 +35,7 @@ public class TableTreeNode extends DefaultMutableTreeNode { } public TableFrame getFrame() { - return table.getTableView().getFrame(); + return table.getTableFrame(); } public void setTable(Table t) {