From a48a94131280bc027ff304a852be9fbfafd3623d Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 8 Apr 2014 08:45:11 +0000 Subject: [PATCH] Update Batch Replace git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94505 82a268e6-3cf1-43bd-a215-b396298e98cf --- .gwt/.gwt-log | 32 ++++++++++++ .../client/batch/ReplaceBatchPanel.java | 51 +++++++++---------- .../ShowOccurrencesTypeProperties.java | 3 +- .../store/ShowOccurrencesTypeElement.java | 40 +++++++-------- .../store/ShowOccurrencesTypeStore.java | 24 ++++----- 5 files changed, 88 insertions(+), 62 deletions(-) diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 3291ff2..c5eab35 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -2472,3 +2472,35 @@ 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: 22 seconds) + 10% complete (ETR: 22 seconds) + 20% complete (ETR: 21 seconds) + 30% complete (ETR: 15 seconds) + 40% complete (ETR: 11 seconds) + 50% complete (ETR: 8 seconds) + 60% complete (ETR: 6 seconds) + 70% complete (ETR: 4 seconds) + 80% complete (ETR: 3 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 21.06 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/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java index e0e7191..f2080df 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/ReplaceBatchPanel.java @@ -15,8 +15,10 @@ 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.DimensionRow; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurrences; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.OccurrencesForReplaceBatchColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceBatchColumnSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceEntry; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ShowOccurrencesType; import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; @@ -62,7 +64,6 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti 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.ComboBox; -import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel; import com.sencha.gxt.widget.core.client.grid.ColumnConfig; @@ -89,6 +90,7 @@ public class ReplaceBatchPanel extends FramedPanel implements protected String columnName; protected ColumnData column; protected boolean hasValidationColumns; + protected ShowOccurrencesType showOccurencesType; protected ReplaceBatchDialog parent; private ReplaceEntry currentReplaceEntry; @@ -99,7 +101,7 @@ public class ReplaceBatchPanel extends FramedPanel implements private TextButton btnSave; private TextButton btnClose; private ComboBox comboShowOccurrencesType = null; - private FieldLabel comboShowOccurencesTypeLabel; + protected ListLoader> loader; protected Grid grid; @@ -128,10 +130,11 @@ public class ReplaceBatchPanel extends FramedPanel implements } protected void create() { + showOccurencesType = ShowOccurrencesType.ONLYERRORS; + ToolBar toolBarHead = new ToolBar(); toolBarHead.add(new LabelToolItem("Show: ")); - - + // Create Combo Show ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT .create(ShowOccurrencesTypeProperties.class); @@ -141,24 +144,21 @@ public class ReplaceBatchPanel extends FramedPanel implements .getShowOccurrencesType()); comboShowOccurrencesType = new ComboBox( - storeShowOccurrencesType, propsShowOccurrencesType.type()); + storeShowOccurrencesType, propsShowOccurrencesType.label()); Log.trace("ComboMeasureType created"); - addHandlersForShowOccurrencesType(propsShowOccurrencesType.type()); + addHandlersForShowOccurrencesType(propsShowOccurrencesType.label()); comboShowOccurrencesType.setEmptyText("Select a show type..."); comboShowOccurrencesType.setWidth(100); comboShowOccurrencesType.setTypeAhead(true); comboShowOccurrencesType.setEditable(false); comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL); - comboShowOccurrencesType.setValue(ShowOccurrencesTypeStore.onlyErrorsElement); - + comboShowOccurrencesType + .setValue(ShowOccurrencesTypeStore.onlyErrorsElement); + toolBarHead.add(comboShowOccurrencesType); - - /*comboShowOccurencesTypeLabel = new FieldLabel(comboShowOccurrencesType, - "Show"); - */ - + // Create Grid IdentityValueProvider identity = new IdentityValueProvider(); @@ -226,7 +226,6 @@ public class ReplaceBatchPanel extends FramedPanel implements l.add(valueCol); l.add(numberCol); l.add(replacementValueCol); - // l.add(replacementIdCol); l.add(changeColumn); ColumnModel cm = new ColumnModel(l); @@ -274,8 +273,6 @@ public class ReplaceBatchPanel extends FramedPanel implements grid.setLoader(loader); grid.setSelectionModel(sm); number.initPlugin(grid); - // grid.getView().setAutoExpandColumn(labelCol); - // grid.setHeight(360); grid.setHeight("388px"); grid.getView().setStripeRows(true); grid.getView().setColumnLines(true); @@ -327,8 +324,7 @@ public class ReplaceBatchPanel extends FramedPanel implements flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4))); VerticalLayoutContainer v = new VerticalLayoutContainer(); - //v.add(comboShowOccurencesTypeLabel,new VerticalLayoutData(-1, -1, new Margins(0,0,2,0))); - v.add(toolBarHead,new VerticalLayoutData(1, -1, new Margins(0))); + v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0))); v.add(grid, new VerticalLayoutData(-1, -1, new Margins(0))); v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0))); v.add(flowButton, new VerticalLayoutData(-1, 36, @@ -389,7 +385,6 @@ public class ReplaceBatchPanel extends FramedPanel implements }); } - protected void addHandlersForShowOccurrencesType( final LabelProvider labelProvider) { comboShowOccurrencesType @@ -407,21 +402,25 @@ public class ReplaceBatchPanel extends FramedPanel implements + event.getSelectedItem()); ShowOccurrencesTypeElement showType = event .getSelectedItem(); - updateShowType(showType.getType()); + updateShowType(showType); } }); } - - protected void updateShowType(String type){ - + + protected void updateShowType(ShowOccurrencesTypeElement showType) { + showOccurencesType = showType.getType(); + loader.load(); } - - + protected void loadData(ListLoadConfig loadConfig, final AsyncCallback> callback) { - TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace(column, + OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession( + column, showOccurencesType); + + TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace( + occurrencesSession, new AsyncCallback>() { public void onFailure(Throwable caught) { diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/ShowOccurrencesTypeProperties.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/ShowOccurrencesTypeProperties.java index d827c02..26a0b1f 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/ShowOccurrencesTypeProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/properties/ShowOccurrencesTypeProperties.java @@ -1,7 +1,6 @@ package org.gcube.portlets.user.td.columnwidget.client.properties; import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement; -import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import com.google.gwt.editor.client.Editor.Path; import com.sencha.gxt.data.shared.LabelProvider; @@ -20,7 +19,7 @@ public interface ShowOccurrencesTypeProperties extends @Path("id") ModelKeyProvider id(); - LabelProvider type(); + LabelProvider label(); } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeElement.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeElement.java index bb35cbc..0cce86b 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeElement.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeElement.java @@ -1,53 +1,49 @@ package org.gcube.portlets.user.td.columnwidget.client.store; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ShowOccurrencesType; /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it - * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * */ public class ShowOccurrencesTypeElement { - + protected int id; // For insert in table only - protected String type; - - - public ShowOccurrencesTypeElement(int id,String type){ - this.id=id; - this.type=type; + protected ShowOccurrencesType type; + + public ShowOccurrencesTypeElement() { } + public ShowOccurrencesTypeElement(int id, ShowOccurrencesType type) { + this.id = id; + this.type = type; + } public int getId() { return id; } - public void setId(int id) { this.id = id; } - - public String getType() { + public ShowOccurrencesType getType() { return type; } - - public void setType(String type) { - this.type = type; + public String getLabel() { + return type.toString(); } + public void setType(ShowOccurrencesType type) { + this.type = type; + } @Override public String toString() { return "ShowOccurrencesTypeElement [id=" + id + ", type=" + type + "]"; } - - - - - - } diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeStore.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeStore.java index c959a6a..4c2bf5d 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeStore.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/store/ShowOccurrencesTypeStore.java @@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.columnwidget.client.store; import java.io.Serializable; import java.util.ArrayList; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ShowOccurrencesType; + @@ -15,13 +17,11 @@ import java.util.ArrayList; public class ShowOccurrencesTypeStore implements Serializable { private static final long serialVersionUID = -1908324094430432681L; - private final static String ONLYERRORS="Only Errors"; - private final static String ALL="All"; protected static ArrayList store; - public static ShowOccurrencesTypeElement onlyErrorsElement=new ShowOccurrencesTypeElement(1,ONLYERRORS); - public static ShowOccurrencesTypeElement allElement=new ShowOccurrencesTypeElement(2,ALL); + public static ShowOccurrencesTypeElement onlyErrorsElement=new ShowOccurrencesTypeElement(1,ShowOccurrencesType.ONLYERRORS); + public static ShowOccurrencesTypeElement allElement=new ShowOccurrencesTypeElement(2,ShowOccurrencesType.ALL); public static ArrayList getShowOccurrencesType(){ @@ -33,10 +33,10 @@ public class ShowOccurrencesTypeStore implements Serializable { public static int selectedShowOccurrencesTypePosition(String selected){ int position=0; - if(selected.compareTo(ONLYERRORS)==0){ + if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){ position=1; } else { - if(selected.compareTo(ALL)==0){ + if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){ position=2; } else { } @@ -46,11 +46,11 @@ public class ShowOccurrencesTypeStore implements Serializable { public static String selectedShowOccurrencesType(String selected){ - if(selected.compareTo(ONLYERRORS)==0){ - return ONLYERRORS; + if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){ + return ShowOccurrencesType.ONLYERRORS.toString(); } else { - if(selected.compareTo(ALL)==0){ - return ALL; + if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){ + return ShowOccurrencesType.ALL.toString(); } else { return null; } @@ -58,10 +58,10 @@ public class ShowOccurrencesTypeStore implements Serializable { } public static ShowOccurrencesTypeElement selectedShowOccurrencesTypeElement(String selected){ - if(selected.compareTo(ONLYERRORS)==0){ + if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){ return onlyErrorsElement; } else { - if(selected.compareTo(ALL)==0){ + if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){ return allElement; } else { return null;