Minor fixes
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129050 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f5dfd39e20
commit
51c3fb40b1
|
@ -5,9 +5,6 @@
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="ckan-util-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<property name="context-root" value="ckan-metadata-publisher-widget"/>
|
<property name="context-root" value="ckan-metadata-publisher-widget"/>
|
||||||
<property name="java-output-path" value="/ckan-metadata-publisher-widget/target/ckan-metadata-publisher-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/ckan-metadata-publisher-widget/target/ckan-metadata-publisher-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
||||||
|
|
||||||
String idFolderWorkspace = "d3a37eb9-1589-4c95-a9d0-c473a02d4f0f";
|
String idFolderWorkspace = "d3a37eb9-1589-4c95-a9d0-c473a02d4f0f";
|
||||||
String owner = "costantino_perciante";
|
String owner = "costantino_perciante";
|
||||||
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(idFolderWorkspace, owner));
|
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(owner));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
|
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
|
||||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Window;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -26,17 +22,9 @@ public class AddResourceContainer extends Composite{
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiField VerticalPanel resourcesPanel;
|
@UiField VerticalPanel resourcesPanel;
|
||||||
@UiField Button goToDatasetButton;
|
|
||||||
|
|
||||||
public AddResourceContainer(final String datasetUrl) {
|
public AddResourceContainer(final String datasetUrl) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
goToDatasetButton.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
Window.Location.assign(datasetUrl);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
<b:Button title="Go to dataset" ui:field="goToDatasetButton"
|
|
||||||
block="true" visible="true">Go to Dataset</b:Button>
|
|
||||||
<!-- Here will be placed the form for the resources -->
|
<!-- Here will be placed the form for the resources -->
|
||||||
<g:VerticalPanel ui:field="resourcesPanel" width="100%"></g:VerticalPanel>
|
<g:VerticalPanel ui:field="resourcesPanel" width="100%"></g:VerticalPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -12,11 +12,13 @@ import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.uibinder.client.UiHandler;
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -51,8 +53,9 @@ public class AddResourceToDataset extends Composite{
|
||||||
@UiField TextArea resourceDescriptionTextArea;
|
@UiField TextArea resourceDescriptionTextArea;
|
||||||
@UiField Button addResourceButton;
|
@UiField Button addResourceButton;
|
||||||
@UiField AlertBlock infoBlock;
|
@UiField AlertBlock infoBlock;
|
||||||
|
@UiField Button goToDatasetButton;
|
||||||
|
|
||||||
public AddResourceToDataset(HandlerManager eventBus, String datasetId, String owner) {
|
public AddResourceToDataset(HandlerManager eventBus, String datasetId, String owner, final String datasetUrl) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
// save bus
|
// save bus
|
||||||
|
@ -63,6 +66,14 @@ public class AddResourceToDataset extends Composite{
|
||||||
|
|
||||||
// the owner of the dataset/files
|
// the owner of the dataset/files
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|
||||||
|
goToDatasetButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
Window.Location.assign(datasetUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiHandler("addResourceButton")
|
@UiHandler("addResourceButton")
|
||||||
|
|
|
@ -85,8 +85,8 @@
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
<!-- Alert blocks for info/errors -->
|
<!-- Alert blocks for info/errors -->
|
||||||
<b:AlertBlock type="INFO" animation="true" visible="false" close="false"
|
<b:AlertBlock type="INFO" animation="true" visible="false"
|
||||||
ui:field="infoBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
|
close="false" ui:field="infoBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
|
||||||
<!-- Add resource button -->
|
<!-- Add resource button -->
|
||||||
<b:Button title="Add resource" ui:field="addResourceButton"
|
<b:Button title="Add resource" ui:field="addResourceButton"
|
||||||
|
@ -94,5 +94,8 @@
|
||||||
|
|
||||||
</b:Fieldset>
|
</b:Fieldset>
|
||||||
</b:Form>
|
</b:Form>
|
||||||
|
|
||||||
|
<b:Button title="Go to dataset" ui:field="goToDatasetButton"
|
||||||
|
block="true" visible="true">Go to Dataset</b:Button>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</ui:UiBinder>
|
</ui:UiBinder>
|
|
@ -543,6 +543,9 @@ public class CreateDatasetForm extends Composite{
|
||||||
// disable dataset fields
|
// disable dataset fields
|
||||||
disableDatasetFields();
|
disableDatasetFields();
|
||||||
|
|
||||||
|
// disable reset
|
||||||
|
resetButton.setEnabled(false);
|
||||||
|
|
||||||
// show the go to dataset button
|
// show the go to dataset button
|
||||||
final String datasetUrl = createdDatasetBean.getSource();
|
final String datasetUrl = createdDatasetBean.getSource();
|
||||||
goToDatasetButton.setVisible(true);
|
goToDatasetButton.setVisible(true);
|
||||||
|
@ -561,7 +564,6 @@ public class CreateDatasetForm extends Composite{
|
||||||
|
|
||||||
// leave to back button, but remove create and add go to dataset
|
// leave to back button, but remove create and add go to dataset
|
||||||
createButton.removeFromParent();
|
createButton.removeFromParent();
|
||||||
resetButton.setEnabled(false);
|
|
||||||
|
|
||||||
// set go to dataset as primary
|
// set go to dataset as primary
|
||||||
goToDatasetButton.setType(ButtonType.PRIMARY);
|
goToDatasetButton.setType(ButtonType.PRIMARY);
|
||||||
|
@ -587,7 +589,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
tabPanel.setWidth("100%");
|
tabPanel.setWidth("100%");
|
||||||
|
|
||||||
// add the form
|
// add the form
|
||||||
resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(), owner);
|
resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(), owner, datasetUrl);
|
||||||
|
|
||||||
// tab for the form
|
// tab for the form
|
||||||
Tab formContainer = new Tab();
|
Tab formContainer = new Tab();
|
||||||
|
@ -617,7 +619,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
alertOnCreate("Unable to create this dataset, maybe it exists?", AlertType.ERROR);
|
alertOnCreate("Unable to create this dataset, maybe it already exists?", AlertType.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -625,7 +627,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
alertOnCreate("Unable to create this dataset, maybe it exists?", AlertType.ERROR);
|
alertOnCreate("Unable to create this dataset, maybe it already exists?", AlertType.ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,52 +1,12 @@
|
||||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client;
|
package org.gcube.portlets.widgets.ckandatapublisherwidget.client;
|
||||||
|
|
||||||
import java.util.List;
|
/**
|
||||||
|
*
|
||||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
* @author Costantino Perciante at ISTI-CNR
|
||||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
* (costantino.perciante@isti.cnr.it)
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
*
|
||||||
import org.gcube.common.homelibrary.home.exceptions.UserNotFoundException;
|
*/
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class Tests {
|
public class Tests {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() throws WorkspaceFolderNotFoundException, InternalErrorException, HomeNotFoundException, UserNotFoundException, ItemNotFoundException{
|
|
||||||
|
|
||||||
ScopeProvider.instance.set("/gcube");
|
|
||||||
|
|
||||||
Workspace ws = HomeLibrary
|
|
||||||
.getHomeManagerFactory()
|
|
||||||
.getHomeManager()
|
|
||||||
.getHome("costantino.perciante").getWorkspace();
|
|
||||||
|
|
||||||
List<WorkspaceItem> childrens = ws.getRoot().getChildren();
|
|
||||||
|
|
||||||
for (WorkspaceItem workspaceItem : childrens) {
|
|
||||||
if(workspaceItem.getName().equals("test-ckan-folder")){
|
|
||||||
|
|
||||||
System.out.println("Dir has id " + workspaceItem.getId());
|
|
||||||
|
|
||||||
List<? extends WorkspaceItem> files = workspaceItem.getChildren();
|
|
||||||
for (WorkspaceItem file : files) {
|
|
||||||
|
|
||||||
if(!file.isFolder()) // ok, it's a file
|
|
||||||
System.out.println("item id is " + file.getId());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckedCkanClient client = new CheckedCkanClient("http://ckan-d-d4s.d4science.org", "803ada7f-2080-493f-8a99-3e593e880d94");
|
|
||||||
//
|
|
||||||
// CkanDataset dataset = client.getDataset("34d9cc5a-9ddb-40a1-9747-8490acd318d3");
|
|
||||||
// //client.deleteDataset("34d9cc5a-9ddb-40a1-9747-8490acd318d3");
|
|
||||||
// System.out.println("Dataset exists " + dataset.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue