aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-17 11:42:55 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-17 11:42:55 +1300
commit2a940c45a38cec42a6a85714f7941ee8613f48ee (patch)
treedadb0078d0896b551b7e5e7ad4861276205b3e00 /src/org/traccar/web
parentfdebc0f3b0453f7898090be98a3edf9664083471 (diff)
downloadtrackermap-web-2a940c45a38cec42a6a85714f7941ee8613f48ee.tar.gz
trackermap-web-2a940c45a38cec42a6a85714f7941ee8613f48ee.tar.bz2
trackermap-web-2a940c45a38cec42a6a85714f7941ee8613f48ee.zip
Added formatter utility
Diffstat (limited to 'src/org/traccar/web')
-rw-r--r--src/org/traccar/web/client/ApplicationContext.java (renamed from src/org/traccar/web/client/Context.java)19
-rw-r--r--src/org/traccar/web/client/model/StateReader.java5
-rw-r--r--src/org/traccar/web/client/view/ArchiveView.java4
3 files changed, 20 insertions, 8 deletions
diff --git a/src/org/traccar/web/client/Context.java b/src/org/traccar/web/client/ApplicationContext.java
index 6cc6f0c4..f5053243 100644
--- a/src/org/traccar/web/client/Context.java
+++ b/src/org/traccar/web/client/ApplicationContext.java
@@ -3,14 +3,27 @@ package org.traccar.web.client;
import org.traccar.web.shared.model.ApplicationSettings;
import org.traccar.web.shared.model.UserSettings;
-public class Context {
+public class ApplicationContext {
- private static final Context context = new Context();
+ private static final ApplicationContext context = new ApplicationContext();
- public Context getInstance() {
+ public static ApplicationContext getInstance() {
return context;
}
+ private FormatterUtil formatterUtil;
+
+ public void setFormatterUtil(FormatterUtil formatterUtil) {
+ this.formatterUtil = formatterUtil;
+ }
+
+ public FormatterUtil getFormatterUtil() {
+ if (formatterUtil == null) {
+ formatterUtil = new FormatterUtil();
+ }
+ return formatterUtil;
+ }
+
private ApplicationSettings applicationSettings;
public void setApplicationSettings(ApplicationSettings applicationSettings) {
diff --git a/src/org/traccar/web/client/model/StateReader.java b/src/org/traccar/web/client/model/StateReader.java
index a3549179..733bde62 100644
--- a/src/org/traccar/web/client/model/StateReader.java
+++ b/src/org/traccar/web/client/model/StateReader.java
@@ -3,11 +3,10 @@ package org.traccar.web.client.model;
import java.util.LinkedList;
import java.util.List;
+import org.traccar.web.client.ApplicationContext;
import org.traccar.web.shared.model.Position;
import org.traccar.web.shared.model.XmlParser;
-import com.google.gwt.i18n.client.DateTimeFormat;
-
public class StateReader {
private static String toString(Object object) {
@@ -21,7 +20,7 @@ public class StateReader {
List<StateItem> state = new LinkedList<StateItem>();
state.add(new StateItem("valid", toString(position.getValid())));
- state.add(new StateItem("time", DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(position.getTime())));
+ state.add(new StateItem("time", ApplicationContext.getInstance().getFormatterUtil().formatTime(position.getTime())));
state.add(new StateItem("latitude", toString(position.getLatitude())));
state.add(new StateItem("longitude", toString(position.getLongitude())));
state.add(new StateItem("altitude", toString(position.getAltitude())));
diff --git a/src/org/traccar/web/client/view/ArchiveView.java b/src/org/traccar/web/client/view/ArchiveView.java
index 32e569eb..d510cbe1 100644
--- a/src/org/traccar/web/client/view/ArchiveView.java
+++ b/src/org/traccar/web/client/view/ArchiveView.java
@@ -19,6 +19,7 @@ import java.util.Date;
import java.util.LinkedList;
import java.util.List;
+import org.traccar.web.client.ApplicationContext;
import org.traccar.web.client.model.BaseStoreHandlers;
import org.traccar.web.client.model.DeviceProperties;
import org.traccar.web.client.model.PositionProperties;
@@ -27,7 +28,6 @@ import org.traccar.web.shared.model.Position;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
@@ -109,7 +109,7 @@ public class ArchiveView implements SelectionChangedEvent.SelectionChangedHandle
columnConfigList.add(new ColumnConfig<Position, Boolean>(positionProperties.valid(), 0, "Valid"));
ColumnConfig<Position, Date> columnConfig = new ColumnConfig<Position, Date>(positionProperties.time(), 0, "Time");
- columnConfig.setCell(new DateCell(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss")));
+ columnConfig.setCell(new DateCell(ApplicationContext.getInstance().getFormatterUtil().getTimeFormat()));
columnConfigList.add(columnConfig);
columnConfigList.add(new ColumnConfig<Position, Double>(positionProperties.latitude(), 0, "Latitude"));