mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 21:48:22 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7dac3ce011 | |||
| 449f929f08 | |||
| 9e3561fedb |
@@ -15,7 +15,7 @@ even in a "normal" CSV editor. So I decided to write this simple JavaFX applicat
|
|||||||
|
|
||||||
[Wiki & Documentation](https://github.com/frosch95/SmartCSV.fx/wiki)
|
[Wiki & Documentation](https://github.com/frosch95/SmartCSV.fx/wiki)
|
||||||
|
|
||||||
binary distribution of the [latest release (1.1.0)](https://github.com/frosch95/SmartCSV.fx/releases/download/1.1.0/SmartCSV.fx-1.0.1.zip)
|
binary distribution of the [latest release (1.2.0)](https://github.com/frosch95/SmartCSV.fx/releases/download/1.2.0/SmartCSV.fx-1.2.0.zip)
|
||||||
|
|
||||||
## Talks
|
## Talks
|
||||||
[Introduction](http://javafx.ninja/talks/introduction/)
|
[Introduction](http://javafx.ninja/talks/introduction/)
|
||||||
|
|||||||
@@ -48,5 +48,5 @@ test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'ninja.javafx'
|
group 'ninja.javafx'
|
||||||
version '1.1.0'
|
version '1.2.0'
|
||||||
mainClassName = 'ninja.javafx.smartcsv.Main'
|
mainClassName = 'ninja.javafx.smartcsv.Main'
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import javafx.event.EventHandler;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.input.Dragboard;
|
||||||
|
import javafx.scene.input.TransferMode;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
@@ -255,6 +257,34 @@ public class SmartCSVController extends FXMLController {
|
|||||||
fileEncodingFile.setFile(ENCODING_FILE);
|
fileEncodingFile.setFile(ENCODING_FILE);
|
||||||
|
|
||||||
loadCsvPreferencesFromFile();
|
loadCsvPreferencesFromFile();
|
||||||
|
|
||||||
|
initDragAndDrop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDragAndDrop() {
|
||||||
|
tableWrapper.setOnDragOver(event -> {
|
||||||
|
Dragboard db = event.getDragboard();
|
||||||
|
if (event.getGestureSource() != tableWrapper
|
||||||
|
&& db.hasFiles()
|
||||||
|
&& db.getFiles().size() == 1
|
||||||
|
&& db.getFiles().get(0).getName().endsWith(".csv")) {
|
||||||
|
event.acceptTransferModes(TransferMode.COPY);
|
||||||
|
}
|
||||||
|
event.consume();
|
||||||
|
});
|
||||||
|
|
||||||
|
tableWrapper.setOnDragDropped(event -> {
|
||||||
|
Dragboard db = event.getDragboard();
|
||||||
|
boolean success = false;
|
||||||
|
if (db.hasFiles() && db.getFiles().size() == 1) {
|
||||||
|
File file = db.getFiles().get(0);
|
||||||
|
openFile(currentCsvFile, file);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
/* let the source know whether the string was successfully
|
||||||
|
* transferred and used */
|
||||||
|
event.setDropCompleted(success);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadEncodingFromFile() {
|
private void loadEncodingFromFile() {
|
||||||
@@ -599,6 +629,10 @@ public class SmartCSVController extends FXMLController {
|
|||||||
|
|
||||||
//Show open file dialog
|
//Show open file dialog
|
||||||
File file = fileChooser.showOpenDialog(applicationPane.getScene().getWindow());
|
File file = fileChooser.showOpenDialog(applicationPane.getScene().getWindow());
|
||||||
|
openFile(storageFile, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openFile(FileStorage storageFile, File file) {
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
File previousFile = storageFile.getFile();
|
File previousFile = storageFile.getFile();
|
||||||
storageFile.setFile(file);
|
storageFile.setFile(file);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
application.name = SmartCSV.fx
|
application.name = SmartCSV.fx
|
||||||
application.version = 1.0.0
|
application.version = 1.2.0
|
||||||
|
|
||||||
# fxml views
|
# fxml views
|
||||||
fxml.smartcvs.view = /ninja/javafx/smartcsv/fx/smartcsv.fxml
|
fxml.smartcvs.view = /ninja/javafx/smartcsv/fx/smartcsv.fxml
|
||||||
|
|||||||
Reference in New Issue
Block a user