Search in sources :

Example 11 with MenuItem

use of javafx.scene.control.MenuItem in project Gargoyle by callakrsos.

the class DAOLoaderController method menuHistoryOnAction.

/**
	 * 히스토리 이력을 살펴보는경우 사용
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 11. 6.
	 * @param event
	 */
public void menuHistoryOnAction(ActionEvent event) {
    Map<String, Object> selectedItem = tbSrchDao.getSelectionModel().getSelectedItem();
    if (selectedItem == null)
        return;
    String packageName = ValueUtil.emptyThan(selectedItem.get("PACKAGE_NAME"), "").toString();
    String className = ValueUtil.emptyThan(selectedItem.get("CLASS_NAME"), "").toString();
    // Stage primaryStage = SharedMemory.getPrimaryStage();
    Map<String, Object> paramMap = new HashMap<>();
    paramMap.put("packageName", packageName);
    paramMap.put("className", className);
    try {
        List<TbmSysDaoMethodsHDVO> select = listHistoryItems(paramMap);
        CommonsBaseGridView<TbmSysDaoMethodsHDVO> commonsBaseGridView = new CommonsBaseGridView<>(TbmSysDaoMethodsHDVO.class, select);
        TableViewSelectionModel<TbmSysDaoMethodsHDVO> selectionModel = commonsBaseGridView.getSelectionModel();
        selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
        BorderPane borderPane = new BorderPane();
        Label value = new Label("History");
        value.setStyle("-fx-font-size:75px");
        borderPane.setTop(value);
        SqlKeywords sqlKeyword = new SqlKeywords();
        borderPane.setBottom(sqlKeyword);
        SplitPane splitPane = new SplitPane(commonsBaseGridView, sqlKeyword);
        splitPane.setOrientation(Orientation.VERTICAL);
        borderPane.setCenter(splitPane);
        commonsBaseGridView.setOnMouseClicked(ev -> {
            if (ev.getClickCount() == 2) {
                try {
                    TbmSysDaoMethodsHDVO selectedItem2 = commonsBaseGridView.getSelectionModel().getSelectedItem();
                    String histTsp = selectedItem2.getHistTsp();
                    String sqlBody = getSqlBody(histTsp);
                    sqlKeyword.setContent(sqlBody);
                } catch (Exception e) {
                    LOGGER.error(ValueUtil.toString(e));
                }
            }
        });
        MenuItem compare = new MenuItem("Compare.");
        compare.setDisable(true);
        compare.setOnAction(ev -> {
            ObservableList<TbmSysDaoMethodsHDVO> selectedItems = commonsBaseGridView.getSelectionModel().getSelectedItems();
            if (selectedItems.size() == 2) {
                compare(selectedItems.get(0), selectedItems.get(1));
            }
        });
        ContextMenu historyContextMenu = new ContextMenu(compare);
        historyContextMenu.setOnShowing(ev -> {
            if (selectionModel.getSelectedItems().size() == 2) {
                compare.setDisable(false);
            } else {
                compare.setDisable(true);
            }
        });
        commonsBaseGridView.setContextMenu(historyContextMenu);
        Scene scene = new Scene(borderPane);
        Stage stage = new Stage();
        stage.initOwner(SharedMemory.getPrimaryStage());
        stage.setScene(scene);
        stage.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SqlKeywords(com.kyj.fx.voeditor.visual.component.text.SqlKeywords) BorderPane(javafx.scene.layout.BorderPane) HashMap(java.util.HashMap) Label(javafx.scene.control.Label) TbmSysDaoMethodsHDVO(com.kyj.fx.voeditor.visual.main.model.vo.TbmSysDaoMethodsHDVO) MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu) SplitPane(javafx.scene.control.SplitPane) Scene(javafx.scene.Scene) CommonsBaseGridView(com.kyj.fx.voeditor.visual.component.grid.CommonsBaseGridView) Stage(javafx.stage.Stage)

Example 12 with MenuItem

use of javafx.scene.control.MenuItem in project jabref by JabRef.

the class GroupTreeController method createContextMenuForGroup.

private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) {
    ContextMenu menu = new ContextMenu();
    MenuItem editGroup = new MenuItem(Localization.lang("Edit group"));
    editGroup.setOnAction(event -> {
        menu.hide();
        viewModel.editGroup(group);
    });
    MenuItem addSubgroup = new MenuItem(Localization.lang("Add subgroup"));
    addSubgroup.setOnAction(event -> {
        menu.hide();
        viewModel.addNewSubgroup(group);
    });
    MenuItem removeGroupAndSubgroups = new MenuItem(Localization.lang("Remove group and subgroups"));
    removeGroupAndSubgroups.setOnAction(event -> viewModel.removeGroupAndSubgroups(group));
    MenuItem removeGroupKeepSubgroups = new MenuItem(Localization.lang("Remove group, keep subgroups"));
    removeGroupKeepSubgroups.setOnAction(event -> viewModel.removeGroupKeepSubgroups(group));
    MenuItem removeSubgroups = new MenuItem(Localization.lang("Remove subgroups"));
    removeSubgroups.setOnAction(event -> viewModel.removeSubgroups(group));
    MenuItem addEntries = new MenuItem(Localization.lang("Add selected entries to this group"));
    addEntries.setOnAction(event -> viewModel.addSelectedEntries(group));
    MenuItem removeEntries = new MenuItem(Localization.lang("Remove selected entries from this group"));
    removeEntries.setOnAction(event -> viewModel.removeSelectedEntries(group));
    MenuItem sortAlphabetically = new MenuItem(Localization.lang("Sort all subgroups (recursively)"));
    sortAlphabetically.setOnAction(event -> viewModel.sortAlphabeticallyRecursive(group));
    menu.getItems().add(editGroup);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().addAll(addSubgroup, removeSubgroups, removeGroupAndSubgroups, removeGroupKeepSubgroups);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().addAll(addEntries, removeEntries);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().add(sortAlphabetically);
    return menu;
}
Also used : ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 13 with MenuItem

use of javafx.scene.control.MenuItem in project jabref by JabRef.

the class EditorMenus method getNameMenu.

public static List<MenuItem> getNameMenu(TextArea textArea) {
    MenuItem normalizeNames = new MenuItem(Localization.lang("Normalize to BibTeX name format"));
    //normalizeNames.setTooltip(Localization.lang("If possible, normalize this list of names to conform to standard BibTeX name formatting"))
    normalizeNames.setOnAction(event -> textArea.setText(new NormalizeNamesFormatter().format(textArea.getText())));
    return Collections.singletonList(normalizeNames);
}
Also used : NormalizeNamesFormatter(org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) MenuItem(javafx.scene.control.MenuItem)

Example 14 with MenuItem

use of javafx.scene.control.MenuItem in project jabref by JabRef.

the class EditorMenus method getDOIMenu.

public static List<MenuItem> getDOIMenu(TextArea textArea) {
    AbstractAction copyDoiUrlAction = new CopyDoiUrlAction(textArea);
    MenuItem copyDoiUrlMenuItem = new MenuItem((String) copyDoiUrlAction.getValue(Action.NAME));
    copyDoiUrlMenuItem.setOnAction(event -> copyDoiUrlAction.actionPerformed(null));
    List<MenuItem> menuItems = new ArrayList<>();
    menuItems.add(copyDoiUrlMenuItem);
    menuItems.add(new SeparatorMenuItem());
    return menuItems;
}
Also used : ArrayList(java.util.ArrayList) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) AbstractAction(javax.swing.AbstractAction) CopyDoiUrlAction(org.jabref.gui.actions.CopyDoiUrlAction)

Example 15 with MenuItem

use of javafx.scene.control.MenuItem in project jabref by JabRef.

the class ProtectedTermsMenu method updateFiles.

private void updateFiles() {
    externalFiles.getItems().clear();
    for (ProtectedTermsList list : Globals.protectedTermsLoader.getProtectedTermsLists()) {
        if (!list.isInternalList()) {
            MenuItem fileItem = new MenuItem(list.getDescription());
            fileItem.setOnAction(event -> {
                String selectedText = opener.getSelectedText();
                if ((selectedText != null) && !selectedText.isEmpty()) {
                    list.addProtectedTerm(selectedText);
                }
            });
            externalFiles.getItems().add(fileItem);
        }
    }
    externalFiles.getItems().add(new SeparatorMenuItem());
    MenuItem addToNewFileItem = new MenuItem(Localization.lang("New") + "...");
    addToNewFileItem.setOnAction(event -> {
        NewProtectedTermsFileDialog dialog = new NewProtectedTermsFileDialog(JabRefGUI.getMainFrame(), Globals.protectedTermsLoader);
        dialog.setVisible(true);
        if (dialog.isOKPressed()) {
            Globals.prefs.setProtectedTermsPreferences(Globals.protectedTermsLoader);
        }
    });
    externalFiles.getItems().add(addToNewFileItem);
}
Also used : ProtectedTermsList(org.jabref.logic.protectedterms.ProtectedTermsList) NewProtectedTermsFileDialog(org.jabref.gui.protectedterms.NewProtectedTermsFileDialog) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Aggregations

MenuItem (javafx.scene.control.MenuItem)133 ContextMenu (javafx.scene.control.ContextMenu)72 Menu (javafx.scene.control.Menu)41 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)41 ActionEvent (javafx.event.ActionEvent)30 File (java.io.File)23 VBox (javafx.scene.layout.VBox)21 List (java.util.List)20 Scene (javafx.scene.Scene)20 ArrayList (java.util.ArrayList)19 Label (javafx.scene.control.Label)19 Collectors (java.util.stream.Collectors)16 MenuBar (javafx.scene.control.MenuBar)15 ObservableList (javafx.collections.ObservableList)13 IOException (java.io.IOException)12 EventHandler (javafx.event.EventHandler)12 Button (javafx.scene.control.Button)12 FXCollections (javafx.collections.FXCollections)11 ImageView (javafx.scene.image.ImageView)11 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)11