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);
}
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();
}
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;
}
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();
}
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());
}
}
}
});
}
Aggregations