Fired event after Record Updated
This commit is contained in:
parent
9d3f3bf380
commit
3df7ab1787
|
@ -38,7 +38,7 @@ public class ConstantsGeoPortalDataEntryApp {
|
||||||
* Aug 6, 2021
|
* Aug 6, 2021
|
||||||
*/
|
*/
|
||||||
public enum ACTION_ON_ITEM {
|
public enum ACTION_ON_ITEM {
|
||||||
SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, DELETE_RECORD, EDIT_RECORD
|
SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, SHOW_EDIT_MODE, DELETE_RECORD, UPDATED_RECORD
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -75,7 +75,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
private static final String DIV_PORTLET_ID = "geoportal-data-entry";
|
private static final String DIV_PORTLET_ID = "geoportal-data-entry";
|
||||||
|
|
||||||
public static final GeoportalDataEntryServiceAsync geoportalDataEntryService = GWT.create(GeoportalDataEntryService.class);
|
public static final GeoportalDataEntryServiceAsync geoportalDataEntryService = GWT
|
||||||
|
.create(GeoportalDataEntryService.class);
|
||||||
|
|
||||||
private final HandlerManager appManagerBus = new HandlerManager(null);
|
private final HandlerManager appManagerBus = new HandlerManager(null);
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
int topBorder = workspace.getAbsoluteTop();
|
int topBorder = workspace.getAbsoluteTop();
|
||||||
int footer = 85; // footer is bottombar + sponsor
|
int footer = 85; // footer is bottombar + sponsor
|
||||||
int headerSize = 90;
|
int headerSize = 90;
|
||||||
//int headerSize = 30;
|
// int headerSize = 30;
|
||||||
int rootHeight = Window.getClientHeight() - topBorder - headerSize - footer;// - ((footer ==
|
int rootHeight = Window.getClientHeight() - topBorder - headerSize - footer;// - ((footer ==
|
||||||
// null)?0:(footer.getOffsetHeight()-15));
|
// null)?0:(footer.getOffsetHeight()-15));
|
||||||
|
|
||||||
|
@ -428,8 +429,12 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||||
|
|
||||||
|
SortFilter sortFilter = getListOfRecordsEvent.getSortFilter();
|
||||||
|
if(sortFilter==null){
|
||||||
|
sortFilter = mainTabPanel.getCurrentSortFilter();
|
||||||
|
}
|
||||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null,
|
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null,
|
||||||
getListOfRecordsEvent.getSortFilter());
|
sortFilter);
|
||||||
mainTabPanel.showListOfConcessioniView(grpw);
|
mainTabPanel.showListOfConcessioniView(grpw);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -505,7 +510,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
case SHOW_REPORT:
|
case SHOW_REPORT:
|
||||||
final Modal modal2 = new Modal(true, true);
|
final Modal modal2 = new Modal(true, true);
|
||||||
modal2.setTitle("Report <div style='color:#555; font-size:22px;'>"+concessione.getNome()+"</div>");
|
modal2.setTitle("Report <div style='color:#555; font-size:22px;'>" + concessione.getNome()
|
||||||
|
+ "</div>");
|
||||||
modal2.setWidth(800);
|
modal2.setWidth(800);
|
||||||
modal2.setCloseVisible(true);
|
modal2.setCloseVisible(true);
|
||||||
if (concessione.getValidationReport() == null) {
|
if (concessione.getValidationReport() == null) {
|
||||||
|
@ -518,18 +524,27 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
modal2.show();
|
modal2.show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDIT_RECORD:
|
case SHOW_EDIT_MODE:
|
||||||
final Modal modal3 = new Modal(true, true);
|
final Modal modal3 = new Modal(true, true);
|
||||||
modal3.setTitle("Edit <div style='color:#555; font-size:22px;'>"+concessione.getNome()+"</div>");
|
modal3.setTitle("Edit <div style='color:#555; font-size:22px;'>" + concessione.getNome()
|
||||||
|
+ "</div>");
|
||||||
modal3.setWidth(950);
|
modal3.setWidth(950);
|
||||||
modal3.setHeight("700px");
|
modal3.setHeight("700px");
|
||||||
modal3.setCloseVisible(true);
|
modal3.setCloseVisible(true);
|
||||||
((Element)modal3.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
|
((Element) modal3.getElement().getChildNodes().getItem(1))
|
||||||
EditModeRecord emr = new EditModeRecord(concessione,RECORD_TYPE.CONCESSIONE);
|
.addClassName("modal-body-custom");
|
||||||
|
EditModeRecord emr = new EditModeRecord(appManagerBus, concessione,
|
||||||
|
RECORD_TYPE.CONCESSIONE);
|
||||||
modal3.add(emr);
|
modal3.add(emr);
|
||||||
modal3.show();
|
modal3.show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UPDATED_RECORD:
|
||||||
|
appManagerBus.fireEvent(
|
||||||
|
new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||||
|
mainTabPanel.getCurrentSortFilter()));
|
||||||
|
break;
|
||||||
case DELETE_RECORD:
|
case DELETE_RECORD:
|
||||||
|
|
||||||
String htmlMsg = "Going to delete the project with:";
|
String htmlMsg = "Going to delete the project with:";
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
||||||
private ACTION_ON_ITEM action;
|
private ACTION_ON_ITEM action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new click item event.
|
* Instantiates a new action on item event.
|
||||||
*
|
*
|
||||||
* @param selectItems the select items
|
* @param selectItems the select items
|
||||||
* @param doAction the do action
|
* @param doAction the do action
|
||||||
|
@ -81,6 +81,11 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
|
@ -237,7 +237,7 @@ public class GeonaMainTabPanel extends Composite {
|
||||||
listConcessioni = grpw.getSelectItems();
|
listConcessioni = grpw.getSelectItems();
|
||||||
}
|
}
|
||||||
appManagerBus
|
appManagerBus
|
||||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.EDIT_RECORD));
|
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_EDIT_MODE));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
|
@ -12,6 +14,7 @@ import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
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.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Random;
|
import com.google.gwt.user.client.Random;
|
||||||
|
@ -51,6 +54,8 @@ public class EditModeRecord extends Composite {
|
||||||
|
|
||||||
private JSONEditorWrapper jsEditor;
|
private JSONEditorWrapper jsEditor;
|
||||||
|
|
||||||
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface EditModeRecordUiBinder.
|
* The Interface EditModeRecordUiBinder.
|
||||||
*
|
*
|
||||||
|
@ -64,26 +69,28 @@ public class EditModeRecord extends Composite {
|
||||||
/**
|
/**
|
||||||
* Instantiates a new edits the mode record.
|
* Instantiates a new edits the mode record.
|
||||||
*
|
*
|
||||||
|
* @param appManagerBus the app manager bus
|
||||||
* @param selectedConcessione the selected concessione
|
* @param selectedConcessione the selected concessione
|
||||||
* @param type the type
|
* @param type the type
|
||||||
*/
|
*/
|
||||||
public EditModeRecord(BaseConcessioneDV selectedConcessione, RECORD_TYPE type) {
|
public EditModeRecord(HandlerManager appManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE type) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.selectedConcessione = selectedConcessione;
|
this.selectedConcessione = selectedConcessione;
|
||||||
this.recordType = type;
|
this.recordType = type;
|
||||||
|
this.appManagerBus = appManagerBus;
|
||||||
|
|
||||||
instanceJSONEditor();
|
instanceJSONEditor();
|
||||||
bindEvents();
|
bindEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void instanceJSONEditor() {
|
private void instanceJSONEditor() {
|
||||||
|
|
||||||
rawUpdatePanel.clear();
|
rawUpdatePanel.clear();
|
||||||
final FlowPanel fp = new FlowPanel();
|
final FlowPanel fp = new FlowPanel();
|
||||||
fp.getElement().setId("jsoneditor" + Random.nextInt());
|
fp.getElement().setId("jsoneditor" + Random.nextInt());
|
||||||
fp.setHeight("400px");
|
fp.setHeight("400px");
|
||||||
rawUpdatePanel.add(fp);
|
rawUpdatePanel.add(fp);
|
||||||
|
|
||||||
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
|
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
|
||||||
new AsyncCallback<String>() {
|
new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@ -138,6 +145,9 @@ public class EditModeRecord extends Composite {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appManagerBus.fireEvent(
|
||||||
|
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -152,8 +162,9 @@ public class EditModeRecord extends Composite {
|
||||||
selectedConcessione = result;
|
selectedConcessione = result;
|
||||||
instanceJSONEditor();
|
instanceJSONEditor();
|
||||||
|
|
||||||
Window.alert("Project '"+result.getNome()+"' updated correctly");
|
Window.alert("Project '" + result.getNome() + "' updated correctly");
|
||||||
|
appManagerBus.fireEvent(
|
||||||
|
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,30 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor;
|
||||||
|
|
||||||
import com.google.gwt.core.client.JavaScriptObject;
|
import com.google.gwt.core.client.JavaScriptObject;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class JSONEditorWrapper.
|
||||||
|
*
|
||||||
|
* Wrapper for https://github.com/josdejong/jsoneditor
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 27, 2021
|
||||||
|
*/
|
||||||
public class JSONEditorWrapper extends JavaScriptObject {
|
public class JSONEditorWrapper extends JavaScriptObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new JSON editor wrapper.
|
||||||
|
*/
|
||||||
protected JSONEditorWrapper() {
|
protected JSONEditorWrapper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the.
|
||||||
|
*
|
||||||
|
* @param divID the div ID
|
||||||
|
* @return the JSON editor wrapper
|
||||||
|
*/
|
||||||
public static native JSONEditorWrapper init(String divID) /*-{
|
public static native JSONEditorWrapper init(String divID) /*-{
|
||||||
var container = $doc.getElementById(divID);
|
var container = $doc.getElementById(divID);
|
||||||
var options = {
|
var options = {
|
||||||
|
@ -20,6 +39,11 @@ public class JSONEditorWrapper extends JavaScriptObject {
|
||||||
return new $wnd.JSONEditor(container, options);
|
return new $wnd.JSONEditor(container, options);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the.
|
||||||
|
*
|
||||||
|
* @param json the json
|
||||||
|
*/
|
||||||
public final native void set(String json) /*-{
|
public final native void set(String json) /*-{
|
||||||
var toJSONObject = JSON.parse(json);
|
var toJSONObject = JSON.parse(json);
|
||||||
// set json
|
// set json
|
||||||
|
@ -28,19 +52,37 @@ public class JSONEditorWrapper extends JavaScriptObject {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the text.
|
||||||
|
*
|
||||||
|
* @return the text
|
||||||
|
*/
|
||||||
public final native String getText() /*-{
|
public final native String getText() /*-{
|
||||||
console.log("this.get(): " +this.getText());
|
console.log("this.get(): " +this.getText());
|
||||||
return this.getText();
|
return this.getText();
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On error.
|
||||||
|
*/
|
||||||
public final native void onError() /*-{
|
public final native void onError() /*-{
|
||||||
this.onError(error);
|
this.onError(error);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the mode.
|
||||||
|
*
|
||||||
|
* @param mode the new mode
|
||||||
|
*/
|
||||||
public final native void setMode(String mode) /*-{
|
public final native void setMode(String mode) /*-{
|
||||||
this.setMode(mode);
|
this.setMode(mode);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name.
|
||||||
|
*
|
||||||
|
* @param rootName the new name
|
||||||
|
*/
|
||||||
public final native void setName(String rootName) /*-{
|
public final native void setName(String rootName) /*-{
|
||||||
this.setName(rootName);
|
this.setName(rootName);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
Loading…
Reference in New Issue