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"/>
</attributes>
</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">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -265,11 +265,15 @@ public class CKanMetadataPublisher implements EntryPoint {
m.setWidth("1200px");
m.getElement().getStyle().setMarginLeft(-30, Unit.PCT);
ResourceElementBean r = new ResourceElementBean();
r.setFolder(true);
r.setFolder(false);
r.setName("Root");
r.setParent(null);
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>();

View File

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

View File

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

View File

@ -4,20 +4,25 @@ import java.util.HashMap;
import java.util.Map;
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.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.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.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
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.Timer;
import com.google.gwt.user.client.Window;
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.Widget;
@ -41,9 +46,18 @@ public class SelectResourceByWEMainPanel extends Composite {
@UiField
VerticalPanel selectResourcesContainer;
@UiField
Alert showAlert;
@UiField
Button buttSelectResource;
@UiField
AccordionGroup buttPickResources;
@UiField
HTMLPanel containerPickResources;
private Item selectedWEItem;
Map<String, SelectResourceWidget> mapSelectedResources = new HashMap<String, SelectResourceWidget>();
@ -67,57 +81,60 @@ public class SelectResourceByWEMainPanel extends Composite {
this.frozen = false;
this.initialBean = initialBean;
//this.buttPickResources.setType(ButtonType.LINK);
WorkspaceResourcesExplorerPanel rp = null;
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
DISPLAY_FIELD.OWNER };
DISPLAY_FIELD.OWNER, DISPLAY_FIELD.CREATION_DATE};
try {
String wsRootId = initialBean.isFolder() ? initialBean.getOriginalIdInWorkspace()
: initialBean.getParent().getOriginalIdInWorkspace();
// WorkspaceResourcesBExplorerPanel(String folderId, boolean showOnlyFolders,
// List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo,
// DISPLAY_FIELD sortByColumn) throws Exception {
WorkspaceResourcesBExplorerPanel workspaceExplorerPanel = new WorkspaceResourcesBExplorerPanel(wsRootId,
false);
WorskpaceExplorerSelectBNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectBNotificationListener() {
String wsRootId = null;
if(initialBean.isFolder()) {
wsRootId = initialBean.getOriginalIdInWorkspace();
}else {
//is file
wsRootId= initialBean.getParent()!=null? initialBean.getParent().getOriginalIdInWorkspace():null;
}
//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
public void onSelectedItem(Item item) {
GWT.log("Listener Selected Item " + item);
selectedWEItem = item;
}
@Override
public void onFailed(Throwable throwable) {
// Log.error(throwable.getLocalizedMessage());
throwable.printStackTrace();
}
@Override
public void onSelectedItem(Item item) {
GWT.log("Listener Selected Item " + item);
selectedWEItem = item;
}
@Override
public void onFailed(Throwable throwable) {
// Log.error(throwable.getLocalizedMessage());
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) {
e.printStackTrace();
}
@ -131,7 +148,7 @@ public class SelectResourceByWEMainPanel extends Composite {
@Override
public void onClick(ClickEvent event) {
if(selectedWEItem!=null) {
if(selectedWEItem!=null && !selectedWEItem.isFolder()) {
addSelectResource(selectedWEItem.getId(), selectedWEItem.getName(), selectedWEItem.getPath());
}
@ -144,7 +161,7 @@ public class SelectResourceByWEMainPanel extends Composite {
SelectResourceWidget selWidg = mapSelectedResources.get(wsItemId);
if (selWidg != null) {
Window.alert("Item '" + name + "' already selected");
showAlertMsg(AlertType.WARNING,"Item '" + name + "' already selected",true);
return;
}
@ -156,10 +173,28 @@ public class SelectResourceByWEMainPanel extends Composite {
selWidg = new SelectResourceWidget(rb);
mapSelectedResources.put(wsItemId, 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() {
// TODO Auto-generated method stub

View File

@ -6,21 +6,35 @@
.important {
font-weight: bold;
}
.margin-bottom-40 {
margin-bottom: 40px;
}
.max-height-250 {
max-height: 250px;
overflow-y: auto;
}
</ui:style>
<g:HTMLPanel width="90%">
<g:VerticalPanel>
<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>
<g:HTMLPanel width="96%">
<g:HTMLPanel addStyleNames="{style.margin-bottom-40}">
<b:PageHeader subtext="Resources">Selected</b:PageHeader>
<b:Alert ui:field="showAlert" visible="false"></b:Alert>
<g:VerticalPanel ui:field="selectResourcesContainer"></g:VerticalPanel>
</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>
</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 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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@ -40,6 +41,9 @@ public class SelectResourceWidget extends Composite {
this.fieldName.setText(rb.getEditableName());
buttonEdit.setType(ButtonType.LINK);
buttonDelete.setType(ButtonType.LINK);
}
}

View File

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