From 2fe572e45c5acd7c1e7003cb95cb971c3a87348c Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 29 Jun 2015 12:36:41 +0000 Subject: [PATCH] Fixed TimeZone git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget@115609 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/RuleActiveOnColumnPanel.java | 21 +++++++++--------- .../client/RuleActiveOnTablePanel.java | 22 ++++++++----------- .../td/rulewidget/client/RuleDeletePanel.java | 18 ++++++--------- .../td/rulewidget/client/RuleInfoDialog.java | 9 ++++++-- .../client/RuleOnColumnApplyPanel.java | 20 +++++++---------- .../td/rulewidget/client/RuleOpenPanel.java | 18 ++++++--------- .../td/rulewidget/client/RuleSharePanel.java | 19 ++++++---------- .../RuleOnTableApplySelectRuleCard.java | 21 +++++++----------- .../RuleOnTableNewExpressionCard.java | 4 +--- 9 files changed, 64 insertions(+), 88 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnColumnPanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnColumnPanel.java index f36a1d2..13f2bbd 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnColumnPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnColumnPanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -22,9 +23,11 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -56,7 +59,11 @@ public class RuleActiveOnColumnPanel extends FramedPanel { private static final String WIDTH = "760px"; private static final String HEIGHT = "418px"; private static final String RULES_GRID_HEIGHT = "102px"; - + + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); + + + interface RuleActiveTemplates extends XTemplates { @XTemplate("{value}") SafeHtml format(String value); @@ -210,18 +217,10 @@ public class RuleActiveOnColumnPanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( propsRules.creationDate(), 56, "Creation Date"); - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleActiveTemplates ruleActiveTemplates = GWT - .create(RuleActiveTemplates.class); - sb.append(ruleActiveTemplates.format(value)); - } - }); + creationDateCol.setCell(new DateCell(sdf)); List> l = new ArrayList>(); l.add(nameCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnTablePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnTablePanel.java index 15d6659..00b223e 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnTablePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActiveOnTablePanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; @@ -17,9 +18,11 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -50,7 +53,8 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem; public class RuleActiveOnTablePanel extends FramedPanel { private static final String WIDTH = "760px"; private static final String HEIGHT = "418px"; - + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); + interface RuleActiveTemplates extends XTemplates { @XTemplate("{value}") SafeHtml format(String value); @@ -139,19 +143,11 @@ public class RuleActiveOnTablePanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( propsRules.creationDate(), 56, "Creation Date"); - - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleActiveTemplates ruleActiveTemplates = GWT - .create(RuleActiveTemplates.class); - sb.append(ruleActiveTemplates.format(value)); - } - }); - + + creationDateCol.setCell(new DateCell(sdf)); + List> l = new ArrayList>(); l.add(nameCol); l.add(descriptionCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java index 33bbc97..1614dba 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; @@ -14,6 +15,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -21,6 +23,7 @@ import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -66,6 +69,7 @@ public class RuleDeletePanel extends FramedPanel { private static final String WIDTH = "760px"; private static final String HEIGHT = "520px"; private static final String GRID_HEIGHT = "384px"; + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); interface RuleDeleteTemplates extends XTemplates { @XTemplate("{value}") @@ -164,19 +168,11 @@ public class RuleDeletePanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( props.creationDate(), 56, "Creation Date"); - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleDeleteTemplates ruleDeleteTemplates = GWT - .create(RuleDeleteTemplates .class); - sb.append(ruleDeleteTemplates.format(value)); - } - }); - + creationDateCol.setCell(new DateCell(sdf)); + List> l = new ArrayList>(); l.add(nameCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java index 41ea7b0..82b1955 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java @@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; +import com.google.gwt.i18n.client.DateTimeFormat; import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.widget.core.client.Dialog; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; @@ -21,7 +22,10 @@ import com.sencha.gxt.widget.core.client.form.TextField; * */ public class RuleInfoDialog extends Dialog { - RuleDescriptionData ruleDescriptionData; + private static final DateTimeFormat sdf = DateTimeFormat + .getFormat("yyyy-MM-dd HH:mm"); + + private RuleDescriptionData ruleDescriptionData; public RuleInfoDialog(RuleDescriptionData ruleDescriptionData) { this.ruleDescriptionData = ruleDescriptionData; @@ -80,7 +84,8 @@ public class RuleInfoDialog extends Dialog { 1, -1, new Margins(0))); TextField ruleCreationDate = new TextField(); - ruleCreationDate.setValue(ruleDescriptionData.getCreationDate()); + ruleCreationDate.setValue(sdf.format(ruleDescriptionData + .getCreationDate())); ruleCreationDate.setReadOnly(true); FieldLabel ruleCreationDateLabel = new FieldLabel(ruleCreationDate, "Creation Date"); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOnColumnApplyPanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOnColumnApplyPanel.java index e44ea16..f08afb4 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOnColumnApplyPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOnColumnApplyPanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -23,9 +24,11 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -74,7 +77,8 @@ public class RuleOnColumnApplyPanel extends FramedPanel { private static final String RULE_TIP = "

Tip.: Use drag and drop in order to change selected rules.

"; private static final String RULES_GRID_HEIGHT = "184px"; private static final String SET_RULES = "SetRules"; - + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); + interface RuleApplyTemplates extends XTemplates { @XTemplate("{value}") SafeHtml format(String value); @@ -236,19 +240,11 @@ public class RuleOnColumnApplyPanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( propsRules.creationDate(), 56, "Creation Date"); - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleApplyTemplates ruleApplyTemplates = GWT - .create(RuleApplyTemplates .class); - sb.append(ruleApplyTemplates.format(value)); - } - }); - + creationDateCol.setCell(new DateCell(sdf)); + List> l = new ArrayList>(); l.add(nameCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java index 86bc6a3..b74a1f6 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; @@ -14,6 +15,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -21,6 +23,7 @@ import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -72,6 +75,7 @@ public class RuleOpenPanel extends FramedPanel { private static final String WIDTH = "760px"; private static final String HEIGHT = "520px"; private static final String GRID_HEIGHT = "384px"; + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); interface RuleOpenTemplates extends XTemplates { @XTemplate("{value}") @@ -170,19 +174,11 @@ public class RuleOpenPanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( props.creationDate(), 56, "Creation Date"); - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleOpenTemplates ruleOpenTemplates = GWT - .create(RuleOpenTemplates .class); - sb.append(ruleOpenTemplates.format(value)); - } - }); - + creationDateCol.setCell(new DateCell(sdf)); + List> l = new ArrayList>(); l.add(nameCol); l.add(scopeCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java index f72ed29..4254f42 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; @@ -14,6 +15,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -21,6 +23,7 @@ import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -72,6 +75,7 @@ public class RuleSharePanel extends FramedPanel { private static final String WIDTH = "760px"; private static final String HEIGHT = "520px"; private static final String GRID_HEIGHT = "384px"; + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); private EventBus eventBus; private RuleShareDialog parent; @@ -170,20 +174,11 @@ public class RuleSharePanel extends FramedPanel { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( props.creationDate(), 56, "Creation Date"); - - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleShareTemplates ruleShareTemplates = GWT - .create(RuleShareTemplates .class); - sb.append(ruleShareTemplates.format(value)); - } - }); - + creationDateCol.setCell(new DateCell(sdf)); + List> l = new ArrayList>(); l.add(nameCol); l.add(scopeCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableApplySelectRuleCard.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableApplySelectRuleCard.java index 84cb1f2..f3ae9a2 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableApplySelectRuleCard.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableApplySelectRuleCard.java @@ -1,6 +1,7 @@ package org.gcube.portlets.user.td.rulewidget.client.multicolumn; import java.util.ArrayList; +import java.util.Date; import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; @@ -18,6 +19,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.DateCell; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -25,6 +27,7 @@ import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.user.client.Command; @@ -73,9 +76,9 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar; * */ public class RuleOnTableApplySelectRuleCard extends WizardCard { - private static final String GRID_HEIGHT = "334px"; - + private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm"); + interface RuleOnTableSelectTemplates extends XTemplates { @XTemplate("{value}") SafeHtml format(String value); @@ -177,18 +180,10 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard { } }); - ColumnConfig creationDateCol = new ColumnConfig( + ColumnConfig creationDateCol = new ColumnConfig( props.creationDate(), 56, "Creation Date"); - - creationDateCol.setCell(new AbstractCell() { - - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - RuleOnTableSelectTemplates ruleOnTableSelectTemplates = GWT - .create(RuleOnTableSelectTemplates.class); - sb.append(ruleOnTableSelectTemplates.format(value)); - } - }); + + creationDateCol.setCell(new DateCell(sdf)); List> l = new ArrayList>(); l.add(nameCol); diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableNewExpressionCard.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableNewExpressionCard.java index a58f8fe..b6edeae 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableNewExpressionCard.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/RuleOnTableNewExpressionCard.java @@ -10,7 +10,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType; import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; import com.allen_sauer.gwt.log.client.Log; -import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.user.client.Command; import com.sencha.gxt.core.client.util.Padding; import com.sencha.gxt.widget.core.client.box.AlertMessageBox; @@ -26,7 +25,6 @@ import com.sencha.gxt.widget.core.client.form.FormPanel; * */ public class RuleOnTableNewExpressionCard extends WizardCard { - private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss"); private RuleOnTableNewExpressionCard thisCard; private TDRuleTableType tdRuleTableType; private RuleDescriptionData ruleDescriptionData; @@ -47,7 +45,7 @@ public class RuleOnTableNewExpressionCard extends WizardCard { panel.setLabelWidth(90); panel.getElement().setPadding(new Padding(5)); - ruleDescriptionData=new RuleDescriptionData(0, null, null,sdf.format(new Date()),null, null,RuleScopeType.TABLE, null, tdRuleTableType); + ruleDescriptionData=new RuleDescriptionData(0, null, null,new Date(),null, null,RuleScopeType.TABLE, null, tdRuleTableType); try { multiColumnExpressionPanel = new MultiColumnExpressionPanel(null, ruleDescriptionData); panel.add(multiColumnExpressionPanel);