Map changes added datamanager now.

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@537 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
Tgui 2007-02-21 05:57:21 +00:00
parent 0ea2973293
commit 9dcc4a5025
3 changed files with 45 additions and 6 deletions

View File

@ -3,7 +3,7 @@ package enginuity.logger.utec.gui.mapTabs;
import enginuity.logger.utec.mapData.UtecMapData;
public class DataManager {
private static UtecMapData currentData = null;
private static UtecMapData currentMapData = null;
private static UtecTableModel fuelListener = null;
@ -12,10 +12,12 @@ public class DataManager {
public static void setCurrentMap(UtecMapData newUtecMap){
currentData = newUtecMap;
fuelListener.replaceData(currentData.getFuelMap());
boostListener.replaceData(currentData.getBoostMap());
timingListener.replaceData(currentData.getTimingMap());
currentMapData = newUtecMap;
// Call listeners
fuelListener.replaceData(currentMapData.getFuelMap());
boostListener.replaceData(currentMapData.getBoostMap());
timingListener.replaceData(currentMapData.getTimingMap());
}
@ -33,5 +35,15 @@ public class DataManager {
DataManager.timingListener = timingListener;
}
public static void setFuelMapValue(int row, int col, double value){
currentMapData.setFuelMapValue(row, col, value);
}
public static void setBoostMapValue(int row, int col, double value){
currentMapData.setBoostMapValue(row, col, value);
}
public static void setTimingMapValue(int row, int col, double value){
currentMapData.setTimingMapValue(row, col, value);
}
}

View File

@ -10,7 +10,10 @@ public class UtecTableModel extends AbstractTableModel {
String test = "";
private int identifier = 0;
public UtecTableModel(int identifier, double[][] initialData) {
this.identifier = identifier;
this.data = initialData;
@ -51,6 +54,18 @@ public class UtecTableModel extends AbstractTableModel {
System.out.println("Not a valid number entered.");
}
data[col][row] = temp;
// Update current map in scope
if(this.identifier == MapJPanel.FUELMAP){
DataManager.setFuelMapValue(row, col, temp);
}
else if(this.identifier == MapJPanel.TIMINGMAP){
DataManager.setTimingMapValue(row, col, temp);
}
else if(this.identifier == MapJPanel.BOOSTMAP){
DataManager.setBoostMapValue(row, col, temp);
}
this.fireTableDataChanged();
}

View File

@ -471,4 +471,16 @@ public class UtecMapData {
public String getMapName() {
return mapName;
}
public void setFuelMapValue(int row, int col, double value){
this.fuelMap[col][row] = value;
}
public void setBoostMapValue(int row, int col, double value){
this.boostMap[col][row] = value;
}
public void setTimingMapValue(int row, int col, double value){
this.timingMap[col][row] = value;
}
}