Change Component Name on SVN

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@83953 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-10-24 10:12:33 +00:00 committed by Giancarlo Panichi
commit 9fa2fb9eb1
41 changed files with 2413 additions and 0 deletions

22
TDOpenTest-dev.launch Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/tabular-data-information/src/test/java/org/gcube/portlets/user/td/open/client/GwtTestTDOpen.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.td.open.client.GwtTestTDOpen"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-open"/>
</launchConfiguration>

22
TDOpenTest-prod.launch Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/tabular-data-information/src/test/java/org/gcube/portlets/user/td/open/client/GwtTestTDOpen.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.td.open.client.GwtTestTDOpen"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-open"/>
</launchConfiguration>

304
pom.xml Normal file
View File

@ -0,0 +1,304 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-open-widget</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>tabular-data-open-widget</name>
<description>tabular-data-open-widget allows the selection and the opening of tabular resource</description>
<scm>
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open</url>
</scm>
<developers>
<developer>
<name>Giancarlo Panichi</name>
<email>g.panichi@isti.cnr.it</email>
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>
<properties>
<distroDirectory>${project.basedir}/distro</distroDirectory>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<release.date>2013-10-18</release.date>
<templatesDirectory>templates</templatesDirectory>
<distroDirectory>distro</distroDirectory>
<configDirectory>config</configDirectory>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</gwtVersion>
<!-- To make this work on gwt-run you need to set up global env vars. on
MacOSX edit this file /etc/launchd.conf and put "setenv GLOBUS_LOCATION /Users/massi/portal/Portal-Bundle/gCore"
on Linux? -->
<GLOBUS_LOCATION>${env.GLOBUS_LOCATION}</GLOBUS_LOCATION>
<!-- GWT needs at least java 1.5 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<profiles>
<profile>
<id>localRun</id>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.gcube.data.publishing</groupId>
<artifactId>sdmx-registry-client-gcube</artifactId>
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.data.analysis.tabulardata</groupId>
<artifactId>service-client-mock</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- tabular-data-gwt-service -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-gwt-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- LOGGING -->
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- JUnit TEST -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
<!-- TODO check if needed -->
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.16</version>
</dependency>
</dependencies>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>TDOpen.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<module>org.gcube.portlets.user.td.open.TDOpen</module>
</configuration>
</plugin>
<!-- Maven -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${configDirectory}</outputDirectory>
<resources>
<resource>
<directory>${templatesDirectory}</directory>
<includes>
<include>profile.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-distro-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${distroDirectory}</outputDirectory>
<resources>
<resource>
<directory>${templatesDirectory}</directory>
<excludes>
<exclude>profile.xml</exclude>
<exclude>descriptor.xml</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>${distroDirectory}</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>${configDirectory}</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${templatesDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -0,0 +1,35 @@
package org.gcube.portlets.user.td.open.client;
import org.gcube.portlets.user.td.open.client.general.WizardWindow;
import org.gcube.portlets.user.td.gxtservice.shared.TDOpenSession;
import com.allen_sauer.gwt.log.client.Log;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TDOpen extends WizardWindow {
protected TDOpenSession tdOpenSession;
/**
* The id of the {@link CSVTarget} to use.
* @param targetId
*/
public TDOpen(String title) {
super(title);
Log.info("TDOpen: "+title);
setWidth(550);
setHeight(520);
tdOpenSession= new TDOpenSession();
TabResourcesSelectionCard tabResourcesSelection= new TabResourcesSelectionCard(tdOpenSession);
addCard(tabResourcesSelection);
}
}

View File

@ -0,0 +1,15 @@
package org.gcube.portlets.user.td.open.client;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
public class TDOpenEntry implements EntryPoint {
@Override
public void onModuleLoad() {
TDOpen tdopen= new TDOpen("Open Tabular Resource");
Log.info(tdopen.getId());
}
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client;
import org.gcube.portlets.user.td.gxtservice.shared.TabResource;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface TabResourcesProperties extends PropertyAccess<TabResource> {
@Path("id")
ModelKeyProvider<TabResource> id();
ValueProvider<TabResource, String> name();
ValueProvider<TabResource, String> agency();
ValueProvider<TabResource, String> date();
}

View File

@ -0,0 +1,105 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client;
import org.gcube.portlets.user.td.gxtservice.client.rpc.TDGXTServiceAsync;
import org.gcube.portlets.user.td.gxtservice.shared.TDOpenSession;
import org.gcube.portlets.user.td.gxtservice.shared.TabResource;
import org.gcube.portlets.user.td.open.client.general.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabResourcesSelectionCard extends WizardCard {
protected TabResourcesSelectionCard thisCard;
protected TDOpenSession tdOpenSession;
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
protected TabResource selectedTabResource = null;
public TabResourcesSelectionCard(final TDOpenSession tdOpenSession) {
super("Select a Tabular Resource", "");
this.tdOpenSession = tdOpenSession;
thisCard = this;
this.tabResourcesSelectionPanel = new TabResourcesSelectionPanel(res);
tabResourcesSelectionPanel
.addSelectionHandler(new SelectionHandler<TabResource>() {
@Override
public void onSelection(SelectionEvent<TabResource> event) {
tdOpenSession
.setSelectedTabResource(tabResourcesSelectionPanel
.getSelectedItem());
getWizardWindow().setEnableNextButton(true);
}
});
setContent(tabResourcesSelectionPanel);
}
@Override
public void setup() {
Command sayFinish = new Command() {
@Override
public void execute() {
TabResource tabResource = tdOpenSession
.getSelectedTabResource();
TDGXTServiceAsync.INSTANCE.setTabResource(tabResource,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox(
"Error", "Error on set TabResource: "
+ caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent event) {
// TODO Auto-generated method stub
}
});
d.show();
}
@Override
public void onSuccess(Void result) {
}
});
getWizardWindow().fireCompleted(tabResource.getTrId());
Log.info("OpenTD Tabular Resource selected :" + tabResource);
getWizardWindow().close(false);
}
};
getWizardWindow().setFinishCommand(sayFinish);
}
}

