From 65f5fd85d5b8833ef32a6b5bf1a3885c9680b290 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 17 Mar 2014 17:59:08 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@93242 82a268e6-3cf1-43bd-a215-b396298e98cf --- .gwt/.gwt-log | 96 ++++++++++ .../client/ChangeColumnTypeDialog.java | 1 - .../client/batch/BatchReplaceDialog.java | 28 +++ .../client/batch/BatchReplacePanel.java | 174 ++++++++++++++++++ .../client/batch/OccurencesProperties.java | 27 +++ 5 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java create mode 100644 src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/OccurencesProperties.java diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index 179f6f4..d029c07 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -1638,3 +1638,99 @@ 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... + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 40% complete (ETR: 9 seconds) + 50% complete (ETR: 6 seconds) + 60% complete (ETR: 5 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.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: 6 seconds) + 60% complete (ETR: 5 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 17.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 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... + 30% complete (ETR: 8 seconds) + 30% complete (ETR: 8 seconds) + 30% complete (ETR: 8 seconds) + 30% complete (ETR: 8 seconds) + 40% complete (ETR: 8 seconds) + 50% complete (ETR: 6 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.88 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/ChangeColumnTypeDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypeDialog.java index baf060f..ff1b2a8 100644 --- a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypeDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/ChangeColumnTypeDialog.java @@ -20,7 +20,6 @@ public class ChangeColumnTypeDialog extends Window { protected TRId trId; protected String columnName=null; - protected ColumnData column=null; protected ComboBox combo=null; public ChangeColumnTypeDialog(TRId trId, EventBus eventBus) { diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java new file mode 100644 index 0000000..0d9e113 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplaceDialog.java @@ -0,0 +1,28 @@ +package org.gcube.portlets.user.td.columnwidget.client.batch; + +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.google.web.bindery.event.shared.EventBus; +import com.sencha.gxt.widget.core.client.Window; + +public class BatchReplaceDialog extends Window { + protected String WIDTH = "650px"; + protected String HEIGHT = "530px"; + protected TRId trId; + protected String columnName=null; + + + public BatchReplaceDialog(TRId trId, String columnName, EventBus eventBus) { + setWidth(WIDTH); + setHeight(HEIGHT); + setBodyBorder(false); + setResizable(false); + setHeadingText("Change Column Type"); + //getHeader().setIcon(Resources.IMAGES.side_list()); + this.trId=trId; + this.columnName=columnName; + + BatchReplacePanel batchRepalcePanel= new BatchReplacePanel(trId,columnName,eventBus); + add(batchRepalcePanel); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java new file mode 100644 index 0000000..a5e62db --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/BatchReplacePanel.java @@ -0,0 +1,174 @@ +package org.gcube.portlets.user.td.columnwidget.client.batch; + +import java.util.ArrayList; +import java.util.List; + +import org.gcube.portlets.user.td.columnwidget.client.ChangeColumnTypeDialog; +import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurences; +import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.web.bindery.event.shared.EventBus; +import com.sencha.gxt.core.client.IdentityValueProvider; +import com.sencha.gxt.core.client.Style.SelectionMode; +import com.sencha.gxt.data.client.loader.RpcProxy; +import com.sencha.gxt.data.shared.ListStore; +import com.sencha.gxt.data.shared.loader.ListLoadConfig; +import com.sencha.gxt.data.shared.loader.ListLoadResult; +import com.sencha.gxt.data.shared.loader.ListLoader; +import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding; +import com.sencha.gxt.widget.core.client.FramedPanel; +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; +import com.sencha.gxt.widget.core.client.grid.ColumnModel; +import com.sencha.gxt.widget.core.client.grid.Grid; +import com.sencha.gxt.widget.core.client.grid.RowNumberer; + +public class BatchReplacePanel extends FramedPanel implements + CodelistSelectionListener { + protected String WIDTH = "640px"; + protected String HEIGHT = "520px"; + protected EventBus eventBus; + protected ChangeColumnTypeDialog parent; + protected TextField label = null; + protected TRId trId; + protected String columnName; + + protected ListLoader> loader; + protected Grid grid; + + public BatchReplacePanel(TRId trId, String columnName, EventBus eventBus) { + setWidth(WIDTH); + setHeight(HEIGHT); + setHeaderVisible(false); + setBodyBorder(false); + this.trId = trId; + this.columnName = columnName; + this.eventBus = eventBus; + Log.debug("Create BatchReplacePanel(): [" + trId.toString()+" , columnName:"+columnName + "]"); + create(); + } + + + protected void create(){ + + IdentityValueProvider identity=new IdentityValueProvider(); + CheckBoxSelectionModel sm = new CheckBoxSelectionModel( + identity); + + RowNumberer number = new RowNumberer(identity); + + OccurencesProperties props = GWT.create(OccurencesProperties.class); + + + ColumnConfig valueCol = new ColumnConfig( + props.value()); + ColumnConfig numberCol = new ColumnConfig( + props.number()); + + + List> l = new ArrayList>(); + l.add(number); + l.add(valueCol); + l.add(numberCol); + ColumnModel cm = new ColumnModel(l); + + ListStore store = new ListStore(props.id()); + + RpcProxy> proxy = new RpcProxy>() { + + public void load(ListLoadConfig loadConfig, + final AsyncCallback> callback) { + loadData(loadConfig, callback); + } + }; + loader = new ListLoader>( + proxy); + + loader.setRemoteSort(false); + loader.addLoadHandler(new LoadResultListStoreBinding>( + store) { + }); + + grid = new Grid(store, cm) { + @Override + protected void onAfterFirstAttach() { + super.onAfterFirstAttach(); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + public void execute() { + loader.load(); + } + }); + } + }; + + sm.setSelectionMode(SelectionMode.MULTI); + grid.setLoader(loader); + grid.setSelectionModel(sm); + //grid.getView().setAutoExpandColumn(labelCol); + //grid.setHeight(360); + grid.getView().setStripeRows(true); + grid.getView().setColumnLines(true); + grid.getView().setAutoFill(true); + grid.setBorders(false); + grid.setLoadMask(true); + grid.setColumnReordering(true); + grid.setColumnResize(false); + + + } + + + protected void loadData(ListLoadConfig loadConfig, + final AsyncCallback> callback) { + /*TDGWTServiceAsync.INSTANCE.getColumns(trId, + new AsyncCallback>() { + + public void onFailure(Throwable caught) { + Log.error("load columns failure:" + + caught.getLocalizedMessage()); + alert("Error retrieving columns", + "Error retrieving columns"); + callback.onFailure(caught); + } + + public void onSuccess(ArrayList result) { + Log.trace("loaded " + result.size() + " ColumnData"); + callback.onSuccess(new ListLoadResultBean( + result)); + + } + + }); + */ + } + + + @Override + public void selected(TabResource tabResource) { + // TODO Auto-generated method stub + + } + + + @Override + public void aborted() { + // TODO Auto-generated method stub + + } + + + @Override + public void failed(String reason, String detail) { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/OccurencesProperties.java b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/OccurencesProperties.java new file mode 100644 index 0000000..b71c257 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/columnwidget/client/batch/OccurencesProperties.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.gcube.portlets.user.td.columnwidget.client.batch; + +import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurences; + +import com.google.gwt.editor.client.Editor.Path; +import com.sencha.gxt.core.client.ValueProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface OccurencesProperties extends PropertyAccess { + + @Path("value") + ModelKeyProvider id(); + + ValueProvider value(); + ValueProvider number(); + +}