Skip to content

Commit

Permalink
Improve search, fix log page, improve transferred resources pages
Browse files Browse the repository at this point in the history
Improve search by making search placeholder, actionable and actionable callback part of the list options;
Fix log list so that clicking an item in the list show the log entry page;
Remove sidebar from log entry page;
Remove sidebar from transferred resources pages, and add toolbar;
Fix creating a folder or uploading a file inside a transferred resource folder.
  • Loading branch information
chalkos authored and luis100 committed Sep 5, 2018
1 parent d7f7527 commit b63c750
Show file tree
Hide file tree
Showing 32 changed files with 262 additions and 429 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,29 +237,29 @@ private BrowseAIP(BrowseAIPBundle bundle) {
ListBuilder<IndexedRepresentation> representationsListBuilder = new ListBuilder<>(() -> new RepresentationList(),
new AsyncTableCellOptions<>(IndexedRepresentation.class, "BrowseAIP_representations")
.withFilter(new Filter(new SimpleFilterParameter(RodaConstants.REPRESENTATION_AIP_ID, aip.getId())))
.withJustActive(justActive).withSummary(messages.listOfRepresentations()).bindOpener());
.withJustActive(justActive).withSummary(messages.listOfRepresentations()).bindOpener()
.withActionable(representationActions));

representationsSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(representationsListBuilder,
representationActions);
representationsSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(representationsListBuilder);

// DISSEMINATIONS

ListBuilder<IndexedDIP> disseminationsListBuilder = new ListBuilder<>(() -> new DIPList(),
new AsyncTableCellOptions<>(IndexedDIP.class, "BrowseAIP_disseminations")
.withFilter(new Filter(new SimpleFilterParameter(RodaConstants.DIP_AIP_UUIDS, aip.getId())))
.withJustActive(justActive).withSummary(messages.listOfDisseminations()).bindOpener());
.withJustActive(justActive).withSummary(messages.listOfDisseminations()).bindOpener()
.withActionable(disseminationActions));

disseminationsSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(disseminationsListBuilder,
disseminationActions);
disseminationsSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(disseminationsListBuilder);

// AIP CHILDREN

ListBuilder<IndexedAIP> aipChildrenListBuilder = new ListBuilder<>(() -> new AIPList(),
new AsyncTableCellOptions<>(IndexedAIP.class, "BrowseAIP_aipChildren")
.withFilter(new Filter(new SimpleFilterParameter(RodaConstants.AIP_PARENT_ID, aip.getId())))
.withJustActive(justActive).withSummary(messages.listOfAIPs()).bindOpener());
.withJustActive(justActive).withSummary(messages.listOfAIPs()).bindOpener().withActionable(aipActions));

aipChildrenSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(aipChildrenListBuilder, aipActions);
aipChildrenSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(aipChildrenListBuilder);

