r1232 - in trunk/simexplorer-is/simexplorer-is-web/src: java/fr/cemagref/simexplorer/is/ui/web/components java/fr/cemagref/simexplorer/is/ui/web/grid java/fr/cemagref/simexplorer/is/ui/web/pages java/fr/cemagref/simexplorer/is/ui/web/tools main/webapp resources/fr/cemagref/simexplorer/is/ui/web/components
Author: glandais Date: 2008-02-25 14:15:49 +0000 (Mon, 25 Feb 2008) New Revision: 1232 Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml Log: Fieldable research Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-25 14:15:49 UTC (rev 1232) @@ -24,12 +24,13 @@ import org.apache.tapestry.annotations.IncludeStylesheet; import org.apache.tapestry.annotations.InjectPage; import org.apache.tapestry.annotations.Parameter; +import org.apache.tapestry.annotations.Persist; import org.apache.tapestry.annotations.Service; import org.apache.tapestry.ioc.annotations.Inject; import org.apache.tapestry.services.PersistentLocale; import org.apache.tapestry.services.RequestGlobals; -import de.hsofttec.t5components.annotations.SetterGetter; +import fr.cemagref.simexplorer.is.storage.SearchColumn; import fr.cemagref.simexplorer.is.ui.web.pages.ElementList; /** @@ -49,9 +50,13 @@ private PersistentLocale persistentLocale; /** The _search text. */ - @SetterGetter - private String _searchText; + @Persist + private String searchText; + /** The search column. */ + @Persist + private SearchColumn searchColumn; + /** The element list. */ @InjectPage private ElementList elementList; @@ -113,7 +118,7 @@ * @return the object */ Object onSuccess() { - elementList.searchQuery(_searchText); + elementList.searchQuery(searchText, searchColumn); // form.recordError(searchField, "Invalid request."); // return null; return elementList; @@ -125,7 +130,8 @@ * @return the object */ public Object onActionFromApplicationList() { - elementList.searchQuery(null); + elementList.searchQuery(null, searchColumn); + searchText = ""; return elementList; } @@ -135,8 +141,7 @@ * @return the object */ public Object onActionFromLogout() { - HttpSession session = requestGlobals.getHTTPServletRequest() - .getSession(); + HttpSession session = requestGlobals.getHTTPServletRequest().getSession(); session.invalidate(); return elementList; } @@ -177,4 +182,40 @@ return elementList.isUserSuperAdmin(); } + /** + * Gets the search text. + * + * @return the search text + */ + public String getSearchText() { + return searchText; + } + + /** + * Sets the search text. + * + * @param searchText the new search text + */ + public void setSearchText(String searchText) { + this.searchText = searchText; + } + + /** + * Gets the search column. + * + * @return the search column + */ + public SearchColumn getSearchColumn() { + return searchColumn; + } + + /** + * Sets the search column. + * + * @param searchColumn the new search column + */ + public void setSearchColumn(SearchColumn searchColumn) { + this.searchColumn = searchColumn; + } + } Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:15:49 UTC (rev 1232) @@ -22,6 +22,7 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.exceptions.SimExplorerException; +import fr.cemagref.simexplorer.is.storage.SearchColumn; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; /** @@ -34,6 +35,9 @@ /** Query being searched. */ private String query = ""; + /** Query being searched. */ + private SearchColumn searchColumn = SearchColumn.AllFields; + /** Bookmark on first item index. */ private int indexStart = 0; @@ -48,11 +52,13 @@ * * @param token the token * @param query the query + * @param searchColumn the search column */ - public ElementDataSource(String token, String query) { + public ElementDataSource(String token, String query, SearchColumn searchColumn) { super(); this.query = query; this.token = token; + this.searchColumn = searchColumn; } /* (non-Javadoc) @@ -64,7 +70,8 @@ if (query == null) { result = RemoteStorageService.getStorageService().findApplicationsCount(token, true); } else { - result = RemoteStorageService.getStorageService().findFullTextCount(token, query, "", false); + result = RemoteStorageService.getStorageService().findFullTextCount(token, query, + searchColumn.toString(), false); } } catch (SimExplorerException e) { throw new RuntimeException(e); @@ -102,8 +109,8 @@ entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex, 1 + endIndex - startIndex, sortColumn, ascending); } else { - entities = RemoteStorageService.getStorageService().findFullText(token, query, "", false, startIndex, - 1 + endIndex - startIndex, sortColumn, ascending); + entities = RemoteStorageService.getStorageService().findFullText(token, query, searchColumn.toString(), + false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending); } } catch (SimExplorerException e) { throw new RuntimeException(e); Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:15:49 UTC (rev 1232) @@ -20,6 +20,7 @@ import java.util.StringTokenizer; import org.apache.tapestry.ComponentResources; +import org.apache.tapestry.annotations.Component; import org.apache.tapestry.annotations.InjectPage; import org.apache.tapestry.annotations.Persist; import org.apache.tapestry.annotations.Retain; @@ -30,6 +31,8 @@ import de.hsofttec.t5components.annotations.SetterGetter; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.exceptions.SimExplorerException; +import fr.cemagref.simexplorer.is.storage.SearchColumn; +import fr.cemagref.simexplorer.is.ui.web.components.SimGrid; import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; @@ -60,9 +63,18 @@ @InjectPage private ElementDetail elementDetail; + /** The query. */ @Persist private String query; - + + /** The search column. */ + @Persist + private SearchColumn searchColumn; + + /** The element list grid. */ + @Component + private SimGrid elementListGrid; + /** * Page loaded. */ @@ -83,13 +95,17 @@ * Search query. * * @param query the query + * @param searchColumn the search column */ - public void searchQuery(String query) { + public void searchQuery(String query, SearchColumn searchColumn) { if (query == null || query.equals("")) { this.query = null; } else { this.query = query; + this.searchColumn = searchColumn; } + elementListGrid.setCurrentPage(1); + elementListGrid.updateSort(""); } /** @@ -97,8 +113,8 @@ * * @return the elements */ - public ElementDataSource getElements() { - return new ElementDataSource(getToken(), this.query); + public ElementDataSource getElements() { + return new ElementDataSource(getToken(), this.query, this.searchColumn); } /** @@ -116,7 +132,8 @@ * @param context the context * * @return the object - * @throws SimExplorerException + * + * @throws SimExplorerException the sim explorer exception */ public Object onActionFromDetailElement(String context) throws SimExplorerException { StringTokenizer st = new StringTokenizer(context, ","); Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:15:49 UTC (rev 1232) @@ -58,7 +58,7 @@ wantedProperties.add("name"); wantedProperties.add("description"); wantedProperties.add("creationDate"); - wantedProperties.add("elementClass"); + wantedProperties.add("elementClassLabel"); List<String> properties = model.getPropertyNames(); for (String property : properties) { if (!wantedProperties.contains(property)) { Modified: trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/main/webapp/ElementList.tml 2008-02-25 14:15:49 UTC (rev 1232) @@ -3,7 +3,7 @@ <h1 class="Title">${windowtitle}</h1> - <table t:type="SimGrid" source="elements" row="element" model="model"> + <table t:id="elementListGrid" t:type="SimGrid" source="elements" row="element" model="model"> <t:parameter name="uuidCell"> <t:actionlink t:id="detailElement" context="${detailElementContext}">${message:simexplorer.ui.web.elementlist.details}</t:actionlink> </t:parameter> Modified: trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml 2008-02-25 14:14:33 UTC (rev 1231) +++ trunk/simexplorer-is/simexplorer-is-web/src/resources/fr/cemagref/simexplorer/is/ui/web/components/Layout.tml 2008-02-25 14:15:49 UTC (rev 1232) @@ -48,7 +48,11 @@ <h2 class="Title"><t:label for="searchField" />:</h2> <input t:type="TextField" t:id="searchField" t:value="searchText" t:validate="required,minlength=3" size="30" /> - <input type="submit" value="${message:simexplorer.ui.web.layout.search}" /> + <br /> + <input t:type="Select" t:value="searchColumn" /> + <br /> + <input type="submit" + value="${message:simexplorer.ui.web.layout.search}" /> </t:form></div> </div>
participants (1)
-
glandais@users.labs.libre-entreprise.org