Added new interactions/controls on the GUI-side

This commit is contained in:
francesco 2020-10-13 11:52:50 +02:00
parent 0681dd6b2c
commit 620bc6fb91
15 changed files with 392 additions and 34 deletions

View File

@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
public enum ConcessioniFormCardTitle {
INFORMAZIONE_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false),
INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false),
RELAZIONI_DI_SCAVO("Relazione di Scavo", "Relazioni di Scavo", 2, false),
IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 3, true),
POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 4, false),

View File

@ -8,6 +8,7 @@ import java.util.List;
import java.util.TreeMap;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaDataEntryMainForm;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
@ -52,6 +53,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
String scope = "/gcube/devsec/devVRE";
String secondaryType = "GeoNaMetadata";
final GeonaMainPanel mainPanel = new GeonaMainPanel();
mainPanel.setLoaderVisible("Loading...", true);
final GeonaDataEntryMainForm geoNaMainForm = new GeonaDataEntryMainForm();
@ -72,14 +76,18 @@ public class GeoPortalDataEntryApp implements EntryPoint {
geoNaMainForm.addForm(key, geonaForm);
mapForms.put(key, geonaForm);
}
mainPanel.setLoaderVisible("", false);
}
@Override
public void onFailure(Throwable caught) {
}
});
mainPanel.addFormPanel(geoNaMainForm);
//
RootPanel.get(DIV_PORTLET_ID).add(geoNaMainForm);
RootPanel.get(DIV_PORTLET_ID).add(mainPanel);
}
@ -94,9 +102,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
String theMetaType = metaDataProfileBean.getType().toLowerCase();
GeoNaFormCardModel geonaForm = new GeoNaFormCardModel(metaDataProfileBean, null, null);
if(theMetaType.contains(ConcessioniFormCardTitle.INFORMAZIONE_DI_PROGETTO.getKey().toLowerCase())) {
geonaForm.setFormCardTitle(ConcessioniFormCardTitle.INFORMAZIONE_DI_PROGETTO);
treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.INFORMAZIONE_DI_PROGETTO.getOrder(), geonaForm);
if(theMetaType.contains(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getKey().toLowerCase())) {
geonaForm.setFormCardTitle(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO);
treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO.getOrder(), geonaForm);
}else if(theMetaType.contains(ConcessioniFormCardTitle.RELAZIONI_DI_SCAVO.getKey().toLowerCase())) {
geonaForm.setFormCardTitle(ConcessioniFormCardTitle.RELAZIONI_DI_SCAVO);
treemapOrderedGeoNaProfiles.put(ConcessioniFormCardTitle.RELAZIONI_DI_SCAVO.getOrder(), geonaForm);

View File

@ -0,0 +1,51 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.GwtEvent;
// TODO: Auto-generated Javadoc
/**
* The Class CreateNewProjectEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
/** The type. */
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
/**
* Instantiates a new cancel upload event.
*/
public CreateNewProjectEvent() {
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<CreateNewProjectEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(CreateNewProjectEventHandler handler) {
handler.onCreateNewProject(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface CreateNewProjectEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public interface CreateNewProjectEventHandler extends EventHandler {
/**
* On create new project.
*
* @param newProjectEvent the new project event
*/
void onCreateNewProject(CreateNewProjectEvent newProjectEvent);
}

View File

@ -0,0 +1,13 @@
package org.gcube.portlets.user.geoportaldataentry.client.resource;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
public interface Images extends ClientBundle {
public static final Images ICONS = GWT.create(Images.class);
@Source("loading.gif")
ImageResource loading();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -10,13 +10,16 @@ import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.TabPanel;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
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;
@ -37,6 +40,9 @@ public class GeonaDataEntryMainForm extends Composite {
@UiField
TabPanel mainTabPanel;
@UiField
AlertBlock alertFormAction;
private LinkedHashMap<String,MetadataFormCard> mapForms = new LinkedHashMap<String,MetadataFormCard>();
private List<Tab> listTabs = new ArrayList<Tab>();
@ -103,12 +109,38 @@ public class GeonaDataEntryMainForm extends Composite {
}
listGoneFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getFormCardTitle()));
}
}else {
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
}
Window.alert("I cane save: "+listGoneFormObjects);
Window.alert("I can save: "+listGoneFormObjects);
}
private void showAlertOnSaveAction(String text, AlertType type, boolean hideAfterAWhile){
//Window.alert("Called alertOnCreate");
alertFormAction.setText(text);
alertFormAction.setType(type);
alertFormAction.setVisible(true);
//goBackButtonSecondStep.setEnabled(true);
if(hideAfterAWhile){
// hide after some seconds
Timer t = new Timer() {
@Override
public void run() {
alertFormAction.setVisible(false);
}
};
t.schedule(10000);
}
}
/**
* Sets the ative after.

View File

@ -6,20 +6,11 @@
.important {
font-weight: bold;
}
.custom-page-header {
padding: 10px;
background-color: #f5f5f5;
margin: 20px 0 30px;
border-bottom: 1px solid #eee;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
<b:TabPanel ui:field="mainTabPanel" tabPosition="left">
</b:TabPanel>
<!-- <b:AlertBlock type="DEFAULT" close="false"> -->
<b:AlertBlock type="DEFAULT" visible="false" close="false" ui:field="alertFormAction"></b:AlertBlock>
<b:FormActions>
<b:Button type="PRIMARY" icon="SAVE" ui:field="buttonSave">Save</b:Button>
</b:FormActions>

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
// TODO: Auto-generated Javadoc
/**
* The Class GeonaMainPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class GeonaMainPanel extends Composite {
/** The geona main form panel. */
@UiField
HTMLPanel geonaMainFormPanel;
/** The loader. */
@UiField
LoaderIcon loader;
/** The ui binder. */
private static GeonaMainPanelUiBinder uiBinder = GWT.create(GeonaMainPanelUiBinder.class);
/**
* The Interface GeonaMainPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
interface GeonaMainPanelUiBinder extends UiBinder<Widget, GeonaMainPanel> {
}
/**
* Instantiates a new geona main panel.
*/
public GeonaMainPanel() {
initWidget(uiBinder.createAndBindUi(this));
}
/**
* Adds the form panel.
*
* @param formPanel the form panel
*/
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
geonaMainFormPanel.add(formPanel);
}
/**
* Sets the loader visible.
*
* @param txtHTML the txt HTML
* @param visible the visible
*/
public void setLoaderVisible(String txtHTML, boolean visible){
loader.setText(txtHTML);
loader.setVisible(visible);
}
}

