Resource picker widget is almost finished
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@133955 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ca9eec91a3
commit
41915d6745
|
@ -20,6 +20,7 @@
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="${webappDirectory}/WEB-INF/classes" path="src/main/resources">
|
||||||
|
|
|
@ -40,7 +40,7 @@ public interface CKanPublisherService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Try to create such dataset starting from the information contained into the toCreate bean.
|
* Try to create such dataset starting from the information contained into the toCreate bean.
|
||||||
* @param toCreate
|
* @param toCreate
|
||||||
* @return the sent bean full filled with the needed information
|
* @return the sent bean filled with the needed information
|
||||||
*/
|
*/
|
||||||
DatasetMetadataBean createCKanDataset(DatasetMetadataBean toCreate);
|
DatasetMetadataBean createCKanDataset(DatasetMetadataBean toCreate);
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,10 @@ public class ResourceCellRight extends AbstractCell<ResourceElementBean>{
|
||||||
public void render(com.google.gwt.cell.client.Cell.Context context,
|
public void render(com.google.gwt.cell.client.Cell.Context context,
|
||||||
ResourceElementBean value, SafeHtmlBuilder sb) {
|
ResourceElementBean value, SafeHtmlBuilder sb) {
|
||||||
|
|
||||||
// Do not render an object if
|
|
||||||
// - is null;
|
|
||||||
// - is still on the left side
|
|
||||||
if (value == null || !value.isMovedToRight() || value.isFolder()) {
|
if (value == null || !value.isMovedToRight() || value.isFolder()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.appendHtmlConstant("<table style='width:100%'");
|
sb.appendHtmlConstant("<table style='width:100%'");
|
||||||
sb.appendHtmlConstant("<tr><td>");
|
sb.appendHtmlConstant("<tr><td>");
|
||||||
sb.appendHtmlConstant("<b>");
|
sb.appendHtmlConstant("<b>");
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.TwinColumnS
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gwt.core.shared.GWT;
|
|
||||||
import com.google.gwt.view.client.ProvidesKey;
|
import com.google.gwt.view.client.ProvidesKey;
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,14 +119,17 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
boolean toReturn = false;
|
||||||
if (o instanceof ResourceElementBean) {
|
if (o instanceof ResourceElementBean) {
|
||||||
return identifier == ((ResourceElementBean) o).identifier;
|
toReturn = identifier == ((ResourceElementBean) o).identifier;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ResourceElementBean o) {
|
public int compareTo(ResourceElementBean o) {
|
||||||
return (o == null || o.name == null) ? -1 : -o.fullPath.compareTo(fullPath);
|
int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath);
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ public class ShowMorePagerPanel extends AbstractPager{
|
||||||
/**
|
/**
|
||||||
* Set the number of rows by which the range is increased when the scrollbar
|
* Set the number of rows by which the range is increased when the scrollbar
|
||||||
* reaches the bottom.
|
* reaches the bottom.
|
||||||
*
|
|
||||||
* @param incrementSize the incremental number of rows
|
* @param incrementSize the incremental number of rows
|
||||||
*/
|
*/
|
||||||
public void setIncrementSize(int incrementSize) {
|
public void setIncrementSize(int incrementSize) {
|
||||||
|
|
|
@ -5,8 +5,11 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Popover;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.BorderStyle;
|
import com.google.gwt.dom.client.Style.BorderStyle;
|
||||||
|
import com.google.gwt.dom.client.Style.Float;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
@ -15,6 +18,7 @@ import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.cellview.client.CellList;
|
import com.google.gwt.user.cellview.client.CellList;
|
||||||
import com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy.KeyboardPagingPolicy;
|
import com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy.KeyboardPagingPolicy;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
import com.google.gwt.view.client.ListDataProvider;
|
import com.google.gwt.view.client.ListDataProvider;
|
||||||
|
@ -44,9 +48,13 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
Button allToLeftButton;
|
Button allToLeftButton;
|
||||||
@UiField
|
@UiField
|
||||||
Button goRootButton;
|
Button goRootButton;
|
||||||
|
@UiField
|
||||||
|
Popover popoverResourceSelection;
|
||||||
|
@UiField
|
||||||
|
Button resourceInfoButton;
|
||||||
|
|
||||||
private final String PANEL_BORDER_COLOR = "#08c";
|
private static final String PANEL_BORDER_COLOR = "#08c";
|
||||||
private final String PANEL_HEIGHT = "400px";
|
private static final String PANEL_HEIGHT = "400px";
|
||||||
private ShowMorePagerPanel showMorePanelLeft = new ShowMorePagerPanel();
|
private ShowMorePagerPanel showMorePanelLeft = new ShowMorePagerPanel();
|
||||||
private ShowMorePagerPanel showMorePanelRight = new ShowMorePagerPanel();
|
private ShowMorePagerPanel showMorePanelRight = new ShowMorePagerPanel();
|
||||||
private CellList<ResourceElementBean> cellListLeft;
|
private CellList<ResourceElementBean> cellListLeft;
|
||||||
|
@ -56,6 +64,9 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
private MultiSelectionModel<ResourceElementBean> selectionModelRight;
|
private MultiSelectionModel<ResourceElementBean> selectionModelRight;
|
||||||
private MultiSelectionModel<ResourceElementBean> selectionModelLeft;
|
private MultiSelectionModel<ResourceElementBean> selectionModelLeft;
|
||||||
private final List<ResourceElementBean> initialElements;
|
private final List<ResourceElementBean> initialElements;
|
||||||
|
private final static HTML aboutHeader = new HTML("<b>Resource Manager</b>");
|
||||||
|
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 TwinColumnSelectionMainPanelUiBinder uiBinder = GWT
|
private static TwinColumnSelectionMainPanelUiBinder uiBinder = GWT
|
||||||
.create(TwinColumnSelectionMainPanelUiBinder.class);
|
.create(TwinColumnSelectionMainPanelUiBinder.class);
|
||||||
|
@ -70,15 +81,19 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
this.initialElements = elements;
|
this.initialElements = elements;
|
||||||
this.buttonsPanel.getElement().getStyle().setMarginTop(50, Unit.PCT);
|
this.buttonsPanel.getElement().getStyle().setMarginTop(50, Unit.PCT);
|
||||||
|
|
||||||
|
goRootButton.getElement().getStyle().setPaddingLeft(0, Unit.PX);
|
||||||
allToRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
allToRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
||||||
toRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
toRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
||||||
toLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
toLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
||||||
allToLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
allToLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX);
|
||||||
buttonsPanel.getElement().setAttribute("align", "center");
|
buttonsPanel.getElement().setAttribute("align", "center");
|
||||||
|
popoverResourceSelection.setPlacement(Placement.LEFT);
|
||||||
|
popoverResourceSelection.setHeading(aboutHeader.getHTML());
|
||||||
|
popoverResourceSelection.setText(aboutBody.getHTML());
|
||||||
|
resourceInfoButton.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
prepareHandlers();
|
prepareHandlers();
|
||||||
initLeftSidePanel(elements);
|
initLeftSidePanel(elements);
|
||||||
initRightSidePanel(elements);
|
initRightSidePanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,26 +118,22 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
selectionModelLeft.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
selectionModelLeft.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||||
public void onSelectionChange(SelectionChangeEvent event) {
|
public void onSelectionChange(SelectionChangeEvent event) {
|
||||||
Iterator<ResourceElementBean> selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator();
|
Iterator<ResourceElementBean> selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator();
|
||||||
|
|
||||||
while (selectedObjectsIterator.hasNext()) {
|
while (selectedObjectsIterator.hasNext()) {
|
||||||
ResourceElementBean selectedBean = (ResourceElementBean) selectedObjectsIterator.next();
|
ResourceElementBean selectedBean = (ResourceElementBean) selectedObjectsIterator.next();
|
||||||
if(selectedBean.isFolder()){
|
if(selectedBean.isFolder()){
|
||||||
if(selectionModelLeft.getSelectedSet().size() == 1){
|
if(selectionModelLeft.getSelectedSet().size() == 1){
|
||||||
GWT.log("Selected folder");
|
|
||||||
dataProviderLeft.setList(selectedBean.getChildren());
|
dataProviderLeft.setList(selectedBean.getChildren());
|
||||||
dataProviderLeft.flush();
|
|
||||||
dataProviderLeft.refresh();
|
dataProviderLeft.refresh();
|
||||||
|
dataProviderLeft.flush();
|
||||||
}
|
}
|
||||||
selectionModelLeft.setSelected(selectedBean, false); // unselect the folder
|
selectionModelLeft.setSelected(selectedBean, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable the buttons that allows to move the objects to the right
|
// enable the buttons that allows to move the objects to the right
|
||||||
enableMoveToRightButtons(selectionModelLeft.getSelectedSet());
|
enableMoveToRightButtons(selectionModelLeft.getSelectedSet());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// set the list into the provider
|
// set the list into the provider
|
||||||
dataProviderLeft.setList(elements);
|
dataProviderLeft.setList(elements);
|
||||||
|
|
||||||
|
@ -137,15 +148,12 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
|
|
||||||
// add the list to the leftContainerPanel
|
// add the list to the leftContainerPanel
|
||||||
leftContainer.add(showMorePanelLeft);
|
leftContainer.add(showMorePanelLeft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the left side panel
|
* Initialize the left side panel
|
||||||
*/
|
*/
|
||||||
private void initRightSidePanel(List<ResourceElementBean> elements) {
|
private void initRightSidePanel() {
|
||||||
|
|
||||||
GWT.log("Size is " + elements.size());
|
|
||||||
|
|
||||||
// initialize the left side list
|
// initialize the left side list
|
||||||
ResourceCellRight cell = new ResourceCellRight();
|
ResourceCellRight cell = new ResourceCellRight();
|
||||||
|
@ -153,7 +161,6 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
// Set a key provider that provides a unique key for each object.
|
// Set a key provider that provides a unique key for each object.
|
||||||
cellListRight = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
|
cellListRight = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
|
||||||
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||||
cellListRight.setPageSize(elements.size());
|
|
||||||
|
|
||||||
// Add a selection model so we can select cells.
|
// Add a selection model so we can select cells.
|
||||||
selectionModelRight = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
|
selectionModelRight = new MultiSelectionModel<ResourceElementBean>(ResourceElementBean.KEY_PROVIDER);
|
||||||
|
@ -162,15 +169,10 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
// perform an action on selection
|
// perform an action on selection
|
||||||
selectionModelRight.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
selectionModelRight.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||||
public void onSelectionChange(SelectionChangeEvent event) {
|
public void onSelectionChange(SelectionChangeEvent event) {
|
||||||
// enable the buttons that allows to move the objects to the left
|
|
||||||
enableMoveToLeftButtons(selectionModelRight.getSelectedSet());
|
enableMoveToLeftButtons(selectionModelRight.getSelectedSet());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// set the list into the provider
|
|
||||||
dataProviderRight.setList(elements);
|
|
||||||
|
|
||||||
// set the cell list into the provider
|
// set the cell list into the provider
|
||||||
dataProviderRight.addDataDisplay(cellListRight);
|
dataProviderRight.addDataDisplay(cellListRight);
|
||||||
|
|
||||||
|
@ -191,7 +193,11 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
*/
|
*/
|
||||||
private void enableMoveToRightButtons(Set<ResourceElementBean> setselectedItemsLeft){
|
private void enableMoveToRightButtons(Set<ResourceElementBean> setselectedItemsLeft){
|
||||||
|
|
||||||
if(setselectedItemsLeft.size() > 1){
|
if(setselectedItemsLeft == null || setselectedItemsLeft.isEmpty()){
|
||||||
|
allToRightButton.setEnabled(false);
|
||||||
|
toRightButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
else if(setselectedItemsLeft.size() > 1){
|
||||||
allToRightButton.setEnabled(true);
|
allToRightButton.setEnabled(true);
|
||||||
toRightButton.setEnabled(false);
|
toRightButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +213,11 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
*/
|
*/
|
||||||
private void enableMoveToLeftButtons(Set<ResourceElementBean> setselectedItemsRight){
|
private void enableMoveToLeftButtons(Set<ResourceElementBean> setselectedItemsRight){
|
||||||
|
|
||||||
if(setselectedItemsRight.size() > 1){
|
if(setselectedItemsRight == null || setselectedItemsRight.isEmpty()){
|
||||||
|
allToLeftButton.setEnabled(false);
|
||||||
|
allToLeftButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
else if(setselectedItemsRight.size() > 1){
|
||||||
allToLeftButton.setEnabled(true);
|
allToLeftButton.setEnabled(true);
|
||||||
toLeftButton.setEnabled(false);
|
toLeftButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -275,51 +285,50 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move to right
|
* Move to right elements
|
||||||
* @param toMoveRight
|
* @param set the elements to move
|
||||||
*/
|
*/
|
||||||
private void moveToRight(Set<ResourceElementBean> set){
|
private void moveToRight(Set<ResourceElementBean> setSelected){
|
||||||
|
|
||||||
if(set == null)
|
if(setSelected == null || setSelected.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Iterator<ResourceElementBean> iterator = set.iterator();
|
Iterator<ResourceElementBean> iterator = setSelected.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator
|
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator
|
||||||
.next();
|
.next();
|
||||||
resourceElementBean.setMovedToRight(true);
|
resourceElementBean.setMovedToRight(true);
|
||||||
GWT.log("To move right " + resourceElementBean);
|
boolean contains = dataProviderRight.getList().contains(resourceElementBean);
|
||||||
|
if(!contains)
|
||||||
|
dataProviderRight.getList().add(resourceElementBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh providers
|
// refresh providers
|
||||||
dataProviderLeft.flush();
|
dataProviderLeft.flush();
|
||||||
dataProviderLeft.refresh();
|
|
||||||
dataProviderRight.flush();
|
dataProviderRight.flush();
|
||||||
|
dataProviderLeft.refresh();
|
||||||
dataProviderRight.refresh();
|
dataProviderRight.refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move to right
|
* Move to left elements
|
||||||
* @param toMoveLeft
|
* @param setSelected the elements to move
|
||||||
*/
|
*/
|
||||||
private void moveToLeft(Set<ResourceElementBean> set){
|
private void moveToLeft(Set<ResourceElementBean> setSelected){
|
||||||
|
|
||||||
if(set == null)
|
if(setSelected == null || setSelected.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Iterator<ResourceElementBean> iterator = set.iterator();
|
Iterator<ResourceElementBean> iterator = setSelected.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator
|
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator.next();
|
||||||
.next();
|
|
||||||
resourceElementBean.setMovedToRight(false);
|
resourceElementBean.setMovedToRight(false);
|
||||||
GWT.log("To move left " + resourceElementBean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh providers
|
// refresh providers
|
||||||
dataProviderLeft.flush();
|
dataProviderLeft.flush();
|
||||||
dataProviderLeft.refresh();
|
|
||||||
dataProviderRight.flush();
|
dataProviderRight.flush();
|
||||||
|
dataProviderLeft.refresh();
|
||||||
dataProviderRight.refresh();
|
dataProviderRight.refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
}
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
|
<g:SimplePanel width="100%">
|
||||||
|
<b:Popover ui:field="popoverResourceSelection" html="true">
|
||||||
|
<b:Button ui:field="resourceInfoButton" type="LINK" icon="INFO_SIGN" size="LARGE"></b:Button>
|
||||||
|
</b:Popover>
|
||||||
|
</g:SimplePanel>
|
||||||
<b:FluidContainer>
|
<b:FluidContainer>
|
||||||
<b:FluidRow>
|
<b:FluidRow>
|
||||||
<b:Column size="3" ui:field="leftColumn">
|
<b:Column size="3" ui:field="leftColumn">
|
||||||
|
@ -20,15 +25,16 @@
|
||||||
<b:Button ui:field="allToRightButton" name="toRight"
|
<b:Button ui:field="allToRightButton" name="toRight"
|
||||||
enabled="false" title="Move selected files to right" text=">>" />
|
enabled="false" title="Move selected files to right" text=">>" />
|
||||||
<b:Button ui:field="toRightButton" name="toRight"
|
<b:Button ui:field="toRightButton" name="toRight"
|
||||||
enabled="false" title="Move file to the right" text=">" />
|
enabled="false" title="Move selected file to the right" text=">" />
|
||||||
<b:Button ui:field="toLeftButton" name="toLeft" enabled="false"
|
<b:Button ui:field="toLeftButton" name="toLeft" enabled="false"
|
||||||
title="Move file to the left" text="<" />
|
title="Move selected file to the left" text="<" />
|
||||||
<b:Button ui:field="allToLeftButton" name="toRight"
|
<b:Button ui:field="allToLeftButton" name="toRight"
|
||||||
enabled="false" title="Move selected files to left" text="<<" />
|
enabled="false" title="Move selected files to left" text="<<" />
|
||||||
</g:VerticalPanel>
|
</g:VerticalPanel>
|
||||||
</b:Column>
|
</b:Column>
|
||||||
<b:Column size="3" ui:field="rightColumn">
|
<b:Column size="3" ui:field="rightColumn">
|
||||||
<g:VerticalPanel ui:field="rightContainer" styleName="{style.right-vertical-panel}" width="100%"></g:VerticalPanel>
|
<g:VerticalPanel ui:field="rightContainer"
|
||||||
|
styleName="{style.right-vertical-panel}" width="100%"></g:VerticalPanel>
|
||||||
</b:Column>
|
</b:Column>
|
||||||
</b:FluidRow>
|
</b:FluidRow>
|
||||||
</b:FluidContainer>
|
</b:FluidContainer>
|
||||||
|
|
|
@ -60,12 +60,13 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
public DataCatalogue getCatalogue(String scope){
|
public DataCatalogue getCatalogue(String scope){
|
||||||
|
|
||||||
DataCatalogue instance = null;
|
DataCatalogue instance = null;
|
||||||
|
String scopeInWhichDiscover = null;
|
||||||
try{
|
try{
|
||||||
String scopeInWhichDiscover = (scope != null && !scope.isEmpty()) ? scope : getASLSession().getScope();
|
scopeInWhichDiscover = (scope != null && !scope.isEmpty()) ? scope : getASLSession().getScope();
|
||||||
logger.debug("Discovering ckan instance into scope " + scopeInWhichDiscover);
|
logger.debug("Discovering ckan instance into scope " + scopeInWhichDiscover);
|
||||||
instance = DataCatalogueFactory.getFactory().getUtilsPerScope(scopeInWhichDiscover);
|
instance = DataCatalogueFactory.getFactory().getUtilsPerScope(scopeInWhichDiscover);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
logger.error("Unable to retrieve ckan utils", e);
|
logger.error("Unable to retrieve ckan utils in scope " + scopeInWhichDiscover, e);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,9 +241,6 @@ public class Utils {
|
||||||
|
|
||||||
logger.debug("Organization name is " + organizationName);
|
logger.debug("Organization name is " + organizationName);
|
||||||
|
|
||||||
// if(organizationName.equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT))
|
|
||||||
// return CKanUtilsImpl.PRODUCTION_SCOPE_ROOT;
|
|
||||||
|
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
List<GCubeGroup> groups = gm.listGroups();
|
List<GCubeGroup> groups = gm.listGroups();
|
||||||
for (GCubeGroup gCubeGroup : groups) {
|
for (GCubeGroup gCubeGroup : groups) {
|
||||||
|
|
|
@ -101,20 +101,21 @@ public class WorkspaceUtils {
|
||||||
Workspace ws = HomeLibrary
|
Workspace ws = HomeLibrary
|
||||||
.getHomeManagerFactory()
|
.getHomeManagerFactory()
|
||||||
.getHomeManager()
|
.getHomeManager()
|
||||||
.getHome(userName).getWorkspace();
|
.getHome().getWorkspace();
|
||||||
|
|
||||||
WorkspaceItem originalFolder = ws.getItem(folderId);
|
WorkspaceItem originalFolder = ws.getItem(folderId);
|
||||||
|
|
||||||
// set some info
|
// set some info
|
||||||
String onlyAlphanumeric = originalFolder.getName().replaceAll("[^A-Za-z0-9.-_]", " "); // that is, remove characters different than the ones inside
|
String onlyAlphanumericTitle = originalFolder.getName().replaceAll("[^A-Za-z0-9.-_]", " "); // that is, remove characters different than the ones inside
|
||||||
bean.setTitle(onlyAlphanumeric);
|
// since it will (likely) be the name of the product
|
||||||
|
bean.setTitle(onlyAlphanumericTitle);
|
||||||
bean.setDescription(originalFolder.getDescription());
|
bean.setDescription(originalFolder.getDescription());
|
||||||
|
|
||||||
// Create the folder in the catalogue
|
// Create the folder in the catalogue
|
||||||
Map<String, String> folderItems = Utils.getGcubeItemProperties(originalFolder);
|
Map<String, String> folderItems = Utils.getGcubeItemProperties(originalFolder);
|
||||||
bean.setCustomFields(folderItems);
|
bean.setCustomFields(folderItems);
|
||||||
|
|
||||||
// check the resources within the folder (skip subdirectories for now TODO)
|
// check the resources within the folder
|
||||||
List<String> childrenIds = new ArrayList<String>();
|
List<String> childrenIds = new ArrayList<String>();
|
||||||
|
|
||||||
for (WorkspaceItem file : originalFolder.getChildren()) {
|
for (WorkspaceItem file : originalFolder.getChildren()) {
|
||||||
|
|
|
@ -17,12 +17,14 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
private boolean toBeAdded;
|
private boolean toBeAdded;
|
||||||
private String mimeType;
|
private String mimeType;
|
||||||
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
|
private String organizationNameDatasetParent; // the organization name in which the parent dataset was created
|
||||||
private List<ResourceBeanWrapper> subResources; // a list of sub resources TODO
|
private List<ResourceBeanWrapper> subResources; // a list of sub resources
|
||||||
|
private ResourceBeanWrapper parentResource;
|
||||||
|
private boolean isFolder;
|
||||||
|
|
||||||
public ResourceBeanWrapper(){
|
public ResourceBeanWrapper(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param url
|
* @param url
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -30,9 +32,16 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
* @param id
|
* @param id
|
||||||
* @param toBeAdded
|
* @param toBeAdded
|
||||||
* @param mimeType
|
* @param mimeType
|
||||||
|
* @param organizationNameDatasetParent
|
||||||
|
* @param subResources
|
||||||
|
* @param parentResource
|
||||||
|
* @param isFolder
|
||||||
*/
|
*/
|
||||||
public ResourceBeanWrapper(String url, String name, String description,
|
public ResourceBeanWrapper(String url, String name, String description,
|
||||||
String id, boolean toBeAdded, String mimeType, String organizationNameDatasetParent) {
|
String id, boolean toBeAdded, String mimeType,
|
||||||
|
String organizationNameDatasetParent,
|
||||||
|
List<ResourceBeanWrapper> subResources,
|
||||||
|
ResourceBeanWrapper parentResource, boolean isFolder) {
|
||||||
super();
|
super();
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -41,6 +50,31 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
this.toBeAdded = toBeAdded;
|
this.toBeAdded = toBeAdded;
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||||
|
this.subResources = subResources;
|
||||||
|
this.parentResource = parentResource;
|
||||||
|
this.isFolder = isFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when the user adds the resources after having created the product
|
||||||
|
* @param url
|
||||||
|
* @param name
|
||||||
|
* @param description
|
||||||
|
* @param id
|
||||||
|
* @param toAdd
|
||||||
|
* @param mimeType
|
||||||
|
* @param datasetOrg
|
||||||
|
*/
|
||||||
|
public ResourceBeanWrapper(String url, String name, String description,
|
||||||
|
String id, boolean toAdd, String mimeType, String datasetOrg) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.url = url;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.toBeAdded = toAdd;
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
this.organizationNameDatasetParent = datasetOrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +118,7 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
|
@ -126,7 +160,7 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
public void setMimeType(String mimeType) {
|
public void setMimeType(String mimeType) {
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the organizationNameDatasetParent
|
* @return the organizationNameDatasetParent
|
||||||
*/
|
*/
|
||||||
|
@ -141,8 +175,7 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
String organizationNameDatasetParent) {
|
String organizationNameDatasetParent) {
|
||||||
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
this.organizationNameDatasetParent = organizationNameDatasetParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ResourceBeanWrapper> getSubResources() {
|
public List<ResourceBeanWrapper> getSubResources() {
|
||||||
return subResources;
|
return subResources;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +184,22 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
this.subResources = subResources;
|
this.subResources = subResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResourceBeanWrapper getParentResource() {
|
||||||
|
return parentResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentResource(ResourceBeanWrapper parentResource) {
|
||||||
|
this.parentResource = parentResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFolder() {
|
||||||
|
return isFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolder(boolean isFolder) {
|
||||||
|
this.isFolder = isFolder;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ResourceBeanWrapper [url=" + url + ", name=" + name
|
return "ResourceBeanWrapper [url=" + url + ", name=" + name
|
||||||
|
@ -158,6 +207,7 @@ public class ResourceBeanWrapper implements Serializable{
|
||||||
+ ", toBeAdded=" + toBeAdded + ", mimeType=" + mimeType
|
+ ", toBeAdded=" + toBeAdded + ", mimeType=" + mimeType
|
||||||
+ ", organizationNameDatasetParent="
|
+ ", organizationNameDatasetParent="
|
||||||
+ organizationNameDatasetParent + ", subResources="
|
+ organizationNameDatasetParent + ", subResources="
|
||||||
+ subResources + "]";
|
+ subResources + ", parentResource=" + parentResource
|
||||||
|
+ ", isFolder=" + isFolder + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue