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.TDGWTIsLockedException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
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.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.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.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
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.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.ColumnDataType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ public class ColumnExpressionDialog extends Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void close (){
|
protected void close (){
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||||
ExpressionType.EXPRESSION_NULL);
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper);
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
hide();
|
hide();
|
||||||
eventBus.fireEvent(expressionEvent);
|
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.expressionwidget.shared.model.logical.C_Not;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
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.monitorwidget.client.utils.UtilsGXT3;
|
||||||
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.type.ExpressionType;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
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.C_ExpressionContainer;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -103,7 +103,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
createOnFilter();
|
createOnFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnExpressionPanel(RowsDeleteByExpressionDialog parentRowsDeleteByExpressionDialog,
|
public ColumnExpressionPanel(
|
||||||
|
RowsDeleteByExpressionDialog parentRowsDeleteByExpressionDialog,
|
||||||
ColumnData column, ArrayList<ColumnData> columns, EventBus eventBus) {
|
ColumnData column, ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
|
@ -117,8 +118,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
createOnRowsDeleteByExpression();
|
createOnRowsDeleteByExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param trId
|
* @param trId
|
||||||
|
@ -199,7 +198,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
btnClose = new TextButton("Close");
|
btnClose = new TextButton("Close");
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||||
|
@ -324,7 +322,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void createOnRowsDeleteByExpression() {
|
protected void createOnRowsDeleteByExpression() {
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
|
|
||||||
|
@ -383,7 +380,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
conditionsField.add(conditionWidget);
|
conditionsField.add(conditionWidget);
|
||||||
|
|
||||||
btnApply = new TextButton("Delete");
|
btnApply = new TextButton("Delete");
|
||||||
btnApply.setIcon(ExpressionResources.INSTANCE.tableRowDeleteByExpression());
|
btnApply.setIcon(ExpressionResources.INSTANCE
|
||||||
|
.tableRowDeleteByExpression());
|
||||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||||
btnApply.setTitle("Delete rows");
|
btnApply.setTitle("Delete rows");
|
||||||
btnApply.addSelectHandler(new SelectHandler() {
|
btnApply.addSelectHandler(new SelectHandler() {
|
||||||
|
@ -423,8 +421,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void setSelectedColumn() {
|
protected void setSelectedColumn() {
|
||||||
if (column == null) {
|
if (column == null) {
|
||||||
|
|
||||||
|
@ -572,17 +568,15 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Template:
|
case Template:
|
||||||
parentRuleDialog.setExpression(exp);
|
parentRuleDialog.setExpression(exp);
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
C_ExpressionContainer condContainer = new C_ExpressionContainer();
|
||||||
ExpressionType.CONDITION_COLUMN_EXPRESSION);
|
condContainer.setId(C_ExpressionContainer.Contains.C_Expression);
|
||||||
C_ExpressionContainer container = new C_ExpressionContainer();
|
condContainer.setExp(exp);
|
||||||
container.setId(C_ExpressionContainer.Contains.C_Expression);
|
condContainer.setReadableExpression(conditionWidget
|
||||||
container.setExp(exp);
|
|
||||||
container.setReadableExpression(conditionWidget
|
|
||||||
.getReadableExpression());
|
.getReadableExpression());
|
||||||
expressionEvent.setC_ConditionExpressionContainer(container);
|
ExpressionWrapper exWrapper=new ExpressionWrapper(column.getTrId(),
|
||||||
expressionEvent.setTrId(column.getTrId());
|
column.getColumnId(), column.getName(),condContainer);
|
||||||
expressionEvent.setColumnId(column.getColumnId());
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||||
expressionEvent.setColumnName(column.getName());
|
exWrapper);
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parentRuleDialog.hide();
|
parentRuleDialog.hide();
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
|
@ -615,8 +609,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
protected void close() {
|
protected void close() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||||
ExpressionType.EXPRESSION_NULL);
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(exWrapper);
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parentRuleDialog.hide();
|
parentRuleDialog.hide();
|
||||||
eventBus.fireEvent(expressionEvent);
|
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.expressionwidget.shared.exception.ReplaceTypeMapException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
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.monitorwidget.client.utils.UtilsGXT3;
|
||||||
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.type.ExpressionType;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
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.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.ColumnDataType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
|
@ -108,7 +108,6 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
private FieldSet replaceValueFieldSet;
|
private FieldSet replaceValueFieldSet;
|
||||||
|
|
||||||
|
|
||||||
public ReplaceColumnByExpressionPanel(
|
public ReplaceColumnByExpressionPanel(
|
||||||
ReplaceColumnByExpressionDialog parent, ColumnData column,
|
ReplaceColumnByExpressionDialog parent, ColumnData column,
|
||||||
ArrayList<ColumnData> columns, EventBus eventBus,
|
ArrayList<ColumnData> columns, EventBus eventBus,
|
||||||
|
@ -271,12 +270,10 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(column==null){
|
if (column == null) {
|
||||||
btnApply.disable();
|
btnApply.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
btnClose = new TextButton("Close");
|
btnClose = new TextButton("Close");
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||||
|
@ -415,13 +412,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
if (event.getSelectedItem() != null) {
|
if (event.getSelectedItem() != null) {
|
||||||
ColumnData col = event.getSelectedItem();
|
ColumnData col = event.getSelectedItem();
|
||||||
Log.debug("Col selected:" + col.toString());
|
Log.debug("Col selected:" + col.toString());
|
||||||
column=col;
|
column = col;
|
||||||
btnApply.enable();
|
btnApply.enable();
|
||||||
conditionWidget.update(col);
|
conditionWidget.update(col);
|
||||||
calcReplaceValue();
|
calcReplaceValue();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
column=null;
|
column = null;
|
||||||
btnApply.disable();
|
btnApply.disable();
|
||||||
conditionWidget.update(null);
|
conditionWidget.update(null);
|
||||||
calcReplaceValue();
|
calcReplaceValue();
|
||||||
|
@ -520,16 +517,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
protected void callApplyReplaceColumnByExpression(
|
protected void callApplyReplaceColumnByExpression(
|
||||||
C_Expression cConditionExpression, String replaceValue) {
|
C_Expression cConditionExpression, String replaceValue) {
|
||||||
if(column==null){
|
if (column == null) {
|
||||||
UtilsGXT3.alert("Attention", "Select a valid column!");
|
UtilsGXT3.alert("Attention", "Select a valid column!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (replaceColumnByExpressionType) {
|
switch (replaceColumnByExpressionType) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
|
||||||
ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION);
|
|
||||||
C_ExpressionContainer conditionExpressionContainer;
|
C_ExpressionContainer conditionExpressionContainer;
|
||||||
if (allRows) {
|
if (allRows) {
|
||||||
conditionExpressionContainer = new C_ExpressionContainer(
|
conditionExpressionContainer = new C_ExpressionContainer(
|
||||||
|
@ -541,18 +535,18 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
cConditionExpression,
|
cConditionExpression,
|
||||||
conditionWidget.getReadableExpression());
|
conditionWidget.getReadableExpression());
|
||||||
}
|
}
|
||||||
expressionEvent.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
|
||||||
expressionEvent.setReplaceByValue(true);
|
ExpressionWrapper exWrapper = new ExpressionWrapper(
|
||||||
expressionEvent.setReplaceValue(replaceValue);
|
column.getTrId(), column.getColumnId(), column.getName(),
|
||||||
expressionEvent.setTrId(column.getTrId());
|
conditionExpressionContainer, replaceValue);
|
||||||
expressionEvent.setColumnId(column.getColumnId());
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||||
expressionEvent.setColumnName(column.getName());
|
exWrapper);
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parent.hide();
|
parent.hide();
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
parent.applyReplaceColumnByExpression(column,allRows,
|
parent.applyReplaceColumnByExpression(column, allRows,
|
||||||
cConditionExpression, replaceValue);
|
cConditionExpression, replaceValue);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -563,15 +557,13 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
protected void callApplyReplaceColumnByExpression(
|
protected void callApplyReplaceColumnByExpression(
|
||||||
C_Expression cConditionExpression, C_Expression cReplaceExpression) {
|
C_Expression cConditionExpression, C_Expression cReplaceExpression) {
|
||||||
if(column==null){
|
if (column == null) {
|
||||||
UtilsGXT3.alert("Attention", "Select a valid column!");
|
UtilsGXT3.alert("Attention", "Select a valid column!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (replaceColumnByExpressionType) {
|
switch (replaceColumnByExpressionType) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
|
||||||
ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION);
|
|
||||||
C_ExpressionContainer conditionExpressionContainer;
|
C_ExpressionContainer conditionExpressionContainer;
|
||||||
if (allRows) {
|
if (allRows) {
|
||||||
conditionExpressionContainer = new C_ExpressionContainer(
|
conditionExpressionContainer = new C_ExpressionContainer(
|
||||||
|
@ -583,18 +575,16 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
cConditionExpression,
|
cConditionExpression,
|
||||||
conditionWidget.getReadableExpression());
|
conditionWidget.getReadableExpression());
|
||||||
}
|
}
|
||||||
expressionEvent
|
|
||||||
.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
|
||||||
expressionEvent.setReplaceByValue(false);
|
|
||||||
C_ExpressionContainer replaceExpressionContainer = new C_ExpressionContainer(
|
C_ExpressionContainer replaceExpressionContainer = new C_ExpressionContainer(
|
||||||
C_ExpressionContainer.Contains.C_Expression,
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||||
expressionEvent
|
|
||||||
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
|
||||||
|
|
||||||
expressionEvent.setTrId(column.getTrId());
|
ExpressionWrapper exWrapper = new ExpressionWrapper(
|
||||||
expressionEvent.setColumnId(column.getColumnId());
|
column.getTrId(), column.getColumnId(), column.getName(),
|
||||||
expressionEvent.setColumnName(column.getName());
|
conditionExpressionContainer, replaceExpressionContainer);
|
||||||
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||||
|
exWrapper);
|
||||||
|
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parent.hide();
|
parent.hide();
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
|
@ -681,8 +671,9 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
protected void close() {
|
protected void close() {
|
||||||
switch (replaceColumnByExpressionType) {
|
switch (replaceColumnByExpressionType) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
ExpressionWrapper exWrapper=new ExpressionWrapper();
|
||||||
ExpressionType.EXPRESSION_NULL);
|
ExpressionWrapperEvent expressionEvent = new ExpressionWrapperEvent(
|
||||||
|
exWrapper);
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parent.close();
|
parent.close();
|
||||||
eventBus.fireEvent(expressionEvent);
|
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 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.resources.ExpressionResources;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceExpressionType;
|
import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceExpressionType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
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.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
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.TRId;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
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>
|
* 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 WIDTH = "880px";
|
||||||
private static final String HEIGHT = "490px";
|
private static final String HEIGHT = "490px";
|
||||||
|
private ArrayList<ExpressionWrapperNotificationListener> listeners;
|
||||||
|
|
||||||
private ColumnData column;
|
private ColumnData column;
|
||||||
private ArrayList<ColumnData> columns;
|
private ArrayList<ColumnData> columns;
|
||||||
private String columnLocalId;
|
private String columnLocalId;
|
||||||
|
@ -42,21 +43,20 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
private ReplaceExpressionPanel replaceExpressionPanel;
|
private ReplaceExpressionPanel replaceExpressionPanel;
|
||||||
private ReplaceExpressionType type;
|
private ReplaceExpressionType type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Column must have set columnId, label, columnTypeCode and ColumnDataType.
|
* Column must have set columnId, label, columnTypeCode and ColumnDataType.
|
||||||
* Column is not used to construct the expression.
|
* Column is not used to construct the expression. Columns are retrieved
|
||||||
* Columns are retrieved from TRId.
|
* from TRId.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param column
|
* @param column
|
||||||
* @param trId
|
* @param trId
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
public ReplaceExpressionDialog(ColumnData column,
|
public ReplaceExpressionDialog(ColumnData column, TRId trId,
|
||||||
TRId trId, EventBus eventBus) {
|
EventBus eventBus) {
|
||||||
|
listeners=new ArrayList<ExpressionWrapperNotificationListener>();
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.column = column;
|
this.column = column;
|
||||||
type = ReplaceExpressionType.Replace;
|
type = ReplaceExpressionType.Replace;
|
||||||
|
@ -67,8 +67,8 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Column and Columns must have set columnId, label, columnTypeCode and ColumnDataType.
|
* Column and Columns must have set columnId, label, columnTypeCode and
|
||||||
* Column is not used to construct the expression.
|
* ColumnDataType. Column is not used to construct the expression.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param column
|
* @param column
|
||||||
|
@ -77,6 +77,7 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
*/
|
*/
|
||||||
public ReplaceExpressionDialog(ColumnData column,
|
public ReplaceExpressionDialog(ColumnData column,
|
||||||
ArrayList<ColumnData> columns, EventBus eventBus) {
|
ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||||
|
listeners=new ArrayList<ExpressionWrapperNotificationListener>();
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.column = column;
|
this.column = column;
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
|
@ -87,8 +88,6 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void initWindow() {
|
protected void initWindow() {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
|
@ -117,28 +116,17 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void create() {
|
protected void create() {
|
||||||
replaceExpressionPanel = new ReplaceExpressionPanel(
|
replaceExpressionPanel = new ReplaceExpressionPanel(this, column,
|
||||||
this, column, columns,type, eventBus);
|
columns, type, eventBus);
|
||||||
add(replaceExpressionPanel);
|
add(replaceExpressionPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void applyReplaceColumnByExpression(ExpressionWrapperNotification expressionWrapperNotification)
|
||||||
protected void applyReplaceColumnByExpression(ColumnData column,
|
{
|
||||||
String value) {
|
fire(expressionWrapperNotification);
|
||||||
this.column=column;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyReplaceColumnByExpression(ColumnData column,
|
|
||||||
C_ExpressionContainer expressionContainer) {
|
|
||||||
this.column=column;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void load() {
|
protected void load() {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
@ -177,16 +165,13 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
protected void sanitizesColumns() {
|
protected void sanitizesColumns() {
|
||||||
ArrayList<ColumnData> removableColumn = new ArrayList<ColumnData>();
|
ArrayList<ColumnData> removableColumn = new ArrayList<ColumnData>();
|
||||||
for (ColumnData c : columns) {
|
for (ColumnData c : columns) {
|
||||||
if (c.getTypeCode().compareTo(
|
if (c.getTypeCode().compareTo(ColumnTypeCode.DIMENSION.toString()) == 0
|
||||||
ColumnTypeCode.DIMENSION.toString()) == 0
|
|
||||||
|| c.getTypeCode().compareTo(
|
|| c.getTypeCode().compareTo(
|
||||||
ColumnTypeCode.TIMEDIMENSION
|
ColumnTypeCode.TIMEDIMENSION.toString()) == 0) {
|
||||||
.toString()) == 0) {
|
|
||||||
removableColumn.add(c);
|
removableColumn.add(c);
|
||||||
} else {
|
} else {
|
||||||
if (columnLocalId != null
|
if (columnLocalId != null
|
||||||
&& c.getColumnId().compareTo(
|
&& c.getColumnId().compareTo(columnLocalId) == 0) {
|
||||||
columnLocalId) == 0) {
|
|
||||||
removableColumn.add(c);
|
removableColumn.add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,11 +179,49 @@ public class ReplaceExpressionDialog extends Window {
|
||||||
columns.removeAll(removableColumn);
|
columns.removeAll(removableColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void close() {
|
protected void close() {
|
||||||
hide();
|
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.expressionwidget.shared.exception.ReplaceTypeMapException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
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.monitorwidget.client.utils.UtilsGXT3;
|
||||||
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.type.ExpressionType;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
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.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.ColumnDataType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
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) {
|
public void onSelect(SelectEvent event) {
|
||||||
Log.debug("Pressed Close");
|
Log.debug("Pressed Close");
|
||||||
|
parent.fireAborted();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -316,7 +317,6 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callApplyReplaceColumnByExpression(value);
|
callApplyReplaceColumnByExpression(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -363,21 +363,27 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
||||||
UtilsGXT3.alert("Attention", "Type is null!");
|
UtilsGXT3.alert("Attention", "Type is null!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExpressionWrapper exWrapper;
|
||||||
|
ExpressionWrapperEvent expressionEvent;
|
||||||
|
ExpressionWrapperNotification expressionWrapperNotification;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
exWrapper = new ExpressionWrapper(
|
||||||
ExpressionType.REPLACE_COLUMN_EXPRESSION);
|
replaceValue, column.getTrId(), column.getColumnId(), column.getName());
|
||||||
expressionEvent.setReplaceByValue(true);
|
expressionEvent = new ExpressionWrapperEvent(
|
||||||
expressionEvent.setReplaceValue(replaceValue);
|
exWrapper);
|
||||||
expressionEvent.setTrId(column.getTrId());
|
|
||||||
expressionEvent.setColumnId(column.getColumnId());
|
|
||||||
expressionEvent.setColumnName(column.getName());
|
|
||||||
Log.debug(expressionEvent.toString());
|
Log.debug(expressionEvent.toString());
|
||||||
parent.hide();
|
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
|
close();
|
||||||
break;
|
break;
|
||||||
case Replace:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -395,28 +401,35 @@ public class ReplaceExpressionPanel extends FramedPanel {
|
||||||
UtilsGXT3.alert("Attention", "Type is null!");
|
UtilsGXT3.alert("Attention", "Type is null!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExpressionWrapper exWrapper;
|
||||||
|
ExpressionWrapperEvent expressionEvent;
|
||||||
|
ExpressionWrapperNotification expressionWrapperNotification;
|
||||||
|
C_ExpressionContainer replaceExpressionContainer;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
|
||||||
ExpressionType.REPLACE_COLUMN_EXPRESSION);
|
replaceExpressionContainer = new C_ExpressionContainer(
|
||||||
expressionEvent.setReplaceByValue(false);
|
|
||||||
C_ExpressionContainer replaceExpressionContainer = new C_ExpressionContainer(
|
|
||||||
C_ExpressionContainer.Contains.C_Expression,
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||||
expressionEvent
|
exWrapper = new ExpressionWrapper(
|
||||||
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
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());
|
Log.debug(expressionEvent.toString());
|
||||||
parent.hide();
|
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
|
close();
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
parent.applyReplaceColumnByExpression(column, new C_ExpressionContainer(
|
replaceExpressionContainer = new C_ExpressionContainer(
|
||||||
C_ExpressionContainer.Contains.C_Expression,
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue