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-csv-export-widget@117639 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ea6c56c885
commit
457ecb5d60
5
pom.xml
5
pom.xml
|
@ -131,10 +131,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>
|
||||
|
|
|
@ -11,15 +11,18 @@ import com.google.web.bindery.event.shared.EventBus;
|
|||
public class CSVExportWizardTD extends WizardWindow {
|
||||
|
||||
protected CSVExportSession exportSession;
|
||||
protected String WIZARDWIDTH = "844px";
|
||||
|
||||
|
||||
/**
|
||||
* The id of the {@link CSVTarget} to use.
|
||||
*
|
||||
* @param targetId
|
||||
* @param title
|
||||
* @param eventBus
|
||||
*/
|
||||
|
||||
public CSVExportWizardTD(String title, EventBus eventBus) {
|
||||
super(title, eventBus);
|
||||
setWidth(WIZARDWIDTH);
|
||||
|
||||
|
||||
exportSession = new CSVExportSession();
|
||||
|
||||
|
|
|
@ -6,13 +6,12 @@ package org.gcube.portlets.user.td.csvexportwidget.client;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.csvexportwidget.client.workspace.WorkspacePanel;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||
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 CSVWorkSpaceSelectionCard extends WizardCard {
|
||||
|
||||
protected CSVExportSession exportSession;
|
||||
protected CSVWorkSpaceSelectionCard thisCard;
|
||||
protected TextField fileName;
|
||||
protected TextField fileDescription;
|
||||
private CSVExportSession exportSession;
|
||||
private CSVWorkSpaceSelectionCard thisCard;
|
||||
private TextField fileName;
|
||||
private TextField fileDescription;
|
||||
|
||||
protected Item item;
|
||||
protected VerticalLayoutContainer p;
|
||||
protected WorkspacePanel wpanel;
|
||||
private VerticalLayoutContainer p;
|
||||
private WorkspaceExplorerSelectPanel wpanel;
|
||||
|
||||
public CSVWorkSpaceSelectionCard(final CSVExportSession exportSession) {
|
||||
super("CSV Export in Workspace", "");
|
||||
|
@ -67,7 +65,7 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
fileName.setAllowBlank(false);
|
||||
fileName.setWidth("410px");
|
||||
fileName.setValue(fileN);
|
||||
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(-1,
|
||||
p.add(new FieldLabel(fileName, "Name"), new VerticalLayoutData(1,
|
||||
-1));
|
||||
|
||||
fileDescription = new TextField();
|
||||
|
@ -76,33 +74,52 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
fileDescription.setWidth("410px");
|
||||
fileDescription.setValue("csv");
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -110,7 +127,6 @@ public class CSVWorkSpaceSelectionCard 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);
|
||||
|
@ -118,7 +134,6 @@ public class CSVWorkSpaceSelectionCard extends WizardCard {
|
|||
HideHandler hideHandler = new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
wpanel.enable();
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(true);
|
||||
fileName.enable();
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package org.gcube.portlets.user.td.csvexportwidget.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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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' /> -->
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="SDMXImportWizardTD.css">
|
||||
<link type="text/css" rel="stylesheet" href="CSVExportWizardTD.css">
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
|
@ -24,7 +24,7 @@
|
|||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
<script type="text/javascript" language="javascript" src="SDMXImportWizardTD/SDMXImportWizardTD.nocache.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="CSVExportWizardTD/CSVExportWizardTD.nocache.js"></script>
|
||||
</head>
|
||||
|
||||
<!-- -->
|
|
@ -16,19 +16,32 @@
|
|||
<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>/CSVExportWizardTD/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>CSVImportWizardTDManagerWidgets/junithost/*</url-pattern>
|
||||
<url-pattern>/CSVExportWizardTD/junithost/*</url-pattern>
|
||||
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>workspaceExplorer</servlet-name>
|
||||
<url-pattern>/CSVExportWizardTD/WorkspaceExplorerService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>CSVImportWizardTD.html</welcome-file>
|
||||
<welcome-file>CSVExportWizardTD.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
||||
|
|
Loading…
Reference in New Issue