Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Make the cancel button in the project type screen into a back button
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehearn committed Dec 10, 2014
1 parent 72a5ea1 commit c0b97cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ private void saveAndWatchDirectory(Project project, Path dirPath) {

@FXML
public void cancelClicked(ActionEvent event) {
overlayUI.done();
if (editing)
EditProjectWindow.openForEdit(model);
else
EditProjectWindow.openForCreate(model);
}

@FXML
Expand Down
19 changes: 15 additions & 4 deletions client/src/main/java/lighthouse/subwindows/EditProjectWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,24 @@ public class EditProjectWindow {
private boolean editing;

public static void openForCreate() {
Main.OverlayUI<EditProjectWindow> ui = Main.instance.overlayUI("subwindows/add_edit_project.fxml", "Create new project");
ui.controller.setupFor(new ProjectModel(Main.wallet), false);
open(new ProjectModel(Main.wallet), "Create new project", false);
}

public static void openForCreate(ProjectModel project) {
open(project, "Create new project", false);
}

public static void openForEdit(Project project) {
Main.OverlayUI<EditProjectWindow> ui = Main.instance.overlayUI("subwindows/add_edit_project.fxml", "Edit project");
ui.controller.setupFor(new ProjectModel(project.getProtoDetails().toBuilder()), true);
open(new ProjectModel(project.getProtoDetails().toBuilder()), "Edit project", true);
}

public static void openForEdit(ProjectModel project) {
open(project, "Edit project", true);
}

private static void open(ProjectModel project, String title, boolean editing) {
Main.OverlayUI<EditProjectWindow> ui = Main.instance.overlayUI("subwindows/add_edit_project.fxml", title);
ui.controller.setupFor(project, editing);
}

private void setupFor(ProjectModel model, boolean editing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<HBox alignment="CENTER_RIGHT" prefHeight="81.0" prefWidth="750.0" spacing="10.0" styleClass="fat-buttons" BorderPane.alignment="CENTER">
<children>
<Pane HBox.hgrow="ALWAYS" />
<Button cancelButton="true" maxWidth="Infinity" mnemonicParsing="false" onAction="#cancelClicked" text="Cancel" />
<Button cancelButton="true" maxWidth="Infinity" mnemonicParsing="false" onAction="#cancelClicked" text="Back" />
<Button fx:id="saveButton" defaultButton="true" maxWidth="Infinity" mnemonicParsing="false" onAction="#saveClicked" text="Save" />
</children>
<padding>
Expand Down

0 comments on commit c0b97cd

Please sign in to comment.