|
|
|
@ -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.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.events.ActionOnItemEvent;
|
|
|
|
|
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.utils.LoaderIcon;
|
|
|
|
@ -12,6 +14,7 @@ import com.github.gwtbootstrap.client.ui.Tab;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
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.Random;
|
|
|
|
@ -51,6 +54,8 @@ public class EditModeRecord extends Composite {
|
|
|
|
|
|
|
|
|
|
private JSONEditorWrapper jsEditor;
|
|
|
|
|
|
|
|
|
|
private HandlerManager appManagerBus;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Interface EditModeRecordUiBinder.
|
|
|
|
|
*
|
|
|
|
@ -64,26 +69,28 @@ public class EditModeRecord extends Composite {
|
|
|
|
|
/**
|
|
|
|
|
* Instantiates a new edits the mode record.
|
|
|
|
|
*
|
|
|
|
|
* @param appManagerBus the app manager bus
|
|
|
|
|
* @param selectedConcessione the selected concessione
|
|
|
|
|
* @param type the type
|
|
|
|
|
*/
|
|
|
|
|
public EditModeRecord(BaseConcessioneDV selectedConcessione, RECORD_TYPE type) {
|
|
|
|
|
public EditModeRecord(HandlerManager appManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE type) {
|
|
|
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
|
|
|
this.selectedConcessione = selectedConcessione;
|
|
|
|
|
this.recordType = type;
|
|
|
|
|
this.appManagerBus = appManagerBus;
|
|
|
|
|
|
|
|
|
|
instanceJSONEditor();
|
|
|
|
|
bindEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void instanceJSONEditor() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rawUpdatePanel.clear();
|
|
|
|
|
final FlowPanel fp = new FlowPanel();
|
|
|
|
|
fp.getElement().setId("jsoneditor" + Random.nextInt());
|
|
|
|
|
fp.setHeight("400px");
|
|
|
|
|
rawUpdatePanel.add(fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
|
|
|
|
|
new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
|
@ -138,6 +145,9 @@ public class EditModeRecord extends Composite {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
appManagerBus.fireEvent(
|
|
|
|
|
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -152,8 +162,9 @@ public class EditModeRecord extends Composite {
|
|
|
|
|
selectedConcessione = result;
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|