Apdated Multi Column Condition

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114705 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-05-07 17:37:23 +00:00
parent 876bbf6f8c
commit 997d4d7f96
9 changed files with 1615 additions and 536 deletions

View File

@ -4,15 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="tabular-data-gwt-service-2.6.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-gwt-service/tabular-data-gwt-service">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-widget-common-event-1.6.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-widget-common-event/tabular-data-widget-common-event">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="tabular-data-monitor-widget-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/tabular-data-monitor-widget/tabular-data-monitor-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/tabular-data-expression-widget/target/tabular-data-expression-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="tabular-data-expression-widget"/>
</wb-module>

View File

@ -1,33 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='ExpressionWidget'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.sencha.gxt.ui.GXT' />
<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.widgetcommonevent.WidgetCommonEvent' />
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<!-- Specify the app entry point class. -->
<!-- <entry-point
class='org.gcube.portlets.user.td.expressionwidget.client.ExpressionWidgetEntry' /> -->
<!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> -->
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- Other module inherits -->
<inherits name='com.sencha.gxt.ui.GXT' />
<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.widgetcommonevent.WidgetCommonEvent' />
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.expressionwidget.client.ExpressionWidgetEntry' /> -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -1,106 +1,196 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.expressionwidget.client.expression.ConditionOnMultiColumnWidget;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
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.user.UserInfo;
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.tr.TabResourceType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnMockUp;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.sencha.gxt.widget.core.client.container.Viewport;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ExpressionWidgetEntry implements EntryPoint {
protected EventBus eventBus;
protected static final String JSP_TAG_ID = "tdp";
public class ExpressionWidgetEntry implements EntryPoint {
private EventBus eventBus;
private TRId trId;
private ArrayList<ColumnData> columns;
private static final String JSP_TAG_ID = "tdp";
public void onModuleLoad() {
Log.debug("ExpressionWidgetEntry");
startInDevMode();
//TabularResource: [ id=86, type=STANDARD, lastTable=[ id=1159, type=Generic]]
EventBus eventBus= new SimpleEventBus();
TRId trId=new TRId("86",TabResourceType.STANDARD, "1159");
//String columnName="zwqvvx";
//Column Expression Dialog
//ColumnExpressionDialog expressionDialog=new ColumnExpressionDialog("1", ColumnTypeCode.ATTRIBUTE, ColumnDataType.Integer, eventBus);
//expressionDialog.show();
//Column Filter Dialog
//id=2, tableId=8, tableType=Generic
//ColumnFilterDialog columnFilterDialog=new ColumnFilterDialog(trId, columnName, eventBus);
//columnFilterDialog.show();
//Multi Column Filter Dialog
//MultiColumnFilterDialog multiColumnFilterDialog= new MultiColumnFilterDialog(trId, eventBus);
//multiColumnFilterDialog.show();
//Replace Column By Expression Dialog
//ReplaceColumnByExpressionDialog replaceColumnByExpression= new ReplaceColumnByExpressionDialog(trId, columnName, eventBus);
//replaceColumnByExpression.show();
//HelpReplaceColumnByExpressionDialog
//HelpReplaceColumnByExpressionDialog help= new HelpReplaceColumnByExpressionDialog(eventBus);
//help.show();
//Replace Expression Dialog
ColumnMockUp columnMockUp=new ColumnMockUp(null, null, "TestMock", ColumnTypeCode.ATTRIBUTE, ColumnDataType.Text,"");
ReplaceExpressionDialog replaceExpressionDialog=new ReplaceExpressionDialog(columnMockUp,trId,eventBus);
replaceExpressionDialog.show();
Log.info("Hello!");
callHello();
}
protected void startInDevMode() {
private void init() {
// TabularResource: [ id=86, type=STANDARD, lastTable=[ id=1159,
// type=Generic]]
// EventBus eventBus= new SimpleEventBus();
trId = new TRId("86", TabResourceType.STANDARD, "1159");
// String columnName="zwqvvx";
// Column Expression Dialog
// ColumnExpressionDialog expressionDialog=new
// ColumnExpressionDialog("1", ColumnTypeCode.ATTRIBUTE,
// ColumnDataType.Integer, eventBus);
// expressionDialog.show();
// Column Filter Dialog
// id=2, tableId=8, tableType=Generic
// ColumnFilterDialog columnFilterDialog=new ColumnFilterDialog(trId,
// columnName, eventBus);
// columnFilterDialog.show();
// Multi Column Filter Dialog
// MultiColumnFilterDialog multiColumnFilterDialog= new
// MultiColumnFilterDialog(trId, eventBus);
// multiColumnFilterDialog.show();
// Replace Column By Expression Dialog
// ReplaceColumnByExpressionDialog replaceColumnByExpression= new
// ReplaceColumnByExpressionDialog(trId, columnName, eventBus);
// replaceColumnByExpression.show();
// HelpReplaceColumnByExpressionDialog
// HelpReplaceColumnByExpressionDialog help= new
// HelpReplaceColumnByExpressionDialog(eventBus);
// help.show();
// Replace Expression Dialog
// ColumnMockUp columnMockUp=new ColumnMockUp(null, null, "TestMock",
// ColumnTypeCode.ATTRIBUTE, ColumnDataType.Text,"");
// ReplaceExpressionDialog replaceExpressionDialog=new
// ReplaceExpressionDialog(columnMockUp,trId,eventBus);
// replaceExpressionDialog.show();
retrieveColumns();
}
private void create() {
try {
ConditionOnMultiColumnWidget cond = new ConditionOnMultiColumnWidget(
columns);
startInDevMode(cond);
} catch (Throwable e) {
Log.error("Errore: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
private void startInDevMode(ConditionOnMultiColumnWidget cond) {
try {
RootPanel root = RootPanel.get(JSP_TAG_ID);
Log.info("Root Panel: " + root);
if (root == null) {
Log.info("Div with id " + JSP_TAG_ID
+ " not found, starting in dev mode");
Viewport viewport = new Viewport();
viewport.setWidget(new HTML("Hello!"));
if (cond == null) {
viewport.setWidget(new HTML(
"Attention Condition Panel is null!"));
} else {
viewport.setWidget(cond);// new HTML("Hello!")
}
viewport.onResize();
RootPanel.get().add(viewport);
} else {
Log.info("Application div with id " + JSP_TAG_ID
+ " found, starting in portal mode");
/*PortalViewport viewport = new PortalViewport();
Log.info("Created Viewport");
viewport.setEnableScroll(false);
viewport.setWidget(mainWidget);
Log.info("Set Widget");
Log.info("getOffsetWidth(): " + viewport.getOffsetWidth());
Log.info("getOffsetHeight(): " + viewport.getOffsetHeight());
viewport.onResize();
root.add(viewport);
Log.info("Added viewport to root");*/
/*
* PortalViewport viewport = new PortalViewport();
* Log.info("Created Viewport");
* viewport.setEnableScroll(false);
* viewport.setWidget(mainWidget); Log.info("Set Widget");
* Log.info("getOffsetWidth(): " + viewport.getOffsetWidth());
* Log.info("getOffsetHeight(): " + viewport.getOffsetHeight());
* viewport.onResize(); root.add(viewport);
* Log.info("Added viewport to root");
*/
}
} catch (Exception e) {
e.printStackTrace();
Log.error("Error in attach viewport:" + e.getLocalizedMessage());
}
}
private void callHello() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
@Override
public void onFailure(Throwable caught) {
Log.info("No valid user found: " + caught.getMessage());
if (caught instanceof TDGWTSessionExpiredException) {
UtilsGXT3.alert("Error", "Expired Session");
} else {
UtilsGXT3.alert("Error", "No user found");
}
}
@Override
public void onSuccess(UserInfo result) {
Log.info("Hello: " + result.getUsername());
init();
}
});
}
private void retrieveColumns() {
TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
Log.error("Error retrieving column: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving column",
caught.getMessage());
}
}
}
public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Retrived column: " + result);
columns = result;
create();
}
});
}
}

View File

@ -0,0 +1,53 @@
package org.gcube.portlets.user.td.expressionwidget.client.multicolumn;
import java.util.Arrays;
import java.util.List;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum ArgType {
COLUMN("Column"),
VALUE("Value");
/**
* @param text
*/
private ArgType(final String id) {
this.id = id;
}
private final String id;
@Override
public String toString() {
return id;
}
public String getLabel() {
return id;
}
public static List<ArgType> asList(){
return Arrays.asList(values());
}
public static ArgType getTypeFromId(String id) {
for (ArgType type : values()) {
if (type.id.compareToIgnoreCase(id) == 0) {
return type;
}
}
return null;
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.td.expressionwidget.client.multicolumn;
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 ArgTypePropertiesCombo extends
PropertyAccess<ArgType> {
@Path("name")
ModelKeyProvider<ArgType> id();
LabelProvider<ArgType> label();
}

View File

@ -1,5 +1,8 @@
package org.gcube.portlets.user.td.expressionwidget.client.multicolumn;
import java.util.Arrays;
import java.util.List;
/**
*
@ -7,13 +10,13 @@ package org.gcube.portlets.user.td.expressionwidget.client.multicolumn;
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum DepthOfExpressionType {
BOTTOM("Botom"),
STARTOR("StartOr"),
ENDOR("EndOr"),
STARTAND("StartAnd"),
ENDAND("EndAnd"),
COMMA("Comma");
public enum DepthOfExpressionType {
BOTTOM("&nbsp;"),
STARTOR("Or("),
ENDOR(")"),
STARTAND("And["),
ENDAND("]"),
COMMA(",");
@ -31,18 +34,24 @@ public enum DepthOfExpressionType {
return id;
}
public String getTableTypeLabel() {
public String getLabel() {
return id;
}
public static List<DepthOfExpressionType> asList(){
return Arrays.asList(values());
}
public static DepthOfExpressionType getColumnDataTypeFromId(String id) {
for (DepthOfExpressionType tableType : values()) {
if (tableType.id.compareToIgnoreCase(id) == 0) {
return tableType;
for (DepthOfExpressionType type : values()) {
if (type.id.compareToIgnoreCase(id) == 0) {
return type;
}
}
return null;
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.td.expressionwidget.client.multicolumn;
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 DepthOfExpressionTypePropertiesCombo extends
PropertyAccess<DepthOfExpressionType> {
@Path("name")
ModelKeyProvider<DepthOfExpressionType> id();
LabelProvider<DepthOfExpressionType> label();
}

View File

@ -23,8 +23,6 @@
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
<inherits
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
@ -33,7 +31,18 @@
<!-- Specify the app entry point class. -->
<!-- <entry-point
class='org.gcube.portlets.user.td.expressionwidget.client.ExpressionWidgetEntry' /> -->
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" />
<set-property name="log_DivLogger" value="ENABLED" />
<set-property name="log_GWTLogger" value="ENABLED" />
<set-property name="log_SystemLogger" value="ENABLED" /> -->
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
<!-- Specify the paths for translatable code -->
<source path='client' />