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.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
@ -42,15 +43,10 @@ import java.util.concurrent.Executors;
|
|||
@Data
|
||||
public class Controller implements Initializable {
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
@FXML
|
||||
private StackPane stackPane;
|
||||
|
||||
@FXML
|
||||
private BorderPane borderPane;
|
||||
|
||||
@FXML
|
||||
private SwingNode swingNode;
|
||||
@FXML private StackPane stackPane;
|
||||
@FXML private BorderPane borderPane;
|
||||
@FXML private SwingNode swingNode;
|
||||
@FXML private MenuItem saveXmlMenuItem;
|
||||
|
||||
private Application application;
|
||||
private Stage window;
|
||||
|
@ -118,11 +114,13 @@ public class Controller implements Initializable {
|
|||
vBox.getChildren().add(mobilityPlayer);
|
||||
}
|
||||
}
|
||||
saveXmlMenuItem.setDisable(false);
|
||||
}
|
||||
|
||||
public void sessionStopped() {
|
||||
VBox vBox = (VBox) borderPane.getTop();
|
||||
vBox.getChildren().remove(mobilityPlayer);
|
||||
saveXmlMenuItem.setDisable(true);
|
||||
}
|
||||
|
||||
public void deleteNode(CoreNode node) {
|
||||
|
|
|
@ -244,7 +244,6 @@ public class GraphToolbar extends VBox {
|
|||
|
||||
boolean result = controller.getCoreClient().start();
|
||||
if (result) {
|
||||
controller.sessionStarted();
|
||||
Toast.success("Session Started");
|
||||
setRunButton(true);
|
||||
}
|
||||
|
@ -259,7 +258,6 @@ public class GraphToolbar extends VBox {
|
|||
try {
|
||||
boolean result = controller.getCoreClient().stop();
|
||||
if (result) {
|
||||
controller.sessionStopped();
|
||||
Toast.success("Session Stopped");
|
||||
setRunButton(false);
|
||||
}
|
||||
|
@ -271,6 +269,7 @@ public class GraphToolbar extends VBox {
|
|||
public void setRunButton(boolean isRunning) {
|
||||
if (isRunning) {
|
||||
Platform.runLater(() -> {
|
||||
controller.sessionStarted();
|
||||
pickingButton.fire();
|
||||
editingButton.setDisable(true);
|
||||
runButton.pseudoClassStateChanged(START_CLASS, false);
|
||||
|
@ -281,6 +280,7 @@ public class GraphToolbar extends VBox {
|
|||
});
|
||||
} else {
|
||||
Platform.runLater(() -> {
|
||||
controller.sessionStopped();
|
||||
editingButton.setDisable(false);
|
||||
runButton.pseudoClassStateChanged(START_CLASS, true);
|
||||
runButton.pseudoClassStateChanged(STOP_CLASS, false);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<Menu mnemonicParsing="false" text="File">
|
||||
<items>
|
||||
<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>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Session">
|
||||
|
|
Loading…
Reference in a new issue