ref 16503: Workspace folder as input
https://support.d4science.org/issues/16503 Added support for Item ID parameter git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@179853 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c1e7231926
commit
b7a19011fe
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/data-miner-manager-1.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/data-miner-manager-1.11.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/data-miner-manager-1.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/data-miner-manager-1.11.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -34,5 +34,5 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="output" path="target/data-miner-manager-1.10.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/data-miner-manager-1.11.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="${groupId}.${artifactId}.1-11-0" date="2019-06-14">
|
||||||
|
<Change>Added Item Id support [ticket #16503]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="${groupId}.${artifactId}.1-10-0" date="2019-04-01">
|
<Changeset component="${groupId}.${artifactId}.1-10-0" date="2019-04-01">
|
||||||
<Change>Added location and zoom support [ticket #11708]</Change>
|
<Change>Added location and zoom support [ticket #11708]</Change>
|
||||||
<Change>Added coordinates EPSG:4326 and EPSG:3857 support [ticket
|
<Change>Added coordinates EPSG:4326 and EPSG:3857 support [ticket
|
||||||
#11710]</Change>
|
#11710]
|
||||||
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset component="${groupId}.${artifactId}.1-9-1" date="2018-12-13">
|
<Changeset component="${groupId}.${artifactId}.1-9-1" date="2018-12-13">
|
||||||
<Change>Updated to support StorageHub properties [ticket #11720]
|
<Change>Updated to support StorageHub properties [ticket #11720]
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>data-miner-manager</artifactId>
|
<artifactId>data-miner-manager</artifactId>
|
||||||
<version>1.10.0-SNAPSHOT</version>
|
<version>1.11.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<name>data-miner-manager</name>
|
<name>data-miner-manager</name>
|
||||||
|
|
|
@ -0,0 +1,244 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
||||||
|
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ItemIdParameter;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||||
|
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
|
||||||
|
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
||||||
|
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.user.dataminermanager.client.workspace.DownloadWidget;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
import com.sencha.gxt.core.client.dom.XDOM;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ItemIdFld extends AbstractFld {
|
||||||
|
|
||||||
|
private VerticalLayoutContainer vp;
|
||||||
|
|
||||||
|
// FileSelector fileSelector;
|
||||||
|
private WorkspaceExplorerSelectDialog wselectDialog;
|
||||||
|
private TextButton selectButton, selectButton2, cancelButton;
|
||||||
|
private ItemDescription selectedItem = null;
|
||||||
|
|
||||||
|
private ItemIdParameter itemIdParameter;
|
||||||
|
|
||||||
|
private SimpleContainer fieldContainer;
|
||||||
|
|
||||||
|
private HBoxLayoutContainer horiz;
|
||||||
|
|
||||||
|
private TextButton downloadButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parameter
|
||||||
|
* parameter
|
||||||
|
*/
|
||||||
|
public ItemIdFld(Parameter parameter) {
|
||||||
|
super(parameter);
|
||||||
|
itemIdParameter = (ItemIdParameter) parameter;
|
||||||
|
|
||||||
|
SimpleContainer tabContainer = new SimpleContainer();
|
||||||
|
vp = new VerticalLayoutContainer();
|
||||||
|
init();
|
||||||
|
tabContainer.add(vp, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
|
fieldContainer = new SimpleContainer();
|
||||||
|
horiz = new HBoxLayoutContainer();
|
||||||
|
horiz.setPack(BoxLayoutPack.START);
|
||||||
|
horiz.setEnableOverflow(false);
|
||||||
|
|
||||||
|
HtmlLayoutContainer descr;
|
||||||
|
|
||||||
|
if (itemIdParameter.getDescription() == null || itemIdParameter.getDescription().isEmpty()) {
|
||||||
|
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||||
|
descr.addStyleName("workflow-fieldDescription");
|
||||||
|
} else {
|
||||||
|
descr = new HtmlLayoutContainer(
|
||||||
|
"<p style='margin-left:5px !important;'>" + itemIdParameter.getDescription() + "</p>");
|
||||||
|
descr.addStyleName("workflow-fieldDescription");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
horiz.add(tabContainer, new BoxLayoutData(new Margins()));
|
||||||
|
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||||
|
|
||||||
|
fieldContainer.add(horiz);
|
||||||
|
showNoSelectionField();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
|
||||||
|
wselectDialog = new WorkspaceExplorerSelectDialog("Select Item", false);
|
||||||
|
|
||||||
|
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelectedItem(Item item) {
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
UtilsGXT3.info("Attention", "Select a valid item!");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
retrieveItemInformation(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailed(Throwable throwable) {
|
||||||
|
Log.error("Error in create project: " + throwable.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAborted() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNotValidSelection() {
|
||||||
|
UtilsGXT3.info("Attention", "Select a valid item!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
wselectDialog.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||||
|
wselectDialog.setZIndex(XDOM.getTopZIndex());
|
||||||
|
|
||||||
|
selectButton = new TextButton("Select Item");
|
||||||
|
selectButton.setIcon(DataMinerManager.resources.folderExplore());
|
||||||
|
selectButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
wselectDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
selectButton.setToolTip("Select Item");
|
||||||
|
|
||||||
|
selectButton2 = new TextButton("");
|
||||||
|
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
|
||||||
|
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
wselectDialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
selectButton2.setToolTip("Select Another Item");
|
||||||
|
|
||||||
|
cancelButton = new TextButton("");
|
||||||
|
cancelButton.setIcon(DataMinerManager.resources.cancel());
|
||||||
|
cancelButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
selectedItem = null;
|
||||||
|
showNoSelectionField();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
downloadButton = new TextButton("");
|
||||||
|
downloadButton.setIcon(DataMinerManager.resources.download());
|
||||||
|
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
downloadFile();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveItemInformation(final Item item) {
|
||||||
|
Log.debug("Retrieved: " + item);
|
||||||
|
final ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||||
|
item.getPath(), item.getType().name());
|
||||||
|
selectedItem = itemDescription;
|
||||||
|
Log.debug("SelectedItem: " + selectedItem);
|
||||||
|
showFieldWithSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downloadFile() {
|
||||||
|
if (selectedItem != null) {
|
||||||
|
DownloadWidget downloadWidget = new DownloadWidget();
|
||||||
|
downloadWidget.download(selectedItem.getId());
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.info("Attention", "Select a Item!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNoSelectionField() {
|
||||||
|
vp.clear();
|
||||||
|
vp.add(selectButton);
|
||||||
|
vp.forceLayout();
|
||||||
|
fieldContainer.forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFieldWithSelection() {
|
||||||
|
String fileName = selectedItem.getName();
|
||||||
|
|
||||||
|
if (fileName == null || fileName.isEmpty()) {
|
||||||
|
fileName = "NoName";
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField tableDescription = new TextField();
|
||||||
|
tableDescription.setValue(fileName);
|
||||||
|
tableDescription.setReadOnly(true);
|
||||||
|
|
||||||
|
HBoxLayoutContainer h = new HBoxLayoutContainer();
|
||||||
|
h.add(tableDescription, new BoxLayoutData(new Margins()));
|
||||||
|
h.add(selectButton2, new BoxLayoutData(new Margins()));
|
||||||
|
h.add(downloadButton, new BoxLayoutData(new Margins()));
|
||||||
|
h.add(cancelButton, new BoxLayoutData(new Margins()));
|
||||||
|
vp.clear();
|
||||||
|
vp.add(h);
|
||||||
|
vp.forceLayout();
|
||||||
|
fieldContainer.forceLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return (selectedItem != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Widget getWidget() {
|
||||||
|
return fieldContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return (selectedItem == null) ? null : selectedItem.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -46,6 +46,9 @@ public class OperatorFieldWidget {
|
||||||
case FILE:
|
case FILE:
|
||||||
field = new FileFld(parameter);
|
field = new FileFld(parameter);
|
||||||
break;
|
break;
|
||||||
|
case ITEMID:
|
||||||
|
field = new ItemIdFld(parameter);
|
||||||
|
break;
|
||||||
case LIST:
|
case LIST:
|
||||||
field = createListField(parameter);
|
field = createListField(parameter);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue