List of usage examples for javafx.scene.input DragEvent getDragboard
public final Dragboard getDragboard()
From source file:org.pdfsam.ui.io.BrowsableDirectoryField.java
private Consumer<DragEvent> onDragDropped() { return (DragEvent e) -> { e.getDragboard().getFiles().stream().filter(f -> f.isDirectory()).findFirst() .ifPresent((file) -> setTextFromFile(file)); };//from w ww . ja va 2 s .c o m }
From source file:org.pdfsam.ui.io.BrowsableFileField.java
private Consumer<DragEvent> onDragDropped() { return (DragEvent e) -> { e.getDragboard().getFiles().stream().filter(f -> fileType.matches(f.getName())).findFirst() .ifPresent((file) -> setTextFromFile(file)); };/*from www. jav a 2s . com*/ }
From source file:org.pdfsam.ui.selection.multiple.SelectionTable.java
private Consumer<DragEvent> onDragDropped() { return (DragEvent e) -> { final PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule()); e.getDragboard().getFiles().stream().filter(f -> FileType.PDF.matches(f.getName())) .map(PdfDocumentDescriptor::newDescriptorNoPassword).forEach(loadEvent::add); eventStudio().broadcast(loadEvent, getOwnerModule()); e.setDropCompleted(true);/*from w w w . j a va 2 s .co m*/ }; }
From source file:org.ykc.usbcx.MainWindowController.java
@FXML void openOnDragOver(DragEvent event) { Dragboard db = event.getDragboard(); if (db.hasFiles()) { event.acceptTransferModes(TransferMode.COPY_OR_MOVE); } else {//from w w w . j av a 2 s . c o m event.consume(); } }
From source file:org.ykc.usbcx.MainWindowController.java
@FXML void openOnDragDrop(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { String filePath = null;/* www. j a v a 2s.com*/ for (File file : db.getFiles()) { if (Utils.getFileExtension(file).equals("ucx1")) { success = true; partFileList = OpenRecord.open(file, usbcontrol, statusBar); loadRecord(); break; } } } event.setDropCompleted(success); event.consume(); }