use of javafx.scene.control.MenuItem in project jgnash by ccavanaugh.
the class TestFxPlugin method start.
@Override
public void start(final PluginPlatform pluginPlatform) {
System.out.println("Starting test plugin");
if (pluginPlatform != PluginPlatform.Fx) {
throw new RuntimeException("Invalid platform");
}
Platform.runLater(() -> {
//for API test. Lookup allows plugins to find nodes within the application scene
final Node node = MainView.getInstance().lookup("#fileMenu");
if (node != null) {
System.out.println("found the file menu");
// Not really a node, but the skin for the node,
System.out.println(node.getClass().toString());
}
assert MainView.getInstance().lookup("#importMenu") != null;
// Install a menu item
final MenuBar menuBar = MainView.getInstance().getMenuBar();
menuBar.getMenus().stream().filter(menu -> menu.getId().equals("fileMenu")).forEach(menu -> {
System.out.println("found the file menu");
menu.getItems().add(new MenuItem("Plugin Menu"));
});
});
}
use of javafx.scene.control.MenuItem in project jgnash by ccavanaugh.
the class PopOverButton method setContentNode.
/**
* Sets the value of the content property.
*
* @param content the new content node value
*/
public final void setContentNode(final Node content) {
contentNode.set(content);
final VBox vBox = new VBox(5);
vBox.setAlignment(Pos.CENTER);
vBox.getChildren().setAll(content);
final MenuItem menuItem = new MenuItem();
menuItem.setGraphic(vBox);
getItems().setAll(menuItem);
}
use of javafx.scene.control.MenuItem in project jgnash by ccavanaugh.
the class Mt940Plugin method installFxMenu.
private static void installFxMenu() {
final MenuBar menuBar = MainView.getInstance().getMenuBar();
menuBar.getMenus().stream().filter(menu -> "fileMenu".equals(menu.getId())).forEach(menu -> menu.getItems().stream().filter(menuItem -> menuItem instanceof Menu).filter(menuItem -> "importMenu".equals(menuItem.getId())).forEach(menuItem -> {
final MenuItemEx importMenuItem = new MenuItemEx(ResourceUtils.getString("Menu.ImportMt940.Name"));
importMenuItem.setOnAction(event -> ImportMt940FxAction.showAndWait());
((Menu) menuItem).getItems().add(MENU_INDEX, importMenuItem);
}));
}
Aggregations