Re: button click and Form with CompoundPropertyModel lose its data
If you create a new Poll object, there is no magic that will bind that to your form instead of the Poll object you wrapped in the CompoundPropertyModel. You could put the poll object as a local field member in the class, and use PropertyModel(poll, property-expression) for the fields instead. That way you can swap out the poll-object and still keep the form in sync. Alternatively you can apply the new Poll object to the form by doing: form.setModel(new CompoundPropertyModel(newPollObject)) after you create the new one. -- Edvin itayh skrev: Hi, I am creating a form in the next format: private abstract class EditForm extends Form{ public EditForm(String id, Poll poll) { /* * We wrap the poll bean with a CompoundPropertyModel, this allows * us to easily connect form components to the bean properties * (component id is used as the property expression) */ super(id, new CompoundPropertyModel(poll)); } } My page has also some buttons in different forms that do all kind of things. My problem begin when I create new Poll object (so the poll is empty) and fill the fields of the poll, but before saving it I press on one of the other buttons. It is rendering the page again so all the data that I enter is lost. Same problem occur when I edit poll and before saving it I press on one of the other buttons. It is rendering the page again so all the data that I change is lost. Any idea will be appreciate. Thanks, Itay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: button click and Form with CompoundPropertyModel lose its data
I'm sorry, I see now that I misunderstood the question :) -- Edvin Igor Vaynberg skrev: your buttons in different forms will submit the form they are in, so you lose any input form any other form. this is how html works - only one form can be submitted. wicket supports embedded forms, so if you embed all your other forms into one form the input should not be lost. -igor On Mon, Dec 1, 2008 at 12:11 AM, itayh [EMAIL PROTECTED] wrote: Hi, I am creating a form in the next format: private abstract class EditForm extends Form{ public EditForm(String id, Poll poll) { /* * We wrap the poll bean with a CompoundPropertyModel, this allows * us to easily connect form components to the bean properties * (component id is used as the property expression) */ super(id, new CompoundPropertyModel(poll)); } } My page has also some buttons in different forms that do all kind of things. My problem begin when I create new Poll object (so the poll is empty) and fill the fields of the poll, but before saving it I press on one of the other buttons. It is rendering the page again so all the data that I enter is lost. Same problem occur when I edit poll and before saving it I press on one of the other buttons. It is rendering the page again so all the data that I change is lost. Any idea will be appreciate. Thanks, Itay -- View this message in context: http://www.nabble.com/button-click-and-Form-with-CompoundPropertyModel-lose-its-data-tp20767616p20767616.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: inmethod / grid website?
Thanks, that worked great. I'm really impressed by this component, and I think it would be very good for Wicket in general that this gets more available to people, including some examples. I'd be happy to write examples and wiki-pages once I understand a bit more of it, btw. -- Edvin Matej Knopp skrev: There is branch for Wicket 1.3 in Wicketstuff SVN. -Matej On Wed, Oct 29, 2008 at 10:41 PM, Edvin Syse [EMAIL PROTECTED] wrote: What version of Wicket is this compiled against? I tried using it with 1.3.5 and it seems AbstractGrid is trying to call a method called init in org.apache.wicket.MetaDataKey, which doesn't exist. -- Edvin Martin Grigorov skrev: Jars: http://wicketstuff.org/maven/repository/com/inmethod/ Demo: http://wicketstuff.org/grid-examples/ Update your bookmarks. On Tue, 2008-10-21 at 11:53 +0200, Martin Voigt wrote: Hi, this may be the wrong place to ask, but anyways. What happened to the inmethod/ grid web site? http://www.inmethod.com/ is showing the tomcat welcome page for some time now. Did it move? Regards, Martin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Double-click to select row - inmethod grid
Hi, I subclassed the AbstractGrid class to enable double-click to select a row instead of single-click, since it is handy to be able to click in a row to copy text etc, and then use double-click to select instead. Wouldn't this be a nice addition to the AbstractGrid class? Here is my quick/dirty implementation: public class MyDataGrid extends DefaultDataGrid { /* Constructors */ public MyDataGrid(String id, IModel model, ListIGridColumn columns) { super(id, model, columns); } public MyDataGrid(String id, IDataSource dataSource, ListIGridColumn columns) { super(id, dataSource, columns); } /* We want double-click to trigger ajax-call, not the default single-click */ protected boolean disableRowClickNotifications() { return true; } /* Add ajax-behavior for double-click */ protected void onRowPopulated(final WebMarkupContainer rowComponent) { super.onRowPopulated(rowComponent); rowComponent.add(new AjaxFormSubmitBehavior(getForm(), ondblclick) { private static final long serialVersionUID = 1L; protected void onSubmit(AjaxRequestTarget target) { } protected void onError(AjaxRequestTarget target) { } protected void onEvent(AjaxRequestTarget target) { onRowDblClicked(target, rowComponent.getModel()); } public CharSequence getCallbackUrl() { return super.getCallbackUrl() + column='+col+'; } protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { public CharSequence decorateScript(CharSequence script) { return super.decorateScript(if (InMethod.XTable.canSelectRow(event)) { + var col=(this.imxtClickedColumn || ''); this.imxtClickedColumn=''; + script + }); } }; } }); } /* Override this to implement the double-click action */ protected void onRowDblClicked(AjaxRequestTarget target, IModel rowModel) { } } -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: inmethod / grid website?
What version of Wicket is this compiled against? I tried using it with 1.3.5 and it seems AbstractGrid is trying to call a method called init in org.apache.wicket.MetaDataKey, which doesn't exist. -- Edvin Martin Grigorov skrev: Jars: http://wicketstuff.org/maven/repository/com/inmethod/ Demo: http://wicketstuff.org/grid-examples/ Update your bookmarks. On Tue, 2008-10-21 at 11:53 +0200, Martin Voigt wrote: Hi, this may be the wrong place to ask, but anyways. What happened to the inmethod/ grid web site? http://www.inmethod.com/ is showing the tomcat welcome page for some time now. Did it move? Regards, Martin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache FOP and Wicket
Sure, it is possible, but it is tedious and verbose compared to using Freemarker or another scripting language. Using Wicket for this will only add more code and complexity to the process, and it's not like you need component based control of the markup you are creating, so Wicket is simply overkill for this task. Wicket isn't a golden hammer, even though it is great at what it does/is meant for :) Remember, you have to create both the java-side and the html-side for every variable you put in your markup, instead of just outputting ${var} where you need it :) -- Edvin Adrian Wiesmann skrev: Why not? I was remembering that Wicket can manage any markup, not just HTML . . Am I missing something ? Not sure. If you do, so do I :) I have written a renderer which takes an XML containing some UI description and either generates Swing, HTML (Wicket), PDF (FOP) or CSV from the same UI description (but from different templates). Although you can ask Wicket to generate the PDF, there is no direct link between FOP and Wicket. Wicket only calls my renderer and forwards the generated file to the user via HTTP. The problem with having Wicket generate your FOP files will be that you will have to write all UI elements on your own because there are no classes/objects you can use. hth, Adrian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reporting Engine on Wicket 1.3.4
We use Apache XmlGraphhics/FOP to create PDF successfully in our Wicket-applications. Some places I use an external XML-datasource and convert using XSLT, and other times I use Freemarker to generate the .fo directly. It's extremely fast, and the markup is easy to understand and easy to change/style. Actually, in our Wicket-based CMS, the users can change templates so that the same article can output HTML, RSS/XML or even PDF through Apache FOP :) -- Edvin David R Robison skrev: We use Jasper reports. We took what had been started and made some modifications and have it working in Wicket. It works well for us. David Eyal Golan wrote: reiern70: Could you please elaborate on how you included BIRT as the part of the application? You can mail directly to me if you feel it is out of Wicket's scope. Thanks On Tue, Sep 9, 2008 at 2:19 PM, reiern70 [EMAIL PROTECTED] wrote: Hi, Actually there is no deed to have BIRT in a separated WAR: in our project we have included it as a (singleton) runtime which is part of the application. We also have some kind of WEB interface to manage report parameters... We found BIRT quite useful for generating reports thought we had some problems when migrating to new versions (sometimes things that were working perfectly with one version got terrible unfixed when moving to the next). With BIRT you get for free the ability to produce Excel, Word, etc... In our project we went a bit further and built a machinery that allows to combine BIRT (and non BIRT) PDF reports into books: BIRT reports are very good in summarizing information but you are on your own when you have to combine them... This tool allows you to build a tree like structure (a book) where the nodes are BIRT reports. The tool will help in collecting all the bookmarks into a table of contents, generate combined bookmarks and so on... For simpler use cases I have used iText, JFreeChart, JExcelAPI, OpenCSV... Best, Ernesto egolan74 wrote: Hi, We use BIRT as a report engine. A freelancer has created the prototype BIRT project, and now we took over it. 1. BIRT gives you all your needs. 2. I don't like it very much actually. 3. It is a different project than Wicket. (different WAR) 4. I plan to check how to integrate it to be in the same project / WAR of our main web application. Our integration: We don't like the way BIRT implemented the parameters window so we wanted to make our own. We found out that it would be much easier to develop it with Wicket than to customize it in BIRT. So: 1. We have a page that has an IFrame (inline frame). 2. For each report (in the BIRT project) there's a Wicket's popup modal window to select parameters. I am very happy with the module we built for that. It is very easy to create new parameters window. 3. When the user chooses the parameters and press OK, I set, using AttributeModifier, the src attribute of the inline frame. 4. It is all Ajax, so the inline frame is updated with the src, and the report is generated with the correct parameters.. This module is VERY new in our project. I still have some bugs, but this is how we integrated BIRT and Wicket. A question to you all: Has anyone worked with Wicket and BIRT? (funny, but I planned to ask this anyway) Eyal On Mon, Sep 8, 2008 at 11:30 AM, Leon Nieuwoudt [EMAIL PROTECTED]wrote: Hi all I would like to know what kind of reporting engines are commonly used for Wicket-based apps? We have the need to generate CSV, Excel, and PDF files with graphs and pretty graphics. We've looked at the JasperReports integration but the docs say it's not complete Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary - Eyal Golan [EMAIL PROTECTED] Visit: JVDrums LinkedIn: LinkedIn -- View this message in context: http://www.nabble.com/Reporting-Engine-on-Wicket-1.3.4-tp19367975p19390209.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] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reporting Engine on Wicket 1.3.4
The freemarker-version is something like this: The user has created a template using the .fo format with Freemarker, a (too) simple example could be: http://tornado.no/template/show?template=global.fop (Notice the list-directive to iterate over articles in this case, since it is a CMS). Then, in the Wicket page I do: byte[] b = FopUtils.createPDF(aStringWithTheMarkup); RequestCycle.get().setRequestTarget(new ResourceStreamRequestTarget( new ByteArrayResourceStream(b, contentType)).setFileName(page.getTitle() + .pdf)); (contentType is application/pdf). The FopUtils class is like this: public class FopUtils { private static FopFactory fopFactory = FopFactory.newInstance(); public static byte[] createPDF(String foMarkup) throws IOException, FOPException, TransformerException { ByteArrayOutputStream out = new ByteArrayOutputStream(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); javax.xml.transform.Transformer transformer = factory.newTransformer(); // identity transformer // Setup input stream Source src = new StreamSource(new StringInputStream(foMarkup)); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); // Result processing FormattingResults foResults = fop.getResults(); out.close(); return out.toByteArray(); } } .. and you get a simple PDF served in milliseconds :) -- Edvin Ajayi Yinka skrev: Hi, could you shed more lights on how you achieve this? Thanks in advance. Yinka On Thu, Sep 11, 2008 at 3:56 AM, Edvin Syse [EMAIL PROTECTED] wrote: We use Apache XmlGraphhics/FOP to create PDF successfully in our Wicket-applications. Some places I use an external XML-datasource and convert using XSLT, and other times I use Freemarker to generate the .fo directly. It's extremely fast, and the markup is easy to understand and easy to change/style. Actually, in our Wicket-based CMS, the users can change templates so that the same article can output HTML, RSS/XML or even PDF through Apache FOP :) -- Edvin David R Robison skrev: We use Jasper reports. We took what had been started and made some modifications and have it working in Wicket. It works well for us. David Eyal Golan wrote: reiern70: Could you please elaborate on how you included BIRT as the part of the application? You can mail directly to me if you feel it is out of Wicket's scope. Thanks On Tue, Sep 9, 2008 at 2:19 PM, reiern70 [EMAIL PROTECTED] wrote: Hi, Actually there is no deed to have BIRT in a separated WAR: in our project we have included it as a (singleton) runtime which is part of the application. We also have some kind of WEB interface to manage report parameters... We found BIRT quite useful for generating reports thought we had some problems when migrating to new versions (sometimes things that were working perfectly with one version got terrible unfixed when moving to the next). With BIRT you get for free the ability to produce Excel, Word, etc... In our project we went a bit further and built a machinery that allows to combine BIRT (and non BIRT) PDF reports into books: BIRT reports are very good in summarizing information but you are on your own when you have to combine them... This tool allows you to build a tree like structure (a book) where the nodes are BIRT reports. The tool will help in collecting all the bookmarks into a table of contents, generate combined bookmarks and so on... For simpler use cases I have used iText, JFreeChart, JExcelAPI, OpenCSV... Best, Ernesto egolan74 wrote: Hi, We use BIRT as a report engine. A freelancer has created the prototype BIRT project, and now we took over it. 1. BIRT gives you all your needs. 2. I don't like it very much actually. 3. It is a different project than Wicket. (different WAR) 4. I plan to check how to integrate it to be in the same project / WAR of our main web application. Our integration: We don't like the way BIRT implemented the parameters window so we wanted to make our own. We found out that it would be much easier to develop it with Wicket than to customize it in BIRT. So: 1. We have a page that has an IFrame (inline frame). 2. For each report (in the BIRT project) there's a Wicket's popup modal window to select parameters. I am very happy with the module we built for that. It is very easy to create new parameters window. 3. When the user chooses the parameters and press OK, I set, using AttributeModifier, the src attribute of the inline frame. 4. It is all Ajax, so the inline frame
Re: Reporting Engine on Wicket 1.3.4
Btw, the ByteArrayResourceStream is just a simple extension of the AbstractResourceStream, wrapping the bytearray :) -- Edvin Edvin Syse skrev: The freemarker-version is something like this: The user has created a template using the .fo format with Freemarker, a (too) simple example could be: http://tornado.no/template/show?template=global.fop (Notice the list-directive to iterate over articles in this case, since it is a CMS). Then, in the Wicket page I do: byte[] b = FopUtils.createPDF(aStringWithTheMarkup); RequestCycle.get().setRequestTarget(new ResourceStreamRequestTarget( new ByteArrayResourceStream(b, contentType)).setFileName(page.getTitle() + .pdf)); (contentType is application/pdf). The FopUtils class is like this: public class FopUtils { private static FopFactory fopFactory = FopFactory.newInstance(); public static byte[] createPDF(String foMarkup) throws IOException, FOPException, TransformerException { ByteArrayOutputStream out = new ByteArrayOutputStream(); FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); // Setup JAXP using identity transformer TransformerFactory factory = TransformerFactory.newInstance(); javax.xml.transform.Transformer transformer = factory.newTransformer(); // identity transformer // Setup input stream Source src = new StreamSource(new StringInputStream(foMarkup)); // Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(fop.getDefaultHandler()); // Start XSLT transformation and FOP processing transformer.transform(src, res); // Result processing FormattingResults foResults = fop.getResults(); out.close(); return out.toByteArray(); } } .. and you get a simple PDF served in milliseconds :) -- Edvin Ajayi Yinka skrev: Hi, could you shed more lights on how you achieve this? Thanks in advance. Yinka On Thu, Sep 11, 2008 at 3:56 AM, Edvin Syse [EMAIL PROTECTED] wrote: We use Apache XmlGraphhics/FOP to create PDF successfully in our Wicket-applications. Some places I use an external XML-datasource and convert using XSLT, and other times I use Freemarker to generate the .fo directly. It's extremely fast, and the markup is easy to understand and easy to change/style. Actually, in our Wicket-based CMS, the users can change templates so that the same article can output HTML, RSS/XML or even PDF through Apache FOP :) -- Edvin David R Robison skrev: We use Jasper reports. We took what had been started and made some modifications and have it working in Wicket. It works well for us. David Eyal Golan wrote: reiern70: Could you please elaborate on how you included BIRT as the part of the application? You can mail directly to me if you feel it is out of Wicket's scope. Thanks On Tue, Sep 9, 2008 at 2:19 PM, reiern70 [EMAIL PROTECTED] wrote: Hi, Actually there is no deed to have BIRT in a separated WAR: in our project we have included it as a (singleton) runtime which is part of the application. We also have some kind of WEB interface to manage report parameters... We found BIRT quite useful for generating reports thought we had some problems when migrating to new versions (sometimes things that were working perfectly with one version got terrible unfixed when moving to the next). With BIRT you get for free the ability to produce Excel, Word, etc... In our project we went a bit further and built a machinery that allows to combine BIRT (and non BIRT) PDF reports into books: BIRT reports are very good in summarizing information but you are on your own when you have to combine them... This tool allows you to build a tree like structure (a book) where the nodes are BIRT reports. The tool will help in collecting all the bookmarks into a table of contents, generate combined bookmarks and so on... For simpler use cases I have used iText, JFreeChart, JExcelAPI, OpenCSV... Best, Ernesto egolan74 wrote: Hi, We use BIRT as a report engine. A freelancer has created the prototype BIRT project, and now we took over it. 1. BIRT gives you all your needs. 2. I don't like it very much actually. 3. It is a different project than Wicket. (different WAR) 4. I plan to check how to integrate it to be in the same project / WAR of our main web application. Our integration: We don't like the way BIRT implemented the parameters window so we wanted to make our own. We found out that it would be much easier to develop it with Wicket than to customize it in BIRT. So: 1. We have a page that has an IFrame (inline frame). 2. For each report (in the BIRT project) there's a Wicket's popup modal window to select parameters. I am very happy with the module we built for that. It is very easy to create new parameters
Re: Apache FOP and Wicket
I don't think Wicket is the right tool for that, try Freemarker instead. You can still serve up the file through Wicket though :) -- Edvin Paolo Di Tommaso skrev: Dear all, If I'm not wrong Wicket is able to manage any king of markup not just HTML. So it would be possibile to use Wicket to generate an Apache FOP markup to rendere a PDF file? Any suggestions? Thank you, -- Paolo -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getForm() on a component inside 2nd level Fragment returns null?
Ritesh Trivedi wrote: Edvin, Before posting, I already made Form a private member of the toolbar and passed it from the parent fragment as a workaround. My main question was - why didnt getForm() on the button work? and second - not sure how you are saying markupProvider is the form? markup provider is the page. My page markup file has the fragments. What am I missing? Martijn answered the first one I see. Sorry for not stating it right away. I was more focused on finding a solution for you :) So to the markupProvider being your form: You wrote: // Cart Header Toolbar cartForm.add(new CartActionToolbar(cartHeaderToolbar, cartActionToolbar, ViewCartPage.this, cartForm)); And your only constructor in CartActionToolbar is: public CartActionToolbar(String id, String markupId, MarkupContainer markupProvider) I didn't count the arguments, I just saw that markupProvider was the last argument, and also that cartForm was the last argument you passed into it. (God damned wrapping in the mail client confused me, I read your mail on the ASUS EEPC - not the biggest screen in the world :) It seems you don't hit this constructor at all? :) Anyways, a cleaner way to do this is to override the onBeforeRender() method of the fragment. Then the component hierarchy is complete, so you can call getParent() or even better, getForm() directly on the component to get the form. Just remember to call super.onBeforeRender() as well :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Change style of TreeNode
Kai Schubert-Altmann skrev: Thanks a lot, Edvin. I will try your answers to 2. and 3.. But I think, that overwriting the populateTreeItem method wouldn't help, because i want to modify nodes of an existing tree, for example mark them red if I click on them. Any suggestions? That's why you need to add an AbstractBehaviour to each item. The onComponentTag() method will be run before the component is rendered, so you can check the state of your userObject and add/remove classes using the tag.put() approach :) Also, you might look into onNodeLinkClicked() method of the tree, if you want to perform actions when you click on an item. The onNodeLinkClicked() gives you access to the AjaxRequestTarget, so you can also execute arbitrary javascript code, like this: protected void onNodeLinkClicked(AjaxRequestTarget target, TreeNode node) { MyObject myObject = (MyObject) ((DefaultMutableTreeNode) node).getUserObject(); if(myObject.getMyState()) target.appendJavascript(targetTheComponentWithAJavascriptMethod( + getId() + );); } Either that, or you could change the state of the userObject in the onNodeLinkClicked method and add it to the AjaxRequestTarget. Your AbstractBehaviour will then take care of visualizing the new state of the object for you :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Calls to MarkupCache#putIntoCache does not use the key provided by MarkupCacheKeyProvider
Hi, I have a virtualhosted CMS written in Wicket 1.3 where some of the pages are loaded from the database. This is done using a custom ResourceStreamLocator, configured in the Application#init method. This works good. Different users have different templates loaded for the same Wicket page, so I need to provide a custom cache key so that instance #2 doesn't get the template loaded for instance #1. Therefore I have overriden the MarkupCache class to be able to override the MarkupCacheKeyProvider. This also works, my CacheKeyProvider is consulted, but not always used for MarkupCache#putIntoCache(). Shouldn't the key returned from the CacheKeyProvider always be used when calling putIntoCache()? Here is my MarkupCache implementation: public class TornadoMarkupCache extends MarkupCache { private IMarkupCacheKeyProvider markupCacheKeyProvider; public TornadoMarkupCache(Application application) { super(application); } protected Markup putIntoCache(String locationString, Markup markup) { System.out.println(Putting + locationString + into cache); return super.putIntoCache(locationString, markup); } public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container) { if (container instanceof IMarkupCacheKeyProvider) { return (IMarkupCacheKeyProvider)container; } if (markupCacheKeyProvider == null) { markupCacheKeyProvider = new TornadoMarkupCacheKeyProvider(); } return markupCacheKeyProvider; } } And here is my CacheKeyProvider: public class TornadoMarkupCacheKeyProvider extends DefaultMarkupCacheKeyProvider { public String getCacheKey(MarkupContainer container, Class clazz) { String key = TornadoSession.get().getInstanceId() + / + super.getCacheKey(container, clazz); System.out.println(Setting key + key); return key; } } I typically see things like this: Setting key 1/no.sysedata.wicket.components.InfoPanelnohtml Putting file:/C:/Users/edvin/projects/tornado/target/classes/no/sysedata/wicket/components/InfoPanel.html into cache .. so it seems the CacheKeyProvider is consulted, but the key is not used for MarkupCache#putInfoCache() Can someone point me to what I'm missing? Thanks! -- Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calls to MarkupCache#putIntoCache does not use the key provided by MarkupCacheKeyProvider
Hi Johan, OK, so I need to override the LocationString to also include my unique prefix somehow? Where should I do that? -- Edvin Johan Compagner skrev: put into cache gets the LocationString not the markupCacheKey Because MarkupCache uses 2 maps CacheKey-LocationString LocationString-Markup so that we dont get multiply markup objects for the same markup file. (location) johan On Tue, Aug 26, 2008 at 11:28 AM, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I have a virtualhosted CMS written in Wicket 1.3 where some of the pages are loaded from the database. This is done using a custom ResourceStreamLocator, configured in the Application#init method. This works good. Different users have different templates loaded for the same Wicket page, so I need to provide a custom cache key so that instance #2 doesn't get the template loaded for instance #1. Therefore I have overriden the MarkupCache class to be able to override the MarkupCacheKeyProvider. This also works, my CacheKeyProvider is consulted, but not always used for MarkupCache#putIntoCache(). Shouldn't the key returned from the CacheKeyProvider always be used when calling putIntoCache()? Here is my MarkupCache implementation: public class TornadoMarkupCache extends MarkupCache { private IMarkupCacheKeyProvider markupCacheKeyProvider; public TornadoMarkupCache(Application application) { super(application); } protected Markup putIntoCache(String locationString, Markup markup) { System.out.println(Putting + locationString + into cache); return super.putIntoCache(locationString, markup); } public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container) { if (container instanceof IMarkupCacheKeyProvider) { return (IMarkupCacheKeyProvider)container; } if (markupCacheKeyProvider == null) { markupCacheKeyProvider = new TornadoMarkupCacheKeyProvider(); } return markupCacheKeyProvider; } } And here is my CacheKeyProvider: public class TornadoMarkupCacheKeyProvider extends DefaultMarkupCacheKeyProvider { public String getCacheKey(MarkupContainer container, Class clazz) { String key = TornadoSession.get().getInstanceId() + / + super.getCacheKey(container, clazz); System.out.println(Setting key + key); return key; } } I typically see things like this: Setting key 1/no.sysedata.wicket.components.InfoPanelnohtml Putting file:/C:/Users/edvin/projects/tornado/target/classes/no/sysedata/wicket/components/InfoPanel.html into cache .. so it seems the CacheKeyProvider is consulted, but the key is not used for MarkupCache#putInfoCache() Can someone point me to what I'm missing? Thanks! -- Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calls to MarkupCache#putIntoCache does not use the key provided by MarkupCacheKeyProvider
Hi again, Johan, I've found something disturbing: MarkupCache#onMarkupNotFound calls putIntoCache(cacheKey, Markup.NO_MARKUP), but putIntoCache has arguments (final String locationString, Markup markup). In my book that seems like the concepts of cacheKey and locationString are mixed. Is this really correct? protected Markup onMarkupNotFound(final String cacheKey, final MarkupContainer container) { if (log.isDebugEnabled()) { log.debug(Markup not found: + cacheKey); } // flag markup as non-existent return putIntoCache(cacheKey, Markup.NO_MARKUP); } protected Markup putIntoCache(final String locationString, Markup markup) { if (locationString != null) { if (markupCache.containsKey(locationString) == false) { markupCache.put(locationString, markup); } else { // We don't lock the cache while loading a markup. Thus it may // happen that the very same markup gets loaded twice (the first // markup being loaded, but not yet in the cache, and another // request requesting the very same markup). Since markup // loading in avg takes less than 100ms, it is not really an // issue. For consistency reasons however, we should always use // the markup loaded first which is why it gets returned. markup = (Markup)markupCache.get(locationString); } } return markup; } Johan Compagner skrev: put into cache gets the LocationString not the markupCacheKey Because MarkupCache uses 2 maps CacheKey-LocationString LocationString-Markup so that we dont get multiply markup objects for the same markup file. (location) johan On Tue, Aug 26, 2008 at 11:28 AM, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I have a virtualhosted CMS written in Wicket 1.3 where some of the pages are loaded from the database. This is done using a custom ResourceStreamLocator, configured in the Application#init method. This works good. Different users have different templates loaded for the same Wicket page, so I need to provide a custom cache key so that instance #2 doesn't get the template loaded for instance #1. Therefore I have overriden the MarkupCache class to be able to override the MarkupCacheKeyProvider. This also works, my CacheKeyProvider is consulted, but not always used for MarkupCache#putIntoCache(). Shouldn't the key returned from the CacheKeyProvider always be used when calling putIntoCache()? Here is my MarkupCache implementation: public class TornadoMarkupCache extends MarkupCache { private IMarkupCacheKeyProvider markupCacheKeyProvider; public TornadoMarkupCache(Application application) { super(application); } protected Markup putIntoCache(String locationString, Markup markup) { System.out.println(Putting + locationString + into cache); return super.putIntoCache(locationString, markup); } public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container) { if (container instanceof IMarkupCacheKeyProvider) { return (IMarkupCacheKeyProvider)container; } if (markupCacheKeyProvider == null) { markupCacheKeyProvider = new TornadoMarkupCacheKeyProvider(); } return markupCacheKeyProvider; } } And here is my CacheKeyProvider: public class TornadoMarkupCacheKeyProvider extends DefaultMarkupCacheKeyProvider { public String getCacheKey(MarkupContainer container, Class clazz) { String key = TornadoSession.get().getInstanceId() + / + super.getCacheKey(container, clazz); System.out.println(Setting key + key); return key; } } I typically see things like this: Setting key 1/no.sysedata.wicket.components.InfoPanelnohtml Putting file:/C:/Users/edvin/projects/tornado/target/classes/no/sysedata/wicket/components/InfoPanel.html into cache .. so it seems the CacheKeyProvider is consulted, but the key is not used for MarkupCache#putInfoCache() Can someone point me to what I'm missing? Thanks! -- Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calls to MarkupCache#putIntoCache does not use the key provided by MarkupCacheKeyProvider
Johan Compagner skrev: the locationString comes from the markup If that is not given by the markup stream it will fallback to the cache key Aha. OK, that makes sense :) The database-backed page is a basepage extended by other pages, so let's say DbPage is loaded from a database, but MyPage which extends DbPage is always the same (from the filesystem). DbPage will get the instanceid/ prefix for the cachekey, as it has no locationString, but MyPage will be cached using the file-location-string. Since MyPage is supposed to show different content depending on the markup of BasePage, I guess I can't put that in the cache at all then? -- Edvin and it would be very strange in my eyes if 1 stream (the same) has multiply locations at least the default MarkupStreams (based on files) johan On Tue, Aug 26, 2008 at 11:53 AM, Edvin Syse [EMAIL PROTECTED] wrote: Hi Johan, OK, so I need to override the LocationString to also include my unique prefix somehow? Where should I do that? -- Edvin Johan Compagner skrev: put into cache gets the LocationString not the markupCacheKey Because MarkupCache uses 2 maps CacheKey-LocationString LocationString-Markup so that we dont get multiply markup objects for the same markup file. (location) johan On Tue, Aug 26, 2008 at 11:28 AM, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I have a virtualhosted CMS written in Wicket 1.3 where some of the pages are loaded from the database. This is done using a custom ResourceStreamLocator, configured in the Application#init method. This works good. Different users have different templates loaded for the same Wicket page, so I need to provide a custom cache key so that instance #2 doesn't get the template loaded for instance #1. Therefore I have overriden the MarkupCache class to be able to override the MarkupCacheKeyProvider. This also works, my CacheKeyProvider is consulted, but not always used for MarkupCache#putIntoCache(). Shouldn't the key returned from the CacheKeyProvider always be used when calling putIntoCache()? Here is my MarkupCache implementation: public class TornadoMarkupCache extends MarkupCache { private IMarkupCacheKeyProvider markupCacheKeyProvider; public TornadoMarkupCache(Application application) { super(application); } protected Markup putIntoCache(String locationString, Markup markup) { System.out.println(Putting + locationString + into cache); return super.putIntoCache(locationString, markup); } public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container) { if (container instanceof IMarkupCacheKeyProvider) { return (IMarkupCacheKeyProvider)container; } if (markupCacheKeyProvider == null) { markupCacheKeyProvider = new TornadoMarkupCacheKeyProvider(); } return markupCacheKeyProvider; } } And here is my CacheKeyProvider: public class TornadoMarkupCacheKeyProvider extends DefaultMarkupCacheKeyProvider { public String getCacheKey(MarkupContainer container, Class clazz) { String key = TornadoSession.get().getInstanceId() + / + super.getCacheKey(container, clazz); System.out.println(Setting key + key); return key; } } I typically see things like this: Setting key 1/no.sysedata.wicket.components.InfoPanelnohtml Putting file:/C:/Users/edvin/projects/tornado/target/classes/no/sysedata/wicket/components/InfoPanel.html into cache .. so it seems the CacheKeyProvider is consulted, but the key is not used for MarkupCache#putInfoCache() Can someone point me to what I'm missing? Thanks! -- Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Change style of TreeNode
Kai Schubert-Altmann skrev: Hi everybody, I have some question regarding my existing wicket tree: 1. How can I change the style or css class of one or more TreeNodes? If you override the populateTreeItem() method, you can add an AbstractBehaviour to the item and override the onComponentTag method. From there you can do tag.put(class, yourValue). 2. How can I specify custom icons for some nodes? Override the getNodeIcon() method of the tree. 3. How can i change the name, that will be shown in the tree, without changing the name of the userObject? I guess the simple solution would be to provide a toString() method on your userObject that returns the desired value :) Alternatively you could override the renderNode method of the Tree, which by default does: protected String renderNode(TreeNode node) { return node.toString(); } Just get your userObject from the node and return the string you want from there :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getForm() on a component inside 2nd level Fragment returns null?
Please post the Java-code. -- Edvin Ritesh Trivedi skrev: Hi, I have a Page which contains Fragment (A) and which in turn contains Fragment (B). Fragment B has a button. In Fragment B class if I do button.getForm() I get null. I also tried button.getParent().getParent() which should be a form - but it returns null as well. Here is the markup body wicket:extend div class=subColumnHolder div wicket:id=feedbackPanel/div div wicket:id=viewCartContainer[Cart Contents here]/div /div wicket:fragment wicket:id=cartContentsFragment h2Your Shopping Cart/h2 pPlease review your shopping cart and press checkout to proceed with your order/p form wicket:id=cartForm div class=actionButtons wicket:id=cartHeaderToolbar/div -Fragment cartActionToolbar /form /wicket:fragment wicket:fragment wicket:id=cartActionToolbar input wicket:id=checkoutButton type=submit value=Checkout lt;lt; class=button floatRight/ /wicket:fragment I have corresponding java code to add components properly - can post if needed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getForm() on a component inside 2nd level Fragment returns null?
Your CartActionToolbar#markupProvider is infact your form, so you can do ((Form)markupProvider).setDefaultButton(checkoutButton), or you could make the cartForm a private field in ViewCartPage and just access it with cartForm.setDefaultButton(checkoutButton). For the first approach you'll need to assign the markupProvider to a private field in CartActionToolbar, or make markupProvider final in the constructor. Does that help? -- Edvin Ritesh Trivedi skrev: public class ViewCartPage { // Add feedback panel add(new FeedbackPanel(feedbackPanel, new ComponentFeedbackMessageFilter(ViewCartPage.this))); ShoppingCart cart = ShoppingCartWorkerEx.getShoppingCart(); int cartSize = cart.size(); if (cartSize == 0) add(new Label(viewCartContainer, new ResourceModel(Cart.empty.label, Your Shopping Cart is empty))); else add(new CartDetailsFragment(viewCartContainer, cartDetailsFragment, this)); } public class CartDetailsFragment extends Fragment { public static final long serialVersionUID = 1L; private ListCartItemVo _cartItemVoList = FastList.CartItemVo newInstance(); public CartDetailsFragment(String id, String fragmentId, MarkupContainer markupProvider) { super(id, fragmentId, markupProvider); populate(); } private void populate() { _cartItemVoList = ShoppingCartWorkerEx.getCartItemVoListFromSession(); Form cartForm = new Form(cartForm, new Model(new ViewCartWrapperModelObject(new ShippingOptionByCriteria( null, null), _cartItemVoList))); add(cartForm); // Cart Header Toolbar cartForm.add(new CartActionToolbar(cartHeaderToolbar, cartActionToolbar, ViewCartPage.this, cartForm)); .. } // end cart detail fragment private class CartActionToolbar extends Fragment { public CartActionToolbar(String id, String markupId, MarkupContainer markupProvider) { super(id, markupId, markupProvider); populate(); } public void populate() { // Checkout button Button checkoutButton = new Button(checkoutButton, new ResourceModel(CartForm.checkoutButton)) { public static final long serialVersionUID = 1L; @Override public void onSubmit() { ... setResponsePage(CheckoutPage.class); } }; add(checkoutButton); LOG.info( Checkout button parent + checkoutButton.getParent() + grand parent + checkoutButton.getParent().getParent() + getForm() + checkoutButton.getForm() + path + checkoutButton.getPath()); checkoutButton.getForm().setDefaultButton(checkoutButton); Edvin Syse wrote: Please post the Java-code. -- Edvin Ritesh Trivedi skrev: Hi, I have a Page which contains Fragment (A) and which in turn contains Fragment (B). Fragment B has a button. In Fragment B class if I do button.getForm() I get null. I also tried button.getParent().getParent() which should be a form - but it returns null as well. Here is the markup body wicket:extend div class=subColumnHolder div wicket:id=feedbackPanel/div div wicket:id=viewCartContainer[Cart Contents here]/div /div wicket:fragment wicket:id=cartContentsFragment h2Your Shopping Cart/h2 pPlease review your shopping cart and press checkout to proceed with your order/p form wicket:id=cartForm div class=actionButtons wicket:id=cartHeaderToolbar/div -Fragment cartActionToolbar /form /wicket:fragment wicket:fragment wicket:id=cartActionToolbar input wicket:id=checkoutButton type=submit value=Checkout lt;lt; class=button floatRight/ /wicket:fragment I have corresponding java code to add components properly - can post if needed. - 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: AJAXIFY Palette: Can't get to the Recorder
Thanks! Will you update the javadoc as well? -- Edvin Den 28. juli. 2008 kl. 16.37 skrev Igor Vaynberg [EMAIL PROTECTED] : override newrecorder() { recorder r=super.newrecorder(); r.add(new whateverbehavior()); return r; } -igor On Mon, Jul 28, 2008 at 12:33 AM, Edvin Syse [EMAIL PROTECTED] wrote: The javadocs for the Palette says to add AjaxFormComponentUpdatingBehaviour to the Recorder like this: Form form=new Form(...); Palette palette=new Palette(...); palette.getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior(onchange) {...}); getRecorderComponent() is null, because it isn't populated in the Palette's constructor, it is populated in the private initFactories() method, which is called from onBeforeRender. How am I supposed to get to the Recorder-component from the constructor of my pageclass? :) -- Edvin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AJAXIFY Palette: Can't get to the Recorder
The javadocs for the Palette says to add AjaxFormComponentUpdatingBehaviour to the Recorder like this: Form form=new Form(...); Palette palette=new Palette(...); palette.getRecorderComponent().add(new AjaxFormComponentUpdatingBehavior(onchange) {...}); getRecorderComponent() is null, because it isn't populated in the Palette's constructor, it is populated in the private initFactories() method, which is called from onBeforeRender. How am I supposed to get to the Recorder-component from the constructor of my pageclass? :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Why isn't the bookmarkable url kept when appending ?wicket:interface=:n:myPage::ILinkListener:: etc?
When using a bookmarkable page and altering the state of the page so that the url is rewritten to ?wicket:interface=:n:myPage::ILinkListener:: etc, why is the basepath / instead of the bookmarkable page's path? If someone bookmarks a stateful page, they will be redirected to the homepage if they use the bookmark later. With the mentioned approach, they could atleast be taken to the bookmarkable page, which would add tremendous value I think. Is there a good reason why this wasn't done? :) -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Why isn't the bookmarkable url kept when appending ?wicket:interface=:n:myPage::ILinkListener:: etc?
The client can't live with the url's created by HybridUrlEncodingStrategy. They are dead set on that arguments in the url should be appended with ?, not dot. Conventionally, dots does not denote arguments, and I must agree that he has a point. I think everyone would agree that keeping the bookmarkable part of the url adds value, so I must ask - is there a technical or otherwise good reason not to include it? As long as the current behaviour is the default for bookmarkable pages, it will degrade the user experience for everyone using it, and it seems this could be easily fixed.. -- Edvin Martijn Dashorst skrev: use HybridUrlEncodingStrategy to mount the page. Martijn On Tue, Jul 22, 2008 at 8:46 AM, Edvin Syse [EMAIL PROTECTED] wrote: When using a bookmarkable page and altering the state of the page so that the url is rewritten to ?wicket:interface=:n:myPage::ILinkListener:: etc, why is the basepath / instead of the bookmarkable page's path? If someone bookmarks a stateful page, they will be redirected to the homepage if they use the bookmark later. With the mentioned approach, they could atleast be taken to the bookmarkable page, which would add tremendous value I think. Is there a good reason why this wasn't done? :) -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Med vennlig hilsen Edvin Syse Programutvikler www.sysedata.no / [EMAIL PROTECTED] Tlf: 333 49700 / Faks: 333 49701 Adresse: Møllegaten 12, 3111 Tønsberg Syse Data AS -Profesjonelle IT-tjenester - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting ALL error messages for a component from AjaxFormComponentUpdatingBehavior#onError()
Hi, I've extended AjaxFormComponentUpdatingBehavior and try to get hold of all error messages in the onError() method. I've added two validators to the formcomponent, but it seems I can only get hold of the first one I added to the component. Spesifically if I do: textfield.add(EmailAddressValidator.getInstance()); textfield.add(PatternValidator.exactLength(5)); I would get the email address error, but If I switch the two lines, I get the pattern error. I try to retrieve the error messages like this: Session.get().getFeedbackMessages().messages(new ComponentFeedbackMessageFilter(getComponent())); .. but it only contains one error message. Can anyone shed some light on what I'm missing? :)) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use wicketstuff-rome
Could you show the pertinent parts of the generated HTML? There is nothing besides the correct link in the correct place that is needed :) -- Edvin Fabien D. skrev: Hi, The generated code contains the link, but nothing is displayed. I think it misses something in my WebApplication.class . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use wicketstuff-rome
Fabien D. wrote: I have something only in the head part : link rel=alternate type=application/rss+xml title=your feed title href=resources/org.apache.wicket.Application/myFeed / This seems correct. Are you sure your browser supports this? Try http://sd.tornado.no and see if you get the RSS-icon there. If you don't, it's your browser. I can't see that any other markup should interfere with this either, so I don't think this is a Wicket issue. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use wicketstuff-rome
Maybe I misunderstood you - you are talking about the RSS link/icon that's supposed to show in the addressbar of the browser, right? Your picture didn't include the addressbar.. -- Edvin Fabien D. skrev: I don't see icon ... Let see : http://www.nabble.com/file/p17509232/seeqd9.jpg If someone have an idea Thank you in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat discards content-type with StringRequestTarget
Sure I could, but since the StringRequestTarget constructor takes a content-type argument, I find it strange that this isn't sent to the browser. Sure enough, StringRequestTarget#respond, creates as StringBufferResourcesStream with the contentType field set correctly, but then it just copies the stream, and doesn't set any headers. Maybe this will work? RequestCycle.get().setRequestTarget(new StringRequestTarget(text/html, body) { public void respond(RequestCycle requestCycle) { requestCycle.getResponse().setContentType(text/html); super.respond(requestCycle); } }); -- Edvin richardwilko skrev: You could implement your own dynamic web resource. eg for a kml page on our site: public class KMLResource extends DynamicWebResource { Document kml; public KMLResource(Document kml) { this.kml = kml; } @Override protected ResourceState getResourceState() { final XMLOutputter out = new XMLOutputter(); KMLResourceState kmlResourceState = new KMLResourceState(); try { ByteArrayOutputStream byteout = new ByteArrayOutputStream(); out.output(kml, byteout); kmlResourceState.setData(byteout.toByteArray()); byteout.close(); } catch (IOException e) { e.printStackTrace(); } return kmlResourceState; } class KMLResourceState extends ResourceState { @Override public String getContentType() { return application/vnd.google-earth.kml+xml; } private byte[] data = new byte[0]; @Override public byte[] getData() { return data; } public void setData(byte[] data) { this.data = data; } @Override public int getLength() { return data.length; } } } then use it like this in your page final KMLResource kmlResource = new KMLResource(kml); getRequestCycle().setRequestTarget(new IRequestTarget() { public void detach(RequestCycle requestCycle) { } public void respond(RequestCycle requestCycle) { ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(kmlResource.getResourceStream()); target.setFileName(name); getRequestCycle().setRequestTarget(target); } }); just alter it for text rather than a Document - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wicket and inline JavaScript
Hi, I have a webdesigner who keeps harassing me with the way Wicket does JavaScript, attaching behaviour to onclick events etc. instead of doing it the jquery way of picking up the components and attaching the events afterwards, thus keeping all the nasty bits away from the actual markup. Ofcourse the code looks a lot cleaner the jquery way, and he tells me that debugging and working with the code is also much easier. Personally I don't know enough about html/javascript to decide what's the better approach, but I just wanted to know if there are any plans to rework this in Wicket, or if the current approach is just as good? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat discards content-type with StringRequestTarget
Update: overriding respond and setting the contentType directly works great :) -- Edvin Edvin Syse skrev: Sure I could, but since the StringRequestTarget constructor takes a content-type argument, I find it strange that this isn't sent to the browser. Sure enough, StringRequestTarget#respond, creates as StringBufferResourcesStream with the contentType field set correctly, but then it just copies the stream, and doesn't set any headers. Maybe this will work? RequestCycle.get().setRequestTarget(new StringRequestTarget(text/html, body) { public void respond(RequestCycle requestCycle) { requestCycle.getResponse().setContentType(text/html); super.respond(requestCycle); } }); -- Edvin richardwilko skrev: You could implement your own dynamic web resource. eg for a kml page on our site: public class KMLResource extends DynamicWebResource { Document kml; public KMLResource(Document kml) { this.kml = kml; } @Override protected ResourceState getResourceState() { final XMLOutputter out = new XMLOutputter(); KMLResourceState kmlResourceState = new KMLResourceState(); try { ByteArrayOutputStream byteout = new ByteArrayOutputStream(); out.output(kml, byteout); kmlResourceState.setData(byteout.toByteArray()); byteout.close(); } catch (IOException e) { e.printStackTrace(); } return kmlResourceState; } class KMLResourceState extends ResourceState { @Override public String getContentType() { return application/vnd.google-earth.kml+xml; } private byte[] data = new byte[0]; @Override public byte[] getData() { return data; } public void setData(byte[] data) { this.data = data; } @Override public int getLength() { return data.length; } } } then use it like this in your page final KMLResource kmlResource = new KMLResource(kml); getRequestCycle().setRequestTarget(new IRequestTarget() { public void detach(RequestCycle requestCycle) { } public void respond(RequestCycle requestCycle) { ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(kmlResource.getResourceStream()); target.setFileName(name); getRequestCycle().setRequestTarget(target); } }); just alter it for text rather than a Document - 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 and inline JavaScript
Hi Ned, thanks for your reply. I agree with your point of view. Today, however, we got bitten because the designer wanted to change all buttons by hiding them with jquery, and adding an anchor right after it in the dom-tree, so he could style them the way he wanted it (not possible with buttons he tells me). You can see his lovely button on this page: http://sd.tornado.no/domorder/search/query/testdomain The way he then triggered the submit buttons is with the following Jquery code: $('.btn.submit').click(function(){ $(this).prev().click(); }); This works most of the times, but sometimes, when the wicket ajax stuff includes references to 'this', the approach doesn't work, and wicket tells me that the ajax request was stopped 'because of precondition'. That's when he started bitching about the Wicket way of inlining JavaScript, so I thought I'd be nice to hear some opinions :)) -- Edvin Ned Collyer skrev: Hi Edvin, I am an advocate of JQuery :). I even won their icon design contest, and I've been using it for years! I think it should be used in all projects that require effects or cool DOM manipulation. I love the unobtrusive way and xhtml strict! That being said, when it comes to wicket AJAX - just use the wicket ajax and be done with it. No point mucking with something thats already excellent. It works and its easy. Why reimplement that bit - and potentially open up bugs that you need to go debug. For effects and DOM manipulation, you can use JQuery by adding header contributors. It is cleaner.. and in many instances easier to debug. It makes development quick and painless. If it wasn't wicket - id suggest using JQuery for ajax. Edvin Syse wrote: Hi, I have a webdesigner who keeps harassing me with the way Wicket does JavaScript, attaching behaviour to onclick events etc. instead of doing it the jquery way of picking up the components and attaching the events afterwards, thus keeping all the nasty bits away from the actual markup. Ofcourse the code looks a lot cleaner the jquery way, and he tells me that debugging and working with the code is also much easier. Personally I don't know enough about html/javascript to decide what's the better approach, but I just wanted to know if there are any plans to rework this in Wicket, or if the current approach is just as good? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Annoying enclosure bug introduced in Wicket 1.3.3
Confirmed :) It works with 1.3-SNAPSHOT -- Edvin Igor Vaynberg skrev: already fixed in trunk afair -igor On Tue, May 20, 2008 at 3:14 PM, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I think this is my third bug found in the enclosure system :) Simple quickstart: HomePage.java: public class HomePage extends WebPage { Boolean show = true; public HomePage() { add(new RadioChoice(show, new PropertyModel(this, show), Arrays.asList(true, false)) { protected boolean wantOnSelectionChangedNotifications() { return true; } }); add(new TextField(textfield) { public boolean isVisible() { return show; } }); } public Boolean getShow() { return show; } public void setShow(Boolean show) { this.show = show; } } HomePage.html: html head titleEnclosure headache/title /head body Show: div wicket:id=show/divbr/ wicket:enclosure child=textfield Text: input type=text wicket:id=textfield /wicket:enclosure /body /html - Click the radiobutton for false, and the text field disappears. - Click the radiobutton for true, and the text field stays hidden - Try changing your pom to wicket 1.3.2, and this works as it should, the textfield is hidden on show=false, and reappears on show=true. - If you remove the enclosure, things also work as they should. I can create a JIRA issue ofcourse, but it would be nice of someone can confirm it's a bug? It might be easy to spot, by browsing the svn changes made to the pertinent files between 1.3.2 and 1.3.3 :) -- Edvin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat discards content-type with StringRequestTarget
Hi, I use Freemarker to generate a HTML-file and spit it out to the browser like this: RequestCycle.get().setRequestTarget(new StringRequestTarget(text/html, body)); With Jetty, it works great, but in Tomcat, the result is rendered as text/plain, which I think is the default mime type for Tomcat. My output starts like this: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=UTF-8/ ... Can anyone think of a solution to this? Thanks, Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Annoying enclosure bug introduced in Wicket 1.3.3
Hi, I think this is my third bug found in the enclosure system :) Simple quickstart: HomePage.java: public class HomePage extends WebPage { Boolean show = true; public HomePage() { add(new RadioChoice(show, new PropertyModel(this, show), Arrays.asList(true, false)) { protected boolean wantOnSelectionChangedNotifications() { return true; } }); add(new TextField(textfield) { public boolean isVisible() { return show; } }); } public Boolean getShow() { return show; } public void setShow(Boolean show) { this.show = show; } } HomePage.html: html head titleEnclosure headache/title /head body Show: div wicket:id=show/divbr/ wicket:enclosure child=textfield Text: input type=text wicket:id=textfield /wicket:enclosure /body /html - Click the radiobutton for false, and the text field disappears. - Click the radiobutton for true, and the text field stays hidden - Try changing your pom to wicket 1.3.2, and this works as it should, the textfield is hidden on show=false, and reappears on show=true. - If you remove the enclosure, things also work as they should. I can create a JIRA issue ofcourse, but it would be nice of someone can confirm it's a bug? It might be easy to spot, by browsing the svn changes made to the pertinent files between 1.3.2 and 1.3.3 :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Immediate redirect from session
Johan Compagner wrote: Doing this stuff in the session constructor is really the wrong place, then still the normal request processing will happen. Something like this should be done in RequestCycle.onBeginRequest() and then throw a RestartResponseException() instead of just setting a request target. Johan OK. By mistake I didn't see your answer, and I just tried with Martijn's RedirectToExternalException and it worked :) I'll try to understand more of the low level processes of Wicket so I don't put code in strange places anymore :) hehe Thanks! Edvin Syse wrote: On 4/28/08, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I have a CMS-system that under some circumstances should do an immediate redirect when the session is created. I try with the following code in MySession's constructor: String host = ((ServletWebRequest) request).getHttpServletRequest().getHeader(host); Instance instance = instanceDao.findByHostname(host); if(!Strings.isEmpty(instance.getHost().getRedirectToHost())) { String redirectUrl = instance.getHost().getRedirectToHost(); if(instance.getHost().getKeepParamsOnRedirect()) redirectUrl = redirectUrl + / + request.getPath(); RequestCycle.get().setRedirect(true); RequestCycle.get().setRequestTarget(new RedirectRequestTarget(redirectUrl)); return; } After this is run, I would like Wicket to just do the redirect, but instead it goes through the authorizationStrategy and returns the page that my RequestCycleProcessor picks out. Is there a way to do an _immediate_ redirect, or discard the page that my RequestCycleProcessor has already picked out? -- Edvin - 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] -- View this message in context: http://www.nabble.com/Immediate-redirect-from-session-tp16946073p17099661.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]
Immediate redirect from session
Hi, I have a CMS-system that under some circumstances should do an immediate redirect when the session is created. I try with the following code in MySession's constructor: String host = ((ServletWebRequest) request).getHttpServletRequest().getHeader(host); Instance instance = instanceDao.findByHostname(host); if(!Strings.isEmpty(instance.getHost().getRedirectToHost())) { String redirectUrl = instance.getHost().getRedirectToHost(); if(instance.getHost().getKeepParamsOnRedirect()) redirectUrl = redirectUrl + / + request.getPath(); RequestCycle.get().setRedirect(true); RequestCycle.get().setRequestTarget(new RedirectRequestTarget(redirectUrl)); return; } After this is run, I would like Wicket to just do the redirect, but instead it goes through the authorizationStrategy and returns the page that my RequestCycleProcessor picks out. Is there a way to do an _immediate_ redirect, or discard the page that my RequestCycleProcessor has already picked out? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ListView and Threading
Hi, I've created a domain search panel for Wicket. It consists of a ListView that lists all the TLD's, and a checkbox so you can order if the domain is available. To make it a bit fancy, I iterate over the list after construction, and set a TldChecker to work on each tld. Basically, it performs a whois search, and sets some boolean values on the tld after it's finished. Then I have a AbstractAjaxTimerBehavior running every 500 milliseconds that adds any tld that has finished the whois-search to the AjaxRequestTarget. This works most of the times, but on some occations, Wicket will complain about a mismatch in the hierachy. That's obviously not the case, so I suspect the threading causes some kind of strange situation. The pertinent code: /* The list */ final ListTld tlds = Collections.synchronizedList(getTlds()); /* A basic executor to spin off the threads */ Executor e = new Executor() { public void execute(Runnable command) { new Thread(command).start(); } }; /* Iterate over the tlds and instantiate a TldChecker */ for(Tld tld : tlds) e.execute(new TldChecker(tld, query)); // Args could be for instance com, and mydomain /* The ListView - simplified */ results = new ListView(results, tlds) { protected void populateItem(ListItem item) { final Tld tld = (Tld) item.getModelObject(); item.setOutputMarkupId(true); /* Link to show who owns the domain if it's taken */ item.add(new Link(taken) { public boolean isVisible() { return tld.getDone() !tld.getAvailable() !tld.getIllegal(); } public void onClick() { setResponsePage(new WhoisPage(query)); } }.setPopupSettings(new PopupSettings())); /* Checkbox so it can be ordered */ item.add(new CheckBox(selected, new PropertyModel(tld, selected)) { public boolean isVisible() { return (tld.getDone() tld.getAvailable()); } }); /* Some other fields, showing spinner while !tld.getDone() etc */ } } /* The timer - it stops when all the TldChekers are finished. 'Published' means it has been added to the request target */ add(new AbstractAjaxTimerBehavior(Duration.milliseconds(500)) { protected void onTimer(AjaxRequestTarget target) { int running = 0; synchronized (tlds) { for(int i = 0; i tlds.size(); i++) { Tld tld = tlds.get(i); if(!tld.getDone()) running++; if(tld.getDone() !tld.getPublished()) { Component theTr = results.get(String.valueOf(i)); target.addComponent(theTr); target.appendJavascript(fadein(' + theTr.getMarkupId() +');); // JQuery Magick, has nothing to do with the problem, tried to remove it tld.setPublished(true); } } } if(running == 0) stop(); } }); /* The HTML for the ListView */ tr wicket:id=results td class=domainspan wicket:id=domainDomain/span/td td input type=checkbox wicket:id=selected/ a class=taken wicket:id=takentaken/a !-- Some more markup, removed for brevity, like this one: span class=searching wicket:id=searchingsearching/span -- /td /tr Wicket will complain about the checkbox with wicket:id selected. If I remove the isVisible() method, it never fails: public boolean isVisible() { return (tld.getDone() tld.getAvailable()); } What might I be doing wrong? Any idea? :)) Here's Wicket's complaint at the time of the error: 13:13:39,186 ERROR [RequestCycle] [btpool0-1 - /?wicket:interface=:5:searchInputPanel:searchInputForm::IFormSubmitListener::] The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = selected, page = no.tornado.web.modules.domorder.DomainSearchPage, path = 6:searchResultPanel:f:results:0:selected.DomainSearchResultPanel$3$2, isVisible = true, isVersioned = false]] org.apache.wicket.WicketRuntimeException: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in
Re: ListView and Threading
lars vonk wrote: Hi, How is the done and available flag set in the Tld class by the TldChecker? Since you are using a separate Thread that sets these flags : /* Iterate over the tlds and instantiate a TldChecker */ for(Tld tld : tlds) e.execute(new TldChecker(tld, query)); // Args could be for instance com, and mydomain The iteraton is called with synchronized(tlds) { ... } around, but maybe that's not enough? Should I wrap all calls to setXXX in TldChecker with a synchronized, or even put synchronized directly on the getters/setters of Tld? Another thing is, (I am not sure about this) is that if the Checkbox.isVisible method returns false wouldn't Wicket always complain since there is HTML markup but no corresponding Java component? When you do setVisible(false) on a component, the corresponding markup will be hidden. That's the beauty of it. I know that getVisible() might be called multiple times during a page-render, so I'm beginning to think that maybe it returns false on the call that decides wether to include the markup, and then true later on, creating the mismatch in hiearachy. Does this sound plausible? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView and Threading
Yes, if you want to have an invisible component made visible again via AJAX you have to call setOutputMarkupPlaceholderTag(true) on it, or wrap it in a WebMarkupContainer that is always visible and refresh the container. The component was never fully rendered or returned via AJAX without being visible. But since tld.setPublished() was set in the current Thread, and the other booleans were set in the thread of the TldChecker, I guess that's what causing it. It seems that it acually helped to include getPublished() in the isVisible() like this: public boolean isVisible() { return tld.getPublished() tld.getDone() tld.getAvailable(); } I guess it is not water proof like this, so I'll include the setOutputMarkupPleaceholderTag(true) as well. Thank's a lot! -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Internationalized error() from Page constructor
Sometimes, I want to redirect to another page with an error message because of something I discover when the constructor runs. I would like to do: if(some_condition) { Session.get().error(errmsg); setResponsePage(PageClass.class); return; } The problem is that Session#error() doesn't take a resource-key, only the final text. In the constructor it might be too early to determine the language etc. What's the Wicket way around this one? :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PropertyModel of textfield not being updated
I don't see you post anything here that would indicate that you're updating the model with data from the view.. What about saveButton and the form, can you supply that code as well? -- Edvin Michael Mehrle skrev: Sure: saveButton.add(ajaxSaveBehavior = new AjaxEventBehavior(JavaScriptUtil.CLICK) { @Override protected void onEvent(AjaxRequestTarget target) { modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { ... fooTextField.setOutputMarkupId(true); target.addComponent(fooTextField); modalWindow.close(target); } }); When I step in there with my debugger it seems that the frequency field in eventSchedule (which is the texfield's bean), still is set to the default value. Meaning, the textfield doesn't receive the input. When I just add 'eventSchedule.setFrequency(10)' for instance - the 10 does show up when I pop up the modal again. So, the link between the model and the textfield is clearly working, but the model is not being updated when typing into the textfield. Michael -Original Message- From: Edvin Syse [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 12:14 PM To: users@wicket.apache.org Subject: Re: PropertyModel of textfield not being updated What exactly are you doing via Ajax? Can you show some code? :) -- Edvin Michael Mehrle skrev: I got a textfield: add(fooTextField = new TextField(foo, new PropertyModel(eventSchedule, foo), Integer.class)); eventSchedule is a bean that has a foo field which is an integer. For some reason it's never being updated, although the field picks it up when I programmatically call eventSchedule.setFoo(). I'm using this with AJAX and have all my component ids set and the textfield added to the target. Any ideas? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView and Threading
Hi Lars, Thank you for the great explanation. I'll read up on Threading and get this one right :)) -- Edvin lars vonk skrev: The iteraton is called with synchronized(tlds) { ... } around, but maybe that's not enough? Should I wrap all calls to setXXX in TldChecker with a synchronized, or even put synchronized directly on the getters/setters of Tld? It is important that the read and write operation synchronize on the same lock. As I understand it the write of the done and available flag are in the TldChecker class which aren't locked by the same lock (the lock on tlds) you put around the iteration. This is because another thread is the executing of the code of the TldChecker (that is done via the Executor, if I understand your code correctly). So in order to make sure your write of the done and available flag are seen by other threads you can do two things: 1. Let the different Threads synchronize on the same lock. The simplest way is to make the setXXX and isXXX methods synchronized as you describe. 2. Declare the done and available properties as volatile. In my recollection this is the only way that, according to the JMM, guarantees visibility in other Threads. Another thing is that your populateItem method contains more probable concurrency issues: It can happen that during the populateItem method the current Tld is under process. That would cause some strange behavior: For instance: /* Link to show who owns the domain if it's taken */ item.add(new Link(taken) { public boolean isVisible() { return tld.getDone() !tld.getAvailable() !tld.getIllegal(); } If the above code executes while in another Thread the TldChecker is currently processing the same tl, then at this point it can happen that the tld.getDone() returns false, as the TldChecker is not done yet. But then when adding the CheckBox like below: /* Checkbox so it can be ordered */ item.add(new CheckBox(selected, new PropertyModel(tld, selected)) { public boolean isVisible() { return (tld.getDone() tld.getAvailable()); } }); The tld.getDone() can return true as it can happen that the TldChecker just finished up with the Tld. So there is an inconsistency between the CheckBox and the Link. I don't know the requirements of your application so I can't see if this is bad or not. A way to prevent this is to make sure that populateItem has the exclusive lock for the Tld it is currently processing, so synchronize on the tld that is in the item.getModelObject() AND make sure the TldChecker also synchronizes on the tld it is processing. The thing is that with these kind of Threading issues it can go right 100 times in a row and than it goes wrong for 10 times, or it may never go wrong. If you don't use correct locking you just don't get any guarantees from the JVM, only headaches :-). Lars On Mon, Apr 21, 2008 at 5:32 PM, Edvin Syse [EMAIL PROTECTED] wrote: lars vonk wrote: Hi, How is the done and available flag set in the Tld class by the TldChecker? Since you are using a separate Thread that sets these flags : /* Iterate over the tlds and instantiate a TldChecker */ for(Tld tld : tlds) e.execute(new TldChecker(tld, query)); // Args could be for instance com, and mydomain The iteraton is called with synchronized(tlds) { ... } around, but maybe that's not enough? Should I wrap all calls to setXXX in TldChecker with a synchronized, or even put synchronized directly on the getters/setters of Tld? Another thing is, (I am not sure about this) is that if the Checkbox.isVisible method returns false wouldn't Wicket always complain since there is HTML markup but no corresponding Java component? When you do setVisible(false) on a component, the corresponding markup will be hidden. That's the beauty of it. I know that getVisible() might be called multiple times during a page-render, so I'm beginning to think that maybe it returns false on the call that decides wether to include the markup, and then true later on, creating the mismatch in hiearachy. Does this sound plausible? -- Edvin - 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: Internationalized error() from Page constructor
Maurice Marrink wrote: String errorMessage =Application.get().getResourceSettings().getLocalizer().getString(key, someComponentOrNull,defaultMsg); Is this the correct way of doing it? I think it would be really nice if Session#error, info etc could take a resourceKey instead.. -- Edvin Maurice On Mon, Apr 21, 2008 at 9:46 PM, Enrique Rodriguez [EMAIL PROTECTED] wrote: I'm curious what's up here, too, since Pro Wicket Listing 6-15 shows the use of StringResourceModel with Component#info. However, when I tried that once, I simply got the Object#toString()-style output in my FeedbackPanel! Enrique On Mon, Apr 21, 2008 at 12:40 PM, Edvin Syse [EMAIL PROTECTED] wrote: Ryan Gravener wrote: I think you can do error((String)(new ResourceModel(page.error).getObject())) Nah.. besides beeing incredibly nasty, you just instantiate and unwrap it right away. Can't see how that will help? :) On Mon, Apr 21, 2008 at 3:11 PM, Edvin Syse [EMAIL PROTECTED] wrote: Sometimes, I want to redirect to another page with an error message because of something I discover when the constructor runs. I would like to do: if(some_condition) { Session.get().error(errmsg); setResponsePage(PageClass.class); return; } The problem is that Session#error() doesn't take a resource-key, only the final text. In the constructor it might be too early to determine the language etc. What's the Wicket way around this one? :) -- Edvin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PropertyModel of textfield not being updated
Strange, because it worked with updating the value of a radio that's tied to a model in that same bean. Are you sure you didn't override wantOnSelectionChangedNotifications() and that the new value you saw came from the onSelectionChanged() method or something? Or maybe you got the value from the component's getInput() method? I tried the AjaxFormSubmitBehavior but am getting the following AJAX error: Channel busy - postponing If you look in the AJAX debug window, I think you should be able to see what other ajax-event fired and didn't return yet. Maybe that can give you a hint. Also, I see that you do: fooTextField.setOutputMarkupId(true); target.addComponent(fooTextField); in your onClose() method. The setOutputMarkupId(true) is redundant - as it has to have been set already some other place in your code, or there will be no way for Wicket to know what component to rerender in the markup, and you would have gotten an error. I mention it, because I think you might have misunderstood some parts of the process. -- Edvin This was the same error I was getting when using the AjaxButton's default onSubmit() method. This is why I am using AjaxEventBehavior, which seems to be the only one that actually triggers the event. Is there another way to submit my form? So, I'm a bit in a bind here - btw, this happens both in Safari and Firefox. Michael -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 1:10 PM To: users@wicket.apache.org Subject: Re: PropertyModel of textfield not being updated But if you don't send the new values using this button then how is wicket supposed to know there is a new value? Try using an AjaxFormSubmitBehavior instead of AjaxEventBehavior, it will submit the form for you. Maurice On Mon, Apr 21, 2008 at 9:58 PM, Michael Mehrle [EMAIL PROTECTED] wrote: Edvin - this is the save button's behavior. I'm using that instead of 'onSubmit()' because I needed to throttle the AJAX calls down a bit. Does that make sense? The entire form is way too long and complex to post it here. Michael -Original Message- From: Edvin Syse [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 12:43 PM To: users@wicket.apache.org Subject: Re: PropertyModel of textfield not being updated I don't see you post anything here that would indicate that you're updating the model with data from the view.. What about saveButton and the form, can you supply that code as well? -- Edvin Michael Mehrle skrev: Sure: saveButton.add(ajaxSaveBehavior = new AjaxEventBehavior(JavaScriptUtil.CLICK) { @Override protected void onEvent(AjaxRequestTarget target) { modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { ... fooTextField.setOutputMarkupId(true); target.addComponent(fooTextField); modalWindow.close(target); } }); When I step in there with my debugger it seems that the frequency field in eventSchedule (which is the texfield's bean), still is set to the default value. Meaning, the textfield doesn't receive the input. When I just add 'eventSchedule.setFrequency(10)' for instance - the 10 does show up when I pop up the modal again. So, the link between the model and the textfield is clearly working, but the model is not being updated when typing into the textfield. Michael -Original Message- From: Edvin Syse [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 12:14 PM To: users@wicket.apache.org Subject: Re: PropertyModel of textfield not being updated What exactly are you doing via Ajax? Can you show some code? :) -- Edvin Michael Mehrle skrev: I got a textfield: add(fooTextField = new TextField(foo, new PropertyModel(eventSchedule, foo), Integer.class)); eventSchedule is a bean that has a foo field which is an integer. For some reason it's never being updated, although the field picks it up when I programmatically call eventSchedule.setFoo(). I'm using this with AJAX and have all my component ids set and the textfield added to the target. Any ideas? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
No, it has not. Johan said he fixed a bug that might have been this problem, but I haven't been able to confirm it yet, as the fix is in 1.3-SNAPSHOT, and I ran into some issues when deploying with the snapshot-version. I see this problem 10-20 times every day still.. -- Edvin StephenP skrev: Has a JIRA issue been created to track this fix? Thanks, Stephen Yes, it seems to be an error in Wicket. Johan says it should be fixed it in the latest shapshot version, but I have not tried it yet. But I will probably keep the workaround code as an extra protection. Niels Anything new on this issue? /Gwyn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Applet parameter
Mathias P.W Nilsson wrote: Hi! How can I add dynamic parameters to my applet from wicket? param name=DocumentId value=292640/ The value needs to come from wicket. How can I add this? You can use a WebMarkupContainer for this. HTML: applet ... param wicket:id=documentId name=DocumentId/ /applet Java: add(new WebMarkupContainer(documentId).add(new SimpleAttributeModifier(value, yourValue))); -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Application Context
Pinger wrote: All the examples I see do something like WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( this.getServletContext()); how do I do the this.getServletContext() when I am not in the wicket file? Maybe you could implement ServletContextAware? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Application Context
.. or just implement ApplicationContextAware ofcourse :) -- Edvin Edvin Syse skrev: Pinger wrote: All the examples I see do something like WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( this.getServletContext()); how do I do the this.getServletContext() when I am not in the wicket file? Maybe you could implement ServletContextAware? -- Edvin - 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: Invoulentary session sharing/leakage in Wicket 1.3.x
Erik van Oosten wrote: Hi, Is there a jira issue in which the topic is tracked? No, not yet. I want to be sure that this is a wicket bug first. I have now confirmed that I get the same behaviour in 1.3.2, and I'm about to put on some more logging as suggested to try to give you guys more relevant info. I'll mail again when the logging is in place. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
I have now redeplyed with the following log4j ConversionPattern: %d{ABSOLUTE} %-5p [%c{1}] [%t] %m%n I've started saving the ip of the user that creates a new session, and then before returning the current mailuser from the session I do: public MailUser getCurrentMailuser() { String currentIp = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRemoteAddr(); if(currentIp.equals(ip)) return currentMailuser; log.error(Session.get().getId() + + Session.get().hashCode() + + currentIp + M: + currentMailuser != null ? currentMailuser.getUsername() : nomailuser); throw new RuntimeException(Invalid session M: + currentMailuser.getUsername() + + currentIp + / + ip); } Will this be enough to get a clearer picture? Tips on what else I can do to make it easier to debug? I'm not very familiar with log4j.. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
I think I have something... Look at the attached stacktrace. It seems I get an NPE on the line where I do: log.error(Session.get().getId() + + Session.get().hashCode() + + currentIp + C: + currentCustomer != null ? currentCustomer.getFullName() : nocustomer); I think that Session.get() returns null somehow.. That's not supposed to happen, is it? -- Edvin 16:54:20,902 ERROR [RequestCycle] [btpool0-9] org.mortbay.jetty.EofException org.apache.wicket.WicketRuntimeException: org.mortbay.jetty.EofException at org.apache.wicket.protocol.http.request.WebErrorCodeResponseTarget.respond(WebErrorCodeResponseTarget.java:96) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) Caused by: org.mortbay.jetty.EofException at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760) at org.mortbay.jetty.AbstractGenerator$Output.flush(AbstractGenerator.java:566) at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:910) at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:650) at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:577) at org.mortbay.util.ByteArrayISO8859Writer.writeTo(ByteArrayISO8859Writer.java:103) at org.mortbay.jetty.handler.ErrorHandler.handle(ErrorHandler.java:55) at org.mortbay.jetty.servlet.ErrorPageErrorHandler.handle(ErrorPageErrorHandler.java:117) at org.mortbay.jetty.Response.sendError(Response.java:274) at org.mortbay.jetty.Response.sendError(Response.java:340) at org.apache.wicket.protocol.http.request.WebErrorCodeResponseTarget.respond(WebErrorCodeResponseTarget.java:91) ... 24 more Caused by: java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcher.writev0(Native Method) at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:33) at sun.nio.ch.IOUtil.write(IOUtil.java:164) at sun.nio.ch.SocketChannelImpl.write0(SocketChannelImpl.java:365) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:388) at java.nio.channels.SocketChannel.write(SocketChannel.java:360) at org.mortbay.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:229) at org.mortbay.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:197) at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:682) ... 34 more 285154 [btpool0-9] ERROR org.mortbay.log - /undefined java.lang.IllegalStateException: STREAM at org.mortbay.jetty.Response.getWriter(Response.java:585) at org.apache.wicket.protocol.http.WebResponse.write(WebResponse.java:355) at org.apache.wicket.protocol.http.BufferedWebResponse.close(BufferedWebResponse.java:73) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:371) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at
Re: jQuery sortables
Has anyone had experience using jQuery's Sortables [1] with Wicket? These allow the user to reorder lists, even nested lists, by dropping and dragging them in the browser. The main interface back to Wicket would probably come in the serialize method, which returns a String representing the new ordering of the items in a Form-escaped format, probably best shown with an example. Try the DnDSortableHandler from wicketstuff-jquery. It gives you a nice method to override like this: public boolean onDnD(AjaxRequestTarget target, MarkupContainer srcContainer, int srcPos,MarkupContainer destContainer, int destPos); Quite easy to setup and use :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Matthew Young wrote: log.error(Session.get().getId() + + Session.get().hashCode() + + currentIp + C: + currentCustomer != null ? currentCustomer.getFullName() : nocustomer); You should put parent around ?:. The '+' op is evaluated before !=. Your statement is effectively this: Thanks, I found out earlier and have redeployed with parenthesis. I've also swapped out Session.get().getId()/hashCode() with just getId()/hashCode() since I'm IN the session when I'm doing this :) I would also like to submit some more code that might have something to do with the problem First up is my RequestCycleProcessor which I override in the Application#init method: @Override protected IRequestCycleProcessor newRequestCycleProcessor() { return new TornadoRequestCycleProcessor(); } The point of this is to mount pages directly on /. What it does is basically pass some url's (starting with css/gfx or js to a WebExternalResourceRequestTarget, or else sends the parameteres to a another page that will know how to get data from the database based on the parameteres and display the correct page. It's based on a tip from Igor a while back, so probably it's safe unless I managed to severely fuck it up :) I'll post another email with my custom UrlCodingStrategy as well. Here is the code: public class TornadoRequestCycleProcessor extends WebRequestCycleProcessor { @Override protected IRequestCodingStrategy newRequestCodingStrategy() { return new TornadoRequestCodingStrategy(); } private static class TornadoRequestCodingStrategy extends WebRequestCodingStrategy { private final TornadoUrlCodingStrategy strat = new TornadoUrlCodingStrategy(); @Override public IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String path) { IRequestTargetUrlCodingStrategy target = super.urlCodingStrategyForPath(path); if (target == null) { target = strat; } return target; } } private static class TornadoUrlCodingStrategy extends BookmarkablePageRequestTargetUrlCodingStrategy { public TornadoUrlCodingStrategy() { super(/, PageModule.class, null); } @Override public IRequestTarget decode(RequestParameters requestParameters) { String path = requestParameters.getPath(); if(path.startsWith(css) || path.startsWith(gfx) || path.startsWith(js)) return new WebExternalResourceRequestTarget(/ + requestParameters.getPath()); if(requestParameters.getParameters().size() 0) { StringBuilder args = new StringBuilder(?); Object[] keys = requestParameters.getParameters().keySet().toArray(); Object[] values = requestParameters.getParameters().values().toArray(); int size = requestParameters.getParameters().size(); for(int i = size-1; i -1; i--) { Object[] valueMap = (Object[]) values[i]; args.append(keys[i] + = + valueMap[0]); if(i 0) args.append(); } path = path + args.toString(); } return new BookmarkablePageRequestTarget(PageModule.class, new PageParameters(0= + path)); } } } -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Here goes the other one I think there might be a problem with, since it deals with PageMaps etc, and I'm not all that familiar with them. I didn't write much of this code, just changed what I needed to get it to work the way I wanted: /** * Url coding strategy for pages that encode number based * parameters without having the numbers in the url. * * The parameters are given on the form /param0-value/param1-value/ etc. and the * paramnames are 0, 1 etc. * * */ public class NumberedRequestTargetUrlCodingStrategy extends AbstractRequestTargetUrlCodingStrategy { /** bookmarkable page class. */ protected final WeakReference/* Class */bookmarkablePageClassRef; /** page map name. */ private final String pageMapName; public NumberedRequestTargetUrlCodingStrategy(final String mountPath, final Class bookmarkablePageClass, String pageMapName) { super(mountPath); if (bookmarkablePageClass == null) { throw new IllegalArgumentException( Argument bookmarkablePageClass must be not null); } this.bookmarkablePageClassRef = new WeakReference(bookmarkablePageClass); this.pageMapName = pageMapName; } /** * @see org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy#decode(org.apache.wicket.request.RequestParameters) */ public IRequestTarget decode(RequestParameters requestParameters) { final String parametersFragment = requestParameters.getPath() .substring(getMountPath().length()); final PageParameters parameters = new PageParameters(decodeParameters( parametersFragment, requestParameters.getParameters())); String pageMapName = (String) parameters .remove(WebRequestCodingStrategy.PAGEMAP); if (requestParameters.getPageMapName() == null) { requestParameters.setPageMapName(pageMapName); } else { pageMapName = requestParameters.getPageMapName(); } // do some extra work for checking whether this is a normal request to a // bookmarkable page, or a request to a stateless page (in which case a // wicket:interface parameter should be available final String interfaceParameter = (String) parameters .remove(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME); if (interfaceParameter != null) { WebRequestCodingStrategy.addInterfaceParameters(interfaceParameter, requestParameters); return new BookmarkableListenerInterfaceRequestTarget(pageMapName, (Class) bookmarkablePageClassRef.get(), parameters, requestParameters.getComponentPath(), requestParameters.getInterfaceName(), 1); } else { return new BookmarkablePageRequestTarget(pageMapName, (Class) bookmarkablePageClassRef.get(), parameters); } } /** * @see org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy#encode(org.apache.wicket.IRequestTarget) */ public final CharSequence encode(final IRequestTarget requestTarget) { if (!(requestTarget instanceof IBookmarkablePageRequestTarget)) { throw new IllegalArgumentException( This encoder can only be used with + instances of + IBookmarkablePageRequestTarget.class.getName()); } final AppendingStringBuffer url = new AppendingStringBuffer(40); url.append(getMountPath()); final IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget) requestTarget; PageParameters pageParameters = target.getPageParameters(); String pagemap = pageMapName != null ? pageMapName : target .getPageMapName(); if (pagemap != null) { if (pageParameters == null) { pageParameters = new PageParameters(); } pageParameters.put(WebRequestCodingStrategy.PAGEMAP, pagemap); } appendParameters(url, pageParameters); return url; } /** *
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
This wasn't it. I found out that IndexedParamUrlCodingStrategy did the same thing so I changed to that one and still get the error.. sigh... -- Edvin Edvin Syse skrev: Here goes the other one I think there might be a problem with, since it deals with PageMaps etc, and I'm not all that familiar with them. I didn't write much of this code, just changed what I needed to get it to work the way I wanted: /** * Url coding strategy for pages that encode number based * parameters without having the numbers in the url. * * The parameters are given on the form /param0-value/param1-value/ etc. and the * paramnames are 0, 1 etc. * * */ public class NumberedRequestTargetUrlCodingStrategy extends AbstractRequestTargetUrlCodingStrategy { /** bookmarkable page class. */ protected final WeakReference/* Class */bookmarkablePageClassRef; /** page map name. */ private final String pageMapName; public NumberedRequestTargetUrlCodingStrategy(final String mountPath, final Class bookmarkablePageClass, String pageMapName) { super(mountPath); if (bookmarkablePageClass == null) { throw new IllegalArgumentException( Argument bookmarkablePageClass must be not null); } this.bookmarkablePageClassRef = new WeakReference(bookmarkablePageClass); this.pageMapName = pageMapName; } /** * @see org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy#decode(org.apache.wicket.request.RequestParameters) */ public IRequestTarget decode(RequestParameters requestParameters) { final String parametersFragment = requestParameters.getPath() .substring(getMountPath().length()); final PageParameters parameters = new PageParameters(decodeParameters( parametersFragment, requestParameters.getParameters())); String pageMapName = (String) parameters .remove(WebRequestCodingStrategy.PAGEMAP); if (requestParameters.getPageMapName() == null) { requestParameters.setPageMapName(pageMapName); } else { pageMapName = requestParameters.getPageMapName(); } // do some extra work for checking whether this is a normal request to a // bookmarkable page, or a request to a stateless page (in which case a // wicket:interface parameter should be available final String interfaceParameter = (String) parameters .remove(WebRequestCodingStrategy.INTERFACE_PARAMETER_NAME); if (interfaceParameter != null) { WebRequestCodingStrategy.addInterfaceParameters(interfaceParameter, requestParameters); return new BookmarkableListenerInterfaceRequestTarget(pageMapName, (Class) bookmarkablePageClassRef.get(), parameters, requestParameters.getComponentPath(), requestParameters.getInterfaceName(), 1); } else { return new BookmarkablePageRequestTarget(pageMapName, (Class) bookmarkablePageClassRef.get(), parameters); } } /** * @see org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy#encode(org.apache.wicket.IRequestTarget) */ public final CharSequence encode(final IRequestTarget requestTarget) { if (!(requestTarget instanceof IBookmarkablePageRequestTarget)) { throw new IllegalArgumentException( This encoder can only be used with + instances of + IBookmarkablePageRequestTarget.class.getName()); } final AppendingStringBuffer url = new AppendingStringBuffer(40); url.append(getMountPath()); final IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget) requestTarget; PageParameters pageParameters = target.getPageParameters(); String pagemap = pageMapName != null ? pageMapName : target .getPageMapName(); if (pagemap != null) { if (pageParameters == null) { pageParameters = new PageParameters(); } pageParameters.put(WebRequestCodingStrategy.PAGEMAP, pagemap); } appendParameters(url, pageParameters); return url; } /** * @see org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy#matches(org.apache.wicket.IRequestTarget) */ public boolean matches(IRequestTarget requestTarget) { if (requestTarget instanceof IBookmarkablePageRequestTarget) { IBookmarkablePageRequestTarget target = (IBookmarkablePageRequestTarget) requestTarget; if (((Class) bookmarkablePageClassRef.get()).equals(target .getPageClass())) { if (this.pageMapName == null) { return true
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
The problem is still there and now it is getting serious for my business. Would any of the core committers be willing to look at my application? I'll pay USD 2500 as a onetime fee for looking at this.. (Or name your hour-price) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Invoulentary session sharing/leakage in Wicket 1.3.x
Today I deployed an application based on Wicket 1.3.3 that has close to 10.000 users. After a couple of hours we started getting reports from users saying that even upon requesting the login-page, they were already logged in as an arbitrary user. The users they were logged in as had previously performed a succesful login. It seems like the wicket-sessions bleed over between different http-sessions. I tried changing from HybridUrlCodingStrategy to mounting the pages with the normal mountBookmarkablePage() method, but the results are the same. I also tried downgrading to 1.3.2 with the same results. Can anyone think of a logical mistake I might have made? Sincerely, Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
is it really the wicket session or a page? I believe it's the session, but I'm not sure. The hijacker is able to navigate through all pages as the hijacked user.. And on the top of every page there is a logout button and text saying Logout username. I'm not running in a clustered environment, just plain Jetty 6.1.7 in setuid mode. I'm using the SecondLevelCacheSessionStore, but I'm thinking about trying with the HttpSessionStore now to see if it makes any difference. I refer to the session object with a static getter everywhere (I think) using MySession.get().etc.. -- Edvin On Mon, Apr 7, 2008 at 10:40 PM, Edvin Syse [EMAIL PROTECTED] wrote: Today I deployed an application based on Wicket 1.3.3 that has close to 10.000 users. After a couple of hours we started getting reports from users saying that even upon requesting the login-page, they were already logged in as an arbitrary user. The users they were logged in as had previously performed a succesful login. It seems like the wicket-sessions bleed over between different http-sessions. I tried changing from HybridUrlCodingStrategy to mounting the pages with the normal mountBookmarkablePage() method, but the results are the same. I also tried downgrading to 1.3.2 with the same results. Can anyone think of a logical mistake I might have made? Sincerely, Edvin Syse - 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: Invoulentary session sharing/leakage in Wicket 1.3.x
Igor Vaynberg wrote: can you try with 1.3.1, 1.3.0. would help us isolate where the problem is... seems kind of strange that you are the only one seeing this though... I've turned on some logging in MySession: public MailUser getCurrentMailuser() { try { System.out.println(((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRemoteAddr() + got mailuser + currentMailuser.getId() + + currentMailuser.getUsername()); } catch (Exception ignored) {} return currentMailuser; } This gives me output like: 85.165.86.192 got mailuser 19712 [EMAIL PROTECTED] 77.208.58.135 got mailuser 22817 [EMAIL PROTECTED] these are fine, but then I suddenly get: 84.215.17.110 got mailuser 21024 [EMAIL PROTECTED] 84.215.17.110 got mailuser 21740 [EMAIL PROTECTED] Trouble! One user got the session for two different users on two subsequent requests.. Any ide? This is really killing me.. :( -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Igor Vaynberg wrote: can you try with 1.3.1, 1.3.0. would help us isolate where the problem is... I tried with 1.3.0 as well, still the same problem. My authorization-strategy is quite involved.. I can't see any immediate problems, but I'm posting it here just in case: getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() { public boolean isActionAuthorized(Component component, Action action) { return true; } public boolean isInstantiationAuthorized(Class componentClass) { TornadoSession s = (TornadoSession) Session.get(); if(MailuserBasePage.class.isAssignableFrom(componentClass)) { if(s.getCurrentMailuser() == null) { throw new RestartResponseAtInterceptPageException(MailLoginPage.class); } } /* Instance pages needs instance */ if (BasePage.class.isAssignableFrom(componentClass)) { if (s.getInstanceId() == null) throw new RestartResponseAtInterceptPageException(NoInstancePage.class); /* Instance has access to cms module */ CmsModule cmsAnnotation = (CmsModule) componentClass.getAnnotation(CmsModule.class); if (cmsAnnotation != null) { if (!webModuleDao.instanceHasModule(s.getInstanceId(), cmsAnnotation.id())) { throw new RestartResponseAtInterceptPageException(NoModuleAccessPage.class); } } } /* New-instance wizard can only be calles from tornado */ if(NewInstanceBasePage.class.isAssignableFrom(componentClass) !new Integer(1).equals(TornadoSession.get().getInstanceId())) throw new RestartResponseAtInterceptPageException(NoModuleAccessPage.class); /* Protected Control Panel pages */ if(CpBasePage.class.isAssignableFrom(componentClass)) { if(s.getCurrentCustomer() == null) throw new RestartResponseAtInterceptPageException(CpLoginPage.class); } if(PartnerBasePage.class.isAssignableFrom(componentClass) (TornadoSession.get().getCurrentCustomer() == null || !TornadoSession.get().getCurrentCustomer().getCustomerType().getId().equals(Customer.CTYPE_PARTNER))) throw new RestartResponseAtInterceptPageException(PartnerLoginPage.class); /* CMS Admin */ if(AdminBasePage.class.isAssignableFrom(componentClass)) { if(s.getCurrentUser() == null || !s.getCurrentUser().getInstance().getId().equals(s.getInstanceId())) throw new RestartResponseAtInterceptPageException(AdminLogin.class); } /* Only instance 1 can bootstrap */ if(BootstrapModuleAdmin.class.isAssignableFrom(componentClass) !s.getInstanceId().equals(new Integer(1))) throw new RestartResponseAtInterceptPageException(AdminHomePage.class); return true; } }); } -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Johan Compagner wrote: is it by the way that easy to reproduce for you? you seem to have it pretty quickly when we ask for you if you could test some other version Yes, it's easy because I have more than 10.000 users that have to login to this system to check their email, so all I do is shutdown the app, do mvn war:war and deploy the war-file and startup again - and after a couple of minutes I would see the behaviour. if that is the case isnt it somehow reproducible in a smaller test case? I could set up a dev-environment with 1.3.3 tomorrow and have ten users log in/out and see if I can reproduce it. If I can, I'll start ripping things out until I have a small reproducible case I can submit. Johan Compagner wrote: can you also log the http session id and the hash/id of the WicketSession? I don't dare to take the app down again now, but if it breaks tomorrow I'll throw it in. If it doesn't break, I'll include this in the 1.3.3 test. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Martijn Dashorst wrote: Add to that the thread name. This way you can track session usage across threads. How do I get the thread name? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Edvin Syse wrote: Igor Vaynberg wrote: can you try with 1.3.1, 1.3.0. would help us isolate where the problem is... I tried with 1.3.0 as well, still the same problem. (I wrote this email earlier this evening but forgot to send it it seems. Here it is:) When I ran with 1.3.0 I also had 1.3.3 on the classpath. I reverted to 1.3.2 30 minutes ago and still haven't seen the problem. I've been running 1.3.2 up until this evening with no problems reported, so I am now quite certain that the problem is only with 1.3.3. We have monitoring running now, and if the problem arises when the traffic increases tomorrow morning we'll know for sure. I'll report back tomorrow :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Invoulentary session sharing/leakage in Wicket 1.3.x
Martijn Dashorst wrote: What kind of logging system do you use? log4j's pattern logger has %p I think. If you combine this with start/end logging of your request (see requestcycle#onbeginrequest/onendrequest) you can log the session id together with the username. This would make it easier to track what is happening in each thread. The debug-output I mentioned is just to stderr now, but I'm using log4j so I'll set this up tomorrow, thanks! :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sorting and ListView
I'm using a ListView to display contents of a List of a domain object. Pretty simply. However, the domain has a name on it that is internationalized, ie it will used a key value from a dot properties file. The issue is is that the List of object must be sorted based on the internationalized value of the name. Currently I'm using the localizer to get the internationalized values and then sorting the List but the localizer complains, something about not being attached to a page yet. Does anyone else have a better way of doing this? The problem arises because you do the sorting in the constructor of the page, where i18n-info might not be available (depending on how the page was constructed). Wrap the sorting in a LoadableDetachableModel and return the sorted list from that and pass it to the listview. This way, the list isn't constructed before it is consulted the first time, and then the page will know about i18n-settings. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FeedbackPanel#newMessageDisplayComponent throws NullPointerException if empty message is inserted
Hi, I sometimes do: try { // work } catch (Exception e) { error(e.getMessage()); } and came across an Exception that didn't have a message, and was greeted with a NullPointerException from the FeedbackPanel. Ofcourse this was my mistake but maybe the code could be changed like this: protected Component newMessageDisplayComponent(String id, FeedbackMessage message) { Label label = new Label(id, message.getMessage().toString()); // Current Label label = new Label(id, message.getMessage() != null ? message.getMessage().toString() : getString(emptyMessage)); // New label.setEscapeModelStrings(FeedbackPanel.this.getEscapeModelStrings()); return label; } .. and then add emptyMessage or some key to FeedbackPanel.properties or is this a bad idea? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom Exception/Error page
Hi. In my application I do: getApplicationSettings().setInternalErrorPage(ErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); to display a custom page for error messages. I would also like to email myself the exception - is it possible that I can get a hold of the throwable from the ErrorPage.class, or do I have to explicitly catch and rethrow a RestartResponseException to obtain the exception? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom Exception/Error page
Wow, that's a very nice solution. Thanks :)) -- Edvin Sebastiaan van Erk skrev: I would say that the standard practice is probably to use your logging subsystem to email you the exception. For example, if you are using log4j to log, you could add something like this to your log4j.xml file: appender name=ERRORMAILER class=org.apache.log4j.net.SMTPAppender param name=from value=[EMAIL PROTECTED] / param name=to value=[EMAIL PROTECTED] / param name=subject value=[mydomain] ERROR / param name=SMTPHost value=localhost / param name=threshold value=ERROR / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p - [%C:%L] %m%n / /layout /appender Regards, Sebastiaan Edvin Syse wrote: Hi. In my application I do: getApplicationSettings().setInternalErrorPage(ErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); to display a custom page for error messages. I would also like to email myself the exception - is it possible that I can get a hold of the throwable from the ErrorPage.class, or do I have to explicitly catch and rethrow a RestartResponseException to obtain the exception? -- Edvin - 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: ListView#isVisible dilemma
Maeder Thomas skrev: what he should do is follow the delete call with a listview.detach() call Probably just being thick here, but how does calling listview.detach() hide the listview? The point is not to hide the listview, but to refresh the content. I think Igor meant model.detach(), not listview.detach() though. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView#isVisible dilemma
But wasn't hiding the listview the original point of the question? No, hiding was not the issue. The issue was that because the model was consulted in the isVisible() method of the ListView, the deletion wouldn't be visible before the page was rerendered using the page-constructor (hence, the need to do setResponsePage()). -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView#isVisible dilemma
to contribute a Wicket page explaining this dilemma and how to get around it, as I'm sure people run into this problem regularily. Sorry, I meant wiki page ofcourse :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView#isVisible dilemma
it is called that way for security reasons, eg so you cannot click a link that is not visible just because you know its url... what he should do is follow the delete call with a listview.detach() call Allright, thanks. Is it worth making a wiki page for this? I'll do it if you think there is any value to it. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ListView#isVisible dilemma
not really sure, maybe add it into the gotchas wiki page OK :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Faulty URL on http://wicket.apache.org/writing-documentation.html
The URL to the Wiki on the mentioned url is wrong, it seems like there is some variable substitution not taking place. It links to http://cwiki.apache.org/SPACE_NAME instead of http://cwiki.apache.org/WICKET/. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Faulty URL on http://wicket.apache.org/writing-documentation.html
The URL to the Wiki on the mentioned url is wrong, it seems like there is some variable substitution not taking place. It links to http://cwiki.apache.org/SPACE_NAME instead of http://cwiki.apache.org/WICKET/. Sorry, think I screwed up. I guess it's supposed to be that way :) *taking a break* -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wicket:enclosure bug: setObject(null) called for excplicitly invisible fields in a non-visible enclosure (Wicket 1.3.1)
It seems that the value for fields that are made invisible because a surrounding enclosure is actually lost on submit of the form. Consider the following code: public class HomePage extends WebPage { private MyObject myObject; public HomePage(final PageParameters parameters) { myObject = new MyObject(); myObject.setField1(field1Value); myObject.setField2(field2Value); Form f = new Form(f, new CompoundPropertyModel(myObject)); add(f); f.add(new TextField(field1).setVisible(false)); f.add(new TextField(field2)); f.add(new Button(submit) { @Override public void onSubmit() { System.out.println(Field 2 value should be 'field2Value' but is : + myObject.getField2()); } }); } class MyObject implements Serializable { private String field1; private String field2; public String getField1() { return field1; } public void setField1(String field1) { this.field1 = field1; } public String getField2() { return field2; } public void setField2(String field2) { this.field2 = field2; } } } With the following markup: form wicket:id=f wicket:enclosure child=field1 input type=text wicket:id=field1/ input type=text wicket:id=field2/ /wicket:enclosure input type=submit wicket:id=submit/ /form Field1 keeps it's value onSubmit, but the value for field2 is lost, and my model object has null in field2. If I implicitly call setVisible(false) on the TextField for field2, the value is kept onSubmit. Can someone confirm that this is a bug? Incase I'll create a JIRA-issue for it and attach a quickstart. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket:enclosure bug: setObject(null) called for excplicitly invisible fields in a non-visible enclosure (Wicket 1.3.1)
so you are saying that: when the page renders none of the fields are shown. after submit, however, myobject.getfield1() is still field1value but myobject.getfield2() is null - which implies that textfield2 is still processed even though it is inside an enclosure that has been hidden? if so, then yes, please file a bug. Exactly, thanks for writing it in an easier-understood way :) Created the ticket now: https://issues.apache.org/jira/browse/WICKET-1391 -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I refresh a parent Page after using PopupCloseLink in a popup window?
class mypopupcloselink extends popupcloselink { oncomponenttag(tag) { super.oncomponenttag(tag); tag.put(onclick,window.parent.refresh();); } } Thanks :) Why didn't I think of this.. arghfl :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket Spy?
you can use IResponseFilter to store the generated markup. in a company i used to work for we would store markup for the last page and if the error occured we attached it to the error report - very useful thing to have. Thank you, just what I need :)) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding Panel(s) at Runtime (dynamically)
Hi, Use a ListView or some other Repeater-component and implement a model that returns a list of the classes that should be created as panels. If you need a wicket:id on the surrounding div, that's fine, but not needed. You would then do WebMarkupContainer cont = new WebMarkupContainer(cont); Then you add the ListView to cont component istead of the page. Also, you would use the div with class a as the base for each listItem: div class=a wicket:id=contsPanels here/div -- Edvin mehdi b skrev: Hi all, I want to add some panels to my web page and the number of panels is unknown. I want a div wicket:id=cont/div in my template page and add needed panels to this div (the number of panels is determined at run time). Besides, I want a surrounding div class=a/div for each dynamic panel on adding it to the page. Thanks - Looking for last minute shopping deals? Find them fast with Yahoo! Search. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wicket menus?
That's purely a css issue, most menues are laid out using an ul and styled accordingly these days :) -- Edvin On 4. feb.. 2008, at 23.18, davout [EMAIL PROTECTED] wrote: Are there any demos to show how Wicket supports vertically orientated menus? -- View this message in context: http://www.nabble.com/Wicket-menus--tp15278751p15278751.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: Workaround for AjaxEditableLabel yields java.lang.IllegalAccessError (WICKET-1239)?
I have checked and double-checked. This IS resolved in trunk now. I created a quickstart-project and put the code from the example in HomePage.java and HomePage.html. Then I verified that the error was there with 1.3.0. Then I synced wicket against trunk and did a mvn clean install in my wicket-folder. Then I changed the pom for the example-project to wicket-version 1.3-SNAPSHOT and did mvn eclipse:eclipse. Without any other modification, it then works. This is on Linux with jdk1.6.0_04. -- Edvin Gerolf Seitz skrev: i have reopened the issue, as the exception is still thrown (at least on wicketstuff.org) :/ see http://wicketstuff.org/wicket13/ajax/editable-label and try it with any of the two labels fox and dog. gerolf On Jan 31, 2008 7:45 PM, Per Ejeklint [EMAIL PROTECTED] wrote: Nice! Thank you Gerolf. /Per Gerolf Seitz wrote: i'm sorry this one slipped through. i commited Per's fix. Edvin, can you try with latest trunk to verify it's fixed? gerolf On Jan 31, 2008 8:53 AM, Edvin Syse [EMAIL PROTECTED] wrote: Advanced Technology(R) skrev: Check Per solution : http://www.nabble.com/AjaxEditableLabel-in-1.3.0-tp14675483p14687720.html Thanks! Worked like a charm. For some reason this didn't make it into 1.3.1, though.. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Workaround-for-%22AjaxEditableLabel-yields-java.lang.IllegalAccessError-%28WICKET-1239%29%22--tp15193816p15211776.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: Short Design Question
Can't you just proceed this way: setResponsePage(new SummaryPage(userdId)); i.e. pass the id as a parameter to the summary page constructor ? Regards This works - kind of. Because even though the response page is mounted, I not see a pretty url in the browser. You can mount the page with HybridUrlCodingStrategy to get a pretty URL even after redirecting: mount(new HybridUrlCodingStrategy(/summary, SummaryPage.class)); -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Short Design Question
Thanks Edwin! That did the trick. Just from the looks it appears as if HybridUrlCodingStrategy would be the preferable mount strategy in general. Absolutely :) Even if it adds the version as .version to the url, it is fully bookmarkable. If the current session doesn't include that version, it will downgrade with a redirect automatically. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Short Design Question
oliverw skrev: Oh an by the way. The constructor for my summary page looks like this at the moment: public RegistrationResultPage(final int user_id) { super(null); // model setup IModel model = new CompoundPropertyModel(new LoadableDetachableModel() { public Object load() { return userAccountService.getUser(user_id); } }); setModel(model); add(new Label(info, new PropertyModel(getModel(), email))); } What's the recommended way to format the output for label info before it get's rendered. For example. The property getter for the email property returns [EMAIL PROTECTED] but I would like to apply a format string like %s foo bar to the value resulting in [EMAIL PROTECTED] foo bar as the label text. You could do: add(new Label(info, new Model() { public Object getObject() { return ((User)getModelObject()).getEmail() + foo bar; } }); Also, depending on your need, you could pass in the User in the page constructor instead of the user_id, and setModel(user) directly. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can you control the order of wicket:head contra added headercontributors?
Hi, I have a basepage which adds a reference to jquery amongst other things in its constructor via add(IHeaderContributor). Then I extend that basepage in other pages. If I want to add another javascript-reference that utilizes jquery in the wicket:head tag of the childpage, I run into trouble because the wicket:head tag is rendered before the headercontributors from the basepage, hence the code fails because jquery is not yet loaded (this happens for many jquery-addons if they are added before jquery.js). Is there a way to tell Wicket that wicket:head should be rendered later than the headercontributors or something, or can I in any way change the order of what's added to the head section? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you control the order of wicket:head contra added headercontributors?
not sure we support that, or want to support it... if you are using a headercontributor in one situation, why not use it also in your child page? -igor In my childpage, the head-section actually does more than just load the other javascript-file. It also does initialization for the jquery-components etc, like for example: $('#lang li').hover( function () { $(this).find('ul').removeClass('collapsed'); }, function () { $(this).find('ul').addClass('collapsed'); } ); When my webdesigner needs to add stuff like that to a subpage, he can't add it to the head, because it will be rendered before jquery etc. Then, for every page he needs to do some jquery-magick in, I need to go: response.renderJavascriptReference(new ResourceReference(ThisSubPage.class, extra-init-stuff-for-that-page.js)); .. in that particular page. And he needs to put the js-stuff in this separate file instead of the head of the subpage, where it belongs. It's OK for webdevelopers that does design/css themselves, but a real pain when you have designers working on your project. Can you think of a good solution for this given the current possibilities in Wicket? -- Edvin On Feb 1, 2008 5:52 AM, Edvin Syse [EMAIL PROTECTED] wrote: Hi, I have a basepage which adds a reference to jquery amongst other things in its constructor via add(IHeaderContributor). Then I extend that basepage in other pages. If I want to add another javascript-reference that utilizes jquery in the wicket:head tag of the childpage, I run into trouble because the wicket:head tag is rendered before the headercontributors from the basepage, hence the code fails because jquery is not yet loaded (this happens for many jquery-addons if they are added before jquery.js). Is there a way to tell Wicket that wicket:head should be rendered later than the headercontributors or something, or can I in any way change the order of what's added to the head section? -- Edvin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: localization of PageExpiredErrorPage.html
Is it possible to localize session expiration error page ? Error messages are hardcoded in PageExpiredErrorPage.html. In your init() method of the application-class you can go: getApplicationSettings().setPageExpiredErrorPage(YourClass.class); .. and then create YourClass_lang.html pages for it. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mounting shared resources
Then there is the mountSharedResource method, but it works on resource by resource basis. Instead, I need to alias the path for a big number of resources (for example, static images for my application). Ideally, I would like my images, following the previous example, to be requested as: wicket:linkimg src=img/some_image.gif//wicket:link If your goal is just to supply static pictures and don't have programmatically control over them, why don't you just create an img-folder in your webroot? Then pictures will be served by your container instead of Wicket :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you control the order of wicket:head contra added headercontributors?
page.setmetadata(new jquery.includedKey(), true); their header contributor would omit the inclusion of the jquery.js. given that is a That would still require me to do some code in every page they want to use jquery stuff in. But what do you think of the possibility of the JQuery headercontributor to scan the wicket:head section using a regexp or something, and not add jquery if the regexp matches? Can I get to the wicket:head stuff from a header-contributor? -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you control the order of wicket:head contra added headercontributors?
That would still require me to do some code in every page they want to use jquery stuff in. But what do you think of the possibility of the JQuery headercontributor to scan the wicket:head section using a regexp or something, and not add jquery if the regexp matches? Can I get to the wicket:head stuff from a header-contributor? Somewhere along the lines of this, in JQueryBehaviour: public static final Pattern JQUERY_REGEXP = Pattern.compile(script.*?src=\.*jquery.*\\.js); public void renderHead(IHeaderResponse response) { super.renderHead(response); if(!JQUERY_REGEXP.matcher(response.getResponse().toString()).matches()) { response.renderJavascriptReference(JQUERY_JS); if (Application.DEVELOPMENT.equals(Application.get().getConfigurationType())) { response.renderJavascriptReference(JQUERY_DEBUG_JS); } } } .. or am I on the wrong track? :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you control the order of wicket:head contra added headercontributors?
i really dont get why the people packaging these libs together dont provide a simple load_once check... can you not modify the version of jquery.js your designer is including to do such a check? Yes I can. But how am I gonna sleep at night when my markup calls jquery.js two times? :)) Do you think my suggestion below is viable? -- Edvin -igor On Feb 1, 2008 2:41 PM, Edvin Syse [EMAIL PROTECTED] wrote: That would still require me to do some code in every page they want to use jquery stuff in. But what do you think of the possibility of the JQuery headercontributor to scan the wicket:head section using a regexp or something, and not add jquery if the regexp matches? Can I get to the wicket:head stuff from a header-contributor? Somewhere along the lines of this, in JQueryBehaviour: public static final Pattern JQUERY_REGEXP = Pattern.compile(script.*?src=\.*jquery.*\\.js); public void renderHead(IHeaderResponse response) { super.renderHead(response); if(!JQUERY_REGEXP.matcher(response.getResponse().toString()).matches()) { response.renderJavascriptReference(JQUERY_JS); if (Application.DEVELOPMENT.equals(Application.get().getConfigurationType())) { response.renderJavascriptReference(JQUERY_DEBUG_JS); } } } .. or am I on the wrong track? :) -- Edvin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you control the order of wicket:head contra added headercontributors?
can you not modify the version of jquery.js your designer is including to do such a check? Yes I can. But how am I gonna sleep at night when my markup calls jquery.js two times? :)) soundly? Not a chance :) Do you think my suggestion below is viable? maybe, but its also a pretty big hack... why dont you discuss with wicket-stuff jquery guys to see if they they are ok with it... OK, I will create a working patch and ask them if they can live with it. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for AjaxEditableLabel yields java.lang.IllegalAccessError (WICKET-1239)?
i'm sorry this one slipped through. i commited Per's fix. Edvin, can you try with latest trunk to verify it's fixed? Done. It works good :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DDC and page reload
I have a little problem with drop down choices. I have one on my page. It stores some currencies. In the same page, I've got a Flash module, who needs the actual currency to work. I pass it using the usual flashvars. But when I change a currency on the DDC (ie from USD to EUR), the actual page is refreshed (or seems to), but the currency passed in the flashvars is the old one (USD) although all of my models are properly updated. So I think wicket hasn't recomputed some markup... Can I force him to fully reload (recreate) the current page when a onSelectionChange event is fired? I think it would be easier to help you if you supplied some code :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Fix typo on http://wicket.apache.org/community.html
Hi, I'm sorry for being a wordnazi, but could someone please change nabble to Nabble on the three entries where it is lowercase on: http://wicket.apache.org/community.html (In the mailing list section) It is correct for Wicket Users but lowercase for the rest of the lists. It's really bugging me :) hehe -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple edit form and models
First of all I want to congratulate Wicket guys for their work. Until today I have developed applications based mainly on SWT/RCP and JSP/Servlets. Currently we are evaluating various frameworks in order to initiate a new project, which will expose many of our in-house developed system (SWT/RCP) functions through web. It seems that Wicket is very close to what we are looking for, because more or less we have the same logic in our gui applications. I am trying to create a common template for edit forms responsible to edit properties of a single pojo. In general, I want to have fool control over the synchronization between the form’s data and pojo’s fields. I am posting some simple code. I would appreciate if anyone has the time to take a look and tell me if I am following a right approach about the models and the binding technique. Out of curiosity - what are you going to do that needs this fool control over the binding process? I find in most cases that using CompoundPropertyModel for the whole form and overriding some fields with another PropertyModel for example is sufficient in almost every usecase. I would do something like: public class InputForm extends Form { public InputForm(String id, IModel model) { super(id, model); add(new TextField(personCode)); add(new TextField(lastname)); add(new TextField(someSpecialField, new PropertyModel(someOtherObject, fieldname)); add(new Button(save) { @Override public void onSubmit() { // Save } }); } } Wicket takes care of all the manual labour concerning binding you are used to from RCP-programming, so why not just let it shine? :) Is it too memory expensive to keep instances of pojos inside the form? Does the session keeps information for all pages or just for the current page? Normally you supply the form with a IModel, and depending on the size/nature of the model object you would use a LoadableModel to avoid saving the whole object when you move on from that page. Wicket 1.3 now uses SecondLevelCacheSessionStore per default, and I think only the current page is in memory, and that subsequent pages are saved off to disk, so normally you don't need to think about optimizing for memory usage unless you have a very special case on your hands. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Workaround for AjaxEditableLabel yields java.lang.IllegalAccessError (WICKET-1239)?
Hi, I really need the AjaxEditableLabel in my application, but because of https://issues.apache.org/jira/browse/WICKET-1239, it seems useless at the time. (Just tested with Linux/Java 1.6_04/Wicket 1.3.1). Does anyone know of a workaround in the meantime? java.lang.IllegalAccessError: tried to access method org.apache.wicket.Component.onModelChanging()V from class org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel$1 -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Workaround for AjaxEditableLabel yields java.lang.IllegalAccessError (WICKET-1239)?
Advanced Technology® skrev: Check Per solution : http://www.nabble.com/AjaxEditableLabel-in-1.3.0-tp14675483p14687720.html Thanks! Worked like a charm. For some reason this didn't make it into 1.3.1, though.. -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wicket 1.3: I would like to translate all resource bundles to Norwegian
Hi, Would it be OK for me to translate all the .properties-files in Wicket to Norwegian and have them included with the distribution? I think that would make a lot of Norwegian Wicket-users happy :) If OK, how do I submit the files to you guys? Sincerely, Edvin Syse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]