View File

@ -0,0 +1,223 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client;
import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.td.open.client.dataresource.ResourceBundle;
import org.gcube.portlets.user.td.gxtservice.client.rpc.TDGXTServiceAsync;
import org.gcube.portlets.user.td.gxtservice.shared.TabResource;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.data.client.loader.RpcProxy;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.Store;
import com.sencha.gxt.data.shared.Store.StoreFilter;
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
import com.sencha.gxt.data.shared.loader.ListLoadResult;
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
import com.sencha.gxt.data.shared.loader.ListLoader;
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.Resizable;
import com.sencha.gxt.widget.core.client.Resizable.Dir;
import com.sencha.gxt.widget.core.client.button.TextButton;
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.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabResourcesSelectionPanel extends ContentPanel implements HasSelectionHandlers<TabResource> {
private static final TabResourcesProperties properties = GWT.create(TabResourcesProperties.class);
protected static final ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(properties.name(), 50, "Name");
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(properties.agency(), 50, "Agency");
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(properties.date(), 50, "Date");
protected Grid<TabResource> grid;
protected ResourceBundle res;
@SuppressWarnings("unchecked")
public TabResourcesSelectionPanel(ResourceBundle res)
{
this.res=res;
setHeaderVisible(false);
new Resizable(this, Dir.E, Dir.SE, Dir.S);
buildPanel(properties.id(), Arrays.<ColumnConfig<TabResource, ?>>asList(nameColumn, agencyColumn, dateColumn), nameColumn);
}
protected void buildPanel(ModelKeyProvider<TabResource> keyProvider, List<ColumnConfig<TabResource, ?>> columns, ColumnConfig<TabResource, ?> autoexpandColumn)
{
ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Search: "));
final TextField searchField = new TextField();
toolBar.add(searchField);
TextButton btnReload = new TextButton();
//btnReload.setText("Reload");
btnReload.setIcon(res.refresh16());
btnReload.setToolTip("Reload");
toolBar.add(btnReload);
IdentityValueProvider<TabResource> identity = new IdentityValueProvider<TabResource>();
final CheckBoxSelectionModel<TabResource> sm = new CheckBoxSelectionModel<TabResource>(identity);
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(keyProvider);
searchField.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
Log.trace("searchTerm: "+searchField.getCurrentValue());
store.applyFilters();
}
});
store.addFilter(new StoreFilter<TabResource>() {
@Override
public boolean select(Store<TabResource> store, TabResource parent, TabResource item) {
String searchTerm = searchField.getCurrentValue();
if (searchTerm == null) return true;
return TabResourcesSelectionPanel.this.select(item, searchTerm);
}
});
store.setEnableFilters(true);
RpcProxy<ListLoadConfig, ListLoadResult<TabResource>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<TabResource>>() {
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<TabResource>> callback) {
loadData(loadConfig, callback);
}
};
final ListLoader<ListLoadConfig, ListLoadResult<TabResource>> loader = new ListLoader<ListLoadConfig, ListLoadResult<TabResource>>(proxy);
loader.setRemoteSort(false);
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, TabResource, ListLoadResult<TabResource>>(store));
grid = new Grid<TabResource>(store, cm){
@Override
protected void onAfterFirstAttach() {
super.onAfterFirstAttach();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
loader.load();
}
});
}
};
sm.setSelectionMode(SelectionMode.SINGLE);
grid.setLoader(loader);
grid.setSelectionModel(sm);
grid.getView().setAutoExpandColumn(autoexpandColumn);
grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true);
grid.setBorders(false);
grid.setLoadMask(true);
grid.setColumnReordering(true);
SelectHandler sh = new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
loader.load();
}
};
btnReload.addSelectHandler(sh);
VerticalLayoutContainer con = new VerticalLayoutContainer();
con.add(toolBar, new VerticalLayoutData(1, -1));
con.add(grid, new VerticalLayoutData(1, 1));
setWidget(con);
}
protected boolean select(TabResource item, String searchTerm) {
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
if (item.getAgency()!=null &&item.getAgency().toLowerCase().contains(searchTerm.toLowerCase())) return true;
if (item.getDate()!=null && item.getDate().toLowerCase().contains(searchTerm.toLowerCase())) return true;
return false;
}
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<TabResource>> callback) {
TDGXTServiceAsync.INSTANCE.getTabularResources(new AsyncCallback<List<TabResource>>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(List<TabResource> result) {
Log.trace("loaded "+result.size()+" TabularResources");
callback.onSuccess(new ListLoadResultBean<TabResource>(result));
}
});
}
@Override
public HandlerRegistration addSelectionHandler(SelectionHandler<TabResource> handler) {
return grid.getSelectionModel().addSelectionHandler(handler);
}
public TabResource getSelectedItem() {
return grid.getSelectionModel().getSelectedItem();
}
protected class ExtendedListStore<M> extends ListStore<M> {
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
super(keyProvider);
}
public void applyFilters()
{
super.applyFilters();
}
}
}

