Fixed TimeZone
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-widget@115601 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
79a80add15
commit
60a6c072a2
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
package org.gcube.portlets.user.td.codelistmappingimportwidget.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();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
package org.gcube.portlets.user.td.codelistmappingimportwidget.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;
|
||||||
|
@ -16,6 +16,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;
|
||||||
|
@ -25,6 +26,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;
|
||||||
|
@ -57,30 +59,17 @@ import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
//Next in GXT 3.1.1
|
//Next in GXT 3.1.1
|
||||||
|
|
||||||
public class TabResourcesSelectionPanel extends ContentPanel implements
|
public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
HasSelectionHandlers<TabResource> {
|
HasSelectionHandlers<TabResource> {
|
||||||
|
private static final DateTimeFormat sdf = DateTimeFormat
|
||||||
|
.getFormat("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
private static final TabResourcesProperties properties = GWT
|
private Grid<TabResource> grid;
|
||||||
.create(TabResourcesProperties.class);
|
private ResourceBundle res;
|
||||||
|
private Menu contextMenu;
|
||||||
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -93,15 +82,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());
|
||||||
|
@ -115,9 +96,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: "));
|
||||||
|
@ -134,10 +113,36 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
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() {
|
||||||
|
|
||||||
|
@ -189,7 +194,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);
|
||||||
|
@ -251,10 +256,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()))
|
||||||
|
@ -277,18 +278,22 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
if (caught instanceof TDGWTIsLockedException) {
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
Log.error(caught.getLocalizedMessage());
|
Log.error(caught.getLocalizedMessage());
|
||||||
parent.showErrorAndHide("Error Locked",
|
parent.showErrorAndHide("Error Locked",
|
||||||
caught.getLocalizedMessage(), "", caught);
|
caught.getLocalizedMessage(), "",
|
||||||
|
caught);
|
||||||
} else {
|
} else {
|
||||||
if (caught instanceof TDGWTIsFinalException) {
|
if (caught instanceof TDGWTIsFinalException) {
|
||||||
Log.error(caught.getLocalizedMessage());
|
Log.error(caught.getLocalizedMessage());
|
||||||
parent.showErrorAndHide("Error Final",
|
parent.showErrorAndHide("Error Final",
|
||||||
caught.getLocalizedMessage(),
|
caught.getLocalizedMessage(), "",
|
||||||
"", caught);
|
caught);
|
||||||
} else {
|
} else {
|
||||||
Log.debug("Error retrieving tabular resource: "
|
Log.debug("Error retrieving tabular resource: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
parent.showErrorAndHide("Error",
|
parent.showErrorAndHide(
|
||||||
"Error retrieving tabular resources on server: ",caught.getLocalizedMessage(),caught);
|
"Error",
|
||||||
|
"Error retrieving tabular resources on server: ",
|
||||||
|
caught.getLocalizedMessage(),
|
||||||
|
caught);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue