From 620bc6fb91dcff8170df188e2ad8efced18d00aa Mon Sep 17 00:00:00 2001 From: francesco Date: Tue, 13 Oct 2020 11:52:50 +0200 Subject: [PATCH] Added new interactions/controls on the GUI-side --- .../client/ConcessioniFormCardTitle.java | 2 +- .../client/GeoPortalDataEntryApp.java | 16 +++- .../client/events/CreateNewProjectEvent.java | 51 +++++++++++++ .../events/CreateNewProjectEventHandler.java | 20 +++++ .../client/resource/Images.java | 13 ++++ .../client/resource/loading.gif | Bin 0 -> 2533 bytes .../client/ui/GeonaDataEntryMainForm.java | 34 ++++++++- .../client/ui/GeonaDataEntryMainForm.ui.xml | 11 +-- .../client/ui/GeonaMainPanel.java | 71 ++++++++++++++++++ .../client/ui/GeonaMainPanel.ui.xml | 27 +++++++ .../client/ui/GeonaNavigationBar.java | 50 ++++++++++++ .../client/ui/GeonaNavigationBar.ui.xml | 18 +++++ .../client/ui/card/MetadataFormCard.java | 20 +++-- .../client/ui/utils/LoaderIcon.java | 61 +++++++++++++++ src/main/webapp/GeoPortalDataEntryApp.css | 32 ++++---- 15 files changed, 392 insertions(+), 34 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/Images.java create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/loading.gif create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.java create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/LoaderIcon.java diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java index a423e2e..e3ea348 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConcessioniFormCardTitle.java @@ -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), diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index fa1ae3e..d14ecc8 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -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); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java new file mode 100644 index 0000000..bbcce94 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEvent.java @@ -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 { + + /** The type. */ + public static Type TYPE = new Type(); + + /** + * 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 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); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEventHandler.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEventHandler.java new file mode 100644 index 0000000..8793ccd --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/CreateNewProjectEventHandler.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/Images.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/Images.java new file mode 100644 index 0000000..d7dddd6 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/Images.java @@ -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(); +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/loading.gif b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/resource/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..27f0eeec008138a3340f8c6bf8badcd2f5503054 GIT binary patch literal 2533 zcmZwJYfw|^83*t;CnuboBqn%rAq5gb2#|zZz<}W*5(p##L_r0STf#LUmqdt$fEq%$ z1eA*+qJoN|BCZr2Z>!QG=<2Gq*xl*4JL4|Utwp=t(fXzBwAur9+uaV|&zbZ5=6~Mz z`Kz@_ib%aXa0l;*0HpK*0KQ#(D<~X(|NaAQ^HFm8kxk9l;w;o6gu5cbv0ZNNN95kvL>#>N|2&YHU^+y7~lM5@_x3~ zczH4}WAJL-oW;P;EDX+9FW0*Wjn!rrsmWm!|nK203t#ODSEV;X(yq16vUl z6B`#V43Pk;SQ4HKAxZw2B%t4;3G*s#$zA=Q@d-a2|B`HZ{L#%*Tb9PxSr67b3g`O% z6qb7aS^J|x4w|sZ*`+m^76Cca#dIqjo|xIFvJB83P2F`2Tqmba>4mfGD?v>?XJx+I z`|r8Z-Hfl^WDve}AIJb}8o4}belsfv(Aqgwpr&~zP!UQ%S!0D?az|dBPP$RXXyd?# zwz28{S}vpqY3#`8-eRTy;Y693K%4{-W+Y1PUuY1z%SmLxfdeZF?tB!8w*W5Oinh%U zIq!Me#gQ*Rr4fC6Z8&0qjV2l5xq~dXHipfR2e*IGC2Z%la;ImCjLCF9oT+Mu=&Yo| zIWr07#YM|@Ax0p2@t&6AqHJXQkuW~d&PoEUUQT8w#-o~dRkRaIBf7B!3SZ(hL$Rb< zA!IvVpg+th;TxD+`HXRuB@Y*E@F@kG+3VWQpr(4E3=Grcp}EsO$Z?B*+4Id zgTX6;?*14F5F<@_(|U`zM`M>IKXnGr=wum%@-tT~EpUR$n-&w$`3EHKW-ttQs8>IX z55Yl}D;NBYzwLB6EVgeSFk8hbl#Qm~u=R`3NY|N=@=HY`+?K>E=B0g~s zi^#VDdo$Jo>On)tUN5ZHybH1rDgfF+ssgX# zW7MIw{SaCPOm6hbn$R^8mrYgheu?gm8|+ag5cc-2h`I9r7=zVyY5J?^hNxG*K@#>M|09r4FZ4A%X{f+fa8*+lU> zUs@>YOlx-3&PkyMjB@UE=>d;F&ZWot(tkUD<8PihcDn8C8_{^5L+!1!a2HP^-md~1 zO`l&7yrumWN9+OnYy>+ngWYWnRW&xK7Q@eeeFdlt&Lb753Kd&GW>z-HS--)SUXXYS z)248vNHMIq_>CcwFu5c{hvZ45m)+bw`2t~E+luqw_*o1b6E}a1?-LpRDvV~RkQaN% z(S%gH>cPxS1xIlN5Hy+awbPw~RsZxu7z?khJX>e?`0aOBStsD52j7TA*>UEe+2knd z4^g(I7#i?jYAFWH0d|9WXQP)<3-5^9S4X`GABnX5(Ju6zS{Va>;^FxcF2k%Pj9?Q6+ z&w3tBge_&!r8b!Y0n!iVC7)@XgR1*sw=D9?Em(ijv7?$&ouyoU+4~ZRd*e zzUIALzk)Fdos$A@W*do$OA4N7T)9U<|arp8)BULrgKy zu&TSEBm+v+*A)kB-pa6_AIW9YCFIJYO}q?t43Bi21NWZOZso}%2GPhm2uYFF`d*+Q zNu;dP^DByOFN+3ffRX`~qKJ=gF2!@0t8nSjJdxeIfUlV8RgMlpx<(RA_X5w{y)&Xa zz;1E}nb9@;3x&}&({29KW8_BCc#2FjAfh~dvK39aV_W;8Fev!@1_BKwV(XjO9{7da z($4I_s;u3iB+S+h6_~pTVxX2gDuhrX*kI8$6nP>U3dT_ud@2VArE;NSkj`G`Nvbw? z3=3saYDA4Vs!o(Fsig%TqadSkC%#!Zp&yq%ihJ;-KSdB5mzMsbd} literal 0 HcmV?d00001 diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.java index 8a9326d..7fc93c5 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.java @@ -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 mapForms = new LinkedHashMap(); private List listTabs = new ArrayList(); @@ -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. diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.ui.xml index 8610286..0099633 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaDataEntryMainForm.ui.xml @@ -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; - } - GeoNa - + Save diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java new file mode 100644 index 0000000..b35ea53 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java @@ -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 { + } + + /** + * 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); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml new file mode 100644 index 0000000..36960c6 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml @@ -0,0 +1,27 @@ + + + + + .important { + font-weight: bold; + } + + .custom-page-header { + padding: 10px; + background-color: #f5f5f5; + margin-bottom: 10px; + border: 1px solid #eee; + } + + + GeoNa + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.java new file mode 100644 index 0000000..c4c56cc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.java @@ -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 { + } + + 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!"); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.ui.xml new file mode 100644 index 0000000..8d8abea --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaNavigationBar.ui.xml @@ -0,0 +1,18 @@ + + + + .important { + font-weight: bold; + } + + + + + Create new Project + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java index 7a9c533..782885c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/card/MetadataFormCard.java @@ -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"); + } } /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/LoaderIcon.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/LoaderIcon.java new file mode 100644 index 0000000..4abff22 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/LoaderIcon.java @@ -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(""+txtHTML+""); + } + + /** + * Show. + * + * @param bool the bool + */ + public void show(boolean bool){ + this.setVisible(bool); + } + +} diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index 7aca7ac..75753a4 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -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; +} \ No newline at end of file