Autopsy  4.5.0
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  */
19 package org.sleuthkit.autopsy.timeline.ui;
20 
21 import java.time.ZoneOffset;
22 import java.util.Date;
23 import java.util.TimeZone;
24 import javafx.beans.value.ObservableValue;
25 import javafx.fxml.FXML;
26 import javafx.scene.control.RadioButton;
27 import javafx.scene.control.TitledPane;
28 import javafx.scene.control.Toggle;
29 import javafx.scene.control.ToggleGroup;
30 import org.openide.util.NbBundle;
33 
38 public 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  public TimeZonePanel() {
75  FXMLConstructor.construct(this, "TimeZonePanel.fxml"); // NON-NLS
76  }
77 }
static String getTimeZoneString(final TimeZone timeZone)
static synchronized void setTimeZone(TimeZone timeZone)
static void construct(Node node, String fxmlFileName)

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.