Fixed TimeZone
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@115607 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e6489aa96c
commit
ce0fa99266
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.user.td.openwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
|
@ -16,9 +15,9 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
|||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
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;
|
||||
|
@ -41,7 +40,7 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
public class TabResourceInfoDialog extends Dialog {
|
||||
private static final int HEIGHT = 500;
|
||||
private static final int WIDTH = 500;
|
||||
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
private static final DateTimeFormat sdf=DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
|
||||
private TabResource tabResource;
|
||||
private TabResourcesInfoDialogPropertiesMessages msgs;
|
||||
private EventBus eventBus;
|
||||
|
@ -122,7 +121,12 @@ public class TabResourceInfoDialog extends Dialog {
|
|||
1, -1, new Margins(0)));
|
||||
|
||||
TextField trCreationDate = new TextField();
|
||||
trCreationDate.setValue(tabResource.getDate());
|
||||
try {
|
||||
trCreationDate.setValue(sdf.format(tabResource.getDate()));
|
||||
} catch(Throwable e){
|
||||
Log.error("Error parsing creation date: "+e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
trCreationDate.setReadOnly(true);
|
||||
FieldLabel trCreationDateLabel = new FieldLabel(trCreationDate,
|
||||
msgs.dateLabel());
|
||||
|
@ -148,19 +152,10 @@ public class TabResourceInfoDialog extends Dialog {
|
|||
trValidFromField.setReadOnly(true);
|
||||
FieldLabel trValidFromLabel=new FieldLabel(trValidFromField, msgs.validFromLabel());
|
||||
trValidFromField.clear();
|
||||
if (tabResource.getValidFrom() == null
|
||||
|| tabResource.getValidFrom().isEmpty()) {
|
||||
if (tabResource.getValidFrom() == null) {
|
||||
Log.debug("ValidFrom null or empty");
|
||||
} else {
|
||||
Date vFrom;
|
||||
try {
|
||||
vFrom = sdf.parse(tabResource.getValidFrom());
|
||||
trValidFromField.setValue(vFrom);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.error("Error Parsing Valid From for Tabular Resource: "
|
||||
+ tabResource);
|
||||
e.printStackTrace();
|
||||
}
|
||||
trValidFromField.setValue(tabResource.getValidFrom());
|
||||
}
|
||||
configurationFieldSetLayout.add(trValidFromLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
@ -171,19 +166,10 @@ public class TabResourceInfoDialog extends Dialog {
|
|||
FieldLabel trValidUntilToLabel= new FieldLabel(trValidUntilToField,
|
||||
msgs.validUntilToLabel());
|
||||
trValidUntilToField.clear();
|
||||
if (tabResource.getValidUntilTo() == null
|
||||
|| tabResource.getValidUntilTo().isEmpty()) {
|
||||
if (tabResource.getValidUntilTo() == null) {
|
||||
Log.debug("ValidUntilTo null or empty");
|
||||
} else {
|
||||
Date vUntilTo;
|
||||
try {
|
||||
vUntilTo = sdf.parse(tabResource.getValidUntilTo());
|
||||
trValidUntilToField.setValue(vUntilTo);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.error("Error Parsing Valid Until To for Tabular Resource: "
|
||||
+ tabResource);
|
||||
e.printStackTrace();
|
||||
}
|
||||
trValidUntilToField.setValue(tabResource.getValidUntilTo());
|
||||
}
|
||||
configurationFieldSetLayout.add(trValidUntilToLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.openwidget.client;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
|
@ -16,7 +18,7 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
|||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface TabResourcesProperties extends PropertyAccess<TabResource> {
|
||||
public interface TabResourceProperties extends PropertyAccess<TabResource> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<TabResource> id();
|
||||
|
@ -24,7 +26,7 @@ public interface TabResourcesProperties extends PropertyAccess<TabResource> {
|
|||
ValueProvider<TabResource, String> name();
|
||||
ValueProvider<TabResource, String> tabResourceType();
|
||||
ValueProvider<TabResource, String> agency();
|
||||
ValueProvider<TabResource, String> date();
|
||||
ValueProvider<TabResource, Date> date();
|
||||
ValueProvider<TabResource, String> tableTypeName();
|
||||
ValueProvider<TabResource, String> ownerLogin();
|
||||
ValueProvider<TabResource, Boolean> locked();
|
|
@ -4,6 +4,7 @@
|
|||
package org.gcube.portlets.user.td.openwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
|
@ -20,6 +21,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;
|
||||
|
@ -29,6 +31,7 @@ import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
|||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
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;
|
||||
|
@ -76,6 +79,9 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
|||
public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||
HasSelectionHandlers<TabResource> {
|
||||
|
||||
private static final DateTimeFormat sdf = DateTimeFormat
|
||||
.getFormat("yyyy-MM-dd HH:mm");
|
||||
|
||||
interface NameTooltipTemplates extends XTemplates {
|
||||
@XTemplate("<span qtip=\"{desc}\" qtitle=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value, String desc);
|
||||
|
@ -132,8 +138,8 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
|
||||
identity);
|
||||
|
||||
TabResourcesProperties properties = GWT
|
||||
.create(TabResourcesProperties.class);
|
||||
TabResourceProperties properties = GWT
|
||||
.create(TabResourceProperties.class);
|
||||
|
||||
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
||||
properties.id());
|
||||
|
@ -161,26 +167,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
|
||||
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.name(), 90, "Name");
|
||||
|
||||
/*
|
||||
* nameColumn.setCell( new AbstractCell<String>() {
|
||||
*
|
||||
* @Override public void render(Context context, String value,
|
||||
* SafeHtmlBuilder sb) { TabResource
|
||||
* tabResource=store.get(context.getIndex());
|
||||
*
|
||||
* final NameTooltipTemplates nameToolTipTemplates = GWT
|
||||
* .create(NameTooltipTemplates.class); String valueSafe=""; String
|
||||
* descriptionSafe="";
|
||||
*
|
||||
* if(value!=null){ valueSafe=SafeHtmlUtils.htmlEscape(value); }
|
||||
* if(tabResource!=null && tabResource.getAgency()!=null){
|
||||
* descriptionSafe=SafeHtmlUtils.htmlEscape(tabResource.getAgency()); }
|
||||
* sb.append(nameToolTipTemplates.format(valueSafe, descriptionSafe));
|
||||
*
|
||||
* } });
|
||||
*/
|
||||
|
||||
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.tabResourceType(), 30, "Type");
|
||||
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
|
||||
|
@ -191,21 +177,11 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
properties.agency(), 60, "Agency");
|
||||
ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.ownerLogin(), 70, "Owner");
|
||||
ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
||||
ColumnConfig<TabResource, Date> dateColumn = new ColumnConfig<TabResource, Date>(
|
||||
properties.date(), 50, "Creation Date");
|
||||
|
||||
/*dateColumn.setCell(new AbstractCell<String>(){
|
||||
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context,
|
||||
String value, SafeHtmlBuilder sb) {
|
||||
if(value!=null){
|
||||
String d=TimeZoneUtils.getLocalFormat(value);
|
||||
sb.appendHtmlConstant(d);
|
||||
}
|
||||
|
||||
}
|
||||
});*/
|
||||
dateColumn.setCell(new DateCell(sdf));
|
||||
|
||||
lockedColumn.setCell(new AbstractCell<Boolean>() {
|
||||
|
||||
@Override
|
||||
|
@ -360,11 +336,12 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
}
|
||||
|
||||
protected void requestInfo(TabResource tabResource) {
|
||||
if(tabResource.isLocked()){
|
||||
UtilsGXT3.alert("Attention", "Tabular Resource is locked no info available!");
|
||||
if (tabResource.isLocked()) {
|
||||
UtilsGXT3.alert("Attention",
|
||||
"Tabular Resource is locked no info available!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(
|
||||
tabResource.getTrId(), new AsyncCallback<TabResource>() {
|
||||
|
||||
|
@ -384,15 +361,16 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
Log.error("Tabular Resource is Locked: "
|
||||
+ caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error",
|
||||
caught.getLocalizedMessage(), "", caught);
|
||||
|
||||
|
||||
caught.getLocalizedMessage(), "",
|
||||
caught);
|
||||
|
||||
} else {
|
||||
Log.error("Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
parent.showErrorAndHide("Error",
|
||||
caught.getLocalizedMessage(), "", caught);
|
||||
|
||||
caught.getLocalizedMessage(), "",
|
||||
caught);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -414,10 +392,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
|||
&& item.getAgency().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getDate() != null
|
||||
&& item.getDate().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getOwnerLogin() != null
|
||||
&& item.getOwnerLogin().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.td.openwidget.client.resources;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.resources.client.ClientBundle.Source;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue