Fixed TimeZone

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@115612 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-29 12:37:11 +00:00 committed by Giancarlo Panichi
parent 2dfbf8ba53
commit e2221229e1
2 changed files with 57 additions and 61 deletions

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.td.unionwizardwidget.client; package org.gcube.portlets.user.td.unionwizardwidget.client;
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;
@ -13,7 +15,7 @@ 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 TabResourcesProperties extends PropertyAccess<TabResource> { public interface TabResourceProperties extends PropertyAccess<TabResource> {
@Path("id") @Path("id")
ModelKeyProvider<TabResource> id(); ModelKeyProvider<TabResource> id();
@ -21,7 +23,7 @@ public interface TabResourcesProperties extends PropertyAccess<TabResource> {
ValueProvider<TabResource, String> name(); ValueProvider<TabResource, String> name();
ValueProvider<TabResource, String> tabResourceType(); ValueProvider<TabResource, String> tabResourceType();
ValueProvider<TabResource, String> agency(); ValueProvider<TabResource, String> agency();
ValueProvider<TabResource, String> date(); ValueProvider<TabResource, Date> date();
ValueProvider<TabResource, String> tableTypeName(); ValueProvider<TabResource, String> tableTypeName();
ValueProvider<TabResource, String> ownerLogin(); ValueProvider<TabResource, String> ownerLogin();

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.td.unionwizardwidget.client; package org.gcube.portlets.user.td.unionwizardwidget.client;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Date;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundl
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@ -24,6 +25,7 @@ import com.google.gwt.event.logical.shared.HasSelectionHandlers;
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.event.shared.HandlerRegistration; import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.IdentityValueProvider; import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode; import com.sencha.gxt.core.client.Style.SelectionMode;
@ -59,26 +61,11 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class TabResourcesSelectionPanel extends ContentPanel implements public class TabResourcesSelectionPanel extends ContentPanel implements
HasSelectionHandlers<TabResource> { HasSelectionHandlers<TabResource> {
private static final DateTimeFormat sdf = DateTimeFormat
private static final TabResourcesProperties properties = GWT .getFormat("yyyy-MM-dd HH:mm");
.create(TabResourcesProperties.class); private Grid<TabResource> grid;
private ResourceBundle res;
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>( private Menu contextMenu;
properties.name(), 90, "Name");
protected static final ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
properties.tabResourceType(), 30, "Type");
protected static final ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
properties.tableTypeName(), 30, "Table Type");
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
properties.agency(), 60, "Agency");
protected static final ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
properties.ownerLogin(), 70, "Owner");
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
properties.date(), 50, "Creation Date");
protected Grid<TabResource> grid;
protected ResourceBundle res;
protected Menu contextMenu;
private TabResource removableTR; private TabResource removableTR;
@ -91,15 +78,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
init(); init();
try { try {
createContextMenu(); createContextMenu();
} catch (Throwable e) { buildPanel();
Log.debug("Error In CreateContextMenu:" + e.getMessage());
e.printStackTrace();
}
try {
buildPanel(properties.id(),
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,typeColumn,
tableTypeNameColumn, ownerColumn, agencyColumn, dateColumn),
nameColumn);
} catch (Throwable e) { } catch (Throwable e) {
Log.debug("Error building panel:" + e.getMessage()); Log.debug("Error building panel:" + e.getMessage());
@ -113,9 +92,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
} }
protected void buildPanel(ModelKeyProvider<TabResource> keyProvider, protected void buildPanel() {
List<ColumnConfig<TabResource, ?>> columns,
ColumnConfig<TabResource, ?> autoexpandColumn) {
ToolBar toolBar = new ToolBar(); ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Search: ")); toolBar.add(new LabelToolItem("Search: "));
@ -131,11 +108,36 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>(); IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>();
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>( final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(
identity); identity);
TabResourceProperties properties = GWT
.create(TabResourceProperties.class);
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
properties.name(), 90, "Name");
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
properties.tabResourceType(), 30, "Type");
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
properties.tableTypeName(), 30, "Table Type");
ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
properties.agency(), 60, "Agency");
ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
properties.ownerLogin(), 70, "Owner");
ColumnConfig<TabResource, Date> dateColumn = new ColumnConfig<TabResource, Date>(
properties.date(), 50, "Creation Date");
dateColumn.setCell(new DateCell(sdf));
List<ColumnConfig<TabResource, ?>> columns = new ArrayList<ColumnConfig<TabResource, ?>>();
columns.add(nameColumn);
columns.add(typeColumn);
columns.add(tableTypeNameColumn);
columns.add(agencyColumn);
columns.add(ownerColumn);
columns.add(dateColumn);
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns); ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>( final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
keyProvider); properties.id());
searchField.addKeyUpHandler(new KeyUpHandler() { searchField.addKeyUpHandler(new KeyUpHandler() {
@ -187,7 +189,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
sm.setSelectionMode(SelectionMode.SINGLE); sm.setSelectionMode(SelectionMode.SINGLE);
grid.setLoader(loader); grid.setLoader(loader);
grid.setSelectionModel(sm); grid.setSelectionModel(sm);
grid.getView().setAutoExpandColumn(autoexpandColumn); grid.getView().setAutoExpandColumn(nameColumn);
grid.getView().setStripeRows(true); grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true); grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true); grid.getView().setAutoFill(true);
@ -249,10 +251,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
&& item.getAgency().toLowerCase() && item.getAgency().toLowerCase()
.contains(searchTerm.toLowerCase())) .contains(searchTerm.toLowerCase()))
return true; return true;
if (item.getDate() != null
&& item.getDate().toLowerCase()
.contains(searchTerm.toLowerCase()))
return true;
if (item.getOwnerLogin() != null if (item.getOwnerLogin() != null
&& item.getOwnerLogin().toLowerCase() && item.getOwnerLogin().toLowerCase()
.contains(searchTerm.toLowerCase())) .contains(searchTerm.toLowerCase()))
@ -340,21 +338,17 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
} }
}); });
/* GXT 3.0.1 /*
mb.addHideHandler(new HideHandler() { * GXT 3.0.1 mb.addHideHandler(new HideHandler() { public void
public void onHide(HideEvent event) { * onHide(HideEvent event) {
*
*
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES * if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
.name())) { * .name())) { callDeleteTabularResource(); } else if
callDeleteTabularResource(); * (mb.getHideButton() == mb .getButtonById(PredefinedButton.NO.name()))
} else if (mb.getHideButton() == mb * { // perform NO action }
.getButtonById(PredefinedButton.NO.name())) { *
// perform NO action * } });
}
}
});
*/ */
mb.setWidth(300); mb.setWidth(300);
mb.show(); mb.show();