in progress on "Manage Resources"
This commit is contained in:
parent
3a9ac6eecc
commit
f4846b0a66
|
@ -266,10 +266,10 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
m.getElement().getStyle().setMarginLeft(-30, Unit.PCT);
|
||||
ResourceElementBean r = new ResourceElementBean();
|
||||
r.setFolder(false);
|
||||
r.setName("Root");
|
||||
r.setName("Mangiacrapra_Introducing_myself.pptx");
|
||||
r.setParent(null);
|
||||
r.setChildrenSize(5);
|
||||
r.setOriginalIdInWorkspace("31d7ec0c-8d31-47d7-9139-c52b5e124349");
|
||||
r.setOriginalIdInWorkspace("8489e2ab-7487-404f-97ff-5aecc35c241f");
|
||||
|
||||
ResourceElementBean parent = new ResourceElementBean();
|
||||
parent.setOriginalIdInWorkspace("91409eba-0bf6-4aa5-8d73-3536bf181587");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<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">
|
||||
<ui:style>
|
||||
.legend-style {
|
||||
width: 100%;
|
||||
|
@ -28,61 +29,68 @@
|
|||
.control-group {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.custom-input {
|
||||
|
||||
}
|
||||
|
||||
</ui:style>
|
||||
<g:HTMLPanel styleName="{style.panel-style}">
|
||||
<b:Form type="VERTICAL" width="100%">
|
||||
<!-- <b:Fieldset styleName="{style.fieldset-border-style}"> -->
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
<b>Resource Information</b>
|
||||
<b:Button ui:field="closeButton" type="LINK" title="Close details"></b:Button>
|
||||
</b:Legend>
|
||||
<b:ControlGroup ui:field="controlName" styleName="{style.control-group}">
|
||||
<b:ControlLabel for="name" styleName="{style.labels-style}"
|
||||
title="The name the resource will have on the catalogue">
|
||||
<b>Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource name" b:id="name"
|
||||
enabled="true" title="The name the resource will have on the catalogue"
|
||||
ui:field="resourceName" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="path" title="Resource path"
|
||||
styleName="{style.labels-style}">
|
||||
<b>Path:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource path" b:id="path"
|
||||
readOnly="true" title="Resource path" ui:field="resourcePath" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="description" styleName="{style.labels-style}"
|
||||
title="The description the resource will have on the catalogue">
|
||||
<b>Description:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextArea placeholder="Resource description" b:id="description"
|
||||
title="The description the resource will have on the catalogue"
|
||||
ui:field="resourceDescription"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="format" styleName="{style.labels-style}"
|
||||
title="The MIME type">
|
||||
<b>Format:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource format" b:id="format"
|
||||
title="The MIME type" ui:field="resourceFormat" readOnly="true" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<g:HorizontalPanel width="100%" ui:field="commandPanel">
|
||||
<!-- <b:Button ui:field="cancelButton">Cancel</b:Button> -->
|
||||
<b:Button ui:field="updateResourceButton" type="PRIMARY">Update</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<!-- </b:Fieldset> -->
|
||||
<g:HTMLPanel addStyleNames="{style.panel-style}">
|
||||
<b:Form type="HORIZONTAL" width="100%">
|
||||
<b:Fieldset addStyleNames="{style.custom-input}">
|
||||
<b:Legend addStyleNames="{style.legend-style}">
|
||||
<b>Resource Information</b>
|
||||
<b:Button ui:field="closeButton" type="LINK"
|
||||
title="Close details"></b:Button>
|
||||
</b:Legend>
|
||||
<b:ControlGroup ui:field="controlName">
|
||||
<b:ControlLabel for="name"
|
||||
title="The name the resource will have on the catalogue">
|
||||
<b>Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Resource name" b:id="name"
|
||||
enabled="true"
|
||||
title="The name the resource will have on the catalogue"
|
||||
ui:field="resourceName" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="path" title="Resource path">
|
||||
<b>Path:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Resource path" b:id="path"
|
||||
readOnly="true" title="Resource path" ui:field="resourcePath" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel for="description"
|
||||
title="The description the resource will have on the catalogue">
|
||||
<b>Description:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea placeholder="Resource description"
|
||||
b:id="description"
|
||||
title="The description the resource will have on the catalogue"
|
||||
ui:field="resourceDescription"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup visible="false">
|
||||
<b:ControlLabel for="format" title="The MIME type">
|
||||
<b>Format:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Resource format" b:id="format"
|
||||
title="The MIME type" ui:field="resourceFormat" readOnly="true" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<g:HorizontalPanel width="100%"
|
||||
ui:field="commandPanel">
|
||||
<!-- <b:Button ui:field="cancelButton">Cancel</b:Button> -->
|
||||
<b:Button ui:field="updateResourceButton" type="PRIMARY">Update</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -1247,15 +1247,15 @@ public class CreateDatasetForm extends Composite{
|
|||
);
|
||||
|
||||
// resources field
|
||||
// InfoIconsLabels.preparePopupPanelAndPopover(
|
||||
// InfoIconsLabels.RESOURCES_INFO_ID_POPUP,
|
||||
// InfoIconsLabels.RESOURCES_INFO_TEXT,
|
||||
// InfoIconsLabels.RESOURCES_INFO_CAPTION,
|
||||
// infoIconResources,
|
||||
// popoverResources,
|
||||
// focusPanelResources,
|
||||
// popupOpenedIds
|
||||
// );
|
||||
InfoIconsLabels.preparePopupPanelAndPopover(
|
||||
InfoIconsLabels.RESOURCES_INFO_ID_POPUP,
|
||||
InfoIconsLabels.RESOURCES_INFO_TEXT,
|
||||
InfoIconsLabels.RESOURCES_INFO_CAPTION,
|
||||
infoIconResources,
|
||||
popoverResources,
|
||||
focusPanelResources,
|
||||
popupOpenedIds
|
||||
);
|
||||
|
||||
// title
|
||||
InfoIconsLabels.preparePopupPanelAndPopover(
|
||||
|
|
|
@ -70,8 +70,8 @@ public class InfoIconsLabels {
|
|||
// RESOURCES
|
||||
public static final String RESOURCES_INFO_ID_POPUP = "resouces-popup-panel-info";
|
||||
public static final String RESOURCES_INFO_CAPTION = "Manage resource items";
|
||||
public static final String RESOURCES_INFO_TEXT = "Move the files you want to attach to the item on the right panel below. Double click on the item for changing resource's name or description."
|
||||
+ " Please consider that any complex hierarchy structure you may have will be flatten.";
|
||||
public static final String RESOURCES_INFO_TEXT = "Select the files you want to attach to the publishing item. Click on 'Trash' to remote it. Click on 'Edit' for changing resource's name or description."
|
||||
+ " You can add others files by using the 'Add files from...' facility. To navigate a folder perform a 'double click' on it. Please consider that any complex hierarchy structure you may have will be flatten.";
|
||||
|
||||
// CUSTOM FIELDS
|
||||
public static final String CUSTOM_FIELDS_INFO_ID_POPUP = "custom-fields-popup-panel-info";
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class EditPublishingResourceEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 9, 2021
|
||||
*/
|
||||
public class EditPublishingResourceEvent extends GwtEvent<EditPublishingResourceEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<EditPublishingResourceEventHandler> TYPE = new Type<EditPublishingResourceEventHandler>();
|
||||
|
||||
/** The resource. */
|
||||
private ResourceElementBean resource;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new edits the publishing resource event.
|
||||
*
|
||||
* @param resource the resource
|
||||
*/
|
||||
public EditPublishingResourceEvent(ResourceElementBean resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resource.
|
||||
*
|
||||
* @return the resource
|
||||
*/
|
||||
public ResourceElementBean getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<EditPublishingResourceEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(EditPublishingResourceEventHandler handler) {
|
||||
handler.onEditResource(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface EditPublishingResourceEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 9, 2021
|
||||
*/
|
||||
public interface EditPublishingResourceEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On edit resource.
|
||||
*
|
||||
* @param editResourceEvent the edit resource event
|
||||
*/
|
||||
void onEditResource(EditPublishingResourceEvent editResourceEvent);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class RemovePublishingResourceEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 9, 2021
|
||||
*/
|
||||
public class RemovePublishingResourceEvent extends GwtEvent<RemovePublishingResourceEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<RemovePublishingResourceEventHandler> TYPE = new Type<RemovePublishingResourceEventHandler>();
|
||||
|
||||
/** The resource. */
|
||||
private ResourceElementBean resource;
|
||||
|
||||
/**
|
||||
* Instantiates a new removes the publishing resource event.
|
||||
*
|
||||
* @param resource the resource
|
||||
*/
|
||||
public RemovePublishingResourceEvent(ResourceElementBean resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resource.
|
||||
*
|
||||
* @return the resource
|
||||
*/
|
||||
public ResourceElementBean getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<RemovePublishingResourceEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(RemovePublishingResourceEventHandler handler) {
|
||||
handler.onRemoveResource(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface RemovePublishingResourceEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Mar 9, 2021
|
||||
*/
|
||||
public interface RemovePublishingResourceEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On remove resource.
|
||||
*
|
||||
* @param removeResourceEvent the remove resource event
|
||||
*/
|
||||
void onRemoveResource(RemovePublishingResourceEvent removeResourceEvent);
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection.ResourceInfoForm;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
|
@ -12,10 +13,14 @@ import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
|||
import com.github.gwtbootstrap.client.ui.AccordionGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
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.event.dom.client.HasAllDragAndDropHandlers;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
|
@ -57,8 +62,16 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
@UiField
|
||||
HTMLPanel containerPickResources;
|
||||
|
||||
@UiField
|
||||
Label labelNothing;
|
||||
|
||||
@UiField
|
||||
HTMLPanel editPanel;
|
||||
|
||||
private Item selectedWEItem;
|
||||
|
||||
public final static HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
Map<String, SelectResourceWidget> mapSelectedResources = new HashMap<String, SelectResourceWidget>();
|
||||
|
||||
/**
|
||||
|
@ -76,30 +89,33 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
*/
|
||||
public SelectResourceByWEMainPanel(ResourceElementBean initialBean) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
this.frozen = false;
|
||||
|
||||
SelectResourceByWEMainPanel.frozen = false;
|
||||
this.initialBean = initialBean;
|
||||
//this.buttPickResources.setType(ButtonType.LINK);
|
||||
|
||||
WorkspaceResourcesExplorerPanel rp = null;
|
||||
|
||||
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
|
||||
DISPLAY_FIELD.OWNER, DISPLAY_FIELD.CREATION_DATE};
|
||||
this.labelNothing.setType(LabelType.INFO);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
String wsRootId = null;
|
||||
String rootName = null;
|
||||
if(initialBean.isFolder()) {
|
||||
wsRootId = initialBean.getOriginalIdInWorkspace();
|
||||
rootName = initialBean.getName();
|
||||
}else {
|
||||
//is file
|
||||
wsRootId= initialBean.getParent()!=null? initialBean.getParent().getOriginalIdInWorkspace():null;
|
||||
|
||||
if(initialBean.getParent()!=null) {
|
||||
wsRootId = initialBean.getParent().getOriginalIdInWorkspace();
|
||||
rootName = initialBean.getParent().getName();
|
||||
}
|
||||
}
|
||||
|
||||
//loads the WE only if the root is not null
|
||||
if(wsRootId!=null) {
|
||||
|
||||
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
|
||||
DISPLAY_FIELD.OWNER, DISPLAY_FIELD.CREATION_DATE};
|
||||
|
||||
WorkspaceResourcesExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesExplorerPanel(wsRootId,false,null, null,false,null,displayFields);
|
||||
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
|
@ -132,6 +148,10 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
}else {
|
||||
containerPickResources.setVisible(false);
|
||||
}
|
||||
|
||||
if(rootName!=null) {
|
||||
buttPickResources.setHeading("Add files from "+rootName);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -141,7 +161,12 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
if(!initialBean.isFolder()) {
|
||||
addSelectResource(initialBean.getOriginalIdInWorkspace(), initialBean.getName(),initialBean.getFullPath());
|
||||
}
|
||||
|
||||
addHandlers();
|
||||
|
||||
}
|
||||
|
||||
private void addHandlers() {
|
||||
|
||||
buttSelectResource.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
@ -154,8 +179,54 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(RemovePublishingResourceEvent.TYPE, new RemovePublishingResourceEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRemoveResource(RemovePublishingResourceEvent removeResourceEvent) {
|
||||
if(removeResourceEvent.getResource()!=null) {
|
||||
removePublishingResource(removeResourceEvent.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
eventBus.addHandler(EditPublishingResourceEvent.TYPE, new EditPublishingResourceEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onEditResource(EditPublishingResourceEvent editResourceEvent) {
|
||||
if(editResourceEvent.getResource()!=null) {
|
||||
editPublishingResource(editResourceEvent.getResource());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void editPublishingResource(ResourceElementBean resource) {
|
||||
|
||||
SelectResourceWidget theRW = mapSelectedResources.get(resource.getOriginalIdInWorkspace());
|
||||
if(theRW!=null) {
|
||||
|
||||
ResourceInfoForm rif = new ResourceInfoForm(resource, null);
|
||||
editPanel.add(rif);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void removePublishingResource(ResourceElementBean resource) {
|
||||
|
||||
SelectResourceWidget theRW = mapSelectedResources.get(resource.getOriginalIdInWorkspace());
|
||||
if(theRW!=null) {
|
||||
selectResourcesContainer.remove(theRW);
|
||||
mapSelectedResources.remove(resource.getOriginalIdInWorkspace());
|
||||
}
|
||||
|
||||
showNothingResourceSelected();
|
||||
}
|
||||
|
||||
public void addSelectResource(String wsItemId, String name, String path) {
|
||||
|
||||
SelectResourceWidget selWidg = mapSelectedResources.get(wsItemId);
|
||||
|
@ -163,7 +234,7 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
showAlertMsg(AlertType.WARNING,"Item '" + name + "' already selected",true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ResourceElementBean rb = new ResourceElementBean();
|
||||
rb.setOriginalIdInWorkspace(wsItemId);
|
||||
rb.setName(name);
|
||||
|
@ -174,6 +245,15 @@ public class SelectResourceByWEMainPanel extends Composite {
|
|||
mapSelectedResources.put(wsItemId, selWidg);
|
||||
selectResourcesContainer.add(selWidg);
|
||||
|
||||
showNothingResourceSelected();
|
||||
|
||||
}
|
||||
|
||||
private void showNothingResourceSelected() {
|
||||
if(mapSelectedResources.size()==0) {
|
||||
labelNothing.setVisible(true);
|
||||
}else
|
||||
labelNothing.setVisible(false);
|
||||
}
|
||||
|
||||
private void showAlertMsg(AlertType type, String txt, boolean autoHide) {
|
||||
|
|
|
@ -7,33 +7,55 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.margin-bottom-40 {
|
||||
margin-bottom: 40px;
|
||||
.custom-header {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.custom-header h1 {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.max-height-250 {
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0px !important;
|
||||
}
|
||||
|
||||
.margin-top-10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.margin-top-20 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel width="96%">
|
||||
<g:HTMLPanel addStyleNames="{style.margin-bottom-40}">
|
||||
<b:PageHeader subtext="Resources">Selected</b:PageHeader>
|
||||
<b:Alert ui:field="showAlert" visible="false"></b:Alert>
|
||||
<g:VerticalPanel ui:field="selectResourcesContainer"></g:VerticalPanel>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<b:PageHeader addStyleNames="{style.custom-header}">Publishing Resources</b:PageHeader>
|
||||
<b:Alert ui:field="showAlert" visible="false"></b:Alert>
|
||||
<g:VerticalPanel ui:field="selectResourcesContainer">
|
||||
<b:Label ui:field="labelNothing">Nothing</b:Label>
|
||||
</g:VerticalPanel>
|
||||
<g:HTMLPanel ui:field="editPanel">
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="containerPickResources">
|
||||
|
||||
<g:HTMLPanel ui:field="containerPickResources"
|
||||
addStyleNames="{style.margin-top-20}">
|
||||
<b:AccordionGroup ui:field="buttPickResources"
|
||||
heading="Pick Resources" defaultOpen="true">
|
||||
heading="Add files from..." defaultOpen="false"
|
||||
addStyleNames="{style.no-border}">
|
||||
<b:FluidRow addStyleNames="{style.max-height-250}">
|
||||
<g:VerticalPanel ui:field="wsContainer">
|
||||
</g:VerticalPanel>
|
||||
</b:FluidRow>
|
||||
<b:Button ui:field="buttSelectResource">Select</b:Button>
|
||||
<b:Button ui:field="buttSelectResource"
|
||||
addStyleNames="{style.margin-top-10}">Select</b:Button>
|
||||
</b:AccordionGroup>
|
||||
|
||||
</g:HTMLPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -5,6 +5,8 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElement
|
|||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
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.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -24,26 +26,53 @@ public class SelectResourceWidget extends Composite {
|
|||
|
||||
@UiField
|
||||
Button buttonDelete;
|
||||
|
||||
|
||||
@UiField
|
||||
Button buttonEdit;
|
||||
|
||||
|
||||
@UiField
|
||||
Label fieldName;
|
||||
|
||||
private ResourceElementBean resourceBean;
|
||||
|
||||
|
||||
public SelectResourceWidget(ResourceElementBean rb) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
|
||||
this.resourceBean = rb;
|
||||
|
||||
|
||||
this.fieldName.setText(rb.getEditableName());
|
||||
|
||||
|
||||
buttonEdit.setType(ButtonType.LINK);
|
||||
|
||||
buttonDelete.setType(ButtonType.LINK);
|
||||
|
||||
addHandlers();
|
||||
|
||||
}
|
||||
|
||||
private void addHandlers() {
|
||||
|
||||
buttonEdit.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SelectResourceByWEMainPanel.eventBus.fireEvent(new EditPublishingResourceEvent(resourceBean));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
buttonDelete.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SelectResourceByWEMainPanel.eventBus.fireEvent(new RemovePublishingResourceEvent(resourceBean));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public ResourceElementBean getResourceBean() {
|
||||
return resourceBean;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -159,7 +159,17 @@ public class WorkspaceUtils {
|
|||
|
||||
//setting parent id
|
||||
ResourceElementBean theParent = new ResourceElementBean();
|
||||
theParent.setOriginalIdInWorkspace(originalFolderOrFile.getParentId());
|
||||
|
||||
if(originalFolderOrFile.getParentId()!=null) {
|
||||
try {
|
||||
WorkspaceItem parentItem = workspace.getItem(originalFolderOrFile.getParentId());
|
||||
theParent.setOriginalIdInWorkspace(parentItem.getId());
|
||||
theParent.setName(parentItem.getName());
|
||||
}catch (Exception e) {
|
||||
logger.warn("Error on loading the parent item with id: "+originalFolderOrFile.getParentId()+" skipping it");
|
||||
}
|
||||
}
|
||||
|
||||
resourceEB.setParent(theParent);
|
||||
bean.setResourceRoot(resourceEB);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue