edit_facility_26115 #3
|
@ -19,7 +19,6 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel
|
|||
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;
|
||||
|
@ -240,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
|
||||
|
@ -879,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)
|
||||
|
|
|
@ -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.ResourceElementBeanProfile;
|
||||
|
||||
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<ResourceElementBeanProfile>{
|
||||
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,
|
||||
ResourceElementBeanProfile 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>");
|
||||
}
|
||||
}
|
|
@ -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.ResourceElementBeanProfile;
|
||||
|
||||
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<ResourceElementBeanProfile>{
|
||||
|
||||
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,
|
||||
ResourceElementBeanProfile 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, ResourceElementBeanProfile value, NativeEvent event,
|
||||
ValueUpdater<ResourceElementBeanProfile> 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);
|
||||
}
|
||||
}
|
|
@ -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.ResourceElementBeanProfile;
|
||||
|
||||
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;
|
||||
ResourceElementBeanProfile resourceFolder;
|
||||
|
||||
PathBean(NavLink link, ResourceElementBeanProfile 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<ResourceElementBeanProfile> cellListLeft;
|
||||
private CellList<ResourceElementBeanProfile> cellListRight;
|
||||
private ListDataProvider<ResourceElementBeanProfile> dataProviderLeft = new ListDataProvider<ResourceElementBeanProfile>();
|
||||
private ListDataProvider<ResourceElementBeanProfile> dataProviderRight = new ListDataProvider<ResourceElementBeanProfile>();
|
||||
private MultiSelectionModel<ResourceElementBeanProfile> selectionModelRight;
|
||||
private MultiSelectionModel<ResourceElementBeanProfile> selectionModelLeft;
|
||||
private final ResourceElementBeanProfile 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(ResourceElementBeanProfile 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 ResourceElementBeanProfile 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<ResourceElementBeanProfile>(cell, ResourceElementBeanProfile.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<ResourceElementBeanProfile>(ResourceElementBeanProfile.KEY_PROVIDER);
|
||||
cellListLeft.setSelectionModel(selectionModelLeft);
|
||||
|
||||
// perform an action on selection
|
||||
selectionModelLeft.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
|
||||
if(frozen)
|
||||
return;
|
||||
|
||||
Iterator<ResourceElementBeanProfile> selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator();
|
||||
|
||||
while (selectedObjectsIterator.hasNext()) {
|
||||
ResourceElementBeanProfile 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();
|
||||
ResourceElementBeanProfile 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<ResourceElementBeanProfile>(cell, ResourceElementBeanProfile.KEY_PROVIDER);
|
||||
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
cellListRight.setValueUpdater(new ValueUpdater<ResourceElementBeanProfile>() {
|
||||
|
||||
@Override
|
||||
public void update(ResourceElementBeanProfile value) {
|
||||
|
||||
// just redraw the list
|
||||
cellListRight.redraw();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Add a selection model so we can select cells.
|
||||
selectionModelRight = new MultiSelectionModel<ResourceElementBeanProfile>(ResourceElementBeanProfile.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<ResourceElementBeanProfile> 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<ResourceElementBeanProfile> 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<ResourceElementBeanProfile> setSelected){
|
||||
|
||||
if(setSelected == null || setSelected.isEmpty())
|
||||
return;
|
||||
|
||||
Iterator<ResourceElementBeanProfile> iterator = setSelected.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ResourceElementBeanProfile 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<ResourceElementBeanProfile> setSelected){
|
||||
|
||||
if(setSelected == null || setSelected.isEmpty())
|
||||
return;
|
||||
|
||||
Iterator<ResourceElementBeanProfile> iterator = setSelected.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ResourceElementBeanProfile 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 ResourceElementBeanProfile getResourcesToPublish(){
|
||||
|
||||
List<ResourceElementBeanProfile> current = dataProviderRight.getList();
|
||||
|
||||
ResourceElementBeanProfile toReturn = new ResourceElementBeanProfile();
|
||||
List<ResourceElementBeanProfile> children = new ArrayList<ResourceElementBeanProfile>();
|
||||
|
||||
for (ResourceElementBeanProfile resource : current) {
|
||||
if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ...
|
||||
ResourceElementBeanProfile beanWithoutChildren = new ResourceElementBeanProfile(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());
|
||||
// }
|
||||
}
|
|
@ -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="<" />
|
||||
<b:Button ui:field="allToLeftButton" name="toRight"
|
||||
enabled="false" title="Remove selected files" text="<<" />
|
||||
</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>
|
|
@ -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<OrganizationBeanProfile> organizationList; // list of organization in which the user is present and could create the dataset
|
||||
// private ResourceElementBeanProfile 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<OrganizationBeanProfile> groups;
|
||||
// private List<OrganizationBeanProfile> 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<OrganizationBeanProfile> organizationList, String selectedOrganization,
|
||||
// ResourceElementBeanProfile resourceRoot,
|
||||
// List<MetaDataProfileBean> metadataList, List<OrganizationBeanProfile> 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<OrganizationBeanProfile> getOrganizationList() {
|
||||
// return organizationList;
|
||||
// }
|
||||
//
|
||||
// public void setOrganizationList(List<OrganizationBeanProfile> organizationList) {
|
||||
// this.organizationList = organizationList;
|
||||
// }
|
||||
//
|
||||
// public String getSelectedOrganization() {
|
||||
// return selectedOrganization;
|
||||
// }
|
||||
//
|
||||
// public void setSelectedOrganization(String selectedOrganization) {
|
||||
// this.selectedOrganization = selectedOrganization;
|
||||
// }
|
||||
//
|
||||
// public ResourceElementBeanProfile getResourceRoot() {
|
||||
// return resourceRoot;
|
||||
// }
|
||||
//
|
||||
// public void setResourceRoot(ResourceElementBeanProfile resourceRoot) {
|
||||
// this.resourceRoot = resourceRoot;
|
||||
// }
|
||||
//
|
||||
// public String getAuthorFullName() {
|
||||
// return authorFullName;
|
||||
// }
|
||||
//
|
||||
// public void setAuthorFullName(String authorFullName) {
|
||||
// this.authorFullName = authorFullName;
|
||||
// }
|
||||
//
|
||||
// public List<OrganizationBeanProfile> getGroups() {
|
||||
// return groups;
|
||||
// }
|
||||
//
|
||||
// public void setGroups(List<OrganizationBeanProfile> groups) {
|
||||
// this.groups = groups;
|
||||
// }
|
||||
//
|
||||
// public List<String> getTagsVocabulary() {
|
||||
// return tagsVocabulary;
|
||||
// }
|
||||
//
|
||||
// public void setTagsVocabulary(List<String> tagsVocabulary) {
|
||||
// this.tagsVocabulary = tagsVocabulary;
|
||||
// }
|
||||
//
|
||||
// public List<OrganizationBeanProfile> getGroupsForceCreation() {
|
||||
// return groupsForceCreation;
|
||||
// }
|
||||
//
|
||||
// public void setGroupsForceCreation(List<OrganizationBeanProfile> 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 : "") + "]";
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -2,11 +2,13 @@ package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* 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 OrganizationBeanProfile implements Serializable{
|
||||
public class OrganizationBeanProfile implements Serializable, IsSerializable {
|
||||
|
||||
private static final long serialVersionUID = -6566519399945530602L;
|
||||
private String title;
|
||||
|
@ -15,7 +17,6 @@ public class OrganizationBeanProfile implements Serializable{
|
|||
private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain
|
||||
|
||||
public OrganizationBeanProfile(){
|
||||
super();
|
||||
}
|
||||
|
||||
public OrganizationBeanProfile(String title, String name, boolean isOrganization) {
|
||||
|
|
|
@ -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 ResourceElementBeanProfile implements Comparable<ResourceElementBeanProfile>, Serializable{
|
||||
public class ResourceElementBeanProfile implements Serializable, IsSerializable {
|
||||
|
||||
private static final long serialVersionUID = -1230871392599580669L;
|
||||
private String name;
|
||||
|
@ -26,24 +27,9 @@ public class ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
private ResourceElementBeanProfile parent;
|
||||
private List<ResourceElementBeanProfile> children;
|
||||
|
||||
// to generate the GWT identifiers
|
||||
private static int nextId = 0;
|
||||
|
||||
// identifier of this instance
|
||||
private int identifierGWT;
|
||||
|
||||
/**
|
||||
* The key provider that provides the unique ID of a bean.
|
||||
*/
|
||||
public static final ProvidesKey<ResourceElementBeanProfile> KEY_PROVIDER = new ProvidesKey<ResourceElementBeanProfile>() {
|
||||
@Override
|
||||
public Object getKey(ResourceElementBeanProfile item) {
|
||||
return item == null ? null : item.identifierGWT;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*
|
||||
* @param another
|
||||
*/
|
||||
public ResourceElementBeanProfile(ResourceElementBeanProfile another) {
|
||||
|
@ -61,10 +47,7 @@ public class ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public ResourceElementBeanProfile(){
|
||||
super();
|
||||
this.identifierGWT = nextId;
|
||||
nextId++;
|
||||
public ResourceElementBeanProfile() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,14 +57,8 @@ public class ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
* @param movedToRight
|
||||
* @param isFolder
|
||||
*/
|
||||
public ResourceElementBeanProfile(
|
||||
ResourceElementBeanProfile parent,
|
||||
String name,
|
||||
boolean isFolder,
|
||||
List<ResourceElementBeanProfile> 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 ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
* @param description
|
||||
* @param 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) {
|
||||
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;
|
||||
|
@ -175,8 +149,7 @@ public class ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
return organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
public void setOrganizationNameDatasetParent(
|
||||
String organizationNameDatasetParent) {
|
||||
public void setOrganizationNameDatasetParent(String organizationNameDatasetParent) {
|
||||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||
}
|
||||
|
||||
|
@ -220,33 +193,35 @@ public class ResourceElementBeanProfile implements Comparable<ResourceElementBea
|
|||
this.editableName = newName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
boolean toReturn = false;
|
||||
if (o instanceof ResourceElementBeanProfile) {
|
||||
toReturn = identifierGWT == ((ResourceElementBeanProfile) o).identifierGWT;
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ResourceElementBeanProfile o) {
|
||||
int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResourceElementBeanProfile [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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue