From 295b1c318e618d6d02b20674ce009a58c37e0a44 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 26 Feb 2014 14:33:39 +0000 Subject: [PATCH] Minor Updated git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@92329 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 +- .gwt/.gwt-log | 326 ++++++++++++++++++ pom.xml | 2 +- .../client/ChangeColumnTypePanel.java | 66 +++- .../dimension/DialogCodelistSelection.java | 141 ++++---- .../properties/TabResourceProperties.java | 25 ++ 6 files changed, 487 insertions(+), 79 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/TabResourceProperties.java diff --git a/.classpath b/.classpath index 968534d..b6369f9 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -44,5 +44,5 @@ - + diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 4e581d3..f028d4d 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -896,3 +896,329 @@ Compiling... Compilation completed in 0.00 seconds Removing invalidated units Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 12.07 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 14.59 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 8.63 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 60% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 14.69 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 14.81 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 40% complete (ETR: 6 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 15.49 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 10% complete (ETR: 34 seconds) + 10% complete (ETR: 34 seconds) + 20% complete (ETR: 24 seconds) + 30% complete (ETR: 17 seconds) + 40% complete (ETR: 13 seconds) + 50% complete (ETR: 10 seconds) + 60% complete (ETR: 8 seconds) + 70% complete (ETR: 5 seconds) + 80% complete (ETR: 3 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 16.42 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 50% complete (ETR: 4 seconds) + 60% complete (ETR: 3 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 11.28 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 10.22 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 70% complete (ETR: 2 seconds) + 80% complete (ETR: 1 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 8.03 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes diff --git a/pom.xml b/pom.xml index 9d6461c..0344292 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 4.0.0 org.gcube.portlets.user tabular-data-column-widget - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT tabular-data-column-widget diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java index d843e4c..7ca87d6 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypePanel.java @@ -2,16 +2,19 @@ package org.gcube.portlets.user.td.columnwidget.client; import java.util.ArrayList; +import org.gcube.portlets.user.td.columnwidget.client.dimension.DialogCodelistSelection; import org.gcube.portlets.user.td.columnwidget.client.progress.ChangeColumnTypeProgressDialog; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataTypeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnTypeCodeProperties; +import org.gcube.portlets.user.td.columnwidget.client.properties.TabResourceProperties; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeElement; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnDataTypeStore; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElement; import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeStore; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; @@ -41,6 +44,8 @@ import com.sencha.gxt.widget.core.client.box.AlertMessageBox; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; +import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent; +import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent.BeforeShowContextMenuHandler; import com.sencha.gxt.widget.core.client.event.HideEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; @@ -55,9 +60,9 @@ import com.sencha.gxt.widget.core.client.info.Info; * ChangeColumnTypePanel is the panel for change column type * * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ public class ChangeColumnTypePanel extends FramedPanel { protected String WIDTH = "640px"; @@ -74,6 +79,9 @@ public class ChangeColumnTypePanel extends FramedPanel { protected FieldLabel comboMeasureTypeLabel; protected ComboBox comboAttributeType = null; protected FieldLabel comboAttributeTypeLabel; + protected ComboBox comboDimensionType = null; + protected FieldLabel comboDimensionTypeLabel; + protected ListLoader> loader; protected TextButton change; @@ -207,6 +215,36 @@ public class ChangeColumnTypePanel extends FramedPanel { "Attribute Type"); comboAttributeTypeLabel.setVisible(false); + // comboMeasureType + TabResourceProperties propsDimensionType = GWT + .create(TabResourceProperties.class); + ListStore storeComboDimensionType = new ListStore( + propsDimensionType.id()); + + comboDimensionType = new ComboBox(storeComboDimensionType, + propsDimensionType.label()); + Log.trace("ComboDimensionType created"); + + comboDimensionType.setEmptyText("Select a Dimension..."); + comboDimensionType.setWidth(150); + comboDimensionType.setTypeAhead(true); + comboDimensionType.setTriggerAction(TriggerAction.ALL); + + comboDimensionType + .addBeforeShowContextMenuHandler(new BeforeShowContextMenuHandler() { + + public void onBeforeShowContextMenu( + BeforeShowContextMenuEvent event) { + callDialogCodelistSelection(); + comboDimensionType.collapse(); + + } + }); + + comboDimensionTypeLabel = new FieldLabel(comboDimensionType, "Codelist"); + comboDimensionTypeLabel.setVisible(false); + + // Change change = new TextButton("Change"); SelectHandler changeHandler = new SelectHandler() { @@ -322,13 +360,22 @@ public class ChangeColumnTypePanel extends FramedPanel { if (type == ColumnTypeCode.MEASURE) { comboMeasureTypeLabel.setVisible(true); comboAttributeTypeLabel.setVisible(false); + comboDimensionTypeLabel.setVisible(false); } else { if (type == ColumnTypeCode.ATTRIBUTE) { comboMeasureTypeLabel.setVisible(false); comboAttributeTypeLabel.setVisible(true); + comboDimensionTypeLabel.setVisible(false); } else { - comboMeasureTypeLabel.setVisible(false); - comboAttributeTypeLabel.setVisible(false); + if (type == ColumnTypeCode.DIMENSION) { + comboMeasureTypeLabel.setVisible(false); + comboAttributeTypeLabel.setVisible(false); + comboDimensionTypeLabel.setVisible(true); + } else { + comboMeasureTypeLabel.setVisible(false); + comboAttributeTypeLabel.setVisible(false); + comboDimensionTypeLabel.setVisible(false); + } } } @@ -523,7 +570,8 @@ public class ChangeColumnTypePanel extends FramedPanel { } public void onSuccess(Void result) { - changeColumnTypeProgressDialog= new ChangeColumnTypeProgressDialog(changeColumnTypeSession, eventBus); + changeColumnTypeProgressDialog = new ChangeColumnTypeProgressDialog( + changeColumnTypeSession, eventBus); } }); @@ -542,4 +590,10 @@ public class ChangeColumnTypePanel extends FramedPanel { } + protected void callDialogCodelistSelection() { + DialogCodelistSelection dialogCodelistSelection = new DialogCodelistSelection( + eventBus); + dialogCodelistSelection.show(); + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DialogCodelistSelection.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DialogCodelistSelection.java index 2169054..d401fcb 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DialogCodelistSelection.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/dimension/DialogCodelistSelection.java @@ -6,8 +6,12 @@ import java.util.Iterator; import java.util.List; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; -import org.gcube.portlets.user.td.gwtservice.shared.util.OrderInfo; +import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadConfig; +import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.CodelistPagingLoadResult; +import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.Direction; +import org.gcube.portlets.user.td.gwtservice.shared.tr.paging.OrderInfo; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.GWT; @@ -33,9 +37,12 @@ import com.sencha.gxt.data.shared.loader.PagingLoadResultBean; import com.sencha.gxt.data.shared.loader.PagingLoader; import com.sencha.gxt.widget.core.client.FramedPanel; import com.sencha.gxt.widget.core.client.Window; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; import com.sencha.gxt.widget.core.client.button.TextButton; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; +import com.sencha.gxt.widget.core.client.event.HideEvent; +import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.TextField; @@ -47,12 +54,14 @@ import com.sencha.gxt.widget.core.client.grid.LiveGridView; import com.sencha.gxt.widget.core.client.grid.LiveToolItem; import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem; import com.sencha.gxt.widget.core.client.toolbar.ToolBar; +import com.google.web.bindery.event.shared.EventBus; public class DialogCodelistSelection extends Window { protected static final int WIDTH = 550; protected static final int HEIGHT = 520; protected static final int CACHE_SIZE = 200; - + + private static final TabResourcesProperties properties = GWT .create(TabResourcesProperties.class); @@ -62,14 +71,17 @@ public class DialogCodelistSelection extends Window { properties.agency(), 50, "Agency"); protected static final ColumnConfig dateColumn = new ColumnConfig( properties.date(), 50, "Date"); - + + protected EventBus eventBus; protected Grid grid; protected ExtendedLiveGridView liveGridView; protected PagingLoader> loader; + protected String filter; protected ResourceBundle res; - - public DialogCodelistSelection() { + + public DialogCodelistSelection(EventBus eventBus) { + this.eventBus=eventBus; Log.info("Dialog CodelistSelection"); setWidth(WIDTH); setHeight(HEIGHT); @@ -113,7 +125,10 @@ public class DialogCodelistSelection extends Window { public void onKeyUp(KeyUpEvent event) { Log.trace("searchTerm: " + searchField.getCurrentValue()); - // store.applyFilters(); + filter=searchField.getCurrentValue(); + if(filter!=null&& !filter.isEmpty()){ + loader.load(0, liveGridView.getCacheSize()); + } } }); @@ -122,10 +137,10 @@ public class DialogCodelistSelection extends Window { public void load(PagingLoadConfig loadConfig, final AsyncCallback> callback) { loadData(loadConfig, callback); - + } }; - loader = new PagingLoader>( + loader = new PagingLoader>( proxy); loader.setRemoteSort(true); @@ -158,7 +173,6 @@ public class DialogCodelistSelection extends Window { grid.setLoadMask(true); grid.setColumnReordering(true); - SelectHandler sh = new SelectHandler() { public void onSelect(SelectEvent event) { loader.load(); @@ -185,74 +199,51 @@ public class DialogCodelistSelection extends Window { protected void loadData(PagingLoadConfig loadConfig, final AsyncCallback> callback) { - /* - * TDGWTServiceAsync.INSTANCE.getTabularResources(new - * AsyncCallback>() { - * - * public void onFailure(Throwable caught) { - * Log.error("load combo failure:" + caught.getLocalizedMessage()); - * callback.onFailure(caught); } - * - * public void onSuccess(ArrayList result) { - * Log.trace("loaded " + result.size() + " ColumnData"); /*if - * (columnName != null) { for (ColumnData cd : result) { if - * (cd.getName().compareTo(columnName) == 0) { comboColumn.setValue(cd); - * labelColumn.setValue(cd.getLabel()); - * comboColumnTypeCode.select(ColumnTypeCodeStore - * .selected(cd.getTypeCode())); } } } callback.onSuccess(new - * ListLoadResultBean( result)); - * - * } - * - * - * }); - */ - - - ArrayList trs = new ArrayList(1000); - List sortInfo=loadConfig.getSortInfo(); - Iterator iterator=sortInfo.iterator(); - ArrayList listOrderInfo=new ArrayList(); - - - while(iterator.hasNext()){ - SortInfo info=iterator.next(); - OrderInfo ord=new OrderInfo(); - SortDir sd=info.getSortDir(); - if(sd.compareTo(SortDir.ASC)==0){ - ord.setDirection("ASC"); + List sortInfo = loadConfig.getSortInfo(); + Iterator iterator = sortInfo.iterator(); + ArrayList listOrderInfo = new ArrayList(); + + while (iterator.hasNext()) { + SortInfo info = iterator.next(); + OrderInfo ord = new OrderInfo(); + SortDir sd = info.getSortDir(); + if (sd.compareTo(SortDir.ASC) == 0) { + ord.setDirection(Direction.ASC); } else { - ord.setDirection("DESC"); + ord.setDirection(Direction.DESC); } ord.setField(info.getSortField()); listOrderInfo.add(ord); } - - int totalLength = loadConfig.getOffset() + loadConfig.getLimit(); - int offset = loadConfig.getOffset(); - Log.debug("Offset: " + offset); - Log.debug("Limit:" + loadConfig.getLimit()); - Log.debug("TotalLength:" + totalLength); - int cur = 0; - for (int i = offset; i < totalLength; i++) { - try { - cur = i + 1; - TabResource tr = new TabResource(); - tr.setId(String.valueOf(i)); - tr.setName("Number" + cur); - tr.setAgency("Agency" + cur); - tr.setDate("2013/11/01"); - trs.add(tr); + CodelistPagingLoadConfig codelistPagingLoadConfig = new CodelistPagingLoadConfig( + loadConfig.getOffset(), loadConfig.getLimit(), listOrderInfo, + filter); - } catch (IndexOutOfBoundsException e) { - Log.debug("OutOfBounds size:" + trs.size() + " index: " + i - + " Error:" + e.getMessage() + "\n"); - } - } + TDGWTServiceAsync.INSTANCE.getCodelistsPagingLoader( + codelistPagingLoadConfig, + new AsyncCallback() { - callback.onSuccess(new PagingLoadResultBean(trs, 1000, - offset)); + @Override + public void onFailure(Throwable caught) { + Log.debug("Error Retrieving Codelist", + caught.getMessage()); + caught.printStackTrace(); + alert("Error Retrieving Codelist", + "Error retrieving codelist on server"); + + } + + @Override + public void onSuccess(CodelistPagingLoadResult result) { + callback.onSuccess(new PagingLoadResultBean( + result.getLtr(), result.getTotalLenght(), + result.getOffset())); + + } + }); + + } protected HandlerRegistration addSelectionHandler( @@ -282,4 +273,16 @@ public class DialogCodelistSelection extends Window { } }; + private void alert(String title, String message) { + final AlertMessageBox d = new AlertMessageBox(title, message); + d.addHideHandler(new HideHandler() { + + public void onHide(HideEvent event) { + + } + }); + d.show(); + + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/TabResourceProperties.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/TabResourceProperties.java new file mode 100644 index 0000000..9943c37 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/TabResourceProperties.java @@ -0,0 +1,25 @@ +package org.gcube.portlets.user.td.columnwidget.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" + * g.panichi@isti.cnr.it + * + */ +public interface TabResourceProperties extends + PropertyAccess { + + @Path("id") + ModelKeyProvider id(); + + @Path("name") + LabelProvider label(); + +}