edit_facility_26115 #3

Merged
francesco.mangiacrapa merged 11 commits from edit_facility_26115 into master 2024-03-19 10:17:19 +01:00
38 changed files with 481 additions and 3450 deletions

View File

@ -4,6 +4,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.1-SNAPSHOT] - 2024-02-02
#### Enhancements
- [#26656] Aligned the data-model to ckan-metadata-publisher-widget
## [v2.1.0] - 2023-02-01
#### Enhancements

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>metadata-profile-form-builder-widget</artifactId>
<packaging>jar</packaging>
<version>2.1.0</version>
<version>2.1.1-SNAPSHOT</version>
<name>Metadata Profile Form Builder</name>
<description>
The Metadata Profile Form Builder is a widget able to build dynamically a web form by reading "gCube Metadata Profile/s"

View File

@ -1,33 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import com.google.gwt.event.shared.GwtEvent;
/**
* Added resource event
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class AddResourceEvent extends GwtEvent<AddResourceEventHandler> {
public static Type<AddResourceEventHandler> TYPE = new Type<AddResourceEventHandler>();
private ResourceElementBean resource;
public AddResourceEvent(ResourceElementBean resource) {
this.resource = resource;
}
public ResourceElementBean getResource() {
return resource;
}
@Override
public Type<AddResourceEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(AddResourceEventHandler handler) {
handler.onAddedResource(this);
}
}

View File

@ -1,11 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* Added resource handler interface
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface AddResourceEventHandler extends EventHandler {
void onAddedResource(AddResourceEvent addResourceEvent);
}

View File

@ -0,0 +1,33 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile;
import com.google.gwt.event.shared.GwtEvent;
/**
* Added resource event
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class AddResourceEventProfile extends GwtEvent<AddResourceEventProfileHandler> {
public static Type<AddResourceEventProfileHandler> TYPE = new Type<AddResourceEventProfileHandler>();
private ResourceElementBeanProfile resource;
public AddResourceEventProfile(ResourceElementBeanProfile resource) {
this.resource = resource;
}
public ResourceElementBeanProfile getResource() {
return resource;
}
@Override
public Type<AddResourceEventProfileHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(AddResourceEventProfileHandler handler) {
handler.onAddedResource(this);
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface AddResourceEventProfileHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 12, 2024
*/
public interface AddResourceEventProfileHandler extends EventHandler {
/**
* On added resource.
*
* @param addResourceEvent the add resource event
*/
void onAddedResource(AddResourceEventProfile addResourceEvent);
}

View File

@ -1,27 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.GwtEvent;
/**
* Called on close form.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class CloseCreationFormEvent extends GwtEvent<CloseCreationFormEventHandler>{
public static Type<CloseCreationFormEventHandler> TYPE = new Type<CloseCreationFormEventHandler>();
public CloseCreationFormEvent() {
super();
}
@Override
public Type<CloseCreationFormEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CloseCreationFormEventHandler handler) {
handler.onClose(this);
}
}

View File

@ -1,13 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* Close event handler interface
* @author Costantino Perciante at ISTI-CNR
* (costantino.perciante@isti.cnr.it)
*
*/
public interface CloseCreationFormEventHandler extends EventHandler {
void onClose(CloseCreationFormEvent event);
}

View File

@ -0,0 +1,44 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class CloseCreationFormProfileEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 12, 2024
*/
public class CloseCreationFormProfileEvent extends GwtEvent<CloseCreationFormProfileEventHandler>{
public static Type<CloseCreationFormProfileEventHandler> TYPE = new Type<CloseCreationFormProfileEventHandler>();
/**
* Instantiates a new close creation form profile event.
*/
public CloseCreationFormProfileEvent() {
super();
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<CloseCreationFormProfileEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(CloseCreationFormProfileEventHandler handler) {
handler.onClose(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface CloseCreationFormProfileEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 12, 2024
*/
public interface CloseCreationFormProfileEventHandler extends EventHandler {
/**
* On close.
*
* @param event the event
*/
void onClose(CloseCreationFormProfileEvent event);
}

View File

@ -1,32 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry;
import com.google.gwt.event.shared.GwtEvent;
/**
* Delete custom field event.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class DeleteCustomFieldEvent extends GwtEvent<DeleteCustomFieldEventHandler> {
public static Type<DeleteCustomFieldEventHandler> TYPE = new Type<DeleteCustomFieldEventHandler>();
private CustomFieldEntry removedEntry;
public DeleteCustomFieldEvent(CustomFieldEntry removedEntry) {
this.removedEntry = removedEntry;
}
public CustomFieldEntry getRemovedEntry() {
return removedEntry;
}
@Override
public Type<DeleteCustomFieldEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(DeleteCustomFieldEventHandler handler) {
handler.onRemoveEntry(this);
}
}

View File

@ -0,0 +1,32 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile;
import com.google.gwt.event.shared.GwtEvent;
/**
* Delete custom field event.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class DeleteCustomFieldProfileEvent extends GwtEvent<DeleteCustomFieldProfileEventHandler> {
public static Type<DeleteCustomFieldProfileEventHandler> TYPE = new Type<DeleteCustomFieldProfileEventHandler>();
private CustomFieldEntryProfile removedEntry;
public DeleteCustomFieldProfileEvent(CustomFieldEntryProfile removedEntry) {
this.removedEntry = removedEntry;
}
public CustomFieldEntryProfile getRemovedEntry() {
return removedEntry;
}
@Override
public Type<DeleteCustomFieldProfileEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(DeleteCustomFieldProfileEventHandler handler) {
handler.onRemoveEntry(this);
}
}

View File

@ -3,9 +3,9 @@ package org.gcube.portlets.widgets.mpformbuilder.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* Handler associated to the DeleteCustomFieldEvent
* Handler associated to the DeleteCustomFieldProfileEvent
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface DeleteCustomFieldEventHandler extends EventHandler {
void onRemoveEntry(DeleteCustomFieldEvent event);
public interface DeleteCustomFieldProfileEventHandler extends EventHandler {
void onRemoveEntry(DeleteCustomFieldProfileEvent event);
}

View File

@ -1,34 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import com.google.gwt.event.shared.GwtEvent;
/**
* Deleted resource event.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class DeleteResourceEvent extends GwtEvent<DeleteResourceEventHandler> {
public static Type<DeleteResourceEventHandler> TYPE = new Type<DeleteResourceEventHandler>();
private ResourceElementBean resource;
public DeleteResourceEvent(ResourceElementBean resource) {
this.resource = resource;
}
public ResourceElementBean getResource() {
return resource;
}
@Override
public Type<DeleteResourceEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(DeleteResourceEventHandler handler) {
handler.onDeletedResource(this);
}
}

View File

@ -0,0 +1,34 @@
package org.gcube.portlets.widgets.mpformbuilder.client.events;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile;
import com.google.gwt.event.shared.GwtEvent;
/**
* Deleted resource event.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class DeleteResourceProfileEvent extends GwtEvent<DeleteResourceProfileEventHandler> {
public static Type<DeleteResourceProfileEventHandler> TYPE = new Type<DeleteResourceProfileEventHandler>();
private ResourceElementBeanProfile resource;
public DeleteResourceProfileEvent(ResourceElementBeanProfile resource) {
this.resource = resource;
}
public ResourceElementBeanProfile getResource() {
return resource;
}
@Override
public Type<DeleteResourceProfileEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(DeleteResourceProfileEventHandler handler) {
handler.onDeletedResource(this);
}
}

View File

@ -6,6 +6,6 @@ import com.google.gwt.event.shared.EventHandler;
* The delete event handler
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface DeleteResourceEventHandler extends EventHandler{
void onDeletedResource(DeleteResourceEvent deleteResourceEvent);
public interface DeleteResourceProfileEventHandler extends EventHandler{
void onDeletedResource(DeleteResourceProfileEvent deleteResourceEvent);
}

View File

@ -1,410 +0,0 @@
<!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:m="urn:import:org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags">
<ui:style>
.form-main-style {
margin-left: 10px !important;
}
.fieldset-border-style {
border: 1px groove #444 !important;
-webkit-box-shadow: 0px 0px 0px 0px #000;
box-shadow: 0px 0px 0px 0px #000 !important;
padding: 10px !important;
}
.legend-style {
width: auto !important;
padding: 10px !important;
margin-bottom: 0px !important;
}
@external .form-horizontal .input-large;
.form-horizontal .input-large .input-prepend {
width: 95%;
}
.block-alert-style {
margin-top: 10px;
padding: 10px;
margin-bottom: 10px;
}
.tagsPanelStyle {
display: inline-block;
}
.selected-profile {
font-weight: bold;
}
.label-go-to-product {
display: inline-block;
vertical-align: middle;
font-weight: bold;
}
.the-margin-left{
margin-left: 5px;
}
</ui:style>
<g:HTMLPanel ui:field="createDatasetMainPanel">
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
ui:field="formFirstStep" visible="true">
<b:Fieldset styleName="{style.fieldset-border-style}">
<b:Legend styleName="{style.legend-style}">
Insert Item Information
<small>
<span style="color:red;">*</span>
is required
</small>
</b:Legend>
<!-- Alert blocks for info/errors -->
<b:AlertBlock type="INFO" close="false" animation="true"
visible="false" ui:field="infoBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
<b:ControlGroup ui:field="productTitleGroup">
<b:ControlLabel for="title" title="Item title">
<font color="red">*</font>
Title :
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="Item title"
width="90%" b:id="title" title="Item title" ui:field="titleTextBox" />
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverTitle" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelTitle">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconTitle" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel for="description" title="Item description">
Description:
</b:ControlLabel>
<b:Controls>
<b:TextArea placeholder="eg. Some useful notes about the item"
width="90%" alternateSize="LARGE" b:id="description" title="Item description"
ui:field="descriptionTextarea"></b:TextArea>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverDescription" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelDescription">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconDescription" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<!-- TAGS Panel -->
<m:TagsPanel ui:field="tagsPanel"></m:TagsPanel>
<b:ControlGroup>
<b:ControlLabel for="licenses" title="License">License:</b:ControlLabel>
<b:Controls>
<b:ListBox b:id="licenses" title="Item license"
width="91%" ui:field="licenseListbox">
</b:ListBox>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverLicenses" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelLicenses">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconLicenses" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel for="licenseUrl" title="Selected License'url">Selected
License Url:</b:ControlLabel>
<b:Controls>
<b:Paragraph ui:field="unavailableUrl" visible="true">
<b>Unavailable</b>
</b:Paragraph>
<g:Anchor ui:field="licenseUrlAnchor" target="_blank"
visible="false"></g:Anchor>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel for="visibility" title="Visibility of the item">Visibility:</b:ControlLabel>
<b:Controls>
<b:ListBox b:id="visibility" title="Item visibility"
width="91%" ui:field="visibilityListbox">
<g:item title="restricted">Restricted</g:item>
<g:item enabled="true" title="public">Public</g:item>
</b:ListBox>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverVisibility" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelVisibility">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconVisibility" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="organizationsGroup">
<b:ControlLabel for="organization"
title="Select the organizations in which you want
to publish the item">Publish in:</b:ControlLabel>
<b:Controls>
<b:ListBox b:id="organization" alternateSize="LARGE"
width="91%" title="Publish in this organization" ui:field="organizationsListbox">
</b:ListBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="versionControlGroup">
<b:ControlLabel for="version"
title="Item version expressed as positive integer number">
Version:
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="1.0" b:id="version"
width="90%" title="Item version" ui:field="versionTextbox" />
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel for="author" title="Item author">
<font color="red">*</font>
Author:
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" width="90%"
placeholder="Joe Bloggs" enabled="false" b:id="author" title="Item author"
ui:field="authorTextbox" />
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverAuthor" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelAuthor">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconAuthor" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="authorEmailControlGroup">
<b:ControlLabel for="email" title="Item author's email">
<font color="red">*</font>
Author Email:
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" width="90%"
placeholder="joe.bloggs@example.com" enabled="false" b:id="email"
title="Item author" ui:field="authorEmailTextbox" />
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverAuthorEmail" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelAuthorEmail">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconAuthorEmail" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel for="maintainer" title="Item maintainer">
Maintainer:
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="Joe Bloggs"
width="90%" b:id="maintainer" title="Item maintainer"
ui:field="maintainerTextbox" />
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverMaintainer" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelMaintainer">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconMaintainer" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="maintainerControlGroup">
<b:ControlLabel for="emailMaintaner" title="Item author's email">
Maintainer Email:
</b:ControlLabel>
<b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="maintainer@example.com"
width="90%" b:id="emailMaintaner" title="Item author"
ui:field="maintainerEmailTextbox" />
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverMaintainerEmail" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelMaintainerEmail">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconMaintainerEmail" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="metadataTypesControlGroup">
<b:ControlLabel for="metadataTypes" title="Item profile types">Types:</b:ControlLabel>
<b:Controls>
<b:ListBox b:id="metadataTypes" alternateSize="LARGE"
width="91%" title="The item type to be used"
ui:field="metadataTypeListbox">
<g:item enabled="true" title="None">none</g:item>
</b:ListBox>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverTypes" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelTypes">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconTypes" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="groupsControlGroup"
visible="false">
<b:ControlLabel for="groups" title="The groups for this item">Item Groups:</b:ControlLabel>
<b:Controls>
<b:ListBox b:id="groups" alternateSize="LARGE" width="91%"
multipleSelect="true"
title="The groups for this item (Hold CTRL or Command button for multiple selection)"
ui:field="groupsListbox">
</b:ListBox>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverGroups" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelGroups">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconGroups" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<!-- Alert block on continue -->
<b:AlertBlock animation="true" visible="false"
ui:field="alertNoResources"
text="Please note that the item you are going to publish will not have resources.">
</b:AlertBlock>
<!-- Alert block on continue -->
<b:AlertBlock type="INFO" close="false" animation="true"
visible="false" ui:field="onContinueAlertBlock">
</b:AlertBlock>
<b:Button title="Continue" ui:field="continueButton" type="PRIMARY"
block="true">Continue</b:Button>
<b:Button title="Reset" ui:field="resetButton" block="true">Reset</b:Button>
</b:Fieldset>
</b:Form>
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
ui:field="formSecondStep" visible="false">
<b:Fieldset styleName="{style.fieldset-border-style}">
<b:Legend styleName="{style.legend-style}">
Manage Resources
</b:Legend>
<b:ControlGroup>
<b:Controls>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverResources" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelResources">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconResources" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<g:SimplePanel ui:field="workspaceResourcesContainer"
width="100%" visible="true">
</g:SimplePanel>
<b:Button title="Continue" ui:field="continueThirdStep"
type="PRIMARY" block="true">Continue</b:Button>
<b:Button title="Go Back" ui:field="goBackButtonFirstStep"
block="true">Go
Back</b:Button>
</b:Fieldset>
</b:Form>
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
ui:field="formThirdStep" visible="false">
<b:Fieldset styleName="{style.fieldset-border-style}">
<b:Legend styleName="{style.legend-style}">
Insert Item Profile Information
<small>
<span style="color:red;">*</span>
is required
</small>
</b:Legend>
<b:Paragraph ui:field="selectedProfile" styleName="{style.selected-profile}"></b:Paragraph>
<!-- Here will be placed the metadata fields formats -->
<g:VerticalPanel ui:field="metadataFieldsPanel"
visible="false" width="100%"></g:VerticalPanel>
<!-- Custom fields can be dinamically added -->
<b:ControlGroup ui:field="customFields">
<b:ControlLabel>Custom Field(s):</b:ControlLabel>
</b:ControlGroup>
<b:ControlGroup>
<b:Controls>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverCustomFields" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelCustomFields">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconCustomFields" />
</g:FocusPanel>
</b:Popover>
</span>
<b:Button icon="PLUS_SIGN" title="Add Custom Field"
ui:field="addCustomFieldButton"></b:Button>
</b:Controls>
</b:ControlGroup>
<!-- Alert block on create -->
<b:AlertBlock type="INFO" close="false" animation="true"
visible="false" ui:field="onCreateAlertBlock" styleName="{style.block-alert-style}">
</b:AlertBlock>
<g:HorizontalPanel ui:field="goToDatasetButtonPanel" visible="false">
<g:Label>Go to the Item</g:Label>
<b:Button title="Go to the Item" ui:field="goToDatasetButton"
type="LINK" visible="false" styleName="{style.the-margin-left}"></b:Button>
</g:HorizontalPanel>
<b:Button title="Add resources to the just created item"
block="true" type="PRIMARY" visible="false" ui:field="addResourcesButton">Add Resources</b:Button>
<b:Button title="Create Item" ui:field="createButton"
type="PRIMARY" block="true">Create</b:Button>
<b:Button title="Go Back" ui:field="goBackButtonSecondStep"
block="true">Go
Back</b:Button>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -8,24 +8,23 @@ import java.util.Map;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderService;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.HasGenericFormListenerRegistration;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.CustomLegend;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.LoaderIcon;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBeanProfile;
import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
@ -205,9 +204,6 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
/** The Constant TRYING_TO_CREATE_PRODUCT. */
private static final String DATA_FORM_FILLED_IN_CORRECTLY = "Very well!!! Data form filled in correclty!";
/** The Constant MISSING_PUBLISH_RIGHTS. */
protected static final String MISSING_PUBLISH_RIGHTS = "It seems you are not authorized to publish on catalogue. Request it to the VRE manager or the portal administrator.";
/** The tab panel. */
// tab panel
private TabPanel tabPanel;
@ -228,7 +224,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
/** The custom field entries list. */
// added custom field entries (by the user)
private List<CustomFieldEntry> customFieldEntriesList = new ArrayList<CustomFieldEntry>();
private List<CustomFieldEntryProfile> customFieldEntriesList = new ArrayList<CustomFieldEntryProfile>();
/** The list of metadata fields. */
// the list of MetaDataField added
@ -243,7 +239,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
/** The resources twin panel. */
// resource table
private TwinColumnSelectionMainPanel resourcesTwinPanel;
//private TwinColumnSelectionMainPanel resourcesTwinPanel;
/** The popup opened ids. */
// List of opened popup'ids
@ -390,19 +386,19 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
*/
private void bind() {
// when a custom field is removed, remove it from the list
uiBus.addHandler(DeleteCustomFieldEvent.TYPE, new DeleteCustomFieldEventHandler() {
uiBus.addHandler(DeleteCustomFieldProfileEvent.TYPE, new DeleteCustomFieldProfileEventHandler() {
@Override
public void onRemoveEntry(DeleteCustomFieldEvent event) {
public void onRemoveEntry(DeleteCustomFieldProfileEvent event) {
customFieldEntriesList.remove(event.getRemovedEntry());
customFields.remove(event.getRemovedEntry());
}
});
// on close form
uiBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() {
uiBus.addHandler(CloseCreationFormProfileEvent.TYPE, new CloseCreationFormProfileEventHandler() {
@Override
public void onClose(CloseCreationFormEvent event) {
public void onClose(CloseCreationFormProfileEvent event) {
InfoIconsLabels.closeDialogBox(popupOpenedIds);
}
});
@ -433,7 +429,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
* @param listFileUploaded the file uploaded
*/
private void prepareMetadataList(final List<MetaDataProfileBean> profiles,
List<? extends FileUploaded> listFileUploaded) {
final List<? extends FileUploaded> listFileUploaded) {
if (profiles != null && !profiles.isEmpty()) {
GWT.log("Building form/s for profile/s: " + profiles);
@ -611,7 +607,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
@UiHandler("addCustomFieldButton")
void addCustomFieldEvent(ClickEvent e) {
CustomFieldEntry toAdd = new CustomFieldEntry(uiBus, "", "", true);
CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(uiBus, "", "", true);
customFieldEntriesList.add(toAdd);
customFields.add(toAdd);
@ -633,8 +629,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
} else {
// Set<String> tags = new HashSet<String>(tagsPanel.getTags());
List<OrganizationBean> groups = new ArrayList<OrganizationBean>();
List<OrganizationBean> groupsToForceCreation = new ArrayList<OrganizationBean>();
List<OrganizationBeanProfile> groups = new ArrayList<OrganizationBeanProfile>();
List<OrganizationBeanProfile> groupsToForceCreation = new ArrayList<OrganizationBeanProfile>();
LinkedHashMap<String, List<String>> customFieldsMap = new LinkedHashMap<String, List<String>>();
List<FileUploaded> listFilesUploaded = new ArrayList<FileUploaded>();
@ -673,10 +669,10 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
if (groupsTitle != null) {
for (String groupTitle : groupsTitle) {
if (field.isGroupToForce())
groupsToForceCreation.add(new OrganizationBean(groupTitle, groupTitle, false,
groupsToForceCreation.add(new OrganizationBeanProfile(groupTitle, groupTitle, false,
field.isPropagateUp()));
else
groups.add(new OrganizationBean(groupTitle, groupTitle, false,
groups.add(new OrganizationBeanProfile(groupTitle, groupTitle, false,
field.isPropagateUp()));
}
}
@ -686,7 +682,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
}
}
for (CustomFieldEntry customEntry : customFieldEntriesList) {
for (CustomFieldEntryProfile customEntry : customFieldEntriesList) {
String key = customEntry.getKey();
String value = customEntry.getValue();
if (value != null && !value.isEmpty()) {
@ -856,7 +852,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
/*
* @UiHandler("resetButton") void resetFormEvent(ClickEvent e){
*
* // delete custom fields for (CustomFieldEntry customField :
* // delete custom fields for (CustomFieldEntryProfile customField :
* customFieldEntriesList) { customField.removeFromParent(); }
* customFieldEntriesList.clear(); }
*/
@ -871,7 +867,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
addCustomFieldButton.setEnabled(!bool);
metadataTypeListbox.setEnabled(!bool);
for (CustomFieldEntry ce : customFieldEntriesList)
for (CustomFieldEntryProfile ce : customFieldEntriesList)
ce.freeze(!bool);
// disable profile fields
@ -882,9 +878,9 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
}
// freeze table of resources
if (resourcesTwinPanel != null)
resourcesTwinPanel.freeze(bool);
// // freeze table of resources
// if (resourcesTwinPanel != null)
// resourcesTwinPanel.freeze(bool);
// TRUE in UPDATE MODE - freeze manage of current content (means file already
// uploaded)

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEvent;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.InputAddOn;
@ -18,13 +18,13 @@ import com.google.gwt.user.client.ui.Widget;
* A custom field entry that has two textboxes, one for the key value and the other for the value.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class CustomFieldEntry extends Composite {
public class CustomFieldEntryProfile extends Composite {
private static CustomFieldEntryUiBinder uiBinder = GWT
.create(CustomFieldEntryUiBinder.class);
interface CustomFieldEntryUiBinder extends
UiBinder<Widget, CustomFieldEntry> {
UiBinder<Widget, CustomFieldEntryProfile> {
}
@UiField InputAddOn keyFieldPrepend;
@ -39,7 +39,7 @@ public class CustomFieldEntry extends Composite {
// event bus
private HandlerManager eventBus;
public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
public CustomFieldEntryProfile(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
initWidget(uiBinder.createAndBindUi(this));
// save information
@ -91,7 +91,7 @@ public class CustomFieldEntry extends Composite {
void onRemoveCustomField(ClickEvent e){
// fire event
eventBus.fireEvent(new DeleteCustomFieldEvent(this));
eventBus.fireEvent(new DeleteCustomFieldProfileEvent(this));
}

View File

@ -3,8 +3,8 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.mpformbuilder.client.openlayerwidget.GeoJsonAreaSelectionDialog;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.timeandranges.DataTimeBox;
@ -546,10 +546,10 @@ public class MetaDataFieldSkeleton extends Composite {
private void bind() {
// on close form
eventBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() {
eventBus.addHandler(CloseCreationFormProfileEvent.TYPE, new CloseCreationFormProfileEventHandler() {
@Override
public void onClose(CloseCreationFormEvent event) {
public void onClose(CloseCreationFormProfileEvent event) {
if (dialog != null)
dialog.hide();

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.resources;
import com.github.gwtbootstrap.client.ui.TabPanel;
import com.github.gwtbootstrap.client.ui.base.StackedNav;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@ -31,7 +31,7 @@ public class AddResourceContainer extends Composite{
* Add the form to this panel
* @param w
*/
public void add(TabPanel w){
public void add(StackedNav w){
resourcesPanel.add(w);
}
}

View File

@ -112,8 +112,8 @@ public class AddResourceToDataset extends Composite{
// collect data and build up the bean
/*//TODO MUST BE DONE IN ANOTHER POINT
*
* final ResourceElementBean resource =
new ResourceElementBean(
* final ResourceElementBeanProfile resource =
new ResourceElementBeanProfile(
resourceNameTextBox.getText(),
true,
false,
@ -130,14 +130,14 @@ public class AddResourceToDataset extends Composite{
addResourceButton.setEnabled(false);
// try to create
ckanServices.addResourceToDataset(resource, datasetId, new AsyncCallback<ResourceElementBean>() {
ckanServices.addResourceToDataset(resource, datasetId, new AsyncCallback<ResourceElementBeanProfile>() {
@Override
public void onSuccess(ResourceElementBean result) {
public void onSuccess(ResourceElementBeanProfile result) {
if(result != null){
showAlert("Resource created correctly", AlertType.SUCCESS);
eventBus.fireEvent(new AddResourceEvent(result));
eventBus.fireEvent(new AddResourceEventProfile(result));
// remove data
resourceUrlTextBox.setText("");

View File

@ -3,11 +3,11 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.resources;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfile;
import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfileHandler;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceProfileEvent;
import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceProfileEventHandler;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile;
import com.github.gwtbootstrap.client.ui.Accordion;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
@ -19,6 +19,7 @@ import com.google.gwt.event.dom.client.ClickHandler;
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.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@ -27,34 +28,31 @@ import com.google.gwt.user.client.ui.Widget;
* A summary of the resources added by the user.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class AddedResourcesSummary extends Composite{
public class AddedResourcesSummaryProfile extends Composite{
private static AddedResourcesSummaryUiBinder uiBinder = GWT
.create(AddedResourcesSummaryUiBinder.class);
interface AddedResourcesSummaryUiBinder extends
UiBinder<Widget, AddedResourcesSummary> {
UiBinder<Widget, AddedResourcesSummaryProfile> {
}
// Event bus
private HandlerManager eventBus;
// list of added resources (beans)
List<ResourceElementBean> addedResources;
List<ResourceElementBeanProfile> addedResources;
@UiField VerticalPanel addResourcesPanel;
public AddedResourcesSummary(HandlerManager eventBus) {
public AddedResourcesSummaryProfile(HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
// save bus
this.eventBus = eventBus;
// bind on add resource event
bind();
// init list
addedResources = new ArrayList<ResourceElementBean>();
addedResources = new ArrayList<ResourceElementBeanProfile>();
}
/**
@ -63,13 +61,14 @@ public class AddedResourcesSummary extends Composite{
private void bind() {
// when a new resource is added
eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() {
eventBus.addHandler(AddResourceEventProfile.TYPE, new AddResourceEventProfileHandler() {
@Override
public void onAddedResource(AddResourceEvent addResourceEvent) {
public void onAddedResource(AddResourceEventProfile addResourceEvent) {
GWT.log("Added resource event: "+addResourceEvent);
// get the resource
final ResourceElementBean justAddedResource = addResourceEvent.getResource();
final ResourceElementBeanProfile justAddedResource = addResourceEvent.getResource();
// Build an accordion to show resource info
Accordion accordion = new Accordion();
@ -91,7 +90,7 @@ public class AddedResourcesSummary extends Composite{
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new DeleteResourceEvent(justAddedResource));
eventBus.fireEvent(new DeleteResourceProfileEvent(justAddedResource));
}
});
@ -110,29 +109,24 @@ public class AddedResourcesSummary extends Composite{
});
// when the user wants to delete a resource
eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() {
eventBus.addHandler(DeleteResourceProfileEvent.TYPE, new DeleteResourceProfileEventHandler() {
@Override
public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) {
public void onDeletedResource(DeleteResourceProfileEvent deleteResourceEvent) {
// to delete
ResourceElementBean toDelete = deleteResourceEvent.getResource();
// find it
ResourceElementBeanProfile toDelete = deleteResourceEvent.getResource();
Window.alert("DELETE RESOURCE MUST BE IMPLEMENTED");
/*
* MUST ME MANAGED IN ANOTHER POINT
*
* for(int i = 0; i < addedResources.size(); i++){
for(int i = 0; i < addedResources.size(); i++){
if(addedResources.get(i).getOriginalIdInWorkspace().equals(toDelete.getOriginalIdInWorkspace())){
if(addedResources.get(i).equals(toDelete)){
// get the associated widget and remove it
final Widget widget = addResourcesPanel.getWidget(i);
// remote call to remove it from the dataset
ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
MetadataProfileFormBuilderServiceAsync.Util.getInstance().deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {
@ -149,11 +143,15 @@ public class AddedResourcesSummary extends Composite{
break;
}
}*/
}
*/
// remove from the list
addedResources.remove(toDelete);
}
});
}
public HandlerManager getEventBus() {
return eventBus;
}
}

View File

@ -176,6 +176,12 @@ public class TagsPanel extends Composite{
if(tagsList.contains(tag))
return;
//selecting the item of the vocabulary
if(vocabulary!= null && vocabulary.size()>0) {
tagsEnterListBox.setSelectedValue(tag);
return;
}
// ckan accepts only alphanumeric values
String[] subTags = tag.trim().split(" ");

View File

@ -1,46 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.Image;
/**
* Cell that renders left side panel objects
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ResourceCellLeft extends AbstractCell<ResourceElementBean>{
private static final Images image = GWT.create(Images.class);
private static final String tipFile = "Hold down the Control (ctrl) or Command button to select multiple options";
private static final String tipFolder = "Click on the folder to navigate it";
@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
ResourceElementBean value, SafeHtmlBuilder sb) {
if (value == null || value.isToBeAdded()) {
return;
}
Image file = new Image(image.fileIcon());
Image folder = new Image(image.folderIcon());
file.setWidth("15px");
file.setHeight("15px");
folder.setWidth("15px");
folder.setHeight("15px");
String whichTip = value.isFolder() ? tipFolder : tipFile;
sb.appendHtmlConstant("<div title='" + value.getName() + "( " + whichTip + " )" + "' style='overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:240px; min-height:30px; padding-top:5px;'>");
sb.appendHtmlConstant("<span style='margin-left:5px;'>");
sb.appendHtmlConstant(value.isFolder() ? folder.toString() : file.toString());
sb.appendHtmlConstant("</span>");
sb.appendHtmlConstant("<span style='margin-left:10px;'>");
sb.appendHtmlConstant("<b>");
sb.appendEscaped(value.getName());
sb.appendHtmlConstant("</b>");
sb.appendHtmlConstant("</span>");
sb.appendHtmlConstant("</div>");
}
}

View File

@ -1,65 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.Image;
/**
* Cell that renders right side panel objects
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ResourceCellRight extends AbstractCell<ResourceElementBean>{
private static final Images image = GWT.create(Images.class);
private static final String tip = "Hold down the Control (CTRL) or Command button to select multiple options. Double click to access "
+ "this resource information";
public ResourceCellRight() {
super("keydown", "dblclick");
}
@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
ResourceElementBean value, SafeHtmlBuilder sb) {
if (value == null || !value.isToBeAdded() || value.isFolder()) {
return;
}
Image file = new Image(image.fileIcon());
file.setWidth("15px");
file.setHeight("15px");
sb.appendHtmlConstant("<div title='" + value.getName() + "( " + tip + " )" + "' style='overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:240px; min-height:30px; padding-top:5px;'>");
sb.appendHtmlConstant("<span style='margin-left:5px'>");
sb.appendHtmlConstant(file.toString());
sb.appendHtmlConstant("</span>");
sb.appendHtmlConstant("<span style='margin-left:10px'>");
sb.appendHtmlConstant("<b>");
sb.appendEscaped(value.getEditableName());
sb.appendHtmlConstant("</b>");
sb.appendHtmlConstant("</span>");
sb.appendHtmlConstant("</div>");
}
@Override
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context,
Element parent, ResourceElementBean value, NativeEvent event,
ValueUpdater<ResourceElementBean> valueUpdater) {
if(value == null || TwinColumnSelectionMainPanel.isFroozen())
return;
super.onBrowserEvent(context, parent, value, event, valueUpdater);
ResourceInfoForm info = new ResourceInfoForm(value, valueUpdater);
if(TwinColumnSelectionMainPanel.detailContainer.getWidget() != null)
TwinColumnSelectionMainPanel.detailContainer.clear();
TwinColumnSelectionMainPanel.detailContainer.add(info);
TwinColumnSelectionMainPanel.detailContainer.setVisible(true);
}
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
@ -44,7 +44,7 @@ public class ResourceInfoForm extends Composite{
@UiField
ControlGroup controlName;
private ResourceElementBean resourceBean;
private ResourceElementBeanProfile resourceBean;
private static ResourceInfoFormUiBinder uiBinder = GWT
.create(ResourceInfoFormUiBinder.class);
@ -57,7 +57,7 @@ public class ResourceInfoForm extends Composite{
initWidget(uiBinder.createAndBindUi(this));
}
public ResourceInfoForm(final ResourceElementBean resource, final ValueUpdater<ResourceElementBean> valueUpdater) {
public ResourceInfoForm(final ResourceElementBeanProfile resource, final ValueUpdater<ResourceElementBeanProfile> valueUpdater) {
initWidget(uiBinder.createAndBindUi(this));
resourceBean = resource;

View File

@ -1,571 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean;
import com.github.gwtbootstrap.client.ui.Breadcrumbs;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.FluidContainer;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Unit;
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.cellview.client.CellList;
import com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy.KeyboardPagingPolicy;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
/**
* The twin column panels for selection of the files to attach to the catalague product.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @author Francesco Mangiacrapa at ISTI-CNR
*/
public class TwinColumnSelectionMainPanel extends Composite{
@UiField
VerticalPanel leftContainer;
@UiField
VerticalPanel rightContainer;
@UiField
VerticalPanel buttonsPanel;
@UiField
Button allToRightButton;
@UiField
Button toRightButton;
@UiField
Button toLeftButton;
@UiField
Button allToLeftButton;
// @UiField
// Popover popoverResourceSelection;
// @UiField
// Button resourceInfoButton;
@UiField
Breadcrumbs breadcrumbs;
@UiField
FluidContainer mainContainerResourcesSelection;
// @UiField
// Button getResources;
@UiField
public static SimplePanel detailContainer;
/**
* The breadcrumb subpath with the linked folder
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
private class PathBean{
NavLink link;
ResourceElementBean resourceFolder;
PathBean(NavLink link, ResourceElementBean resourceFolder){
this.link = link;
this.resourceFolder = resourceFolder;
}
}
private static boolean frozen = false;
private List<PathBean> pathListBeans = new ArrayList<PathBean>();
private static final String PANEL_BORDER_COLOR = "#8899a6";
private static final String PANEL_HEIGHT = "400px";
private ShowMorePagerPanel showMorePanelLeft = new ShowMorePagerPanel();
private ShowMorePagerPanel showMorePanelRight = new ShowMorePagerPanel();
private CellList<ResourceElementBean> cellListLeft;
private CellList<ResourceElementBean> cellListRight;
private ListDataProvider<ResourceElementBean> dataProviderLeft = new ListDataProvider<ResourceElementBean>();
private ListDataProvider<ResourceElementBean> dataProviderRight = new ListDataProvider<ResourceElementBean>();
private MultiSelectionModel<ResourceElementBean> selectionModelRight;
private MultiSelectionModel<ResourceElementBean> selectionModelLeft;
private final ResourceElementBean initialBean;
// private final static HTML aboutHeader = new HTML("<b>Resource Manager</b>");
// private final static HTML aboutBody = new HTML("<p style='text-align:justify;'>Move the files you want to attach to the product on the right panel below."
// + " Please consider that any complex hierarchy structure you may have will be flatten.</p>");
// private static final short PATH_THRESHOLD = 1; // TODO
private static TwinColumnSelectionMainPanelUiBinder uiBinder = GWT
.create(TwinColumnSelectionMainPanelUiBinder.class);
interface TwinColumnSelectionMainPanelUiBinder extends
UiBinder<Widget, TwinColumnSelectionMainPanel> {
}
public TwinColumnSelectionMainPanel(ResourceElementBean initialBean) {
initWidget(uiBinder.createAndBindUi(this));
frozen = false;
GWT.log(initialBean.toString());
this.initialBean = initialBean;
buttonsPanel.getElement().getStyle().setMarginTop(50, Unit.PCT);
allToRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
toRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
toLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
allToLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
buttonsPanel.getElement().setAttribute("align", "center");
// popoverResourceSelection.setPlacement(Placement.LEFT);
// popoverResourceSelection.setHeading(aboutHeader.getHTML());
// popoverResourceSelection.setText(aboutBody.getHTML());
// resourceInfoButton.getElement().getStyle().setFloat(Float.RIGHT);
// resourceInfoButton.getElement().getStyle().setPaddingRight(0, Unit.PX);
mainContainerResourcesSelection.getElement().getStyle().setPadding(10, Unit.PX);
breadcrumbs.getElement().getStyle().setBackgroundColor("white");
breadcrumbs.getElement().getStyle().setFontWeight(FontWeight.BOLD);
breadcrumbs.getElement().getStyle().setMarginLeft(0, Unit.PX);
mainContainerResourcesSelection.getElement().getStyle().setMarginLeft(10, Unit.PX);
mainContainerResourcesSelection.getElement().getStyle().setMarginBottom(20, Unit.PX);
mainContainerResourcesSelection.getElement().getStyle().setMarginTop(0, Unit.PX);
prepareHandlers();
initLeftSidePanel(initialBean);
initRightSidePanel();
}
/**
* Initialize the left side panel
*/
private void initLeftSidePanel(final ResourceElementBean initialBean) {
// initialize the left side list
ResourceCellLeft cell = new ResourceCellLeft();
// Set a key provider that provides a unique key for each object.
cellListLeft = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
// set page size
int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1;
cellListLeft.setPageSize(size);
// Add a selection model so we can select cells.
selectionModelLeft = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
cellListLeft.setSelectionModel(selectionModelLeft);
// perform an action on selection
selectionModelLeft.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
if(frozen)
return;
Iterator<ResourceElementBean> selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator();
while (selectedObjectsIterator.hasNext()) {
ResourceElementBean selectedBean = selectedObjectsIterator.next();
if(selectedBean.isFolder()){
// a single folder selected
if(selectionModelLeft.getSelectedSet().size() == 1){
// update path
final NavLink navElem = new NavLink(selectedBean.getName());
navElem.getElement().getStyle().setFontWeight(FontWeight.BOLD);
final PathBean pathBean = new PathBean(navElem, selectedBean);
navElem.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
removeStartingFromBreadcrumbs(navElem, pathBean);
GWT.log("Clicked on element " + pathBean.resourceFolder.getName());
//breadcrumbsUpdater();
ResourceElementBean folder = pathBean.resourceFolder;
Collections.sort(folder.getChildren());
dataProviderLeft.setList(folder.getChildren());
dataProviderLeft.refresh();
}
});
pathListBeans.add(pathBean);
breadcrumbs.add(navElem);
//breadcrumbsUpdater();
Collections.sort(selectedBean.getChildren());
GWT.log("Children " + selectedBean.getChildren());
dataProviderLeft.setList(selectedBean.getChildren());
cellListLeft.setPageSize(selectedBean.getChildren().size());
dataProviderLeft.refresh();
}
selectionModelLeft.setSelected(selectedBean, false);
}
}
// enable the buttons that allows to move the objects to the right
enableMoveToRightButtons(selectionModelLeft.getSelectedSet());
}
});
// set the list into the provider
if(initialBean.isFolder()){
Collections.sort(this.initialBean.getChildren());
dataProviderLeft.setList(this.initialBean.getChildren());
}else
dataProviderLeft.setList(Arrays.asList(this.initialBean));
// add root to breadcrumb
final NavLink root = new NavLink(initialBean.getName());
final PathBean pathBean = new PathBean(root, initialBean);
root.getElement().getStyle().setFontWeight(FontWeight.BOLD);
pathListBeans.add(pathBean);
breadcrumbs.add(root);
root.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
removeStartingFromBreadcrumbs(root, pathBean);
//breadcrumbsUpdater();
// set back the root content list
dataProviderLeft.setList(initialBean.getChildren());
cellListLeft.setPageSize(initialBean.getChildren().size());
dataProviderLeft.refresh();
}
});
// set the cell list into the provider
dataProviderLeft.addDataDisplay(cellListLeft);
// manage showMorePanelLeft
showMorePanelLeft.setDisplay(cellListLeft);
showMorePanelLeft.setHeight(PANEL_HEIGHT);
showMorePanelLeft.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
showMorePanelLeft.getElement().getStyle().setBorderWidth(2, Unit.PX);
showMorePanelLeft.getElement().getStyle().setBorderColor(PANEL_BORDER_COLOR);
// add the list to the leftContainerPanel
leftContainer.add(showMorePanelLeft);
}
/**
* Update the path
* @param navElem
* @param pathBean
*/
public void removeStartingFromBreadcrumbs(NavLink navElem, PathBean pathBean){
// remove data after
Iterator<Widget> iteratorBreadcrumb = breadcrumbs.iterator();
Iterator<PathBean> iteratorListPath = pathListBeans.iterator();
boolean delete = false;
while(iteratorBreadcrumb.hasNext()){
Widget current = iteratorBreadcrumb.next();
if(delete){
current.removeFromParent();
iteratorBreadcrumb.remove();
}
if(!delete && navElem.equals(current))
delete = true;
}
delete = false;
while(iteratorListPath.hasNext()){
PathBean current = iteratorListPath.next();
if(delete)
iteratorListPath.remove();
if(!delete && pathBean.equals(current))
delete = true;
}
}
/**
* Initialize the left side panel
*/
private void initRightSidePanel() {
// initialize the left side list
ResourceCellRight cell = new ResourceCellRight();
// Set a key provider that provides a unique key for each object.
cellListRight = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
cellListRight.setValueUpdater(new ValueUpdater<ResourceElementBean>() {
@Override
public void update(ResourceElementBean value) {
// just redraw the list
cellListRight.redraw();
}
});
// Add a selection model so we can select cells.
selectionModelRight = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
cellListRight.setSelectionModel(selectionModelRight);
// perform an action on selection
selectionModelRight.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
if(frozen)
return;
enableMoveToLeftButtons(selectionModelRight.getSelectedSet());
}
});
// set the cell list into the provider
dataProviderRight.addDataDisplay(cellListRight);
// manage showMorePanelRight
showMorePanelRight.setDisplay(cellListRight);
showMorePanelRight.setHeight(PANEL_HEIGHT);
showMorePanelRight.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
showMorePanelRight.getElement().getStyle().setBorderWidth(2, Unit.PX);
showMorePanelRight.getElement().getStyle().setBorderColor(PANEL_BORDER_COLOR);
// add the list to the leftContainerPanel
rightContainer.add(showMorePanelRight);
}
/**
* Enable/disable the buttons to move objects from left to right properly.
* @param setselectedItemsLeft
*/
private void enableMoveToRightButtons(Set<ResourceElementBean> setselectedItemsLeft){
if(setselectedItemsLeft == null || setselectedItemsLeft.isEmpty()){
allToRightButton.setEnabled(false);
toRightButton.setEnabled(false);
}
else if(setselectedItemsLeft.size() > 1){
allToRightButton.setEnabled(true);
toRightButton.setEnabled(false);
}
else{
allToRightButton.setEnabled(false);
toRightButton.setEnabled(true);
}
}
/**
* Enable/disable the buttons to move objects from right to left properly.
* @param setselectedItemsRight
*/
private void enableMoveToLeftButtons(Set<ResourceElementBean> setselectedItemsRight){
if(setselectedItemsRight == null || setselectedItemsRight.isEmpty()){
allToLeftButton.setEnabled(false);
allToLeftButton.setEnabled(false);
}
else if(setselectedItemsRight.size() > 1){
allToLeftButton.setEnabled(true);
toLeftButton.setEnabled(false);
}
else{
allToLeftButton.setEnabled(false);
toLeftButton.setEnabled(true);
}
}
/**
* Prepare the buttons' handlers
*/
private void prepareHandlers() {
allToRightButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
moveToRight(selectionModelLeft.getSelectedSet());
}
});
toRightButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
moveToRight(selectionModelLeft.getSelectedSet());
}
});
allToLeftButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
moveToLeft(selectionModelRight.getSelectedSet());
}
});
toLeftButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
moveToLeft(selectionModelRight.getSelectedSet());
}
});
}
/**
* Move to right elements
* @param set the elements to move
*/
private void moveToRight(Set<ResourceElementBean> setSelected){
if(setSelected == null || setSelected.isEmpty())
return;
Iterator<ResourceElementBean> iterator = setSelected.iterator();
while (iterator.hasNext()) {
ResourceElementBean resourceElementBean = iterator
.next();
resourceElementBean.setToBeAdded(true);
int indexRight = dataProviderRight.getList().indexOf(resourceElementBean);
if(indexRight >= 0)
dataProviderRight.getList().set(indexRight, resourceElementBean);
else{
dataProviderRight.getList().add(resourceElementBean);
Collections.sort(dataProviderRight.getList());
dataProviderRight.refresh();
}
int indexLeft = dataProviderLeft.getList().indexOf(resourceElementBean);
dataProviderLeft.getList().set(indexLeft, resourceElementBean);
}
}
/**
* Move to left elements
* @param setSelected the elements to move
*/
private void moveToLeft(Set<ResourceElementBean> setSelected){
if(setSelected == null || setSelected.isEmpty())
return;
Iterator<ResourceElementBean> iterator = setSelected.iterator();
while (iterator.hasNext()) {
ResourceElementBean resourceElementBean = iterator.next();
resourceElementBean.setToBeAdded(false);
}
Collections.sort(dataProviderLeft.getList());
dataProviderLeft.refresh();
dataProviderRight.refresh();
}
/**
* Freeze the panel
*/
public void freeze(boolean bool) {
frozen = bool;
Iterator<Widget> iteratorOverPath = breadcrumbs.iterator();
while (iteratorOverPath.hasNext()) {
Widget widget = iteratorOverPath.next();
if(widget instanceof NavLink)
((NavLink)widget).setActive(!bool);
}
allToRightButton.setEnabled(!bool);
toRightButton.setEnabled(!bool);
allToLeftButton.setEnabled(!bool);
toLeftButton.setEnabled(!bool);
}
/**
* Returns the root parent with the children as files to save
* @return the resources to save
*/
public ResourceElementBean getResourcesToPublish(){
List<ResourceElementBean> current = dataProviderRight.getList();
ResourceElementBean toReturn = new ResourceElementBean();
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
for (ResourceElementBean resource : current) {
if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ...
ResourceElementBean beanWithoutChildren = new ResourceElementBean(resource);
beanWithoutChildren.setName(resource.getEditableName());
children.add(beanWithoutChildren);
}
}
toReturn.setChildren(children);
return toReturn;
}
/**
* @return the freezed
*/
public static boolean isFroozen() {
return frozen;
}
// @UiHandler("getResources")
// void getResources(ClickEvent ce){
// getResourcesToPublish();
// }
//
// /**
// * Short the current path if needed
// */
// private void breadcrumbsUpdater(){
//
// // ignore first and last elem
// boolean reduce = (pathListBeans.size() - 2) > PATH_THRESHOLD;
//
// GWT.log("Is to reduce? " + reduce);
//
// GWT.log("Full size is " + pathListBeans.size());
//
// if(!reduce){
// GWT.log("Restore");
// for(int i = 0; i < pathListBeans.size(); i++){
// PathBean bean = pathListBeans.get(i);
// GWT.log("Elem is " + bean.resourceFolder);
// bean.link.setText(bean.resourceFolder.getName());
// bean.link.setVisible(true);
// }
// }else{
// for(int i = 1; i < pathListBeans.size(); i++){
// PathBean bean = pathListBeans.get(i);
//
// if(i == (pathListBeans.size() - 1)){
// bean.link.setText(bean.resourceFolder.getName());
// bean.link.setVisible(true);
// }else if(i == (pathListBeans.size() - 2)){
// GWT.log("The last to modify ****" + bean.resourceFolder.getName());
// bean.link.setText("...");
// bean.link.setVisible(true);
// }else{
// bean.link.setText(bean.resourceFolder.getName());
// bean.link.setVisible(false);
// }
// }
// }
// GWT.log("Updated list is " + pathListBeans.toString());
// }
}

View File

@ -1,58 +0,0 @@
<!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:m="urn:import:org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection">
<ui:style>
</ui:style>
<g:HTMLPanel>
<b:FluidContainer ui:field="mainContainerResourcesSelection">
<!-- <b:FluidRow> -->
<!-- <b:Column offset="6" size="1"> -->
<!-- <b:Popover ui:field="popoverResourceSelection" html="true"> -->
<!-- <b:Button ui:field="resourceInfoButton" type="LINK" icon="INFO_SIGN" -->
<!-- size="LARGE"></b:Button> -->
<!-- </b:Popover> -->
<!-- </b:Column> -->
<!-- </b:FluidRow> -->
<b:FluidRow>
<b:Column size="11">
<b:Breadcrumbs ui:field="breadcrumbs" divider=">"
title="Current path">
</b:Breadcrumbs>
</b:Column>
</b:FluidRow>
<b:FluidRow>
<b:Column size="3" ui:field="leftColumn">
<!-- <b:Button enabled="true" type="LINK" ui:field="goRootButton">Root
level</b:Button> -->
<!-- <b:Button enabled="true" type="LINK" ui:field="goUpButton">Go up</b:Button> -->
<g:VerticalPanel ui:field="leftContainer" width="100%">
</g:VerticalPanel>
</b:Column>
<b:Column size="1" ui:field="centralPanel">
<g:VerticalPanel ui:field="buttonsPanel">
<b:Button ui:field="allToRightButton" name="toRight"
enabled="false" title="Add selected files" text=">>" />
<b:Button ui:field="toRightButton" name="toRight"
enabled="false" title="Add selected file" text=">" />
<b:Button ui:field="toLeftButton" name="toLeft" enabled="false"
title="Remove selected file" text="&lt;" />
<b:Button ui:field="allToLeftButton" name="toRight"
enabled="false" title="Remove selected files" text="&lt;&lt;" />
</g:VerticalPanel>
</b:Column>
<b:Column size="3" ui:field="rightColumn">
<g:VerticalPanel ui:field="rightContainer" width="100%"></g:VerticalPanel>
</b:Column>
<b:Column size="3" ui:field="detailColumn">
<g:SimplePanel ui:field="detailContainer" width="100%"></g:SimplePanel>
</b:Column>
<!-- <b:Column size="2"> -->
<!-- <m:ResourceInfoForm ui:field="resourceInfoForm"></m:ResourceInfoForm> -->
<!-- </b:Column> -->
</b:FluidRow>
</b:FluidContainer>
<!-- <b:Button ui:field="getResources">Get Resources</b:Button> -->
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -4,11 +4,11 @@
package org.gcube.portlets.widgets.mpformbuilder.client.ui.utils;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images;
import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
/**
* The Class LoaderIcon.
@ -19,8 +19,10 @@ import com.google.gwt.user.client.ui.Image;
public class LoaderIcon extends HorizontalPanel{
private Image imgLoading = new Image(Images.ICONS.loading());
//private Image imgLoading = new Image(Images.ICONS.loading());
private HTML txtLoading = new HTML("");
private Icon iconSpinner = new Icon(IconType.SPINNER);
/**
* Instantiates a new loader icon.
@ -37,8 +39,11 @@ public class LoaderIcon extends HorizontalPanel{
*/
public LoaderIcon() {
setStyleName("marginTop20");
add(imgLoading);
add(txtLoading);
iconSpinner.setSpin(true);
iconSpinner.getElement().getStyle().setProperty("animation", "spin 1s infinite linear");
iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX);
add(iconSpinner);
}
/**

View File

@ -1,335 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
/**
* This bean will contain during ckan metadata creation information related to the future build.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
@SuppressWarnings("serial")
public class DatasetBean implements Serializable {
private String id;
private String title;
private String description;
private String license; // chosen by the user
private String source; // url of the folder in the workspace
private String authorName; // author name
private String authorSurname; // author surname
private String authorFullName;
private String authorEmail; // owner's email
private String maintainer;
private String maintainerEmail;
private String ownerIdentifier; // owner of the folder into the workspace (e.g., andrea.rossi)
private String chosenType; // the name of the MetaDataType chosen
private String selectedOrganization;
private long version; // version 1, 2 ...
private boolean visible; // Private (false) or Public(true)
private List<OrganizationBean> organizationList; // list of organization in which the user is present and could create the dataset
private ResourceElementBean resourceRoot; // in case of workspace, this is the directory root or the single file information
private List<MetaDataProfileBean> metadataList;
private List<String> tags; // on retrieve, they are the keys of the product
private List<String> tagsVocabulary; // when available
private Map<String, List<String>> customFields;
private List<OrganizationBean> groups;
private List<OrganizationBean> groupsForceCreation;
public DatasetBean(){
super();
}
/** Create a metadata bean object.
* @param id
* @param title
* @param description
* @param customFields
* @param tags
* @param license
* @param visibility
* @param source
* @param version
* @param author
* @param authorEmail
* @param maintainer
* @param maintainerEmail
* @param ownerIdentifier
* @param organizationList
* @param selectedOrganization
* @param resourcesIds
* @param addResources
* @param metadataList
*/
public DatasetBean(String id, String title, String description,
Map<String, List<String>> customFields, List<String> tags,
String license, boolean visible, String source, long version,
String authorName, String authorSurname, String authorEmail, String maintainer,
String maintainerEmail, String ownerIdentifier,
List<OrganizationBean> organizationList, String selectedOrganization,
ResourceElementBean resourceRoot,
List<MetaDataProfileBean> metadataList, List<OrganizationBean> groups, List<String> tagsVocabulary) {
super();
this.id = id;
this.title = title;
this.description = description;
this.customFields = customFields;
this.tags = tags;
this.license = license;
this.visible = visible;
this.source = source;
this.version = version;
this.authorName = authorName;
this.authorSurname = authorSurname;
this.authorEmail = authorEmail;
this.maintainer = maintainer;
this.maintainerEmail = maintainerEmail;
this.ownerIdentifier = ownerIdentifier;
this.organizationList = organizationList;
this.selectedOrganization = selectedOrganization;
this.resourceRoot = resourceRoot;
this.metadataList = metadataList;
this.groups = groups;
this.tagsVocabulary = tagsVocabulary;
}
public String getChosenType() {
return chosenType;
}
public void setChosenType(String chosenType) {
this.chosenType = chosenType;
}
public List<MetaDataProfileBean> getMetadataList() {
return metadataList;
}
public void setMetadataList(List<MetaDataProfileBean> metadataListTypes) {
this.metadataList = metadataListTypes;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOwnerIdentifier() {
return ownerIdentifier;
}
public void setOwnerIdentifier(String ownerIdentifier) {
this.ownerIdentifier = ownerIdentifier;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Map<String, List<String>> getCustomFields() {
return customFields;
}
public void setCustomFields(Map<String, List<String>> customFields) {
this.customFields = customFields;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public boolean getVisibility() {
return visible;
}
public void setVisibile(boolean visibile) {
this.visible = visibile;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public long getVersion() {
return version;
}
public void setVersion(long version) {
this.version = version;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getAuthorSurname() {
return authorSurname;
}
public void setAuthorSurname(String authorSurname) {
this.authorSurname = authorSurname;
}
public String getAuthorEmail() {
return authorEmail;
}
public void setAuthorEmail(String authorEmail) {
this.authorEmail = authorEmail;
}
public String getMaintainer() {
return maintainer;
}
public void setMaintainer(String maintainer) {
this.maintainer = maintainer;
}
public String getMaintainerEmail() {
return maintainerEmail;
}
public void setMaintainerEmail(String maintainerEmail) {
this.maintainerEmail = maintainerEmail;
}
public List<OrganizationBean> getOrganizationList() {
return organizationList;
}
public void setOrganizationList(List<OrganizationBean> organizationList) {
this.organizationList = organizationList;
}
public String getSelectedOrganization() {
return selectedOrganization;
}
public void setSelectedOrganization(String selectedOrganization) {
this.selectedOrganization = selectedOrganization;
}
public ResourceElementBean getResourceRoot() {
return resourceRoot;
}
public void setResourceRoot(ResourceElementBean resourceRoot) {
this.resourceRoot = resourceRoot;
}
public String getAuthorFullName() {
return authorFullName;
}
public void setAuthorFullName(String authorFullName) {
this.authorFullName = authorFullName;
}
public List<OrganizationBean> getGroups() {
return groups;
}
public void setGroups(List<OrganizationBean> groups) {
this.groups = groups;
}
public List<String> getTagsVocabulary() {
return tagsVocabulary;
}
public void setTagsVocabulary(List<String> tagsVocabulary) {
this.tagsVocabulary = tagsVocabulary;
}
public List<OrganizationBean> getGroupsForceCreation() {
return groupsForceCreation;
}
public void setGroupsForceCreation(List<OrganizationBean> groupsForceCreation) {
this.groupsForceCreation = groupsForceCreation;
}
@Override
public String toString() {
return "DatasetBean ["
+ (id != null ? "id=" + id + ", " : "")
+ (title != null ? "title=" + title + ", " : "")
+ (description != null ? "description=" + description + ", "
: "")
+ (license != null ? "license=" + license + ", " : "")
+ (source != null ? "source=" + source + ", " : "")
+ (authorName != null ? "authorName=" + authorName + ", " : "")
+ (authorSurname != null ? "authorSurname=" + authorSurname
+ ", " : "")
+ (authorFullName != null ? "authorFullName=" + authorFullName
+ ", " : "")
+ (authorEmail != null ? "authorEmail=" + authorEmail + ", "
: "")
+ (maintainer != null ? "maintainer=" + maintainer + ", " : "")
+ (maintainerEmail != null ? "maintainerEmail="
+ maintainerEmail + ", " : "")
+ (ownerIdentifier != null ? "ownerIdentifier="
+ ownerIdentifier + ", " : "")
+ (chosenType != null ? "chosenType=" + chosenType + ", " : "")
+ (selectedOrganization != null ? "selectedOrganization="
+ selectedOrganization + ", " : "")
+ "version="
+ version
+ ", visible="
+ visible
+ ", "
+ (organizationList != null ? "organizationList="
+ organizationList + ", " : "")
+ (resourceRoot != null ? "resourceRoot=" + resourceRoot + ", "
: "")
+ (metadataList != null ? "metadataList=" + metadataList + ", "
: "")
+ (tags != null ? "tags=" + tags + ", " : "")
+ (tagsVocabulary != null ? "tagsVocabulary=" + tagsVocabulary
+ ", " : "")
+ (customFields != null ? "customFields=" + customFields + ", "
: "")
+ (groups != null ? "groups=" + groups + ", " : "")
+ (groupsForceCreation != null ? "groupsForceCreation="
+ groupsForceCreation : "") + "]";
}
}

View File

@ -1,75 +0,0 @@
package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue;
import java.io.Serializable;
/**
* A ckan organization/group (you can check its nature by looking at getIsOrganization();) like bean with name and title
* @author Costantino Perciante (costantino.perciante@isti.cnr.it)
*/
public class OrganizationBean implements Serializable{
private static final long serialVersionUID = -6566519399945530602L;
private String title;
private String name;
private boolean isOrganization;
private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain
public OrganizationBean(){
super();
}
public OrganizationBean(String title, String name, boolean isOrganization) {
super();
this.title = title;
this.name = name;
this.isOrganization = isOrganization;
}
public OrganizationBean(String title, String name, boolean isOrganization, boolean propagateUp) {
super();
this.title = title;
this.name = name;
this.isOrganization = isOrganization;
this.propagateUp = propagateUp;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isOrganization() {
return isOrganization;
}
public void setOrganization(boolean isOrganization) {
this.isOrganization = isOrganization;
}
public boolean isPropagateUp() {
return propagateUp;
}
public void setPropagateUp(boolean propagateUp) {
this.propagateUp = propagateUp;
}
@Override
public String toString() {
return "OrganizationBean [title=" + title + ", name=" + name
+ ", isOrganization=" + isOrganization + ", propagateUp="
+ propagateUp + "]";
}
}

View File

@ -0,0 +1,146 @@
package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue;
import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* The Class OrganizationBeanProfile.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Feb 15, 2024
*/
public class OrganizationBeanProfile implements Serializable, IsSerializable {
/**
*
*/
private static final long serialVersionUID = -2078766102599662775L;
private String title;
private String name;
private boolean isOrganization;
private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain
/**
* Instantiates a new organization bean profile.
*/
public OrganizationBeanProfile() {
}
/**
* Instantiates a new organization bean profile.
*
* @param title the title
* @param name the name
* @param isOrganization the is organization
*/
public OrganizationBeanProfile(String title, String name, boolean isOrganization) {
this.title = title;
this.name = name;
this.isOrganization = isOrganization;
}
/**
* Instantiates a new organization bean profile.
*
* @param title the title
* @param name the name
* @param isOrganization the is organization
* @param propagateUp the propagate up
*/
public OrganizationBeanProfile(String title, String name, boolean isOrganization, boolean propagateUp) {
this.title = title;
this.name = name;
this.isOrganization = isOrganization;
this.propagateUp = propagateUp;
}
/**
* Gets the title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Sets the title.
*
* @param title the new title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Checks if is organization.
*
* @return true, if is organization
*/
public boolean isOrganization() {
return isOrganization;
}
/**
* Sets the organization.
*
* @param isOrganization the new organization
*/
public void setOrganization(boolean isOrganization) {
this.isOrganization = isOrganization;
}
/**
* Checks if is propagate up.
*
* @return true, if is propagate up
*/
public boolean isPropagateUp() {
return propagateUp;
}
/**
* Sets the propagate up.
*
* @param propagateUp the new propagate up
*/
public void setPropagateUp(boolean propagateUp) {
this.propagateUp = propagateUp;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OrganizationBeanProfile [title=");
builder.append(title);
builder.append(", name=");
builder.append(name);
builder.append(", isOrganization=");
builder.append(isOrganization);
builder.append(", propagateUp=");
builder.append(propagateUp);
builder.append("]");
return builder.toString();
}
}

View File

@ -3,14 +3,15 @@ package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue;
import java.io.Serializable;
import java.util.List;
import com.google.gwt.view.client.ProvidesKey;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* A resource element bean. Contains part of the logic used into the TwinColumn widget
* A resource element bean. Contains part of the logic used into the TwinColumn
* widget
*
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ResourceElementBean implements Comparable<ResourceElementBean>, Serializable{
public class ResourceElementBeanProfile implements Serializable, IsSerializable {
private static final long serialVersionUID = -1230871392599580669L;
private String name;
@ -23,30 +24,21 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
private String url;
private String description;
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
private ResourceElementBean parent;
private List<ResourceElementBean> children;
// to generate the GWT identifiers
private static int nextId = 0;
// identifier of this instance
private int identifierGWT;
private ResourceElementBeanProfile parent;
private List<ResourceElementBeanProfile> children;
/**
* The key provider that provides the unique ID of a bean.
* Default constructor
*/
public static final ProvidesKey<ResourceElementBean> KEY_PROVIDER = new ProvidesKey<ResourceElementBean>() {
@Override
public Object getKey(ResourceElementBean item) {
return item == null ? null : item.identifierGWT;
}
};
public ResourceElementBeanProfile() {
}
/**
* Copy constructor
*
* @param another
*/
public ResourceElementBean(ResourceElementBean another) {
public ResourceElementBeanProfile(ResourceElementBeanProfile another) {
this.name = another.name;
this.toBeAdded = another.toBeAdded;
this.fullPath = another.fullPath;
@ -58,15 +50,6 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.organizationNameDatasetParent = another.organizationNameDatasetParent;
}
/**
* Default constructor
*/
public ResourceElementBean(){
super();
this.identifierGWT = nextId;
nextId++;
}
/**
* @param identifier
* @param parentFolder
@ -74,14 +57,8 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
* @param movedToRight
* @param isFolder
*/
public ResourceElementBean(
ResourceElementBean parent,
String name,
boolean isFolder,
List<ResourceElementBean> children,
String fullPath) {
this.identifierGWT = nextId;
nextId++;
public ResourceElementBeanProfile(ResourceElementBeanProfile parent, String name, boolean isFolder,
List<ResourceElementBeanProfile> children, String fullPath) {
this.parent = parent;
this.name = name;
this.isFolder = isFolder;
@ -102,14 +79,11 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
* @param description
* @param organizationNameDatasetParent
*/
public ResourceElementBean(String name, boolean toBeAdded,
boolean isFolder, ResourceElementBean parent,
List<ResourceElementBean> children, String fullPath,
String originalIdInWorkspace, String mimeType, String url,
String description, String organizationNameDatasetParent) {
public ResourceElementBeanProfile(String name, boolean toBeAdded, boolean isFolder,
ResourceElementBeanProfile parent, List<ResourceElementBeanProfile> children, String fullPath,
String originalIdInWorkspace, String mimeType, String url, String description,
String organizationNameDatasetParent) {
super();
this.identifierGWT = nextId;
nextId++;
this.name = name;
this.toBeAdded = toBeAdded;
this.isFolder = isFolder;
@ -123,11 +97,11 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.organizationNameDatasetParent = organizationNameDatasetParent;
}
public ResourceElementBean getParent() {
public ResourceElementBeanProfile getParent() {
return parent;
}
public void setParent(ResourceElementBean parent) {
public void setParent(ResourceElementBeanProfile parent) {
this.parent = parent;
}
@ -175,8 +149,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
return organizationNameDatasetParent;
}
public void setOrganizationNameDatasetParent(
String organizationNameDatasetParent) {
public void setOrganizationNameDatasetParent(String organizationNameDatasetParent) {
this.organizationNameDatasetParent = organizationNameDatasetParent;
}
@ -188,11 +161,11 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.isFolder = isFolder;
}
public List<ResourceElementBean> getChildren() {
public List<ResourceElementBeanProfile> getChildren() {
return children;
}
public void setChildren(List<ResourceElementBean> children) {
public void setChildren(List<ResourceElementBeanProfile> children) {
this.children = children;
}
@ -220,33 +193,35 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
this.editableName = newName;
}
@Override
public boolean equals(Object o) {
boolean toReturn = false;
if (o instanceof ResourceElementBean) {
toReturn = identifierGWT == ((ResourceElementBean) o).identifierGWT;
}
return toReturn;
}
@Override
public int compareTo(ResourceElementBean o) {
int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath);
return toReturn;
}
@Override
public String toString() {
return "ResourceElementBean [identifierGWT=" + identifierGWT
+ ", name=" + name + ", editableName=" + editableName
+ ", toBeAdded=" + toBeAdded + ", isFolder=" + isFolder
+ ", fullPath=" + fullPath + ", originalIdInWorkspace="
+ originalIdInWorkspace + ", mimeType=" + mimeType + ", url="
+ url + ", description=" + description
+ ", organizationNameDatasetParent="
+ organizationNameDatasetParent + ", parent=" + parent
+ ", children number=" + (children == null ? 0 : children.size()) + "]";
StringBuilder builder = new StringBuilder();
builder.append("ResourceElementBeanProfile [name=");
builder.append(name);
builder.append(", editableName=");
builder.append(editableName);
builder.append(", toBeAdded=");
builder.append(toBeAdded);
builder.append(", isFolder=");
builder.append(isFolder);
builder.append(", fullPath=");
builder.append(fullPath);
builder.append(", originalIdInWorkspace=");
builder.append(originalIdInWorkspace);
builder.append(", mimeType=");
builder.append(mimeType);
builder.append(", url=");
builder.append(url);
builder.append(", description=");
builder.append(description);
builder.append(", organizationNameDatasetParent=");
builder.append(organizationNameDatasetParent);
builder.append(", parent=");
builder.append(parent);
builder.append(", children=");
builder.append(children);
builder.append("]");
return builder.toString();
}
}

View File

@ -400,7 +400,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable {
builder.append(", maxOccurs=");
builder.append(maxOccurs);
builder.append(", currentValues=");
builder.append(currentValues);
builder.append("currentValues");
builder.append("]");
return builder.toString();
}