In progress on Update facility

This commit is contained in:
Francesco Mangiacrapa 2022-12-13 11:14:07 +01:00
parent 843a9b19b6
commit 04eb740ea5
3 changed files with 52 additions and 33 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -76,7 +77,8 @@
<wb-module deploy-name="geoportal-data-entry-app-3.1.0-SNAPSHOT"> <wb-module deploy-name="geoportal-data-entry-app-3.1.0-SNAPSHOT">
@ -153,7 +155,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -230,7 +233,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -307,7 +311,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -336,10 +341,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-mapper-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -416,7 +419,8 @@
<property name="context-root" value="geoportal-data-entry-app"/> <property name="context-root" value="geoportal-data-entry-app"/>
@ -493,7 +497,8 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -570,7 +575,8 @@
</wb-module> </wb-module>

View File

@ -37,10 +37,10 @@ public class UpdateRecord extends Composite {
ListBox listBoxSections; ListBox listBoxSections;
@UiField @UiField
HTMLPanel htmlSectionContent; ScrollPanel scrollSectionContent;
@UiField @UiField
ScrollPanel scrollPanelContainer; HTMLPanel htmlPanelContainer;
@UiField @UiField
HTMLPanel alertHTMLPanel; HTMLPanel alertHTMLPanel;
@ -48,21 +48,25 @@ public class UpdateRecord extends Composite {
@UiField @UiField
ControlGroup controlsControlGroup; ControlGroup controlsControlGroup;
public static final String PLACEHOLDER_LIST_BOX = "Select section...";
private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections..., please wait"); private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections..., please wait");
public UpdateRecord(HandlerManager editorManagerBus, String profileID, String projectID) { public UpdateRecord(HandlerManager editorManagerBus, String profileID, String projectID) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
scrollPanelContainer.setVisible(false); htmlPanelContainer.setVisible(false);
alertHTMLPanel.add(loaderProjectSections); alertHTMLPanel.add(loaderProjectSections);
scrollSectionContent.getElement().getStyle().setProperty("maxHeight", "500px");
GeoportalDataEntryServiceAsync.Util.getInstance().getProjectEdit(profileID, projectID, GeoportalDataEntryServiceAsync.Util.getInstance().getProjectEdit(profileID, projectID,
new AsyncCallback<ProjectEdit>() { new AsyncCallback<ProjectEdit>() {
@Override @Override
public void onSuccess(ProjectEdit result) { public void onSuccess(ProjectEdit result) {
scrollPanelContainer.setVisible(true); htmlPanelContainer.setVisible(true);
try { try {
alertHTMLPanel.remove(loaderProjectSections); alertHTMLPanel.remove(loaderProjectSections);
@ -70,8 +74,8 @@ public class UpdateRecord extends Composite {
} }
listBoxSections.addItem("Select section...", "Select section..."); listBoxSections.addItem(PLACEHOLDER_LIST_BOX, PLACEHOLDER_LIST_BOX);
for (final MetaDataProfileBeanExt profileBean : result.getTheProfileBeans()) { for (final MetaDataProfileBeanExt profileBean : result.getTheProfileBeans()) {
listBoxSections.addItem(profileBean.getType(), profileBean.getType()); listBoxSections.addItem(profileBean.getType(), profileBean.getType());
} }
@ -81,16 +85,19 @@ public class UpdateRecord extends Composite {
@Override @Override
public void onChange(ChangeEvent event) { public void onChange(ChangeEvent event) {
MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans() MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans()
.get(listBoxSections.getSelectedIndex()); .get(listBoxSections.getSelectedIndex() - 1); // -1 because the first element is
// the PLACEHOLDER "Select
// section..."
GWT.log("Change handler fired " + selectedBean); GWT.log("Change handler fired " + selectedBean);
controlsControlGroup.setVisible(true); controlsControlGroup.setVisible(true);
htmlSectionContent.clear(); scrollSectionContent.clear();
GcubeProfileDV gcubeProfile = selectedBean.getGcubeProfileDV(); GcubeProfileDV gcubeProfile = selectedBean.getGcubeProfileDV();
GeoNaFormCardModel formcard = GeoPortalDataEntryApp.buildNewFormCardModelFromProfile(gcubeProfile, 1, selectedBean, OPERATION.UPDATE, editorManagerBus); GeoNaFormCardModel formcard = GeoPortalDataEntryApp.buildNewFormCardModelFromProfile(
htmlSectionContent.add(formcard.getMetadataForm()); gcubeProfile, 1, selectedBean, OPERATION.UPDATE, editorManagerBus);
scrollSectionContent.add(formcard.getMetadataForm());
} }
}); });
@ -98,7 +105,7 @@ public class UpdateRecord extends Composite {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
scrollPanelContainer.setVisible(true); htmlPanelContainer.setVisible(true);
alertHTMLPanel.remove(loaderProjectSections); alertHTMLPanel.remove(loaderProjectSections);
String errorMsg = caught.getMessage(); String errorMsg = caught.getMessage();

View File

@ -14,24 +14,30 @@
.max-height-500 { .max-height-500 {
max-height: 450px; max-height: 450px;
} }
.margin-top-10 {
margin-top: 10px;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<g:HTMLPanel ui:field="alertHTMLPanel"> <g:HTMLPanel ui:field="alertHTMLPanel">
</g:HTMLPanel> </g:HTMLPanel>
<g:ScrollPanel ui:field="scrollPanelContainer"> <g:HTMLPanel ui:field="htmlPanelContainer">
<b:Form type="INLINE"> <b:Form type="INLINE">
<b:Fieldset addStyleNames="form-fieldset-edit"> <b:Fieldset addStyleNames="form-fieldset-edit">
<b:ControlGroup> <b:ControlGroup>
<b:Label type="INFO">Select the section of the document you want to update...</b:Label> <b:Label type="INFO">Select the section of the document you want
to update...</b:Label>
<b:Controls> <b:Controls>
<b:ListBox ui:field="listBoxSections"></b:ListBox> <b:ListBox ui:field="listBoxSections"
addStyleNames="{style.margin-top-10}"></b:ListBox>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup ui:field="controlsControlGroup" <b:ControlGroup ui:field="controlsControlGroup"
visible="false"> visible="false">
<b:Label type="INFO">Manage the content of</b:Label> <b:Label type="INFO">Manage the content of</b:Label>
<b:Controls> <b:Controls>
<g:HTMLPanel ui:field="htmlSectionContent"></g:HTMLPanel> <g:ScrollPanel ui:field="scrollSectionContent"></g:ScrollPanel>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup> <b:ControlGroup>
@ -42,7 +48,7 @@
</b:ControlGroup> </b:ControlGroup>
</b:Fieldset> </b:Fieldset>
</b:Form> </b:Form>
</g:ScrollPanel> </g:HTMLPanel>
<b:Button icon="SAVE" type="INFO" <b:Button icon="SAVE" type="INFO"
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate" addStyleNames="{style.button-save-style}" ui:field="buttonUpdate"
visible="false">UPDATE</b:Button> visible="false">UPDATE</b:Button>