forked from j62/ctbrec
Convert recording time relative to local timezone.
Convert recording time relative to local timezone and format it with a easily readable format.
This commit is contained in:
parent
63a91b830d
commit
88ee4bd157
|
@ -9,6 +9,11 @@ import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.FormatStyle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,6 +36,7 @@ import ctbrec.Recording.STATUS;
|
||||||
import ctbrec.recorder.Recorder;
|
import ctbrec.recorder.Recorder;
|
||||||
import ctbrec.recorder.download.MergedHlsDownload;
|
import ctbrec.recorder.download.MergedHlsDownload;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.concurrent.ScheduledService;
|
import javafx.concurrent.ScheduledService;
|
||||||
|
@ -93,7 +99,12 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
name.setPrefWidth(200);
|
name.setPrefWidth(200);
|
||||||
name.setCellValueFactory(new PropertyValueFactory<JavaFxRecording, String>("modelName"));
|
name.setCellValueFactory(new PropertyValueFactory<JavaFxRecording, String>("modelName"));
|
||||||
TableColumn<JavaFxRecording, String> date = new TableColumn<>("Date");
|
TableColumn<JavaFxRecording, String> date = new TableColumn<>("Date");
|
||||||
date.setCellValueFactory(new PropertyValueFactory<JavaFxRecording, String>("startDate"));
|
date.setCellValueFactory((cdf) -> {
|
||||||
|
Instant instant = cdf.getValue().getStartDate();
|
||||||
|
ZonedDateTime time = instant.atZone(ZoneId.systemDefault());
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM, FormatStyle.MEDIUM);
|
||||||
|
return new SimpleStringProperty(dtf.format(time));
|
||||||
|
});
|
||||||
date.setPrefWidth(200);
|
date.setPrefWidth(200);
|
||||||
TableColumn<JavaFxRecording, String> status = new TableColumn<>("Status");
|
TableColumn<JavaFxRecording, String> status = new TableColumn<>("Status");
|
||||||
status.setCellValueFactory((cdf) -> cdf.getValue().getStatusProperty());
|
status.setCellValueFactory((cdf) -> cdf.getValue().getStatusProperty());
|
||||||
|
|
Loading…
Reference in New Issue