Added ExpressionWrapperEvent

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@113756 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-26 13:41:33 +00:00
parent b16aeb8bfb
commit 293919acf4
3 changed files with 328 additions and 139 deletions

View File

@ -1,139 +0,0 @@
package org.gcube.portlets.user.td.widgetcommonevent.client.event;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_ExpressionContainer;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExpressionEvent extends GwtEvent<ExpressionEvent.ExpressionEventHandler> {
public static Type<ExpressionEventHandler> TYPE = new Type<ExpressionEventHandler>();
private ExpressionType expressionType;
private TRId trId;
private String columnId;
private String columnName;
private C_ExpressionContainer c_ConditionExpressionContainer;
private boolean replaceByValue;
private String replaceValue;
private C_ExpressionContainer c_ReplaceExpressionContainer;
public interface ExpressionEventHandler extends EventHandler {
void onExpression(ExpressionEvent event);
}
public interface HasExpressionEventHandler extends HasHandlers{
public HandlerRegistration addExpressionEventHandler(ExpressionEventHandler handler);
}
public ExpressionEvent(ExpressionType expressionType) {
this.expressionType = expressionType;
}
public ExpressionType getExpressionType() {
return expressionType;
}
@Override
protected void dispatch(ExpressionEventHandler handler) {
handler.onExpression(this);
}
@Override
public Type<ExpressionEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ExpressionEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, ExpressionType expressionType) {
source.fireEvent(new ExpressionEvent(expressionType));
}
public TRId getTrId() {
return trId;
}
public void setTrId(TRId trId) {
this.trId = trId;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public C_ExpressionContainer getC_ConditionExpressionContainer() {
return c_ConditionExpressionContainer;
}
public void setC_ConditionExpressionContainer(C_ExpressionContainer c_ConditionExpressionContainer) {
this.c_ConditionExpressionContainer = c_ConditionExpressionContainer;
}
public String getColumnId() {
return columnId;
}
public void setColumnId(String columnId) {
this.columnId = columnId;
}
public boolean isReplaceByValue() {
return replaceByValue;
}
public void setReplaceByValue(boolean replaceByValue) {
this.replaceByValue = replaceByValue;
}
public C_ExpressionContainer getC_ReplaceExpressionContainer() {
return c_ReplaceExpressionContainer;
}
public void setC_ReplaceExpressionContainer(
C_ExpressionContainer c_ReplaceExpressionContainer) {
this.c_ReplaceExpressionContainer = c_ReplaceExpressionContainer;
}
public String getReplaceValue() {
return replaceValue;
}
public void setReplaceValue(String replaceValue) {
this.replaceValue = replaceValue;
}
@Override
public String toString() {
return "ExpressionEvent [expressionType=" + expressionType + ", trId="
+ trId + ", columnId=" + columnId + ", columnName="
+ columnName + ", c_ConditionExpressionContainer="
+ c_ConditionExpressionContainer + ", replaceByValue="
+ replaceByValue + ", replaceValue=" + replaceValue
+ ", c_ReplaceExpressionContainer="
+ c_ReplaceExpressionContainer + "]";
}
}

View File

@ -0,0 +1,81 @@
package org.gcube.portlets.user.td.widgetcommonevent.client.event;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.ExpressionWrapper;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExpressionWrapperEvent extends GwtEvent<ExpressionWrapperEvent.ExpressionWrapperEventHandler> {
public static Type<ExpressionWrapperEventHandler> TYPE = new Type<ExpressionWrapperEventHandler>();
private ExpressionWrapper expressionWrapper;
public interface ExpressionWrapperEventHandler extends EventHandler {
void onExpression(ExpressionWrapperEvent event);
}
public interface HasExpressionWrapperEventHandler extends HasHandlers{
public HandlerRegistration addExpressionWrapperEventHandler(ExpressionWrapperEventHandler handler);
public void removeExpressionWrapperEventHandler(ExpressionWrapperEventHandler handler);
}
public ExpressionWrapperEvent(ExpressionWrapper expressionWrapper) {
this.expressionWrapper = expressionWrapper;
}
@Override
protected void dispatch(ExpressionWrapperEventHandler handler) {
handler.onExpression(this);
}
@Override
public Type<ExpressionWrapperEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ExpressionWrapperEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, ExpressionWrapper expressionWrapper) {
source.fireEvent(new ExpressionWrapperEvent(expressionWrapper));
}
public ExpressionWrapper getExpressionWrapper() {
return expressionWrapper;
}
public void setExpressionWrapper(ExpressionWrapper expressionWrapper) {
this.expressionWrapper = expressionWrapper;
}
@Override
public String toString() {
return "ExpressionWrapperEvent [expressionWrapper=" + expressionWrapper
+ "]";
}
}

View File

