Re: How to add filtering to AjaxFallbackDefaultDataTable
Hi, I tried to use the FilterForm adding a TextFilter instead of the normal TextField but then I had problems with the bindings between the FilterText and the filter field on my (java) page... so actually I renounced and I just put a normal Form with just a text field and in the submit implementation of the search button I set the filter value(s) in my data provider. So this is not exactly the answer to your questions but maybe it can help... Here some code: In my BaseListPage (then extended by different specific ListPages): /** * Creates the filter form and adds it to the page. * * @param accountDataProvider The dataprovider to use. * @param dataView the data view to use for this filter form. */ private Form createFilterForm( final AccountDataProvider accountDataProvider, final DataView dataView) { keyFilter = new ApiKey(); keyFilter.setKey(); accountDataProvider.setFilterState(keyFilter); keyFilterModel = new BoundCompoundPropertyModel(keyFilter); Form returnedFilterForm = new Form(filterForm, keyFilterModel); key = new TextField(filterByKey); keyFilterModel.bind(key, key); returnedFilterForm.add(key); cancelFilterButton = new ImageButton(cancelFilterButton) { /** * */ private static final long serialVersionUID = -6964798131219341486L; @Override public void onSubmit() { keyFilter.setKey(); dataView.setCurrentPage(0); setResponsePage(getPage()); } }; cancelFilterButton.add(key); returnedFilterForm.add(cancelFilterButton); filterButton = new ImageButton(filterButton) { /** * */ private static final long serialVersionUID = -6964798131219341486L; @Override public void onSubmit() { dataView.setCurrentPage(0); setResponsePage(getPage()); } }; returnedFilterForm.add(key); returnedFilterForm.add(filterButton); return returnedFilterForm; } And then the dataprovider structure: public abstract class AccountDataProvider extends SortableDataProvider implements IFilterStateLocator { /** Service that will be used to retrieve the list of accounts */ protected AccountService? extends ApiAbstractAccount accountService; /** * Reuse the key entity to store filter information. */ private ApiKey keyFilter; public AccountDataProvider( AccountService? extends ApiAbstractAccount accountService) { this.accountService = accountService; } /** * Retrieves the accounts from the database considering the filterFielmodel * passed. * * @param first offset for the first row of data to retrieve * @param count number of rows to retrieve * @param The filter model to be used. * @return A collection of accounts. */ protected Collection? extends ApiAbstractAccount retrieveAccounts( int first, int count, ApiKey keyFilter) { SortParam sp = getSort(); QueryParam queryParam = new QueryParam(first, count, sp.getProperty(), sp.isAscending()); Collection? extends ApiAbstractAccount accounts = null; accounts = accountService.find(queryParam, keyFilter); return accounts; } /** * Gets total number of items in the collection taking into account the * filter value currently set. * * @return total item count */ public int size() { return accountService.count(keyFilter); } public ApiKey getFilterState() { return keyFilter; } public void setFilterState(Object state) { keyFilter = (ApiKey) state; } } and: public class BusinessAccountDataProvider extends AccountDataProvider { /** * Eclipse Generated Id. */ private static final long serialVersionUID = -2177966069711283834L; public BusinessAccountDataProvider( BusinessAccountServiceApiBusinessAccount businessAccountService) { super(businessAccountService); // set the default sort setSort(contactName, true); } /** * Gets an iterator for the subset of accounts. * * @param first offset for the first row of data to retrieve * @param count number of rows to retrieve * @return iterator capable of iterating over {first, first+count} accounts */ public IteratorApiBusinessAccountAdapterImpl iterator(int first, int count) { SortParam sp = getSort(); CollectionApiBusinessAccount accounts = (CollectionApiBusinessAccount) retrieveAccounts(first, count, getFilterState()); CollectionApiBusinessAccountAdapterImpl accountAdapters =
Re: enclosures and dataview
heh, you see...all those hacks like calling isvisible inside getrowcount() were to avoid all these extra calls to size()...so more hacks to avoid other hacks, etc. we need to rethink how the whole size() thing is dealt with -igor On Dec 10, 2007 10:41 AM, Michael Sparer [EMAIL PROTECTED] wrote: Hi, I'm using a DataView along with a AjaxPagingNavigator inside a wicket:enclosure tag. I wanted to display the whole stuff only if the item-count of the items that will be displayed in the DataView is greater than 0. I wanted to avoid by all means (well it would have been the last resort actually :-)) to call the DataProvider's size-method as this would make an unnecessary database query. Fortunately the DataView provides a method getRowCount() which should give me exactly the number I need, and write it to its iternal cache. So I overrode the DataView's isVisible method like that public boolean isVisible() { return getRowCount() 0; } Unfortunately getRowCount() calls isVisible() internally which then leads to an infinite loop. To keep it short, I ended up with a filthy hack by implementing a custom subclass of DataView that went like that in the constructor: private boolean _initActive = false; private int _rowCount; public MyDataView() { super(...); _initActive = true; _rowCount = getRowCount(); _initActive = false; } public boolean isVisible() { return _initActive || _rowCount 0; } My question: As empty PagingNavigators/Dataviews often don't look nice, I can imagine that keeping them invisible if they're empty is a common scenario. Wouldn't it be nice to have a convenience method in DataView or PagingNavigator for that? Or am I missing an obvious way to do this? - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/enclosures-and-dataview-tp14258879p14258879.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket behind a front-end proxy
I am pretty sure my configuration is correct as per the documentation however I am having the following problem: My configuration is as follows: Apache 2.2 (mod_proxy_jk) -- Tomcat 5.5(JBoss embedded) My Wicket application filter is mapped to /* and my WAR file is deployed within a context of /web therefore URL's look like http://pabst:8080/web/mypage http://myhost:8080/web/mypage or http://pabst:8080/web/?x=TFx*mXM8oGdr1hAFT5*lkAhttp://myhost:8080/web/?x=TFx*mXM8oGdr1hAFT5*lkAetc.. using the CryptedUrlWebRequestCodingStrategy. Here is my Apache virtual host configuration for mod_proxy running on tiger proxing to pabst : VirtualHost *:80 ServerName tiger DocumentRoot /opt/www/ ProxyRequests Off Proxy * Order deny,allow Allow from all /Proxy RewriteEngine on #HACK to fix home page context issue RewriteRule ^/web(.*) $1 [R=302,NC] ProxyPass / ajp://10.0.0.1:8009/web/ ProxyPassReverse / ajp://10.0.0.1:8009/web/ ProxyPassReverseCookiePath /web / ProxyPreserveHost On RewriteLog /var/log/httpd/rewrite.log RewriteLogLevel 2 /VirtualHost This works just fine, however without the rewrite rule mentioned above the site redirects to /web/[page] under some circumstances. As far as I can tell it happens when you click on a link that requires authorization, RestartResponseAtInterceptPageException is thrown and it attempts redirect to the InterceptPage but the ProxyPassReverse rule isn't applied. It also seems to happen when ever Application.getHomePage() is called, but I can't confirm that. One last thing and I'm not sure if it matters but getHomePage() is returning a page that is an Authenticated web page, I do this because this way the URL doesn't change from the logged in home page versus the unauthenticated home page. For the people who aren't having problems with this, are you using Tomcat? Any help is appreciated. j On Dec 9, 2007 3:18 AM, Frank Bille [EMAIL PROTECTED] wrote: If you read[1], it say what you need to do (and which version of Apache httpd you need to use). Frank [1]: http://cwiki.apache.org/WICKET/wicket-behind-a-front-end-proxy.html On Dec 9, 2007 8:15 AM, sshark [EMAIL PROTECTED] wrote: Hi, I am trying the same but it does not seems to work.What I want is to be able to access Wicket application using the URL * http://www.someapps.com*instead of *http://myapps.com/wicketapps*. I am using Apache 1.3. Should I be using Apache 2.x instead? Please advise. Thanks My configuration is VirtualHost myapps.com DocumentRoot /home/vocanic/apps_vocanic_net ServerAlias www.myapps.com JkMount /* vocanic_1 /VirtualHost VirtualHost someapps.com ServerAlias www.someapps.com ProxyPass / http://localhost:10012/wicketapps ProxyPassReverse / http://localhost:10012/wicketapps #ProxyPassReverseCookiePath /citibank-survey / #not supported in Apache 1.3 /VirtualHost /lim/ p.s. I tried to post this message in reply to the topic Re: Wicket behind a front-end proxy in Nabble but it was rejected. The error was, I quoted, *This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: users@wicket.apache.org SMTP error from remote mail server after end of data: host mx1.eu.apache.org [192.87.106.230]: 552 spam score (5.0) exceeded threshold** * Can anyone shed someone light here? Thanks
Create button to open popup Window.
Hi, I am very new to wicket. My background is with jsp. I'd like to add a button that will open a popup window that contains mulitple checkboxes. The user will select a few checkboxes and then those choices will be listed back on the main page ( using ajax??) Right now I'm trying to figure out how in wicket to have my button open a popup window. I don't want to submit the form but have some type of onclick event. Any insight is greatly appreciated. Thanks Karen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox tree component
Doug Leeper wrote: When does this occur? - the first time the page is displayed - after you do some user interaction? if so, are you using Ajax in the user interaction? This happens on the initial loading of the page, and I tried setting the CheckType to Ajax and to Regular. It happens in both cases (except you get CheckBoxTree$2 instead of $3). -- View this message in context: http://www.nabble.com/Checkbox-tree-component-tp13433102p14267352.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]