View File

@ -0,0 +1,31 @@
package org.gcube.portlets.user.td.open.client.dataresource;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface ResourceBundle extends ClientBundle {
public static final ResourceBundle IMPL=GWT.create(ResourceBundle.class);
@Source("org/gcube/portlets/user/td/open/client/dataresource/resources/TDOpen.css")
TDOpenCSS tdOpenCss();
@Source("resources/arrow-refresh.png")
ImageResource refresh();
@Source("resources/arrow-refresh_16.png")
ImageResource refresh16();
@Source("resources/arrow-refresh_32.png")
ImageResource refresh32();
}

View File

@ -0,0 +1,41 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.dataresource;
import com.google.gwt.resources.client.CssResource;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface TDOpenCSS extends CssResource {
@ClassName("wizard-title")
public String getWizardTitle();
@ClassName("wizard-footer")
public String getWizardFooter();
@ClassName("source-selection-hover")
public String getSourceSelectionHover();
// @ClassName("column-excluded")
// public String getColumnExcluded();
@ClassName("importSelection-sources")
public String getImportSelectionSources();
@ClassName("importSelection-source")
public String getImportSelectionSource();
@ClassName("sdmxRegistryUrlStyle")
public String getSDMXRegistryUrlStyle();
@ClassName("sdmxRegistryUrlInputStyle")
public String getSDMXRegistryUrlInputStyle();
}

View File

@ -0,0 +1,33 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.general;
import com.google.gwt.user.client.ui.HTML;
import com.sencha.gxt.widget.core.client.ContentPanel;
/**
* A simple wizard card.
* @author Federico De Faveri defaveri@isti.cnr.it
*/
public class SimpleWizardCard extends WizardCard {
/**
* Create a new simple wizard card.
* @param title the card title.
* @param footer the card footer.
* @param content the card content.
*/
public SimpleWizardCard(String title, String footer, String content) {
super(title, footer);
ContentPanel contentPanel = new ContentPanel();
contentPanel.setHeaderVisible(false);
HTML htmlContent = new HTML(content);
htmlContent.setStyleName("wizard-simple-content");
contentPanel.add(htmlContent);
setContent(contentPanel);
}
}

View File

