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">
@ -76,7 +77,8 @@
<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"/>
@ -230,7 +233,8 @@
<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"/>
@ -336,10 +341,8 @@
<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"/>
@ -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"/>
@ -570,7 +575,8 @@
</wb-module>

View File

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

View File

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