Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
TimeZonePanel.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2014 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package org.sleuthkit.autopsy.timeline.ui;
20
21import java.time.ZoneOffset;
22import java.util.Date;
23import java.util.TimeZone;
24import javafx.beans.value.ObservableValue;
25import javafx.fxml.FXML;
26import javafx.scene.control.RadioButton;
27import javafx.scene.control.TitledPane;
28import javafx.scene.control.Toggle;
29import javafx.scene.control.ToggleGroup;
30import org.openide.util.NbBundle;
31import org.sleuthkit.autopsy.timeline.FXMLConstructor;
32import org.sleuthkit.autopsy.timeline.TimeLineController;
33
38public class TimeZonePanel extends TitledPane {
39
40 @FXML
41 private RadioButton localRadio;
42
43 @FXML
44 private RadioButton otherRadio;
45
46 @FXML
47 private ToggleGroup localOtherGroup;
48
49 static private String getTimeZoneString(final TimeZone timeZone) {
50 final String id = ZoneOffset.ofTotalSeconds(timeZone.getOffset(System.currentTimeMillis()) / 1000).getId();
51 final String timeZoneString = "(GMT" + ("Z".equals(id) ? "+00:00" : id) + ") " + timeZone.getID() + " [" + timeZone.getDisplayName(timeZone.observesDaylightTime() && timeZone.inDaylightTime(new Date()), TimeZone.SHORT) + "]"; // NON-NLS
52 return timeZoneString;
53 }
54
55 @FXML
56 @NbBundle.Messages({"TimeZonePanel.title=Display Times In:"})
57 public void initialize() {
58 setText(Bundle.TimeZonePanel_title());
59// localRadio.setText("Local Time Zone: " + getTimeZoneString(TimeZone.getDefault()));
60 localRadio.setText(NbBundle.getMessage(this.getClass(), "TimeZonePanel.localRadio.text"));
61 otherRadio.setText(NbBundle.getMessage(this.getClass(), "TimeZonePanel.otherRadio.text"));
62 // The text field for this TimeZonePanel (TitlePane) object is set by the instantiating class (TimeLineTopComponent).
63
64 localOtherGroup.selectedToggleProperty().addListener(
65 (ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) -> {
66 if (newValue == localRadio) {
67 TimeLineController.setTimeZone(TimeZone.getDefault());
68 } else {
69 TimeLineController.setTimeZone(TimeZone.getTimeZone(ZoneOffset.UTC));
70 }
71 });
72 }
73
74 @SuppressWarnings("this-escape")
75 public TimeZonePanel() {
76 FXMLConstructor.construct(this, "TimeZonePanel.fxml"); // NON-NLS
77 }
78}
static void construct(Node node, String fxmlFileName)
static synchronized void setTimeZone(TimeZone timeZone)
static String getTimeZoneString(final TimeZone timeZone)

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.