View File

@ -0,0 +1,27 @@
<!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"
xmlns:m="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui"
xmlns:r="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui.utils">
<ui:style>
.important {
font-weight: bold;
}
.custom-page-header {
padding: 10px;
background-color: #f5f5f5;
margin-bottom: 10px;
border: 1px solid #eee;
}
</ui:style>
<g:HTMLPanel ui:field="geonaMainPanel">
<b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
<m:GeonaNavigationBar></m:GeonaNavigationBar>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,50 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class GeonaNavigationBar extends Composite {
private static GeonaNavigationBarUiBinder uiBinder = GWT.create(GeonaNavigationBarUiBinder.class);
interface GeonaNavigationBarUiBinder extends UiBinder<Widget, GeonaNavigationBar> {
}
private EventBus eventBus;
public GeonaNavigationBar() {
initWidget(uiBinder.createAndBindUi(this));
}
public GeonaNavigationBar(EventBus eventBus) {
this();
this.eventBus = eventBus;
bindEvents();
}
private void bindEvents() {
// TODO Auto-generated method stub
}
@UiField
NavLink linkCreateNewProject;
public GeonaNavigationBar(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
@UiHandler("linkCreateNewProject")
void onClick(ClickEvent e) {
Window.alert("Hello!");
}
}

View File

@ -0,0 +1,18 @@
<!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>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<b:Navbar>
<b:Nav>
<b:NavLink ui:field="linkCreateNewProject"
title="Create a new Project">Create new Project</b:NavLink>
</b:Nav>
</b:Navbar>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.base.Style;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -197,10 +198,14 @@ public class MetadataFormCard {
* @param bool the new valid card
*/
public void setValidCard(boolean bool) {
if(bool)
if(bool) {
tab.setIcon(IconType.OK_SIGN);
else
tab.setIcon(IconType.REMOVE_SIGN);
tab.asWidget().getElement().removeClassName("red-text");
}
else {
tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().addClassName("red-text");
}
}
@ -209,10 +214,15 @@ public class MetadataFormCard {
*/
private void setTabStatus() {
boolean isValid = validateForm();
if(isValid)
if(isValid) {
tab.setIcon(IconType.OK_SIGN);
else
tab.asWidget().getElement().removeClassName("red-text");
tab.asWidget().getElement().addClassName("green-text");
}
else {
tab.setIcon(IconType.MINUS_SIGN);
tab.asWidget().getElement().addClassName("red-text");
}
}
/**

View File

@ -0,0 +1,61 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
/**
* The Class LoaderIcon.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
public class LoaderIcon extends HorizontalPanel{
private Image imgLoading = new Image(Images.ICONS.loading());
private HTML txtLoading = new HTML("");
/**
* Instantiates a new loader icon.
*
* @param txtHTML the txt html
*/
public LoaderIcon(String txtHTML) {
this();
setText(txtHTML);
}
/**
* Instantiates a new loader icon.
*/
public LoaderIcon() {
setStyleName("marginTop20");
add(imgLoading);
add(txtLoading);
}
/**
* Sets the text.
*
* @param txtHTML the new text
*/
public void setText(String txtHTML){
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
}
/**
* Show.
*
* @param bool the bool
*/
public void show(boolean bool){
this.setVisible(bool);
}
}

View File

@ -1,34 +1,40 @@
/** Add css rules here for your application. */
/** Example rules used by the template application (remove for your app) */
h1 {
font-size: 2em;
font-weight: bold;
color: #777777;
margin: 40px 0px 70px;
text-align: center;
font-size: 2em;
font-weight: bold;
color: #777777;
margin: 40px 0px 70px;
text-align: center;
}
.sendButton {
display: block;
font-size: 16pt;
display: block;
font-size: 16pt;
}
/** Most GWT widgets already have a style name defined */
.gwt-DialogBox {
width: 400px;
width: 400px;
}
.dialogVPanel {
margin: 5px;
margin: 5px;
}
.serverResponseLabelError {
color: red;
color: red;
}
/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
margin: 15px 6px 6px;
margin: 15px 6px 6px;
}
.red-text a {
color: red !important;
}
.green-text a {
color: green !important;
}