From 0fa5de5c731c415283d99ef53b0489c48e461dd4 Mon Sep 17 00:00:00 2001 From: Nuno Vieira Date: Fri, 23 Mar 2018 16:55:18 +0000 Subject: [PATCH] export csv button is now hidden when managing RI associations #1188; cancel buttons on RI pages are now more coherent #1185 --- .../FileNotificationProcessor.java | 5 ++--- .../RepresentationInformationDialogs.java | 4 ++++ .../common/lists/utils/AsyncTableCell.java | 4 ++++ .../RepresentationInformationNetwork.java | 9 --------- .../RepresentationInformationNetwork.ui.xml | 4 ---- .../planning/ShowRepresentationInformation.java | 17 ++++++++--------- .../ShowRepresentationInformation.ui.xml | 2 +- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/roda-core/roda-core/src/main/java/org/roda/core/common/notifications/FileNotificationProcessor.java b/roda-core/roda-core/src/main/java/org/roda/core/common/notifications/FileNotificationProcessor.java index 2bb222c9e5..45666d72a3 100644 --- a/roda-core/roda-core/src/main/java/org/roda/core/common/notifications/FileNotificationProcessor.java +++ b/roda-core/roda-core/src/main/java/org/roda/core/common/notifications/FileNotificationProcessor.java @@ -43,6 +43,8 @@ public Notification processNotification(ModelService model, Notification notific Job job = (Job) scope.get(JOB_KEY); String content = createNotificationContent(job); notification.setBody(content); + notification.setState(NOTIFICATION_STATE.FAILED); + if (dropPath != null && dropPath.startsWith("file:///")) { LOGGER.debug("Sending notification via drop folder ..."); Path trimmedDropPath = Paths.get(dropPath.substring(7)); @@ -65,15 +67,12 @@ public Notification processNotification(ModelService model, Notification notific notification.setState(NOTIFICATION_STATE.COMPLETED); } catch (AlreadyExistsException | GenericException | IOException e) { LOGGER.warn("Notification not sent", e); - notification.setState(NOTIFICATION_STATE.FAILED); } } else { LOGGER.warn("Drop path is not a folder, cannot send notification."); - notification.setState(NOTIFICATION_STATE.FAILED); } } else { LOGGER.warn("No drop path, cannot send notification."); - notification.setState(NOTIFICATION_STATE.FAILED); } } diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/dialogs/RepresentationInformationDialogs.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/dialogs/RepresentationInformationDialogs.java index a4b8698429..42137b5940 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/dialogs/RepresentationInformationDialogs.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/dialogs/RepresentationInformationDialogs.java @@ -238,6 +238,7 @@ public void onClick(ClickEvent event) { } if (table != null) { + table.setCsvDownloadButtonVisibility(false); table.addRedrawHandler(new AbstractHasData.RedrawEvent.Handler() { @Override public void onRedraw() { @@ -508,6 +509,7 @@ public void onClick(ClickEvent event) { Filter filter = new Filter(new NotSimpleFilterParameter(RodaConstants.INDEX_UUID, ri.getId())); SelectRepresentationInformationDialog selectDialog = new SelectRepresentationInformationDialog( messages.chooseEntityTitle(), filter, false); + selectDialog.getList().setCsvDownloadButtonVisibility(false); selectDialog.setSingleSelectionMode(); selectDialog.showAndCenter(); selectDialog.addValueChangeHandler(new ValueChangeHandler() { @@ -738,6 +740,7 @@ public void onClick(ClickEvent event) { Filter filter = new Filter(new OneOfManyFilterParameter(RodaConstants.INDEX_UUID, aipsAlreadyLinked)); SelectAipDialog selectAipDialog = new SelectAipDialog(messages.chooseEntityTitle(), filter, false, false); + selectAipDialog.getList().setCsvDownloadButtonVisibility(false); selectAipDialog.setSingleSelectionMode(); selectAipDialog.showAndCenter(); selectAipDialog.addValueChangeHandler(new ValueChangeHandler() { @@ -850,6 +853,7 @@ public static FlowPanel createInnerAddRepresentationInformationwithAssociation(f Filter defaultFilter = SearchFilters.defaultFilter(RepresentationInformation.class.getName()); final RepresentationInformationList representationInformationList = new RepresentationInformationList(defaultFilter, facets, messages.representationInformationTitle(), true, 10, 10); + representationInformationList.setCsvDownloadButtonVisibility(false); representationInformationList.addRedrawHandler(new AbstractHasData.RedrawEvent.Handler() { @Override public void onRedraw() { diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/lists/utils/AsyncTableCell.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/lists/utils/AsyncTableCell.java index 487eb8aff0..f895224064 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/lists/utils/AsyncTableCell.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/common/lists/utils/AsyncTableCell.java @@ -855,6 +855,10 @@ public boolean hasElementsSelected() { return true; } + public void setCsvDownloadButtonVisibility(boolean isVisible) { + csvDownloadButton.setVisible(isVisible); + } + public Actionable getActionable() { return actionable; } diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.java index 28cbf04412..c30ca5ff55 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.java @@ -123,9 +123,6 @@ interface MyUiBinder extends UiBinder @UiField Button startProcess; - @UiField - Button buttonCancel; - @UiField FlowPanel sidebar; @@ -314,10 +311,4 @@ void handleButtonProcess(ClickEvent e) { selectedItems.setLastHistory(HistoryUtils.getCurrentHistoryPath()); HistoryUtils.newHistory(CreateSelectedJob.RESOLVER, RodaConstants.JOB_PROCESS_ACTION); } - - @UiHandler("buttonCancel") - void handleButtonCancel(ClickEvent e) { - LastSelectedItemsSingleton selectedItems = LastSelectedItemsSingleton.getInstance(); - HistoryUtils.newHistory(selectedItems.getLastHistory()); - } } diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.ui.xml b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.ui.xml index 039c501067..e5754f4f9c 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.ui.xml +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/RepresentationInformationNetwork.ui.xml @@ -46,10 +46,6 @@ - - - diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.java b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.java index e55e97c957..6dd3b03f27 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.java +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.java @@ -228,7 +228,6 @@ public void onSuccess(String familyTranslation) { parPanel.setHTML("" + messages.representationInformationListItems(category) + ""); parPanel.addClickHandler(new ClickHandler() { - @Override public void onClick(ClickEvent event) { List history = new ArrayList<>(); @@ -397,16 +396,16 @@ public void onSuccess(final RelationTypeTranslationsBundle bundle) { if (ri.getRelations() != null) { for (RepresentationInformationRelation relation : ri.getRelations()) { - GWT - .log(bundle.getTranslations().get(relation.getObjectType()).get(relation.getRelationType()).toString()); String relationType = bundle.getTranslations().get(relation.getObjectType()) .get(relation.getRelationType()); - if (relationTypeToLink.containsKey(relationType)) { - relationTypeToLink.get(relationType).add(relation); - } else { - List newRelations = new ArrayList<>(); - newRelations.add(relation); - relationTypeToLink.put(relationType, newRelations); + if (relationType != null) { + if (relationTypeToLink.containsKey(relationType)) { + relationTypeToLink.get(relationType).add(relation); + } else { + List newRelations = new ArrayList<>(); + newRelations.add(relation); + relationTypeToLink.put(relationType, newRelations); + } } } } diff --git a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.ui.xml b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.ui.xml index 9b59c770b4..a2ae04dd1a 100644 --- a/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.ui.xml +++ b/roda-ui/roda-wui/src/main/java/org/roda/wui/client/planning/ShowRepresentationInformation.ui.xml @@ -100,7 +100,7 @@ - +