-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progress on #1333: fix superfluous searches
Searching only occurs when the list is attached and visible; Pressing enter on the search box or clicking the magnifying glass icon shows the list and triggers a refresh (effectively a first fetch if there was no data in the list yet).
- Loading branch information
Showing
7 changed files
with
124 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
roda-ui/roda-wui/src/main/java/org/roda/wui/client/search/SearchWithPreFilters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* The contents of this file are subject to the license and copyright | ||
* detailed in the LICENSE file at the root of the source | ||
* tree and available online at | ||
* | ||
* https://github.com/keeps/roda | ||
*/ | ||
/** | ||
* | ||
*/ | ||
package org.roda.wui.client.search; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.roda.core.data.v2.ip.AIPState; | ||
import org.roda.wui.client.common.UserLogin; | ||
import org.roda.wui.client.common.search.CatalogueSearch; | ||
import org.roda.wui.common.client.HistoryResolver; | ||
import org.roda.wui.common.client.widgets.HTMLWidgetWrapper; | ||
|
||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.uibinder.client.UiBinder; | ||
import com.google.gwt.uibinder.client.UiField; | ||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
import com.google.gwt.user.client.ui.Composite; | ||
import com.google.gwt.user.client.ui.FlowPanel; | ||
import com.google.gwt.user.client.ui.Widget; | ||
|
||
/** | ||
* @author Luis Faria | ||
* | ||
*/ | ||
public class SearchWithPreFilters extends Composite { | ||
|
||
// Used by Search.RESOLVER | ||
|
||
private static SearchWithPreFilters instance = null; | ||
|
||
interface MyUiBinder extends UiBinder<Widget, SearchWithPreFilters> { | ||
} | ||
|
||
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); | ||
|
||
@UiField | ||
FlowPanel searchDescription; | ||
|
||
@UiField(provided = true) | ||
CatalogueSearch catalogueSearch; | ||
|
||
private SearchWithPreFilters() { | ||
// Create main search | ||
catalogueSearch = new CatalogueSearch(true, "Search_AIPs", "Search_representations", "Search_files", null, | ||
AIPState.ACTIVE, null, false); | ||
|
||
initWidget(uiBinder.createAndBindUi(this)); | ||
searchDescription.add(new HTMLWidgetWrapper("SearchDescription.html")); | ||
} | ||
|
||
public static SearchWithPreFilters getInstance() { | ||
if (instance == null) { | ||
instance = new SearchWithPreFilters(); | ||
} | ||
return instance; | ||
} | ||
|
||
public void resolve(List<String> historyTokens, AsyncCallback<Widget> callback) { | ||
catalogueSearch.setFilters(historyTokens); | ||
callback.onSuccess(this); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
roda-ui/roda-wui/src/main/java/org/roda/wui/client/search/SearchWithPreFilters.ui.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> | ||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" | ||
xmlns:g="urn:import:com.google.gwt.user.client.ui" | ||
xmlns:commonsearch="urn:import:org.roda.wui.client.common.search"> | ||
|
||
<ui:with field='messages' type='config.i18n.client.ClientMessages' /> | ||
|
||
<g:FlowPanel styleName="search" addStyleNames="wrapper skip_padding"> | ||
<g:FlowPanel addStyleNames="row full_width skip_padding"> | ||
<g:FlowPanel addStyleNames="col_12 content"> | ||
<g:HTML> | ||
<h1> | ||
<ui:text from='{messages.searchTitle}' /> | ||
</h1> | ||
</g:HTML> | ||
<g:FlowPanel addStyleNames="page-description" ui:field="searchDescription"> | ||
</g:FlowPanel> | ||
<commonsearch:CatalogueSearch ui:field="catalogueSearch" /> | ||
</g:FlowPanel> | ||
</g:FlowPanel> | ||
</g:FlowPanel> | ||
</ui:UiBinder> |