@ -0,0 +1,272 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.general;
import org.gcube.portlets.user.td.open.client.dataresource.ResourceBundle;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.HTML;
import com.sencha.gxt.widget.core.client.Component;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
* Represents a Wizard Card.
*/
public class WizardCard extends BorderLayoutContainer {
private WizardWindow wizardWindow;
protected ContentPanel titlePanel;
protected ContentPanel footerPanel;
protected boolean calculateFooter = false;
protected HTML titleHtml;
protected HTML footerHtml;
final protected ResourceBundle res=ResourceBundle.IMPL;
/**
* Creates a new wizard card.
* The footer is automatically calculated.
* @param title the card title.
*/
public WizardCard(String title) {
this(title,"");
calculateFooter = true;
}
/**
* Creates a new wizard card.
* @param title the card title.
* @param footer the card footer.
*/
public WizardCard(String title, String footer) {
Log.info(title);
res.tdOpenCss().ensureInjected();
//add the title panel
titlePanel = new ContentPanel();
titlePanel.setHeight(30);
titlePanel.setBodyStyle("background-color:#C3D9FF");
titlePanel.setHeaderVisible(false);
titleHtml = new HTML(title);
titleHtml.setStylePrimaryName(res.tdOpenCss().getWizardTitle());
titlePanel.add(titleHtml);
setNorthWidget(titlePanel, new BorderLayoutData(30));
//add the footer panel
footerPanel = new ContentPanel();
footerPanel.setHeight(30);
footerPanel.setBodyStyle("background-color:#CDEB8B");
footerPanel.setHeaderVisible(false);
footerHtml = new HTML(footer);
footerHtml.setStylePrimaryName(res.tdOpenCss().getWizardFooter());
footerPanel.add(footerHtml);
setSouthWidget(footerPanel, new BorderLayoutData(30));
}
/**
* {@inheritDoc}
*/
public void setTitle(String title)
{
titleHtml.setHTML("<h1>"+title+"</h1>");
}
/**
* Sets the card footer.
* @param footer the footer.
*/
public void setFooter(String footer)
{
footerHtml.setHTML("<p>"+footer+"</p>");
}
/**
* Sets the card content.
* @param content the card content.
*/
public void setContent(Component content)
{
setCenterWidget(content);
}
/**
* Sets the card content.
* @param content the card content.
*/
public void setContent(com.google.gwt.user.client.ui.Panel content)
{
setCenterWidget(content);
}
/**
* Enables the next button.
* @param enable <code>true</code> to enable it, <code>false</code> otherwise.
*/
public void setEnableNextButton(boolean enable)
{
if (wizardWindow!=null){
wizardWindow.setEnableNextButton(enable);
}
}
/**
* Enables the back button.
* @param enable <code>true</code> to enable the button, <code>false</code> otherwise.
*/
public void setEnableBackButton(boolean enable)
{
if (wizardWindow!=null){
wizardWindow.setEnableBackButton(enable);
}
}
/**
* Sets the next button label.
* @param text the button label.
*/
public void setNextButtonText(String text)
{
if (wizardWindow!=null){
wizardWindow.setNextButtonText(text);
}
}
/**
* Sets the back button label.
* @param text the button label.
*/
public void setBackButtonText(String text)
{
if (wizardWindow!=null){
wizardWindow.setBackButtonText(text);
}
}
/**
* Visible the next button.
* @param visible <code>true</code> to show the button, <code>false</code> otherwise.
*/
public void setNextButtonVisible(boolean visible)
{
if (wizardWindow!=null){
wizardWindow.setNextButtonVisible(visible);
}
}
/**
* Visible the back button.
* @param visible <code>true</code> to show the button, <code>false</code> otherwise.
*/
public void setBackButtonVisible(boolean visible)
{
if (wizardWindow!=null){
wizardWindow.setBackButtonVisible(visible);
}
}
public void setNextButtonToFinish()
{
if (wizardWindow!=null){
wizardWindow.setNextButtonToFinish();
}
}
/**
* Sets the WizardWindow for this import card.
* @param wizardWindow the WizardWindow.
*/
protected void setWizardWindow(WizardWindow wizardWindow)
{
this.wizardWindow = wizardWindow;
if (calculateFooter) {
StringBuilder footer = new StringBuilder();
footer.append("Step ");
footer.append(getCardPosition());
footer.append(" of ");
footer.append(getCardSize());
setFooter(footer.toString());
}
}
/**
* Returns the current wizard window.
* @return the wizard window.
*/
protected WizardWindow getWizardWindow()
{
if (wizardWindow==null) throw new IllegalStateException("No Wizard Window setup");
return wizardWindow;
}
public void addToWindowTitle(String toAdd)
{
wizardWindow.setTitle(wizardWindow.getOriginalTitle()+toAdd);
}
/**
* Called before the card is showed.
*/
public void setup()
{
}
/**
* Called when the card is disposed.
*/
public void dispose()
{}
/**
* Add a listener to the next button.
* @param listener the listener to add.
*/
public void addNextButtonListener(SelectHandler listener)
{
if (wizardWindow!=null){
wizardWindow.addNextButtonListener(listener);
}
}
/**
* Gets the number of cards in the wizard window.
* @return the number of cards.
*/
public int getCardSize()
{
return getWizardWindow().getCardStackSize();
}
/**
* Returns this card position on card list.
* @return the card position on the card stack.
*/
public int getCardPosition()
{
int indexPosition = getWizardWindow().getCardStack().indexOf(this);
return (indexPosition>=0)?indexPosition+1:indexPosition;
}
public void showErrorAndHide(String title, final String failureReason, final String failureDetails, final Throwable throwable)
{
wizardWindow.showErrorAndHide(title, failureReason, failureDetails, throwable);
}
public void hideWindow()
{
wizardWindow.hide();
}
}

View File

@ -0,0 +1,36 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.general;
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface WizardListener {
/**
* Called when the wizard is completed without errors
* and return TableId
*/
public void completed(TRId trId);
/**
* Called when the wizard has been aborted by the user.
*/
public void aborted();
/**
* Called when the something in the wizard is failed.
* @param throwable the exception or <code>null</code>.
* @param reason the failure reason or <code>null</code>.
* @param details the failure details or <code>null</code>.
*/
public void failed(Throwable throwable, String reason, String details);
}

View File

@ -0,0 +1,484 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.general;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
import org.gcube.portlets.user.td.open.client.util.ErrorMessageBox;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.Callback;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.SimpleEventBus;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.widget.core.client.Dialog;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.CardLayoutContainer;
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.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.toolbar.FillToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class WizardWindow extends Window {
protected ArrayList<WizardCard> cardStack = new ArrayList<WizardCard>();
protected TextButton backButton;
protected TextButton nextButton;
protected String originalTitle;
protected boolean checkBeforeClose = true;
protected boolean nextCardFinish = false;
protected Command nextButtonAction = null;
protected Command previousButtonAction = null;
protected Command finishCommand = new Command() {
public void execute() {
close(false);
}
};
protected CardLayoutContainer cardContainer;
protected ArrayList<WizardListener> listeners;
protected SimpleEventBus eventBus;
protected boolean finish=true;
/**
* Create a new Wizard Window with the specified title.
* @param title the wizard window title.
*/
public WizardWindow(String title)
{
super();
Log.info("Window "+title);
this.eventBus= new SimpleEventBus();
Log.info(title);
//setModal(true);
setResizable(true);
setCollapsible(true);
listeners = new ArrayList<WizardListener>();
setHeadingText(title);
this.originalTitle = title;
VerticalLayoutContainer container = new VerticalLayoutContainer();
cardContainer = new CardLayoutContainer();
container.add(cardContainer, new VerticalLayoutData(1, 1));
ToolBar toolbar = new ToolBar();
toolbar.addStyleName(ThemeStyles.getStyle().borderTop());
backButton = new TextButton("Back");
backButton.setEnabled(false);
backButton.setVisible(false);
backButton.setTabIndex(1001);
toolbar.add(backButton);
toolbar.add(new FillToolItem());
nextButton = new TextButton("Open");
nextButton.setEnabled(false);
nextButton.setTabIndex(1000);
toolbar.add(nextButton);
toolbar.setLayoutData(new VerticalLayoutData(1, -1));
container.add(toolbar);
SelectHandler selectionHandler = new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
TextButton button = (TextButton)event.getSource();
String btnID = button.getId();
if (btnID.equals(backButton.getId())) {
if(previousButtonAction!=null) {
previousButtonAction.execute();
}
else {
previousCard();
}
} else {
if (nextButtonAction!=null) {
nextButtonAction.execute();
} else {
nextCard();
}
}
}
};
backButton.addSelectHandler(selectionHandler);
nextButton.addSelectHandler(selectionHandler);
setWidget(container);
}
/**
* {@inheritDoc}
*/
@Override
protected void initTools() {
super.initTools();
//we can't distinguish between hide and hide with button
/*closeBtn.removeAllListeners();
closeBtn.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
MessageBox.confirm("Confirm", "Are you sure to cancel the operation?", new Listener<MessageBoxEvent>() {
@Override
public void handleEvent(MessageBoxEvent be) {
if (be.getButtonClicked().getItemId().equals(Dialog.YES)) {
hide();
fireAborted();
}
}
});
}
});*/
}
public void addListener(WizardListener listener)
{
listeners.add(listener);
}
public void removeListener(WizardListener listener)
{
listeners.remove(listener);
}
/**
* Shows the next available card.
*/
public void nextCard()
{
if (finish) {
callCardSetup();
finishCommand.execute();
} else {
Widget activeItem = cardContainer.getActiveWidget();
if (activeItem instanceof WizardCard)
((WizardCard) activeItem).dispose();
int cardPos = cardStack.indexOf(activeItem);
// NEXT ->
nextButton.setEnabled(true);
backButton.setEnabled(true);
int newPos = cardPos + 1;
if (newPos == 0) {
// we are moving forward from the first card
backButton.setEnabled(false);
}
nextButtonAction = null;
previousButtonAction = null;
Log.info("cardStack size:" + cardStack.size());
if (newPos < cardStack.size()) {
WizardCard card = cardStack.get(newPos);
cardContainer.setActiveWidget(card);
doLayout();
card.setup();
} else {
close(false);
}
}
}
private void callCardSetup(){
cardStack.get(cardStack.indexOf(cardContainer.getActiveWidget())).setup();
}
/**
* Shows the previous available card.
*/
public void previousCard()
{
Widget activeItem = cardContainer.getActiveWidget();
if (activeItem instanceof WizardCard) ((WizardCard)activeItem).dispose();
int cardPos = cardStack.indexOf(activeItem);
//BACK <-
nextButton.setEnabled(true);
backButton.setEnabled(true);
int newPos=cardPos-1;
if (newPos == 0) {
backButton.setEnabled(false);
}
nextButtonAction=null;
previousButtonAction=null;
WizardCard card = cardStack.get(newPos);
cardContainer.setActiveWidget(card);
doLayout();
//if (card instanceof WizardCard) ((WizardCard)card).setup();
card.setup();
}
/**
* Returns the number of available cards.
* @return
*/
public int getCardStackSize()
{
return cardStack.size();
}
/**
* Returns the current active card.
* @return
*/
public int getCurrentCard()
{
return cardStack.indexOf(cardContainer.getActiveWidget());
}
public boolean checkBeforeClose()
{
return true;
}
public void close(boolean check) {
checkBeforeClose = check;
hide();
}
/**
* Sets the label of next button to "Finish" value and add a close command to it.
*/
public void setNextButtonToFinish()
{
finish=true;
nextButton.setText("Finish");
}
/**
*
* @param finishCommand
*/
public void setFinishCommand(Command finishCommand) {
this.finishCommand = finishCommand;
}
/**
* Set the command for the next button.
* @param command the command to execute.
*/
public void setNextButtonCommand(Command command)
{
nextButtonAction = command;
}
/**
* Set the command for the previous button.
* @param command the command to execute.
*/
public void setPreviousButtonCommand(Command command)
{
previousButtonAction = command;
}
/**
* {@inheritDoc}
*/
@Override
public void show() {
super.show();
Widget activeItem = cardContainer.getActiveWidget();
if (activeItem instanceof WizardCard) ((WizardCard)activeItem).setup();
}
/**
* Set the card list.
* @param cards
*/
public void setCards(ArrayList<WizardCard> cards)
{
for (WizardCard card:cards) {
addCard(card);
}
}
/**
* Adds a card to this wizard.
* @param card the card to add.
*/
public void addCard(WizardCard card)
{
card.setWizardWindow(this);
cardContainer.add(card);
cardStack.add(card);
}
/**
* Remove a card to this wizard.
* @param card the card to add.
*/
public void removeCard(WizardCard card)
{
cardContainer.remove(card);
cardStack.remove(card);
}
/**
* Enables the next button on the wizard.
* @param enable <code>true</code> to enable the next button, <code>false</code> otherwise.
*/
public void setEnableNextButton(boolean enable)
{
nextButton.setEnabled(enable);
}
/**
* Enables the back button on the wizard.
* @param enable <code>true</code> to enable the back button, <code>false</code> otherwise.
*/
public void setEnableBackButton(boolean enable)
{
backButton.setEnabled(enable);
}
/**
* Sets the next button label.
* @param text the button label.
*/
protected void setNextButtonText(String text)
{
nextButton.setText(text);
}
/**
* Sets the back button label.
* @param text the button label.
*/
protected void setBackButtonText(String text)
{
backButton.setText(text);
}
/**
* Sets visible next button.
* @param visible
*/
protected void setNextButtonVisible(boolean visible)
{
nextButton.setVisible(visible);
}
/**
* Sets visible back button.
* @param visible
*/
protected void setBackButtonVisible(boolean visible)
{
backButton.setVisible(visible);
}
/**
* Add a listener to the next button.
* @param listener the listener to add.
*/
protected void addNextButtonListener(SelectHandler listener)
{
nextButton.addSelectHandler(listener);
}
/**
* @return the originalTitle
*/
public String getOriginalTitle() {
return originalTitle;
}
/**
* Returns the card list.
* @return teh card list.
*/
public ArrayList<WizardCard> getCardStack()
{
return cardStack;
}
public void showErrorAndHide(String title, final String failureReason, final String failureDetails, final Throwable throwable)
{
ErrorMessageBox.showError(title, failureReason, failureDetails, new Callback<Dialog, Void>() {
@Override
public void onSuccess(Dialog result) {
}
@Override
public void onFailure(Void reason) {
hide();
fireFailed(throwable, failureReason, failureDetails);
}
});
}
public void fireCompleted(TRId trId)
{
for (WizardListener listener:listeners) listener.completed(trId);
}
public void fireAborted()
{
for (WizardListener listener:listeners) listener.aborted();
}
public void fireFailed(Throwable throwable, String reason, String details)
{
for (WizardListener listener:listeners) listener.failed(throwable, reason, details);
}
}

