Added Application Notifier. Improved Modal Expand

This commit is contained in:
Francesco Mangiacrapa 2022-11-14 14:12:50 +01:00
parent 430d28ce03
commit 84fcc7dbb3
7 changed files with 66 additions and 7 deletions

View File

@ -85,6 +85,8 @@ import ol.layer.Image;
public class GeoportalDataViewer implements EntryPoint {
public static final String DIV_TIMELINE_DATA = "timeline-data";
public static final String APP_NOTIFIER = "app-notifier";
/** The Constant APP_DIV. */
public final static String APP_DIV = "geoportal-data-viewer";
@ -395,7 +397,7 @@ public class GeoportalDataViewer implements EntryPoint {
if (showDetailsEvent.isLoadTimelineRelationships() && relationships != null
&& relationships.size() > 0) {
GWT.log("LoadTimelineRelationships is true and the project has Relationships");
timelineMS.showTimelineProjectRelations(result.getTheProjectDV());
timelineMS.showTimelineProjectRelations(result.getTheProjectDV(), false);
}
}
});
@ -533,7 +535,7 @@ public class GeoportalDataViewer implements EntryPoint {
switch (timelineProjectRelationsEvent.getEventType()) {
case SHOW: {
timelineMS.showTimelineProjectRelations(timelineProjectRelationsEvent.getTheProjectDV());
timelineMS.showTimelineProjectRelations(timelineProjectRelationsEvent.getTheProjectDV(), true);
break;
}
case HIDE:

View File

@ -24,6 +24,25 @@ public class ProjectUtil {
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(boolean showkey, T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(T document) {
String htmlCode = "";

View File

@ -149,7 +149,9 @@ public class ProjectViewer extends Composite {
cv.setAddLayersToMapVisible(false);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow(theTitle, width, height);
String modalTitle = ProjectUtil.toHMLCode(false, theProjectView.getTheProjectDV().getTheDocument(), theProjectView.getTheProjectDV().getId());
ModalWindow mw = new ModalWindow(modalTitle, width, height);
mw.add(cv);
mw.setCaller(ProjectViewer.this);
// mw.setWidth(900);

View File

@ -3,9 +3,13 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relati
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
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.event.shared.HandlerManager;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
public class TimelineManagerStatus {
@ -43,23 +47,48 @@ public class TimelineManagerStatus {
}
public void showTimelineProjectRelations(ProjectDV theProject) {
public void showTimelineProjectRelations(ProjectDV theProject, boolean showNotify) {
GWT.log("Showing project relations for: " + theProject);
TimelineStatus timelineStatus = getTimelineOf(theProject);
if (timelineStatus.isStatusChanged()) {
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
} else if (showNotify) {
setupPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
"Timeline from the selected project is already displayed", "Timeline displayed");
}
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
}
protected void setupPopover(final Widget w, String message, String heading) {
final Popover popover = new Popover();
popover.setWidget(w);
popover.setText(message);
if (heading != null)
popover.setHeading(heading);
popover.setPlacement(Placement.BOTTOM);
popover.reconfigure();
popover.show();
Timer timer = new Timer() {
@Override
public void run() {
popover.hide();
}
};
timer.schedule(3000);
}
public void hideTimelineProjectRelations() {
GWT.log("hideTimelineProjectRelations");
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
//RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
// RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
}
public class TimelineStatus {

View File

@ -619,6 +619,12 @@ body {
max-height: 400px;
}
.app-notifier {
top: 0;
width: 100%;
text-align: center;
}
/*****
RESPONSIVE

View File

@ -137,6 +137,7 @@
Your web browser must have JavaScript enabled in order for this
application to display correctly.</div>
</noscript>
<div id="app-notifier" class="app-notifier"></div>
<div id="geoportal-data-viewer"></div>
<div class="timeline-container">
<div id="timeline-data"></div>

View File

@ -110,7 +110,7 @@
};
</script>
<div id="app-notifier" class="app-notifier"></div>
<div id="geoportal-data-viewer"></div>
<div class="timeline-container">
<div id="timeline-data"></div>