Giancarlo Panichi 10 years ago committed by Giancarlo Panichi
parent 20978d78b3
commit f78c4b5648

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tabular-data-mainbox-widget</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="MainBox.html"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/tabular-data-mainbox-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.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -startupUrl MainBox.html -logLevel INFO -codeServerPort 9997 -port 8888"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-mainbox-widget"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
</launchConfiguration>

@ -0,0 +1,331 @@
<?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-mainbox-widget</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>tabular-data-mainbox-widget</name>
<description>tabular-data-mainbox-widget implements a tab panel to shows resources and table</description>
<scm>
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-mainbox-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-09-12</release.date>
<wikiurl>https://gcube.wiki.gcube-system.org/gcube/index.php</wikiurl>
<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>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>
<scope>provided</scope>
</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>
<!-- TDX Source -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-widgetx-tdx-source</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- tabular-data-monitor-widget -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-monitor-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- tabular-data-resources-widget -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-resources-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>
<!-- JUnit TEST -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>true</skipTests>
<exclude>**/GwtTest*.java</exclude>
</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>test</goal> -->
<goal>resources</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>MainBox.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<module>org.gcube.portlets.user.td.mainboxwidget.MainBox</module>
<includes>**/GwtTest*.java</includes>
</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>
<packaging>war</packaging>
</project>

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='MainBox'>
<!-- 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.extjs.gxt.ui.GXT" /> -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
<inherits
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<inherits name='org.gcube.portlets.user.td.resourceswidget.ResourcesWidget' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.mainboxwidget.client.MainBoxEntry'
/> -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

@ -0,0 +1,140 @@
package org.gcube.portlets.user.td.mainboxwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.mainboxwidget.client.tdx.TDXPanel;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataView;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.TabularResourceDataView;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel;
import com.sencha.gxt.widget.core.client.event.BeforeCloseEvent;
import com.sencha.gxt.widget.core.client.event.BeforeCloseEvent.BeforeCloseHandler;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class MainBox extends TabPanel {
protected EventBus eventBus;
protected MainBoxPanel mainBoxPanel;
protected ArrayList<TDXPanel> tdxPanelList;
public MainBox(String name, EventBus eventBus, MainBoxPanel mainBoxPanel) {
super();
Log.debug("Create MainBox");
this.eventBus = eventBus;
this.mainBoxPanel = mainBoxPanel;
setId(name);
setBodyBorder(false);
setBorders(false);
setAnimScroll(true);
setTabScroll(true);
setCloseContextMenu(true);
tdxPanelList = new ArrayList<TDXPanel>();
// setResizeTabs(true);
}
public void startTabs() {
Log.debug("Start MainBox Tabs");
}
public void openTDXTab(DataView dataView) {
if (dataView instanceof TabularResourceDataView) {
TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) dataView;
Log.debug("Open TDX Tab");
if (tdxPanelList == null) {
tdxPanelList = new ArrayList<TDXPanel>();
}
addTDXPanel(tabularResourceDataView);
}
}
// Close
public void closePanel() {
Log.debug("Close TDX Tabs");
if (tdxPanelList != null) {
for (TDXPanel tdxPanel : tdxPanelList) {
remove(tdxPanel);
}
tdxPanelList.clear();
}
}
//
public void updateTabs(DataView dataView) {
try {
Log.debug("Update MainBox Tabs");
if (dataView instanceof TabularResourceDataView) {
TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) dataView;
boolean found=false;
for (TDXPanel tdxPanel : tdxPanelList) {
if(tdxPanel.isDataViewRequest(tabularResourceDataView)){
tdxPanel.update(tabularResourceDataView);
found=true;
break;
}
}
if(!found){
addTDXPanel(tabularResourceDataView);
}
}
forceLayout();
} catch (Throwable e) {
Log.error("Error in MainBox: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
protected void addTDXPanel(TabularResourceDataView tabularResourceDataView) {
for (TDXPanel tdxPanel : tdxPanelList) {
if (tdxPanel.getTabularResourceDataView().getTrId().getId()
.compareTo(tabularResourceDataView.getTrId().getId()) == 0) {
tdxPanel.update(tabularResourceDataView);
setActiveWidget(tdxPanel);
return;
}
}
TabItemConfig tdxPanelItemConf = new TabItemConfig(
tabularResourceDataView.getTrId().getId(), true);
final TDXPanel tdxPanel = new TDXPanel(tabularResourceDataView,
eventBus);
tdxPanelList.add(tdxPanel);
add(tdxPanel, tdxPanelItemConf);
addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (tdxPanel == event.getItem()) {
remove(tdxPanel);
tdxPanelList.remove(tdxPanel);
}
}
});
setActiveWidget(tdxPanel);
};
}

@ -0,0 +1,36 @@
package org.gcube.portlets.user.td.mainboxwidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
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.gwt.user.client.ui.RootPanel;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
public class MainBoxEntry implements EntryPoint {
public void onModuleLoad() {
// For example Tabular Resource 7 and table 402
TRId trId = new TRId("220", "3555");
EventBus eventBus = new SimpleEventBus();
try {
MainBoxPanel mainBoxPanel = new MainBoxPanel("MainBoxPanel",
eventBus);
RootPanel.get().add(mainBoxPanel);
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN);
uiStateEvent.setTrId(trId);
eventBus.fireEvent(uiStateEvent);
Log.info("MainBoxPanel Added:" + mainBoxPanel);
} catch (Throwable e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,194 @@
package org.gcube.portlets.user.td.mainboxwidget.client;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.DataViewRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.DataViewRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataView;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.TabularResourceDataView;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.ContentPanel;
public class MainBoxPanel extends ContentPanel {
protected EventBus eventBus;
protected MainBox mainBox;
protected MainBoxPanelState state;
protected UIStateType uiStateType;
protected DataViewRequestType dataViewRequestType;
public MainBoxPanel(String name, EventBus eventBus) {
super();
Log.debug("Open MainBoxPanel");
this.eventBus = eventBus;
setId(name);
setHeaderVisible(false);
setResize(true);
setBodyBorder(false);
setBorders(false);
forceLayoutOnResize = true;
mainBox = new MainBox("MainBox", eventBus, this);
add(mainBox);
startPanel();
bindToEvents();
}
protected void bindToEvents() {
eventBus.addHandler(DataViewRequestEvent.TYPE,
new DataViewRequestEvent.DataViewRequestEventHandler() {
public void onDataViewRequest(DataViewRequestEvent event) {
manageDataViewRequestEvents(event);
}
});
eventBus.addHandler(UIStateEvent.TYPE,
new UIStateEvent.UIStateHandler() {
public void onUIState(UIStateEvent event) {
manageUIStateEvents(event);
}
});
}
protected void manageUIStateEvents(UIStateEvent event) {
Log.debug("MainBox recieved event: "
+ event.getUIStateType().toString());
uiStateType = event.getUIStateType();
TRId trId=null;
switch (event.getUIStateType()) {
case START:
break;
case TR_CLOSE:
// this.enable();
closePanel();
break;
case TR_OPEN:
// this.enable();
trId=event.getTrId();
updateForOpenPanel(new TabularResourceDataView(trId));
break;
case TABLECURATION:
trId=event.getTrId();
updateForCurationPanel(new TabularResourceDataView(trId));
break;
case TABLEUPDATE:
trId=event.getTrId();
updatePanel(new TabularResourceDataView(trId));
break;
case TR_READONLY:
break;
case WIZARD_OPEN:
// this.disable();
break;
default:
break;
}
}
protected void manageDataViewRequestEvents(DataViewRequestEvent event) {
Log.debug("MainBox recieved event: "
+ event.getDataViewRequestType().toString());
dataViewRequestType = event.getDataViewRequestType();
switch (event.getDataViewRequestType()) {
case RESOURCE:
break;
case TABULARRESOURCE:
doTabularResourceTab(event);
break;
default:
break;
}
}
protected void doTabularResourceTab(DataViewRequestEvent event) {
Log.debug("DataViewRequestEvent.TDXPanel : ["
+ event.getDataView() + "]");
if (uiStateType == UIStateType.TR_OPEN
|| uiStateType == UIStateType.TABLECURATION
|| uiStateType == UIStateType.TABLEUPDATE) {
if (state == MainBoxPanelState.OPENED) {
mainBox.openTDXTab(event.getDataView());
Log.debug("MainBoxPanelState.OPENED Add Tabs");
} else {
enable();
expand();
state = MainBoxPanelState.OPENED;
mainBox.openTDXTab(event.getDataView());
}
} else {
Log.debug("MainBoxPanel No tabular resource open");
}
}
public void closePanelOnly() {
collapse();
disable();
state = MainBoxPanelState.CLOSED;
}
public void closePanel() {
mainBox.closePanel();
Log.debug("MainBoxPanel Closed");
}
public void startPanel() {
enable();
expand();
state = MainBoxPanelState.OPENED;
mainBox.startTabs();
}
public void updatePanel(DataView dataView) {
if (state == MainBoxPanelState.OPENED) {
mainBox.updateTabs(dataView);
Log.debug("MainBoxPanel Updated");
}
}
public void updateForOpenPanel(DataView dataView) {
if (state == MainBoxPanelState.OPENED) {
mainBox.updateTabs(dataView);
Log.debug("MainBoxPanel Updated For Table");
} else {
enable();
expand();
state = MainBoxPanelState.OPENED;
mainBox.updateTabs(dataView);
//mainBox.openPropertiesTab();
Log.debug("MainBoxPanel Updated For Table");
}
}
public void updateForCurationPanel(DataView dataView) {
if (state == MainBoxPanelState.OPENED) {
mainBox.updateTabs(dataView);
//mainBox.openValidationsTasksTab(trId);
Log.debug("MainBoxPanel Updated For Curation");
} else {
enable();
expand();
state = MainBoxPanelState.OPENED;
mainBox.updateTabs(dataView);
//mainBox.openValidationsTasksTab(trId);
Log.debug("MainBoxPanel Updated For Curation");
}
}
}

@ -0,0 +1,6 @@
package org.gcube.portlets.user.td.mainboxwidget.client;
public enum MainBoxPanelState {
CLOSED,
OPENED;
}

@ -0,0 +1,104 @@
package org.gcube.portlets.user.td.mainboxwidget.client.tdx;
import org.gcube.portlets.user.td.mainboxwidget.client.utils.Constants;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataView;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.TabularResourceDataView;
import org.gcube.portlets.user.tdwx.client.TabularDataX;
import org.gcube.portlets.user.tdwx.client.TabularDataXGridPanel;
import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler;
import org.gcube.portlets.user.tdwx.shared.model.TableId;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.info.Info;
public class TDXPanel extends FramedPanel {
protected EventBus eventBus;
protected TabularResourceDataView tabularResourceDataView;
protected TabularDataX tabularData;
public TDXPanel(TabularResourceDataView tabularResourceDataView,
EventBus eventBus) {
super();
this.tabularResourceDataView = tabularResourceDataView;
this.eventBus = eventBus;
forceLayoutOnResize = true;
setBodyBorder(false);
setBorders(false);
setHeaderVisible(false);
setWidth(500);
setHeight(500);
addGrid();
}
public void addGrid() {
try {
tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID);
tabularData.addFailureHandler(new FailureEventHandler() {
public void onFailure(FailureEvent event) {
Throwable e=event.getCaught();
Info.display("Error: " + event.getMessage(), e.getLocalizedMessage());
e.printStackTrace();
}
});
// Grid Panel
final TabularDataXGridPanel gridPanel = tabularData.getGridPanel();
gridPanel.setHeaderVisible(false);
/*
* GridHeaderColumnMenu columnHeaderMenu = new
* GridHeaderColumnMenu();
* gridPanel.addGridHeaderContextMenuItems(columnHeaderMenu
* .getMenu(), eventBus);
*
* GridContextMenu gridContextMenu = new GridContextMenu(gridPanel,
* eventBus);
* gridPanel.setGridContextMenu(gridContextMenu.getMenu());
*
* gridPanel.setSelectionModel(SelectionMode.MULTI);
*/
this.add(gridPanel);
TableId tableOpening = new TableId(
Constants.TDX_DATASOURCE_FACTORY_ID,
tabularResourceDataView.getTrId().getTableId());
tabularData.openTable(tableOpening);
} catch (Throwable e) {
e.printStackTrace();
}
}
public void update(TabularResourceDataView tabularResourceDataViewTemp) {
if (isDataViewRequest(tabularResourceDataViewTemp)) {
tabularResourceDataView = tabularResourceDataViewTemp;
TableId tableOpening = new TableId(
Constants.TDX_DATASOURCE_FACTORY_ID,
tabularResourceDataView.getTrId().getTableId());
tabularData.openTable(tableOpening);
forceLayout();
}
}
public TabularResourceDataView getTabularResourceDataView() {
return tabularResourceDataView;
}
public boolean isDataViewRequest(TabularResourceDataView dataViewRequest) {
if (dataViewRequest != null
&& dataViewRequest.getTrId() != null
&& dataViewRequest.getTrId().getId() == tabularResourceDataView
.getTrId().getId()) {
return true;
} else {
return false;
}
}
}

@ -0,0 +1,7 @@
package org.gcube.portlets.user.td.mainboxwidget.client.utils;
public class Constants {
public static final String TDX_DATASOURCE_FACTORY_ID = "TDXDataSourceFactory";
}

@ -0,0 +1,28 @@
package org.gcube.portlets.user.td.mainboxwidget.client.utils;
import com.sencha.gxt.widget.core.client.box.MessageBox;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class InfoMessageBox extends MessageBox {
/**
* Creates a message box with an info icon and the specified title and
* message.
*
* @param title
* the message box title
* @param message
* the message displayed in the message box
*/
public InfoMessageBox(String title, String message) {
super(title, message);
setIcon(ICONS.info());
}
}

@ -0,0 +1,78 @@
package org.gcube.portlets.user.td.mainboxwidget.client.utils;
import com.google.gwt.core.client.Callback;
import com.google.gwt.user.client.Element;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.widget.core.client.Component;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class UtilsGXT3 {
public static void mask(Element element) {
XElement el = element.<XElement> cast();
el.mask("Loading...");
}
public static void umask(Element element) {
element.<XElement> cast().unmask();
}
public static void alert(String title, String message) {
final AlertMessageBox d = new AlertMessageBox(title, message);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
public static void alert(String title, String message,
final Callback<Component, Void> callback) {
final AlertMessageBox d = new AlertMessageBox(title, message);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
Component comp = event.getSource();
callback.onSuccess(comp);
}
});
d.show();
}
public static void info(String title, String message) {
final InfoMessageBox d = new InfoMessageBox(title, message);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
}
public static void info(String title, String message,
final Callback<Component, Void> callback) {
final InfoMessageBox d = new InfoMessageBox(title, message);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
Component comp = event.getSource();
callback.onSuccess(comp);
}
});
d.show();
}
}

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='MainBox'>
<!-- 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.extjs.gxt.ui.GXT" /> -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
<inherits
name='org.gcube.portlets.user.td.widgetcommonevent.WidgetCommonEvent' />
<inherits name="org.gcube.portlets.user.tdwx.TabularDataWidgetX" />
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<inherits name='org.gcube.portlets.user.td.resourceswidget.ResourcesWidget' />
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlets.user.td.mainboxwidget.client.MainBoxEntry'
/>
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

@ -0,0 +1,34 @@
/** Add css rules here for your application. */
/** Example rules used by the template application (remove for your app) */
h1 {
font-size: 2em;
font-weight: bold;
color: #777777;
margin: 40px 0px 70px;
text-align: center;
}
.sendButton {
display: block;
font-size: 16pt;
}
/** Most GWT widgets already have a style name defined */
.gwt-DialogBox {
width: 400px;
}
.dialogVPanel {
margin: 5px;
}
.serverResponseLabelError {
color: red;
}
/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
margin: 15px 6px 6px;
}

@ -0,0 +1,50 @@
<!doctype html>
<!-- The DOCTYPE declaration above will set the -->
<!-- browser's rendering engine into -->
<!-- "Standards Mode". Replacing this declaration -->
<!-- with a "Quirks Mode" doctype may lead to some -->
<!-- differences in layout. -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet" href="MainBox.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="MainBox/MainBox.nocache.js"></script>
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic UI. -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
</body>
</html>

@ -0,0 +1,49 @@
<?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>jUnitHostImpl</servlet-name>
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
</servlet>
<!-- TDWidget -->
<servlet>
<servlet-name>tdwxService</servlet-name>
<servlet-class>org.gcube.portlets.user.tdwx.server.TabularDataXServiceImpl</servlet-class>
</servlet>
<servlet>
<servlet-name>tdwxServlet</servlet-name>
<servlet-class>org.gcube.portlets.user.tdwx.server.TabularDataXServlet</servlet-class>
</servlet>
<!-- Servlets Mapping -->
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>
<url-pattern>TDMainBoxManagerWidgets/junithost/*</url-pattern>
</servlet-mapping>
<!-- TDWidget -->
<servlet-mapping>
<servlet-name>tdwxService</servlet-name>
<url-pattern>/MainBox/tdwx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>tdwxServlet</servlet-name>
<url-pattern>/MainBox/tdwxdata</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>MainBox.html</welcome-file>
</welcome-file-list>
</web-app>

@ -0,0 +1,60 @@
package org.gcube.portlets.user.td.mainboxwidget.client;
import com.google.gwt.junit.client.GWTTestCase;
/**
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
* surefire during the test phase.
*
* If you run the tests using the Maven command line, you will have to
* navigate with your browser to a specific url given by Maven.
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
* for details.
*/
public class GwtTestMainBox extends GWTTestCase {
/**
* Must refer to a valid module that sources this class.
*/
public String getModuleName() {
return "org.gcube.portlets.user.td.mainboxwidget.MainBoxJUnit";
}
/**
* This test will send a request to the server
*/
public void testToolBox() {
// Create the service that we will test.
/*TDGWTServiceAsync tdGWTService = TDGWTServiceAsync.INSTANCE;
ServiceDefTarget target = (ServiceDefTarget) tdGWTService;
System.out.println(GWT.getModuleBaseURL() + "TDGWTService");
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TDGWTService");
// Send a request to the server.
/*tdGWTService.getTabResourceInformation(new AsyncCallback<TabResource>(){
@Override
public void onFailure(Throwable caught) {
fail("Request failure: " + caught.getMessage());
}
@Override
public void onSuccess(TabResource result) {
assertTrue(result!=null);
System.out.println(result);
finishTest();
}
});*/
delayTestFinish(1000);
finishTest();
}
}

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="MainBoxJUnit">
<!-- 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' />
<source path='share' />
</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,48 @@
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 is available from SVN:
${scm.url}
Binaries can be downloaded from:
http://software.d4science.research-infrastructures.eu/
Documentation
-------------
${project.description}
Documentation is available on-line from the Projects Documentation Wiki:
${wikiurl}
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="Next">
<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>${version}</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}
Loading…
Cancel
Save