Java 类javafx.scene.control.Menu 实例源码

项目:Vokabeltrainer    文件:Main.java   
@Override
    public void start(Stage stage) {
        stage.setTitle("Vokabeltrainer");
        Scene scene = new Scene(new VBox(), 400, 350);
        scene.setFill(Color.OLDLACE);

        MenuBar menuBar = new MenuBar();

        // --- Menu File
        Menu menuFile = new Menu("Vokabeln");

        MenuItem sample = new MenuItem("Sample");
        sample.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
//              Do stuff here
            }
        });

        menuFile.getItems().add(sample);

        // --- Menu Edit
        Menu menuEdit = new Menu("Abfragemodus");

        // --- Menu View
        Menu menuView = new Menu("Statistik");

        menuBar.getMenus().addAll(menuFile, menuEdit, menuView);


        ((VBox) scene.getRoot()).getChildren().addAll(menuBar);

        stage.setScene(scene);
        stage.show();
    }
项目:Suji    文件:Main.java   
private Menu getOGSMenu() {
    Menu ogsMenu = new Menu("OGS");

    MenuItem ogsGameList = new MenuItem("Game List");
    ogsGameList.setOnAction(event -> {
        GameListController controller = new GameListController();

        DockNode node = controller.getDockNode();
        node.setTitle("OGS GameList");
        node.dock(dockPane, DockPos.RIGHT);
    });

    ogsMenu.getItems().add(ogsGameList);

    return ogsMenu;
}
项目:titanium    文件:MainPane.java   
private Menu getWSMenu() {
    Menu result = new Menu("WSP");

    MenuItem editWSPItem = new MenuItem("Edit WSP...", AssetsLoader.getIcon("edit.png"));
    MenuItem connectItem = new MenuItem("Sign in...", AssetsLoader.getIcon("discord_icon.png"));
    orgManagerItem = new MenuItem("Organization manager...", AssetsLoader.getIcon("wsp_icon.png"));

    orgManagerItem.setDisable(true);

    connectItem.setOnAction(this::connectToWSPAction);
    editWSPItem.setOnAction(this::editWSPAction);
    orgManagerItem.setOnAction(this::organizationManagerAction);

    result.getItems().add(connectItem);
    result.getItems().add(orgManagerItem);
    result.getItems().add(editWSPItem);

    cam.getWspConnectionRequiredMenuItems().add(orgManagerItem);

    cam.getWspNotConnectedRequiredMenuItems().add(connectItem);
    cam.getWspNotConnectedRequiredMenuItems().add(editWSPItem);

    return result;
}
项目:hygene    文件:MenuControllerTest.java   
@SuppressWarnings("unchecked") // needed for the mocking of ObservableList<MenuItem>
@Test
void testPopulateRecentFilesMenu() throws UIInitialisationException, IOException {
    // Clean up file history (not in a global @BeforeEach, due to this test being the only test requiring it)
    RecentFiles.reset();

    final Menu recentFilesMenuMock = mock(Menu.class);
    when(recentFilesMenuMock.getItems()).thenReturn((ObservableList<MenuItem>) mock(ObservableList.class));

    // Add one test-file
    RecentFiles.add(new File("test.gfa"));

    menuController.setRecentFilesMenu(recentFilesMenuMock);
    menuController.populateRecentFilesMenu();

    verify(recentFilesMenuMock.getItems()).add(any(MenuItem.class));

    // Clean up file history
    RecentFiles.reset();
}
项目:marathonv5    文件:JavaFXMenuBarElement.java   
@Override public boolean marathon_select(String value) {
    MenuBar menuBar = (MenuBar) node;
    ObservableList<Menu> menus = menuBar.getMenus();
    String[] items = value.split("\\>\\>");
    Menu parentMenu = getParentMenu(menus, items[0]);
    List<MenuItem> menuItems = new ArrayList<>();
    for (int i = 1; i < items.length; i++) {
        getChidernMenuItem(parentMenu, items[i], menuItems);
    }
    parentMenu.fire();
    menuItems.stream().forEach((menu) -> {
        if (menu instanceof CheckMenuItem) {
            CheckMenuItem checkMenuItem = (CheckMenuItem) menu;
            checkMenuItem.setSelected(!checkMenuItem.isSelected());
        } else if (menu instanceof RadioMenuItem) {
            RadioMenuItem radioMenuItem = (RadioMenuItem) menu;
            radioMenuItem.setSelected(!isSelected());
        }
        menu.fire();
    });
    return true;
}
项目:marathonv5    文件:RFXMenuItem.java   
private String getTagForMenu(MenuItem source) {
    LinkedList<MenuItem> menuItems = new LinkedList<>();
    while (source != null) {
        menuItems.addFirst(source);
        source = source.getParentMenu();
    }
    if (menuItems.getFirst() instanceof Menu) {
        if (menuItems.size() >= 2) {
            ownerNode = menuItems.get(1).getParentPopup().getOwnerNode();
            return isMenuBar(ownerNode) ? "#menu" : "#contextmenu";
        }
    } else {
        ownerNode = menuItems.getFirst().getParentPopup().getOwnerNode();
        return "#contextmenu";
    }
    return null;
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void menuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem("Clear");
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void menuItemIconNoText() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem();
        clear.setGraphic(new ImageView(RFXTabPaneTest.imgURL.toString()));
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>middle", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void subMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuEdit = new Menu("Edit");
        Menu menuEffect = new Menu("Picture Effect");

        final MenuItem noEffects = new MenuItem("No Effects");

        menuEdit.getItems().addAll(menuEffect, noEffects);
        MenuItem add = new MenuItem("Shuffle");
        menuEffect.getItems().addAll(add);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(add));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Edit>>Picture Effect>>Shuffle", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void specialChars() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuView = new Menu("View");
        CheckMenuItem titleView = createMenuItem("Tit>le");
        CheckMenuItem binNameView = createMenuItem("Binomial name");
        CheckMenuItem picView = createMenuItem("Picture");
        CheckMenuItem descriptionView = createMenuItem("Decsription");

        menuView.getItems().addAll(titleView, binNameView, picView, descriptionView);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(titleView));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("View>>Tit\\>le", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void duplicateMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");

        MenuItem clear = new MenuItem("Clear");
        MenuItem clear1 = new MenuItem("Clear");
        MenuItem clear2 = new MenuItem("Clear");

        MenuItem exit = new MenuItem("Exit");

        menuFile.getItems().addAll(add, clear, clear1, clear2, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear2));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear(2)", path.get(0));
}
项目:jmonkeybuilder    文件:SpatialTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
                            @NotNull final ObservableList<MenuItem> items) {
    if (!(nodeTree instanceof ModelNodeTree)) return;

    final T element = getElement();
    final AssetLinkNode linkNode = findParent(element, AssetLinkNode.class::isInstance);

    if (linkNode == null) {
        final Menu createMenu = createCreationMenu(nodeTree);
        if (createMenu != null) items.add(createMenu);
        final Menu toolMenu = createToolMenu(nodeTree);
        if (toolMenu != null) items.add(toolMenu);
    }

    if (linkNode == null || element == linkNode) {
        items.add(new AddUserDataAction(nodeTree, this));
    }

    if (canRemove()) {
        items.add(new RemoveNodeAction(nodeTree, this));
    }

    super.fillContextMenu(nodeTree, items);
}
项目:MineIDE    文件:MenuManagement.java   
public void addMenu(final String name, final MenuCategory... menuCats)
{
    final Menu newItem = new MenuTranslate(name);

    // add menus
    for (final MenuCategory mc : menuCats)
        // check if category is not empty
        if (mc.getItems().size() > 0)
        {
            // add a separator
            if (newItem.getItems().size() != 0)
                newItem.getItems().add(new SeparatorMenuItem());
            // add all menu items
            newItem.getItems().addAll(mc.getItems());
        }

    this.listMenu.add(newItem);
    this.menu.getMenus().add(newItem);
}
项目:atbash-octopus    文件:ApplicationMenu.java   
public void initialize() {
    MenuBar menuBar = new MenuBar();
    // Make same width as the stage
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    rootPane.setTop(menuBar);

    // File menu - new, save, exit
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = createMenuItem("New", actionEvent -> this.onNewFile());

    MenuItem openMenuItem = createMenuItem("Open", actionEvent -> this.onOpenFile());

    MenuItem saveMenuItem = createMenuItem("Save", actionEvent -> this.onSaveFile());
    saveMenuItem.disableProperty().bind(jwkSetData.changedProperty().not());

    MenuItem exitMenuItem = createMenuItem("Exit", actionEvent -> Platform.exit());

    fileMenu.getItems().addAll(newMenuItem, openMenuItem, saveMenuItem,
            new SeparatorMenuItem(), exitMenuItem);

    menuBar.getMenus().addAll(fileMenu);
}
项目:javafx-qiniu-tinypng-client    文件:MainView.java   
@Override
protected void onViewCreated() {
    siderBarView.setOnItemSelectedListener(contentView::loadBucket);
    contentView.setOnItemSelectedListener(this::updateSelectItem);
    contentView.setUpdateListener(bucketFile -> {
        if (Platform.isFxApplicationThread()) {
            updateSelectItem(bucketFile);
        } else {
            runOnUiThread(() -> this.updateSelectItem(bucketFile));
        }
    });

    // 初始化菜单
    Menu setting = new Menu("设置");
    setting.getItems().add(getMenuItem("TinyPNG", "tinypng"));
    setting.getItems().add(getMenuItem("七牛", "qiniu"));
    setting.getItems().add(getMenuItem("Gif", "gif"));

    Menu about = new Menu("关于");
    about.getItems().add(getMenuItem("关于BlogHelper", "aboutBlogHelper"));
    about.getItems().add(getMenuItem("关于作者cmlanche", "aboutAnchor"));

    menuBar.getMenus().add(setting);
    menuBar.getMenus().add(about);

    if (PlatformUtil.isMac()) {
        menuBar.setUseSystemMenuBar(true);
    }

    // 操作按钮
    downloadBtn.setOnAction(event -> contentView.handleAction("download"));
    renameBtn.setOnAction(event -> contentView.handleAction("rename"));
    deleteBtn.setOnAction(event -> contentView.handleAction("delete"));
    optimizeBtn.setOnAction(event -> contentView.handleAction("optimize"));
    uploadBtn.setOnAction(event -> contentView.handleAction("upload"));
}
项目:WebPLP    文件:PLPToolMenuBarPanel.java   
public PLPToolMenuBarPanel(Controller controller)
{
    this.controller = controller;
    MenuBar menuBar = new MenuBar();

    Menu file = createFileMenu();
    Menu edit = createEditMenu();
    Menu view = createViewMenu();
    Menu project = createProjectMenu();
    Menu tools = createToolsMenu();
    Menu simulation = createSimulationMenu();
    Menu help = createHelpMenu();

    menuBar.getMenus().addAll(file, edit, view, project, tools, simulation, help);
    this.setCenter(menuBar);
}
项目:CalendarFX    文件:ContextMenuProvider.java   
/**
 * Returns the context menu specific for a single {@link WeekDayView}. Week
 * day views are used inside a {@link WeekView}.
 *
 * @param param
 *            parameter object with the most relevant information for
 *            creating a new context menu
 * @return a context menu for a week day view
 */
protected ContextMenu getWeekDayViewMenu(ContextMenuParameter param) {
    ContextMenu contextMenu = getDayViewBaseMenu(param);

    WeekDayView weekDayView = (WeekDayView) param.getDateControl();
    WeekView weekView = weekDayView.getWeekView();
    Menu daysMenu = new Menu(Messages.getString("ContextMenuProvider.SHOW_DAYS")); //$NON-NLS-1$
    int[] days = new int[]{5, 7, 14, 21, 28};
    for (int d : days) {
        String itemText = MessageFormat.format(Messages.getString("ContextMenuProvider.DAYS"), d); //$NON-NLS-1$
        MenuItem item = new MenuItem(itemText);
        item.setOnAction(evt -> weekView.setNumberOfDays(d));
        daysMenu.getItems().add(item);
    }

    contextMenu.getItems().add(daysMenu);

    return contextMenu;
}
项目:GazePlay    文件:Utils.java   
public static MenuBar buildLicence() {
    ClassLoader classLoader = ClassLoader.getSystemClassLoader();
    String licenseFileAsString = loadLicenseFileAsString(classLoader);

    MenuItem licenseMenuItem = new MenuItem(licenseFileAsString);

    Menu menu = new Menu("GazePlay");
    menu.getItems().add(licenseMenuItem);

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().addAll(menu);
    menuBar.setPrefHeight(40);
    menuBar.setPrefWidth(80);

    return menuBar;
}
项目:can4eve    文件:JavaFXDisplay.java   
/**
 * create the Menu Bar
 * 
 * @param scene
 */
