gui - save xml only enabled when session running
This commit is contained in:
parent
a852a60fd4
commit
c1f6e3711b
3 changed files with 10 additions and 12 deletions
|
@ -19,6 +19,7 @@ import javafx.embed.swing.SwingNode;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
@ -42,15 +43,10 @@ import java.util.concurrent.Executors;
|
||||||
@Data
|
@Data
|
||||||
public class Controller implements Initializable {
|
public class Controller implements Initializable {
|
||||||
private static final Logger logger = LogManager.getLogger();
|
private static final Logger logger = LogManager.getLogger();
|
||||||
|
@FXML private StackPane stackPane;
|
||||||
@FXML
|
@FXML private BorderPane borderPane;
|
||||||
private StackPane stackPane;
|
@FXML private SwingNode swingNode;
|
||||||
|
@FXML private MenuItem saveXmlMenuItem;
|
||||||
@FXML
|
|
||||||
private BorderPane borderPane;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private SwingNode swingNode;
|
|
||||||
|
|
||||||
private Application application;
|
private Application application;
|
||||||
private Stage window;
|
private Stage window;
|
||||||
|
@ -118,11 +114,13 @@ public class Controller implements Initializable {
|
||||||
vBox.getChildren().add(mobilityPlayer);
|
vBox.getChildren().add(mobilityPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
saveXmlMenuItem.setDisable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sessionStopped() {
|
public void sessionStopped() {
|
||||||
VBox vBox = (VBox) borderPane.getTop();
|
VBox vBox = (VBox) borderPane.getTop();
|
||||||
vBox.getChildren().remove(mobilityPlayer);
|
vBox.getChildren().remove(mobilityPlayer);
|
||||||
|
saveXmlMenuItem.setDisable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteNode(CoreNode node) {
|
public void deleteNode(CoreNode node) {
|
||||||
|
|
|
@ -244,7 +244,6 @@ public class GraphToolbar extends VBox {
|
||||||
|
|
||||||
boolean result = controller.getCoreClient().start();
|
boolean result = controller.getCoreClient().start();
|
||||||
if (result) {
|
if (result) {
|
||||||
controller.sessionStarted();
|
|
||||||
Toast.success("Session Started");
|
Toast.success("Session Started");
|
||||||
setRunButton(true);
|
setRunButton(true);
|
||||||
}
|
}
|
||||||
|
@ -259,7 +258,6 @@ public class GraphToolbar extends VBox {
|
||||||
try {
|
try {
|
||||||
boolean result = controller.getCoreClient().stop();
|
boolean result = controller.getCoreClient().stop();
|
||||||
if (result) {
|
if (result) {
|
||||||
controller.sessionStopped();
|
|
||||||
Toast.success("Session Stopped");
|
Toast.success("Session Stopped");
|
||||||
setRunButton(false);
|
setRunButton(false);
|
||||||
}
|
}
|
||||||
|
@ -271,6 +269,7 @@ public class GraphToolbar extends VBox {
|
||||||
public void setRunButton(boolean isRunning) {
|
public void setRunButton(boolean isRunning) {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
controller.sessionStarted();
|
||||||
pickingButton.fire();
|
pickingButton.fire();
|
||||||
editingButton.setDisable(true);
|
editingButton.setDisable(true);
|
||||||
runButton.pseudoClassStateChanged(START_CLASS, false);
|
runButton.pseudoClassStateChanged(START_CLASS, false);
|
||||||
|
@ -281,6 +280,7 @@ public class GraphToolbar extends VBox {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
controller.sessionStopped();
|
||||||
editingButton.setDisable(false);
|
editingButton.setDisable(false);
|
||||||
runButton.pseudoClassStateChanged(START_CLASS, true);
|
runButton.pseudoClassStateChanged(START_CLASS, true);
|
||||||
runButton.pseudoClassStateChanged(STOP_CLASS, false);
|
runButton.pseudoClassStateChanged(STOP_CLASS, false);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<Menu mnemonicParsing="false" text="File">
|
<Menu mnemonicParsing="false" text="File">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" onAction="#onOpenXmlAction" text="Open XML" />
|
<MenuItem mnemonicParsing="false" onAction="#onOpenXmlAction" text="Open XML" />
|
||||||
<MenuItem mnemonicParsing="false" onAction="#onSaveXmlAction" text="Save XML" />
|
<MenuItem fx:id="saveXmlMenuItem" disable="true" mnemonicParsing="false" onAction="#onSaveXmlAction" text="Save XML" />
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu mnemonicParsing="false" text="Session">
|
<Menu mnemonicParsing="false" text="Session">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue