tested the init stage of the widget

This commit is contained in:
Francesco Mangiacrapa 2020-10-08 16:06:58 +02:00
parent b0c95d161a
commit 8855c34308
3 changed files with 71 additions and 3 deletions

View File

@ -1,10 +1,17 @@
package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaDataEntryMainForm;
import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
/**
@ -27,6 +34,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private final Messages messages = GWT.create(Messages.class);
private final HandlerManager eventBus = new HandlerManager(null);
/**
* This is the entry point method.
*/
@ -34,9 +42,29 @@ public class GeoPortalDataEntryApp implements EntryPoint {
String scope = "/gcube/devsec/devVRE";
String secondaryType = "GeoNaMetadata";
HandlerManager eventBus = new HandlerManager(null);
CreateMetadataForm baseForm = new CreateMetadataForm(scope, secondaryType, eventBus);
RootPanel.get(DIV_PORTLET_ID).add(baseForm);
final GeonaDataEntryMainForm geoNaMainForm = new GeonaDataEntryMainForm();
// CreateMetadataForm baseForm = new CreateMetadataForm(scope, secondaryType, eventBus);
// geoNaMainForm.addWidget(baseForm);
MetadataProfileFormBuilderServiceAsync.Util.getInstance().getProfilesInTheScope(scope, secondaryType, new AsyncCallback<List<MetaDataProfileBean>>() {
@Override
public void onSuccess(List<MetaDataProfileBean> result) {
for (MetaDataProfileBean metaDataProfileBean : result) {
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(metaDataProfileBean), eventBus);
geoNaMainForm.addWidget(baseForm);
}
}
@Override
public void onFailure(Throwable caught) {
}
});
//
RootPanel.get(DIV_PORTLET_ID).add(geoNaMainForm);
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
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;
public class GeonaDataEntryMainForm extends Composite {
private static GeonaDataEntryMainFormUiBinder uiBinder = GWT.create(GeonaDataEntryMainFormUiBinder.class);
interface GeonaDataEntryMainFormUiBinder extends UiBinder<Widget, GeonaDataEntryMainForm> {
}
@UiField
HTMLPanel baseHtmlPanel;
public GeonaDataEntryMainForm() {
initWidget(uiBinder.createAndBindUi(this));
}
public void addWidget(Widget w) {
baseHtmlPanel.add(w);
}
}

View File

@ -0,0 +1,11 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel ui:field="baseHtmlPanel">
</g:HTMLPanel>
</ui:UiBinder>