use of javafx.scene.control.ContextMenu in project completable-reactor by ru-fix.
the class ProcessorNode method initializePopupMenu.
void initializePopupMenu() {
ContextMenu contextMenu = buildTooltipContent();
this.setOnContextMenuRequested(contextMenuEvent -> {
contextMenu.show(this, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY());
contextMenuEvent.consume();
});
}
use of javafx.scene.control.ContextMenu in project completable-reactor by ru-fix.
the class StartPointNode method initializePopupMenu.
void initializePopupMenu() {
ContextMenu contextMenu = new ContextMenu();
MenuItem documentationMenuItem = new MenuItem();
documentationMenuItem.setGraphic(buildTooltipContent());
contextMenu.getItems().add(documentationMenuItem);
documentationMenuItem.setOnAction(event -> {
fireGoToSourceEvent();
});
this.setOnContextMenuRequested(contextMenuEvent -> {
contextMenu.show(this, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY());
contextMenuEvent.consume();
});
}
use of javafx.scene.control.ContextMenu in project completable-reactor by ru-fix.
the class SubgraphNode method buildTooltipContent.
ContextMenu buildTooltipContent() {
ContextMenu contextMenu = new ContextMenu();
MenuItem processorMenuItem = new MenuItem();
VBox processorContent = new VBox();
processorMenuItem.setGraphic(processorContent);
processorMenuItem.setOnAction(event -> actionListener.goToSource(this.subgraph.getBuildSource()));
contextMenu.getItems().add(processorMenuItem);
processorContent.getChildren().add(new Text(serialize(this.subgraph.getIdentity())));
Optional.ofNullable(subgraph.subgraphDoc).map(doc -> new Text(Arrays.stream(doc).collect(Collectors.joining("\n")))).ifPresent(processorContent.getChildren()::add);
return contextMenu;
}
use of javafx.scene.control.ContextMenu in project completable-reactor by ru-fix.
the class TransitionLine method initializePopupMenu.
void initializePopupMenu() {
val contextMenu = buildTooltipContent();
EventHandler<ContextMenuEvent> contextMenuHandler = contextMenuEvent -> {
contextMenu.show(line, contextMenuEvent.getScreenX(), contextMenuEvent.getScreenY());
contextMenuEvent.consume();
};
labelsPane.setOnContextMenuRequested(contextMenuHandler);
pointer.setOnContextMenuRequested(contextMenuHandler);
line.setOnContextMenuRequested(contextMenuHandler);
menuArea.setOnContextMenuRequested(contextMenuHandler);
}
use of javafx.scene.control.ContextMenu in project completable-reactor by ru-fix.
the class TransitionLine method buildTooltipContent.
ContextMenu buildTooltipContent() {
// documentation
Map<String, String[]> mergeStatusDocumentation = new HashMap<>();
this.transition.map(transitionItem -> transitionItem.mergeStatuses).ifPresent(statuses -> statuses.forEach(status -> mergeStatusDocumentation.put(status, new String[] {})));
this.transition.map(transitionItem -> transitionItem.transitionsDoc).ifPresent(docs -> docs.forEach(doc -> {
mergeStatusDocumentation.put(doc.mergeStatus, doc.docs);
}));
// menu controls
ContextMenu contextMenu = new ContextMenu();
for (String status : mergeStatusDocumentation.keySet()) {
VBox content = new VBox();
MenuItem documentationMenuItem = new MenuItem();
documentationMenuItem.setGraphic(content);
contextMenu.getItems().add(documentationMenuItem);
this.transition.map(transitionItem -> transitionItem.transitionOnStatusSource).map(onStatusSources -> onStatusSources.get(status)).ifPresent(source -> documentationMenuItem.setOnAction(event -> actionListener.goToSource(source)));
// menu item content
content.getChildren().add(new Text(status));
Optional.ofNullable(mergeStatusDocumentation.get(status)).map(statusDocs -> new Text(Arrays.stream(statusDocs).collect(Collectors.joining("\n")))).ifPresent(content.getChildren()::add);
}
if (this.transition.isPresent()) {
ReactorGraphModel.Transition transitionItem = this.transition.get();
if (transitionItem.isOnAny) {
MenuItem onAnyMenuItem = new MenuItem();
VBox content = new VBox();
onAnyMenuItem.setGraphic(content);
content.getChildren().add(new Text("<Any>"));
content.getChildren().add(new Text("Transition activated by any status."));
contextMenu.getItems().add(onAnyMenuItem);
ReactorGraphModel.Source source = transitionItem.transitionOnAnySource;
if (source != null) {
onAnyMenuItem.setOnAction(event -> {
actionListener.goToSource(source);
});
}
}
}
return contextMenu;
}
Aggregations