Updated Batch replace

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94091 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-02 15:18:19 +00:00
parent ea7495022d
commit 325883feab
14 changed files with 519 additions and 110 deletions

View File

@ -2344,3 +2344,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...
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 seconds)
30% complete (ETR: 9 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 15.08 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

@ -3,7 +3,7 @@ package org.gcube.portlets.user.td.columnwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DialogCodelistSelection;
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionDialog;
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;
@ -758,7 +758,7 @@ public class ChangeColumnTypePanel extends FramedPanel implements
protected void callDialogCodelistSelection() {
DialogCodelistSelection dialogCodelistSelection = new DialogCodelistSelection(
CodelistSelectionDialog dialogCodelistSelection = new CodelistSelectionDialog(
eventBus);
dialogCodelistSelection.addListener(this);
dialogCodelistSelection.show();

View File

@ -4,6 +4,9 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.columnwidget.client.custom.ActionButtonCell;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRow;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
@ -11,6 +14,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurences;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.cell.client.AbstractCell;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.core.client.GWT;
@ -60,7 +65,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class BatchReplacePanel extends FramedPanel {
public class BatchReplacePanel extends FramedPanel implements SingleValueReplaceListener, DimensionRowSelectionListener {
protected String WIDTH = "560px";
protected String HEIGHT = "520px";
protected EventBus eventBus;
@ -75,15 +80,16 @@ public class BatchReplacePanel extends FramedPanel {
private TextButton btnApply;
private TextButton btnClose;
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
protected Grid<ReplaceEntry> grid;
protected ListStore<ReplaceEntry> store;
protected HTML info;
public BatchReplacePanel(BatchReplaceDialog parent, TRId trId, String columnName, EventBus eventBus) {
this.parent=parent;
Log.debug("BatchReplacePanel:["+trId+", columnName:"+columnName+"]");
public BatchReplacePanel(BatchReplaceDialog parent, TRId trId,
String columnName, EventBus eventBus) {
this.parent = parent;
Log.debug("BatchReplacePanel:[" + trId + ", columnName:" + columnName
+ "]");
setWidth(WIDTH);
setHeight(HEIGHT);
setHeaderVisible(false);
@ -104,13 +110,14 @@ public class BatchReplacePanel extends FramedPanel {
CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>(
identity);
RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>(identity);
//number.setFixed(false);
//number.setResizable(false);
RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>(
identity);
// number.setFixed(false);
// number.setResizable(false);
number.setWidth(50);
number.setColumnClassSuffix("");
number.setHeader("N.");
SafeStylesBuilder styleBuilder=new SafeStylesBuilder();
SafeStylesBuilder styleBuilder = new SafeStylesBuilder();
styleBuilder.width(50, Unit.PX);
number.setColumnStyle(styleBuilder.toSafeStyles());
@ -119,14 +126,31 @@ public class BatchReplacePanel extends FramedPanel {
ColumnConfig<ReplaceEntry, String> valueCol = new ColumnConfig<ReplaceEntry, String>(
props.value(), 130, "Values");
ColumnConfig<ReplaceEntry, Integer> numberCol = new ColumnConfig<ReplaceEntry, Integer>(
props.number(), 100,"Occurences");
props.number(), 100, "Occurences");
ColumnConfig<ReplaceEntry, String> replacementValueCol = new ColumnConfig<ReplaceEntry, String>(
props.replacementValue(),130,"Replacement");
/*ColumnConfig<ReplaceEntry, String> replacementIdCol = new ColumnConfig<ReplaceEntry, String>(
props.replacementId());
*/
props.replacementValue(), 130, "Replacement");
replacementValueCol.setCell(new AbstractCell<String>() {
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
if (value == null) {
String style = "style='color: black;font-weight:bold'";
sb.appendHtmlConstant("<span " + style
+">" + DON_T_REPLACE
+ "</span>");
} else {
String style = "style='color: green;font-weight:normal'";
sb.appendHtmlConstant("<span " + style
+">" + value
+ "</span>");
}
}
});
ColumnConfig<ReplaceEntry, String> changeColumn = new ColumnConfig<ReplaceEntry, String>(
props.value(),24);
props.value(), 24);
ActionButtonCell button = new ActionButtonCell();
button.setIcon(ResourceBundle.INSTANCE.magnifier());
@ -136,9 +160,8 @@ public class BatchReplacePanel extends FramedPanel {
@Override
public void onSelect(SelectEvent event) {
Context c = event.getContext();
int row = c.getIndex();
ReplaceEntry re = store.get(row);
Log.debug("ReplaceEntry " + re.toString() + " was clicked.");
int rowIndex = c.getIndex();
startReplaceEntry(rowIndex);
}
});
@ -149,7 +172,7 @@ public class BatchReplacePanel extends FramedPanel {
l.add(valueCol);
l.add(numberCol);
l.add(replacementValueCol);
//l.add(replacementIdCol);
// l.add(replacementIdCol);
l.add(changeColumn);
ColumnModel<ReplaceEntry> cm = new ColumnModel<ReplaceEntry>(l);
@ -163,10 +186,8 @@ public class BatchReplacePanel extends FramedPanel {
}
});
RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ReplaceEntry>>() {
public void load(ListLoadConfig loadConfig,
@ -211,7 +232,7 @@ public class BatchReplacePanel extends FramedPanel {
grid.setColumnResize(true);
grid.getView().setAutoExpandColumn(valueCol);
info=new HTML("No info");
info = new HTML("No info");
ToolBar toolBar = new ToolBar();
toolBar.add(info);
@ -247,24 +268,19 @@ public class BatchReplacePanel extends FramedPanel {
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton
.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton
.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer v = new VerticalLayoutContainer();
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, new Margins(
5, 2, 5, 2)));
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
v.add(flowButton, new VerticalLayoutData(-1, 36,
new Margins(5, 2, 5, 2)));
add(v);
}
protected void retrieveColumn(){
protected void retrieveColumn() {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
new AsyncCallback<ColumnData>() {
@ -277,8 +293,8 @@ public class BatchReplacePanel extends FramedPanel {
}
public void onSuccess(ColumnData result) {
Log.debug("Column: "+result);
column=result;
Log.debug("Column: " + result);
column = result;
create();
}
@ -304,7 +320,6 @@ public class BatchReplacePanel extends FramedPanel {
callback.onSuccess(new ListLoadResultBean<ReplaceEntry>(
getRecord(result)));
}
});
@ -320,41 +335,35 @@ public class BatchReplacePanel extends FramedPanel {
for (ReplaceEntry record : store.getAll()) {
int errors = record.getNumber();
totalErrors += errors;
if (record.getReplacementValue() != null && record.getReplacementValue().compareTo(DON_T_REPLACE)!=0) {
if (record.getReplacementValue() != null
&& record.getReplacementValue().compareTo(DON_T_REPLACE) != 0) {
assigned++;
assignedErrors += errors;
}
}
String text = Format
.substitute("Assigned {0} ({1} occurences) of {2} ({3} occurences)",
String.valueOf(assigned),
String.valueOf(assignedErrors), String.valueOf(total),
String.valueOf(totalErrors));
String text = Format.substitute(
"Assigned {0} ({1} occurences) of {2} ({3} occurences)",
String.valueOf(assigned), String.valueOf(assignedErrors),
String.valueOf(total), String.valueOf(totalErrors));
info.setText(text);
Log.debug(text);
}
/*public ArrayList<ReplaceEntry> getReplaceEntries() {
ArrayList<ReplaceEntry> entries = new ArrayList<ReplaceEntry>();
for (ReplaceEntry record : store.getAll() {
if (record.getAsString(REPLACE_ID_FIELD) != null) {
ReplaceEntry entry = new ReplaceEntry(
record.getAsString(ERROR_VALUE_FIELD),
record.getAsString(REPLACE_VALUE_FIELD),
record.getAsString(REPLACE_ID_FIELD));
entries.add(entry);
}
}
return entries;
}
protected void updateEntries(ArrayList<Occurences> entries) {
store.clear();
ArrayList<ReplaceEntry> records = getRecord(entries);
store.addAll(records);
store.commitChanges();
}*/
/*
* public ArrayList<ReplaceEntry> getReplaceEntries() {
* ArrayList<ReplaceEntry> entries = new ArrayList<ReplaceEntry>(); for
* (ReplaceEntry record : store.getAll() { if
* (record.getAsString(REPLACE_ID_FIELD) != null) { ReplaceEntry entry = new
* ReplaceEntry( record.getAsString(ERROR_VALUE_FIELD),
* record.getAsString(REPLACE_VALUE_FIELD),
* record.getAsString(REPLACE_ID_FIELD)); entries.add(entry); } } return
* entries; }
*
* protected void updateEntries(ArrayList<Occurences> entries) {
* store.clear(); ArrayList<ReplaceEntry> records = getRecord(entries);
* store.addAll(records); store.commitChanges(); }
*/
protected ArrayList<ReplaceEntry> getRecord(ArrayList<Occurences> entries) {
ArrayList<ReplaceEntry> records = new ArrayList<ReplaceEntry>();
@ -364,18 +373,56 @@ public class BatchReplacePanel extends FramedPanel {
}
protected ReplaceEntry getRecord(Occurences entry) {
ReplaceEntry data = new ReplaceEntry(entry.getValue(), entry.getNumber(),
DON_T_REPLACE, null);
ReplaceEntry data = new ReplaceEntry(entry.getValue(),
entry.getNumber(), null, null);
return data;
}
protected void save(){
protected void startReplaceEntry(int rowIndex){
ReplaceEntry re = store.get(rowIndex);
Log.debug("ReplaceEntry " + re.toString() + " was clicked.");
}
protected void save() {
}
protected void close(){
protected void close() {
parent.close();
}
protected void callDialogDimensionRowSelection() {
/*DimensionRowSelectionDialog dialogDimensionRowSelection = new DimensionRowSelectionDialog(
column, cellData, eventBus);
dialogDimensionRowSelection.addListener(this);
dialogDimensionRowSelection.show();*/
}
@Override
public void selected(String replaceValue) {
// 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
}
@Override
public void selected(DimensionRow dimensionRow) {
// TODO Auto-generated method stub
}
}

View File

@ -1,23 +1,26 @@
package org.gcube.portlets.user.td.columnwidget.client.batch;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRow;
class ReplaceEntry {
protected String value;
protected Integer number;
protected String replacementValue;
protected String replacementId;
protected DimensionRow replacementDimensionRow;
/**
* @param errorValue
* @param replacementValue
* @param replacementId
*/
public ReplaceEntry(String value, Integer number, String replacementValue, String replacementId) {
public ReplaceEntry(String value, Integer number, String replacementValue, DimensionRow replacementDimensionRow) {
this.value = value;
this.number = number;
this.replacementValue = replacementValue;
this.replacementId = replacementId;
this.replacementDimensionRow = replacementDimensionRow;
}
public String getValue() {
@ -44,23 +47,24 @@ class ReplaceEntry {
this.replacementValue = replacementValue;
}
public String getReplacementId() {
return replacementId;
public DimensionRow getReplacementDimensionRow() {
return replacementDimensionRow;
}
public void setReplacementId(String replacementId) {
this.replacementId = replacementId;
public void setReplacementDimensionRow(DimensionRow replacementDimensionRow) {
this.replacementDimensionRow = replacementDimensionRow;
}
@Override
public String toString() {
return "ReplaceEntry [value=" + value + ", number=" + number
+ ", replacementValue=" + replacementValue + ", replacementId="
+ replacementId + "]";
+ ", replacementValue=" + replacementValue
+ ", replacementDimensionRow=" + replacementDimensionRow + "]";
}
}

View File

@ -22,6 +22,6 @@ public interface ReplaceEntryProperties extends PropertyAccess<ReplaceEntry> {
ValueProvider<ReplaceEntry, String> value();
ValueProvider<ReplaceEntry, Integer> number();
ValueProvider<ReplaceEntry, String> replacementValue();
ValueProvider<ReplaceEntry, String> replacementId();
ValueProvider<ReplaceEntry, String> replacementDimensionRow();
}

View File

@ -0,0 +1,102 @@
package org.gcube.portlets.user.td.columnwidget.client.batch;
import java.util.ArrayList;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class SingleValueReplaceDialog extends Window {
protected String WIDTH = "500px";
protected String HEIGHT = "150px";
protected SingleValueReplacePanel ReplacePanel;
protected EventBus eventBus;
protected String value;
protected ColumnData column;
protected ArrayList<SingleValueReplaceListener> listeners;
public SingleValueReplaceDialog(String value, ColumnData column, EventBus eventBus) {
listeners=new ArrayList<SingleValueReplaceListener>();
this.value=value;
this.column=column;
this.eventBus = eventBus;
initWindow();
create();
}
protected void initWindow() {
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Replace Value");
setClosable(true);
getHeader().setIcon(ResourceBundle.INSTANCE.columnValue());
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
closeBtn.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
close();
}
});
}
protected void create() {
SingleValueReplacePanel replacePanel = new SingleValueReplacePanel(this, value,column,
eventBus);
add(replacePanel);
}
protected void close() {
hide();
}
public void addListener(SingleValueReplaceListener listener) {
listeners.add(listener);
}
public void removeListener(SingleValueReplaceListener listener) {
listeners.remove(listener);
}
public void fireCompleted(String replaceValue) {
for (SingleValueReplaceListener listener : listeners)
listener.selected(replaceValue);
hide();
}
public void fireAborted() {
for (SingleValueReplaceListener listener : listeners)
listener.aborted();
hide();
}
public void fireFailed(String reason, String details) {
for (SingleValueReplaceListener listener : listeners)
listener.failed(reason, details);
hide();
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.portlets.user.td.columnwidget.client.batch;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface SingleValueReplaceListener {
/**
* Called when selected replaceValue without errors
*/
public void selected(String replaceValue);
/**
* Called when the select operation is aborted by the user.
*/
public void aborted();
/**
* Called when the something in the wizard is failed.
*
* @param reason
* @param detail
*/
public void failed(String reason, String detail);
}

View File

@ -0,0 +1,189 @@
package org.gcube.portlets.user.td.columnwidget.client.batch;
import java.sql.Date;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRow;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
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.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class SingleValueReplacePanel extends FramedPanel {
protected String WIDTH = "500px";
protected String HEIGHT = "150px";
protected EventBus eventBus;
protected SingleValueReplaceDialog parent;
protected ColumnData column;
protected String value;
protected DimensionRow dimensionRow;
protected ReplaceColumnSession replaceColumnSession;
private TextField valueField;
private TextField replaceValueField;
private TextButton btnApply;
private TextButton btnClose;
public SingleValueReplacePanel(SingleValueReplaceDialog parent,
String value, ColumnData column, EventBus eventBus) {
this.parent = parent;
this.value = value;
this.eventBus = eventBus;
this.column = column;
dimensionRow = null;
Log.debug("SingleValueReplacePanel:[" + value + "]");
initPanel();
create();
}
protected void initPanel() {
setWidth(WIDTH);
setHeight(HEIGHT);
setHeaderVisible(false);
setBodyBorder(false);
}
protected void create() {
valueField = new TextField();
valueField.setValue(value);
valueField.setReadOnly(true);
replaceValueField = new TextField();
btnApply = new TextButton("Replace");
btnApply.setIcon(ResourceBundle.INSTANCE.replace());
btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Replace Value");
btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Apply");
replaceValue();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ResourceBundle.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Close");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER);
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
VerticalLayoutContainer v = new VerticalLayoutContainer();
v.add(new FieldLabel(valueField, "Value"),
new VerticalLayoutData(1, -1));
v.add(new FieldLabel(replaceValueField, "Replace"),
new VerticalLayoutData(1, -1));
v.add(flowButton, new VerticalLayoutData(-1, 36,
new Margins(5, 2, 5, 2)));
add(v);
}
protected void replaceValue() {
String rValue = replaceValueField.getCurrentValue();
if (rValue == null || rValue.isEmpty()) {
UtilsGXT3.alert("Attention", "Insert a valid replace value");
} else {
String checkedValue = checkTypeData(rValue);
if (checkedValue != null && !checkedValue.isEmpty()) {
callReplaceValue(rValue);
} else {
UtilsGXT3.alert("Attention",
"Insert a valid replace value for this column");
}
}
}
protected String checkTypeData(String rValue) {
String checked = null;
try {
if (column.getDataTypeName().compareTo("Boolean") == 0) {
Boolean b = new Boolean(rValue);
checked = b.toString();
} else {
if (column.getDataTypeName().compareTo("Date") == 0) {
Date d = Date.valueOf(rValue);
if (d != null) {
checked = rValue;
}
} else {
if (column.getDataTypeName().compareTo("Geometry") == 0) {
checked = rValue;
} else {
if (column.getDataTypeName().compareTo("Integer") == 0) {
Integer in = new Integer(rValue);
checked = in.toString();
} else {
if (column.getDataTypeName().compareTo("Numeric") == 0) {
Float fl = new Float(rValue);
checked = fl.toString();
} else {
if (column.getDataTypeName().compareTo("Text") == 0) {
checked = rValue;
} else {
}
}
}
}
}
}
} catch (Throwable e) {
Log.debug("Error no valid type data: " + e.getLocalizedMessage());
}
return checked;
}
protected void callReplaceValue(String rValue) {
parent.fireCompleted(rValue);
}
protected void close() {
parent.close();
}
}

View File

@ -55,7 +55,7 @@ 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;
public class DialogCodelistSelection extends Window {
public class CodelistSelectionDialog extends Window {
protected static final int WIDTH = 550;
protected static final int HEIGHT = 520;
protected static final int CACHE_SIZE = 200;
@ -84,7 +84,7 @@ public class DialogCodelistSelection extends Window {
protected ResourceBundle res;
private TextButton select;
public DialogCodelistSelection(EventBus eventBus) {
public CodelistSelectionDialog(EventBus eventBus) {
this.eventBus = eventBus;
Log.info("Dialog CodelistSelection");
setWidth(WIDTH);

View File

@ -26,7 +26,7 @@ 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.info.Info;
public class DialogDimensionRowSelection extends Window {
public class DimensionRowSelectionDialog extends Window {
protected static final int WIDTH = 550;
protected static final int HEIGHT = 520;
@ -42,7 +42,7 @@ public class DialogDimensionRowSelection extends Window {
private TextField value;
private TextButton select;
public DialogDimensionRowSelection(ColumnData column, CellData cellData,
public DimensionRowSelectionDialog(ColumnData column, CellData cellData,
EventBus eventBus) {
this.column = column;
this.eventBus = eventBus;

View File

@ -1,9 +1,8 @@
/**
*
*/
package org.gcube.portlets.user.td.columnwidget.client.replace;
package org.gcube.portlets.user.td.columnwidget.client.dimension;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRow;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;

View File

@ -71,7 +71,7 @@ public class ReplaceColumnProgressUpdater extends Timer {
break;
case SUCCEDED:
cancel();
Log.info("Import fisnish TableId :"
Log.info("ReplaceColumn fisnish:"
+ result.getTrId());
fireOperationComplete(result.getTrId());
break;

View File

@ -9,6 +9,12 @@ import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ReplaceDialog extends Window {
protected String WIDTH = "500px";
protected String HEIGHT = "150px";
@ -32,7 +38,7 @@ public class ReplaceDialog extends Window {
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(false);
setHeadingText("Replace All");
setHeadingText("Replace Value");
setClosable(true);
getHeader().setIcon(ResourceBundle.INSTANCE.replace());

View File

@ -2,9 +2,10 @@ package org.gcube.portlets.user.td.columnwidget.client.replace;
import java.sql.Date;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DialogDimensionRowSelection;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRow;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowsProperties;
import org.gcube.portlets.user.td.columnwidget.client.progress.ReplaceColumnProgressDialog;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
@ -370,7 +371,7 @@ public class ReplacePanel extends FramedPanel implements
}
protected void callDialogDimensionRowSelection() {
DialogDimensionRowSelection dialogDimensionRowSelection = new DialogDimensionRowSelection(
DimensionRowSelectionDialog dialogDimensionRowSelection = new DimensionRowSelectionDialog(
column, cellData, eventBus);
dialogDimensionRowSelection.addListener(this);
dialogDimensionRowSelection.show();