diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellLeft.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellLeft.java deleted file mode 100644 index 1a9c681..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellLeft.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection; - -import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.icons.Images; -import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.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{ - 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("
"); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(value.isFolder() ? folder.toString() : file.toString()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendEscaped(value.getName()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant("
"); - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellRight.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellRight.java deleted file mode 100644 index e4f7748..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceCellRight.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection; - -import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.icons.Images; -import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.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{ - - 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("
"); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(file.toString()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendEscaped(value.getEditableName()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant("
"); - } - - @Override - public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context, - Element parent, ResourceElementBean value, NativeEvent event, - ValueUpdater 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); - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.java deleted file mode 100644 index f2205c7..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection; - -import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; - -import com.github.gwtbootstrap.client.ui.Button; -import com.github.gwtbootstrap.client.ui.ControlGroup; -import com.github.gwtbootstrap.client.ui.TextArea; -import com.github.gwtbootstrap.client.ui.TextBox; -import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; -import com.github.gwtbootstrap.client.ui.constants.IconType; -import com.google.gwt.cell.client.ValueUpdater; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Float; -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.client.ui.Composite; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Widget; - -/** - * A resource information form panel - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public class ResourceInfoForm extends Composite{ - - @UiField - public TextBox resourceName; - @UiField - public TextBox resourcePath; - @UiField - public TextBox resourceFormat; - @UiField - public TextArea resourceDescription; - @UiField - public Button updateResourceButton; - @UiField - Button closeButton; - @UiField - HorizontalPanel commandPanel; - @UiField - ControlGroup controlName; - - private ResourceElementBean resourceBean; - - private static ResourceInfoFormUiBinder uiBinder = GWT - .create(ResourceInfoFormUiBinder.class); - - interface ResourceInfoFormUiBinder extends - UiBinder { - } - - public ResourceInfoForm() { - initWidget(uiBinder.createAndBindUi(this)); - } - - public ResourceInfoForm(final ResourceElementBean resource, final ValueUpdater valueUpdater) { - initWidget(uiBinder.createAndBindUi(this)); - - resourceBean = resource; - resourceDescription.setText(resource.getDescription()); - resourceFormat.setText(resource.getMimeType() == null? "Unavailable" : resource.getMimeType()); - resourceName.setText(resource.getEditableName()); - resourcePath.setText(resource.getFullPath()); - closeButton.getElement().getStyle().setFloat(Float.RIGHT); - closeButton.setIcon(IconType.REMOVE_CIRCLE); - commandPanel.setCellHorizontalAlignment(updateResourceButton, HasHorizontalAlignment.ALIGN_RIGHT); - commandPanel.getElement().getStyle().setMarginTop(10, Unit.PX); - updateResourceButton.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - resourceBean.setDescription(resourceDescription.getText()); - - removeError(controlName); - String newName = resourceName.getText(); - if(newName == null || newName.isEmpty()){ - showError(controlName); - }else{ - resourceBean.setEditableName(newName); - valueUpdater.update(resourceBean); - } - } - }); - - closeButton.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - clearPanel(); - - } - }); - } - - public String getResourceName() { - return resourceName.getText(); - } - - public void setResourceName(String resourceName) { - this.resourceName.setText(resourceName); - } - - public String getResourcePath() { - return resourcePath.getText(); - } - - public void setResourcePath(String resourcePath) { - this.resourcePath.setText(resourcePath); - } - - public String getResourceFormat() { - return resourceFormat.getText(); - } - - public void setResourceFormat(String resourceFormat) { - this.resourceFormat.setText(resourceFormat); - } - - public String getResourceDescription() { - return resourceDescription.getText(); - } - - public void setResourceDescription(String resourceDescription) { - this.resourceDescription.setText(resourceDescription); - } - - public void removeError(ControlGroup control) { - control.setType(ControlGroupType.NONE); - } - - public void showError(ControlGroup control) { - control.setType(ControlGroupType.ERROR); - } - - protected void clearPanel() { - this.removeFromParent(); - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.ui.xml deleted file mode 100644 index c9d29ce..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ResourceInfoForm.ui.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - .legend-style { - width: 100%; - padding: 10px; - margin-bottom: 0px; - font-size: 14px; - } - - .panel-style { - padding: 5px; - border: 1px solid #bbb; - border-radius: 5px; - height: 400px; - width: 95%; - } - - .labels-style { - color: #999; - } - - .controls-style { - margin-left: 10px !important; - } - - .control-group { - margin-bottom: 0px !important; - } - - - - - - Resource Information - - - - - Name: - - - - - - - - Path: - - - - - - - - Description: - - - - - - - - Format: - - - - - - - - Update - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ShowMorePagerPanel.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ShowMorePagerPanel.java deleted file mode 100644 index 8a8f4cf..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/ShowMorePagerPanel.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection; - -import com.google.gwt.event.dom.client.ScrollEvent; -import com.google.gwt.event.dom.client.ScrollHandler; -import com.google.gwt.user.cellview.client.AbstractPager; -import com.google.gwt.user.client.ui.ScrollPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.view.client.HasRows; - -/** - * Basically a scroll panel - * Partially changed from the code at http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCellList - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public class ShowMorePagerPanel extends AbstractPager{ - - /** - * The default increment size. - */ - public static final int DEFAULT_INCREMENT = 10; - - /** - * The increment size. - */ - private int incrementSize = DEFAULT_INCREMENT; - - /** - * The last scroll position. - */ - private int lastScrollPos = 0; - - /** - * The scrollable panel. - */ - private final ScrollPanel scrollable = new ScrollPanel(); - - /** - * Construct a new {@link ShowMorePagerPanel}. - */ - public ShowMorePagerPanel() { - initWidget(scrollable); - - // Do not let the scrollable take tab focus. - scrollable.getElement().setTabIndex(-1); - - // Handle scroll events. - scrollable.addScrollHandler(new ScrollHandler() { - public void onScroll(ScrollEvent event) { - // If scrolling up, ignore the event. - int oldScrollPos = lastScrollPos; - lastScrollPos = scrollable.getVerticalScrollPosition(); - if (oldScrollPos >= lastScrollPos) { - return; - } - - HasRows display = getDisplay(); - if (display == null) { - return; - } - int maxScrollTop = scrollable.getWidget().getOffsetHeight() - - scrollable.getOffsetHeight(); - if (lastScrollPos >= maxScrollTop) { - // We are near the end, so increase the page size. - int newPageSize = Math.min( - display.getVisibleRange().getLength() + incrementSize, - display.getRowCount()); - display.setVisibleRange(0, newPageSize); - } - } - }); - } - - /** - * Get the number of rows by which the range is increased when the scrollbar - * reaches the bottom. - * @return the increment size - */ - public int getIncrementSize() { - return incrementSize; - } - - @Override - public void setDisplay(HasRows display) { - assert display instanceof Widget : "display must extend Widget"; - scrollable.setWidget((Widget) display); - super.setDisplay(display); - } - - /** - * Set the number of rows by which the range is increased when the scrollbar - * reaches the bottom. - * @param incrementSize the incremental number of rows - */ - public void setIncrementSize(int incrementSize) { - this.incrementSize = incrementSize; - } - - @Override - protected void onRangeOrRowCountChanged() { - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.java deleted file mode 100644 index 909f0cc..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.java +++ /dev/null @@ -1,571 +0,0 @@ -package org.gcube.portlets.widgets.ckandatapublisherwidget.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.ckandatapublisherwidget.shared.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 pathListBeans = new ArrayList(); - 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 cellListLeft; - private CellList cellListRight; - private ListDataProvider dataProviderLeft = new ListDataProvider(); - private ListDataProvider dataProviderRight = new ListDataProvider(); - private MultiSelectionModel selectionModelRight; - private MultiSelectionModel selectionModelLeft; - private final ResourceElementBean initialBean; - // private final static HTML aboutHeader = new HTML("Resource Manager"); - // private final static HTML aboutBody = new HTML("

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.

"); - - // private static final short PATH_THRESHOLD = 1; // TODO - - private static TwinColumnSelectionMainPanelUiBinder uiBinder = GWT - .create(TwinColumnSelectionMainPanelUiBinder.class); - - interface TwinColumnSelectionMainPanelUiBinder extends - UiBinder { - } - - 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(cell, ResourceElementBean.KEY_PROVIDER); - cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); - - // set page size - //int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1; - cellListLeft.setPageSize(0); - - // Add a selection model so we can select cells. - selectionModelLeft = new MultiSelectionModel(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 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 iteratorBreadcrumb = breadcrumbs.iterator(); - Iterator 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(cell, ResourceElementBean.KEY_PROVIDER); - cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); - cellListRight.setValueUpdater(new ValueUpdater() { - - @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.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 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 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 setSelected){ - - if(setSelected == null || setSelected.isEmpty()) - return; - - Iterator 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 setSelected){ - - if(setSelected == null || setSelected.isEmpty()) - return; - - Iterator 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() { - - frozen = true; - - Iterator iteratorOverPath = breadcrumbs.iterator(); - while (iteratorOverPath.hasNext()) { - Widget widget = iteratorOverPath.next(); - if(widget instanceof NavLink) - ((NavLink)widget).setActive(false); - } - - allToRightButton.setEnabled(false); - toRightButton.setEnabled(false); - allToLeftButton.setEnabled(false); - toLeftButton.setEnabled(false); - } - - /** - * Returns the root parent with the children as files to save - * @return the resources to save - */ - public ResourceElementBean getResourcesToPublish(){ - - List current = dataProviderRight.getList(); - - ResourceElementBean toReturn = new ResourceElementBean(); - List children = new ArrayList(); - - 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()); - // } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.ui.xml deleted file mode 100644 index 0fbe728..0000000 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/TwinColumnSelection/TwinColumnSelectionMainPanel.ui.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml index a952ea0..f578000 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/CreateDatasetForm.ui.xml @@ -9,16 +9,16 @@ } .fieldset-border-style { - border: 1px groove #444; - -webkit-box-shadow: 0px 0px 0px 0px #000; - box-shadow: 0px 0px 0px 0px #000; - padding: 10px; + border: 1px groove #444 !important; + box-shadow: 0px 0px 0px 0px #000 !important; + padding: 10px !important; } .legend-style { - width: auto; - padding: 10px; - margin-bottom: 0px; + width: auto !important; + padding: 10px !important; + margin-bottom: 0 !important; + border-bottom: 0 !important; } @external .form-horizontal .input-large; diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/GcubeDialogExtended.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/GcubeDialogExtended.java index 43b0d7b..cdb67e7 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/GcubeDialogExtended.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/utils/GcubeDialogExtended.java @@ -1,7 +1,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils; import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog; -import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnSelection.ResourceInfoForm; +import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.ResourceInfoForm; import com.github.gwtbootstrap.client.ui.Paragraph; import com.google.gwt.core.shared.GWT; diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.java index 36efd7c..6a0c5a5 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.java @@ -92,30 +92,30 @@ public class SelectResourceByWEMainPanel extends Composite { this.initialBean = initialBean; this.labelNothing.setType(LabelType.INFO); - try { - String wsRootId = null; - String rootName = null; + String wsFolderId = null; + + //remove this? if(initialBean.isFolder()) { - wsRootId = initialBean.getOriginalIdInWorkspace(); - rootName = initialBean.getName(); + wsFolderId = initialBean.getOriginalIdInWorkspace(); }else { //is file - if(initialBean.getParent()!=null) { - wsRootId = initialBean.getParent().getOriginalIdInWorkspace(); - rootName = initialBean.getParent().getName(); + wsFolderId = initialBean.getParent().getOriginalIdInWorkspace(); + } } + + wsFolderId = initialBean.getRootIdInWorkspace()!=null?initialBean.getRootIdInWorkspace():wsFolderId; //loads the WE only if the root is not null - if(wsRootId!=null) { + if(wsFolderId!=null) { DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD.OWNER, DISPLAY_FIELD.CREATION_DATE}; - WorkspaceResourcesExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesExplorerPanel(wsRootId,false,null, null,false,null,displayFields); + WorkspaceResourcesExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesExplorerPanel(wsFolderId,false,null, null,false,null,displayFields); WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { @Override diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml index c345b3a..54fb234 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml @@ -8,9 +8,9 @@ } .custom-header { - margin: 0; + margin: 0 !important; font-size: 18px !important; - color: #222; + color: #222 !important; } .max-height-250 { diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css index 9b14018..2715ccd 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css @@ -51,10 +51,14 @@ width: 100% !important; } -.accordion-no-border-inner .accordion-inner { - border: 0px; +.accordion-no-border-inner { + border: 1px solid #e5e5e5 !important; + border-radius: 4px !important; } +.accordion-no-border-inner .accordion-inner { + border-top: 0 !important; +} /* WIZARD-CREATOR CLASSES */ diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java index 82ec1b6..964d22f 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/WorkspaceUtils.java @@ -128,6 +128,7 @@ public class WorkspaceUtils { resourceEB.setDescription(originalFolderOrFile.getDescription()); resourceEB.setFolder(originalFolderOrFile.isFolder()); resourceEB.setEditableName(originalFolderOrFile.getName()); + resourceEB.setRootIdInWorkspace(workspace.getRoot().getId()); //in case of folder if(originalFolderOrFile.isFolder()) { diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/shared/ResourceElementBean.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/shared/ResourceElementBean.java index f840530..6c2cb5a 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/shared/ResourceElementBean.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/shared/ResourceElementBean.java @@ -36,6 +36,8 @@ public class ResourceElementBean implements Comparable, Ser /** The original id in workspace. */ private String originalIdInWorkspace; + private String rootIdInWorkspace; + /** The mime type. */ private String mimeType; @@ -423,12 +425,16 @@ public class ResourceElementBean implements Comparable, Ser int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath); return toReturn; } + + + public String getRootIdInWorkspace() { + return rootIdInWorkspace; + } + + public void setRootIdInWorkspace(String rootIdInWorkspace) { + this.rootIdInWorkspace = rootIdInWorkspace; + } - /** - * To string. - * - * @return the string - */ @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -444,6 +450,8 @@ public class ResourceElementBean implements Comparable, Ser builder.append(fullPath); builder.append(", originalIdInWorkspace="); builder.append(originalIdInWorkspace); + builder.append(", rootIdInWorkspace="); + builder.append(rootIdInWorkspace); builder.append(", mimeType="); builder.append(mimeType); builder.append(", url="); @@ -452,14 +460,16 @@ public class ResourceElementBean implements Comparable, Ser builder.append(description); builder.append(", organizationNameDatasetParent="); builder.append(organizationNameDatasetParent); - builder.append(", parent="); - builder.append(parent); builder.append(", childrenSize="); builder.append(childrenSize); - builder.append(", identifierGWT="); - builder.append(identifierGWT); + builder.append(", toPublish="); + builder.append(toPublish); builder.append("]"); return builder.toString(); } + + + + }