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-resources-widget@117643 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-08-03 16:56:37 +00:00
parent 71223f3d28
commit 07d58f6a01
7 changed files with 77 additions and 87 deletions

View File

@ -163,10 +163,11 @@
<!-- WSLT dependencies -->
<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>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>

View File

@ -24,6 +24,8 @@
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry'
/> -->

View File

@ -11,6 +11,7 @@ import com.google.web.bindery.event.shared.EventBus;
public class SaveResourceWizard extends WizardWindow {
protected SaveResourceSession saveResourceSession;
protected String WIZARDWIDTH = "844px";
/**
* The id of the {@link CSVTarget} to use.
@ -21,6 +22,7 @@ public class SaveResourceWizard extends WizardWindow {
public SaveResourceWizard(SaveResourceSession saveResourceSession,
String title, EventBus eventBus) {
super(title, eventBus);
setWidth(WIZARDWIDTH);
this.saveResourceSession = saveResourceSession;

View File

@ -7,12 +7,11 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.SaveResourceSession;
import org.gcube.portlets.user.td.resourceswidget.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;
@ -34,14 +33,13 @@ import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
*/
public class WorkSpaceSelectionCard extends WizardCard {
protected SaveResourceSession saveResourceSession;
protected WorkSpaceSelectionCard thisCard;
protected TextField fileName;
protected TextField fileDescription;
private SaveResourceSession saveResourceSession;
private WorkSpaceSelectionCard thisCard;
private TextField fileName;
private TextField fileDescription;
protected Item item;
protected VerticalLayoutContainer p;
protected WorkspacePanel wpanel;
private VerticalLayoutContainer p;
private WorkspaceExplorerSelectPanel wpanel;
public WorkSpaceSelectionCard(final SaveResourceSession saveResourceSession) {
super("Save in Workspace", "");
@ -61,7 +59,7 @@ public class WorkSpaceSelectionCard extends WizardCard {
fileName.setValue(saveResourceSession.getFileName());
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(-1,
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(1,
-1));
fileDescription = new TextField();
@ -70,33 +68,52 @@ public class WorkSpaceSelectionCard extends WizardCard {
fileDescription.setWidth("410px");
fileDescription.setValue(saveResourceSession.getFileDescription());
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.saveResourceSession.setItemId(item.getId());
} else {
thisCard.saveResourceSession.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);
}
@ -104,7 +121,6 @@ public class WorkSpaceSelectionCard extends WizardCard {
protected void checkExportData() {
Log.debug("File Name:" + fileName.getCurrentValue() + " Item id: "
+ saveResourceSession.getItemId());
wpanel.disable();
fileName.disable();
getWizardWindow().setEnableNextButton(false);
getWizardWindow().setEnableBackButton(false);
@ -112,7 +128,6 @@ public class WorkSpaceSelectionCard extends WizardCard {
HideHandler hideHandler = new HideHandler() {
public void onHide(HideEvent event) {
wpanel.enable();
getWizardWindow().setEnableNextButton(true);
getWizardWindow().setEnableBackButton(true);
fileName.enable();

View File

@ -1,47 +0,0 @@
package org.gcube.portlets.user.td.resourceswidget.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;
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();
}
}

View File

@ -26,6 +26,8 @@
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.gcube.portlets.user.td.resourceswidget.client.ResourcesWidgetEntry'
/> -->

View File

@ -23,11 +23,19 @@
<servlet-class>org.gcube.portlets.user.td.gwtservice.server.RetrieveFileAndDiscoverMimeTypeServlet</servlet-class>
</servlet>
<!-- WorkspaceExplorer -->
<servlet>
<servlet-name>workspaceExplorer</servlet-name>
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
</servlet>
<!-- JUnit -->
<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>
@ -46,6 +54,13 @@
<url-pattern>/ResourcesWidget/RetrieveFileAndDiscoverMimeTypeServlet</url-pattern>
</servlet-mapping>
<!-- WorkspaceExplorer -->
<servlet-mapping>
<servlet-name>workspaceExplorer</servlet-name>
<url-pattern>/ResourcesWidget/WorkspaceExplorerService</url-pattern>
</servlet-mapping>
<!-- JUnit -->
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>
<url-pattern>/ResourcesWidget/junithost/*</url-pattern>