corefx - removed edit button, set to edit mode on node/device button click instead
This commit is contained in:
parent
8423bae0af
commit
f75f6f9ec0
2 changed files with 28 additions and 25 deletions
|
@ -45,7 +45,6 @@ public class GraphToolbar extends VBox {
|
||||||
private boolean isEditing = false;
|
private boolean isEditing = false;
|
||||||
@FXML private JFXButton runButton;
|
@FXML private JFXButton runButton;
|
||||||
@FXML private JFXButton pickingButton;
|
@FXML private JFXButton pickingButton;
|
||||||
@FXML private JFXButton editingButton;
|
|
||||||
@FXML private JFXButton drawingButton;
|
@FXML private JFXButton drawingButton;
|
||||||
@FXML private ComboBox<String> graphModeCombo;
|
@FXML private ComboBox<String> graphModeCombo;
|
||||||
@FXML private JFXButton nodesButton;
|
@FXML private JFXButton nodesButton;
|
||||||
|
@ -61,7 +60,6 @@ public class GraphToolbar extends VBox {
|
||||||
stopIcon.setSize(ICON_SIZE);
|
stopIcon.setSize(ICON_SIZE);
|
||||||
|
|
||||||
setupPickingButton();
|
setupPickingButton();
|
||||||
setupEditingButton();
|
|
||||||
setupDrawingButton();
|
setupDrawingButton();
|
||||||
setupNodesButton();
|
setupNodesButton();
|
||||||
setupDevicesButton();
|
setupDevicesButton();
|
||||||
|
@ -82,24 +80,20 @@ public class GraphToolbar extends VBox {
|
||||||
controller.getBottom().getChildren().remove(controller.getAnnotationToolbar());
|
controller.getBottom().getChildren().remove(controller.getAnnotationToolbar());
|
||||||
controller.getBorderPane().setRight(null);
|
controller.getBorderPane().setRight(null);
|
||||||
setSelected(true, pickingButton);
|
setSelected(true, pickingButton);
|
||||||
setSelected(false, editingButton, drawingButton, selectedEditButton);
|
setSelected(false, drawingButton, selectedEditButton);
|
||||||
isEditing = false;
|
isEditing = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupEditingButton() {
|
private void setEditMode() {
|
||||||
SVGGlyph editIcon = IconUtils.get("mode_edit");
|
controller.getNetworkGraph().setMode(ModalGraphMouse.Mode.EDITING);
|
||||||
editIcon.setSize(ICON_SIZE);
|
controller.getBottom().getChildren().remove(controller.getAnnotationToolbar());
|
||||||
editingButton.setGraphic(editIcon);
|
controller.getBorderPane().setRight(null);
|
||||||
editingButton.setTooltip(new Tooltip("Edit Graph"));
|
if (selectedEditButton != null) {
|
||||||
editingButton.setOnAction(event -> {
|
setSelected(true, selectedEditButton);
|
||||||
controller.getNetworkGraph().setMode(ModalGraphMouse.Mode.EDITING);
|
}
|
||||||
controller.getBottom().getChildren().remove(controller.getAnnotationToolbar());
|
setSelected(false, drawingButton, pickingButton);
|
||||||
controller.getBorderPane().setRight(null);
|
isEditing = true;
|
||||||
setSelected(true, editingButton, selectedEditButton);
|
|
||||||
setSelected(false, drawingButton, pickingButton);
|
|
||||||
isEditing = true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDrawingButton() {
|
private void setupDrawingButton() {
|
||||||
|
@ -112,7 +106,7 @@ public class GraphToolbar extends VBox {
|
||||||
controller.getBottom().getChildren().add(controller.getAnnotationToolbar());
|
controller.getBottom().getChildren().add(controller.getAnnotationToolbar());
|
||||||
controller.getBorderPane().setRight(null);
|
controller.getBorderPane().setRight(null);
|
||||||
setSelected(true, drawingButton);
|
setSelected(true, drawingButton);
|
||||||
setSelected(false, editingButton, pickingButton, selectedEditButton);
|
setSelected(false, pickingButton, selectedEditButton);
|
||||||
isEditing = false;
|
isEditing = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -165,7 +159,9 @@ public class GraphToolbar extends VBox {
|
||||||
JFXButton previous = selectedEditButton;
|
JFXButton previous = selectedEditButton;
|
||||||
selectedEditButton = button;
|
selectedEditButton = button;
|
||||||
if (isEditing) {
|
if (isEditing) {
|
||||||
setSelected(false, previous);
|
if (previous != null) {
|
||||||
|
setSelected(false, previous);
|
||||||
|
}
|
||||||
setSelected(true, selectedEditButton);
|
setSelected(true, selectedEditButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,8 +183,11 @@ public class GraphToolbar extends VBox {
|
||||||
});
|
});
|
||||||
|
|
||||||
JFXPopup popup = new JFXPopup(nodesList);
|
JFXPopup popup = new JFXPopup(nodesList);
|
||||||
nodesButton.setOnAction(event -> popup.show(nodesButton, JFXPopup.PopupVPosition.TOP,
|
nodesButton.setOnAction(event -> {
|
||||||
JFXPopup.PopupHPosition.LEFT, nodesButton.getWidth(), 0));
|
setEditMode();
|
||||||
|
popup.show(nodesButton, JFXPopup.PopupVPosition.TOP,
|
||||||
|
JFXPopup.PopupHPosition.LEFT, nodesButton.getWidth(), 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDevicesButton() {
|
private void setupDevicesButton() {
|
||||||
|
@ -208,8 +207,11 @@ public class GraphToolbar extends VBox {
|
||||||
});
|
});
|
||||||
|
|
||||||
JFXPopup popup = new JFXPopup(devicesList);
|
JFXPopup popup = new JFXPopup(devicesList);
|
||||||
devicesButton.setOnAction(event -> popup.show(devicesButton, JFXPopup.PopupVPosition.TOP,
|
devicesButton.setOnAction(event -> {
|
||||||
JFXPopup.PopupHPosition.LEFT, devicesButton.getWidth(), 0));
|
setEditMode();
|
||||||
|
popup.show(devicesButton, JFXPopup.PopupVPosition.TOP,
|
||||||
|
JFXPopup.PopupHPosition.LEFT, devicesButton.getWidth(), 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -272,7 +274,8 @@ public class GraphToolbar extends VBox {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
pickingButton.fire();
|
pickingButton.fire();
|
||||||
editingButton.setDisable(true);
|
devicesButton.setDisable(true);
|
||||||
|
nodesButton.setDisable(true);
|
||||||
runButton.pseudoClassStateChanged(START_CLASS, false);
|
runButton.pseudoClassStateChanged(START_CLASS, false);
|
||||||
runButton.pseudoClassStateChanged(STOP_CLASS, true);
|
runButton.pseudoClassStateChanged(STOP_CLASS, true);
|
||||||
if (runButton.getGraphic() != stopIcon) {
|
if (runButton.getGraphic() != stopIcon) {
|
||||||
|
@ -282,7 +285,8 @@ public class GraphToolbar extends VBox {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
editingButton.setDisable(false);
|
devicesButton.setDisable(false);
|
||||||
|
nodesButton.setDisable(false);
|
||||||
runButton.pseudoClassStateChanged(START_CLASS, true);
|
runButton.pseudoClassStateChanged(START_CLASS, true);
|
||||||
runButton.pseudoClassStateChanged(STOP_CLASS, false);
|
runButton.pseudoClassStateChanged(STOP_CLASS, false);
|
||||||
if (runButton.getGraphic() != startIcon) {
|
if (runButton.getGraphic() != startIcon) {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
<children>
|
<children>
|
||||||
<JFXButton id="run-button" fx:id="runButton" onAction="#onRunButtonAction" styleClass="toolbar-button" />
|
<JFXButton id="run-button" fx:id="runButton" onAction="#onRunButtonAction" styleClass="toolbar-button" />
|
||||||
<JFXButton fx:id="pickingButton" styleClass="toolbar-button" />
|
<JFXButton fx:id="pickingButton" styleClass="toolbar-button" />
|
||||||
<JFXButton fx:id="editingButton" styleClass="toolbar-button" />
|
|
||||||
<JFXButton fx:id="nodesButton" styleClass="toolbar-button" text="Nodes" />
|
<JFXButton fx:id="nodesButton" styleClass="toolbar-button" text="Nodes" />
|
||||||
<JFXButton fx:id="devicesButton" styleClass="toolbar-button" text="Devices" />
|
<JFXButton fx:id="devicesButton" styleClass="toolbar-button" text="Devices" />
|
||||||
<JFXButton fx:id="drawingButton" styleClass="toolbar-button" />
|
<JFXButton fx:id="drawingButton" styleClass="toolbar-button" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue