Added replace all value on view column
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@93655 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b83e1e3bc0
commit
4a4ed2cd8d
8
pom.xml
8
pom.xml
|
@ -124,6 +124,14 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- TDX Source -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>tabular-data-widgetx-tdx-source</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- LOGGING -->
|
<!-- LOGGING -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||||
|
|
||||||
|
<inherits name="org.gcube.portlets.user.tdwx.TabularDataWidgetX" />
|
||||||
|
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
|
|
|
@ -0,0 +1,197 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.utils.Constants;
|
||||||
|
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.widgetcommonevent.shared.CellData;
|
||||||
|
import org.gcube.portlets.user.tdwx.client.TabularDataX;
|
||||||
|
import org.gcube.portlets.user.tdwx.client.TabularDataXGridPanel;
|
||||||
|
import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
|
||||||
|
import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler;
|
||||||
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
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;
|
||||||
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
public class DialogDimensionRowSelection extends Window {
|
||||||
|
protected static final int WIDTH = 550;
|
||||||
|
protected static final int HEIGHT = 520;
|
||||||
|
|
||||||
|
protected ColumnData column;
|
||||||
|
protected EventBus eventBus;
|
||||||
|
protected DimensionRow dimRow;
|
||||||
|
protected CellData cellData;
|
||||||
|
|
||||||
|
protected ArrayList<DimensionRowSelectionListener> listeners;
|
||||||
|
|
||||||
|
private static TabularDataX tabularData;
|
||||||
|
private TabularDataXGridPanel gridPanel;
|
||||||
|
private TextField value;
|
||||||
|
private TextButton select;
|
||||||
|
|
||||||
|
|
||||||
|
public DialogDimensionRowSelection(ColumnData column, CellData cellData, EventBus eventBus) {
|
||||||
|
this.column=column;
|
||||||
|
this.eventBus=eventBus;
|
||||||
|
this.cellData=cellData;
|
||||||
|
listeners=new ArrayList<DimensionRowSelectionListener>();
|
||||||
|
initWindow();
|
||||||
|
create();
|
||||||
|
open();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void create(){
|
||||||
|
final FramedPanel panel = new FramedPanel();
|
||||||
|
panel.setHeaderVisible(false);
|
||||||
|
panel.setBodyBorder(false);
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
|
||||||
|
value = new TextField();
|
||||||
|
value.setValue(cellData.getValue());
|
||||||
|
value.setReadOnly(true);
|
||||||
|
|
||||||
|
//Grid
|
||||||
|
tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID);
|
||||||
|
tabularData.addFailureHandler(new FailureEventHandler() {
|
||||||
|
|
||||||
|
public void onFailure(FailureEvent event) {
|
||||||
|
Info.display("Error: " + event.getMessage(), event.getCaught()
|
||||||
|
.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gridPanel = tabularData.getGridPanel();
|
||||||
|
gridPanel.setHeaderVisible(false);
|
||||||
|
gridPanel.setSelectionModel(SelectionMode.SINGLE);
|
||||||
|
|
||||||
|
v.add(new FieldLabel(value, "Value"), new VerticalLayoutData(1, -1));
|
||||||
|
v.add(gridPanel, new VerticalLayoutData(1, 1));
|
||||||
|
|
||||||
|
panel.add(v);
|
||||||
|
|
||||||
|
select = new TextButton("Select");
|
||||||
|
select.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
startSelect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.addButton(select);
|
||||||
|
|
||||||
|
add(panel);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startSelect(){
|
||||||
|
ArrayList<String> rowsId=gridPanel.getSelectedRowsId();
|
||||||
|
if(rowsId==null||rowsId.size()==0){
|
||||||
|
Log.debug("No row selected");
|
||||||
|
UtilsGXT3.alert("Attention",
|
||||||
|
"Select a row");
|
||||||
|
} else {
|
||||||
|
String rowId=rowsId.get(0);
|
||||||
|
Log.debug("Row selected: "+rowId);
|
||||||
|
ArrayList<String> cellValues=gridPanel.getCellValue(column.getColumnId());
|
||||||
|
if(cellValues==null|| cellValues.size()==0){
|
||||||
|
Log.debug("No value retrieved");
|
||||||
|
UtilsGXT3.alert("Attention",
|
||||||
|
"Select a row");
|
||||||
|
} else {
|
||||||
|
String cellValue=cellValues.get(0);
|
||||||
|
Log.debug("Retrived: "+ rowId+" "+cellValue);
|
||||||
|
dimRow=new DimensionRow(rowId,cellValue);
|
||||||
|
fireCompleted(dimRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void open(){
|
||||||
|
long tableId=column.getColumnViewData().getTargetTableId();
|
||||||
|
|
||||||
|
TableId tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
|
||||||
|
String.valueOf(tableId));
|
||||||
|
tabularData.openTable(tableOpening);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initWindow() {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setBodyBorder(false);
|
||||||
|
setResizable(false);
|
||||||
|
setHeadingText("Dimension");
|
||||||
|
setClosable(true);
|
||||||
|
//getHeader().setIcon(ResourceBundle.INSTANCE.replace());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initTools() {
|
||||||
|
super.initTools();
|
||||||
|
|
||||||
|
closeBtn.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
fireAborted();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void addListener(DimensionRowSelectionListener listener) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(DimensionRowSelectionListener listener) {
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireCompleted(DimensionRow dimensionRow) {
|
||||||
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
|
listener.selected(dimensionRow);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireAborted() {
|
||||||
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
|
listener.aborted();
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireFailed(String reason, String details) {
|
||||||
|
for (DimensionRowSelectionListener listener : listeners)
|
||||||
|
listener.failed(reason, details);
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DimensionRow implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -4220185160420435932L;
|
||||||
|
|
||||||
|
|
||||||
|
protected String rowId;
|
||||||
|
protected String value;
|
||||||
|
|
||||||
|
public DimensionRow(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DimensionRow(String rowId, String value){
|
||||||
|
this.rowId=rowId;
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRowId() {
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowId(String rowId) {
|
||||||
|
this.rowId = rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DimensionRow [rowId=" + rowId + ", value=" + value + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.dimension;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DimensionRowSelectionListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when selected one row of dimension or time dimension without errors
|
||||||
|
*/
|
||||||
|
public void selected(DimensionRow dimensionRow);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.replace;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DimensionRowsProperties extends PropertyAccess<DimensionRow> {
|
||||||
|
|
||||||
|
@Path("rowId")
|
||||||
|
ModelKeyProvider<DimensionRow> rowId();
|
||||||
|
|
||||||
|
LabelProvider<DimensionRow> value();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -17,8 +17,6 @@ public class ReplaceDialog extends Window {
|
||||||
protected TRId trId;
|
protected TRId trId;
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
|
||||||
// private ReplaceSession columnFilterSession;
|
|
||||||
// private ReplaceProgressDialog dialog;
|
|
||||||
|
|
||||||
public ReplaceDialog(CellData cellData, TRId trId, EventBus eventBus) {
|
public ReplaceDialog(CellData cellData, TRId trId, EventBus eventBus) {
|
||||||
initWindow();
|
initWindow();
|
||||||
|
@ -34,7 +32,7 @@ public class ReplaceDialog extends Window {
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
setHeadingText("Replace");
|
setHeadingText("Replace All");
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
getHeader().setIcon(ResourceBundle.INSTANCE.replace());
|
getHeader().setIcon(ResourceBundle.INSTANCE.replace());
|
||||||
|
|
||||||
|
@ -66,29 +64,6 @@ public class ReplaceDialog extends Window {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* protected void callApplyFilter() { columnFilterSession = new
|
|
||||||
* ColumnFilterSession(column, exp);
|
|
||||||
* Log.debug(columnFilterSession.toString());
|
|
||||||
*
|
|
||||||
* ExpressionServiceAsync.INSTANCE.submitColumnFilter(columnFilterSession,
|
|
||||||
* new AsyncCallback<Void>() {
|
|
||||||
*
|
|
||||||
* @Override public void onSuccess(Void result) {
|
|
||||||
* Log.debug("Submitted column filter"); callColumnFilterProgressDialog(); }
|
|
||||||
*
|
|
||||||
* @Override public void onFailure(Throwable caught) {
|
|
||||||
* Log.error("Error submitting the column filter: " + caught.getMessage() +
|
|
||||||
* " " + caught.getCause()); caught.printStackTrace();
|
|
||||||
* UtilsGXT3.alert("Error submitting the column filter",
|
|
||||||
* caught.getMessage());
|
|
||||||
*
|
|
||||||
* } });
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* protected void callColumnFilterProgressDialog() { dialog = new
|
|
||||||
* ColumnFilterProgressDialog(this, eventBus); dialog.show(); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ package org.gcube.portlets.user.td.columnwidget.client.replace;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.DialogDimensionRowSelection;
|
||||||
|
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.progress.ReplaceColumnProgressDialog;
|
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.resources.ResourceBundle;
|
||||||
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
||||||
|
@ -12,10 +15,14 @@ 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;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
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.BoxLayoutData;
|
||||||
|
@ -26,6 +33,9 @@ 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.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
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.event.TriggerClickEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
||||||
|
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.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
|
||||||
|
@ -35,7 +45,8 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
* 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 ReplacePanel extends FramedPanel {
|
public class ReplacePanel extends FramedPanel implements
|
||||||
|
DimensionRowSelectionListener {
|
||||||
protected String WIDTH = "500px";
|
protected String WIDTH = "500px";
|
||||||
protected String HEIGHT = "150px";
|
protected String HEIGHT = "150px";
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
@ -45,11 +56,14 @@ public class ReplacePanel extends FramedPanel {
|
||||||
protected ColumnData column;
|
protected ColumnData column;
|
||||||
|
|
||||||
protected ReplaceColumnSession replaceColumnSession;
|
protected ReplaceColumnSession replaceColumnSession;
|
||||||
|
private ComboBox<DimensionRow> comboDimensionType;
|
||||||
|
private FieldLabel comboDimensionTypeLabel;
|
||||||
|
|
||||||
private TextField value;
|
private TextField value;
|
||||||
private TextField replaceValue;
|
private TextField replaceValue;
|
||||||
private TextButton btnApply;
|
private TextButton btnApply;
|
||||||
private TextButton btnClose;
|
private TextButton btnClose;
|
||||||
|
private boolean isDimension;
|
||||||
|
|
||||||
public ReplacePanel(ReplaceDialog parent, TRId trId, CellData cellData,
|
public ReplacePanel(ReplaceDialog parent, TRId trId, CellData cellData,
|
||||||
EventBus eventBus) {
|
EventBus eventBus) {
|
||||||
|
@ -57,7 +71,6 @@ public class ReplacePanel extends FramedPanel {
|
||||||
this.cellData = cellData;
|
this.cellData = cellData;
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
Log.debug("ReplacePanel:[" + trId + ", CellData:" + cellData + "]");
|
Log.debug("ReplacePanel:[" + trId + ", CellData:" + cellData + "]");
|
||||||
initPanel();
|
initPanel();
|
||||||
retrieveColumn();
|
retrieveColumn();
|
||||||
|
@ -84,13 +97,17 @@ public class ReplacePanel extends FramedPanel {
|
||||||
|
|
||||||
public void onSuccess(ColumnData result) {
|
public void onSuccess(ColumnData result) {
|
||||||
Log.debug("Retrived column: " + result);
|
Log.debug("Retrived column: " + result);
|
||||||
|
column = result;
|
||||||
if (result.isViewColumn()) {
|
if (result.isViewColumn()) {
|
||||||
UtilsGXT3
|
/*
|
||||||
.info("View Column",
|
* UtilsGXT3 .info("View Column",
|
||||||
"You can not replace value on view column for now");
|
* "You can not replace value on view column for now"
|
||||||
close();
|
* );
|
||||||
|
*/
|
||||||
|
isDimension=true;
|
||||||
|
createForDimension();
|
||||||
} else {
|
} else {
|
||||||
column = result;
|
isDimension=false;
|
||||||
create();
|
create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,6 +166,74 @@ public class ReplacePanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void createForDimension() {
|
||||||
|
value = new TextField();
|
||||||
|
value.setValue(cellData.getValue());
|
||||||
|
value.setReadOnly(true);
|
||||||
|
|
||||||
|
// comboDimensionType
|
||||||
|
DimensionRowsProperties propsDimensionType = GWT
|
||||||
|
.create(DimensionRowsProperties.class);
|
||||||
|
ListStore<DimensionRow> storeComboDimensionType = new ListStore<DimensionRow>(
|
||||||
|
propsDimensionType.rowId());
|
||||||
|
|
||||||
|
comboDimensionType = new ComboBox<DimensionRow>(
|
||||||
|
storeComboDimensionType, propsDimensionType.value());
|
||||||
|
|
||||||
|
Log.trace("ComboDimensionType created");
|
||||||
|
|
||||||
|
addHandlersForComboDimensionType(propsDimensionType.value());
|
||||||
|
|
||||||
|
comboDimensionType.setEmptyText("Select a Value...");
|
||||||
|
comboDimensionType.setWidth(300);
|
||||||
|
comboDimensionType.setEditable(false);
|
||||||
|
comboDimensionType.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
comboDimensionTypeLabel = new FieldLabel(comboDimensionType, "Replace");
|
||||||
|
|
||||||
|
//
|
||||||
|
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");
|
||||||
|
replaceValueForDimension();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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(value, "Value"), new VerticalLayoutData(1, -1));
|
||||||
|
v.add(comboDimensionTypeLabel, new VerticalLayoutData(1, -1));
|
||||||
|
v.add(flowButton, new VerticalLayoutData(-1, 36,
|
||||||
|
new Margins(5, 2, 5, 2)));
|
||||||
|
add(v);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void replaceValue() {
|
protected void replaceValue() {
|
||||||
String rValue = replaceValue.getCurrentValue();
|
String rValue = replaceValue.getCurrentValue();
|
||||||
if (rValue == null || rValue.isEmpty()) {
|
if (rValue == null || rValue.isEmpty()) {
|
||||||
|
@ -165,6 +250,16 @@ public class ReplacePanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void replaceValueForDimension() {
|
||||||
|
DimensionRow dimRow = comboDimensionType.getCurrentValue();
|
||||||
|
if (dimRow == null) {
|
||||||
|
UtilsGXT3.alert("Attention", "Select a valid value");
|
||||||
|
} else {
|
||||||
|
callReplaceValue(dimRow.getRowId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected String checkTypeData(String rValue) {
|
protected String checkTypeData(String rValue) {
|
||||||
String checked = null;
|
String checked = null;
|
||||||
try {
|
try {
|
||||||
|
@ -211,11 +306,18 @@ public class ReplacePanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void callReplaceValue(String rValue) {
|
protected void callReplaceValue(String rValue) {
|
||||||
replaceColumnSession = new ReplaceColumnSession(
|
if (isDimension) {
|
||||||
value.getCurrentValue(), rValue, trId, column,
|
replaceColumnSession = new ReplaceColumnSession(
|
||||||
cellData.getRowId());
|
value.getCurrentValue(), rValue, trId, column,
|
||||||
Log.debug(replaceColumnSession.toString());
|
cellData.getRowId(), true);
|
||||||
|
Log.debug(replaceColumnSession.toString());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
replaceColumnSession = new ReplaceColumnSession(
|
||||||
|
value.getCurrentValue(), rValue, trId, column,
|
||||||
|
cellData.getRowId());
|
||||||
|
Log.debug(replaceColumnSession.toString());
|
||||||
|
}
|
||||||
TDGWTServiceAsync.INSTANCE.startReplaceColumn(replaceColumnSession,
|
TDGWTServiceAsync.INSTANCE.startReplaceColumn(replaceColumnSession,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@ -250,4 +352,45 @@ public class ReplacePanel extends FramedPanel {
|
||||||
parent.close();
|
parent.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addHandlersForComboDimensionType(
|
||||||
|
final LabelProvider<DimensionRow> labelProvider) {
|
||||||
|
|
||||||
|
comboDimensionType.addTriggerClickHandler(new TriggerClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTriggerClick(TriggerClickEvent event) {
|
||||||
|
Log.debug("ComboDimensionRows TriggerClickEvent");
|
||||||
|
callDialogDimensionRowSelection();
|
||||||
|
comboDimensionType.collapse();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void callDialogDimensionRowSelection() {
|
||||||
|
DialogDimensionRowSelection dialogDimensionRowSelection = new DialogDimensionRowSelection(
|
||||||
|
column, cellData, eventBus);
|
||||||
|
dialogDimensionRowSelection.addListener(this);
|
||||||
|
dialogDimensionRowSelection.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selected(DimensionRow dimRow) {
|
||||||
|
Log.debug("Selected dimension row: " + dimRow);
|
||||||
|
comboDimensionType.setValue(dimRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void aborted() {
|
||||||
|
comboDimensionType.setValue(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failed(String reason, String detail) {
|
||||||
|
comboDimensionType.setValue(null);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.gcube.portlets.user.td.columnwidget.client.utils;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
public static final String TDX_DATASOURCE_FACTORY_ID = "TDXDataSourceFactory";
|
||||||
|
|
||||||
|
}
|
|
@ -19,6 +19,7 @@
|
||||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||||
|
|
||||||
|
<inherits name="org.gcube.portlets.user.tdwx.TabularDataWidgetX" />
|
||||||
|
|
||||||
|
|
||||||
<!-- Specify the app entry point class. -->
|
<!-- Specify the app entry point class. -->
|
||||||
|
|
Loading…
Reference in New Issue