Commit 8948b6fb authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Merge branch 'save_current_project'

parents 8cf7c11e ec2b615d
Pipeline #98662 failed with stages
in 151 minutes and 13 seconds
......@@ -2,16 +2,19 @@ package org.vadere.gui.projectview.control;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.VadereApplication;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.utils.ApplicationWriter;
import org.vadere.gui.projectview.view.VDialogManager;
import org.vadere.util.io.IOUtils;
import org.vadere.util.logging.Logger;
import javax.swing.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.TreeSet;
import java.util.prefs.BackingStoreException;
import javax.swing.*;
import java.util.prefs.Preferences;
public abstract class ActionAbstractSaveProject extends AbstractAction {
......@@ -99,6 +102,7 @@ public abstract class ActionAbstractSaveProject extends AbstractAction {
model.getProject().saveChanges();
model.refreshScenarioNames();
logger.info("save project");
updateRecentProjectPreferences(model);
} catch (IOException e) {
IOUtils.errorBox(
Messages.getString("SaveFileErrorMessage.text") + System.lineSeparator()
......@@ -113,6 +117,16 @@ public abstract class ActionAbstractSaveProject extends AbstractAction {
}
}
private static void updateRecentProjectPreferences(ProjectViewModel model) {
Preferences preferences = Preferences.userNodeForPackage(VadereApplication.class);
final String key = "recent_projects";
final TreeSet<String> values = new TreeSet(Arrays.asList(preferences.get(key, "").split(",")));
values.add(model.getCurrentProjectPath());
String value = values.stream().reduce("", (a, b) -> a + "," + b);
System.out.println(values.toString());
preferences.put(key, value.replaceFirst(",", ""));
}
static void savePreferences() throws IOException, BackingStoreException {
ApplicationWriter.savePreferences();
logger.info("save preferences");
......
......@@ -333,7 +333,7 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
closeApplicationAction.actionPerformed(null);
}
});
Preferences pref = Preferences.userNodeForPackage(VadereApplication.class);
pack();
}
......@@ -365,7 +365,7 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
JMenuItem mntmLoadProject = new JMenuItem(loadProjectAction);
mntmRecentProjects = new JMenu(Messages.getString("ProjectView.mntmRecentProjects.text"));
mntmRecentProjects.setEnabled(false);
mntmRecentProjects.setEnabled(true);
updateRecentProjectsMenu();
Action changeNameAction = new ActionRenameProject(Messages.getString("ProjectView.mntmChangeName.text"), model);
......@@ -535,6 +535,7 @@ public class ProjectView extends JFrame implements ProjectFinishedListener, Sing
model.setCurrentScenario(bundle.getScenario());
logger.info(String.format("selected scenario '%s'", bundle.getScenario().getName()));
scenarioJPanel.setScenario(bundle.getScenario(), true);
outputTableRenderer.setMarkedOutputFiles(bundle.getOutputDirectories());
......
......@@ -2,11 +2,11 @@
"name" : "basic_1_chicken_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -118,6 +118,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -139,6 +140,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -148,8 +150,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_1_chicken_gnm1_displaced",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -118,6 +118,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -139,6 +140,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -148,8 +150,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_1_chicken_gnm2",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -118,6 +118,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -139,6 +140,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -148,8 +150,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_2_density_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -127,6 +127,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -148,6 +149,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -157,8 +159,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_3_1_wall_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -100,6 +100,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -121,6 +122,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -130,8 +132,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_3_2_wall_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -100,6 +100,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -121,6 +122,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -130,8 +132,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_3_3_wall_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -100,6 +100,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -121,6 +122,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -130,8 +132,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_4_1_wall_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -100,6 +100,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -121,6 +122,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -130,8 +132,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "basic_4_2_wall_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -58,7 +58,7 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 1,
"simulationSeed" : 0
"simulationSeed" : 1
},
"topography" : {
"attributes" : {
......@@ -100,6 +100,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -121,6 +122,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -130,8 +132,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_01_pathway_gnm1",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_04_flow_gnm1_025_h",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_04_flow_gnm1_050_h",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_04_flow_gnm1_075_h",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_04_flow_gnm1_100_h",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"name" : "rimea_04_flow_gnm1_125_h",
"description" : "",
"release" : "0.7",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ ],
"processors" : [ ],
"isTimestamped" : true
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.gnm.GradientNavigationModel",
......@@ -91,6 +91,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......@@ -112,6 +113,7 @@
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
......@@ -121,8 +123,9 @@
"maximumSpeed" : 2.2,
"acceleration" : 2.0
},
"attributesCar" : null,
"dynamicElements" : [ ]
}
"teleporter" : null,