Fixed TimeZone

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@115604 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-29 12:35:45 +00:00
parent 2fff4d09bb
commit 07dd4732f5
6 changed files with 71 additions and 69 deletions

View File

@ -29,7 +29,6 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
@ -66,8 +65,7 @@ public class ColumnExpressionPanel extends FramedPanel {
private static final String WIDTH = "658px"; private static final String WIDTH = "658px";
private static final String HEIGHT = "364px"; private static final String HEIGHT = "364px";
private static final String RULE_HEIGHT = "388px"; private static final String RULE_HEIGHT = "388px";
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
private enum ColumnExpressionPanelType { private enum ColumnExpressionPanelType {
ColumnFilter, RowDeleteByExpression, Template, RuleOnColumn; ColumnFilter, RowDeleteByExpression, Template, RuleOnColumn;
} }
@ -443,7 +441,7 @@ public class ColumnExpressionPanel extends FramedPanel {
columnMockUp.getColumnDataType()); columnMockUp.getColumnDataType());
RuleDescriptionData ruleDescriptionData = new RuleDescriptionData( RuleDescriptionData ruleDescriptionData = new RuleDescriptionData(
0, ruleNameS, ruleDescriptionS, sdf.format(new Date()), 0, ruleNameS, ruleDescriptionS, new Date(),
null, null, RuleScopeType.COLUMN, exp, tdBaseColumnRule); null, null, RuleScopeType.COLUMN, exp, tdBaseColumnRule);
return ruleDescriptionData; return ruleDescriptionData;
} else { } else {

View File

@ -24,7 +24,6 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeC
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.web.bindery.event.shared.EventBus; import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign; import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
@ -53,23 +52,21 @@ import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
* *
*/ */
public class MultiColumnExpressionPanel extends FramedPanel { public class MultiColumnExpressionPanel extends FramedPanel {
private static final String WIDTH = "929px"; private static final String WIDTH = "929px";
private static final String HEIGHT = "352px"; private static final String HEIGHT = "352px";
private static final String CONDITION_FIELD_WIDTH = "910px"; private static final String CONDITION_FIELD_WIDTH = "910px";
private static final String RULE_CONDITION_FIELD_WIDTH = "914px"; private static final String RULE_CONDITION_FIELD_WIDTH = "914px";
private static final String ROWS_DELETE_HEIGHT = "388px"; private static final String ROWS_DELETE_HEIGHT = "388px";
private static final String RULE_HEIGHT= "312px"; private static final String RULE_HEIGHT = "312px";
private static final String RULE_MULTI_CONDITION_WIDTH = "890px"; private static final String RULE_MULTI_CONDITION_WIDTH = "890px";
private static final String RULE_MULTI_CONDITION_HEIGHT = "228px"; private static final String RULE_MULTI_CONDITION_HEIGHT = "228px";
private static final String RULE_DESCRIPTION_HEIGHT = "44px"; private static final String RULE_DESCRIPTION_HEIGHT = "44px";
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
private enum MultiColumnExpressionPanelType { private enum MultiColumnExpressionPanelType {
ColumnFilter, RowDeleteByExpression, Template, RuleOnTable; ColumnFilter, RowDeleteByExpression, Template, RuleOnTable;
} }
@ -168,9 +165,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
this.initialRuleDescriptionData = initialRuleDescriptionData; this.initialRuleDescriptionData = initialRuleDescriptionData;
retrieveColumns(); retrieveColumns();
} }
protected void retrieveColumns() throws MultiColumnExpressionPanelException { protected void retrieveColumns() throws MultiColumnExpressionPanelException {
if (initialRuleDescriptionData == null) { if (initialRuleDescriptionData == null) {
@ -217,7 +211,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
setBodyBorder(false); setBodyBorder(false);
setHeaderVisible(false); setHeaderVisible(false);
FieldSet propertiesField = new FieldSet(); FieldSet propertiesField = new FieldSet();
propertiesField.setHeadingText("Properties"); propertiesField.setHeadingText("Properties");
propertiesField.setCollapsible(false); propertiesField.setCollapsible(false);
@ -231,7 +224,8 @@ public class MultiColumnExpressionPanel extends FramedPanel {
conditionsField.setCollapsible(false); conditionsField.setCollapsible(false);
conditionsField.setWidth(RULE_CONDITION_FIELD_WIDTH); conditionsField.setWidth(RULE_CONDITION_FIELD_WIDTH);
conditionWidget = new ConditionOnMultiColumnWidget(columns,RULE_MULTI_CONDITION_WIDTH,RULE_MULTI_CONDITION_HEIGHT); conditionWidget = new ConditionOnMultiColumnWidget(columns,
RULE_MULTI_CONDITION_WIDTH, RULE_MULTI_CONDITION_HEIGHT);
conditionsField.add(conditionWidget); conditionsField.add(conditionWidget);
HBoxLayoutContainer flowButton = new HBoxLayoutContainer(); HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
@ -268,10 +262,10 @@ public class MultiColumnExpressionPanel extends FramedPanel {
flowButton flowButton
.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); .add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
//basicLayout.setAdjustForScroll(true); // basicLayout.setAdjustForScroll(true);
basicLayout.add(propertiesField, new VerticalLayoutData(1, -1, basicLayout.add(propertiesField, new VerticalLayoutData(1, -1,
new Margins(1))); new Margins(1)));
@ -294,7 +288,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
} }
} }
} catch (Throwable e) { } catch (Throwable e) {
Log.debug("Error in createOnRule(): "+e.getLocalizedMessage()); Log.debug("Error in createOnRule(): " + e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -335,9 +329,8 @@ public class MultiColumnExpressionPanel extends FramedPanel {
String ruleNameS = ruleName.getCurrentValue(); String ruleNameS = ruleName.getCurrentValue();
String ruleDescriptionS = ruleDescription.getCurrentValue(); String ruleDescriptionS = ruleDescription.getCurrentValue();
RuleDescriptionData ruleDescriptionData = new RuleDescriptionData( RuleDescriptionData ruleDescriptionData = new RuleDescriptionData(
0, ruleNameS, ruleDescriptionS, 0, ruleNameS, ruleDescriptionS, new Date(), null,
sdf.format(new Date()), null, null, null, RuleScopeType.TABLE, exp,
RuleScopeType.TABLE, exp,
initialRuleDescriptionData.getTdRuleType()); initialRuleDescriptionData.getTdRuleType());
return ruleDescriptionData; return ruleDescriptionData;
} else { } else {
@ -362,7 +355,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
setBodyBorder(false); setBodyBorder(false);
setHeaderVisible(false); setHeaderVisible(false);
HBoxLayoutContainer flowButton = new HBoxLayoutContainer(); HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
@ -404,10 +396,9 @@ public class MultiColumnExpressionPanel extends FramedPanel {
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
//basicLayout.setAdjustForScroll(true); // basicLayout.setAdjustForScroll(true);
// basicLayout.setScrollMode(ScrollMode.AUTO); Set In GXT 3.0.1 // basicLayout.setScrollMode(ScrollMode.AUTO); Set In GXT 3.0.1
basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1, basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1,
@ -424,7 +415,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
setBodyBorder(false); setBodyBorder(false);
setHeaderVisible(false); setHeaderVisible(false);
HBoxLayoutContainer flowButton = new HBoxLayoutContainer(); HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
@ -464,9 +454,8 @@ public class MultiColumnExpressionPanel extends FramedPanel {
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
//basicLayout.setAdjustForScroll(true); // basicLayout.setAdjustForScroll(true);
basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1, basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1,
new Margins(0))); new Margins(0)));
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins( basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
@ -490,7 +479,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
conditionsField.setHeadingText("Conditions"); conditionsField.setHeadingText("Conditions");
conditionsField.setCollapsible(false); conditionsField.setCollapsible(false);
conditionsField.setWidth(CONDITION_FIELD_WIDTH); conditionsField.setWidth(CONDITION_FIELD_WIDTH);
conditionWidget = new ConditionOnMultiColumnWidget(columns); conditionWidget = new ConditionOnMultiColumnWidget(columns);
Log.debug("ConditionWidget" + conditionWidget); Log.debug("ConditionWidget" + conditionWidget);
conditionsField.add(conditionWidget); conditionsField.add(conditionWidget);
@ -524,7 +513,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1, basicLayout.add(conditionsField, new VerticalLayoutData(-1, -1,
new Margins(1))); new Margins(1)));
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins( basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(

View File

@ -1,9 +1,11 @@
package org.gcube.portlets.user.td.expressionwidget.client.properties; package org.gcube.portlets.user.td.expressionwidget.client.properties;
import java.util.Date;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import com.google.gwt.editor.client.Editor.Path; import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider; import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess; import com.sencha.gxt.data.shared.PropertyAccess;
@ -13,13 +15,16 @@ import com.sencha.gxt.data.shared.PropertyAccess;
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public interface TabResourceProperties extends public interface TabResourceProperties extends PropertyAccess<TabResource> {
PropertyAccess<TabResource> {
@Path("id") @Path("id")
ModelKeyProvider<TabResource> id(); ModelKeyProvider<TabResource> id();
@Path("name") ValueProvider<TabResource, String> name();
LabelProvider<TabResource> label(); ValueProvider<TabResource, String> tabResourceType();
ValueProvider<TabResource, String> agency();
ValueProvider<TabResource, Date> date();
ValueProvider<TabResource, String> tableTypeName();
ValueProvider<TabResource, String> ownerLogin();
} }

View File

@ -0,0 +1,25 @@
package org.gcube.portlets.user.td.expressionwidget.client.properties;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface TabResourcePropertiesCombo extends
PropertyAccess<TabResource> {
@Path("id")
ModelKeyProvider<TabResource> id();
@Path("name")
LabelProvider<TabResource> label();
}

View File

@ -1,7 +1,5 @@
package org.gcube.portlets.user.td.expressionwidget.server.service.rule; package org.gcube.portlets.user.td.expressionwidget.server.service.rule;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
@ -30,9 +28,6 @@ public class RuleDescriptionMap {
private static final Logger logger = LoggerFactory private static final Logger logger = LoggerFactory
.getLogger(RuleDescriptionMap.class); .getLogger(RuleDescriptionMap.class);
private static SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm");
private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!"; private static final String SECURITY_EXCEPTION_RIGHTS = "Security exception, you don't have the required rights!";
public static RuleDescriptionData map(RuleDescription ruleDescription) public static RuleDescriptionData map(RuleDescription ruleDescription)
@ -49,9 +44,8 @@ public class RuleDescriptionMap {
throw new TDGWTServiceException("Rule description has scope null"); throw new TDGWTServiceException("Rule description has scope null");
} }
ruleDescriptionData = createRuleDescriptionData(ruleDescription); ruleDescriptionData = createRuleDescriptionData(ruleDescription);
return ruleDescriptionData; return ruleDescriptionData;
} }
@ -71,13 +65,13 @@ public class RuleDescriptionMap {
Contacts owner = new Contacts("", ruleDescription.getOwner(), false); Contacts owner = new Contacts("", ruleDescription.getOwner(), false);
ArrayList<Contacts> contacts = retrieveRuleShareInfo(ruleDescription); ArrayList<Contacts> contacts = retrieveRuleShareInfo(ruleDescription);
String creationDate=""; Date creationDate = null;
try{ try {
creationDate = sdf.format(ruleDescription.getCreationDate().getTime()); creationDate = ruleDescription.getCreationDate().getTime();
} catch(IllegalArgumentException e){ } catch (Throwable e) {
logger.error("Error in rule description, creation date is not valid!"+ logger.error("Error in rule description, creation date is not valid!"
ruleDescription.getCreationDate()); + ruleDescription.getCreationDate());
throw new TDGWTServiceException( throw new TDGWTServiceException(
"Error in rule description, creation date is not valid!"); "Error in rule description, creation date is not valid!");
} }
@ -140,7 +134,7 @@ public class RuleDescriptionMap {
} }
ruleDescription = createRuleDescription(ruleDescriptionData); ruleDescription = createRuleDescription(ruleDescriptionData);
return ruleDescription; return ruleDescription;
} }
@ -170,19 +164,8 @@ public class RuleDescriptionMap {
"Error saving rule, rule column type is null!"); "Error saving rule, rule column type is null!");
} }
Date cDate;
try {
cDate = sdf.parse(ruleDescriptionData.getCreationDate());
} catch (ParseException e) {
logger.error("Error saving rule, creation date is not valid: "
+ ruleDescriptionData.getCreationDate());
throw new TDGWTServiceException(
"Error saving rule, creation date is not valid: "
+ ruleDescriptionData.getCreationDate());
}
GregorianCalendar creationDate = new GregorianCalendar(); GregorianCalendar creationDate = new GregorianCalendar();
creationDate.setTime(cDate); creationDate.setTime(ruleDescriptionData.getCreationDate());
RuleDescription ruleDescription = new RuleDescription( RuleDescription ruleDescription = new RuleDescription(
ruleDescriptionData.getId(), ruleDescriptionData.getName(), ruleDescriptionData.getId(), ruleDescriptionData.getName(),

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.td.expressionwidget.shared.rule; package org.gcube.portlets.user.td.expressionwidget.shared.rule;
import java.util.Date;
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
import com.google.gwt.editor.client.Editor.Path; import com.google.gwt.editor.client.Editor.Path;
@ -23,7 +25,7 @@ public interface RuleDescriptionDataProperties extends
ValueProvider<RuleDescriptionData, String> scopeLabel(); ValueProvider<RuleDescriptionData, String> scopeLabel();
ValueProvider<RuleDescriptionData, String> creationDate(); ValueProvider<RuleDescriptionData, Date> creationDate();
ValueProvider<RuleDescriptionData, String> description(); ValueProvider<RuleDescriptionData, String> description();