Search in sources :

Example 6 with ContextMenu

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

the class DaoWizardViewController method tbMappingsContextMenu.

private void tbMappingsContextMenu() {
    MenuItem menuToVoEditor = new MenuItem("To VO Editor");
    menuToVoEditor.setOnAction(this::menuToVoEditorOnAction);
    // 사실 이 항목은 필요없을것같음.
    // MenuItem addMenuItem = new MenuItem("Add");
    // addMenuItem.setOnAction(this::addMenuParamOnAction);
    // MenuItem deleteMenuItem = new MenuItem("Delete");
    // deleteMenuItem.setOnAction(this::deleteMenuParamOnAction);
    tbMappings.setContextMenu(new ContextMenu(menuToVoEditor));
}
Also used : MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu) CommonsContextMenu(com.kyj.fx.voeditor.visual.component.CommonsContextMenu)

Example 7 with ContextMenu

use of javafx.scene.control.ContextMenu 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 8 with ContextMenu

use of javafx.scene.control.ContextMenu 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 9 with ContextMenu

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

the class SqlPane method createTreeContextMenu.

/**
	 * 컨텍스트 메뉴 생성 및 기능 적용
	 *
	 *
	 * 2016-10-27 키 이벤트를 setAccelerator를 사용하지않고 이벤트 방식으로 변경 이유 : 도킹기능을 적용하하면
	 * setAccelerator에 등록된 이벤트가 호출안됨
	 *
	 * @param schemaTree2
	 */
private void createTreeContextMenu(TreeView<K> schemaTree) {
    MenuItem menuSelectScript = new MenuItem("Select Script");
    menuSelectScript.setOnAction(this::applySelectScript);
    MenuItem menuUpdateScript = new MenuItem("Update Script");
    menuUpdateScript.setOnAction(this::applyUpdateScript);
    MenuItem menuDeleteScript = new MenuItem("Delete Script");
    menuDeleteScript.setOnAction(this::applyDeleteSelectScript);
    MenuItem menuInsertScript = new MenuItem("Insert Script");
    menuInsertScript.setOnAction(this::applyInsertScript);
    Menu menu = new Menu("Script", null, menuSelectScript, menuUpdateScript, menuDeleteScript, menuInsertScript);
    // MenuItem menuPrimaryKeys = new MenuItem("Primary Keys");
    MenuItem menuShowData = new MenuItem("Show 100 rows [F1]");
    menuShowData.setOnAction(this::show100RowAction);
    MenuItem menuEditShowData = new MenuItem("Show Editable View  [CTRL + F1]");
    menuEditShowData.setOnAction(this::menuEditShowDataAction);
    MenuItem menuFindTable = new MenuItem("Find Table [CTRL + SHIFT + R]");
    // menuFindTable.setAccelerator(new KeyCodeCombination(KeyCode.R,
    // KeyCombination.CONTROL_DOWN));
    menuFindTable.setOnAction(this::showFileTableOnAction);
    MenuItem menuProperties = new MenuItem("Properties");
    menuProperties.setOnAction(this::showProperties);
    MenuItem menuReflesh = new MenuItem("Reflesh [F5]");
    // menuReflesh.setOnAction(this::menuRefleshOnAction);
    menuReflesh.setAccelerator(new KeyCodeCombination(KeyCode.F5));
    ContextMenu contextMenu = new ContextMenu(menu, menuShowData, menuEditShowData, menuFindTable, menuProperties, new SeparatorMenuItem(), menuReflesh);
    schemaTree.setContextMenu(contextMenu);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) ContextMenu(javafx.scene.control.ContextMenu) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 10 with ContextMenu

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

the class CommonsContextMenu method addMenus.

/**
	 * 컨텍스트 메뉴 추가.
	 *
	 * @Date 2015. 10. 14.
	 * @param tableView
	 * @param mode
	 *            Menus 클래스 참고
	 * @return
	 * @User KYJ
	 */
public static void addMenus(Control node, int mode) {
    ContextMenu contextMenu = new ContextMenu();
    if (Menus.isAdd(mode)) {
        contextMenu.getItems().add(addMenuEvent(node));
    }
    if (Menus.isDelete(mode)) {
        contextMenu.getItems().add(deleteMenuEvent(node));
    }
    if (Menus.isUp(mode)) {
        contextMenu.getItems().add(upMenuEvent(node));
    }
    if (Menus.isDown(mode)) {
        contextMenu.getItems().add(downMenuEvent(node));
    }
    node.setContextMenu(contextMenu);
}
Also used : ContextMenu(javafx.scene.control.ContextMenu)

Aggregations

ContextMenu (javafx.scene.control.ContextMenu)35 MenuItem (javafx.scene.control.MenuItem)31 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)12 Menu (javafx.scene.control.Menu)6 Node (javafx.scene.Node)5 File (java.io.File)3 List (java.util.List)3 FXML (javafx.fxml.FXML)3 Scene (javafx.scene.Scene)3 Label (javafx.scene.control.Label)3 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)3 Stage (javafx.stage.Stage)3 CommonsContextMenu (com.kyj.fx.voeditor.visual.component.CommonsContextMenu)2 JavaTextArea (com.kyj.fx.voeditor.visual.component.text.JavaTextArea)2 SqlKeywords (com.kyj.fx.voeditor.visual.component.text.SqlKeywords)2 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)2 IOException (java.io.IOException)2 Collectors (java.util.stream.Collectors)2 ObservableList (javafx.collections.ObservableList)2 ActionEvent (javafx.event.ActionEvent)2