Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@93315 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0f1f5d7474
commit
0a0b050176
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.td.columnwidget.client.batch;
|
package org.gcube.portlets.user.td.columnwidget.client.batch;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
@ -40,7 +41,7 @@ public class BatchReplaceDialog extends Window {
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
//getHeader().setIcon(ColumnResources.INSTANCE.rule());
|
getHeader().setIcon(ResourceBundle.INSTANCE.rule());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,17 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.safecss.shared.SafeStylesBuilder;
|
import com.google.gwt.safecss.shared.SafeStylesBuilder;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
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;
|
||||||
|
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||||
import com.sencha.gxt.core.client.util.Format;
|
import com.sencha.gxt.core.client.util.Format;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.event.StoreDataChangeEvent;
|
||||||
|
import com.sencha.gxt.data.shared.event.StoreDataChangeEvent.StoreDataChangeHandler;
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
@ -45,6 +49,7 @@ 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.ColumnModel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -54,7 +59,7 @@ import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||||
*/
|
*/
|
||||||
public class BatchReplacePanel extends FramedPanel implements
|
public class BatchReplacePanel extends FramedPanel implements
|
||||||
CodelistSelectionListener {
|
CodelistSelectionListener {
|
||||||
protected String WIDTH = "5600px";
|
protected String WIDTH = "560px";
|
||||||
protected String HEIGHT = "520px";
|
protected String HEIGHT = "520px";
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
protected ChangeColumnTypeDialog parent;
|
protected ChangeColumnTypeDialog parent;
|
||||||
|
@ -69,6 +74,7 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
|
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
|
||||||
protected Grid<ReplaceEntry> grid;
|
protected Grid<ReplaceEntry> grid;
|
||||||
protected ListStore<ReplaceEntry> store;
|
protected ListStore<ReplaceEntry> store;
|
||||||
|
protected HTML info;
|
||||||
|
|
||||||
public BatchReplacePanel(TRId trId, String columnName, EventBus eventBus) {
|
public BatchReplacePanel(TRId trId, String columnName, EventBus eventBus) {
|
||||||
Log.debug("BatchReplacePanel:["+trId+", columnName:"+columnName+"]");
|
Log.debug("BatchReplacePanel:["+trId+", columnName:"+columnName+"]");
|
||||||
|
@ -119,7 +125,6 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
ActionButtonCell button = new ActionButtonCell();
|
ActionButtonCell button = new ActionButtonCell();
|
||||||
button.setIcon(ResourceBundle.INSTANCE.magnifier());
|
button.setIcon(ResourceBundle.INSTANCE.magnifier());
|
||||||
button.setTitle("Change");
|
button.setTitle("Change");
|
||||||
// button.setTitle("Change Value");
|
|
||||||
button.addSelectHandler(new SelectHandler() {
|
button.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -143,7 +148,25 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
ColumnModel<ReplaceEntry> cm = new ColumnModel<ReplaceEntry>(l);
|
ColumnModel<ReplaceEntry> cm = new ColumnModel<ReplaceEntry>(l);
|
||||||
|
|
||||||
store = new ListStore<ReplaceEntry>(props.id());
|
store = new ListStore<ReplaceEntry>(props.id());
|
||||||
|
|
||||||
|
store.addStoreDataChangeHandler(new StoreDataChangeHandler<ReplaceEntry>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataChange(StoreDataChangeEvent<ReplaceEntry> event) {
|
||||||
|
updateInfo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>>() {
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig,
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
@ -178,7 +201,7 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
number.initPlugin(grid);
|
number.initPlugin(grid);
|
||||||
// grid.getView().setAutoExpandColumn(labelCol);
|
// grid.getView().setAutoExpandColumn(labelCol);
|
||||||
// grid.setHeight(360);
|
// grid.setHeight(360);
|
||||||
grid.setHeight("460px");
|
grid.setHeight("454px");
|
||||||
grid.getView().setStripeRows(true);
|
grid.getView().setStripeRows(true);
|
||||||
grid.getView().setColumnLines(true);
|
grid.getView().setColumnLines(true);
|
||||||
grid.getView().setAutoFill(true);
|
grid.getView().setAutoFill(true);
|
||||||
|
@ -188,10 +211,17 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
grid.setColumnResize(true);
|
grid.setColumnResize(true);
|
||||||
grid.getView().setAutoExpandColumn(valueCol);
|
grid.getView().setAutoExpandColumn(valueCol);
|
||||||
|
|
||||||
|
info=new HTML("No info");
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
|
toolBar.add(info);
|
||||||
|
toolBar.addStyleName(ThemeStyles.getStyle().borderTop());
|
||||||
|
toolBar.getElement().getStyle().setProperty("borderBottom", "none");
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
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)));
|
||||||
|
|
||||||
add(v);
|
add(v);
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,6 +267,7 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
Log.trace("loaded " + result.size() + " Occurences");
|
Log.trace("loaded " + result.size() + " Occurences");
|
||||||
callback.onSuccess(new ListLoadResultBean<ReplaceEntry>(
|
callback.onSuccess(new ListLoadResultBean<ReplaceEntry>(
|
||||||
getRecord(result)));
|
getRecord(result)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,18 +284,18 @@ public class BatchReplacePanel extends FramedPanel implements
|
||||||
for (ReplaceEntry record : store.getAll()) {
|
for (ReplaceEntry record : store.getAll()) {
|
||||||
int errors = record.getNumber();
|
int errors = record.getNumber();
|
||||||
totalErrors += errors;
|
totalErrors += errors;
|
||||||
if (record.getReplacementValue() != null) {
|
if (record.getReplacementValue() != null && record.getReplacementValue().compareTo(DON_T_REPLACE)!=0) {
|
||||||
assigned++;
|
assigned++;
|
||||||
assignedErrors += errors;
|
assignedErrors += errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = Format
|
String text = Format
|
||||||
.substitute("Assigned {0} ({1} error occurence) of {2} ({3} error occurence)",
|
.substitute("Assigned {0} ({1} occurence) of {2} ({3} occurence)",
|
||||||
String.valueOf(assigned),
|
String.valueOf(assigned),
|
||||||
String.valueOf(assignedErrors), String.valueOf(total),
|
String.valueOf(assignedErrors), String.valueOf(total),
|
||||||
String.valueOf(totalErrors));
|
String.valueOf(totalErrors));
|
||||||
//infoText.setText(text);
|
info.setText(text);
|
||||||
Log.debug(text);
|
Log.debug(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,5 +33,11 @@ public interface ResourceBundle extends ClientBundle {
|
||||||
|
|
||||||
@Source("magnifier_32.png")
|
@Source("magnifier_32.png")
|
||||||
ImageResource magnifier32();
|
ImageResource magnifier32();
|
||||||
|
|
||||||
|
@Source("column-values.png")
|
||||||
|
ImageResource replace();
|
||||||
|
|
||||||
|
@Source("column-values_32.png")
|
||||||
|
ImageResource replace32();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue