Skip to content

Commit

Permalink
export csv button is now hidden when managing RI associations #1188; …
Browse files Browse the repository at this point in the history
…cancel buttons on RI pages are now more coherent #1185
  • Loading branch information
nunovieira220 committed Mar 23, 2018
1 parent 8916d69 commit 0fa5de5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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<RepresentationInformation>() {
Expand Down Expand Up @@ -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<IndexedAIP>() {
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,10 @@ public boolean hasElementsSelected() {
return true;
}

public void setCsvDownloadButtonVisibility(boolean isVisible) {
csvDownloadButton.setVisible(isVisible);
}

public Actionable<T> getActionable() {
return actionable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ interface MyUiBinder extends UiBinder<Widget, RepresentationInformationNetwork>
@UiField
Button startProcess;

@UiField
Button buttonCancel;

@UiField
FlowPanel sidebar;

Expand Down Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
<ui:text
from='{messages.representationInformationRegisterProcessButton}' />
</g:Button>
<g:Button addStyleNames="btn btn-block btn-default btn-times-circle"
ui:field="buttonCancel">
<ui:text from='{messages.cancelButton}' />
</g:Button>
<g:FlowPanel addStyleNames="sidebar-group sidebar-facet-panel facet-empty">
<g:Label addStyleNames="h4">
<ui:text from='{messages.representationInformationTags}' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ public void onSuccess(String familyTranslation) {
parPanel.setHTML("<span class='label label-info btn-separator-right ri-category'>"
+ messages.representationInformationListItems(category) + "</span>");
parPanel.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
List<String> history = new ArrayList<>();
Expand Down Expand Up @@ -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<RepresentationInformationRelation> newRelations = new ArrayList<>();
newRelations.add(relation);
relationTypeToLink.put(relationType, newRelations);
if (relationType != null) {
if (relationTypeToLink.containsKey(relationType)) {
relationTypeToLink.get(relationType).add(relation);
} else {
List<RepresentationInformationRelation> newRelations = new ArrayList<>();
newRelations.add(relation);
relationTypeToLink.put(relationType, newRelations);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</g:Button>
<g:Button addStyleNames="btn btn-block btn-default btn-times-circle"
ui:field="buttonCancel">
<ui:text from='{messages.cancelButton}' />
<ui:text from='{messages.backButton}' />
</g:Button>
</g:FlowPanel>
</g:FlowPanel>
Expand Down

0 comments on commit 0fa5de5

Please sign in to comment.