in progress

This commit is contained in:
Francesco Mangiacrapa 2021-03-08 17:51:04 +01:00
parent d2846cd9f4
commit 79e51db104
8 changed files with 144 additions and 80 deletions

View File

@ -6,7 +6,13 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="src/test/java"/> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<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"/>

View File

@ -265,11 +265,15 @@ public class CKanMetadataPublisher implements EntryPoint {
m.setWidth("1200px"); m.setWidth("1200px");
m.getElement().getStyle().setMarginLeft(-30, Unit.PCT); m.getElement().getStyle().setMarginLeft(-30, Unit.PCT);
ResourceElementBean r = new ResourceElementBean(); ResourceElementBean r = new ResourceElementBean();
r.setFolder(true); r.setFolder(false);
r.setName("Root"); r.setName("Root");
r.setParent(null); r.setParent(null);
r.setChildrenSize(5); r.setChildrenSize(5);
r.setOriginalIdInWorkspace("4ab50488-67d7-4664-9a0f-88a1de043399"); r.setOriginalIdInWorkspace("31d7ec0c-8d31-47d7-9139-c52b5e124349");
ResourceElementBean parent = new ResourceElementBean();
parent.setOriginalIdInWorkspace("91409eba-0bf6-4aa5-8d73-3536bf181587");
r.setParent(parent);
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>(); List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();

View File

@ -1247,15 +1247,15 @@ public class CreateDatasetForm extends Composite{
); );
// resources field // resources field
InfoIconsLabels.preparePopupPanelAndPopover( // InfoIconsLabels.preparePopupPanelAndPopover(
InfoIconsLabels.RESOURCES_INFO_ID_POPUP, // InfoIconsLabels.RESOURCES_INFO_ID_POPUP,
InfoIconsLabels.RESOURCES_INFO_TEXT, // InfoIconsLabels.RESOURCES_INFO_TEXT,
InfoIconsLabels.RESOURCES_INFO_CAPTION, // InfoIconsLabels.RESOURCES_INFO_CAPTION,
infoIconResources, // infoIconResources,
popoverResources, // popoverResources,
focusPanelResources, // focusPanelResources,
popupOpenedIds // popupOpenedIds
); // );
// title // title
InfoIconsLabels.preparePopupPanelAndPopover( InfoIconsLabels.preparePopupPanelAndPopover(

View File

@ -320,7 +320,6 @@
Manage Resources Manage Resources
</b:Legend> </b:Legend>
<b:ControlGroup> <b:ControlGroup>
<b:Controls>
<span style="float:right; width:5%; color: #aaaaaa;"> <span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverResources" html="true" <b:Popover ui:field="popoverResources" html="true"
animation="true" placement="LEFT"> animation="true" placement="LEFT">
@ -329,13 +328,9 @@
</g:FocusPanel> </g:FocusPanel>
</b:Popover> </b:Popover>
</span> </span>
</b:Controls> <g:SimplePanel ui:field="workspaceResourcesContainer" width="100%" visible="true"></g:SimplePanel>
</b:ControlGroup> </b:ControlGroup>
<g:SimplePanel ui:field="workspaceResourcesContainer"
width="100%" visible="true">
</g:SimplePanel>
<b:Button title="Continue" ui:field="continueThirdStep" <b:Button title="Continue" ui:field="continueThirdStep"
type="PRIMARY" block="true">Continue</b:Button> type="PRIMARY" block="true">Continue</b:Button>

View File

@ -4,20 +4,25 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesBExplorerPanel;
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel; import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectBNotification.WorskpaceExplorerSelectBNotificationListener; import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD; import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.wsexplorer.shared.Item; import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
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;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
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;
@ -41,9 +46,18 @@ public class SelectResourceByWEMainPanel extends Composite {
@UiField @UiField
VerticalPanel selectResourcesContainer; VerticalPanel selectResourcesContainer;
@UiField
Alert showAlert;
@UiField @UiField
Button buttSelectResource; Button buttSelectResource;
@UiField
AccordionGroup buttPickResources;
@UiField
HTMLPanel containerPickResources;
private Item selectedWEItem; private Item selectedWEItem;
Map<String, SelectResourceWidget> mapSelectedResources = new HashMap<String, SelectResourceWidget>(); Map<String, SelectResourceWidget> mapSelectedResources = new HashMap<String, SelectResourceWidget>();
@ -67,57 +81,60 @@ public class SelectResourceByWEMainPanel extends Composite {
this.frozen = false; this.frozen = false;
this.initialBean = initialBean; this.initialBean = initialBean;
//this.buttPickResources.setType(ButtonType.LINK);
WorkspaceResourcesExplorerPanel rp = null; WorkspaceResourcesExplorerPanel rp = null;
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
DISPLAY_FIELD.OWNER }; DISPLAY_FIELD.OWNER, DISPLAY_FIELD.CREATION_DATE};
try { try {
String wsRootId = initialBean.isFolder() ? initialBean.getOriginalIdInWorkspace()
: initialBean.getParent().getOriginalIdInWorkspace(); String wsRootId = null;
// WorkspaceResourcesBExplorerPanel(String folderId, boolean showOnlyFolders, if(initialBean.isFolder()) {
// List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, wsRootId = initialBean.getOriginalIdInWorkspace();
// DISPLAY_FIELD sortByColumn) throws Exception { }else {
WorkspaceResourcesBExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesBExplorerPanel(wsRootId, //is file
false); wsRootId= initialBean.getParent()!=null? initialBean.getParent().getOriginalIdInWorkspace():null;
WorskpaceExplorerSelectBNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectBNotificationListener() { }
//loads the WE only if the root is not null
if(wsRootId!=null) {
WorkspaceResourcesExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesExplorerPanel(wsRootId,false,null, null,false,null,displayFields);
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
@Override
@Override public void onSelectedItem(Item item) {
public void onSelectedItem(Item item) { GWT.log("Listener Selected Item " + item);
GWT.log("Listener Selected Item " + item); selectedWEItem = item;
selectedWEItem = item; }
}
@Override
@Override public void onFailed(Throwable throwable) {
public void onFailed(Throwable throwable) { // Log.error(throwable.getLocalizedMessage());
// Log.error(throwable.getLocalizedMessage()); throwable.printStackTrace();
throwable.printStackTrace(); }
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
selectedWEItem = null;
}
};
workspaceExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
wsContainer.add(workspaceExplorerPanel);
}else {
containerPickResources.setVisible(false);
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
selectedWEItem = null;
}
@Override
public void onBreadcrumbChanged(Item item) {
GWT.log("Breadcrumb Changed: " + item);
}
};
workspaceExplorerPanel.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
wsContainer.add(workspaceExplorerPanel);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -131,7 +148,7 @@ public class SelectResourceByWEMainPanel extends Composite {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
if(selectedWEItem!=null) { if(selectedWEItem!=null && !selectedWEItem.isFolder()) {
addSelectResource(selectedWEItem.getId(), selectedWEItem.getName(), selectedWEItem.getPath()); addSelectResource(selectedWEItem.getId(), selectedWEItem.getName(), selectedWEItem.getPath());
} }
@ -144,7 +161,7 @@ public class SelectResourceByWEMainPanel extends Composite {
SelectResourceWidget selWidg = mapSelectedResources.get(wsItemId); SelectResourceWidget selWidg = mapSelectedResources.get(wsItemId);
if (selWidg != null) { if (selWidg != null) {
Window.alert("Item '" + name + "' already selected"); showAlertMsg(AlertType.WARNING,"Item '" + name + "' already selected",true);
return; return;
} }
@ -156,10 +173,28 @@ public class SelectResourceByWEMainPanel extends Composite {
selWidg = new SelectResourceWidget(rb); selWidg = new SelectResourceWidget(rb);
mapSelectedResources.put(wsItemId, selWidg); mapSelectedResources.put(wsItemId, selWidg);
selectResourcesContainer.add(selWidg); selectResourcesContainer.add(selWidg);
} }
private void showAlertMsg(AlertType type, String txt, boolean autoHide) {
showAlert.setType(type);
showAlert.setText(txt);
showAlert.setVisible(true);
showAlert.setClose(true);
if(autoHide) {
Timer timer = new Timer() {
@Override
public void run() {
showAlert.setVisible(false);
}
};
timer.schedule(5000);
}
}
public ResourceElementBean getResourcesToPublish() { public ResourceElementBean getResourcesToPublish() {
// TODO Auto-generated method stub // TODO Auto-generated method stub

View File

@ -6,21 +6,35 @@
.important { .important {
font-weight: bold; font-weight: bold;
} }
.margin-bottom-40 {
margin-bottom: 40px;
}
.max-height-250 {
max-height: 250px;
overflow-y: auto;
}
</ui:style> </ui:style>
<g:HTMLPanel width="90%"> <g:HTMLPanel width="96%">
<g:VerticalPanel> <g:HTMLPanel addStyleNames="{style.margin-bottom-40}">
<b:Accordion>
<b:AccordionGroup heading="Pick Resources"
defaultOpen="true">
<g:VerticalPanel ui:field="wsContainer">
</g:VerticalPanel>
<b:Button ui:field="buttSelectResource">Select Resource</b:Button>
</b:AccordionGroup>
</b:Accordion>
</g:VerticalPanel>
<g:HTMLPanel>
<b:PageHeader subtext="Resources">Selected</b:PageHeader> <b:PageHeader subtext="Resources">Selected</b:PageHeader>
<b:Alert ui:field="showAlert" visible="false"></b:Alert>
<g:VerticalPanel ui:field="selectResourcesContainer"></g:VerticalPanel> <g:VerticalPanel ui:field="selectResourcesContainer"></g:VerticalPanel>
</g:HTMLPanel> </g:HTMLPanel>
<g:HTMLPanel ui:field="containerPickResources"
addStyleNames="{style.max-height-250}">
<b:AccordionGroup ui:field="buttPickResources"
heading="Pick Resources" defaultOpen="true">
<b:FluidRow>
<g:VerticalPanel ui:field="wsContainer">
</g:VerticalPanel>
<b:Button ui:field="buttSelectResource">Select</b:Button>
</b:FluidRow>
</b:AccordionGroup>
</g:HTMLPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder>

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiField;
@ -40,6 +41,9 @@ public class SelectResourceWidget extends Composite {
this.fieldName.setText(rb.getEditableName()); this.fieldName.setText(rb.getEditableName());
buttonEdit.setType(ButtonType.LINK);
buttonDelete.setType(ButtonType.LINK);
} }
} }

View File

@ -6,11 +6,17 @@
.important { .important {
font-weight: bold; font-weight: bold;
} }
.selected-resources {
}
.selected-resources td {
vertical-align: middle !important;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<g:HorizontalPanel> <g:HorizontalPanel addStyleNames="{style.selected-resources}">
<b:Button ui:field="buttonDelete" icon="TRASH" /> <b:Button ui:field="buttonDelete" icon="TRASH" title="Remove this resource" />
<b:Button ui:field="buttonEdit" icon="PENCIL" /> <b:Button ui:field="buttonEdit" icon="PENCIL" title="Edit the resource title"/>
<b:Label ui:field="fieldName"></b:Label> <b:Label ui:field="fieldName"></b:Label>
</g:HorizontalPanel> </g:HorizontalPanel>
</g:HTMLPanel> </g:HTMLPanel>