renamed variables and functions for timezone check

This commit is contained in:
U-BASIS\tshahi
2014-02-07 13:26:17 -05:00
parent e64efe3587
commit e16ef6082c
3 changed files with 13 additions and 28 deletions
@@ -34,7 +34,7 @@ final class GeneralPanel extends javax.swing.JPanel {
GeneralPanel(GeneralOptionsPanelController controller) {
this.controller = controller;
initComponents();
ContentUtils.setLocalTime(useLocalTimeRB.isSelected());
ContentUtils.setDisplayInLocalTime(useLocalTimeRB.isSelected());
// TODO listen to changes in form fields and call controller.changed()
}
@@ -152,7 +152,7 @@ final class GeneralPanel extends javax.swing.JPanel {
}//GEN-LAST:event_useBestViewerRBActionPerformed
private void useGMTTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useGMTTimeRBActionPerformed
ContentUtils.setLocalTime(useLocalTimeRB.isSelected());
ContentUtils.setDisplayInLocalTime(useLocalTimeRB.isSelected());
}//GEN-LAST:event_useGMTTimeRBActionPerformed
void load() {
@@ -50,7 +50,7 @@ public final class ContentUtils {
private final static Logger logger = Logger.getLogger(ContentUtils.class.getName());
private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
private static final SimpleDateFormat dateFormatterISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
private static boolean localTime;
private static boolean displayInLocalTime;
// don't instantiate
private ContentUtils() {
throw new AssertionError();
@@ -108,7 +108,7 @@ public final class ContentUtils {
public static TimeZone getTimeZone(Content c) {
try {
if (!localTime()) {
if (!getDisplayInLocalTime()) {
return TimeZone.getTimeZone("GMT");
}
else {
@@ -359,18 +359,18 @@ public final class ContentUtils {
+ cntnt.getClass().getSimpleName());
}
}
/**sets localTime value based on button in GeneralPanel.java
/**sets displayInlocalTime value based on button in GeneralPanel.java
*
* @param flag
*/
public static void setLocalTime(boolean flag) {
localTime = flag;
public static void setDisplayInLocalTime(boolean flag) {
displayInLocalTime = flag;
}
/** returns true if local time is selected.
* returns false if GMT is selected.
/** get global timezone setting for displaying time values
*
* @return
*/
public static boolean localTime(){
return localTime;
public static boolean getDisplayInLocalTime(){
return displayInLocalTime;
}
}
@@ -145,7 +145,6 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
private EventHandler<MouseEvent> fxMouseExitedListener;
private SleuthkitCase skCase;
private boolean fxInited = false;
private static boolean localTime = true;
public Timeline() {
super();
@@ -932,13 +931,13 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
int minute=Integer.valueOf(date[4]);
int second=Integer.valueOf(date[5]);
setLocalTime(localTime);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); //set calendar to GMT due to ISO format
calendar.set(year, month, day, hour, minute, second);
day=calendar.get(Calendar.DAY_OF_MONTH); // this is needed or else timezone change wont work. probably incorrect optimization by compiler
//conversion to GMT
if (!localTime()) {
if (!ContentUtils.getDisplayInLocalTime()) {
calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
}
else{
@@ -1128,20 +1127,6 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
initTimeline();
}
/**set localTime by getting it from ContentUtils class
*
* @param flag
*/
public static void setLocalTime(boolean flag) {
localTime = ContentUtils.localTime();
}
/**returns whether user has set localTime settings, or GMT if false
*
* @return
*/
public static boolean localTime() {
return localTime;
}
private void initTimeline() {
if (!Case.existsCurrentCase()) {
return;