Search in sources :

Example 21 with ContextMenu

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

the class DatabaseTableView method initialize.

@FXML
void initialize() {
    contextMenuTbModelMst = new ContextMenu();
    txtTableName.setOnKeyReleased(event -> {
        if (KeyCode.ENTER == event.getCode()) {
            String tableName = txtTableName.getText();
            requestTables(tableName);
        }
    });
    btnSearch.setOnMouseClicked(event -> {
        String name = txtTableName.getText();
        String selectedItem = choType.getSelectionModel().getSelectedItem();
        switch(selectedItem) {
            case TYPE_TABLE:
                requestTables(name);
                break;
            case TYPE_VIEW:
                requestViews(name);
        }
    });
    tbMaster.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            tbModelMst.getItems().clear();
            TableMasterDVO selectedItem = tbMaster.getSelectionModel().getSelectedItem();
            try {
                if (selectedItem == null)
                    return;
                List<TableModelDVO> list = listColumns(selectedItem);
                tbModelMst.getItems().addAll(list);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e, "데이터베이스 처리 에러");
            }
        }
    });
    btnSelect.setOnMouseClicked(event -> {
        if (tbMaster.getItems().isEmpty() || tbModelMst.getItems().isEmpty()) {
            return;
        }
        TableMasterDVO selectedItem = tbMaster.getSelectionModel().getSelectedItem();
        ObservableList<TableModelDVO> items = tbModelMst.getItems();
        tableDVO = new TableDVO(selectedItem, items);
        close();
    });
    MenuItem menuDelete = new MenuItem("삭제");
    menuDelete.setOnAction(event -> {
        TableViewSelectionModel<TableModelDVO> selectionModel = tbModelMst.getSelectionModel();
        int selectedIndex = selectionModel.getSelectedIndex();
        if (selectedIndex >= 0) {
            tbModelMst.getItems().remove(selectedIndex);
            selectionModel.clearSelection();
        }
    });
    // MenuItem menuDistinct = new MenuItem("중복제거");
    // menuDistinct.setOnAction(event -> {
    // ObservableList<TableModelDVO> items = tbModelMst.getItems();
    // items.stream().filter(distinctByKey(new Function<TableModelDVO,
    // ObservableList<TableModelDVO>>(){
    //
    // @Override
    // public ObservableList<TableModelDVO> apply(TableModelDVO t) {
    // // TODO Auto-generated method stub
    // return null;
    // }));
    contextMenuTbModelMst.getItems().add(menuDelete);
    tbModelMst.setContextMenu(contextMenuTbModelMst);
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) SQLException(java.sql.SQLException) FXML(javafx.fxml.FXML)

Example 22 with ContextMenu

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

the class ProxyServerController method initRemote.

private void initRemote() {
    MenuItem miClear = new MenuItem("Clear All");
    lvRemoteData.setContextMenu(new ContextMenu(miClear));
    miClear.setOnAction(ev -> {
        lvRemoteData.getItems().clear();
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu)

Example 23 with ContextMenu

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

the class ProxyServerController method initLocal.

private void initLocal() {
    MenuItem miClear = new MenuItem("Clear All");
    lvLocalData.setContextMenu(new ContextMenu(miClear));
    miClear.setOnAction(ev -> {
        lvLocalData.getItems().clear();
    });
}
Also used : MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu)

Example 24 with ContextMenu

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

the class SVNTreeView method addContextMenus.

/***********************************************************************************/
/***********************************************************************************/
/* 일반API 구현 */
/**
	 * 컨텍스트 메뉴 등록
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 4. 4.
	 */
void addContextMenus() {
    menuNew = new Menu("New");
    menuAddNewLocation = new MenuItem("Repository Location");
    menuDiscardLocation = new MenuItem("Discard Location");
    menuReflesh = new MenuItem("Reflesh");
    menuCheckout = new MenuItem("Checkout");
    menuSvnGraph = new MenuItem("SVN Graph");
    menuProperties = new MenuItem("Properties");
    menuNew.getItems().add(menuAddNewLocation);
    menuAddNewLocation.setOnAction(this::menuAddNewLocationOnAction);
    menuDiscardLocation.setOnAction(this::menuDiscardLocationOnAction);
    menuCheckout.setOnAction(this::menuCheckoutOnAction);
    menuSvnGraph.setOnAction(this::menuSVNGraphOnAction);
    menuProperties.setOnAction(this::menuPropertiesOnAction);
    contextMenu = new ContextMenu(menuNew, new SeparatorMenuItem(), menuCheckout, new SeparatorMenuItem(), menuSvnGraph, new SeparatorMenuItem(), menuDiscardLocation, menuReflesh, new SeparatorMenuItem(), menuProperties);
    // setContextMenu(contextMenu);
    setCellFactory(treeItem -> {
        TextFieldTreeCell<SVNItem> textFieldTreeCell = new TextFieldTreeCell<>();
        textFieldTreeCell.setContextMenu(contextMenu);
        return textFieldTreeCell;
    });
    // 특정 조건에 따른 메뉴 VISIBLE 처리를 정의함.
    contextMenu.setOnShown(contextMenuVisibleEvent);
}
Also used : MenuItem(javafx.scene.control.MenuItem) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem) ContextMenu(javafx.scene.control.ContextMenu) ContextMenu(javafx.scene.control.ContextMenu) Menu(javafx.scene.control.Menu) TextFieldTreeCell(javafx.scene.control.cell.TextFieldTreeCell) SeparatorMenuItem(javafx.scene.control.SeparatorMenuItem)

Example 25 with ContextMenu

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

the class SVNViewer method initialize.

@FXML
public void initialize() {
    tvSvnView = new SVNTreeView();
    tvSvnView.setOnAction(this::svnTreeViewOnAction);
    tvSvnView.setOnKeyPressed(this::svnTreeVoewOnKeyPressed);
    tvSvnView.load();
    anTreePane.getChildren().set(0, tvSvnView);
    AnchorPane.setLeftAnchor(tvSvnView, 0.0);
    AnchorPane.setRightAnchor(tvSvnView, 0.0);
    AnchorPane.setBottomAnchor(tvSvnView, 0.0);
    AnchorPane.setTopAnchor(tvSvnView, 0.0);
    colRevision.setCellValueFactory(v -> new SimpleObjectProperty<Long>(v.getValue().getRevision()));
    colUser.setCellValueFactory(v -> new SimpleStringProperty(v.getValue().getAuthor()));
    colComment.setCellValueFactory(v -> new SimpleStringProperty(v.getValue().getMessage()));
    colDate.setCellValueFactory(v -> new SimpleStringProperty(DateUtil.getDateString(v.getValue().getDate().getTime(), "yyyy-MM-dd")));
    javaTextAre = new JavaTextArea();
    borSource.setCenter(javaTextAre);
    lineHist = new LineChart<>(new CategoryAxis(), new CategoryAxis());
    borChart.setCenter(lineHist);
    tbRevision.getSelectionModel().setCellSelectionEnabled(true);
    tbRevision.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    //		FxClipboardUtil.installCopyPasteHandler(tbRevision);
    //		FxTableViewUtil.
    FxUtil.installClipboardKeyEvent(tbRevision);
    MenuItem menuDiff = new MenuItem("Diff");
    menuDiff.setOnAction(this::menuDiffOnAction);
    tbRevision.setContextMenu(new ContextMenu(menuDiff));
    tvSvnView.svnGraphPropertyProperty().addListener((oba, oldView, newView) -> {
        if (newView != null) {
            Tab tabSvnGraph = new Tab("SVN Graph", newView);
            if (tabPaneSVN.getTabs().size() <= TAB_INDEX_SVN_GRAPH) {
                tabPaneSVN.getTabs().add(tabSvnGraph);
            } else {
                tabPaneSVN.getTabs().add(TAB_INDEX_SVN_GRAPH, tabSvnGraph);
            }
        }
    });
    displayLatestRevision();
}
Also used : Tab(javafx.scene.control.Tab) JavaTextArea(com.kyj.fx.voeditor.visual.component.text.JavaTextArea) CategoryAxis(javafx.scene.chart.CategoryAxis) MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) FXML(javafx.fxml.FXML)

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