public MenuBar createMenuBar(Scene scene, com.bitplan.gui.App app) {
  MenuBar lMenuBar = new MenuBar();
  for (com.bitplan.gui.Menu amenu : app.getMainMenu().getSubMenus()) {
    Menu menu = new Menu(i18n(amenu.getId()));
    lMenuBar.getMenus().add(menu);
    for (com.bitplan.gui.MenuItem amenuitem : amenu.getMenuItems()) {
      MenuItem menuItem = new MenuItem(i18n(amenuitem.getId()));
      menuItem.setOnAction(this);
      menuItem.setId(amenuitem.getId());
      menu.getItems().add(menuItem);
    }
  }

  hideMenuButton = new Button(I18n.get(I18n.HIDE_MENU));
  hideMenuButton.setOnAction(new EventHandler<ActionEvent>() {
    @Override
    public void handle(ActionEvent e) {
      showMenuBar(scene, lMenuBar, !lMenuBar.isVisible());
    }
  });
  return lMenuBar;
}
项目:cassandra-client    文件:CassandraClientUIConfiguration.java   
@Bean
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public Menu fileMenu() {
    Menu file = new Menu(localeService.getMessage("ui.menu.file"));
    file.setMnemonicParsing(false);

    MenuItem connect = new MenuItem(localeService.getMessage("ui.menu.file.connect"));
    connect.setMnemonicParsing(false);
    connect.setOnAction(event -> newConnectionBox(getMainView().getPrimaryStage(),
            (data) -> getMainController().loadTables(data)));

    MenuItem manager = new MenuItem(localeService.getMessage("ui.menu.file.manager"));
    manager.setMnemonicParsing(false);
    manager.setOnAction(event -> connectionManager());
    file.getItems().addAll(connect, manager);
    return file;
}
项目:jmonkeybuilder    文件:PhysicsObjectTreeNode.java   
@Override
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree,
                            @NotNull final ObservableList<MenuItem> items) {

    final Menu changeShapeMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CHANGE_COLLISION_SHAPE, new ImageView(Icons.ADD_12));
    changeShapeMenu.getItems().addAll(new GenerateCollisionShapeAction(nodeTree, this),
            new CreateBoxCollisionShapeAction(nodeTree, this),
            new CreateCapsuleCollisionShapeAction(nodeTree, this),
            new CreateConeCollisionShapeAction(nodeTree, this),
            new CreateCylinderCollisionShapeAction(nodeTree, this),
            new CreateSphereCollisionShapeAction(nodeTree, this));

    items.add(changeShapeMenu);

    super.fillContextMenu(nodeTree, items);
}
项目:jmonkeybuilder    文件:Toneg0DParticleInfluencersTreeNode.java   
@Override
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {

    final Toneg0dParticleInfluencers element = getElement();
    final ParticleEmitterNode emitterNode = element.getEmitterNode();

    final Menu createMenu = new Menu(Messages.MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
    final ObservableList<MenuItem> createItems = createMenu.getItems();

    CONSTRUCTORS.forEach((type, constructor) -> {
        if (emitterNode.getInfluencer(type) != null) return;
        createItems.add(newInstance(constructor, nodeTree, this));
    });

    items.add(createMenu);

    super.fillContextMenu(nodeTree, items);
}
项目:Suji    文件:Main.java   
private void buildMenuBar() {
    //file menu, creating the main tabs
    Menu fileMenu = getFileMenu();
    Menu ogsMenu = getOGSMenu();
    Menu settingsMenu = getSettingsMenu();

    //main menu bar
    menuBar = new MenuBar();
    menuBar.getMenus().addAll(fileMenu, ogsMenu, settingsMenu);
}
项目:Suji    文件:Main.java   
private Menu getSettingsMenu() {
    Menu settings = new Menu("Settings");

    MenuItem proxy = new MenuItem("Configure Proxy");
    proxy.setOnAction(event -> {
        DockNode node = (new ProxySettings()).getDockNode();
        node.setTitle("Proxy Settings");
        node.dock(dockPane, DockPos.CENTER);
        node.setFloating(true);
    });

    settings.getItems().add(proxy);

    return settings;
}
项目:jmonkeybuilder    文件:SpatialTreeNode.java   
/**
 * Create creation menu menu.
 *
 * @param nodeTree the node tree
 * @return the menu
 */
@FXThread
protected @Nullable Menu createCreationMenu(@NotNull final NodeTree<?> nodeTree) {

    final T element = getElement();

    final Menu menu = new Menu(MODEL_NODE_TREE_ACTION_CREATE, new ImageView(Icons.ADD_12));
    final Menu createControlsMenu = new Menu(MODEL_NODE_TREE_ACTION_ADD_CONTROL, new ImageView(Icons.ADD_12));

    final ObservableList<MenuItem> items = createControlsMenu.getItems();
    items.add(new CreateCustomControlAction(nodeTree, this));

    if (element.getControl(RigidBodyControl.class) == null) {
        items.add(new CreateStaticRigidBodyControlAction(nodeTree, this));
        items.add(new CreateRigidBodyControlAction(nodeTree, this));
    }

    if (element.getControl(VehicleControl.class) == null) {
        items.add(new CreateVehicleControlAction(nodeTree, this));
    }

    if (element.getControl(CharacterControl.class) == null) {
        items.add(new CreateCharacterControlAction(nodeTree, this));
    }

    if (element.getControl(MotionEvent.class) == null) {
        items.add(new CreateMotionControlAction(nodeTree, this));
    }

    items.add(new CreateLightControlAction(nodeTree, this));

    //final SkeletonControl skeletonControl = element.getControl(SkeletonControl.class);
    //if (skeletonControl != null) {
        //FIXME items.add(new CreateKinematicRagdollControlAction(nodeTree, this));
    //}

    menu.getItems().add(createControlsMenu);

    return menu;
}
项目:titanium    文件:MainPane.java   
private Menu getHelpMenu() {
    Menu result = new Menu("Help");
    MenuItem aboutItem = new MenuItem("About Titanium");

    result.getItems().addAll(aboutItem);

    return result;
}
项目:textmd    文件:ToolBarMenus.java   
public ToolBarMenus(Dictionary dictionary) {
    EDITOR_FILE_MENU = new Menu(dictionary.TOOLBAR_EDITOR_FILE_MENU);
    EDITOR_EDIT_MENU = new Menu(dictionary.TOOLBAR_EDITOR_EDIT_MENU);
    EDITOR_VIEW_MENU = new Menu(dictionary.TOOLBAR_EDITOR_VIEW_MENU);
    EDITOR_HELP_MENU = new Menu(dictionary.TOOLBAR_EDITOR_HELP_MENU);
    EDITOR_EXTENSIONS_MENU = new Menu(dictionary.TOOLBAR_EDITOR_EXTENSIONS_MENU);

    EDITOR_OPEN_SUBMENU = new Menu(dictionary.TOOLBAR_EDITOR_OPEN_MENU);
    EDITOR_IMPORT_SUBMENU = new Menu(dictionary.TOOLBAR_EDITOR_IMPORT_MENU);
    EDITOR_EXPORT_SUBMENU = new Menu(dictionary.TOOLBAR_EDITOR_EXPORT_MENU);
}
项目:jmonkeybuilder    文件:GeometryTreeNode.java   
@Override
protected @Nullable Menu createToolMenu(@NotNull final NodeTree<?> nodeTree) {

    final Menu toolActions = new Menu(Messages.MODEL_NODE_TREE_ACTION_TOOLS, new ImageView(Icons.INFLUENCER_16));
    toolActions.getItems().addAll(new TangentGeneratorAction(nodeTree, this),
                    new GenerateLoDAction(nodeTree, this));

    return toolActions;
}
项目:marathonv5    文件:DisplayWindow.java   
/**
 * Create Menu with new file/folder options
 * 
 * @return
 */
private Menu createNewMenu() {
    Menu newMenu = new Menu("New");
    newMenu.getItems().add(newTestcaseAction.getMenuItem());
    newMenu.getItems().add(etAction.getMenuItem());
    newMenu.getItems().add(newModuleAction.getMenuItem());
    newMenu.getItems().add(newFixtureAction.getMenuItem());
    newMenu.getItems().add(newCheckListAction.getMenuItem());
    newMenu.getItems().add(newModuleDirAction.getMenuItem());
    newMenu.getItems().add(newSuiteFileAction.getMenuItem());
    newMenu.getItems().add(newFeatureFileAction.getMenuItem());
    newMenu.getItems().add(newStoryFileAction.getMenuItem());
    newMenu.getItems().add(newIssueFileAction.getMenuItem());
    return newMenu;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String parentMenuText(ObservableList<Menu> menus, int index) {
    String original = getMenuText(menus, index);
    String itemText = original;
    int suffixIndex = 0;
    for (int i = 0; i < index; i++) {
        String current = getMenuText(menus, i);
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
private String getMenuText(ObservableList<Menu> menus, int index) {
    Menu menu = menus.get(index);
    String text = menu.getText();
    if (text == null || "".equals(text)) {
        return getMenuTextFromIcon(menu, index);
    }
    return text;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
@SuppressWarnings("deprecation") private String getMenuTextFromIcon(Menu menu, int index) {
    Node graphic = menu.getGraphic();
    if (graphic == null || !(graphic instanceof ImageView)) {
        return "menuindex-" + index;
    }
    return nameFromImage(((ImageView) graphic).getImage().impl_getUrl());
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String getTextForMenuItem(MenuItem menuItem, Menu parentMenu) {
    int index = parentMenu.getItems().indexOf(menuItem);
    String original = getMenuItemText(parentMenu, index);
    String itemText = original;
    int suffixIndex = 0;

    for (int i = 0; i < index; i++) {
        String current = getMenuItemText(parentMenu, i);

        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String getMenuItemText(Menu parentMenu, int index) {
    MenuItem menuItem = parentMenu.getItems().get(index);
    String text = menuItem.getText();
    if (text == null || "".equals(text)) {
        return getTextFromIcon(menuItem, index);
    }
    return text;
}
项目:marathonv5    文件:JavaFXMenuBarElement.java   
private void getChidernMenuItem(Menu parentMenu, String items, List<MenuItem> menuItems) {
    ObservableList<MenuItem> children = parentMenu.getItems();
    for (MenuItem menuItem : children) {
        if (menuItem instanceof Menu) {
            getChidernMenuItem((Menu) menuItem, items, menuItems);
        }
        if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem, menuItem.getParentMenu()).equals(items)) {
            menuItems.add(menuItem);
            break;
        }
    }
}
项目:marathonv5    文件:JavaFXMenuBarElement.java   
private Menu getParentMenu(ObservableList<Menu> menus, String menuText) {
    for (Menu menu : menus) {
        if (parentMenuText(menus, menus.indexOf(menu)).equals(menuText)) {
            return menu;
        }
    }
    return null;
}
项目:marathonv5    文件:JavaFXContextMenuElement.java   
private void getChidernMenuItem(ObservableList<MenuItem> children, String items, List<MenuItem> menuItems) {
    for (MenuItem menuItem : children) {
        if (menuItem instanceof Menu) {
            getChidernMenuItem(((Menu) menuItem).getItems(), items, menuItems);
        }
        if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem).equals(items)) {
            menuItems.add(menuItem);
            break;
        }
    }
}
项目:marathonv5    文件:JavaFXContextMenuElement.java   
public String getTextForMenuItem(MenuItem menuItem) {
    Menu parentMenu = menuItem.getParentMenu();
    if (parentMenu == null) {
        String text = menuItem.getText();
        if (text == null || "".equals(text)) {
            return getTextFromIcon(menuItem, -1);
        }
        return text;
    }
    return getTextForMenuItem(menuItem, parentMenu);
}
项目:marathonv5    文件:RFXMenuItem.java   
public String getTextForMenuItem(MenuItem menuItem) {
    Menu parentMenu = menuItem.getParentMenu();
    if (parentMenu == null) {
        if (menuBar != null) {
            ObservableList<Menu> menus = menuBar.getMenus();
            return parentMenuText(menus, menus.indexOf(menuItem));
        }
        String text = menuItem.getText();
        if (text == null || "".equals(text)) {
            return getTextFromIcon(menuItem, -1);
        }
        return text;
    }
    return getTextForMenuItem(menuItem, parentMenu);
}
项目:jmonkeybuilder    文件:EditorMenuBarComponent.java   
@NotNull
private Menu createFileMenu() {

    final Menu menu = new Menu(Messages.EDITOR_MENU_FILE);
    menu.getItems().addAll(new OpenAssetAction(),
            new ReopenAssetMenu(),
            new ExitAction());

    return menu;
}