Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113757 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
959d99b09e
commit
29f2512706
|
@ -7,12 +7,12 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
|
@ -97,8 +97,8 @@ public class ColumnExpressionDialog extends Window {
|
|||
}
|
||||
|
||||
protected void close (){
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.EXPRESSION_NULL);
|
||||
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
|
|
|
@ -8,10 +8,10 @@ import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTyp
|
|||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Not;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -103,7 +103,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
createOnFilter();
|
||||
}
|
||||
|
||||
public ColumnExpressionPanel(RowsDeleteByExpressionDialog parentRowsDeleteByExpressionDialog,
|
||||
public ColumnExpressionPanel(
|
||||
RowsDeleteByExpressionDialog parentRowsDeleteByExpressionDialog,
|
||||
ColumnData column, ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||
super();
|
||||
setWidth(WIDTH);
|
||||
|
@ -117,8 +118,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
createOnRowsDeleteByExpression();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
|
@ -199,7 +198,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
|
@ -324,7 +322,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected void createOnRowsDeleteByExpression() {
|
||||
forceLayoutOnResize = true;
|
||||
|
||||
|
@ -383,7 +380,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
conditionsField.add(conditionWidget);
|
||||
|
||||
btnApply = new TextButton("Delete");
|
||||
btnApply.setIcon(ExpressionResources.INSTANCE.tableRowDeleteByExpression());
|
||||
btnApply.setIcon(ExpressionResources.INSTANCE
|
||||
.tableRowDeleteByExpression());
|
||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||
btnApply.setTitle("Delete rows");
|
||||
btnApply.addSelectHandler(new SelectHandler() {
|
||||
|
@ -423,8 +421,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void setSelectedColumn() {
|
||||
if (column == null) {
|
||||
|
||||
|
@ -572,17 +568,15 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
switch (type) {
|
||||
case Template:
|
||||
parentRuleDialog.setExpression(exp);
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.CONDITION_COLUMN_EXPRESSION);
|
||||
C_ExpressionContainer container = new C_ExpressionContainer();
|
||||
container.setId(C_ExpressionContainer.Contains.C_Expression);
|
||||
container.setExp(exp);
|
||||
container.setReadableExpression(conditionWidget
|
||||
C_ExpressionContainer condContainer = new C_ExpressionContainer();
|
||||
condContainer.setId(C_ExpressionContainer.Contains.C_Expression);
|
||||
condContainer.setExp(exp);
|
||||
condContainer.setReadableExpression(conditionWidget
|
||||
.getReadableExpression());
|
||||
expressionEvent.setC_ConditionExpressionContainer(container);
|
||||
expressionEvent.setTrId(column.getTrId());
|
||||
expressionEvent.setColumnId(column.getColumnId());
|
||||
expressionEvent.setColumnName(column.getName());
|
||||
ExpressionWrapper exWrapper=new ExpressionWrapper(column.getTrId(),
|
||||
column.getColumnId(), column.getName(),condContainer);
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
parentRuleDialog.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
|
@ -615,8 +609,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
protected void close() {
|
||||
switch (type) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.EXPRESSION_NULL);
|
||||
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
parentRuleDialog.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
|
|
|
@ -10,10 +10,10 @@ import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTyp
|
|||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ReplaceTypeMapException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
|
@ -108,7 +108,6 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
|
||||
private FieldSet replaceValueFieldSet;
|
||||
|
||||
|
||||
public ReplaceColumnByExpressionPanel(
|
||||
ReplaceColumnByExpressionDialog parent, ColumnData column,
|
||||
ArrayList<ColumnData> columns, EventBus eventBus,
|
||||
|
@ -271,12 +270,10 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
});
|
||||
if(column==null){
|
||||
if (column == null) {
|
||||
btnApply.disable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
|
@ -415,13 +412,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
if (event.getSelectedItem() != null) {
|
||||
ColumnData col = event.getSelectedItem();
|
||||
Log.debug("Col selected:" + col.toString());
|
||||
column=col;
|
||||
column = col;
|
||||
btnApply.enable();
|
||||
conditionWidget.update(col);
|
||||
calcReplaceValue();
|
||||
|
||||
} else {
|
||||
column=null;
|
||||
column = null;
|
||||
btnApply.disable();
|
||||
conditionWidget.update(null);
|
||||
calcReplaceValue();
|
||||
|
@ -520,16 +517,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
|
||||
protected void callApplyReplaceColumnByExpression(
|
||||
C_Expression cConditionExpression, String replaceValue) {
|
||||
if(column==null){
|
||||
if (column == null) {
|
||||
UtilsGXT3.alert("Attention", "Select a valid column!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (replaceColumnByExpressionType) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION);
|
||||
C_ExpressionContainer conditionExpressionContainer;
|
||||
if (allRows) {
|
||||
conditionExpressionContainer = new C_ExpressionContainer(
|
||||
|
@ -541,18 +535,18 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
cConditionExpression,
|
||||
conditionWidget.getReadableExpression());
|
||||
}
|
||||
expressionEvent.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
||||
expressionEvent.setReplaceByValue(true);
|
||||
expressionEvent.setReplaceValue(replaceValue);
|
||||
expressionEvent.setTrId(column.getTrId());
|
||||
expressionEvent.setColumnId(column.getColumnId());
|
||||
expressionEvent.setColumnName(column.getName());
|
||||
|
||||
ExpressionWrapper exWrapper = new ExpressionWrapper(
|
||||
column.getTrId(), column.getColumnId(), column.getName(),
|
||||
conditionExpressionContainer, replaceValue);
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
parent.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
break;
|
||||
case Replace:
|
||||
parent.applyReplaceColumnByExpression(column,allRows,
|
||||
parent.applyReplaceColumnByExpression(column, allRows,
|
||||
cConditionExpression, replaceValue);
|
||||
break;
|
||||
default:
|
||||
|
@ -563,15 +557,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
|
||||
protected void callApplyReplaceColumnByExpression(
|
||||
C_Expression cConditionExpression, C_Expression cReplaceExpression) {
|
||||
if(column==null){
|
||||
if (column == null) {
|
||||
UtilsGXT3.alert("Attention", "Select a valid column!");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (replaceColumnByExpressionType) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION);
|
||||
C_ExpressionContainer conditionExpressionContainer;
|
||||
if (allRows) {
|
||||
conditionExpressionContainer = new C_ExpressionContainer(
|
||||
|
@ -583,18 +575,16 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
cConditionExpression,
|
||||
conditionWidget.getReadableExpression());
|
||||
}
|
||||
expressionEvent
|
||||
.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
||||
expressionEvent.setReplaceByValue(false);
|
||||
C_ExpressionContainer replaceExpressionContainer = new C_ExpressionContainer(
|
||||
C_ExpressionContainer.Contains.C_Expression,
|
||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||
expressionEvent
|
||||
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
||||
|
||||
expressionEvent.setTrId(column.getTrId());
|
||||
expressionEvent.setColumnId(column.getColumnId());
|
||||
expressionEvent.setColumnName(column.getName());
|
||||
ExpressionWrapper exWrapper = new ExpressionWrapper(
|
||||
column.getTrId(), column.getColumnId(), column.getName(),
|
||||
conditionExpressionContainer, replaceExpressionContainer);
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
|
||||
Log.debug(expressionEvent.toString());
|
||||
parent.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
|
@ -681,8 +671,9 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
|||
protected void close() {
|
||||
switch (replaceColumnByExpressionType) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.EXPRESSION_NULL);
|
||||
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
parent.close();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.client.expression;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ExpressionWrapperNotification {
|
||||
|
||||
private ExpressionWrapper expressionWrapper;
|
||||
|
||||
public interface ExpressionWrapperNotificationListener {
|
||||
void onExpression(ExpressionWrapperNotification expressionWrapper);
|
||||
|
||||
void aborted();
|
||||
|
||||
void failed(Throwable throwable);
|
||||
}
|
||||
|
||||
public interface HasExpressionWrapperNotificationListener {
|
||||
public void addExpressionWrapperNotificationListener(ExpressionWrapperNotificationListener handler);
|
||||
|
||||
public void removeExpressionWrapperNotificationListener(
|
||||
ExpressionWrapperNotificationListener handler);
|
||||
|
||||
public void fire(ExpressionWrapperNotification notification);
|
||||
|
||||
public void fireAborted();
|
||||
|
||||
public void fireFailed(Throwable throwable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ExpressionWrapperNotification(ExpressionWrapper expressionWrapper) {
|
||||
this.expressionWrapper = expressionWrapper;
|
||||
}
|
||||
|
||||
public static void fire(HasExpressionWrapperNotificationListener source, ExpressionWrapper expressionWrapper) {
|
||||
source.fire(new ExpressionWrapperNotification(expressionWrapper));
|
||||
}
|
||||
|
||||
public static void fireAbort(HasExpressionWrapperNotificationListener source) {
|
||||
source.fireAborted();
|
||||
}
|
||||
|
||||
public static void fireFailed(HasExpressionWrapperNotificationListener source, Throwable throwable) {
|
||||
source.fireFailed(throwable);
|
||||
}
|
||||
|
||||
|
||||
public ExpressionWrapper getExpressionWrapper() {
|
||||
return expressionWrapper;
|
||||
}
|
||||
|
||||
public void setExpressionWrapper(ExpressionWrapper expressionWrapper) {
|
||||
this.expressionWrapper = expressionWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ExpressionWrapperNotification [expressionWrapper="
|
||||
+ expressionWrapper + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,8 @@ package org.gcube.portlets.user.td.expressionwidget.client.expression;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.expression.ExpressionWrapperNotification.ExpressionWrapperNotificationListener;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.expression.ExpressionWrapperNotification.HasExpressionWrapperNotificationListener;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceExpressionType;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
||||
|
@ -12,7 +14,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -28,11 +29,11 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ReplaceExpressionDialog extends Window {
|
||||
public class ReplaceExpressionDialog extends Window implements
|
||||
HasExpressionWrapperNotificationListener {
|
||||
private static final String WIDTH = "880px";
|
||||
private static final String HEIGHT = "490px";
|
||||
|
||||
|
||||
private ArrayList<ExpressionWrapperNotificationListener> listeners;
|
||||
private ColumnData column;
|
||||
private ArrayList<ColumnData> columns;
|
||||
private String columnLocalId;
|
||||
|
@ -42,21 +43,20 @@ public class ReplaceExpressionDialog extends Window {
|
|||
private ReplaceExpressionPanel replaceExpressionPanel;
|
||||
private ReplaceExpressionType type;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Column must have set columnId, label, columnTypeCode and ColumnDataType.
|
||||
* Column is not used to construct the expression.
|
||||
* Columns are retrieved from TRId.
|
||||
* Column is not used to construct the expression. Columns are retrieved
|
||||
* from TRId.
|
||||
*
|
||||
*
|
||||
* @param column
|
||||
* @param trId
|
||||
* @param eventBus
|
||||
*/
|
||||
public ReplaceExpressionDialog(ColumnData column,
|
||||
TRId trId, EventBus eventBus) {
|
||||
public ReplaceExpressionDialog(ColumnData column, TRId trId,
|
||||
EventBus eventBus) {
|
||||
listeners=new ArrayList<ExpressionWrapperNotificationListener>();
|
||||
this.eventBus = eventBus;
|
||||
this.column = column;
|
||||
type = ReplaceExpressionType.Replace;
|
||||
|
@ -67,8 +67,8 @@ public class ReplaceExpressionDialog extends Window {
|
|||
|
||||
/**
|
||||
*
|
||||
* Column and Columns must have set columnId, label, columnTypeCode and ColumnDataType.
|
||||
* Column is not used to construct the expression.
|
||||
* Column and Columns must have set columnId, label, columnTypeCode and
|
||||
* ColumnDataType. Column is not used to construct the expression.
|
||||
*
|
||||
*
|
||||
* @param column
|
||||
|
@ -77,6 +77,7 @@ public class ReplaceExpressionDialog extends Window {
|
|||
*/
|
||||
public ReplaceExpressionDialog(ColumnData column,
|
||||
ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||
listeners=new ArrayList<ExpressionWrapperNotificationListener>();
|
||||
this.eventBus = eventBus;
|
||||
this.column = column;
|
||||
this.columns = columns;
|
||||
|
@ -87,8 +88,6 @@ public class ReplaceExpressionDialog extends Window {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -117,28 +116,17 @@ public class ReplaceExpressionDialog extends Window {
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected void create() {
|
||||
replaceExpressionPanel = new ReplaceExpressionPanel(
|
||||
this, column, columns,type, eventBus);
|
||||
replaceExpressionPanel = new ReplaceExpressionPanel(this, column,
|
||||
columns, type, eventBus);
|
||||
add(replaceExpressionPanel);
|
||||
}
|
||||
|
||||
|
||||
protected void applyReplaceColumnByExpression(ColumnData column,
|
||||
String value) {
|
||||
this.column=column;
|
||||
|
||||
|
||||
protected void applyReplaceColumnByExpression(ExpressionWrapperNotification expressionWrapperNotification)
|
||||
{
|
||||
fire(expressionWrapperNotification);
|
||||
}
|
||||
|
||||
protected void applyReplaceColumnByExpression(ColumnData column,
|
||||
C_ExpressionContainer expressionContainer) {
|
||||
this.column=column;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void load() {
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
|
@ -177,16 +165,13 @@ public class ReplaceExpressionDialog extends Window {
|
|||
protected void sanitizesColumns() {
|
||||
ArrayList<ColumnData> removableColumn = new ArrayList<ColumnData>();
|
||||
for (ColumnData c : columns) {
|
||||
if (c.getTypeCode().compareTo(
|
||||
ColumnTypeCode.DIMENSION.toString()) == 0
|
||||
if (c.getTypeCode().compareTo(ColumnTypeCode.DIMENSION.toString()) == 0
|
||||
|| c.getTypeCode().compareTo(
|
||||
ColumnTypeCode.TIMEDIMENSION
|
||||
.toString()) == 0) {
|
||||
ColumnTypeCode.TIMEDIMENSION.toString()) == 0) {
|
||||
removableColumn.add(c);
|
||||
} else {
|
||||
if (columnLocalId != null
|
||||
&& c.getColumnId().compareTo(
|
||||
columnLocalId) == 0) {
|
||||
&& c.getColumnId().compareTo(columnLocalId) == 0) {
|
||||
removableColumn.add(c);
|
||||
}
|
||||
}
|
||||
|
@ -194,11 +179,49 @@ public class ReplaceExpressionDialog extends Window {
|
|||
columns.removeAll(removableColumn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExpressionWrapperNotificationListener(ExpressionWrapperNotificationListener handler) {
|
||||
listeners.add(handler);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeExpressionWrapperNotificationListener(
|
||||
ExpressionWrapperNotificationListener handler) {
|
||||
listeners.remove(handler);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fire(ExpressionWrapperNotification notification) {
|
||||
for(ExpressionWrapperNotificationListener listener:listeners){
|
||||
listener.onExpression(notification);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAborted() {
|
||||
for(ExpressionWrapperNotificationListener listener:listeners){
|
||||
listener.aborted();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireFailed(Throwable throwable) {
|
||||
for(ExpressionWrapperNotificationListener listener:listeners){
|
||||
listener.failed(throwable);;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceExpression
|
|||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ReplaceTypeMapException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionWrapperEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||
|
||||
|
@ -188,6 +188,7 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
|||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
parent.fireAborted();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
@ -316,7 +317,6 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
|||
return;
|
||||
}
|
||||
callApplyReplaceColumnByExpression(value);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -363,21 +363,27 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
|||
UtilsGXT3.alert("Attention", "Type is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
ExpressionWrapper exWrapper;
|
||||
ExpressionWrapperEvent expressionEvent;
|
||||
ExpressionWrapperNotification expressionWrapperNotification;
|
||||
|
||||
switch (type) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.REPLACE_COLUMN_EXPRESSION);
|
||||
expressionEvent.setReplaceByValue(true);
|
||||
expressionEvent.setReplaceValue(replaceValue);
|
||||
expressionEvent.setTrId(column.getTrId());
|
||||
expressionEvent.setColumnId(column.getColumnId());
|
||||
expressionEvent.setColumnName(column.getName());
|
||||
exWrapper = new ExpressionWrapper(
|
||||
replaceValue, column.getTrId(), column.getColumnId(), column.getName());
|
||||
expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
Log.debug(expressionEvent.toString());
|
||||
parent.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
close();
|
||||
break;
|
||||
case Replace:
|
||||
parent.applyReplaceColumnByExpression(column, replaceValue);
|
||||
exWrapper = new ExpressionWrapper(
|
||||
replaceValue, column.getTrId(), column.getColumnId(), column.getName());
|
||||
expressionWrapperNotification=new ExpressionWrapperNotification(exWrapper);
|
||||
parent.applyReplaceColumnByExpression(expressionWrapperNotification);
|
||||
close();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -395,28 +401,35 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
|||
UtilsGXT3.alert("Attention", "Type is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
ExpressionWrapper exWrapper;
|
||||
ExpressionWrapperEvent expressionEvent;
|
||||
ExpressionWrapperNotification expressionWrapperNotification;
|
||||
C_ExpressionContainer replaceExpressionContainer;
|
||||
switch (type) {
|
||||
case Template:
|
||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||
ExpressionType.REPLACE_COLUMN_EXPRESSION);
|
||||
expressionEvent.setReplaceByValue(false);
|
||||
C_ExpressionContainer replaceExpressionContainer = new C_ExpressionContainer(
|
||||
|
||||
replaceExpressionContainer = new C_ExpressionContainer(
|
||||
C_ExpressionContainer.Contains.C_Expression,
|
||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||
expressionEvent
|
||||
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
||||
exWrapper = new ExpressionWrapper(
|
||||
replaceExpressionContainer, column.getTrId(), column.getColumnId(), column.getName());
|
||||
expressionEvent = new ExpressionWrapperEvent(
|
||||
exWrapper);
|
||||
|
||||
expressionEvent.setTrId(column.getTrId());
|
||||
expressionEvent.setColumnId(column.getColumnId());
|
||||
expressionEvent.setColumnName(column.getName());
|
||||
Log.debug(expressionEvent.toString());
|
||||
parent.hide();
|
||||
eventBus.fireEvent(expressionEvent);
|
||||
close();
|
||||
break;
|
||||
case Replace:
|
||||
parent.applyReplaceColumnByExpression(column, new C_ExpressionContainer(
|
||||
replaceExpressionContainer = new C_ExpressionContainer(
|
||||
C_ExpressionContainer.Contains.C_Expression,
|
||||
cReplaceExpression, replaceWidget.getReadableExpression()));
|
||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||
exWrapper = new ExpressionWrapper(
|
||||
replaceExpressionContainer, column.getTrId(), column.getColumnId(), column.getName());
|
||||
expressionWrapperNotification=new ExpressionWrapperNotification(exWrapper);
|
||||
parent.applyReplaceColumnByExpression(expressionWrapperNotification);
|
||||
close();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue