FULL PRODUCT VERSION :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64-bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
Microsoft Outlook Professional Plus
A DESCRIPTION OF THE PROBLEM :
I am trying to implement a requirement to drag and drop documents attached in an email into a JavaFX 8 application running on jdk 8b45. I am able to drag and drop from any Windows folder on my computer but not from an Outlook email attachment.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Drag a file from Windows folder onto FX application. This works.
2. Now drag an attachment from Microsoft Outlook email. This does NOT work.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be able to drag and drop attachments from Outlook emails.
ACTUAL -
Does not identify the files being dragged from an email attachment.
For email attachments, "dragboard.hasFiles()::false" is always displayed on the console inside 'setOnDragOver' method.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.util.Duration;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.input.*;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class HelloDragAndDrop extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Hello Drag And Drop");
VBox root = new VBox();
root.setStyle("-fx-border-color: transparent;");
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 400, 200);
scene.setFill(Color.WHITESMOKE);
Text target = new Text("DROP HERE");
target.setScaleX(2.0);
target.setScaleY(2.0);
root.setOnDragOver((DragEvent event) -> {
System.out.println("onDragOver");
// The below statement ALWAYS displays false for outlook attachments
System.out.println("event.getDragboard().hasFiles()::" + event.getDragboard().hasFiles());
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.ANY);
}
event.consume();
});
root.setOnDragEntered((DragEvent event) -> {
System.out.println("onDragEntered");
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
root.setStyle("-fx-border-color: green;");
}
event.consume();
});
root.setOnDragExited((DragEvent event) -> {
root.setStyle("-fx-border-color: transparent;");
event.consume();
});
root.setOnDragDropped((DragEvent event) -> {
System.out.println("onDragDropped");
Dragboard db = event.getDragboard();
System.out.println("db.hasFiles()::" + db.hasFiles());
boolean success = false;
if (db.hasFiles()) {
target.setText("SUCCESSFULLY DROPPED");
success = true;
}
event.setDropCompleted(success);
event.consume();
Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(2), (ActionEvent actionEvent) -> {
target.setText("DROP HERE");
}),
new KeyFrame(Duration.seconds(5))
);
timeline.setCycleCount(1);
timeline.play();
});
root.getChildren().add(target);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
---------- END SOURCE ----------
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64-bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
Microsoft Outlook Professional Plus
A DESCRIPTION OF THE PROBLEM :
I am trying to implement a requirement to drag and drop documents attached in an email into a JavaFX 8 application running on jdk 8b45. I am able to drag and drop from any Windows folder on my computer but not from an Outlook email attachment.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Drag a file from Windows folder onto FX application. This works.
2. Now drag an attachment from Microsoft Outlook email. This does NOT work.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be able to drag and drop attachments from Outlook emails.
ACTUAL -
Does not identify the files being dragged from an email attachment.
For email attachments, "dragboard.hasFiles()::false" is always displayed on the console inside 'setOnDragOver' method.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.util.Duration;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.input.*;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class HelloDragAndDrop extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Hello Drag And Drop");
VBox root = new VBox();
root.setStyle("-fx-border-color: transparent;");
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 400, 200);
scene.setFill(Color.WHITESMOKE);
Text target = new Text("DROP HERE");
target.setScaleX(2.0);
target.setScaleY(2.0);
root.setOnDragOver((DragEvent event) -> {
System.out.println("onDragOver");
// The below statement ALWAYS displays false for outlook attachments
System.out.println("event.getDragboard().hasFiles()::" + event.getDragboard().hasFiles());
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
event.acceptTransferModes(TransferMode.ANY);
}
event.consume();
});
root.setOnDragEntered((DragEvent event) -> {
System.out.println("onDragEntered");
if (event.getGestureSource() != root && event.getDragboard().hasFiles()) {
root.setStyle("-fx-border-color: green;");
}
event.consume();
});
root.setOnDragExited((DragEvent event) -> {
root.setStyle("-fx-border-color: transparent;");
event.consume();
});
root.setOnDragDropped((DragEvent event) -> {
System.out.println("onDragDropped");
Dragboard db = event.getDragboard();
System.out.println("db.hasFiles()::" + db.hasFiles());
boolean success = false;
if (db.hasFiles()) {
target.setText("SUCCESSFULLY DROPPED");
success = true;
}
event.setDropCompleted(success);
event.consume();
Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(2), (ActionEvent actionEvent) -> {
target.setText("DROP HERE");
}),
new KeyFrame(Duration.seconds(5))
);
timeline.setCycleCount(1);
timeline.play();
});
root.getChildren().add(target);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
---------- END SOURCE ----------