Skip to content

Commit

Permalink
feat(app): wipe scenes when going back to start
Browse files Browse the repository at this point in the history
Related #33.
  • Loading branch information
yarl committed May 6, 2017
1 parent a579ae4 commit dd7a6d8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
13 changes: 12 additions & 1 deletion src/pattypan/elements/WikiButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
Expand Down Expand Up @@ -87,7 +88,17 @@ public WikiButton linkTo(String paneName, Stage stage) {
});
return this;
}


public WikiButton linkTo(String paneName, Stage stage, boolean clearScenes) {
this.setOnAction((ActionEvent event) -> {
if(clearScenes) {
Session.SCENES = new HashMap<>();
}
goTo(paneName, stage);
});
return this;
}

public void goTo(String paneName, Stage stage) {
Scene scene = Session.SCENES.containsKey(paneName)
? Session.SCENES.get(paneName)
Expand Down
4 changes: 2 additions & 2 deletions src/pattypan/elements/WikiPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class WikiPane extends BorderPane {
public VBox centerContainer = new VBox(15);
public HBox bottomContainer = new HBox();

public WikiButton prevButton = new WikiButton("generic-back", "inversed").setWidth(150);
public WikiButton nextButton = new WikiButton("generic-next", "inversed").setWidth(150);
public WikiButton prevButton = new WikiButton("generic-back", "inversed").setWidth(250);
public WikiButton nextButton = new WikiButton("generic-next", "inversed").setWidth(250);

private final String[] progressBarLabels = {
Util.text("choose-directory-name"),
Expand Down
2 changes: 1 addition & 1 deletion src/pattypan/panes/CreateFilePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void showOpenFileButton() {
}
});

nextButton.linkTo("StartPane", stage).setText(Util.text("create-file-back-to-start"));
nextButton.linkTo("StartPane", stage, true).setText(Util.text("create-file-back-to-start"));
nextButton.setVisible(true);
}

Expand Down
4 changes: 4 additions & 0 deletions src/pattypan/panes/UploadPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private void setActions() {
uploadButton.setDisable(true);
stopButton.setDisable(false);
uploadFiles();
nextButton.setVisible(false);
});

stopButton.setOnAction((ActionEvent e) -> {
Expand All @@ -97,6 +98,9 @@ public void changed(ObservableValue<? extends String> ov, String oldValue, Strin
stopButton.setDisable(true);
} else {
addInfo(newValue);

nextButton.linkTo("StartPane", stage, true).setText(Util.text("upload-next-sheet"));
nextButton.setVisible(true);
}
}
});
Expand Down
1 change: 1 addition & 0 deletions src/pattypan/text/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ upload-log-error-name-taken=This file name is already used
upload-log-success=[%s/%s] File uploaded\!
upload-log-uploading=[%s/%s] Uploading %s...
upload-name=Upload
upload-next-sheet=Upload next spreadsheet
upload-stop=Stop
validate-file-select=Select file
validate-file-type=XLS files (*.xls)
Expand Down
1 change: 1 addition & 0 deletions src/pattypan/text/messages_pl_PL.properties
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ upload-log-error-name-taken=Podana nazwa pliku jest ju\u017c w u\u017cyciu
upload-log-success=[%s/%s] File przes\u0142any\!
upload-log-uploading=[%s/%s] Przesy\u0142anie %s...
upload-name=Prze\u015blij
upload-next-sheet=Prze\u015blij nast\u0119pny arkusz
upload-stop=Zatrzymaj
validate-file-select=Wybierz plik
validate-file-type=pliki XLS (*.xls)
Expand Down

0 comments on commit dd7a6d8

Please sign in to comment.