@ -0,0 +1,247 @@
package org.gcube.portlets.user.td.widgetcommonevent.shared.expression;
import java.io.Serializable;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ExpressionType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExpressionWrapper implements Serializable {
private static final long serialVersionUID = 3877772253100442685L;
private ExpressionType expressionType;
private TRId trId;
private String columnId;
private String columnName;
private C_ExpressionContainer conditionExpressionContainer;
private boolean replaceByValue;
private String replaceValue;
private C_ExpressionContainer replaceExpressionContainer;
/**
*
*/
public ExpressionWrapper() {
super();
this.expressionType=ExpressionType.EXPRESSION_NULL;
}
/**
*
* @param trId
* @param columnId
* @param columnName
* @param conditionExpressionContainer
*/
public ExpressionWrapper(TRId trId,
String columnId, String columnName,
C_ExpressionContainer conditionExpressionContainer) {
super();
this.expressionType = ExpressionType.CONDITION_COLUMN_EXPRESSION;
this.trId = trId;
this.columnId = columnId;
this.columnName = columnName;
this.conditionExpressionContainer = conditionExpressionContainer;
this.replaceByValue = false;
this.replaceValue = null;
this.replaceExpressionContainer = null;
}
/**
*
* @param replaceValue
* @param trId
* @param columnId
* @param columnName
*/
public ExpressionWrapper(String replaceValue,TRId trId,
String columnId, String columnName) {
super();
this.expressionType = ExpressionType.REPLACE_COLUMN_EXPRESSION;
this.trId = trId;
this.columnId = columnId;
this.columnName = columnName;
this.conditionExpressionContainer = null;
this.replaceByValue = true;
this.replaceValue = replaceValue;
this.replaceExpressionContainer = null;
}
/**
*
* @param replaceExpressionContainer
* @param trId
* @param columnId
* @param columnName
*/
public ExpressionWrapper(C_ExpressionContainer replaceExpressionContainer,TRId trId,
String columnId, String columnName) {
super();
this.expressionType = ExpressionType.REPLACE_COLUMN_EXPRESSION;
this.trId = trId;
this.columnId = columnId;
this.columnName = columnName;
this.conditionExpressionContainer = null;
this.replaceByValue = false;
this.replaceValue = null;
this.replaceExpressionContainer = replaceExpressionContainer;
}
/**
*
* @param trId
* @param columnId
* @param columnName
* @param conditionExpressionContainer
* @param replaceExpressionContainer
*/
public ExpressionWrapper(TRId trId,
String columnId, String columnName,
C_ExpressionContainer conditionExpressionContainer,
C_ExpressionContainer replaceExpressionContainer) {
super();
this.expressionType = ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION;
this.trId = trId;
this.columnId = columnId;
this.columnName = columnName;
this.conditionExpressionContainer = conditionExpressionContainer;
this.replaceByValue = false;
this.replaceValue = null;
this.replaceExpressionContainer = replaceExpressionContainer;
}
/**
*
* @param trId
* @param columnId
* @param columnName
* @param conditionExpressionContainer
* @param replaceValue
*/
public ExpressionWrapper(TRId trId,
String columnId, String columnName,
C_ExpressionContainer conditionExpressionContainer,
String replaceValue) {
super();
this.expressionType = ExpressionType.CONDITION_AND_REPLACE_COLUMN_EXPRESSION;
this.trId = trId;
this.columnId = columnId;
this.columnName = columnName;
this.conditionExpressionContainer = conditionExpressionContainer;
this.replaceByValue = true;
this.replaceValue = replaceValue;
this.replaceExpressionContainer = null;
}
public ExpressionType getExpressionType() {
return expressionType;
}
public void setExpressionType(ExpressionType expressionType) {
this.expressionType = expressionType;
}
public TRId getTrId() {
return trId;
}
public void setTrId(TRId trId) {
this.trId = trId;
}
public String getColumnId() {
return columnId;
}
public void setColumnId(String columnId) {
this.columnId = columnId;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public C_ExpressionContainer getConditionExpressionContainer() {
return conditionExpressionContainer;
}
public void setConditionExpressionContainer(
C_ExpressionContainer conditionExpressionContainer) {
this.conditionExpressionContainer = conditionExpressionContainer;
}
public boolean isReplaceByValue() {
return replaceByValue;
}
public void setReplaceByValue(boolean replaceByValue) {
this.replaceByValue = replaceByValue;
}
public String getReplaceValue() {
return replaceValue;
}
public void setReplaceValue(String replaceValue) {
this.replaceValue = replaceValue;
}
public C_ExpressionContainer getReplaceExpressionContainer() {
return replaceExpressionContainer;
}
public void setReplaceExpressionContainer(
C_ExpressionContainer replaceExpressionContainer) {
this.replaceExpressionContainer = replaceExpressionContainer;
}
@Override
public String toString() {
return "ExpressionWrapper [expressionType=" + expressionType
+ ", trId=" + trId + ", columnId=" + columnId + ", columnName="
+ columnName + ", conditionExpressionContainer="
+ conditionExpressionContainer + ", replaceByValue="
+ replaceByValue + ", replaceValue=" + replaceValue
+ ", replaceExpressionContainer=" + replaceExpressionContainer
+ "]";
}
}