In progress on "View Relations" facility
This commit is contained in:
parent
8c1392b8ff
commit
f110ae1685
|
@ -26,11 +26,13 @@ public class GeoPortalClientCaches {
|
|||
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
|
||||
|
||||
private Map<String, List<ConfigurationDV<?>>> mapHandlersConfigurationsForProfileId;
|
||||
|
||||
|
||||
private Map<String, UseCaseDescriptorDV> mapUseCaseDescriptor;
|
||||
|
||||
private Map<String, CacheSearchingFilterParametersFromConfig> mapSearchingFilterParametersForProfileId;
|
||||
|
||||
private Map<String, List<String>> mapRelationsNamesForProfileId;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo portal client caches.
|
||||
*/
|
||||
|
@ -39,6 +41,7 @@ public class GeoPortalClientCaches {
|
|||
mapHandlersConfigurationsForProfileId = new HashMap<String, List<ConfigurationDV<?>>>();
|
||||
mapSearchingFilterParametersForProfileId = new HashMap<String, GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig>();
|
||||
mapUseCaseDescriptor = new HashMap<String, UseCaseDescriptorDV>();
|
||||
mapRelationsNamesForProfileId = new HashMap<String, List<String>>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,23 +54,43 @@ public class GeoPortalClientCaches {
|
|||
mapHandlersConfigurationsForProfileId.put(profileId, lsitConfigurations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put list relation names for profile ID.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @param listRealationNames the list realation names
|
||||
*/
|
||||
public void putListRelationNamesForProfileID(String profileId, List<String> listRealationNames) {
|
||||
mapRelationsNamesForProfileId.put(profileId, listRealationNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list relation names for profile id.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @return the list relation names for profile id
|
||||
*/
|
||||
public List<String> getListRelationNamesForProfileId(String profileId) {
|
||||
return mapRelationsNamesForProfileId.get(profileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put UCD for profile id.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param ucdDV the ucd DV
|
||||
* @param ucdDV the ucd DV
|
||||
*/
|
||||
public void putUCDForProfileId(String profileID, UseCaseDescriptorDV ucdDV) {
|
||||
mapUseCaseDescriptor.put(profileID, ucdDV);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the UCD for profile ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the UCD for profile ID
|
||||
*/
|
||||
public UseCaseDescriptorDV getUCDForProfileID(String profileID){
|
||||
public UseCaseDescriptorDV getUCDForProfileID(String profileID) {
|
||||
return mapUseCaseDescriptor.get(profileID);
|
||||
}
|
||||
|
||||
|
@ -130,7 +153,7 @@ public class GeoPortalClientCaches {
|
|||
searchingFilterParameters.addDisplayField(itemField);
|
||||
// adding to projection for filtering
|
||||
for (String jsonFieldPath : itemField.getJsonFields()) {
|
||||
//String mongoProjection = itemField.getProjection() + "." + jsonField;
|
||||
// String mongoProjection = itemField.getProjection() + "." + jsonField;
|
||||
searchingFilterParameters.putMongoProjection(jsonFieldPath, 1);
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +207,7 @@ public class GeoPortalClientCaches {
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 13, 2022
|
||||
* Sep 13, 2022
|
||||
*/
|
||||
public class CacheSearchingFilterParametersFromConfig {
|
||||
|
||||
|
@ -209,7 +232,7 @@ public class GeoPortalClientCaches {
|
|||
* Put mongo projection.
|
||||
*
|
||||
* @param keyField the key field
|
||||
* @param value the value
|
||||
* @param value the value
|
||||
*/
|
||||
public void putMongoProjection(String keyField, Object value) {
|
||||
projection.put(keyField, value);
|
||||
|
|
|
@ -270,6 +270,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initGUI() {
|
||||
|
@ -341,7 +342,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
mainTabPanel.initMainAccordingToListUseCaseDescriptors(listUCDescriptors);
|
||||
|
||||
for (UseCaseDescriptorDV ucdDV : listUCDescriptors) {
|
||||
for (final UseCaseDescriptorDV ucdDV : listUCDescriptors) {
|
||||
|
||||
List<ConfigurationDV<?>> listConfigurations = geoportalCaches
|
||||
.getHandlerConfigurationsForProfileId(ucdDV.getProfileID());
|
||||
|
@ -764,10 +765,39 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
|
||||
.getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
|
||||
|
||||
String profileID = getListOfRecordsEvent.getProfileID();
|
||||
if (profileID == null) {
|
||||
new DialogInform(null, "Error", "No Use Case Descriptor selected").center();
|
||||
return;
|
||||
}
|
||||
|
||||
if (searchingFilter == null || getListOfRecordsEvent.isOnApplicationInit()
|
||||
|| getListOfRecordsEvent.isReloadFilteringParameters()) {
|
||||
mainTabPanel.setFilteringParameters(seachingFilterParameters);
|
||||
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
|
||||
|
||||
//Searching in the cache if the list of relation names is present
|
||||
List<String> listRelationNames = geoportalCaches.getListRelationNamesForProfileId(profileID);
|
||||
// Loading list of Relation Names for ProfileID
|
||||
if (listRelationNames == null || listRelationNames.isEmpty()) {
|
||||
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(profileID,
|
||||
new AsyncCallback<List<String>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<String> relationshipNames) {
|
||||
GWT.log("getRelationshipNames for " + profileID + " are: "+relationshipNames);
|
||||
geoportalCaches.putListRelationNamesForProfileID(profileID, relationshipNames);
|
||||
mainTabPanel.setVisibleCreateRelationButton(
|
||||
relationshipNames != null && !relationshipNames.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO MUST MANAGE getListOfRecordsEvent.isReloadFilteringParameters()
|
||||
|
@ -776,20 +806,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields();
|
||||
|
||||
String profileID = getListOfRecordsEvent.getProfileID();
|
||||
if (profileID == null) {
|
||||
new DialogInform(null, "Error", "No Use Case Descriptor selected").center();
|
||||
return;
|
||||
}
|
||||
|
||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter);
|
||||
|
||||
mainTabPanel.showListOfConcessioniView(grpw);
|
||||
mainTabPanel.showListOfProjectsView(grpw);
|
||||
|
||||
// The Project Type is changed
|
||||
if (getListOfRecordsEvent.isReloadFilteringParameters()) {
|
||||
// Setting the action panel according to profileID
|
||||
mainTabPanel.initActionListPanel(geoportalCaches.getUCDForProfileID(profileID));
|
||||
// Displaying the create relation button only if list of relation names exits
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -856,21 +884,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
Alert alert = new Alert();
|
||||
alert.setType(AlertType.SUCCESS);
|
||||
alert.setClose(false);
|
||||
alert.setText("Relationship "+relName+" created correctly!");
|
||||
alert.setText("Relationship " + relName + " created correctly!");
|
||||
modal.add(alert);
|
||||
|
||||
String htmlMsg = "In the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + fromProjectID + "</li>";
|
||||
htmlMsg += "<li>profile: " + fromProfileID + "</li>";
|
||||
htmlMsg += "<li>"
|
||||
+ createRelationHE.getFromProject().getFirstEntryOfMap().getKey()
|
||||
+ ": "
|
||||
+ createRelationHE.getFromProject().getFirstEntryOfMap().getValue()
|
||||
htmlMsg += "<li>" + createRelationHE.getFromProject().getFirstEntryOfMap().getKey()
|
||||
+ ": " + createRelationHE.getFromProject().getFirstEntryOfMap().getValue()
|
||||
+ "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "has been created the relationship <b>" + relName + "</b> to the project wiht id: "
|
||||
+ toProjectID;
|
||||
htmlMsg += "has been created the relationship <b>" + relName
|
||||
+ "</b> to the project wiht id: " + toProjectID;
|
||||
modal.add(new HTML(htmlMsg));
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("Relationship", result.getAsJSON(),
|
||||
false, false);
|
||||
|
@ -1229,10 +1255,13 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
break;
|
||||
}
|
||||
|
||||
// case UPDATED_PROJECT:
|
||||
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
// mainTabPanel.getCurrentSortFilter()));
|
||||
// break;
|
||||
case VIEW_RELATIONSHIPS: {
|
||||
|
||||
mainTabPanel.showViewProjectRelationsPanel(true, resultDocumentDV);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DELETE_PROJECT: {
|
||||
|
||||
String htmlMsg = "Going to delete the project with:";
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
|
@ -189,15 +190,35 @@ public interface GeoportalDataEntryService extends RemoteService {
|
|||
/**
|
||||
* Creates the relationship.
|
||||
*
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param relationshipName the relationship name
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @return the relationship DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
RelationshipDV createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
|
||||
String toProfileID, String toProjectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the project by ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the project by ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ProjectDV getProjectByID(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the result document fo project by ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the result document fo project by ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
|
@ -89,4 +90,8 @@ public interface GeoportalDataEntryServiceAsync {
|
|||
void createRelationship(String fromProfileID, String fromProjectID, String relationshipName, String toProfileID,
|
||||
String toProjectID, AsyncCallback<RelationshipDV> callback);
|
||||
|
||||
void getProjectByID(String profileID, String projectID, AsyncCallback<ProjectDV> callback);
|
||||
|
||||
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryM
|
|||
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectTablePanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectWorkflowActionsPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.CreateRelationProjectsPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.ViewRelationshipPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.UCD_Util;
|
||||
|
@ -103,6 +104,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@UiField
|
||||
NavLink navCreateRelation;
|
||||
|
||||
@UiField
|
||||
NavLink navViewRelations;
|
||||
|
||||
@UiField
|
||||
Label roleLabel;
|
||||
|
||||
|
@ -130,6 +134,8 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
private CreateRelationProjectsPanel createRelationProjectsPanel;
|
||||
|
||||
private ViewRelationshipPanel viewRelationshipPanel;
|
||||
|
||||
private ScrollPanel detailsPanel = new ScrollPanel();
|
||||
|
||||
private ListOfProjectTablePanel listOfProjectTablePanel;
|
||||
|
@ -277,6 +283,23 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
navViewRelations.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
OperationOnItemEvent oIE = new OperationOnItemEvent<DocumentDV>(listDocuments,
|
||||
OPERATION_ON_ITEM.VIEW_RELATIONSHIPS);
|
||||
oIE.setSourceElement(navViewRelations.getElement());
|
||||
appManagerBus.fireEvent(
|
||||
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_RELATIONSHIPS));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -304,13 +327,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show list of concessioni view.
|
||||
* Show list of projects view.
|
||||
*
|
||||
* @param grpw the grpw
|
||||
*/
|
||||
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
||||
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
|
||||
this.grpw = grpw;
|
||||
listOfProjectTablePanel.showListOfConcessioniView(grpw);
|
||||
listOfProjectTablePanel.showListOfProjectsView(grpw);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,6 +506,10 @@ public class GeonaMainTabPanel extends Composite {
|
|||
createRelationProjectsPanel.selectedProject((ResultDocumentDV) selectItems.get(0));
|
||||
}
|
||||
|
||||
if (viewRelationshipPanel != null && viewRelationshipPanel.isVisible()) {
|
||||
viewRelationshipPanel.showRelationsOf((ResultDocumentDV) selectItems.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -519,9 +546,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
* Show create relation panel.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param resultDocumentDV the result document DV
|
||||
* @param selectedDocument the document DV
|
||||
*/
|
||||
public void showCreateRelationPanel(boolean bool, ResultDocumentDV resultDocumentDV) {
|
||||
public void showCreateRelationPanel(boolean bool, ResultDocumentDV selectedDocument) {
|
||||
detailsPanel.clear();
|
||||
// theDetailsPanel.setVisible(bool);
|
||||
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
|
||||
|
@ -529,8 +556,35 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (!bool) {
|
||||
return;
|
||||
}
|
||||
createRelationProjectsPanel = new CreateRelationProjectsPanel(appManagerBus, resultDocumentDV);
|
||||
createRelationProjectsPanel = new CreateRelationProjectsPanel(appManagerBus, selectedDocument);
|
||||
detailsPanel.add(createRelationProjectsPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show view project relations panel.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param resultDocumentDV the result document DV
|
||||
*/
|
||||
public void showViewProjectRelationsPanel(boolean bool, ResultDocumentDV selectedDocument) {
|
||||
detailsPanel.clear();
|
||||
// theDetailsPanel.setVisible(bool);
|
||||
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
|
||||
// if hiding, returns
|
||||
if (!bool) {
|
||||
return;
|
||||
}
|
||||
viewRelationshipPanel = new ViewRelationshipPanel(appManagerBus, selectedDocument);
|
||||
detailsPanel.add(viewRelationshipPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visible create relation.
|
||||
*
|
||||
* @param bool the new visible create relation
|
||||
*/
|
||||
public void setVisibleCreateRelationButton(boolean bool) {
|
||||
navCreateRelation.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
position: relative;
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
.divider-border-right {
|
||||
border-left: 1px solid #ccc !important;
|
||||
height: 35px !important;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:PageHeader subtext="data entry facility"
|
||||
|
@ -98,8 +103,13 @@
|
|||
icon="PENCIL">Edit</b:NavLink>
|
||||
<b:NavLink ui:field="navDelete" title="Delete Project"
|
||||
icon="TRASH">Delete Project</b:NavLink>
|
||||
<b:Divider addStyleNames="{style.divider-border-right}" />
|
||||
<b:NavLink ui:field="navCreateRelation"
|
||||
title="Create Relation" icon="LINK">Create Relation</b:NavLink>
|
||||
title="Create Relation between two Projects" icon="LINK">Create
|
||||
Relation</b:NavLink>
|
||||
<b:NavLink ui:field="navViewRelations"
|
||||
title="View the relations created for a Project" icon="LIST_ALT">View
|
||||
Relations</b:NavLink>
|
||||
</b:NavPills>
|
||||
</g:FlowPanel>
|
||||
<g:DockLayoutPanel ui:field="theDockLayoutPanel">
|
||||
|
|
|
@ -6,13 +6,21 @@
|
|||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
.action-panel-style {
|
||||
|
||||
.action-panel {
|
||||
display: flex;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.action-title {
|
||||
color: #777;
|
||||
font-size: 14px;
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="actionListBasePanel" addStyleNames="{style.action-panel-style}">
|
||||
<g:Label>WORKFLOW ACTIONS</g:Label>
|
||||
<g:HTMLPanel ui:field="actionListBasePanel"
|
||||
addStyleNames="{style.action-panel}">
|
||||
<g:HTML addStyleNames="{style.action-title}">WORKFLOW ACTIONS</g:HTML>
|
||||
<g:HTMLPanel ui:field="actionListContainer"></g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -19,6 +19,7 @@ import com.github.gwtbootstrap.client.ui.Alert;
|
|||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
|
@ -78,6 +79,9 @@ public class ListOfProjectTablePanel extends Composite {
|
|||
|
||||
@UiField
|
||||
Dropdown ddProjectType;
|
||||
|
||||
@UiField
|
||||
Paragraph noProjectSelectionMessage;
|
||||
|
||||
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
|
||||
|
||||
|
@ -312,7 +316,9 @@ public class ListOfProjectTablePanel extends Composite {
|
|||
this.ucdProjectTypesForListingDataView = ucdProjectTypesForListingDataView;
|
||||
// If the list of UCDProjectType for listing is not empty.. FIRE THE EVENT OF
|
||||
// SELECTION on the first item
|
||||
noProjectSelectionMessage.setVisible(true);
|
||||
if (ucdProjectTypesForListingDataView.size() > 0) {
|
||||
noProjectSelectionMessage.setVisible(false);
|
||||
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
|
||||
alertProjectType.setText(singleUCD.getName());
|
||||
// setFilteringParameters(displayFields, sortByFields, searchForFields,
|
||||
|
@ -425,12 +431,7 @@ public class ListOfProjectTablePanel extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show list of concessioni view.
|
||||
*
|
||||
* @param grpw the grpw
|
||||
*/
|
||||
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
||||
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
|
||||
this.grpw = grpw;
|
||||
geonaListOfRecordsPanel.clear();
|
||||
VerticalPanel htmllPanel = new VerticalPanel();
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<a href="#bottomPage2">Go to bottom</a>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="geonaListOfRecordsPanel">
|
||||
<b:Paragraph ui:field="noProjectSelectionMessage">select "Project Type"</b:Paragraph>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="bottomPage2"></div>
|
||||
|
|
|
@ -37,8 +37,6 @@ public class CreateRelationProjectsPanel extends Composite {
|
|||
interface CreateRelationProjectsPanelUiBinder extends UiBinder<Widget, CreateRelationProjectsPanel> {
|
||||
}
|
||||
|
||||
private String profileID;
|
||||
|
||||
@UiField
|
||||
HTMLPanel firstPanelContainer;
|
||||
|
||||
|
@ -100,11 +98,21 @@ public class CreateRelationProjectsPanel extends Composite {
|
|||
|
||||
listBoxRelationNames.setWidth("90%");
|
||||
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(profileID,
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipNames(project.getProfileID(),
|
||||
new AsyncCallback<List<String>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<String> relationshipNames) {
|
||||
|
||||
if (relationshipNames == null || relationshipNames.size() == 0) {
|
||||
buttCreateRelation.setEnabled(false);
|
||||
alertMessage
|
||||
.setText("You cannot create a relationship. No configuration found in the UCD for: "
|
||||
+ project.getProfileID());
|
||||
alertMessage.setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (String relName : relationshipNames) {
|
||||
listBoxRelationNames.addItem(relName, relName);
|
||||
}
|
||||
|
@ -113,7 +121,8 @@ public class CreateRelationProjectsPanel extends Composite {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
alertMessage.setText("Error on reading the relationship names. Error: " + caught.getMessage());
|
||||
return;
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -36,6 +36,14 @@
|
|||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.panel-style table {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.panel-container-style {
|
||||
padding-left: 10px;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel>
|
||||
|
@ -52,7 +60,7 @@
|
|||
<b:Alert ui:field="firstItemAlert">Select project from the "List of
|
||||
Projects"
|
||||
Table</b:Alert>
|
||||
<g:FlowPanel ui:field="firstProjectPanelContainer"></g:FlowPanel>
|
||||
<g:FlowPanel ui:field="firstProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.list-box-delimiter}">
|
||||
|
@ -68,7 +76,7 @@
|
|||
<b:Alert ui:field="secondItemAlert">Select project from the "List of
|
||||
Projects"
|
||||
Table</b:Alert>
|
||||
<g:FlowPanel ui:field="secondProjectPanelContainer"></g:FlowPanel>
|
||||
<g:FlowPanel ui:field="secondProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
<b:Alert type="ERROR" ui:field="alertMessage" visible="false"></b:Alert>
|
||||
<b:Button type="PRIMARY" ui:field="buttCreateRelation"
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandlerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ViewRelationshipPanel extends Composite {
|
||||
|
||||
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
|
||||
|
||||
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
|
||||
}
|
||||
|
||||
private String profileID;
|
||||
|
||||
@UiField
|
||||
HTMLPanel firstPanelContainer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelTitle;
|
||||
|
||||
@UiField
|
||||
HTMLPanel secondPanelContainer;
|
||||
|
||||
@UiField
|
||||
FlowPanel firstProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
FlowPanel secondProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
Button closeButton;
|
||||
|
||||
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
public ViewRelationshipPanel(HandlerManager appManagerBus, ResultDocumentDV fromProject) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
|
||||
closeButton.setType(ButtonType.LINK);
|
||||
closeButton.setIcon(IconType.REMOVE);
|
||||
closeButton.setIconSize(IconSize.LARGE);
|
||||
|
||||
closeButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
|
||||
}
|
||||
});
|
||||
|
||||
showRelationsOf(fromProject);
|
||||
}
|
||||
|
||||
public void showRelationsOf(ResultDocumentDV project) {
|
||||
firstProjectPanelContainer.clear();
|
||||
secondProjectPanelContainer.clear();
|
||||
|
||||
String htmlMsg = "<b>" + project.getFirstEntryOfMap().getKey() + ": " + project.getFirstEntryOfMap().getValue()
|
||||
+ "</b> (id: " + project.getId() + ")";
|
||||
|
||||
firstProjectPanelContainer.add(new HTML(htmlMsg));
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
|
||||
rtth.showAsJSON(false);
|
||||
firstProjectPanelContainer.add(rtth);
|
||||
|
||||
HTML labelNoRelations = new HTML("No relationship/s found");
|
||||
secondProjectPanelContainer.add(labelNoRelations);
|
||||
|
||||
if (project.getListRelationshipDV() != null && project.getListRelationshipDV().size() > 0) {
|
||||
|
||||
secondProjectPanelContainer.clear();
|
||||
|
||||
for (RelationshipDV relationDV : project.getListRelationshipDV()) {
|
||||
final FlexTable flexTable = new FlexTable();
|
||||
flexTable.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
Label label = new Label();
|
||||
label.setType(LabelType.INFO);
|
||||
label.setText(relationDV.getRelationshipName());
|
||||
flexTable.setWidget(0, 0, label);
|
||||
flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(project.getProfileID(),
|
||||
project.getId(), new AsyncCallback<ResultDocumentDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResultDocumentDV result) {
|
||||
String htmlMsg = "<b>" + project.getFirstEntryOfMap().getValue() + "</b> (id: "
|
||||
+ project.getId() + ")";
|
||||
|
||||
flexTable.setWidget(1, 0, new HTML(htmlMsg));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
|
||||
rtth.showAsJSON(false);
|
||||
|
||||
flexTable.setWidget(2, 0, rtth2);
|
||||
secondProjectPanelContainer.add(flexTable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<!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>
|
||||
.view-rel-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
padding: 18px;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.butt-create {
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.to-align-right {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.panel-style {
|
||||
margin-top: 10px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.panel-style table {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.panel-container-style {
|
||||
padding-left: 10px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<b:Button ui:field="closeButton"
|
||||
addStyleNames="{style.to-align-right}"></b:Button>
|
||||
<g:HTMLPanel ui:field="panelTitle"
|
||||
addStyleNames="{style.view-rel-title}">View Relations</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="firstPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>From Project</b:Label>
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel ui:field="firstProjectPanelContainer"
|
||||
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="secondPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>To Project/s</b:Label>
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel ui:field="secondProjectPanelContainer"
|
||||
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
|
||||
</ui:UiBinder>
|
|
@ -1018,4 +1018,45 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectDV getProjectByID(String profileID, String projectID) throws Exception {
|
||||
LOG.info("getProjectByID called");
|
||||
|
||||
try {
|
||||
ProjectsCaller projects = GeoportalClientCaller.projects();
|
||||
Project project = projects.getProjectByID(profileID, projectID);
|
||||
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
|
||||
LOG.info("returning: " + projectDV.getId());
|
||||
return projectDV;
|
||||
|
||||
} catch (Exception e) {
|
||||
String error = "Error occurred on reading the project with id: " + projectID;
|
||||
LOG.error(error, e);
|
||||
throw new Exception(
|
||||
error + ". Error: " + e.getMessage() + ". Refresh and try again or contact the support");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception {
|
||||
LOG.info("getResultDocumentFoProjectByID called");
|
||||
|
||||
try {
|
||||
ProjectsCaller projects = GeoportalClientCaller.projects();
|
||||
Project project = projects.getProjectByID(profileID, projectID);
|
||||
ResultDocumentDV documentDV = ConvertToDataValueObjectModel.toResultDocumentDV(project);
|
||||
LOG.info("returning: " + documentDV.getId());
|
||||
return documentDV;
|
||||
|
||||
} catch (Exception e) {
|
||||
String error = "Error occurred on reading the project with id: " + projectID;
|
||||
LOG.error(error, e);
|
||||
throw new Exception(
|
||||
error + ". Error: " + e.getMessage() + ". Refresh and try again or contact the support");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue