Search in sources :

Example 11 with ContextMenu

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

the class CommonsContextMenu method addMenus.

/**
	 * 컨텍스트 메뉴 추가.
	 * 
	 * @param node
	 * @param items
	 */
public static void addMenus(Control node, MenuItem... items) {
    ContextMenu contextMenu = new ContextMenu();
    if (items != null) {
        for (MenuItem item : items) {
            contextMenu.getItems().add(item);
        }
    }
    node.setContextMenu(contextMenu);
}
Also used : ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem)

Example 12 with ContextMenu

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

the class PagedCodeAreaHelper method init.

/* (non-Javadoc)
	 * @see com.kyj.fx.voeditor.visual.component.text.CodeAreaHelper#init()
	 */
@Override
protected void init() {
    if (codeArea == null)
        throw new RuntimeException("TextView is null ");
    defaultSelectionHandler = new CodeAreaDefaultSelectionHandler(codeArea);
    this.codeArea.setOnMouseClicked(defaultSelectionHandler);
    this.codeMoveDeligator = new CodeAreaMoveLineHelper(codeArea);
    this.dragDropHelper = new CodeAreaFileDragDropHelper(codeArea);
    this.findAndReplaceHelper = new PagedCodeAreaFindAndReplaceHelper(bigTextView);
    contextMenu = codeArea.getContextMenu();
    if (contextMenu == null) {
        contextMenu = new ContextMenu();
        codeArea.setContextMenu(contextMenu);
    }
    createMenus();
}
Also used : RuntimeException(com.sun.star.uno.RuntimeException) ContextMenu(javafx.scene.control.ContextMenu)

Example 13 with ContextMenu

use of javafx.scene.control.ContextMenu in project arquivoProject by fader-azevedo.

the class ListaDocumentoController method rightClik.

private ContextMenu rightClik(JFXButton button) {
    final ContextMenu contextMenu = new ContextMenu();
    MenuItem verDoc = new MenuItem("Ver Pauta");
    MaterialDesignIconView iconEye = new MaterialDesignIconView(MaterialDesignIcon.EYE, "20");
    verDoc.setGraphic(iconEye);
    contextMenu.getItems().addAll(verDoc);
    verDoc.setOnAction(e -> {
        try {
            System.out.println(button.getText());
            FXMLLoader loader = new FXMLLoader();
            loader.load(getClass().getResource("/view/PdfViewer.fxml").openStream());
            Parent parent = loader.getRoot();
            File pdfCaminho = new File("documentos/pautas/" + button.getText());
            PdfViewerController pdfController = loader.getController();
            pdfController.initialize();
            pdfController.loadFile(pdfCaminho.toString());
            final Stage dialog = new Stage();
            dialog.initModality(Modality.APPLICATION_MODAL);
            Scene dialogScene = new Scene(parent, 500, 620);
            dialog.setScene(dialogScene);
            dialog.setTitle(button.getText());
            dialog.setResizable(false);
            dialog.show();
        } catch (IOException ex) {
            Logger.getLogger(ListaDocumentoController.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    return contextMenu;
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) IOException(java.io.IOException) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) File(java.io.File) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView)

Example 14 with ContextMenu

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

the class CodeAreaHelper method init.

protected void init() {
    defaultSelectionHandler = new CodeAreaDefaultSelectionHandler(codeArea);
    this.codeArea.setOnMouseClicked(defaultSelectionHandler);
    this.codeMoveDeligator = new CodeAreaMoveLineHelper(codeArea);
    this.dragDropHelper = new CodeAreaFileDragDropHelper(codeArea);
    this.findAndReplaceHelper = new CodeAreaFindAndReplaceHelper<>(codeArea);
    // this.codeArea.addEventHandler(MouseDragEvent.MOUSE_DRAG_OVER,
    // this::codeAreaDagOver);
    // this.codeArea.addEventHandler(MouseDragEvent.MOUSE_DRAG_ENTERED_TARGET,
    // this::codeAreaDagEnteredTarget);
    contextMenu = codeArea.getContextMenu();
    if (contextMenu == null) {
        contextMenu = new ContextMenu();
        codeArea.setContextMenu(contextMenu);
    }
    createMenus();
}
Also used : ContextMenu(javafx.scene.control.ContextMenu)

Example 15 with ContextMenu

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

the class NrchRealtimeSrchFlowComposite method contextMenu.

/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 11. 21.
	 */
private void contextMenu(Node target) {
    target.setOnMousePressed(ev -> {
        if (MouseButton.SECONDARY == ev.getButton()) {
            if (ev.getClickCount() != 1) {
                return;
            }
            if (ev.getSource() instanceof VBox) {
                VBox tmp = (VBox) ev.getSource();
                Object userData = tmp.getUserData();
                if (userData != null) {
                    ContextMenu contextMenu = new ContextMenu();
                    MenuItem menuGoogleTrend = new MenuItem("구글 트랜드로 조회");
                    menuGoogleTrend.setOnAction(e -> {
                        googleChartSearch((RealtimeSearchItemVO) userData);
                    });
                    MenuItem menuArticleAnalyzer = new MenuItem("기사 분석기 - Preview ver.");
                    menuArticleAnalyzer.setOnAction(e -> {
                        FxUtil.createStageAndShow(new ArticleExtractorComposite((RealtimeSearchItemVO) userData), stage -> {
                            stage.initOwner(FxUtil.getWindow(getParent()));
                            stage.setTitle(ArticleExtractorComposite.TITLE);
                            stage.sizeToScene();
                        });
                    });
                    contextMenu.getItems().addAll(menuGoogleTrend, menuArticleAnalyzer);
                    contextMenu.show(this.getParent().getScene().getWindow(), ev.getScreenX(), ev.getScreenY());
                }
            }
        }
    });
}
Also used : RealtimeSearchItemVO(com.kyj.fx.voeditor.visual.framework.RealtimeSearchItemVO) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) VBox(javafx.scene.layout.VBox)

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