removed the package ui/TwinColumnSelection. Revisited css with
!important attribute
This commit is contained in:
parent
a8900c41e1
commit
ea2adf14a2
|
@ -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<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>");
|
||||
}
|
||||
}
|
|
@ -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<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);
|
||||
}
|
||||
}
|
|
@ -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<Widget, ResourceInfoForm> {
|
||||
}
|
||||
|
||||
public ResourceInfoForm() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public ResourceInfoForm(final ResourceElementBean resource, final ValueUpdater<ResourceElementBean> 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();
|
||||
}
|
||||
}
|
|
@ -1,88 +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">
|
||||
<ui:style>
|
||||
.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;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel styleName="{style.panel-style}">
|
||||
<b:Form type="VERTICAL" width="100%">
|
||||
<!-- <b:Fieldset styleName="{style.fieldset-border-style}"> -->
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
<b>Resource Information</b>
|
||||
<b:Button ui:field="closeButton" type="LINK" title="Close details"></b:Button>
|
||||
</b:Legend>
|
||||
<b:ControlGroup ui:field="controlName" styleName="{style.control-group}">
|
||||
<b:ControlLabel for="name" styleName="{style.labels-style}"
|
||||
title="The name the resource will have on the catalogue">
|
||||
<b>Name:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource name" b:id="name"
|
||||
enabled="true" title="The name the resource will have on the catalogue"
|
||||
ui:field="resourceName" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="path" title="Resource path"
|
||||
styleName="{style.labels-style}">
|
||||
<b>Path:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource path" b:id="path"
|
||||
readOnly="true" title="Resource path" ui:field="resourcePath" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="description" styleName="{style.labels-style}"
|
||||
title="The description the resource will have on the catalogue">
|
||||
<b>Description:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextArea placeholder="Resource description" b:id="description"
|
||||
title="The description the resource will have on the catalogue"
|
||||
ui:field="resourceDescription"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup styleName="{style.control-group}">
|
||||
<b:ControlLabel for="format" styleName="{style.labels-style}"
|
||||
title="The MIME type">
|
||||
<b>Format:</b>
|
||||
</b:ControlLabel>
|
||||
<b:Controls styleName="{style.controls-style}">
|
||||
<b:TextBox placeholder="Resource format" b:id="format"
|
||||
title="The MIME type" ui:field="resourceFormat" readOnly="true" />
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<g:HorizontalPanel width="100%" ui:field="commandPanel">
|
||||
<!-- <b:Button ui:field="cancelButton">Cancel</b:Button> -->
|
||||
<b:Button ui:field="updateResourceButton" type="PRIMARY">Update</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<!-- </b:Fieldset> -->
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -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() {
|
||||
}
|
||||
}
|
|
@ -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<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(0);
|
||||
|
||||
// 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() {
|
||||
|
||||
frozen = true;
|
||||
|
||||
Iterator<Widget> 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<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());
|
||||
// }
|
||||
}
|
|
@ -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.ckandatapublisherwidget.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>
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
}
|
||||
|
||||
.custom-header {
|
||||
margin: 0;
|
||||
margin: 0 !important;
|
||||
font-size: 18px !important;
|
||||
color: #222;
|
||||
color: #222 !important;
|
||||
}
|
||||
|
||||
.max-height-250 {
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -36,6 +36,8 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, 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<ResourceElementBean>, 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<ResourceElementBean>, 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<ResourceElementBean>, 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue