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
This commit is contained in:
Giancarlo Panichi 2014-04-08 08:45:11 +00:00
parent 41eb61a1ee
commit a48a941312
5 changed files with 88 additions and 62 deletions

View File

@ -2472,3 +2472,35 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes 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

View File

@ -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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow; 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.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.ReplaceBatchColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ReplaceEntry; 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.CellData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; 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;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; 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.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.form.TextField;
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel; import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig; import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
@ -89,6 +90,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected String columnName; protected String columnName;
protected ColumnData column; protected ColumnData column;
protected boolean hasValidationColumns; protected boolean hasValidationColumns;
protected ShowOccurrencesType showOccurencesType;
protected ReplaceBatchDialog parent; protected ReplaceBatchDialog parent;
private ReplaceEntry currentReplaceEntry; private ReplaceEntry currentReplaceEntry;
@ -99,7 +101,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null; private ComboBox<ShowOccurrencesTypeElement> comboShowOccurrencesType = null;
private FieldLabel comboShowOccurencesTypeLabel;
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader; protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
protected Grid<ReplaceEntry> grid; protected Grid<ReplaceEntry> grid;
@ -128,10 +130,11 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
protected void create() { protected void create() {
showOccurencesType = ShowOccurrencesType.ONLYERRORS;
ToolBar toolBarHead = new ToolBar(); ToolBar toolBarHead = new ToolBar();
toolBarHead.add(new LabelToolItem("Show: ")); toolBarHead.add(new LabelToolItem("Show: "));
// Create Combo Show // Create Combo Show
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
.create(ShowOccurrencesTypeProperties.class); .create(ShowOccurrencesTypeProperties.class);
@ -141,24 +144,21 @@ public class ReplaceBatchPanel extends FramedPanel implements
.getShowOccurrencesType()); .getShowOccurrencesType());
comboShowOccurrencesType = new ComboBox<ShowOccurrencesTypeElement>( comboShowOccurrencesType = new ComboBox<ShowOccurrencesTypeElement>(
storeShowOccurrencesType, propsShowOccurrencesType.type()); storeShowOccurrencesType, propsShowOccurrencesType.label());
Log.trace("ComboMeasureType created"); Log.trace("ComboMeasureType created");
addHandlersForShowOccurrencesType(propsShowOccurrencesType.type()); addHandlersForShowOccurrencesType(propsShowOccurrencesType.label());
comboShowOccurrencesType.setEmptyText("Select a show type..."); comboShowOccurrencesType.setEmptyText("Select a show type...");
comboShowOccurrencesType.setWidth(100); comboShowOccurrencesType.setWidth(100);
comboShowOccurrencesType.setTypeAhead(true); comboShowOccurrencesType.setTypeAhead(true);
comboShowOccurrencesType.setEditable(false); comboShowOccurrencesType.setEditable(false);
comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL); comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL);
comboShowOccurrencesType.setValue(ShowOccurrencesTypeStore.onlyErrorsElement); comboShowOccurrencesType
.setValue(ShowOccurrencesTypeStore.onlyErrorsElement);
toolBarHead.add(comboShowOccurrencesType); toolBarHead.add(comboShowOccurrencesType);
/*comboShowOccurencesTypeLabel = new FieldLabel(comboShowOccurrencesType,
"Show");
*/
// Create Grid // Create Grid
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>(); IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
@ -226,7 +226,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
l.add(valueCol); l.add(valueCol);
l.add(numberCol); l.add(numberCol);
l.add(replacementValueCol); l.add(replacementValueCol);
// l.add(replacementIdCol);
l.add(changeColumn); l.add(changeColumn);
ColumnModel<ReplaceEntry> cm = new ColumnModel<ReplaceEntry>(l); ColumnModel<ReplaceEntry> cm = new ColumnModel<ReplaceEntry>(l);
@ -274,8 +273,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
grid.setLoader(loader); grid.setLoader(loader);
grid.setSelectionModel(sm); grid.setSelectionModel(sm);
number.initPlugin(grid); number.initPlugin(grid);
// grid.getView().setAutoExpandColumn(labelCol);
// grid.setHeight(360);
grid.setHeight("388px"); grid.setHeight("388px");
grid.getView().setStripeRows(true); grid.getView().setStripeRows(true);
grid.getView().setColumnLines(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))); flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer v = new VerticalLayoutContainer(); 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(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0))); v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
v.add(flowButton, new VerticalLayoutData(-1, 36, v.add(flowButton, new VerticalLayoutData(-1, 36,
@ -389,7 +385,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
}); });
} }
protected void addHandlersForShowOccurrencesType( protected void addHandlersForShowOccurrencesType(
final LabelProvider<ShowOccurrencesTypeElement> labelProvider) { final LabelProvider<ShowOccurrencesTypeElement> labelProvider) {
comboShowOccurrencesType comboShowOccurrencesType
@ -407,21 +402,25 @@ public class ReplaceBatchPanel extends FramedPanel implements
+ event.getSelectedItem()); + event.getSelectedItem());
ShowOccurrencesTypeElement showType = event ShowOccurrencesTypeElement showType = event
.getSelectedItem(); .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, protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) { final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace(column, OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession(
column, showOccurencesType);
TDGWTServiceAsync.INSTANCE.getOccurrencesForBatchReplace(
occurrencesSession,
new AsyncCallback<ArrayList<Occurrences>>() { new AsyncCallback<ArrayList<Occurrences>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.td.columnwidget.client.properties; 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.columnwidget.client.store.ShowOccurrencesTypeElement;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import com.google.gwt.editor.client.Editor.Path; import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider; import com.sencha.gxt.data.shared.LabelProvider;
@ -20,7 +19,7 @@ public interface ShowOccurrencesTypeProperties extends
@Path("id") @Path("id")
ModelKeyProvider<ShowOccurrencesTypeElement> id(); ModelKeyProvider<ShowOccurrencesTypeElement> id();
LabelProvider<ShowOccurrencesTypeElement> type(); LabelProvider<ShowOccurrencesTypeElement> label();
} }

View File

@ -1,53 +1,49 @@
package org.gcube.portlets.user.td.columnwidget.client.store; package org.gcube.portlets.user.td.columnwidget.client.store;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.ShowOccurrencesType;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class ShowOccurrencesTypeElement { public class ShowOccurrencesTypeElement {
protected int id; // For insert in table only protected int id; // For insert in table only
protected String type; protected ShowOccurrencesType type;
public ShowOccurrencesTypeElement() {
public ShowOccurrencesTypeElement(int id,String type){
this.id=id;
this.type=type;
} }
public ShowOccurrencesTypeElement(int id, ShowOccurrencesType type) {
this.id = id;
this.type = type;
}
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public ShowOccurrencesType getType() {
public String getType() {
return type; return type;
} }
public String getLabel() {
public void setType(String type) { return type.toString();
this.type = type;
} }
public void setType(ShowOccurrencesType type) {
this.type = type;
}
@Override @Override
public String toString() { public String toString() {
return "ShowOccurrencesTypeElement [id=" + id + ", type=" + type + "]"; return "ShowOccurrencesTypeElement [id=" + id + ", type=" + type + "]";
} }
} }

View File

@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.columnwidget.client.store;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; 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 { public class ShowOccurrencesTypeStore implements Serializable {
private static final long serialVersionUID = -1908324094430432681L; private static final long serialVersionUID = -1908324094430432681L;
private final static String ONLYERRORS="Only Errors";
private final static String ALL="All";
protected static ArrayList<ShowOccurrencesTypeElement> store; protected static ArrayList<ShowOccurrencesTypeElement> store;
public static ShowOccurrencesTypeElement onlyErrorsElement=new ShowOccurrencesTypeElement(1,ONLYERRORS); public static ShowOccurrencesTypeElement onlyErrorsElement=new ShowOccurrencesTypeElement(1,ShowOccurrencesType.ONLYERRORS);
public static ShowOccurrencesTypeElement allElement=new ShowOccurrencesTypeElement(2,ALL); public static ShowOccurrencesTypeElement allElement=new ShowOccurrencesTypeElement(2,ShowOccurrencesType.ALL);
public static ArrayList<ShowOccurrencesTypeElement> getShowOccurrencesType(){ public static ArrayList<ShowOccurrencesTypeElement> getShowOccurrencesType(){
@ -33,10 +33,10 @@ public class ShowOccurrencesTypeStore implements Serializable {
public static int selectedShowOccurrencesTypePosition(String selected){ public static int selectedShowOccurrencesTypePosition(String selected){
int position=0; int position=0;
if(selected.compareTo(ONLYERRORS)==0){ if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){
position=1; position=1;
} else { } else {
if(selected.compareTo(ALL)==0){ if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){
position=2; position=2;
} else { } else {
} }
@ -46,11 +46,11 @@ public class ShowOccurrencesTypeStore implements Serializable {
public static String selectedShowOccurrencesType(String selected){ public static String selectedShowOccurrencesType(String selected){
if(selected.compareTo(ONLYERRORS)==0){ if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){
return ONLYERRORS; return ShowOccurrencesType.ONLYERRORS.toString();
} else { } else {
if(selected.compareTo(ALL)==0){ if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){
return ALL; return ShowOccurrencesType.ALL.toString();
} else { } else {
return null; return null;
} }
@ -58,10 +58,10 @@ public class ShowOccurrencesTypeStore implements Serializable {
} }
public static ShowOccurrencesTypeElement selectedShowOccurrencesTypeElement(String selected){ public static ShowOccurrencesTypeElement selectedShowOccurrencesTypeElement(String selected){
if(selected.compareTo(ONLYERRORS)==0){ if(selected.compareTo(ShowOccurrencesType.ONLYERRORS.toString())==0){
return onlyErrorsElement; return onlyErrorsElement;
} else { } else {
if(selected.compareTo(ALL)==0){ if(selected.compareTo(ShowOccurrencesType.ALL.toString())==0){
return allElement; return allElement;
} else { } else {
return null; return null;