View File

@ -0,0 +1,54 @@
package org.gcube.portlets.user.td.open.client.source;
public class FileSource implements Source {
private static final long serialVersionUID = -5990408094142286488L;
public static final FileSource INSTANCE = new FileSource();
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "File";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "File source";
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return "Select this source if you want to retrive document from File";
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("File source [getId()=");
builder.append(getId());
builder.append(", getName()=");
builder.append(getName());
builder.append(", getDescription()=");
builder.append(getDescription());
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,27 @@
package org.gcube.portlets.user.td.open.client.source;
import java.io.Serializable;
public interface Source extends Serializable {
/**
* Returns the document type id.
* @return the document type id.
*/
public String getId();
/**
* Returns the document type name.
* @return the document type name.
*/
public String getName();
/**
* Returns the document type description.
* @return the document type description.
*/
public String getDescription();
}

View File

@ -0,0 +1,68 @@
package org.gcube.portlets.user.td.open.client.source;
public class TDOpenSource implements Source {
private static final long serialVersionUID = 3254879141340681969L;
public static final TDOpenSource INSTANCE = new TDOpenSource();
protected String url;
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "SDMXRegistry";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "SDMX Registry source";
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return "Select this source if you want to retrive document from SDMX Registry";
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SDMXRegistry source [getId()=");
builder.append(getId());
builder.append(", getName()=");
builder.append(getName());
builder.append(", getDescription()=");
builder.append(getDescription());
builder.append(", getUrl()=");
builder.append(getUrl());
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,54 @@
package org.gcube.portlets.user.td.open.client.source;
public class WorkspaceSource implements Source {
private static final long serialVersionUID = 2826706131664617270L;
public static final WorkspaceSource INSTANCE = new WorkspaceSource();
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "Workspace";
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Workspace source";
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return "Select this source if you want to retrive document from Workspace";
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Workspace source [getId()=");
builder.append(getId());
builder.append(", getName()=");
builder.append(getName());
builder.append(", getDescription()=");
builder.append(getDescription());
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,70 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.util;
import com.google.gwt.core.client.Callback;
import com.google.gwt.user.client.ui.Label;
import com.sencha.gxt.widget.core.client.Dialog;
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
import com.sencha.gxt.widget.core.client.box.MessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ErrorMessageBox {
private static final String DETAILS = "Details";
public static void showError(String title, String failureReason, final String failureDetails)
{
showError(title, failureReason, failureDetails, new NOPCallBack<Dialog, Void>());
}
public static void showError(String title, String failureReason, final String failureDetails, final Callback<Dialog, Void> callback)
{
final MessageBox box = new MessageBox(title);
box.setMessage(failureReason);
box.addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent event) {
Dialog dialog = (Dialog) event.getSource();
if (dialog.getHideButton().getText().equals(DETAILS)){
//box.close();
showErrorDetails("Error details", failureDetails);
} else callback.onSuccess(dialog);
}
});
/*FIXME box.setIcon(MessageBox.ERROR);
box.getDialog().cancelText = DETAILS;
box.getDialog().setButtons(MessageBox.OKCANCEL);*/
box.show();
}
public static void showErrorDetails(String title, String failureDetails)
{
final Dialog simple = new Dialog();
simple.setHeadingText(title);
simple.setPredefinedButtons(PredefinedButton.OK);
simple.setBodyStyleName("pad-text");
simple.add(new Label("<PRE>"+failureDetails+"</PRE>"));
//simple.getItem(0).getFocusSupport().setIgnore(true);
//FIXME simple.setScrollMode(ScrollMode.AUTO);
simple.setHideOnButtonClick(true);
simple.setWidth(400);
simple.setHeight(400);
simple.show();
}
}

View File

@ -0,0 +1,35 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.util;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
*/
public class Format {
/**
* Converts a file size into a {@link String} representation adding the misure unit.
* @param size the file size.
* @return the textual representation.
*/
public static String fileSize(long size) {
StringBuilder text = new StringBuilder();
if (size < 1024) {
text.append(size);
text.append(" bytes");
} else if (size < 1048576) {
text.append(Math.round(((size * 10) / 1024)) / 10);
text.append(" KB");
} else if (size < 1073741824) {
text.append(Math.round(((size * 10) / 1048576)) / 10);
text.append(" MB");
} else {
text.append(Math.round(((size * 10) / 1073741824)) / 10);
text.append(" GB");
}
return text.toString();
}
}

View File

@ -0,0 +1,20 @@
/**
*
*/
package org.gcube.portlets.user.td.open.client.util;
import com.google.gwt.core.client.Callback;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class NOPCallBack<T,F> implements Callback<T, F> {
@Override
public void onFailure(F reason) {}
@Override
public void onSuccess(T result) {}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='TDOpen'>
<!-- 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.gxtservice.GXTService' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.open.client.TDOpenEntry' /> -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -0,0 +1,2 @@
sendButton = Send
nameField = Enter your name

View File

@ -0,0 +1,2 @@
sendButton = Envoyer
nameField = Entrez votre nom

View File

@ -0,0 +1,53 @@
@CHARSET "UTF-8";
.wizard-title {
padding: 5px;
font-weight: bold;
font-size: small;
background-color: #C3D9FF;
}
.wizard-footer {
padding: 5px;
font-weight: bold;
font-size: small;
text-align: right;
background-color: #CDEB8B
}
.source-selection-hover:hover {
cursor: pointer;
}
/*.column-excluded {
background-color: #e6e0da !important;
color: #bfa698;
}*/
.importSelection-sources {
padding: 30px;
display: block;
}
.importSelection-source {
padding-bottom: 20px;
}
.sdmxRegistryUrlStyle {
padding-top:5px;
}
.sdmxRegistryUrlInputStyle {
width:300px!important;
}
input#sdmxRegistryUrlInputFieldId-input {
width:300px!important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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;
}

View File

@ -0,0 +1,63 @@
<!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="TDOpen.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="TDOpen/TDOpen.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>
<h1>Web Application Starter Project</h1>
<table align="center">
<tr>
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
</tr>
<tr>
<td id="nameFieldContainer"></td>
<td id="sendButtonContainer"></td>
</tr>
<tr>
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,34 @@
<?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>TDOpenService</servlet-name>
<servlet-class>org.gcube.portlets.user.td.open.server.TDOpenServiceImpl</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>TDOpenService</servlet-name>
<url-pattern>tabulardataportlet/TDOpenService</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>
<url-pattern>TDOpenManagerWidgets/junithost/*</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>TDOpen.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@ -0,0 +1,83 @@
package org.gcube.portlets.user.td.open.client;
import java.util.List;
import org.gcube.portlets.user.td.gxtservice.client.rpc.TDGXTService;
import org.gcube.portlets.user.td.gxtservice.client.rpc.TDGXTServiceAsync;
import org.gcube.portlets.user.td.gxtservice.shared.TabResource;
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
/**
* 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 GwtTestTDOpen extends GWTTestCase {
/**
* Must refer to a valid module that sources this class.
*/
public String getModuleName() {
return "org.gcube.portlets.user.td.open.TDOpenJUnit";
}
/**
* This test will send a request to the server
*/
public void testResource() {
// Create the service that we will test.
TDGXTServiceAsync tdGXTService = GWT.create(TDGXTService.class);
ServiceDefTarget target = (ServiceDefTarget) tdGXTService;
System.out.println(GWT.getModuleBaseURL() + "TDGXTService");
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TDGXTService");
// 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 7 seconds before timing out.
delayTestFinish(7000);
// Send a request to the server.
tdGXTService.getTabularResources(new AsyncCallback<List<TabResource>>() {
@Override
public void onFailure(Throwable caught) {
// The request resulted in an unexpected error.
fail("Request failure: " + caught.getMessage());
}
@Override
public void onSuccess(List<TabResource> result) {
// Shows the first three resources.
int i=0;
for(TabResource tr:result){
i++;
System.out.println(tr.toString());
if(i>3){
break;
}
}
assertTrue(result.size()>0);
// 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();
}
});
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="TDOpenJUnit">
<!-- Inherit our applications main module. -->
<inherits name='org.gcube.portlets.user.td.gxtservice.GXTService' />
<!-- Specify the path to any remote services. -->
<servlet path="/TDGXTService"
class="org.gcube.portlets.user.td.gxtservice.server.TDGXTServiceImpl" />
<!-- Specify the paths for translatable code -->
<source path='client' />
</module>

0
templates/INSTALL Normal file
View File

6
templates/LICENSE Normal file
View File

@ -0,0 +1,6 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

1
templates/MAINTAINERS Normal file
View File

@ -0,0 +1 @@
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"

40
templates/README Normal file
View File

@ -0,0 +1,40 @@
The gCube System - ${name}
------------------------------------------------------------
This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2)
Authors
-------
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
Version and Release Date
------------------------
v. ${version} (${release.date})
Description
-----------
${project.description}
Download information
--------------------
Source code URL: ${scm.url}
Documentation
-------------
${project.description}
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

6
templates/changelog.xml Normal file
View File

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.tabular-data-open.1-0-0"
date="2013-10-18">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

39
templates/descriptor.xml Normal file
View File

@ -0,0 +1,39 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${configDirectory}/profile.xml</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>target/${build.finalName}.${packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

29
templates/profile.xml Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${project.description}</Description>
<Class>PortletsUser</Class>
<Name>${project.name}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Description>${project.description}</Description>
<Name>${project.name}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</MavenCoordinates>
<Type>library</Type>
<Files>
<File>${project.build.finalName}.${project.packaging}</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

1
templates/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}