Commit 81dd0f86 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

the change of the name of an output file should now work from within the gui

parent 9e38e233
...@@ -57,6 +57,7 @@ import org.fife.ui.rsyntaxtextarea.SyntaxConstants; ...@@ -57,6 +57,7 @@ import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rsyntaxtextarea.Theme; import org.fife.ui.rsyntaxtextarea.Theme;
import org.vadere.gui.components.utils.Messages; import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.view.JComboCheckBox; import org.vadere.gui.components.view.JComboCheckBox;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.utils.ClassFinder; import org.vadere.gui.projectview.utils.ClassFinder;
import org.vadere.simulator.projects.Scenario; import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager; import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager;
...@@ -87,7 +88,6 @@ class DataProcessingView extends JPanel implements IJsonView { ...@@ -87,7 +88,6 @@ class DataProcessingView extends JPanel implements IJsonView {
private Scenario currentScenario; private Scenario currentScenario;
private boolean isEditable; private boolean isEditable;
DataProcessingView() { DataProcessingView() {
setLayout(new BorderLayout()); // force it to span across the whole available space setLayout(new BorderLayout()); // force it to span across the whole available space
...@@ -240,6 +240,7 @@ class DataProcessingView extends JPanel implements IJsonView { ...@@ -240,6 +240,7 @@ class DataProcessingView extends JPanel implements IJsonView {
JButton addFileBtn = new JButton(new AbstractAction("Add") { JButton addFileBtn = new JButton(new AbstractAction("Add") {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String filename = "out.txt"; String filename = "out.txt";
int count = 1; int count = 1;
while (outputFileNameAlreadyExists(filename)) { // ensure unique suggested filename while (outputFileNameAlreadyExists(filename)) { // ensure unique suggested filename
......
...@@ -50,6 +50,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro ...@@ -50,6 +50,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
private Scenario scenario; private Scenario scenario;
private boolean initialized; private boolean initialized;
private ProjectViewModel model;
private static String activeJsonParsingErrorMsg = null; private static String activeJsonParsingErrorMsg = null;
...@@ -58,6 +59,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro ...@@ -58,6 +59,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
this.scenarioName = scenarioName; this.scenarioName = scenarioName;
this.onlineVisualization = new OnlineVisualization(true); this.onlineVisualization = new OnlineVisualization(true);
this.postVisualizationView = new PostvisualizationWindow(model.getCurrentProjectPath()); this.postVisualizationView = new PostvisualizationWindow(model.getCurrentProjectPath());
this.model = model;
setBorder(new EmptyBorder(5, 5, 5, 5)); setBorder(new EmptyBorder(5, 5, 5, 5));
setLayout(new CardLayout(0, 0)); setLayout(new CardLayout(0, 0));
......
...@@ -3,8 +3,15 @@ ...@@ -3,8 +3,15 @@
"description" : "", "description" : "",
"release" : "0.2", "release" : "0.2",
"processWriters" : { "processWriters" : {
"files" : [ ], "files" : [ {
"processors" : [ ], "type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "out.txt",
"processors" : [ 1 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
} ],
"isTimestamped" : true "isTimestamped" : true
}, },
"scenario" : { "scenario" : {
......
...@@ -45,7 +45,14 @@ public abstract class OutputFile<K extends DataKey<K>> { ...@@ -45,7 +45,14 @@ public abstract class OutputFile<K extends DataKey<K>> {
} }
public void setRelativeFileName(final String fileName) { public void setRelativeFileName(final String fileName) {
this.fileName = new File(this.fileName).getParentFile().toPath().resolve(fileName).toString(); File file = new File(this.fileName);
if(file.getParentFile() != null) {
this.fileName = new File(this.fileName).getParentFile().toPath().resolve(fileName).toString();
}
else {
this.fileName = fileName;
}
} }
public void setProcessorIds(final List<Integer> processorIds) { public void setProcessorIds(final List<Integer> processorIds) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment