428: TDM - Support the new Workspace Explorer
Task-Url: https://support.d4science.org/issues/428 Updated support to workspace explorer git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-json-export-widget@117642 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0a0fd5ca97
commit
0eb972042b
6
pom.xml
6
pom.xml
|
@ -131,10 +131,10 @@
|
|||
</dependency>
|
||||
|
||||
<!-- WSLT dependencies -->
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-light-tree</artifactId>
|
||||
<version>[2.13.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<artifactId>workspace-explorer</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -4,6 +4,7 @@ package org.gcube.portlets.user.td.jsonexportwidget.client;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
||||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
|
||||
|
@ -17,7 +18,9 @@ import com.google.web.bindery.event.shared.EventBus;
|
|||
public class JSONExportWidgetTD extends WizardWindow {
|
||||
|
||||
protected JSONExportSession exportSession;
|
||||
|
||||
protected String WIZARDWIDTH = "844px";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -27,6 +30,8 @@ public class JSONExportWidgetTD extends WizardWindow {
|
|||
*/
|
||||
public JSONExportWidgetTD(String title, EventBus eventBus) {
|
||||
super(title,eventBus);
|
||||
setWidth(WIZARDWIDTH);
|
||||
|
||||
|
||||
exportSession= new JSONExportSession();
|
||||
|
||||
|
|
|
@ -7,12 +7,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
|
||||
import org.gcube.portlets.user.td.jsonexportwidget.client.workspace.WorkspacePanel;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.widgets.lighttree.client.Item;
|
||||
import org.gcube.portlets.widgets.lighttree.client.ItemType;
|
||||
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionEvent;
|
||||
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.Command;
|
||||
|
@ -39,9 +38,8 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
protected TextField fileName;
|
||||
protected TextField fileDescription;
|
||||
|
||||
protected Item item;
|
||||
protected VerticalLayoutContainer p;
|
||||
protected WorkspacePanel wpanel;
|
||||
protected WorkspaceExplorerSelectPanel wpanel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -60,19 +58,18 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
String fileN = "Name";
|
||||
if (exportSession.getTabResource() != null
|
||||
&& exportSession.getTabResource().getName() != null &&
|
||||
!exportSession.getTabResource().getName().isEmpty()) {
|
||||
fileN=exportSession.getTabResource().getName();
|
||||
fileN=fileN.trim();
|
||||
&& exportSession.getTabResource().getName() != null
|
||||
&& !exportSession.getTabResource().getName().isEmpty()) {
|
||||
fileN = exportSession.getTabResource().getName();
|
||||
fileN = fileN.trim();
|
||||
}
|
||||
|
||||
|
||||
fileName = new TextField();
|
||||
fileName.setAllowBlank(false);
|
||||
fileName.addValidator(new EmptyValidator<String>());
|
||||
fileName.setWidth("410px");
|
||||
fileName.setValue(fileN);
|
||||
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(-1,
|
||||
-1));
|
||||
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(1, -1));
|
||||
|
||||
fileDescription = new TextField();
|
||||
fileDescription.addValidator(new EmptyValidator<String>());
|
||||
|
@ -80,34 +77,50 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
fileDescription.setWidth("410px");
|
||||
fileDescription.setValue("json");
|
||||
p.add(new FieldLabel(fileDescription, "Description"),
|
||||
new VerticalLayoutData(-1, -1));
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
// /
|
||||
Log.debug("Set Workspace Panel");
|
||||
wpanel = new WorkspacePanel();
|
||||
wpanel.setSpWidth("410px");
|
||||
wpanel.setSpHeight("330px");
|
||||
List<ItemType> lItemType = new ArrayList<ItemType>();
|
||||
lItemType.add(ItemType.ROOT);
|
||||
lItemType.add(ItemType.FOLDER);
|
||||
wpanel.setShowableTypes(lItemType);
|
||||
wpanel.setSelectableTypes(lItemType);
|
||||
wpanel.addSelectionHandler(new ItemSelectionHandler() {
|
||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||
selectableTypes.add(ItemType.FOLDER);
|
||||
List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||
showableTypes.add(ItemType.FOLDER);
|
||||
|
||||
|
||||
public void onSelection(ItemSelectionEvent event) {
|
||||
item = event.getSelectedItem();
|
||||
wpanel = new WorkspaceExplorerSelectPanel(new String(
|
||||
"Workspace Selection"), selectableTypes, showableTypes);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
Log.debug("Selected Item:" + item);
|
||||
if (item.getType() == ItemType.FOLDER
|
||||
|| item.getType() == ItemType.ROOT) {
|
||||
if (item.getType() == ItemType.FOLDER) {
|
||||
thisCard.exportSession.setItemId(item.getId());
|
||||
} else {
|
||||
thisCard.exportSession.setItemId(null);
|
||||
Log.debug("Item type:" + item.getType());
|
||||
}
|
||||
}
|
||||
});
|
||||
p.add(new FieldLabel(wpanel, "Folder"), new VerticalLayoutData(-1, -1));
|
||||
wpanel.loadTree();
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in workspaceExplorer: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
Log.debug("WorkspaceExplorer Aborted");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
wpanel.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||
|
||||
// /
|
||||
p.add(new FieldLabel(wpanel, "Folder"), new VerticalLayoutData(1, 1));
|
||||
|
||||
setContent(formPanel);
|
||||
|
||||
}
|
||||
|
@ -115,7 +128,6 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
protected void checkExportData() {
|
||||
Log.debug("File Name:" + fileName.getCurrentValue() + " Item id: "
|
||||
+ exportSession.getItemId());
|
||||
wpanel.disable();
|
||||
fileName.disable();
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
|
@ -123,7 +135,6 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
HideHandler hideHandler = new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
wpanel.enable();
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
fileName.enable();
|
||||
|
@ -137,11 +148,11 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
|
||||
if (exportSession.getItemId() != null) {
|
||||
exportSession.setFileName(fileName.getCurrentValue());
|
||||
exportSession.setFileDescription(fileDescription.getCurrentValue());
|
||||
exportSession.setFileDescription(fileDescription
|
||||
.getCurrentValue());
|
||||
goNext();
|
||||
} else {
|
||||
d = new AlertMessageBox("Attetion",
|
||||
"No folder selected");
|
||||
d = new AlertMessageBox("Attetion", "No folder selected");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.setModal(false);
|
||||
d.show();
|
||||
|
@ -190,8 +201,7 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
setBackButtonVisible(true);
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
@ -200,11 +210,12 @@ public class JSONWorkSpaceSelectionCard extends WizardCard {
|
|||
}
|
||||
|
||||
protected void goNext() {
|
||||
JSONOperationInProgressCard jsonOperationInProgressCard = new JSONOperationInProgressCard(exportSession);
|
||||
JSONOperationInProgressCard jsonOperationInProgressCard = new JSONOperationInProgressCard(
|
||||
exportSession);
|
||||
getWizardWindow().addCard(jsonOperationInProgressCard);
|
||||
Log.info("NextCard CSVOperationInProgressCard");
|
||||
Log.info("NextCard CSVOperationInProgressCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
package org.gcube.portlets.user.td.jsonexportwidget.client.workspace;
|
||||
|
||||
import org.gcube.portlets.widgets.lighttree.client.WorkspaceLightTreePanel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.DisableEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.EnableEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class WorkspacePanel extends WorkspaceLightTreePanel {
|
||||
|
||||
AutoProgressMessageBox box;
|
||||
|
||||
public void setSpWidth(String w) {
|
||||
sp.setWidth(w);
|
||||
|
||||
}
|
||||
|
||||
public void setSpHeight(String h) {
|
||||
sp.setHeight(h);
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
Log.debug("WorkspacePanel Disable");
|
||||
fireEvent(new DisableEvent());
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
Log.debug("WorkspacePanel Enable");
|
||||
fireEvent(new EnableEvent());
|
||||
}
|
||||
|
||||
public void startWaiting() {
|
||||
box= new AutoProgressMessageBox("Loading",
|
||||
"Retriving data from workspace, please wait...");
|
||||
box.setProgressText("Loading...");
|
||||
box.setModal(false);
|
||||
box.auto();
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
public void endWaiting() {
|
||||
box.hide();
|
||||
}
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry' /> -->
|
||||
|
|
|
@ -4,28 +4,40 @@
|
|||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Servlets -->
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>workspaceExplorer</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
<!-- Servlets Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<url-pattern>tdgwtservice/TDGWTService</url-pattern>
|
||||
<url-pattern>/JSONExportWidget/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>JSONExportWidget/junithost/*</url-pattern>
|
||||
<url-pattern>/JSONExportWidget/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>workspaceExplorer</servlet-name>
|
||||
<url-pattern>/JSONExportWidget/WorkspaceExplorerService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>JSONExportWidgetTD.html</welcome-file>
|
||||
|
|
Loading…
Reference in New Issue