// INIT
initWidget(uiBinder.createAndBindUi(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ public BrowseDIP(Viewers viewers, BrowseDipBundle bundle) {

ListBuilder<DIPFile> dipFileListBuilder = new ListBuilder<>(() -> new DIPFileList(),
new AsyncTableCellOptions<>(DIPFile.class, "BrowseDIP_dipFiles").withFilter(filter)
.withSummary(messages.allOfAObject(DIPFile.class.getName())).bindOpener());
.withSummary(messages.allOfAObject(DIPFile.class.getName())).bindOpener()
.withActionable(DisseminationFileActions.get(dip.getPermissions())));

SearchWrapper search = new SearchWrapper(false).createListAndSearchPanel(dipFileListBuilder,
DisseminationFileActions.get(dip.getPermissions()));
SearchWrapper search = new SearchWrapper(false).createListAndSearchPanel(dipFileListBuilder);

SimplePanel layout = new SimplePanel();
layout.add(search);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ public BrowseRepresentation(BrowseRepresentationBundle bundle) {

ListBuilder<IndexedFile> fileListBuilder = new ListBuilder<>(() -> new SearchFileList(showFilesPath),
new AsyncTableCellOptions<>(IndexedFile.class, "BrowseRepresentation_files").withFilter(filesFilter)
.withJustActive(justActive).withSummary(summary).bindOpener());
.withJustActive(justActive).withSummary(summary).bindOpener()
.withActionable(FileActions.get(aipId, repId, aip.getPermissions())));

filesSearch = new SearchWrapper(false).createListAndSearchPanel(fileListBuilder,
FileActions.get(aipId, repId, aip.getPermissions()));
filesSearch = new SearchWrapper(false).createListAndSearchPanel(fileListBuilder);

// DISSEMINATIONS

Expand All @@ -245,10 +245,9 @@ public BrowseRepresentation(BrowseRepresentationBundle bundle) {
ListBuilder<IndexedDIP> disseminationsListBuilder = new ListBuilder<>(() -> new DIPList(),
new AsyncTableCellOptions<>(IndexedDIP.class, "BrowseRepresentation_disseminations")
.withFilter(disseminationsFilter).withSummary(messages.listOfDisseminations()).bindOpener()
.withJustActive(justActive));
.withJustActive(justActive).withActionable(DisseminationActions.get()));

disseminationsSearch = new SearchWrapper(false).createListAndSearchPanel(disseminationsListBuilder,
DisseminationActions.get());
disseminationsSearch = new SearchWrapper(false).createListAndSearchPanel(disseminationsListBuilder);

// INIT
initWidget(uiBinder.createAndBindUi(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ private BrowseTop() {
ListBuilder<IndexedAIP> listBuilder = new ListBuilder<>(() -> new AIPList(),
new AsyncTableCellOptions<>(IndexedAIP.class, "BrowseTop_aip")
.withFilter(new Filter(new EmptyKeyFilterParameter(RodaConstants.AIP_PARENT_ID))).withJustActive(true)
.withSummary(messages.listOfAIPs()).bindOpener());
.withSummary(messages.listOfAIPs()).bindOpener().withActionable(AipActions.get()));

search = new SearchWrapper(false).createListAndSearchPanel(listBuilder, AipActions.get());
search = new SearchWrapper(false).createListAndSearchPanel(listBuilder);

// INIT
initWidget(uiBinder.createAndBindUi(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ protected Widget directoryPreview() {

ListBuilder<IndexedFile> folderListBuilder = new ListBuilder<>(() -> new SearchFileList(),
new AsyncTableCellOptions<>(IndexedFile.class, "IndexedFilePreview_files").withFilter(filter)
.withSummary(messages.representationListOfFiles()).withJustActive(getJustActive()).bindOpener());
.withSummary(messages.representationListOfFiles()).withJustActive(getJustActive()).bindOpener().withActionable(
FileActions.get(getObject().getAipId(), getObject().getRepresentationId(), getObject(), getPermissions())));

LastSelectedItemsSingleton.getInstance().setSelectedJustActive(getJustActive());

searchWrapper = new SearchWrapper(false).createListAndSearchPanel(folderListBuilder,
FileActions.get(getObject().getAipId(), getObject().getRepresentationId(), getObject(), getPermissions()),
messages.searchPlaceHolder());
searchWrapper = new SearchWrapper(false).createListAndSearchPanel(folderListBuilder);
return searchWrapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.roda.core.data.v2.ip.IndexedFile;
import org.roda.core.data.v2.ip.IndexedRepresentation;
import org.roda.core.data.v2.ip.Permissions;
import org.roda.core.data.v2.ip.TransferredResource;
import org.roda.wui.client.browse.bundle.BrowseAIPBundle;
import org.roda.wui.client.browse.bundle.BrowseDipBundle;
import org.roda.wui.client.browse.bundle.BrowseFileBundle;
Expand All @@ -32,6 +33,7 @@
import org.roda.wui.client.common.actions.DisseminationFileActions;
import org.roda.wui.client.common.actions.FileActions;
import org.roda.wui.client.common.actions.RepresentationActions;
import org.roda.wui.client.common.actions.TransferredResourceActions;
import org.roda.wui.client.common.actions.model.ActionableBundle;
import org.roda.wui.client.common.actions.model.ActionableGroup;
import org.roda.wui.client.common.actions.model.ActionableObject;
Expand Down Expand Up @@ -108,6 +110,7 @@ interface MyUiBinder extends UiBinder<Widget, NavigationToolbar> {
FlowPanel toolbarPanel;

private T currentObject = null;
private Object parentObject = null;
private Permissions permissions = null;
private HandlerRegistration searchPopupClickHandler = null;

Expand Down Expand Up @@ -275,6 +278,16 @@ private void setupActions() {
new ActionableWidgetBuilder<>(disseminationFileActions).buildListWithObjects(new ActionableObject<>(dipFile)));
actionsButton.addClickHandler(event -> popup.showRelativeTo(actionsButton));
actionsButton.setVisible(true);
} else if (currentObject instanceof TransferredResource) {
infoSidebarButton.setTitle(messages.oneOfAObject(TransferredResource.class.getName()));

TransferredResource transferredResource = (TransferredResource) this.currentObject;
TransferredResourceActions transferredResourceActions = TransferredResourceActions.get(null);

popup.setWidget(new ActionableWidgetBuilder<>(transferredResourceActions)
.buildListWithObjects(new ActionableObject<>(transferredResource)));
actionsButton.addClickHandler(event -> popup.showRelativeTo(actionsButton));
actionsButton.setVisible(true);
}
}

Expand Down Expand Up @@ -318,6 +331,10 @@ public void updateBreadcrumb(Bundle dipReferrerBundle) {
}
}

public void updateBreadcrumb(TransferredResource transferredResource) {
breadcrumb.updatePath(BreadcrumbUtils.getTransferredResourceBreadcrumbs(transferredResource));
}

public void updateBreadcrumbPath(BreadcrumbItem... items) {
updateBreadcrumbPath(Arrays.asList(items));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public class TransferredResourceActions extends AbstractActionable<TransferredRe
TransferredResourceAction.NEW_FOLDER));

private static final Set<TransferredResourceAction> POSSIBLE_ACTIONS_ON_FOLDER_TRANSFERRED_RESOURCE = new HashSet<>(
Arrays.asList(TransferredResourceAction.values()));
Arrays.asList(TransferredResourceAction.RENAME, TransferredResourceAction.MOVE, TransferredResourceAction.REMOVE,
TransferredResourceAction.NEW_PROCESS));

private static final Set<TransferredResourceAction> POSSIBLE_ACTIONS_ON_FILE_TRANSFERRED_RESOURCE = new HashSet<>(
Arrays.asList(TransferredResourceAction.RENAME, TransferredResourceAction.MOVE, TransferredResourceAction.REMOVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.cellview.client.AbstractHasData.RedrawEvent;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.view.client.SelectionChangeEvent;

public class AsyncTableCellOptions<T extends IsIndexed> {
Expand All @@ -27,6 +28,7 @@ public class AsyncTableCellOptions<T extends IsIndexed> {
private int initialPageSize;
private int pageSizeIncrement;
private Actionable<T> actionable;
private AsyncCallback<Actionable.ActionImpact> actionableCallback;
private boolean bindOpener;
private List<AsyncTableCell.CheckboxSelectionListener<T>> checkboxSelectionListeners;
private List<ValueChangeHandler<IndexResult<T>>> indexResultValueChangeHandlers;
Expand All @@ -36,13 +38,15 @@ public class AsyncTableCellOptions<T extends IsIndexed> {
private Integer autoUpdate;
private boolean csvDownloadButtonVisibility;
private boolean startHidden;
private String searchPlaceholder;

public AsyncTableCellOptions(Class<T> classToReturn, String listId) {
this.classToReturn = classToReturn;
this.listId = listId;

// set defaults
actionable = null;
actionableCallback = null;
filter = SearchFilters.allFilter();
justActive = false;
facets = ConfigurationManager.FacetFactory.getFacets(listId);
Expand All @@ -58,6 +62,7 @@ public AsyncTableCellOptions(Class<T> classToReturn, String listId) {
autoUpdate = null;
csvDownloadButtonVisibility = true;
startHidden = false;
searchPlaceholder = null;
}

public Class<T> getClassToReturn() {
Expand Down Expand Up @@ -153,133 +158,93 @@ public AsyncTableCellOptions<T> addRedrawHandler(RedrawEvent.Handler handler) {
return this;
}

/**
* @return the listId
*/
public String getListId() {
return listId;
}

/**
* @return the filter
*/
public Filter getFilter() {
return filter;
}

/**
* @return the justActive
*/
public boolean isJustActive() {
return justActive;
}

/**
* @return the facets
*/
public Facets getFacets() {
return facets;
}

/**
* @return the summary
*/
public String getSummary() {
return summary;
}

/**
* @return the fieldsToReturn
*/
public List<String> getFieldsToReturn() {
return fieldsToReturn;
}

/**
* @return the initialPageSize
*/
public int getInitialPageSize() {
return initialPageSize;
}

/**
* @return the pageSizeIncrement
*/
public int getPageSizeIncrement() {
return pageSizeIncrement;
}

/**
* @return the actionable
*/
public Actionable<T> getActionable() {
return actionable;
}

/**
* @return the bindOpener
*/
public boolean isBindOpener() {
return bindOpener;
}

/**
* @return the checkboxSelectionListeners
*/
public List<AsyncTableCell.CheckboxSelectionListener<T>> getCheckboxSelectionListeners() {
return checkboxSelectionListeners;
}

/**
* @return the indexResultValueChangeHandlers
*/
public List<ValueChangeHandler<IndexResult<T>>> getIndexResultValueChangeHandlers() {
return indexResultValueChangeHandlers;
}

/**
* @return the selectionChangeHandlers
*/
public List<SelectionChangeEvent.Handler> getSelectionChangeHandlers() {
return selectionChangeHandlers;
}

/**
* @return the redrawEventHandlers
*/
public List<RedrawEvent.Handler> getRedrawEventHandlers() {
return redrawEventHandlers;
}

/**
* @return the extraStyleNames
*/
public List<String> getExtraStyleNames() {
return extraStyleNames;
}

/**
* @return the autoUpdate
*/
public Integer getAutoUpdate() {
return autoUpdate;
}

/**
* @return the csvDownloadButtonVisibility
*/
public boolean isCsvDownloadButtonVisibility() {
return csvDownloadButtonVisibility;
}

/**
* @return the startHidden
*/
public boolean isStartHidden() {
return startHidden;
}





public String getSearchPlaceholder() {
return searchPlaceholder;
}

public AsyncTableCellOptions<T> withSearchPlaceholder(String searchPlaceholder) {
this.searchPlaceholder = searchPlaceholder;
return this;
}

public AsyncCallback<Actionable.ActionImpact> getActionableCallback() {
return actionableCallback;
}

public AsyncTableCellOptions<T> withActionableCallback(AsyncCallback<Actionable.ActionImpact> actionableCallback) {
this.actionableCallback = actionableCallback;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,20 @@ public CatalogueSearch(boolean justActive, String itemsListId, String representa
// prepare lists
ListBuilder<IndexedAIP> aipListBuilder = new ListBuilder<>(() -> new AIPList(),
new AsyncTableCellOptions<>(IndexedAIP.class, itemsListId).withJustActive(justActive).bindOpener()
.withStartHidden(true));
.withStartHidden(true).withActionable(AipActions.get(parentAipId, parentAipState, permissions)));

ListBuilder<IndexedRepresentation> representationListBuilder = new ListBuilder<>(() -> new RepresentationList(),
new AsyncTableCellOptions<>(IndexedRepresentation.class, representationsListId).withJustActive(justActive)
.bindOpener().withStartHidden(true));
.bindOpener().withStartHidden(true).withActionable(RepresentationActions.get()));

ListBuilder<IndexedFile> fileListBuilder = new ListBuilder<>(() -> new SearchFileList(true),
new AsyncTableCellOptions<>(IndexedFile.class, filesListId).withJustActive(justActive).bindOpener()
.withStartHidden(true));
.withStartHidden(true).withActionable(FileActions.get()));

// add lists to search
searchWrapper = new SearchWrapper(true, IndexedAIP.class.getSimpleName())
.createListAndSearchPanel(aipListBuilder, AipActions.get(parentAipId, parentAipState, permissions))
.createListAndSearchPanel(representationListBuilder, RepresentationActions.get())
.createListAndSearchPanel(fileListBuilder, FileActions.get());
.createListAndSearchPanel(aipListBuilder).createListAndSearchPanel(representationListBuilder)
.createListAndSearchPanel(fileListBuilder);

initWidget(uiBinder.createAndBindUi(this));
}
Expand Down
Loading

0 comments on commit b63c750

Please sign in to comment.