improve table type handling

- return correct type
- fix error on table properties
This commit is contained in:
stirkac 2019-03-05 16:38:31 +01:00
parent 4e30af5940
commit 798cb43830
2 changed files with 7 additions and 5 deletions

View File

@ -33,6 +33,7 @@ import javax.swing.JPanel;
import javax.swing.JTextArea;
import com.romraider.Settings;
import com.romraider.maps.Table.TableType;
import com.romraider.util.ByteUtil;
import static com.romraider.util.ByteUtil.isBitSet;
@ -46,7 +47,6 @@ public class TableBitwiseSwitch extends Table {
public TableBitwiseSwitch() {
super();
storageType = 1;
type = Settings.TABLE_SWITCH;
removeAll();
setLayout(new BorderLayout());
checkboxes = new ArrayList<JCheckBox>();
@ -72,8 +72,8 @@ public class TableBitwiseSwitch extends Table {
}
@Override
public int getType() {
return Settings.TABLE_SWITCH;
public TableType getType() {
return Table.TableType.SWITCH;
}
@Override

View File

@ -48,8 +48,10 @@ public class TablePropertyPanel extends javax.swing.JPanel {
if (Table.TableType.SWITCH == table.getType()) {
dim = 1;
storageSize.setText("switch");
scrollPane.setViewportView(populateScalesTable(
((TableSwitch) table).getSwitchStates()));
if(table.getClass() == TableSwitch.class) {
scrollPane.setViewportView(populateScalesTable(
((TableSwitch) table).getSwitchStates()));
}
}
else {
if (Settings.STORAGE_TYPE_FLOAT == table.getStorageType()) {