Initial import.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@90172 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7d9d295c4b
commit
133117fbfd
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='ExpressionWidget'>
|
||||
<!-- 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' />
|
||||
|
||||
<!-- 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' />
|
||||
|
||||
|
||||
|
||||
<!-- 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>
|
|
@ -0,0 +1,180 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ColumnExpressionPanel extends FramedPanel {
|
||||
protected TRId trId;
|
||||
protected String columnName=null;
|
||||
protected ColumnData column;
|
||||
//protected ComboBox<ColumnData> combo=null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param columnTypeCode
|
||||
* @param dataTypeName
|
||||
*/
|
||||
public ColumnExpressionPanel(String columnTypeCode, String dataTypeName) {
|
||||
column=new ColumnData();
|
||||
column.setDataTypeName(dataTypeName);
|
||||
column.setTypeCode(columnTypeCode);
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
* @param columnName
|
||||
*/
|
||||
public ColumnExpressionPanel(TRId trId, String columnName) {
|
||||
this.trId=trId;
|
||||
this.columnName=columnName;
|
||||
load(trId, columnName);
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
setBodyBorder(false);
|
||||
// getHeader().setIcon(Resources.IMAGES.side_list());
|
||||
setWidth(400);
|
||||
setHeight(400);
|
||||
setResize(true);
|
||||
|
||||
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||
basicLayout.setScrollMode(ScrollMode.AUTO);
|
||||
basicLayout.setAdjustForScroll(true);
|
||||
|
||||
TextField tf= new TextField();
|
||||
basicLayout.add(new FieldLabel(tf, "Prova"), new VerticalLayoutData(1, -1));
|
||||
|
||||
|
||||
add(basicLayout);
|
||||
|
||||
/*
|
||||
ContentPanel panel = new ContentPanel();
|
||||
panel.setHeaderVisible(false);
|
||||
|
||||
//panel.setBodyStyle("margin: 0px;");
|
||||
|
||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||
|
||||
Log.trace("Store created");
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||
|
||||
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
final ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(proxy);
|
||||
loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(store));
|
||||
Log.trace("Loader created");
|
||||
|
||||
|
||||
combo = new ComboBox<ColumnData>(store,
|
||||
props.label()){
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Log.trace("Combo created");
|
||||
|
||||
addHandlersForEventObservation(combo, props.label());
|
||||
|
||||
combo.setEmptyText("Select a column...");
|
||||
combo.setWidth(150);
|
||||
combo.setTypeAhead(true);
|
||||
combo.setTriggerAction(TriggerAction.ALL);
|
||||
combo.setLoader(loader);
|
||||
|
||||
FramedPanel form = new FramedPanel();
|
||||
form.setHeaderVisible(false);
|
||||
//form.setWidth(350);
|
||||
form.setBodyStyle("background: none;");
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(new FieldLabel(combo, "Column"), new VerticalLayoutData(1, -1));
|
||||
form.add(v);
|
||||
form.addButton(new TextButton("Remove"));
|
||||
|
||||
|
||||
panel.add(form);
|
||||
|
||||
basicLayout.add(panel, new VerticalLayoutData(-1, -1, new Margins()));
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private <T> void addHandlersForEventObservation(ComboBox<T> combo,
|
||||
final LabelProvider<T> labelProvider) {
|
||||
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
||||
|
||||
public void onValueChange(ValueChangeEvent<T> event) {
|
||||
Info.display(
|
||||
"Value Changed",
|
||||
"New value: "
|
||||
+ (event.getValue() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getValue()) + "!"));
|
||||
|
||||
}
|
||||
});
|
||||
combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||
public void onSelection(SelectionEvent<T> event) {
|
||||
Info.display(
|
||||
"State Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
protected void load(TRId trId, String columnName) {
|
||||
TDGWTServiceAsync.INSTANCE.getColumn(trId,columnName, new AsyncCallback<ColumnData>(){
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error retrieving column: "+caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(ColumnData result) {
|
||||
Log.debug("Retrived column: "+result);
|
||||
column=result;
|
||||
create();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.client;
|
||||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
|
||||
public class ExpressionWidgetEntry implements EntryPoint {
|
||||
|
||||
|
||||
public void onModuleLoad() {
|
||||
TRId trId=new TRId();
|
||||
//For example Tabular Resource 1 and table 1
|
||||
trId.setId("1");
|
||||
trId.setTableId("1");
|
||||
/*RemoveColumnDialog dialog=new RemoveColumnDialog(trId);
|
||||
dialog.show();
|
||||
ChangeLabelColumnDialog changeLabel=new ChangeLabelColumnDialog(trId);
|
||||
changeLabel.show();
|
||||
ChangeToAnnotationColumnDialog changeToAnnotation=new ChangeToAnnotationColumnDialog(trId);
|
||||
changeToAnnotation.show();*/
|
||||
Log.info("Hello!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='ExpressionWidget'>
|
||||
<!-- 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' />
|
||||
|
||||
<!-- 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' />
|
||||
|
||||
|
||||
|
||||
<!-- 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>
|
|
@ -0,0 +1,2 @@
|
|||
sendButton = Send
|
||||
nameField = Enter your name
|
|
@ -0,0 +1,2 @@
|
|||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
|
@ -0,0 +1,34 @@
|
|||
/** Add css rules here for your application. */
|
||||
|
||||
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #777777;
|
||||
margin: 40px 0px 70px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sendButton {
|
||||
display: block;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
/** Most GWT widgets already have a style name defined */
|
||||
.gwt-DialogBox {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.dialogVPanel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.serverResponseLabelError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||
#closeButton {
|
||||
margin: 15px 6px 6px;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<!doctype html>
|
||||
<!-- The DOCTYPE declaration above will set the -->
|
||||
<!-- browser's rendering engine into -->
|
||||
<!-- "Standards Mode". Replacing this declaration -->
|
||||
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||
<!-- differences in layout. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="ExpressionWidget.css">
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
<title>Web Application Starter Project</title>
|
||||
|
||||
<!-- -->
|
||||
<!-- This script loads your compiled module. -->
|
||||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
<script type="text/javascript" language="javascript" src="ExpressionWidget/ExpressionWidget.nocache.js"></script>
|
||||
</head>
|
||||
|
||||
<!-- -->
|
||||
<!-- The body can have arbitrary html, or -->
|
||||
<!-- you can leave the body empty if you want -->
|
||||
<!-- to create a completely dynamic UI. -->
|
||||
<!-- -->
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled
|
||||
in order for this application to display correctly.
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- Servlets Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<url-pattern>ExpressionWidget/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>ExpressionWidget/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>ExpressionWidget.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
|
@ -0,0 +1,64 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.client;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.junit.client.GWTTestCase;
|
||||
|
||||
/**
|
||||
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
|
||||
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
|
||||
* surefire during the test phase.
|
||||
*
|
||||
* If you run the tests using the Maven command line, you will have to
|
||||
* navigate with your browser to a specific url given by Maven.
|
||||
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
|
||||
* for details.
|
||||
*/
|
||||
public class GwtTestExpressionWidget extends GWTTestCase {
|
||||
|
||||
/**
|
||||
* Must refer to a valid module that sources this class.
|
||||
*/
|
||||
public String getModuleName() {
|
||||
return "org.gcube.portlets.user.td.expressionwidget.ExpressionWidgetJUnit";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This test will send a request to the server using the greetServer method in
|
||||
* GreetingService and verify the response.
|
||||
*/
|
||||
public void testGreetingService() {
|
||||
// Create the service that we will test.
|
||||
//GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
|
||||
//ServiceDefTarget target = (ServiceDefTarget) greetingService;
|
||||
//target.setServiceEntryPoint(GWT.getModuleBaseURL() + "SDMXImportWizardTD/greet");
|
||||
|
||||
// Since RPC calls are asynchronous, we will need to wait for a response
|
||||
// after this test method returns. This line tells the test runner to wait
|
||||
// up to 10 seconds before timing out.
|
||||
//delayTestFinish(10000);
|
||||
|
||||
// Send a request to the server.
|
||||
/* greetingService.greetServer("GWT User", new AsyncCallback<String>() {
|
||||
public void onFailure(Throwable caught) {
|
||||
// The request resulted in an unexpected error.
|
||||
fail("Request failure: " + caught.getMessage());
|
||||
}
|
||||
|
||||
|
||||
public void onSuccess(String result) {
|
||||
// Verify that the response is correct.
|
||||
assertTrue(result.startsWith("Hello, GWT User!"));
|
||||
|
||||
// Now that we have received a response, we need to tell the test runner
|
||||
// that the test is complete. You must call finishTest() after an
|
||||
// asynchronous test finishes successfully, or the test will time out.
|
||||
finishTest();
|
||||
}
|
||||
});*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="ExpressionWidgetJUnit">
|
||||
<!-- Inherit our applications main module. -->
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
|
||||
<!-- Specify the path to any remote services. -->
|
||||
<servlet path="/TDGWTService"
|
||||
class="org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl" />
|
||||
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
</module>
|
Loading…
Reference in New Issue