use of com.github.axet.vget.vhs.YouTubeInfo.YoutubeQuality in project Gargoyle by callakrsos.
the class UtubeDownloaderComposite method initialize.
@FXML
public void initialize() {
btnDownload.setDisable(true);
this.txtDownloadLocation.setText(System.getProperty("user.home"));
this.txtDownloadLocation.setPromptText("Downlaod Location");
// this.lvDownlaodCont.setCellFactory(new Callback<ListView<UtubeItemDVO>, ListCell<UtubeItemDVO>>() {
//
// @Override
// public ListCell<UtubeItemDVO> call(ListView<UtubeItemDVO> param) {
// return new UtubeListCell();
// }
// });
// this.lvDownlaodCont.setOnDragDetected(ev -> {
// ev.setDragDetect(true);
// });
txtUtubeURL.setOnDragOver(ev -> {
if (ev.getDragboard().hasUrl()) {
ev.acceptTransferModes(TransferMode.LINK);
ev.consume();
}
});
txtUtubeURL.setOnDragDropped(ev -> {
Dragboard dragboard = ev.getDragboard();
String url = dragboard.getUrl();
txtUtubeURL.setText(url);
});
txtUtubeURL.textProperty().addListener((oba, o, n) -> {
btnDownload.setDisable(n.trim().isEmpty());
});
// 초기값
this.cbQuality.getItems().addAll(YoutubeQuality.values());
// 디폴트
this.cbQuality.getSelectionModel().select(YoutubeQuality.p480);
this.cbQuality.setCellFactory(new Callback<ListView<YoutubeQuality>, ListCell<YoutubeQuality>>() {
@Override
public ListCell<YoutubeQuality> call(ListView<YoutubeQuality> param) {
return new TextFieldListCell<>(new StringConverter<YoutubeQuality>() {
@Override
public String toString(YoutubeQuality object) {
return object.name();
}
@Override
public YoutubeQuality fromString(String string) {
return YoutubeQuality.valueOf(string);
}
});
}
});
this.wasDownloading.addListener((oba, o, n) -> {
if (n != null)
this.btnDownload.setDisable(n.booleanValue());
});
this.downloadedFile.addListener((oba, o, n) -> {
if (n != null && n.exists()) {
// btnOpen.setDisable(false);
this.txtFileName.setText(n.getName());
} else {
// btnOpen.setDisable(true);
}
});
}
Aggregations