Initial import.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget@98644 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="UnionWizardTD.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/tabular-data-unionwizard-widget"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-unionwizard-widget"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
|
||||
</launchConfiguration>
|
|
@ -0,0 +1,300 @@
|
|||
<?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-unionwizard-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<name>tabular-data-unionwizard-widget</name>
|
||||
<description>tabular-data-unionwizard-widget allows the union of tabular resources</description>
|
||||
|
||||
<scm>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-unionwizard-widget</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>2014-07-04</release.date>
|
||||
<templatesDirectory>templates</templatesDirectory>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<configDirectory>config</configDirectory>
|
||||
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.5.1</gwtVersion>
|
||||
|
||||
<KEYS>${env.KEYS}</KEYS>
|
||||
<!-- 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>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
<!-- tabular-data-gwt-service -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-gwt-service</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- tabular-data-widget-common-event -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-widget-common-event</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tabular-data-wizard-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-wizard-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- LOGGING -->
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</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>UnionWizardTD.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
<module>org.gcube.portlets.user.td.unionwizardwidget.UnionWizardTD</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>
|
|
@ -0,0 +1,102 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.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;
|
||||
|
||||
public class ColumnMappingCard extends WizardCard {
|
||||
protected UnionSession unionSession;
|
||||
protected ColumnMappingCard thisCard;
|
||||
protected ColumnMappingPanel columnMappingPanel;
|
||||
|
||||
public ColumnMappingCard(final UnionSession unionSession) {
|
||||
super("Column Mapping", "");
|
||||
Log.debug("ColumnMappingCard");
|
||||
this.unionSession = unionSession;
|
||||
thisCard = this;
|
||||
|
||||
columnMappingPanel = new ColumnMappingPanel(thisCard,res);
|
||||
|
||||
columnMappingPanel
|
||||
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
||||
|
||||
public void onSelection(SelectionEvent<TabResource> event) {
|
||||
/*codelistMappingSession.setConnectedTR(tabResourcesSelectionPanel
|
||||
.getSelectedItem());
|
||||
getWizardWindow().setEnableNextButton(true);*/
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
setContent(columnMappingPanel);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("ColumnMappingCard Call Setup ");
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
Log.debug("ColumnMappingCard Call sayNextCard");
|
||||
setMapping();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.debug("Remove ColumnMappingCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void setMapping() {
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void goNext() {
|
||||
try {
|
||||
Log.info("NextCard ColumnSelectionCard");
|
||||
UnionOperationInProgressCard progressCard = new UnionOperationInProgressCard(
|
||||
unionSession);
|
||||
getWizardWindow().addCard(
|
||||
progressCard);
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Throwable e) {
|
||||
Log.error("goNext: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,371 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
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.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||
|
||||
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.SelectionEvent;
|
||||
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.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
|
||||
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.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
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.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
public class ColumnMappingPanel 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(), 90, "Name");
|
||||
protected static final ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.tabularResourceType(), 30, "Type");
|
||||
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.agency(), 60, "Agency");
|
||||
protected static final ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.ownerLogin(), 70, "Owner");
|
||||
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.date(), 40, "Date");
|
||||
|
||||
protected Grid<TabResource> grid;
|
||||
protected ResourceBundle res;
|
||||
protected Menu contextMenu;
|
||||
|
||||
private TabResource removableTR;
|
||||
|
||||
private WizardCard parent;
|
||||
|
||||
public ColumnMappingPanel(WizardCard parent, ResourceBundle res) {
|
||||
this.res = res;
|
||||
this.parent = parent;
|
||||
Log.debug("TabResourcesSelectionPanel");
|
||||
init();
|
||||
try {
|
||||
createContextMenu();
|
||||
} catch (Throwable e) {
|
||||
Log.debug("Error In CreateContextMenu:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
buildPanel(properties.id(),
|
||||
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
|
||||
typeColumn, ownerColumn, agencyColumn, dateColumn),
|
||||
nameColumn);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.debug("Error building panel:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
setHeaderVisible(false);
|
||||
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||
store.applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
store.addFilter(new StoreFilter<TabResource>() {
|
||||
|
||||
public boolean select(Store<TabResource> store, TabResource parent,
|
||||
TabResource item) {
|
||||
String searchTerm = searchField.getCurrentValue();
|
||||
if (searchTerm == null)
|
||||
return true;
|
||||
return ColumnMappingPanel.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() {
|
||||
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() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
btnReload.addSelectHandler(sh);
|
||||
|
||||
if (contextMenu != null) {
|
||||
grid.setContextMenu(contextMenu);
|
||||
} else
|
||||
grid.setContextMenu(null);
|
||||
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||
con.add(grid, new VerticalLayoutData(1, 1));
|
||||
setWidget(con);
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
contextMenu = new Menu();
|
||||
MenuItem deleteTRItem = new MenuItem("Delete");
|
||||
deleteTRItem.setId("DeleteTR");
|
||||
deleteTRItem.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.dataresource.ResourceBundle.INSTANCE.delete());
|
||||
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
if (grid != null) {
|
||||
TabResource tabResource = getSelectedItem();
|
||||
deleteTR(tabResource);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
contextMenu.add(deleteTRItem);
|
||||
|
||||
}
|
||||
|
||||
protected boolean select(TabResource item, String searchTerm) {
|
||||
if (item.getName() != null
|
||||
&& item.getName().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getTabularResourceType() != null
|
||||
&& item.getTabularResourceType().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;
|
||||
if (item.getOwnerLogin() != null
|
||||
&& item.getOwnerLogin().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<TabResource>> callback) {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
parent.getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug("Error retrieving tabular resource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
|
||||
AlertMessageBox d = new AlertMessageBox("Error!",
|
||||
"Error retrieving tabular resources on server!");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
//
|
||||
}
|
||||
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<TabResource> result) {
|
||||
Log.debug("loaded " + result.size()
|
||||
+ " TabularResources");
|
||||
callback.onSuccess(new ListLoadResultBean<TabResource>(
|
||||
result));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void gridReload() {
|
||||
grid.getLoader().load();
|
||||
}
|
||||
|
||||
protected void deleteTR(TabResource tabResource) {
|
||||
removableTR = tabResource;
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this tabular resource?");
|
||||
mb.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
||||
.name())) {
|
||||
callDeleteTabularResource();
|
||||
} else if (mb.getHideButton() == mb
|
||||
.getButtonById(PredefinedButton.NO.name())) {
|
||||
// perform NO action
|
||||
}
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
}
|
||||
|
||||
protected void callDeleteTabularResource() {
|
||||
Log.debug("Delete TR:" + removableTR);
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(removableTR.getTrId(),
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
gridReload();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.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 "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface TabResourcesProperties extends PropertyAccess<TabResource> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<TabResource> id();
|
||||
|
||||
ValueProvider<TabResource, String> name();
|
||||
ValueProvider<TabResource, String> agency();
|
||||
ValueProvider<TabResource, String> date();
|
||||
ValueProvider<TabResource, String> tabularResourceType();
|
||||
ValueProvider<TabResource, String> ownerLogin();
|
||||
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.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.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
public class TabResourcesSelectionCard extends WizardCard {
|
||||
protected UnionSession unionSession;
|
||||
protected TabResourcesSelectionCard thisCard;
|
||||
protected TabResourcesSelectionPanel tabResourcesSelectionPanel;
|
||||
protected TabResource selectedTabResource = null;
|
||||
|
||||
public TabResourcesSelectionCard(final UnionSession unionSession) {
|
||||
super("Select Tabular Resource for Union", "");
|
||||
Log.debug("TabResourcesSelectionCard");
|
||||
this.unionSession = unionSession;
|
||||
thisCard = this;
|
||||
|
||||
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
|
||||
|
||||
tabResourcesSelectionPanel
|
||||
.addSelectionHandler(new SelectionHandler<TabResource>() {
|
||||
|
||||
public void onSelection(SelectionEvent<TabResource> event) {
|
||||
unionSession.setUnionTabularResource(tabResourcesSelectionPanel
|
||||
.getSelectedItem());
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
setContent(tabResourcesSelectionPanel);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("TabResourcesSelectionCard Call Setup ");
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
Log.debug("TabResourcesSelectionCard Call sayNextCard");
|
||||
retrieveLastTable();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.debug("Remove TabResourcesSelectionCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void retrieveLastTable() {
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.getLastTable(unionSession
|
||||
.getUnionTabularResource().getTrId(),
|
||||
new AsyncCallback<TableData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.debug("Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
AlertMessageBox d = new AlertMessageBox("Attention",
|
||||
"This tabular resource does not have a valid table");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
deleteTRWithLastTableNull();
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TableData result) {
|
||||
Log.debug("Retrieve last table: " + result);
|
||||
updateConnectedTRInfo(result);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void deleteTRWithLastTableNull() {
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this tabular resource without table?");
|
||||
mb.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
||||
.name())) {
|
||||
callDeleteLastTable();
|
||||
|
||||
} else if (mb.getHideButton() == mb
|
||||
.getButtonById(PredefinedButton.NO.name())) {
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
}
|
||||
|
||||
protected void callDeleteLastTable(){
|
||||
Log.debug("Delete TR:" + unionSession.getUnionTabularResource()
|
||||
.getTrId());
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(unionSession.getUnionTabularResource()
|
||||
.getTrId(),
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
tabResourcesSelectionPanel.gridReload();
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void updateConnectedTRInfo(TableData table) {
|
||||
TabResource tabResource = unionSession.getUnionTabularResource();
|
||||
tabResource.setTrId(table.getTrId());
|
||||
unionSession.setUnionTabularResource(tabResource);
|
||||
Log.debug("UnionSession: " + unionSession);
|
||||
goNext();
|
||||
}
|
||||
|
||||
protected void goNext() {
|
||||
try {
|
||||
Log.info("NextCard ColumnMappingCard");
|
||||
ColumnMappingCard columnSelectionCard = new ColumnMappingCard(
|
||||
unionSession);
|
||||
getWizardWindow().addCard(
|
||||
columnSelectionCard);
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Throwable e) {
|
||||
Log.error("goNext: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,371 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
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.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||
|
||||
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.SelectionEvent;
|
||||
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.Dialog.PredefinedButton;
|
||||
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox;
|
||||
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.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
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.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
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(), 90, "Name");
|
||||
protected static final ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.tabularResourceType(), 30, "Type");
|
||||
protected static final ColumnConfig<TabResource, String> agencyColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.agency(), 60, "Agency");
|
||||
protected static final ColumnConfig<TabResource, String> ownerColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.ownerLogin(), 70, "Owner");
|
||||
protected static final ColumnConfig<TabResource, String> dateColumn = new ColumnConfig<TabResource, String>(
|
||||
properties.date(), 40, "Date");
|
||||
|
||||
protected Grid<TabResource> grid;
|
||||
protected ResourceBundle res;
|
||||
protected Menu contextMenu;
|
||||
|
||||
private TabResource removableTR;
|
||||
|
||||
private WizardCard parent;
|
||||
|
||||
public TabResourcesSelectionPanel(WizardCard parent, ResourceBundle res) {
|
||||
this.res = res;
|
||||
this.parent = parent;
|
||||
Log.debug("TabResourcesSelectionPanel");
|
||||
init();
|
||||
try {
|
||||
createContextMenu();
|
||||
} catch (Throwable e) {
|
||||
Log.debug("Error In CreateContextMenu:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
buildPanel(properties.id(),
|
||||
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
|
||||
typeColumn, ownerColumn, agencyColumn, dateColumn),
|
||||
nameColumn);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.debug("Error building panel:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
setHeaderVisible(false);
|
||||
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||
store.applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
store.addFilter(new StoreFilter<TabResource>() {
|
||||
|
||||
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() {
|
||||
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() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
btnReload.addSelectHandler(sh);
|
||||
|
||||
if (contextMenu != null) {
|
||||
grid.setContextMenu(contextMenu);
|
||||
} else
|
||||
grid.setContextMenu(null);
|
||||
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||
con.add(grid, new VerticalLayoutData(1, 1));
|
||||
setWidget(con);
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
contextMenu = new Menu();
|
||||
MenuItem deleteTRItem = new MenuItem("Delete");
|
||||
deleteTRItem.setId("DeleteTR");
|
||||
deleteTRItem.setIcon(org.gcube.portlets.user.td.unionwizardwidget.client.dataresource.ResourceBundle.INSTANCE.delete());
|
||||
deleteTRItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
if (grid != null) {
|
||||
TabResource tabResource = getSelectedItem();
|
||||
deleteTR(tabResource);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
contextMenu.add(deleteTRItem);
|
||||
|
||||
}
|
||||
|
||||
protected boolean select(TabResource item, String searchTerm) {
|
||||
if (item.getName() != null
|
||||
&& item.getName().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getTabularResourceType() != null
|
||||
&& item.getTabularResourceType().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;
|
||||
if (item.getOwnerLogin() != null
|
||||
&& item.getOwnerLogin().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<TabResource>> callback) {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
parent.getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.debug("Error retrieving tabular resource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
|
||||
AlertMessageBox d = new AlertMessageBox("Error!",
|
||||
"Error retrieving tabular resources on server!");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
//
|
||||
}
|
||||
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<TabResource> result) {
|
||||
Log.debug("loaded " + result.size()
|
||||
+ " TabularResources");
|
||||
callback.onSuccess(new ListLoadResultBean<TabResource>(
|
||||
result));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void gridReload() {
|
||||
grid.getLoader().load();
|
||||
}
|
||||
|
||||
protected void deleteTR(TabResource tabResource) {
|
||||
removableTR = tabResource;
|
||||
final ConfirmMessageBox mb = new ConfirmMessageBox("Delete",
|
||||
"Would you like to delete this tabular resource?");
|
||||
mb.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
if (mb.getHideButton() == mb.getButtonById(PredefinedButton.YES
|
||||
.name())) {
|
||||
callDeleteTabularResource();
|
||||
} else if (mb.getHideButton() == mb
|
||||
.getButtonById(PredefinedButton.NO.name())) {
|
||||
// perform NO action
|
||||
}
|
||||
}
|
||||
});
|
||||
mb.setWidth(300);
|
||||
mb.show();
|
||||
|
||||
}
|
||||
|
||||
protected void callDeleteTabularResource() {
|
||||
Log.debug("Delete TR:" + removableTR);
|
||||
TDGWTServiceAsync.INSTANCE.removeTabularResource(removableTR.getTrId(),
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
AlertMessageBox d = new AlertMessageBox("Error",
|
||||
"Error on delete TabResource: "
|
||||
+ caught.getLocalizedMessage());
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
gridReload();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
|
||||
import org.gcube.portlets.user.td.unionwizardwidget.client.progress.UnionProgressBarUpdater;
|
||||
import org.gcube.portlets.user.td.unionwizardwidget.client.progress.UnionProgressListener;
|
||||
import org.gcube.portlets.user.td.unionwizardwidget.client.progress.UnionProgressUpdater;
|
||||
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.wizardwidget.client.WizardCard;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
|
||||
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 UnionOperationInProgressCard extends WizardCard implements
|
||||
UnionProgressListener {
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected UnionOperationInProgressCard thisCard;
|
||||
protected UnionSession unionSession;
|
||||
protected UnionProgressUpdater progressUpdater;
|
||||
|
||||
public UnionOperationInProgressCard(final UnionSession unionSession) {
|
||||
super("Operation In Progress", "");
|
||||
|
||||
this.unionSession = unionSession;
|
||||
thisCard = this;
|
||||
|
||||
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
||||
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
||||
|
||||
final FlexTable description = new FlexTable();
|
||||
description.setCellSpacing(10);
|
||||
description.setCellPadding(4);
|
||||
description.setBorderWidth(0);
|
||||
|
||||
description.setHTML(0, 0,
|
||||
"<span style=\"font-weight:bold;\";>Union with: </span>");
|
||||
description.setText(0, 1, unionSession.getUnionTabularResource().getName());
|
||||
description.setHTML(1, 0,
|
||||
"<span style=\"font-weight:bold;\";>Type: </span>");
|
||||
description.setText(1, 1, unionSession.getUnionTabularResource().getTabularResourceType());
|
||||
|
||||
description.setHTML(2, 0,
|
||||
"<span style=\"font-weight:bold;\";>Owner: </span>");
|
||||
description.setText(2, 1, unionSession.getUnionTabularResource().getOwnerLogin());
|
||||
|
||||
FramedPanel summary = new FramedPanel();
|
||||
summary.setHeadingText("Union Summary");
|
||||
summary.setWidth(400);
|
||||
summary.add(description);
|
||||
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
||||
5, 10, 5)));
|
||||
|
||||
ProgressBar progressBar = new ProgressBar();
|
||||
operationInProgressPanel.add(progressBar, new BoxLayoutData(
|
||||
new Margins(10, 5, 10, 5)));
|
||||
|
||||
progressUpdater = new UnionProgressUpdater();
|
||||
progressUpdater
|
||||
.addListener(new UnionProgressBarUpdater(progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
|
||||
setContent(operationInProgressPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void importCodelistMapping() {
|
||||
/*TDGWTServiceAsync.INSTANCE.startUnion(unionSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
showErrorAndHide(
|
||||
"Error in import codelist mapping",
|
||||
"An error occured in import codelist mapping: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.getStackTrace().toString(), caught);
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
setBackButtonVisible(false);
|
||||
setNextButtonVisible(false);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setNextButtonToFinish();
|
||||
importCodelistMapping();
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
|
||||
}
|
||||
|
||||
public void operationUpdate(float elaborated) {
|
||||
|
||||
}
|
||||
|
||||
public void operationComplete(final TRId trId) {
|
||||
|
||||
Command sayComplete = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().close(false);
|
||||
Log.info("fire Complete: "+ trId);
|
||||
|
||||
getWizardWindow().fireCompleted(trId);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("fire Complete :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayComplete);
|
||||
|
||||
setNextButtonVisible(true);
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
}
|
||||
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
AlertMessageBox d = new AlertMessageBox("Error in Codelist Mapping Import",
|
||||
reason);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(final TRId trId, String reason, String details) {
|
||||
|
||||
Command sayComplete = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().close(false);
|
||||
Log.info("fire Complete: tabular resource " + trId.getId());
|
||||
Log.info("fire Complete: tableId " + trId.getTableId());
|
||||
|
||||
getWizardWindow().fireCompleted(trId);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("fire Complete :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayComplete);
|
||||
|
||||
setNextButtonVisible(true);
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.union.UnionSession;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class UnionWizardTD extends WizardWindow {
|
||||
protected static final int WITHWIZARD=720;
|
||||
protected static final int HEIGHTWIZARD=520;
|
||||
|
||||
protected UnionSession unionSession;
|
||||
|
||||
/**
|
||||
* The id of the {@link CSVTarget} to use.
|
||||
* @param targetId
|
||||
*/
|
||||
|
||||
public UnionWizardTD(TRId trId, String title, EventBus eventBus) {
|
||||
super(title,eventBus);
|
||||
Log.debug("UnionWizardTD: "+trId);
|
||||
setWidth(WITHWIZARD);
|
||||
setHeight(HEIGHTWIZARD);
|
||||
|
||||
unionSession= new UnionSession();
|
||||
unionSession.setTrId(trId);
|
||||
|
||||
TabResourcesSelectionCard tabResourcesSelection= new TabResourcesSelectionCard(unionSession);
|
||||
addCard(tabResourcesSelection);
|
||||
tabResourcesSelection.setup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.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;
|
||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class UnionWizardTDEntry implements EntryPoint {
|
||||
|
||||
public void onModuleLoad() {
|
||||
TRId trId=new TRId();
|
||||
SimpleEventBus eventBus=new SimpleEventBus();
|
||||
UnionWizardTD unionWizard= new UnionWizardTD(trId, "Union",eventBus);
|
||||
Log.info(unionWizard.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client.dataresource;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
|
||||
public interface ResourceBundle extends ClientBundle {
|
||||
|
||||
public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class);
|
||||
|
||||
@Source("resources/UnionWizardTD.css")
|
||||
UnionCSS unionCss();
|
||||
|
||||
@Source("resources/arrow-refresh.png")
|
||||
ImageResource refresh();
|
||||
|
||||
@Source("resources/arrow-refresh_16.png")
|
||||
ImageResource refresh_16();
|
||||
|
||||
@Source("resources/arrow-refresh_32.png")
|
||||
ImageResource refresh32();
|
||||
|
||||
@Source("resources/accept.png")
|
||||
ImageResource csvCheckSuccess();
|
||||
|
||||
@Source("resources/error.png")
|
||||
ImageResource csvCheckFailure();
|
||||
|
||||
@Source("resources/loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
@Source("resources/information.png")
|
||||
ImageResource information();
|
||||
|
||||
@Source("resources/delete.png")
|
||||
ImageResource delete();
|
||||
|
||||
@Source("resources/delete_32.png")
|
||||
ImageResource delete32();
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.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 UnionCSS 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();
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client.grid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
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.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
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.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
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;
|
||||
|
||||
public class ColumnDataGridPanel extends ContentPanel implements
|
||||
HasSelectionHandlers<ColumnData> {
|
||||
protected static final int GRIDHEIGHT = 360;
|
||||
|
||||
protected static final ColumnDataProperties props = GWT
|
||||
.create(ColumnDataProperties.class);
|
||||
|
||||
protected final CheckBoxSelectionModel<ColumnData> sm;
|
||||
|
||||
protected final Grid<ColumnData> grid;
|
||||
protected TRId trId;
|
||||
|
||||
public ColumnDataGridPanel(TRId trId) {
|
||||
Log.debug("ColumnDataGridPanel");
|
||||
if(trId==null){
|
||||
Log.error("ColumnDataGridPanel: TRId is null");
|
||||
}
|
||||
Log.debug("ColumnDataGridPanel: "+trId.toString());
|
||||
this.trId=trId;
|
||||
setHeaderVisible(false);
|
||||
//setHeadingText("Columns");
|
||||
|
||||
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
||||
props.label(), 120,"Column");
|
||||
|
||||
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
||||
|
||||
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
||||
|
||||
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
||||
|
||||
l.add(labelCol);
|
||||
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
||||
|
||||
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||
|
||||
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) {
|
||||
});
|
||||
|
||||
grid = new Grid<ColumnData>(store, cm) {
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight(GRIDHEIGHT);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.setScrollMode(ScrollMode.AUTO);
|
||||
con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
setWidget(con);
|
||||
|
||||
}
|
||||
|
||||
public Grid<ColumnData> getGrid() {
|
||||
return grid;
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getColumns(trId, new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("No load columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<ColumnData> result) {
|
||||
Log.trace("loaded " + result.size() + " columns");
|
||||
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
||||
result));
|
||||
sm.selectAll();
|
||||
forceLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ColumnData getSelectedItem() {
|
||||
return grid.getSelectionModel().getSelectedItem();
|
||||
|
||||
}
|
||||
|
||||
public HandlerRegistration addSelectionHandler(
|
||||
SelectionHandler<ColumnData> handler) {
|
||||
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client.grid;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
|
||||
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;
|
||||
|
||||
public interface ColumnDataProperties extends PropertyAccess<ColumnData> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<ColumnData> id();
|
||||
|
||||
ValueProvider<ColumnData, String> label();
|
||||
|
||||
// ValueProvider<ColumnData, String> typeName();
|
||||
|
||||
// ValueProvider<ColumnData, String> typeCode();
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client.progress;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
|
||||
/**
|
||||
* Updates a {@link ProgressBar} progress and text based on {@link UnionProgressListener} events.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class UnionProgressBarUpdater implements UnionProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public UnionProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
Log.info("Import completed");
|
||||
progressBar.updateProgress(1, "Import completed.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("Import failed");
|
||||
progressBar.updateText("Import failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
Log.info("Inport Inizializing");
|
||||
progressBar.updateProgress(0, "Initializing...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
Log.trace("progress "+elaborated);
|
||||
int elab=new Float(elaborated*100).intValue();
|
||||
progressBar.updateProgress(elaborated,elab+"% Importing...");
|
||||
}
|
||||
if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
Log.info("Validation Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Start Validation...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
Log.trace("Validation progress "+elaborated);
|
||||
int elab=new Float(elaborated*100).intValue();
|
||||
progressBar.updateProgress(elaborated,elab+"% Validation Progress...");
|
||||
}
|
||||
if (elaborated == 1) progressBar.updateProgress(1, "Validation...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId,String reason, String details) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Validations failed");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
Log.info("Generating View...");
|
||||
progressBar.updateText("Generating View...");
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines a listener for operation progress.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface UnionProgressListener {
|
||||
|
||||
/**
|
||||
* Called when the operation is starting.
|
||||
*/
|
||||
public void operationInitializing();
|
||||
|
||||
/**
|
||||
* Called when there is a progress for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationUpdate(float elaborated);
|
||||
|
||||
/**
|
||||
* Called when there is a validate for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationValidate(float elaborated);
|
||||
|
||||
|
||||
/**
|
||||
* Called when the operation is complete.
|
||||
*/
|
||||
public void operationComplete(TRId trId);
|
||||
|
||||
/**
|
||||
* Called when the operation is failed.
|
||||
* @param caught the failure exception.
|
||||
* @param reason the failure reason.
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void operationStopped(TRId trId, String reason, String details);
|
||||
|
||||
/**
|
||||
* Called when the operation is generating the view
|
||||
*/
|
||||
public void operationGeneratingView();
|
||||
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client.progress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingMonitor;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* This {@link Timer} retrieves {@link OperationProgress} from the specified
|
||||
* {@link OperationProgressSource} with the scheduled interval. The retrieved
|
||||
* information are spread to the subscribed {@link UnionProgressListener}.
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class UnionProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<UnionProgressListener> listeners = new ArrayList<UnionProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getCodelistMappingMonitor(new AsyncCallback<CodelistMappingMonitor>() {
|
||||
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
cancel();
|
||||
Log.error("Error retrieving the operation state",
|
||||
caught);
|
||||
String message = getStack(caught);
|
||||
fireOperationFailed(caught,
|
||||
"Failed getting operation updates", message);
|
||||
}
|
||||
|
||||
public void onSuccess(CodelistMappingMonitor result) {
|
||||
Log.info("retrieved CSVImportMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("CSV Import Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("CSV Import Operation Aborted");
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
fireOperationUpdate(result.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
fireOperationValidate(result.getProgress());
|
||||
break;
|
||||
case GENERATING_VIEW:
|
||||
Log.info("Generating View...");
|
||||
fireOperationGeneratingView();
|
||||
break;
|
||||
case STOPPED:
|
||||
cancel();
|
||||
stopMessage(result);
|
||||
break;
|
||||
case FAILED:
|
||||
cancel();
|
||||
errorMessage(result);
|
||||
break;
|
||||
case SUCCEDED:
|
||||
cancel();
|
||||
Log.info("Import fisnish:"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(CodelistMappingMonitor result) {
|
||||
Log.info("Codelist Mapping Import Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Codelist Mapping Import";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Codelist Mapping Import";
|
||||
details = "Error in codelist mapping import";
|
||||
}
|
||||
fireOperationFailed(th, failure, details);
|
||||
|
||||
}
|
||||
|
||||
protected void stopMessage(CodelistMappingMonitor result) {
|
||||
Log.info("Codelist Mapping Import Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped codelist mapping import";
|
||||
}
|
||||
|
||||
fireOperationStopped(result.getTrId(),failure, details);
|
||||
}
|
||||
|
||||
protected String getStack(Throwable e) {
|
||||
String message = e.getLocalizedMessage() + " -> <br>";
|
||||
Throwable c = e.getCause();
|
||||
if (c != null)
|
||||
message += getStack(c);
|
||||
return message;
|
||||
}
|
||||
|
||||
protected void fireOperationInitializing() {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (UnionProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link UnionProgressListener} to this
|
||||
* {@link UnionProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(UnionProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link UnionProgressListener} from this
|
||||
* {@link UnionProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(UnionProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.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 "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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() {
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
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.setHideOnButtonClick(true);
|
||||
simple.setWidth(400);
|
||||
simple.setHeight(400);
|
||||
simple.show();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client.util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.unionwizardwidget.client.util;
|
||||
|
||||
import com.google.gwt.core.client.Callback;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @param <T>
|
||||
* @param <F>
|
||||
*/
|
||||
public class NOPCallBack<T,F> implements Callback<T, F> {
|
||||
|
||||
public void onFailure(F reason) {}
|
||||
|
||||
public void onSuccess(T result) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='UnionWizardTD'>
|
||||
<!-- 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' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry' /> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<!-- <source path='org.gcube.data.analysis.tabulardata.operation.worker'/> -->
|
||||
|
||||
</module>
|
|
@ -0,0 +1,2 @@
|
|||
sendButton = Send
|
||||
nameField = Enter your name
|
|
@ -0,0 +1,2 @@
|
|||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
|
@ -0,0 +1,54 @@
|
|||
@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;
|
||||
margin-top: 20px;
|
||||
|
||||
}
|
||||
|
||||
.importSelection-source {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sdmxRegistryUrlStyle {
|
||||
padding-top:5px;
|
||||
}
|
||||
|
||||
.sdmxRegistryUrlInputStyle {
|
||||
width:300px!important;
|
||||
}
|
||||
|
||||
|
||||
input#sdmxRegistryUrlInputFieldId-input {
|
||||
width:300px!important;
|
||||
}
|
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 984 B |
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 962 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 778 B |
After Width: | Height: | Size: 771 B |
|
@ -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,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="UnionWizardTD.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="UnionWizardTD/UnionWizardTD.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>
|
|
@ -0,0 +1,40 @@
|
|||
<?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>tdgwtservice/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>UnionWizardWidgets/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>UnionWizardTD.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
|
@ -0,0 +1,82 @@
|
|||
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.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 GwtTestUnionWizardTD extends GWTTestCase {
|
||||
|
||||
/**
|
||||
* Must refer to a valid module that sources this class.
|
||||
*/
|
||||
public String getModuleName() {
|
||||
return "org.gcube.portlets.user.unionwizardwidget.UnionWizardTDJUnit";
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will send a request to the server
|
||||
*/
|
||||
public void testResource() {
|
||||
// Create the service that we will test.
|
||||
TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class);
|
||||
ServiceDefTarget target = (ServiceDefTarget) tdGWTService;
|
||||
System.out.println(GWT.getModuleBaseURL() + "TDGWTService");
|
||||
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TDGWTService");
|
||||
|
||||
// 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.
|
||||
tdGWTService.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
|
||||
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
// The request resulted in an unexpected error.
|
||||
fail("Request failure: " + caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<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();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="UnionWizardTDJUnit">
|
||||
<!-- 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>
|
|
@ -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.
|
|
@ -0,0 +1 @@
|
|||
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
|
@ -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.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="${groupId}.${artifactId}.1-0-0"
|
||||
date="2014-06-05">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -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>
|
|
@ -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>
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
${scm.url}
|