Re: Why you should not override isVisible
Hello. Pardon me for jumping into this topic as I did not go through previous posts. But I did notice that the isVisible() is called at least three time when a page is rendered I have a SQL call inside the method and the sql log shows multiple sqls were issued. I am running wicket 1.3.5. Sorry I could not provide sample to reproduce this. but I did see it happening. - Original Message - From: Erik van Oosten e.vanoos...@grons.nl To: users@wicket.apache.org Sent: Friday, January 16, 2009 4:18 AM Subject: Re: Why you should not override isVisible Martijn, I just went through the source (1.4-rc1) to trace a detach manually and find suspect callers of isVisible. I found none during detach, but I did find one call to isVisible /after/ detach. A simple run confirmed this. The call to isVisible /after/ detach can be found in method ComponentRequestTarget#respond(RequestCycle). That method initiates a detach and then calls page.endComponentRender. This leads to a call to Page#checkRendering which calls isVisibleInHierarchy() and from there isVisible(). Method checkRendering only does something when the debug setting 'componentUseCheck' is enabled (which according to the javadoc is true by default). I vividly remember the pain when I found out that isVisible was called /during/ detach. So I am certain the problem existed at some time in the past (1.2, 1.3?). I can bang my head against the wall for not having documented the problem more thoroughly back then. Anyways, a call to isVisible /after/ detach has similar problems to a call during detach. Regards, Erik. Martijn Dashorst wrote: A short test didn't uncover any calls to isVisible during detach phase (1.4). Might need more extensive tests though... Martijn -- Erik van Oosten http://day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Go back to previous page when error occurs
Hello: I have a specific goal of set a error handler so that when a page (whether bookmarkable or not) throw exceptions during instantiation, it would go back to the previous page (if previous page does not exist, such as accessed via a bookmark, then go to home page) at least an error page would have a link to point to the previous page. I have seen many discussions on how to use pagemap/accesstack/backbutton,etc. My need here is specific and single purpose simplified (only for page creation exception handling and only needs to know the previous page object). I could not find an simple API for this. any advice would be appreciated. I wish I could use something session.getLastCreatedPageObject() where wicket would always have a ref in each session for the last page object it creates successfully, regardless of bookmarkable or not. Thank you in advance.
wicket:link modify tags
Hello: wicket:link lia href=... /wicket:link wicket replace a with span use getMarkupsetting.setDefaultDis would not help. Would it be possible now to tell wicket not to modify/replace any tags/attrs except href? This has been a headache for web designers to figure out what to do for the changed tags. Thanks
Re: wicket:link modify tags
I understand. But there are so many such links which are what the wicket:link is for. All that takes is for the autolink processing NOT to do extra modification of the element except href, which is what autolink is supposed to behave (and only). The extra replacement is nice to have but in many cases I have seen, it often results in unexpected issues since people would expect it to only convert the href. - Original Message - From: Igor Vaynberg [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Monday, November 17, 2008 1:48 PM Subject: Re: wicket:link modify tags use a bookmarkablepagelink instead -igor On Mon, Nov 17, 2008 at 10:41 AM, DVD [EMAIL PROTECTED] wrote: Hello: wicket:link lia href=... /wicket:link wicket replace a with span use getMarkupsetting.setDefaultDis would not help. Would it be possible now to tell wicket not to modify/replace any tags/attrs except href? This has been a headache for web designers to figure out what to do for the changed tags. Thanks - 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: users, please give us your opinion: what is your take on generics with Wicket
The way 1.3 works currently has been fine with me and any type mismatch in programming error usually result in crash with obvious location of error and easily fixed. So to me, it is optional and not very important. Switching to java 5 does not mean wicket must include generics, there are many other features in java 5 could be used to enhance wicket. and I feel the most helpful new facilities of wicket could be some powerful widgets, layouts, menus that one can use java api to produce (it could use any JS toolkits). Although it was contended that wicket is server side framework, without those widgets, it would not help spread its use as a Java web toolkit. It is true one could write javascript for some of them, but integration with java api would distinguish wicket from the rest. I know there are some projects like this but it would be nice to have it in wicket core as a strategic effort. It might not be worth a huge undertaking for a web framework, considering there are so many other equally crucial factors such as the widget issue above to make a web app successful. Hi all, We have had several threads in this and the dev list, and some discussions in the public on how to incorporate generics in Wicket. I'd like to use this thread to gather the opinions of as many regular Wicket users as we can. Please help us get an impression of what our users think about the issue by completing this simple survey. Note that it is not a vote; we only want to get an idea of what you think. 1) Generifying* Wicket [ ] Can best be done like currently in the 1.4 branch, where models and components are both generified. I care most about the improved static type checking generified models and components give Wicket. [ ] Can best be done in a limited fashion, where we only generify IModel but not components. I care more about what generifying can do for API clarity (declaring a component to only accept certain models for instance) than static type checking. [ ] Should be avoided, I prefer the way 1.3 works. Because... (fill in your opinion here). [ ] (anything other than these choices?) 2) How strongly do you feel about your choice above? [ ] Whatever choice ultimately made, I'll happily convert/ start using 1.4 and up. [ ] I might rethink upgrading if my choice doesn't win. [ ] I definitively won't be using 1.4. if Wicket doesn't go for my preference. Thanks in advance for everyone participating, and pls feel free to explain yourself further beyond just answering these questions! Eelco p.s. I suggest that the core devs and most active participants and previous discussions wait a few days before giving their opinions so that we don't flood the thread right from the start. * Parameterizing would probably be the better word to use, but generifying seems to be the word that many people use. - 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]
wicket maven dependency
Hello: A dumb question. I tried to build wicket from its source (say 1.3.3) (thinking about working on wicket) and realized that several dependent artifacts such as slf4j ,portlet were not on repo1.maven.org. Does wicket team (or anyone building from source) have to install those locally or is there larger maven repo that I could use? I can install them locally but just incase there are easier ways. Thanks
possible html parsing bug?
Hi: It took me a while to find out why my iframe was not displaying properly. I have a parent/container page like ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/; ... wicket:childiframe child/wicket:child and the child page is like ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/; ... wicket:extend The final rendering the html page would contain ?xml. declaration , which results in improper display in browser. Once I remove the ?xml.. line from the child html file, the final rendering of html does not show ?xml line, i.e. the first line is !DOCTYPE..., and this somehow make the browser happy and display the page correctly. My understanding is that for child page, wicket would discard anything outside wicket:extend, but apparently, the presence of ?xml as the first line in child html somehow forced the parser to add the ?xml to the final html output as the first line, which also surprises as I thought wicket would stream out content as it goes instead of waiting to parse the entire tree. Thanks
Re: possible html parsing bug?
There is inconsistency here. If both parent.html and child.html have ?xml declared, ?xml would show in the final rendering. But if child.html does not have ?xml declared, the final rendering would not show even though the parent.html has one. Perhaps wicket auto downgrade the page? That would mean wicket is not streaming parsing the doc, rather it would first build the entire tree before rendering the page. I thought wicket would render the page as it goes. public class WicketApplication extends WebApplication { @Override public void init() { this.getMarkupSettings().setStripXmlDeclarationFromOutput(true); } } On Wed, Apr 16, 2008 at 3:06 AM, [EMAIL PROTECTED] wrote: Hi: It took me a while to find out why my iframe was not displaying properly. I have a parent/container page like ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/; ... wicket:childiframe child/wicket:child and the child page is like ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/; ... wicket:extend The final rendering the html page would contain ?xml. declaration , which results in improper display in browser. Once I remove the ?xml.. line from the child html file, the final rendering of html does not show ?xml line, i.e. the first line is !DOCTYPE..., and this somehow make the browser happy and display the page correctly. My understanding is that for child page, wicket would discard anything outside wicket:extend, but apparently, the presence of ?xml as the first line in child html somehow forced the parser to add the ?xml to the final html output as the first line, which also surprises as I thought wicket would stream out content as it goes instead of waiting to parse the entire tree. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
inlineframe usage
Hello: I am trying to implement the following in one html page wicket:linka href=IFrame.html?src=url when clicked, it would call another page IFrame.class which has IFrame.html like diviframe wicket:id=iframe src=#/div I thought I could do in IFrame.java like add(new InlineFrame(iframe,srcurl)) since InlineFrame is a component. but I looked at the doc and do not know how to handle this. Any help would be great Thanks
Re: inlineframe usage
Hello, Rudiger: I got it and it worked. Thanks very much. Hello dvd, If the URL is an external one (i.e. not a link to a wicket page), you can't use the InlineFrame class from wicket. Just use WebmarkupContainer and link it to the iframe tag. I had the same problem when doing the iframe integration for wicketstuff-picnik (not yet comitted, but will be this week). Greetings, Rüdiger 2008/4/15, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hello: I am trying to implement the following in one html pagewicket:linka href=IFrame.html?src=url when clicked, it would call another page IFrame.class which has IFrame.html like diviframe wicket:id=iframe src=#/div I thought I could do in IFrame.java like add(new InlineFrame(iframe,srcurl)) since InlineFrame is a component. but I looked at the doc and do not know how to handle this. Any help would be great Thanks -- greetings from Berlin, Rüdiger Schulz www.2rue.de www.indyphone.de - Coole Handy Logos einfach selber bauen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: export excel file via an OutputStream
That is exactly what I am looking for. Perhaps someone could show a sample of implementation or even better to make it in the release? Sorry if there was any misunderstanding of my question but this is something Wicket should excel against other frameworks. That looks like an excellent API. Would it be very hard to implement this? Personally I am also looking for something like this, but then bookmarkable. I got some suggestions on how to do this with the current APIs, but I did not like them at all. So now I am using a servlet. Regards, Erik. Al Maw wrote: I think he makes a valid point, personally. People do want to do this sort of thing quite frequently. It wouldn't kill us to implement an OutputStreamLink that looked like this: add(new StreamingLink(link) { public String getFileName() { return download.xls; } public String getMimeType() { return application/vnd.excel; // Or whatever it is. } public void writeToOutputStream(OutputStream outputStream) { excelGenerator.writeOutput(outputStream); } }); I don't think the current API here is very pleasant or obvious to use. Regards, Al -- Erik van Oosten http://www.day-to-day-stuff.blogspot.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: export excel file via an OutputStream
Never mind. I just saw and tested Johan Campagner's posted solution and it resolves all issues. This is why I like Wicket and its developers. That is exactly what I am looking for. Perhaps someone could show a sample of implementation or even better to make it in the release? Sorry if there was any misunderstanding of my question but this is something Wicket should excel against other frameworks. That looks like an excellent API. Would it be very hard to implement this? Personally I am also looking for something like this, but then bookmarkable. I got some suggestions on how to do this with the current APIs, but I did not like them at all. So now I am using a servlet. Regards, Erik. Al Maw wrote: I think he makes a valid point, personally. People do want to do this sort of thing quite frequently. It wouldn't kill us to implement an OutputStreamLink that looked like this: add(new StreamingLink(link) { public String getFileName() { return download.xls; } public String getMimeType() { return application/vnd.excel; // Or whatever it is. } public void writeToOutputStream(OutputStream outputStream) { excelGenerator.writeOutput(outputStream); } }); I don't think the current API here is very pleasant or obvious to use. Regards, Al -- Erik van Oosten http://www.day-to-day-stuff.blogspot.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]
export excel file via an OutputStream
Hello: I am trying to export dynamically generated excel file. The generator would send the file.xls to an OutputStream. In wicket, I am trying to use example as below but how can I connect the OutputStream to the inputstream ins. Pipedoutputstream would block. Using a separate thread is not desirable. public void onClick() { IResourceStream stream = new AbstractResourceStream() { public InputStream getInputStream() throws ResourceStreamNotFoundException { return ins; } public void close() throws IOException { ins.close(); } }; getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(stream).setFileName(file.xls));
Re: export excel file via an OutputStream
This does not apply as it copies input to output. My issue is that in OnClick() I call excelGen(OutputStream) to produce the bytes on the fly. but the ResourceStream needs InputStream that wicket would read data to send as response. My take is that I need to get a handle of the reponse outputstream to pass it to excelGen. But How to do it at wicket api level instead of bypass it to directly get servlet reponse stream. see Streams.copy() in wicket utils package -igor On Tue, Apr 1, 2008 at 12:31 AM, [EMAIL PROTECTED] wrote: Hello: I am trying to export dynamically generated excel file. The generator would send the file.xls to an OutputStream. In wicket, I am trying to use example as below but how can I connect the OutputStream to the inputstream ins. Pipedoutputstream would block. Using a separate thread is not desirable. public void onClick() { IResourceStream stream = new AbstractResourceStream() { public InputStream getInputStream() throws ResourceStreamNotFoundException { return ins; } public void close() throws IOException { ins.close(); } }; getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(stream).setFileName(file.xls)); - 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: export excel file via an OutputStream
In a raw servlet programming, it is trivial, just get response outputstream, set headers and pass it to the excelGen (as a poorman's way, close the connection after done) Wicket got to have a more structured api for this common task. This one (even with model args) falls to the same category of getting the inputstream actively. I do not see how I can define the model to get data since the controlling side is excelGen(outputstream). it keeps writing data to outputstream. and I am trying to get it directly send back to browser. It has to directly write to the response stream in a single thread or it would block. see DownloadLink -igor On Tue, Apr 1, 2008 at 12:45 AM, [EMAIL PROTECTED] wrote: This does not apply as it copies input to output. My issue is that in OnClick() I call excelGen(OutputStream) to produce the bytes on the fly. but the ResourceStream needs InputStream that wicket would read data to send as response. My take is that I need to get a handle of the reponse outputstream to pass it to excelGen. But How to do it at wicket api level instead of bypass it to directly get servlet reponse stream. see Streams.copy() in wicket utils package -igor On Tue, Apr 1, 2008 at 12:31 AM, [EMAIL PROTECTED] wrote: Hello: I am trying to export dynamically generated excel file. The generator would send the file.xls to an OutputStream. In wicket, I am trying to use example as below but how can I connect the OutputStream to the inputstream ins. Pipedoutputstream would block. Using a separate thread is not desirable. public void onClick() { IResourceStream stream = new AbstractResourceStream() { public InputStream getInputStream() throws ResourceStreamNotFoundException { return ins; } public void close() throws IOException { ins.close(); } }; getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(stream).setFileName(file.xls)); - 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] - 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: export excel file via an OutputStream
FY. Once you reach getResponse.getOutputStream, you are back to square one with servlet programming. wtf -igor On Tue, Apr 1, 2008 at 1:12 AM, [EMAIL PROTECTED] wrote: In a raw servlet programming, it is trivial, just get response outputstream, set headers and pass it to the excelGen (as a poorman's way, close the connection after done) Wicket got to have a more structured api for this common task. This one (even with model args) falls to the same category of getting the inputstream actively. I do not see how I can define the model to get data since the controlling side is excelGen(outputstream). it keeps writing data to outputstream. and I am trying to get it directly send back to browser. It has to directly write to the response stream in a single thread or it would block. see DownloadLink -igor On Tue, Apr 1, 2008 at 12:45 AM, [EMAIL PROTECTED] wrote: This does not apply as it copies input to output. My issue is that in OnClick() I call excelGen(OutputStream) to produce the bytes on the fly. but the ResourceStream needs InputStream that wicket would read data to send as response. My take is that I need to get a handle of the reponse outputstream to pass it to excelGen. But How to do it at wicket api level instead of bypass it to directly get servlet reponse stream. see Streams.copy() in wicket utils package -igor On Tue, Apr 1, 2008 at 12:31 AM, [EMAIL PROTECTED] wrote: Hello: I am trying to export dynamically generated excel file. The generator would send the file.xls to an OutputStream. In wicket, I am trying to use example as below but how can I connect the OutputStream to the inputstream ins. Pipedoutputstream would block. Using a separate thread is not desirable. public void onClick() { IResourceStream stream = new AbstractResourceStream() { public InputStream getInputStream() throws ResourceStreamNotFoundException { return ins; } public void close() throws IOException { ins.close(); } }; getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(stream).setFileName(file.xls)); - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CheckBox uses true/false but model is Y/N
Hello: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Thanks.
Re: CheckBox uses true/false but model is Y/N
Thanks. I'd prefer a custom checkbox class with converter. I just created a test class as below but not working. Appreciate any pointers. I did not find an example to follow. public class CheckBoxYN extends CheckBox{ public CheckBoxYN(String id){ super(id); } @Override public final IConverter getConverter(Class arg0){ IConverter icYN = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { if (arg0.equals(true)){ return 'Y'; }else{ return 'N'; } } public String convertToString(Object arg0, Locale arg1) { if(arg0.toString().equals('Y')){ return true; }else{ return false; } } }; return icYN; } } On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Probably you could set your own IConverter on the component corresponding the checkbox. The converter can then be reused as needed. I've typically (if not always) used checkboxes with custom models directly toggling things in domain objects, e.g. class RoomReservedModel extends Model { private IModel room; public RoomReservedModel(IModel room) { this.room = room; } @Override public void setObject(Object object) { room().setReserved((Boolean) object); } @Override public Object getObject() { return room().isReserved(); } private Room room() { return (Room) room.getObject(); } } Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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: CheckBox uses true/false but model is Y/N
Use model decorator sometimes seems troublesome. I need to use a form containing a lot of checkboxes and other types with compoundproperty model with a entity bean, say record. Most formcoponent ids are identical to their record property name, such as Textfield(firstName) and record also has firstName if I use the extra decorator indirection for checkbox, I'd have to use CheckBox(checked,new CustomerModel(new PropertyModel(record,checked)) or is there a better/convenient way to do this? you forgot the important detach() { room.detach(); } -igor On Tue, Mar 25, 2008 at 1:52 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Probably you could set your own IConverter on the component corresponding the checkbox. The converter can then be reused as needed. I've typically (if not always) used checkboxes with custom models directly toggling things in domain objects, e.g. class RoomReservedModel extends Model { private IModel room; public RoomReservedModel(IModel room) { this.room = room; } @Override public void setObject(Object object) { room().setReserved((Boolean) object); } @Override public Object getObject() { return room().isReserved(); } private Room room() { return (Room) room.getObject(); } } Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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: CheckBox uses true/false but model is Y/N
I am not sure how this would solve my problem I intend to only use new CheckBox(checked) without adding any other arguments since I expect it to resolve the form's compoundpropertymodel whose object is entitybean with checked as column name. or you can simply do: class YesNoCheckBox extends CheckBox { protected IModel initModel() { return new CheckBoxYesNoModel(super.initModel()); } } -igor On Tue, Mar 25, 2008 at 2:29 PM, [EMAIL PROTECTED] wrote: Use model decorator sometimes seems troublesome. I need to use a form containing a lot of checkboxes and other types with compoundproperty model with a entity bean, say record. Most formcoponent ids are identical to their record property name, such as Textfield(firstName) and record also has firstName if I use the extra decorator indirection for checkbox, I'd have to use CheckBox(checked,new CustomerModel(new PropertyModel(record,checked)) or is there a better/convenient way to do this? you forgot the important detach() { room.detach(); } -igor On Tue, Mar 25, 2008 at 1:52 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Probably you could set your own IConverter on the component corresponding the checkbox. The converter can then be reused as needed. I've typically (if not always) used checkboxes with custom models directly toggling things in domain objects, e.g. class RoomReservedModel extends Model { private IModel room; public RoomReservedModel(IModel room) { this.room = room; } @Override public void setObject(Object object) { room().setReserved((Boolean) object); } @Override public Object getObject() { return room().isReserved(); } private Room room() { return (Room) room.getObject(); } } Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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] - 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: CheckBox uses true/false but model is Y/N
I just tested and it worked. Thanks very much. Pardon me for being stubbon here. For a simple convertion like this, So much has to be created so it seems a little heavy weight. For this one, first a subclass of Checkbox (possibly creating multiple constructors) overide initmodel and separate custom model class just to convert a simple data object to another. I'd still prefer the direct converter method. Even though one could see it as in business domain, this kind of conversion is generic enough to be put in the convert phase. Also, I saw you saying about the detach() method, it could add some performance overhead, I guess. Could you show me what I am doing wrong below for the converter method? If this works, I'd even suggest to make it in the wicket core release:-) by adding a method such as new CheckBox(id).setTrueFalse(y,n), you get the idea. public class CheckBoxYN extends CheckBox{ public CheckBoxYN(String id){ super(id); } @Override public final IConverter getConverter(Class arg0){ IConverter icYN = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { if (arg0.equals(true)){ return 'Y'; }else{ return 'N'; } } public String convertToString(Object arg0, Locale arg1) { if(arg0.toString().equals('Y')){ return true; }else{ return false; } } }; return icYN; } } what i have shown you will work independently of the fact that you are sure or not :) -igor On Tue, Mar 25, 2008 at 2:51 PM, [EMAIL PROTECTED] wrote: I am not sure how this would solve my problem I intend to only use new CheckBox(checked) without adding any other arguments since I expect it to resolve the form's compoundpropertymodel whose object is entitybean with checked as column name. or you can simply do: class YesNoCheckBox extends CheckBox { protected IModel initModel() { return new CheckBoxYesNoModel(super.initModel()); } } -igor On Tue, Mar 25, 2008 at 2:29 PM, [EMAIL PROTECTED] wrote: Use model decorator sometimes seems troublesome. I need to use a form containing a lot of checkboxes and other types with compoundproperty model with a entity bean, say record. Most formcoponent ids are identical to their record property name, such as Textfield(firstName) and record also has firstName if I use the extra decorator indirection for checkbox, I'd have to use CheckBox(checked,new CustomerModel(new PropertyModel(record,checked)) or is there a better/convenient way to do this? you forgot the important detach() { room.detach(); } -igor On Tue, Mar 25, 2008 at 1:52 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Probably you could set your own IConverter on the component corresponding the checkbox. The converter can then be reused as needed. I've typically (if not always) used checkboxes with custom models directly toggling things in domain objects, e.g. class RoomReservedModel extends Model { private IModel room; public RoomReservedModel(IModel room) { this.room = room; } @Override public void setObject(Object object) { room().setReserved((Boolean) object); } @Override public Object getObject() { return room().isReserved(); } private Room room() { return (Room) room.getObject(); } } Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To
Re: CheckBox uses true/false but model is Y/N
Mine is not working. I feel these basic data manipulation tasks are little to heavy in Wicket. Some built-in custom/helper classes could help a bit. I found I am writing many of these kind of custom class to do basic conversion and still have to worry if I am doing right, like the detach() method Igor just pointed out. wondering if that really always works. looking at the current getConverter doc: /** * CheckBox will by default always just use the boolean converter because the implementation * expects that the string is can be converted to a boolean [EMAIL PROTECTED] Strings#isTrue(String)} * * @see org.apache.wicket.Component#getConverter(java.lang.Class) */ public IConverter getConverter(Class type) { return BooleanConverter.INSTANCE; } but i guess yours works by accident because Strings#isTrue(String) returns the right value for Y or N Also with generics i believe we have this: public class Checkbox extends FormComponentBoolean so the model type is hard to a boolean. johan On Tue, Mar 25, 2008 at 11:30 PM, [EMAIL PROTECTED] wrote: I just tested and it worked. Thanks very much. Pardon me for being stubbon here. For a simple convertion like this, So much has to be created so it seems a little heavy weight. For this one, first a subclass of Checkbox (possibly creating multiple constructors) overide initmodel and separate custom model class just to convert a simple data object to another. I'd still prefer the direct converter method. Even though one could see it as in business domain, this kind of conversion is generic enough to be put in the convert phase. Also, I saw you saying about the detach() method, it could add some performance overhead, I guess. Could you show me what I am doing wrong below for the converter method? If this works, I'd even suggest to make it in the wicket core release:-) by adding a method such as new CheckBox(id).setTrueFalse(y,n), you get the idea. public class CheckBoxYN extends CheckBox{ public CheckBoxYN(String id){ super(id); } @Override public final IConverter getConverter(Class arg0){ IConverter icYN = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { if (arg0.equals(true)){ return 'Y'; }else{ return 'N'; } } public String convertToString(Object arg0, Locale arg1) { if(arg0.toString().equals('Y')){ return true; }else{ return false; } } }; return icYN; } } what i have shown you will work independently of the fact that you are sure or not :) -igor On Tue, Mar 25, 2008 at 2:51 PM, [EMAIL PROTECTED] wrote: I am not sure how this would solve my problem I intend to only use new CheckBox(checked) without adding any other arguments since I expect it to resolve the form's compoundpropertymodel whose object is entitybean with checked as column name. or you can simply do: class YesNoCheckBox extends CheckBox { protected IModel initModel() { return new CheckBoxYesNoModel(super.initModel()); } } -igor On Tue, Mar 25, 2008 at 2:29 PM, [EMAIL PROTECTED] wrote: Use model decorator sometimes seems troublesome. I need to use a form containing a lot of checkboxes and other types with compoundproperty model with a entity bean, say record. Most formcoponent ids are identical to their record property name, such as Textfield(firstName) and record also has firstName if I use the extra decorator indirection for checkbox, I'd have to use CheckBox(checked,new CustomerModel(new PropertyModel(record,checked)) or is there a better/convenient way to do this? you forgot the important detach() { room.detach(); } -igor On Tue, Mar 25, 2008 at 1:52 PM, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote: Is there built-in mechanism to auto convert the checkbox model value to be a character set Y/N or Yes/No or any other pairs? This is frequently used pattern. Probably you could set your own IConverter on the component corresponding the checkbox. The converter can then be reused as needed. I've typically (if not always) used checkboxes with custom models directly toggling things in domain objects, e.g. class RoomReservedModel extends Model { private IModel room; public RoomReservedModel(IModel room) { this.room = room; } @Override public void setObject(Object object) { room().setReserved((Boolean) object); }
wicket:link change markup
Hello: Is there a way to disable wicket:link' removing a tag action. I only need to use wicket:link for a list of urls but do not want it to remove the a tag. That is, I want to keep the markups as they are. The reason is that I need to keep these markups for CSS. When using wicket:id, the visual appearance is totally messedup. I could use the add link method inside Java but wonder if wicket:link has an option to do so. Thanks
Re: wicket:link change markup
I have been doing that way to work around this issue but found it is often cumbersome to do so, particularly to deal with large number of links. use Listview helps a bit but not complete solution. I wonder if something similar tothe following could be done wicket:link nomarkupremoval=true This would not break any existing app and give a lot of flexibility. Don't use wicket:link in that case. Just add the links as bookmarkable page links. wicket:link is a convenience, not for all use cases. This is not one of them. Martijn On 3/15/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: Is there a way to disable wicket:link' removing a tag action. I only need to use wicket:link for a list of urls but do not want it to remove the a tag. That is, I want to keep the markups as they are. The reason is that I need to keep these markups for CSS. When using wicket:id, the visual appearance is totally messedup. I could use the add link method inside Java but wonder if wicket:link has an option to do so. Thanks -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.1 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1 - 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: append a converter or coversion function
You could resolve the type because a converted is already registered for that type. I could make a special class called UpperCaseString and register a converter and new TextField( . UpperCaseString.class). From this perspective, if I override getConverter to provide my own, wicket should use it directly instead of infer the type and what to do since I have give a definite converter. As I had observed, the custom getConverter was actually called, so all that takes is to call its methods instead of using builtin rules. The provider of the custom converter would be responsible for the outcome. A converter is only called when type is set for converting from string to object. Maybe we should document this a bit better. The type is tried to be resolved for you, but if it is a string then it is ignored so that normal convert() processing happens. This is a bit weird but dont know how we can make this easier On 3/10/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I used the trick it worked great. Thanks very much. Should it be considered a bug? What is interesting before using setType is that getConverter is actually called (from my simple tracing), but after that its methods were not called (I guess somewhere it learned the modelobject was a String so it simply call the built-in converter. I'd think if the getConverter is overriden, its methods should be called regardless of what type was it. Besides, UppercaseString is a special Type so it does not conflict with the rules. (Any custom converter could be considered to target a special type even though it could be just uppercasing or prepend a * to the string) Built-in converter might follow the default rules but if custom converter is provided, wicket should totally depend on the custom converter to do whatever it does. Anyway, thanks again. if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
I'd consider it a generic business component that applies to so many apps/business pojos that would justify it to become a web component, much like RequiredTextField or even PasswordTextField. Could you illustrate how to do it better with model decorator to use it like using RequiredTextField? no, upper case string is not a special type, not unless you do not use String to represent it...like i said, my suggestion is to do this via a model decorator. further, something like this doesnt even sound like it belongs in the web layer - sounds like a business requirement which should be enforced by the setter of the bussiness pojo. -igor On Sun, Mar 9, 2008 at 7:57 PM, [EMAIL PROTECTED] wrote: I used the trick it worked great. Thanks very much. Should it be considered a bug? What is interesting before using setType is that getConverter is actually called (from my simple tracing), but after that its methods were not called (I guess somewhere it learned the modelobject was a String so it simply call the built-in converter. I'd think if the getConverter is overriden, its methods should be called regardless of what type was it. Besides, UppercaseString is a special Type so it does not conflict with the rules. (Any custom converter could be considered to target a special type even though it could be just uppercasing or prepend a * to the string) Built-in converter might follow the default rules but if custom converter is provided, wicket should totally depend on the custom converter to do whatever it does. Anyway, thanks again. if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
Yes, but the issue I encountered that wicket first call getConverter method, yet not using what was returned as supposed to be. Class based converter is a way to write one default converter for one class, but if a special converter is provided for a subset of that class, then the special convert should be used yes, since the converter interface now has convertToObject(String value); convertToString(Object value); not just a single convertTo(Object object, Class type) it makes it rather explicit that the converter is meant to convert something to a string and back...no? -igor On Mon, Mar 10, 2008 at 11:35 AM, Eelco Hillenius [EMAIL PROTECTED] wrote: On Sun, Mar 9, 2008 at 9:45 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters... Did we? :-) Eelco - 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: append a converter or coversion function
Another level of indirection? for compoundpropertymode Could I could do add(new textfield(foo).setModel(new uppercasingmodel(this))) ? if this is the webpage with the foo field. Compared to add(new UpperCaseTextfield(foo)); the latter would be more efficient and clean. class uppercasingmodel implements imodel { private final imodel delegate; public void setobject(object) { delegate.setobject(uppercase((string)object)); } ... } add(new textfield(foo, new uppercasingmodel(model))); -igor On Mon, Mar 10, 2008 at 3:31 AM, [EMAIL PROTECTED] wrote: I'd consider it a generic business component that applies to so many apps/business pojos that would justify it to become a web component, much like RequiredTextField or even PasswordTextField. Could you illustrate how to do it better with model decorator to use it like using RequiredTextField? no, upper case string is not a special type, not unless you do not use String to represent it...like i said, my suggestion is to do this via a model decorator. further, something like this doesnt even sound like it belongs in the web layer - sounds like a business requirement which should be enforced by the setter of the bussiness pojo. -igor On Sun, Mar 9, 2008 at 7:57 PM, [EMAIL PROTECTED] wrote: I used the trick it worked great. Thanks very much. Should it be considered a bug? What is interesting before using setType is that getConverter is actually called (from my simple tracing), but after that its methods were not called (I guess somewhere it learned the modelobject was a String so it simply call the built-in converter. I'd think if the getConverter is overriden, its methods should be called regardless of what type was it. Besides, UppercaseString is a special Type so it does not conflict with the rules. (Any custom converter could be considered to target a special type even though it could be just uppercasing or prepend a * to the string) Built-in converter might follow the default rules but if custom converter is provided, wicket should totally depend on the custom converter to do whatever it does. Anyway, thanks again. if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final
Re: append a converter or coversion function
I missed this one. That explains what I just posted. I'd say the logic could be if a converter is provided, the its stringtoobject is called. otherwise, check the set type and use the types'registered converter. yes i think i explained that before the first call you see is the getConverter call that calls objectToString() on it but if type is not set on a field getConverter is not called for StringToObject johan On Mon, Mar 10, 2008 at 11:44 PM, [EMAIL PROTECTED] wrote: Yes, but the issue I encountered that wicket first call getConverter method, yet not using what was returned as supposed to be. Class based converter is a way to write one default converter for one class, but if a special converter is provided for a subset of that class, then the special convert should be used yes, since the converter interface now has convertToObject(String value); convertToString(Object value); not just a single convertTo(Object object, Class type) it makes it rather explicit that the converter is meant to convert something to a string and back...no? -igor On Mon, Mar 10, 2008 at 11:35 AM, Eelco Hillenius [EMAIL PROTECTED] wrote: On Sun, Mar 9, 2008 at 9:45 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters... Did we? :-) Eelco - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: append a converter or coversion function
Thanks. I will give a try, although I wish there would be something like component.add(IPostConverteToObject or IPostConverttoString) that would not require subclass and also allow easy reuse of what is available. A related question, after conversion is done, Can I do something like below class MyTextField extend TextField{ @Override setModel(model){ MySpeicalProcessing(model) // after this model object is changed to what I want super.setModel(model) } } The javadoc said it WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT. Also, would wicket gurantee that after the conversion, it would only call setModel(model) instead of being able to use other means to update the model value such as setModelObject. If allowed, then the above method could fail mysteriously. Thanks Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
I used the trick it worked great. Thanks very much. Should it be considered a bug? What is interesting before using setType is that getConverter is actually called (from my simple tracing), but after that its methods were not called (I guess somewhere it learned the modelobject was a String so it simply call the built-in converter. I'd think if the getConverter is overriden, its methods should be called regardless of what type was it. Besides, UppercaseString is a special Type so it does not conflict with the rules. (Any custom converter could be considered to target a special type even though it could be just uppercasing or prepend a * to the string) Built-in converter might follow the default rules but if custom converter is provided, wicket should totally depend on the custom converter to do whatever it does. Anyway, thanks again. if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
append a converter or coversion function
Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks
Re: append a converter or coversion function
I could use both model or onSubmit to do what I mentioned. But this resulted in repeating coding. If I put the special conversion code in converter, it would be handily reusable by me or others without worring about the convertion logic for each model or form. Validator chaining is the example of what I meant i think a model decorator is more appropriate here -igor On Sat, Mar 8, 2008 at 3:10 PM, [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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]
attach link component to most of markups?
Hello: I am reading the lastest wicket in action and saw a statement A link component can be attached to tags other than a such as spans td tr... I was a confused as I remember to I have to create buttons within a data table in order to hava link function. Is it true I could do the followin td wicket:id=linkLink/td or span wicket:id=linkLink/span add(link, new Link(.) Thanks
Re: attach link component to most of markups?
I am reading it without immediate access to wicket dev environment. so I'd like to confirm it before I forget it why cant you just try and see if it works... -igor On Tue, Mar 4, 2008 at 8:34 PM, [EMAIL PROTECTED] wrote: Hello: I am reading the lastest wicket in action and saw a statement A link component can be attached to tags other than a such as spans td tr... I was a confused as I remember to I have to create buttons within a data table in order to hava link function. Is it true I could do the followin td wicket:id=linkLink/td or span wicket:id=linkLink/span add(link, new Link(.) Thanks - 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]
YUI integration?
Hi: I wonder if there is a plan to integrate YUI into wicket. or any other JS lib. YUI seems to be a nice fit with its license and number of widgets. Since wicket is already using its calendar, so would it be rational approach to adopt the rest of YUI ? Thanks
Re: YUI integration?
I saw it but it did not seem to very active. Besides, it would be nice that wicket core team adopt a js lib as many frontend functions have to use js, like datepicker. It would make sense to me to expand it to make wicket more powerful and easy to use. Have you taken a look at wicket-contrib-yui? There are already a few YUI integrated components built. -- View this message in context: http://www.nabble.com/YUI-integration--tp15793009p15793412.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: strange DropDownChoice display
Thanks very much. but it is not just like it was after it has been created is it? it is currently holding a value from the request. anywho: secondchoiceSelected=null; secondchoicedropdownchoice.clearInput(); and you will have what you want. -igor On Feb 4, 2008 7:36 PM, [EMAIL PROTECTED] wrote: The following is the code sample class webpage String secondchoiceSelected; } new Firstdropdownchoice( ){ onSelectionChange{ secondchoiceSelected = null; } I did set to null. This issue is that the displayed value is the first item of the new list, instead of Choose One, it is not displaying the old secondVarSelected since I already set it to null. Basically, when the dropdownchoice is redisplayed and is model is null, it is supposed to display the same as the first created. It does not appear this way. whe the first is submitted you have to set the second one's model object to null -igor On Feb 4, 2008 4:59 PM, [EMAIL PROTECTED] wrote: Hello: I am using two dropdownchoices, after the first select, the second would get data on the fly using the first choice. The first round everything is fine with both displaying Choose One and selecting the first one set the correct second one list of choice with Choose One still displaying on the second so that one could click on it to pick the right one. After the first round, I select a different value in the first one, which resets correctly the second one' list as in the first round but strangely this time, the 'Choose One display is gone in the second dropdownchoice. Instead it shows the first item of the new list. I used the wicket-examples sample code as basis and use getObject() to load the correct list when selection on the first changed. Thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange DropDownChoice display
This worked great but why is a separate call needed? the Rerendering should find out the model value is null and do the same as it did for the first rendering. Is it due to the Javascript effect? The second request would set the value to the first rendering but after that, the my call back resets it to null and the rendering kicks in in that order which would pick the null value as the secondchoice? but it is not just like it was after it has been created is it? it is currently holding a value from the request. anywho: secondchoiceSelected=null; secondchoicedropdownchoice.clearInput(); and you will have what you want. -igor On Feb 4, 2008 7:36 PM, [EMAIL PROTECTED] wrote: The following is the code sample class webpage String secondchoiceSelected; } new Firstdropdownchoice( ){ onSelectionChange{ secondchoiceSelected = null; } I did set to null. This issue is that the displayed value is the first item of the new list, instead of Choose One, it is not displaying the old secondVarSelected since I already set it to null. Basically, when the dropdownchoice is redisplayed and is model is null, it is supposed to display the same as the first created. It does not appear this way. whe the first is submitted you have to set the second one's model object to null -igor On Feb 4, 2008 4:59 PM, [EMAIL PROTECTED] wrote: Hello: I am using two dropdownchoices, after the first select, the second would get data on the fly using the first choice. The first round everything is fine with both displaying Choose One and selecting the first one set the correct second one list of choice with Choose One still displaying on the second so that one could click on it to pick the right one. After the first round, I select a different value in the first one, which resets correctly the second one' list as in the first round but strangely this time, the 'Choose One display is gone in the second dropdownchoice. Instead it shows the first item of the new list. I used the wicket-examples sample code as basis and use getObject() to load the correct list when selection on the first changed. Thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: A submit link that can be used with span wicket:id
That is what I meant. If wicket comes with such a commonly used component, it would save a lot of time for both users and authors having to exlain everytime needing this. And perhaps there is not one yet because it is not easy to come up with a good abstraction of such a component that would behave exactly like a usual submitLink. All the examples/books I saw uses individual panels/htmls for each button needed such as Edit and Delete. I have not seen a universal one that one could just provide needed paramsin constructor and the onSubmit callback. Perhaps you could explain how to implement this with some skeleton code. I found it quite awkward everytime I construct a datatable with different needs of links, I have to go through this. why exactly is it a chore? you only have to write it once... -igor On Feb 2, 2008 8:55 PM, [EMAIL PROTECTED] wrote: Hello: All the books and examples I have read to deal with situation like datatable that would not accept normal Link since it is not anchored with a but span wicket:id, the suggestion is to create a panel for each such a link in the app when needed. while it works, it is quite tedious to write many of these. Is there already a component/extension that function the same as Link (or SubmitLink) (that is, has the same call such as onSubmit, and other common Link component functions) yet can be used against with span or aWhen used with span, I mean that the component would replace the element with a a on the fly, I saw in the doc wicket can replace the entire element on the fly so I assume this is feasibly. Thanks - 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]
strange DropDownChoice display
Hello: I am using two dropdownchoices, after the first select, the second would get data on the fly using the first choice. The first round everything is fine with both displaying Choose One and selecting the first one set the correct second one list of choice with Choose One still displaying on the second so that one could click on it to pick the right one. After the first round, I select a different value in the first one, which resets correctly the second one' list as in the first round but strangely this time, the 'Choose One display is gone in the second dropdownchoice. Instead it shows the first item of the new list. I used the wicket-examples sample code as basis and use getObject() to load the correct list when selection on the first changed. Thanks
Re: strange DropDownChoice display
The following is the code sample class webpage String secondchoiceSelected; } new Firstdropdownchoice( ){ onSelectionChange{ secondchoiceSelected = null; } I did set to null. This issue is that the displayed value is the first item of the new list, instead of Choose One, it is not displaying the old secondVarSelected since I already set it to null. Basically, when the dropdownchoice is redisplayed and is model is null, it is supposed to display the same as the first created. It does not appear this way. whe the first is submitted you have to set the second one's model object to null -igor On Feb 4, 2008 4:59 PM, [EMAIL PROTECTED] wrote: Hello: I am using two dropdownchoices, after the first select, the second would get data on the fly using the first choice. The first round everything is fine with both displaying Choose One and selecting the first one set the correct second one list of choice with Choose One still displaying on the second so that one could click on it to pick the right one. After the first round, I select a different value in the first one, which resets correctly the second one' list as in the first round but strangely this time, the 'Choose One display is gone in the second dropdownchoice. Instead it shows the first item of the new list. I used the wicket-examples sample code as basis and use getObject() to load the correct list when selection on the first changed. Thanks - 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]
A submit link that can be used with span wicket:id
Hello: All the books and examples I have read to deal with situation like datatable that would not accept normal Link since it is not anchored with a but span wicket:id, the suggestion is to create a panel for each such a link in the app when needed. while it works, it is quite tedious to write many of these. Is there already a component/extension that function the same as Link (or SubmitLink) (that is, has the same call such as onSubmit, and other common Link component functions) yet can be used against with span or a When used with span, I mean that the component would replace the element with a a on the fly, I saw in the doc wicket can replace the entire element on the fly so I assume this is feasibly. Thanks
RE: TextField not getting value on the fly?
Sorry Textfield id should be key. Should be class C extends webpage{ String key = default; add(new Form(f, new CompoundPropertyModel(this)) form.add(new Textfield(key) Hello: here is a strange result class C extends webpage{ String key = default; add(new Form(f, new CompoundPropertyModel(this)) form.add(new Textfield(tf) } When I enter a something like Test and hit submit I'd expect the textfield would return with Test since it has been saved to mode object (key) and the textfield should display the new value. But instead it always 'default' when it returns even though I check the model value was set to Test, the html markup input value=Test was not changed even though the model value has been set. Should it be this way? the value attribute of input element is not backed by model value? Thanks - 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]
TextField not getting value on the fly?
Hello: here is a strange result class C extends webpage{ String key = default; add(new Form(f, new CompoundPropertyModel(this)) form.add(new Textfield(tf) } When I enter a something like Test and hit submit I'd expect the textfield would return with Test since it has been saved to mode object (key) and the textfield should display the new value. But instead it always 'default' when it returns even though I check the model value was set to Test, the html markup input value=Test was not changed even though the model value has been set. Should it be this way? the value attribute of input element is not backed by model value? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: TextField not getting value on the fly?
Apologies. Pls disregard this question. I found the problem. Sorry Textfield id should be key. Should be class C extends webpage{ String key = default; add(new Form(f, new CompoundPropertyModel(this)) form.add(new Textfield(key) Hello: here is a strange result class C extends webpage{ String key = default; add(new Form(f, new CompoundPropertyModel(this)) form.add(new Textfield(tf) } When I enter a something like Test and hit submit I'd expect the textfield would return with Test since it has been saved to mode object (key) and the textfield should display the new value. But instead it always 'default' when it returns even though I check the model value was set to Test, the html markup input value=Test was not changed even though the model value has been set. Should it be this way? the value attribute of input element is not backed by model value? Thanks - 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: bookmarkable link keep recreate the objects.
I guess I need to read more docs and codes to understand so never mind. On Jan 22, 2008 7:09 PM, [EMAIL PROTECTED] wrote: The point is the model should be first absorbed/consumed by listview, and later provided to listitem. according to whom is this the point? -igor - 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: We are adopting Wicket in our Organization
I fully agree. I used JSF/SEAM before switching to Wicket. My experience is that Wicket is JSF-Done-Right As I've stated before in a previous post, I work a for a company that develops software for the health care industry. It was a battle between JSF/Seam and Wicket as the framework of choice for the rewrite of the company's portal. After a whitepaper written by a colleague of mine that compared the two implementations, Wicket was the clear winner. (I also presented a demo of the Wicket framework to the team a couple months back). I'd like to thank the authors of the framework for building such a fine tool. After years of struts development, developing web applications with Wicket is a breath of fresh air. Keep up the fine work. I'll update this forum with our experience in developing/deploying web apps using Wicket. - rm3 -- View this message in context: http://www.nabble.com/We-are-adopting-Wicket-in-our-Organization-tp14988751p149 88751.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]
bookmarkable link keep recreate the objects.
Hi: On a Home page menu bar, I put a FAQ link add(new Bookmarkablelinl(id,FAQ.class) it is not an external static html file link since it would includes a few other bookmarkable links/buttons. It is content does not change, but in the same session, say every second, when I click on the FAQ link, a new FAQ object is created and content is resent to browser even if the content is the same. FAQ.html template is basically static except a few wicket:link. This is obviouly a huge performance issue. What would be the best way to resolve this. So far, Wicket's link handling has been the biggest issue compared to more convertional approaches but I guess I am just not getting it well enough. Thanks
RE: bookmarkable link keep recreate the objects.
To simpplify the issue, Consider the following Home.html html span wicket:id=text//html Home.java add(new Label(text, StaticText) Everytime the home page is accessed, Home.java is created anew and so is the text label even though the content should remain the same through the session. How can I make the Home page object reusable for each user seassion after the first access. Hi: On a Home page menu bar, I put a FAQ link add(new Bookmarkablelinl(id,FAQ.class) it is not an external static html file link since it would includes a few other bookmarkable links/buttons. It is content does not change, but in the same session, say every second, when I click on the FAQ link, a new FAQ object is created and content is resent to browser even if the content is the same. FAQ.html template is basically static except a few wicket:link. This is obviouly a huge performance issue. What would be the best way to resolve this. So far, Wicket's link handling has been the biggest issue compared to more convertional approaches but I guess I am just not getting it well enough. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bookmarkable link keep recreate the objects.
Thanks. I looked that source of the staticpages examples and even more troubled with it. It generates each static links via a costly markup object creation and attribute modification. In a base template page that may contain,say 50 such links, that would be displayed for all site (bookmarkable) pages, it would mean a lot of object creation/destruction just for a static markup. I saw a post about running out of wicket memory during stress test. I had quite a few times noticing the turnaround is quite slow in my app even though it is just a page with many constructed links, even though I do not have test suite to back it up. Would it be possible to turn a bookmarkale/stateless page object into a stateful page during a session once user first access it. After all, bookmarkable page link is for accessing the page when you return to it after ,say a few days. Once you access/create it, during the session, it should be considered a stateful. This is obviouly a huge performance issue. I wonder if it is. Java is optimized for creating objects, and creating new ones is often cheaper than reusing old ones if you take synchronization and lookups into account. Are you sure it is a bottleneck? If you haven't seen any actual performance problems (and determined that it is the web tier causing it, which is often unlikely given that accessing the back-end such as databases often take the majority of the processing of a request) you'd be wasting your time. Premature optimization is evil :-) If you're still unconvinced, take a look at org.apache.wicket.examples.staticpages in wicket-examples; it might do what you want. Eelco - 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: bookmarkable link keep recreate the objects.
Would it be possible to turn a bookmarkale/stateless page object into a stateful page during a session once user first access it. these pages are not created until accessed...so not sure what you mean I meant once they are created, accessing it again (say hit refresh button on browser) should not result in a new page object recreation, instead using a way to locate the previous created object and rerender it as in a stateful page. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bookmarkable link keep recreate the objects.
I see. I guess I need to dig through more info on usage of api. But I just noticed the following perhaps you can point out surprising (to me) issue right away. It is a simple list view display with class Test{ PageableListView listView = new PageableListView(records, new PropertyModel(this, records), rowsPerPage) { public void populateItem(final ListItem listItem) { final Object record = listItem.getModelObject(); public List getRecords(){ return a record list from db query } } what I noticed that for each populateItem call, it would invokes getRecords() (perhaps with further indexing). So it I have 1000 records in db, it would issue 1000 query for the same result list. What I am doing wrong here? I basically took an example class from wicket website and replace the fixed record list with a db query and could not explain the extreem slowness until I found out this problem. you are free to write your own coding strategy that checks for existence of these pages in session before creating a new instance. -igor On Jan 21, 2008 6:01 PM, [EMAIL PROTECTED] wrote: Would it be possible to turn a bookmarkale/stateless page object into a stateful page during a session once user first access it. these pages are not created until accessed...so not sure what you mean I meant once they are created, accessing it again (say hit refresh button on browser) should not result in a new page object recreation, instead using a way to locate the previous created object and rerender it as in a stateful page. - 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: bookmarkable link keep recreate the objects.
Got it. On Jan 21, 2008 6:32 PM, [EMAIL PROTECTED] wrote: I see. I guess I need to dig through more info on usage of api. But I just noticed the following perhaps you can point out surprising (to me) issue right away. It is a simple list view display with class Test{ PageableListView listView = new PageableListView(records, new PropertyModel(this, records), rowsPerPage) { public void populateItem(final ListItem listItem) { final Object record = listItem.getModelObject(); public List getRecords(){ return a record list from db query } } The idea behind PageableListView is that it is backed by a list that understands how to page. See for instance http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-stuff/branches/WICKET_1_2 /wicket-contrib-data/src/java/wicket/contrib/data/model/PageableList.java?view= markup However, nowadays IDataProvider and the repeaters that use it are a better alternative to PageableListViews, amongst other reasons because the paging is more explicit. Eelco - 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: bookmarkable link keep recreate the objects.
Thanks for the tip. It worked perfectly. I do feel this could be a minor bug even for a fixed list (might not be noticeable visually). At the time ListView is created, it is provided with a predefined model object =this.getRecords() which should be the state of the listview and this.getModel should directly return this state. This is probably due to the program idiom used. wicket is doing exactly what you told it to do you call final Object record = listItem.getModelObject(); 1000 times which in turns calls listviewmodel.getobject().get(index); where index varies from 1 to 1000 listviewmodel is PropertyModel(this, records) so when its getobject() is called (1000 times) it calls getrecords() method thus your getrecords is called 1000 times - just like you have it setup. you should read up on detachable models and loadable models - models that cache a value for the duration of a request. for example, if you replace new PropertyModel(this, records) with new LoadableDetachableModel() { Object load() { return getRecords(); }} getRecords() would only be called once per request. also if you have read the javadoc of ListView you would have noticed that it does not recommend using ListView with database driven data. ListView is made to work with lists. in a list an item is identified by its index, in a database rowset an item is identified by its primary key. you took an example that uses static data where getrecords() is a cheap call and expect it to work with database data without modifications - where getrecords() is an expensive call, dont you think that is silly? if you want to display database data i would look into DataView and DataTable. there are plenty examples in http://wicketstuff.org/wicket13/repeater/ -igor On Jan 21, 2008 6:32 PM, [EMAIL PROTECTED] wrote: I see. I guess I need to dig through more info on usage of api. But I just noticed the following perhaps you can point out surprising (to me) issue right away. It is a simple list view display with class Test{ PageableListView listView = new PageableListView(records, new PropertyModel(this, records), rowsPerPage) { public void populateItem(final ListItem listItem) { final Object record = listItem.getModelObject(); public List getRecords(){ return a record list from db query } } what I noticed that for each populateItem call, it would invokes getRecords() (perhaps with further indexing). So it I have 1000 records in db, it would issue 1000 query for the same result list. What I am doing wrong here? I basically took an example class from wicket website and replace the fixed record list with a db query and could not explain the extreem slowness until I found out this problem. you are free to write your own coding strategy that checks for existence of these pages in session before creating a new instance. -igor On Jan 21, 2008 6:01 PM, [EMAIL PROTECTED] wrote: Would it be possible to turn a bookmarkale/stateless page object into a stateful page during a session once user first access it. these pages are not created until accessed...so not sure what you mean I meant once they are created, accessing it again (say hit refresh button on browser) should not result in a new page object recreation, instead using a way to locate the previous created object and rerender it as in a stateful page. - 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] - 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]
How to redisplay a previous/known page
Hello: in a call back, I'd like to setResponsePage(A Page that had been displayed/created already) for example, redisplay the home page without having to do things like setResponsePage(new HomePage(params)), rather, I'd like to retrieved the HomePage object that has already been created when user accessed it the first time. Basically how to locate the page object based on class/link name. BTW, Is it possible to make the page object stateless when using setResponsePage(pageObject). so that pageObject would not be serialized/saved? for performance? I read that using setResponsePage(Home.class) would make a non-session object of Home, but setResponsePage(new Home(obj)) would make home object saved in session.
a rolling display label component
Hello: I wonder if wicket already has a component that would display a list of text every n seconds, with the text list predefined (not ajax call every n second) so that I could use a java call like new NeonLabel(id,ListModel({ab, cd,ef}, Nseconds) so that web page would display ab and cd and ef and ab every N seconds. I have done that in raw javascript but wonder if wicket already has such a component? Thanks
Re: a rolling display label component
Using ajaxtimer would mean an ajax call to server to get next data? That is not what I want as the data are fixed and I'd want them loaded in html once and a javascript would auto display them in turn without ever going back to server. use a label and a ajaxtimer... [EMAIL PROTECTED] wrote: Hello: I wonder if wicket already has a component that would display a list of text every n seconds, with the text list predefined (not ajax call every n second) so that I could use a java call like new NeonLabel(id,ListModel({ab, cd,ef}, Nseconds) so that web page would display ab and cd and ef and ab every N seconds. I have done that in raw javascript but wonder if wicket already has such a component? Thanks -- Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - 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]
how to logout and redirect
Hi: I used the following for logout Logout extend WebPage{ getSession().invalidateNow() getResponse().redirect(.) When the link is clicked, it says Already redirecting to . Cannot redirect more than once What would be the solution. (interestingly, the above worked a while ago) Now I am using 1.3 final. BTW, I tried adding a button inside a form and use onSubmit callback instead of the normal submit type. The button does not respond at all and the html code shows there is not any way that the browser would send back request. form input type=button value=cancel /form in Java new button(){onSubmit()) A lot of surprises once getting into more in Wicket Thanks
Re: TreeGrid and DataGrid open source
Hi, I like it too. But I am seeing a bizzare problem on IE (not firefox) When I put a simple gridview in the one section of my existing webpage, The cursor keep blinking with busy shape and stretch the gridview display horizontally and never end. I saw many javascripts included so I'd think some ajax updating occurring? but why it change the display width? There could be some conflict of css but what updating the layout? Can it be disabled? Thanks -Ted Glad you like it :) -Matej On Jan 12, 2008 2:31 AM, Edward Yakop [EMAIL PROTECTED] wrote: On Jan 12, 2008 9:08 AM, Matej Knopp [EMAIL PROTECTED] wrote: The beta downloads and live demo are available at http://www.inmethod.com . It's very nice :) Regards, Edward Yakop - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Resizable and reorderable grid components. http://www.inmethod.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: difference between ListView and DefaultDataTable
Thanks. At first, I actually use a form to encapulate the the table and tried to use new Button. It did not work. It appears it has to be a panel. If you look at the markup in DataTable.html, you see from tbody tr wicket:id=rows td wicket:id=cells span wicket:id=cell[cell]/span /td /tr /tbody that the markup for cells is a span tag. A link cannot work with this markup, so you can either: a) populate the cell with a panel containing the link (panel can use the span tag) b) make your own data table subclass which has a link in every cell. Since you probably want to not only show links, you'll have to go with a) Thomas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Dienstag, 15. Januar 2008 07:56 To: users@wicket.apache.org Subject: difference between ListView and DefaultDataTable Hello: When I use ListView with each row having an Edit link I use new Link() { callback handler), which is very handy. How to do the same in DefaultDataTable? I tried to use new AbstractDataColumn { populateItem{ item.add(new Link(..) { callback} but it would not work. From what I read, a panel has to be used, Can it be done? Thanks - 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: TreeGrid and DataGrid open source
Hello, Matej: I spent 3 hour trying to find out why. I still did not know why but I found out how to avoid it. The problem occurred as I put the grid component inside table td once I move it out of the table, Everything works fine. Never seen this kind of things. Perhaps some css/javascript tries to recalculate the size of the cell? Thanks There is no ajax update going on while resizing the layout. I'd need a quickstart to be able to say more. -Matej On Jan 15, 2008 10:52 AM, [EMAIL PROTECTED] wrote: Hi, I like it too. But I am seeing a bizzare problem on IE (not firefox) When I put a simple gridview in the one section of my existing webpage, The cursor keep blinking with busy shape and stretch the gridview display horizontally and never end. I saw many javascripts included so I'd think some ajax updating occurring? but why it change the display width? There could be some conflict of css but what updating the layout? Can it be disabled? Thanks -Ted Glad you like it :) -Matej On Jan 12, 2008 2:31 AM, Edward Yakop [EMAIL PROTECTED] wrote: On Jan 12, 2008 9:08 AM, Matej Knopp [EMAIL PROTECTED] wrote: The beta downloads and live demo are available at http://www.inmethod.com . It's very nice :) Regards, Edward Yakop - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Resizable and reorderable grid components. http://www.inmethod.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] -- Resizable and reorderable grid components. http://www.inmethod.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: TreeGrid and DataGrid open source
If I change wicket:extenddiv wickid:id=grid/ to span wicket:id=grid/ the problem goes away even if I put it inside td of course, the display loses style. So looks like it is a css issue. below is the what in the source html td id=content wicket:childwicket:extend div class=imxt-grid imxt-vista wicket:id=grid id=grid7wicket:panel !-- This is used to size the data table properly in Internet explorer -- div class=imxt-container1 id=main div class=imxt-top-toolbar-container /div div class=imxt-head-container There is no ajax update going on while resizing the layout. I'd need a quickstart to be able to say more. -Matej On Jan 15, 2008 10:52 AM, [EMAIL PROTECTED] wrote: Hi, I like it too. But I am seeing a bizzare problem on IE (not firefox) When I put a simple gridview in the one section of my existing webpage, The cursor keep blinking with busy shape and stretch the gridview display horizontally and never end. I saw many javascripts included so I'd think some ajax updating occurring? but why it change the display width? There could be some conflict of css but what updating the layout? Can it be disabled? Thanks -Ted Glad you like it :) -Matej On Jan 12, 2008 2:31 AM, Edward Yakop [EMAIL PROTECTED] wrote: On Jan 12, 2008 9:08 AM, Matej Knopp [EMAIL PROTECTED] wrote: The beta downloads and live demo are available at http://www.inmethod.com . It's very nice :) Regards, Edward Yakop - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Resizable and reorderable grid components. http://www.inmethod.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] -- Resizable and reorderable grid components. http://www.inmethod.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]
difference between ListView and DefaultDataTable
Hello: When I use ListView with each row having an Edit link I use new Link() { callback handler), which is very handy. How to do the same in DefaultDataTable? I tried to use new AbstractDataColumn { populateItem{ item.add(new Link(..) { callback} but it would not work. From what I read, a panel has to be used, Can it be done? Thanks
Re: How to display as is
Thanks for the quick response. That solves the problem. What do you mean that browser displays as amp;? Is it in source code? Because that is right. The needs to be escaped, but unless your browser is broken the user should never see amp; unless he looks to source code. Anyway, label.setEscapeModelStrings(false) prevents wicket from escaping it. -Matej On Jan 13, 2008 1:35 PM, [EMAIL PROTECTED] wrote: Hello: I use Label(id, A B) and the is supposed to be kept as is since it is what the title would read. but the browser displays A amp; B What should I do to avoid this? Thanks -- Resizable and reorderable grid components. http://www.inmethod.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]
How to display as is
Hello: I use Label(id, A B) and the is supposed to be kept as is since it is what the title would read. but the browser displays A amp; B What should I do to avoid this? Thanks