diff --git a/src/enginuity/NewGUI/tree/ETree.java b/src/enginuity/NewGUI/tree/ETree.java index fca77849..40b12824 100644 --- a/src/enginuity/NewGUI/tree/ETree.java +++ b/src/enginuity/NewGUI/tree/ETree.java @@ -46,8 +46,10 @@ public class ETree extends JTree implements MouseListener { // If this is a table that contains data, then open it in the right pane in an internal frame if(theNode.getTableMetaData().getNodeType() == TableMetaData.DATA1D || theNode.getTableMetaData().getNodeType() == TableMetaData.DATA2D || theNode.getTableMetaData().getNodeType() == TableMetaData.DATA3D){ - System.out.println("Table data"); + System.out.println("ETree Table data:"+theNode.getTableMetaData().getTableIdentifier()); Double[][] tableData = ApplicationStateManager.getCurrentTuningEntity().getTableData(theNode.getTableMetaData().getTableIdentifier()); + System.out.println("ETree size:"+tableData.length); + ApplicationStateManager.getEnginuityInstance().displayInternalFrameTable(tableData, theNode.getTableMetaData()); } diff --git a/src/enginuity/logger/utec/gui/JutecToolBar.java b/src/enginuity/logger/utec/gui/JutecToolBar.java index 8ac1f7bd..5a3f2bd0 100644 --- a/src/enginuity/logger/utec/gui/JutecToolBar.java +++ b/src/enginuity/logger/utec/gui/JutecToolBar.java @@ -103,7 +103,7 @@ public class JutecToolBar extends JToolBar implements ActionListener { if(mapData != null){ // Initialise tree - ETreeNode root = new ETreeNode("UTEC:"+UtecDataManager.getCurrentMapData().getMapName()+", "+UtecDataManager.getCurrentMapData().getMapComment(), new TableMetaData(TableMetaData.CATEGORY,0.0,0.0,new Object[0],null,null,false,"","", mapData.getMapName(), this.parentTuningEntity)); + ETreeNode root = new ETreeNode("UTEC:"+mapData.getMapName()+", "+mapData.getMapComment(), new TableMetaData(TableMetaData.CATEGORY,0.0,0.0,new Object[0],null,null,false,"","", mapData.getMapName(), this.parentTuningEntity)); Object[] ignored = {new Double(-100.0)}; ETreeNode fuel = new ETreeNode("Fuel", new TableMetaData(TableMetaData.DATA3D, Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMax")[0]), ignored,null,null, false, "Fuel" , "Fuel:"+mapData.getMapName(), mapData.getMapName(),this.parentTuningEntity)); @@ -128,7 +128,9 @@ public class JutecToolBar extends JToolBar implements ActionListener { } } else if (e.getSource() == saveImage) { try { - int count = this.theTEL.getMapChangeCount(this.parentTuningEntity, UtecDataManager.getCurrentMapData().getMapName()); + String temp = ApplicationStateManager.getSelectedTuningGroup(); + System.out.println("TEMP:"+temp); + int count = 0;//this.theTEL.getMapChangeCount(this.parentTuningEntity, UtecDataManager.getCurrentMapData().getMapName()); System.out.println("Maps Changed:"+count); if(count > 0){ this.theTEL.saveMaps(); diff --git a/src/enginuity/logger/utec/gui/mapTabs/UtecDataManager.java b/src/enginuity/logger/utec/gui/mapTabs/UtecDataManager.java index 884448c5..a909eddb 100644 --- a/src/enginuity/logger/utec/gui/mapTabs/UtecDataManager.java +++ b/src/enginuity/logger/utec/gui/mapTabs/UtecDataManager.java @@ -36,7 +36,7 @@ public class UtecDataManager { public static void addMap(UtecMapData newUtecMap){ allMaps.add(newUtecMap); - setCurrentMap(newUtecMap); + //setCurrentMap(newUtecMap); } public static void setCurrentMap(UtecMapData newUtecMap){ @@ -82,7 +82,7 @@ public class UtecDataManager { UtecMapData newMap = new UtecMapData(); newMap.replaceRawData(new StringBuffer(rawMapData)); newMap.populateMapDataStructures(); - setCurrentMap(newMap); + // setCurrentMap(newMap); rawMapData = ""; setExpectingMap(false); } diff --git a/src/enginuity/logger/utec/impl/UtecTuningEntityImpl.java b/src/enginuity/logger/utec/impl/UtecTuningEntityImpl.java index 7c9134b3..2c80cae1 100644 --- a/src/enginuity/logger/utec/impl/UtecTuningEntityImpl.java +++ b/src/enginuity/logger/utec/impl/UtecTuningEntityImpl.java @@ -145,10 +145,10 @@ public class UtecTuningEntityImpl implements TuningEntity{ } public Double[][] getTableData(String tableIdentifier) { - System.out.println("UTEC Impl tablename:"+tableIdentifier); + System.out.println("UTEC getTableData Impl tablename:"+tableIdentifier); Double[][] data = null; - if(UtecDataManager.getCurrentMapData() == null){ + if(UtecDataManager.getAllMaps().size() == 0){ System.out.println("UTEC Impl Current map data is null"); return new Double[0][0]; } @@ -159,14 +159,22 @@ public class UtecTuningEntityImpl implements TuningEntity{ String mapName = newMapData.getMapName(); if(tableIdentifier.equals("Fuel:"+mapName)){ + System.out.println("UTE Fuel"); data = newMapData.getFuelMap(); + System.out.println("Fuel size:"+data.length); + return data; } else if(tableIdentifier.equals("Timing:"+mapName)){ + System.out.println("UTE Timing"); data = newMapData.getTimingMap(); + return data; } else if(tableIdentifier.equals("Boost:"+mapName)){ + System.out.println("UTE Boost"); data = newMapData.getBoostMap(); + return data; }else{ + System.out.println("UTE returning empty data"); data = new Double[0][0]; } @@ -238,6 +246,7 @@ public class UtecTuningEntityImpl implements TuningEntity{ } else if (cmd.equals("Save Map To File")) { + /* System.out.println("Saving map to file."); if (UtecDataManager.getCurrentMapData() != null) { @@ -252,6 +261,7 @@ public class UtecTuningEntityImpl implements TuningEntity{ } else { System.out.println("Map is null."); } + */ } else if (cmd.equals("Load Map #1")) { @@ -349,6 +359,28 @@ public class UtecTuningEntityImpl implements TuningEntity{ } public void setTableData(String tableIdentifier, Double[][] data) { - System.out.println("utec save data requested"); + System.out.println("utec save data requested:"+tableIdentifier); + + Iterator mapIterate = UtecDataManager.getAllMaps().iterator(); + while(mapIterate.hasNext()){ + UtecMapData mapData = (UtecMapData)mapIterate.next(); + String[] split = tableIdentifier.split(":"); + String mapType = split[0]; + String tableName = split[1]; + if(mapData.getMapName().equals(tableName)){ + if(mapType.equals("Fuel")){ + System.out.println("UTE: Fuel"); + mapData.setFuelMap(data); + } + else if(mapType.equals("Boost")){ + System.out.println("UTE: Boost"); + mapData.setBoostMap(data); + } + else if(mapType.equals("Timing")){ + System.out.println("UTE: Timing"); + mapData.setTimingMap(data); + } + } + } } }