Re: Issue with panel ,model refresh
The examples for 1.5.x are online again. On Tue, Jan 29, 2013 at 8:54 AM, Martin Grigorov mgrigo...@apache.orgwrote: The examples for 6.x are OK - http://www.wicket-library.com/wicket-examples-6.0.x/index.html I'll see what is the problem with 1.5.x On Tue, Jan 29, 2013 at 1:31 AM, Paul Bors p...@bors.ws wrote: Unfortunately the live wicket examples for the component references is offline right now so I can't point you to an Ajax example :( http://www.wicket-library.com/wicket-examples/compref/ But take a look at: http://wicket.apache.org/learn/examples/ajaxcounter.html Your code is too complex to follow for me to understand what you're doing wrong. Try simplifying the problem with the least code possible. ~ Thank you, Paul Bors On Mon, Jan 28, 2013 at 4:36 PM, mohallo moha...@qwest.com wrote: It works for the Label .Trying to implement the same for the Panel . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: JQuery - best practice
Hi Ernesto, Hi Martin, IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance For this point, I was not sure whether to make a WebMarkupContainer or a Panel that, you are true, force the inheritance. But actually the main discussion here is... Is it the role of a Behavior to handle callbacks or it is the role of a Wicket component to handle these, or both. I thought about this at the beginning of the project. I wanted to have a component oriented API, as Wicket is, and to be the closest as possible in term of phylosophy and coding pratice. My conclusion was that, but maybe am I wrong, that it is the responsibility of the Component to handle callbacks, not the Behavior. (but in another hand, Wicket's Behavior are exposing callback sometimes, but mainly Components are doing so) Sure, it is not a big redesign to make both the Component and the Behavior to handle callback, but I would like to be sure it fit Wicket's philosophy. Ernesto, thanks for your input. I would like other inputs on that subject before changing the way the API is designed. Best regards, Sebastien. On Tue, Jan 29, 2013 at 8:09 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: HI On Tue, Jan 29, 2013 at 8:05 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Tue, Jan 29, 2013 at 7:55 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Jan 29, 2013 at 7:31 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Tue, Jan 29, 2013 at 12:38 AM, Sebastien seb...@gmail.com wrote: Hi Pieter, I added the ResizablePanel component and deployed the snapshot release (wicket-jquery-ui-core-6.2.1-SNAPSHOT) You may find how it works on the demo site: http://www.7thweb.net/wicket-jquery-ui/resizable/ResizablePanelPage IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance. On wiquery this is done as an adapter that is passed to a behavior. There is a behavior is as well: http://www.7thweb.net/wicket-jquery-ui/resizable/DefaultResizablePage does seem --- DOES NOT SEEM. below... mornings:-() Yes I have looked at the behavior example as well... but behavior does seem to support (at least at the example) to plug in anything to make it listen to resize call backs. Maybe it does and it isn't shown at the code... Well my point is that it makes more sense to have this as an adapter added to a behavior than having a panel. E.g. You a have a data table that you want to make resizable and want to remember new sizes at server side... Panel won't help you there. I hope it will suit your use case, do not hesitate to come back to me if you have any questions... Best regards, Sebastien. On Mon, Jan 28, 2013 at 1:19 PM, Sebastien seb...@gmail.com wrote: Hi Pieter, hi Martin, As you are using wicket 6 and wicket-jquery-ui 6, there is no version conflict because wicket-jquery-ui relies on wicket's embedded jquery core, so there is only one reference of jquery-js But a problem may arise: - if you are youself using a version of jquery core javascript, for other needs. - if you are using severals jquery ui integrations. The conflict may occurs with jquery-ui javascript library (probably not with the jquery core), you have to provide you own jquery-ui JSRR, as Martin mentioned, and remove these used by the integrations. Caution, if you prefer to remove the JSRR of only one integration (using the code I provide earlier) and let the one of another integration, you will get into trouble if you use a component of the first integration but none of the second integration on a same page, because no jquery-ui javascript library will be rendered in that case... Best regards, Sebastien. On Mon, Jan 28, 2013 at 12:58 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi Pieter, Both Wicket and the libraries which integrate with jQuery UI provide ways to setup custom JavaScriptResourceReference (JSRR) that loads jquery.js. The easiest way is to tell the jquery-ui integration library to not contribute its JSRR at all. Only Wicket will contribute it. If for some reason you need different version of jquery.js than the one that comes with Wicket itself then you can use the APIs explained by Sebastien to use your custom JSRR. Wicket is smart enough to filter several contributions of the same resource and actually render it just once. On Mon, Jan 28, 2013 at 1:35 PM, Pieter Claassen pie...@musmato.com wrote: Sebastien, So by
Re: JQuery - best practice
Hi Sebastien, I think the more flexible way is to have the callbacks in the behavior: class ResizeableBehavior extends JQueryAjaxBehavior { protected void onAjax(AjaxRequestTarget target) { int top, left, width, height = ...; // use the request parameters to extract the values onResize(target, top, left, width, height) } protected /*abstract*/ void onResize(AjaxRequestTarget target, int top, int left, int width, int height) {} } This way any component can make use of it: class MyComponent extends AnyOtherComponent { add(new ReziseBehavior() { @Override protected void onResize(...) { MyComponent.this.onResize(...) } }) protected void onResize(AjaxRequestTarget target, int top, int left, int width, int height) {} } On Tue, Jan 29, 2013 at 10:26 AM, Sebastien seb...@gmail.com wrote: Hi Ernesto, Hi Martin, IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance For this point, I was not sure whether to make a WebMarkupContainer or a Panel that, you are true, force the inheritance. But actually the main discussion here is... Is it the role of a Behavior to handle callbacks or it is the role of a Wicket component to handle these, or both. I thought about this at the beginning of the project. I wanted to have a component oriented API, as Wicket is, and to be the closest as possible in term of phylosophy and coding pratice. My conclusion was that, but maybe am I wrong, that it is the responsibility of the Component to handle callbacks, not the Behavior. (but in another hand, Wicket's Behavior are exposing callback sometimes, but mainly Components are doing so) Sure, it is not a big redesign to make both the Component and the Behavior to handle callback, but I would like to be sure it fit Wicket's philosophy. Ernesto, thanks for your input. I would like other inputs on that subject before changing the way the API is designed. Best regards, Sebastien. On Tue, Jan 29, 2013 at 8:09 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: HI On Tue, Jan 29, 2013 at 8:05 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Tue, Jan 29, 2013 at 7:55 AM, Martin Grigorov mgrigo...@apache.org wrote: On Tue, Jan 29, 2013 at 7:31 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Tue, Jan 29, 2013 at 12:38 AM, Sebastien seb...@gmail.com wrote: Hi Pieter, I added the ResizablePanel component and deployed the snapshot release (wicket-jquery-ui-core-6.2.1-SNAPSHOT) You may find how it works on the demo site: http://www.7thweb.net/wicket-jquery-ui/resizable/ResizablePanelPage IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance. On wiquery this is done as an adapter that is passed to a behavior. There is a behavior is as well: http://www.7thweb.net/wicket-jquery-ui/resizable/DefaultResizablePage does seem --- DOES NOT SEEM. below... mornings:-() Yes I have looked at the behavior example as well... but behavior does seem to support (at least at the example) to plug in anything to make it listen to resize call backs. Maybe it does and it isn't shown at the code... Well my point is that it makes more sense to have this as an adapter added to a behavior than having a panel. E.g. You a have a data table that you want to make resizable and want to remember new sizes at server side... Panel won't help you there. I hope it will suit your use case, do not hesitate to come back to me if you have any questions... Best regards, Sebastien. On Mon, Jan 28, 2013 at 1:19 PM, Sebastien seb...@gmail.com wrote: Hi Pieter, hi Martin, As you are using wicket 6 and wicket-jquery-ui 6, there is no version conflict because wicket-jquery-ui relies on wicket's embedded jquery core, so there is only one reference of jquery-js But a problem may arise: - if you are youself using a version of jquery core javascript, for other needs. - if you are using severals jquery ui integrations. The conflict may occurs with jquery-ui javascript library (probably not with the jquery core), you have to provide you own jquery-ui JSRR, as Martin mentioned, and remove these used by the integrations. Caution, if you prefer to remove the JSRR of only one integration (using the code I provide earlier) and let the one of another integration, you will get into trouble if you use a component of the first integration but none of the second integration on a same page, because no jquery-ui javascript library will be
Re: JQuery - best practice
Hi, On Tue, Jan 29, 2013 at 10:26 AM, Sebastien seb...@gmail.com wrote: Hi Ernesto, Hi Martin, IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance For this point, I was not sure whether to make a WebMarkupContainer or a Panel that, you are true, force the inheritance. But actually the main discussion here is... Is it the role of a Behavior to handle callbacks or it is the role of a Wicket component to handle these, or both. I thought about this at the beginning of the project. I wanted to have a component oriented API, as Wicket is, and to be the closest as possible in term of phylosophy and coding pratice. My conclusion was that, but maybe am I wrong, that it is the responsibility of the Component to handle callbacks, not the Behavior. (but in another hand, Wicket's Behavior are exposing callback sometimes, but mainly Components are doing so) Sure, it is not a big redesign to make both the Component and the Behavior to handle callback, but I would like to be sure it fit Wicket's philosophy. Ernesto, thanks for your input. I would like other inputs on that subject before changing the way the API is designed. As Martin already pointed out Behavior approach is more flexible and reusable... This approach is used all over wicket core. E.g. public AjaxCheckBox(final String id) { this(id, null); } public AjaxCheckBox(final String id, final IModelBoolean model) { super(id, model); setOutputMarkupId(true); add(new AjaxFormComponentUpdatingBehavior(click) { private static final long serialVersionUID = 1L; @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCheckBox.this.updateAjaxAttributes(attributes); } @Override protected void onUpdate(AjaxRequestTarget target) { AjaxCheckBox.this.onUpdate(target); } }); } protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { } protected abstract void onUpdate(AjaxRequestTarget target); In your case I would use something like add(new ResizableBehavior().addEndResizeListener( new IResiseListener() { public void onResize(AjaxRequestTarget targe) { } })); This way listening to resize is just a decorator you added to resize behavior... The JAVAScrip and server side hooks to process resize will only be added if you register a listener. Having this behavior implementing ResizablePanel can be left to the users... or just be an example on your page By the way nice demo app! We lack something like that for wiquery! I have tried to roll out some demo for some wiquery extensions here http://antiliasoft.com/wiquery-plugins/ But never got to include core UI componets. -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia
Re: JQuery - best practice
Hi Ernesto, Hi Martin, Thank you very much for your inputs!! Then, I agree on the architecture, and will generalize this, as part of the upgrade to jQuery UI 1.10. @Ernesto, glad to read you like the demo app! :) I would like to redesign it in a little bit more sexy way, but I don't do what I want with the time... (unfortunately) What does prevent you to make a demo of wiquery components? Lack of time? Or is it a technical issue? (your server seems to be IIS7 - with a nice 404 at root by the way) If this is this second case, and if you do not have your own server already, maybe can I host your webapp if you need/wish... Feel free to contact me in PM about this. Best regards, Sebastien. On Tue, Jan 29, 2013 at 10:48 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi, On Tue, Jan 29, 2013 at 10:26 AM, Sebastien seb...@gmail.com wrote: Hi Ernesto, Hi Martin, IMHO, it would make more sense to have that feature as a behavior instead of a panel... that way you are not forcing an inheritance For this point, I was not sure whether to make a WebMarkupContainer or a Panel that, you are true, force the inheritance. But actually the main discussion here is... Is it the role of a Behavior to handle callbacks or it is the role of a Wicket component to handle these, or both. I thought about this at the beginning of the project. I wanted to have a component oriented API, as Wicket is, and to be the closest as possible in term of phylosophy and coding pratice. My conclusion was that, but maybe am I wrong, that it is the responsibility of the Component to handle callbacks, not the Behavior. (but in another hand, Wicket's Behavior are exposing callback sometimes, but mainly Components are doing so) Sure, it is not a big redesign to make both the Component and the Behavior to handle callback, but I would like to be sure it fit Wicket's philosophy. Ernesto, thanks for your input. I would like other inputs on that subject before changing the way the API is designed. As Martin already pointed out Behavior approach is more flexible and reusable... This approach is used all over wicket core. E.g. public AjaxCheckBox(final String id) { this(id, null); } public AjaxCheckBox(final String id, final IModelBoolean model) { super(id, model); setOutputMarkupId(true); add(new AjaxFormComponentUpdatingBehavior(click) { private static final long serialVersionUID = 1L; @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); AjaxCheckBox.this.updateAjaxAttributes(attributes); } @Override protected void onUpdate(AjaxRequestTarget target) { AjaxCheckBox.this.onUpdate(target); } }); } protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { } protected abstract void onUpdate(AjaxRequestTarget target); In your case I would use something like add(new ResizableBehavior().addEndResizeListener( new IResiseListener() { public void onResize(AjaxRequestTarget targe) { } })); This way listening to resize is just a decorator you added to resize behavior... The JAVAScrip and server side hooks to process resize will only be added if you register a listener. Having this behavior implementing ResizablePanel can be left to the users... or just be an example on your page By the way nice demo app! We lack something like that for wiquery! I have tried to roll out some demo for some wiquery extensions here http://antiliasoft.com/wiquery-plugins/ But never got to include core UI componets. -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia
Re: JQuery - best practice
Hi, On Tue, Jan 29, 2013 at 1:16 PM, Sebastien seb...@gmail.com wrote: Hi Ernesto, Hi Martin, Thank you very much for your inputs!! Then, I agree on the architecture, and will generalize this, as part of the upgrade to jQuery UI 1.10. @Ernesto, glad to read you like the demo app! :) I would like to redesign it in a little bit more sexy way, but I don't do what I want with the time... (unfortunately) Demo is already quite nice as it is! What does prevent you to make a demo of wiquery components? Lack of time? Lack of time mainly: I'm twice father, once husband, I'm also getting old and I need to earn some money by the end of the month;-)... Seriously, whenever I have a bit of free time I do prefer to fix something or add a new feature than creating a demo... Or is it a technical issue? (your server seems to be IIS7 - with a nice 404 at root by the way) Yes! I have to fix that when I find some time. It should point to http://antiliasoft.com/antilia/ which isn't finished either... If this is this second case, and if you do not have your own server already, maybe can I host your webapp if you need/wish... Feel free to contact me in PM about this. Thank you very much for your offer! I'm already paying for that (modest) hosting myself. -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia
Select, Option and equals()
Hi all, I'm using Select/SelectOptions with model-objects that have a semantic equality but their #equals() method is not overriden :/. What is the recommended way to the have the correct option preselected, given that I cannot add #equals() to the implementation? Select#isSelected() has package access only, Select#compareModels() uses #equals() on the model-object and is private currently. Thanks Sven - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Pages, Panels, and Dependency Injection
OK... but how do I pass the current UserBean from one page to another? I cannot bind it to Guice as I don't know what it is when I'm setting up my Guice Module. Currently I used setRedirectPage(new MyPage(currentUser)). From what I understand you're saying I can switch to setRedirectPage(MyPage.class), but then how do I set the UserBean property for that instance? Should these types of values be passed via the session instead? So I simply use setRedirectPage(MyPage.class), then inside that class get the current user from the session? The overall question is, what is the best practice for passing values to a WebPage from another WebPage via setRedirectPage()? Should you create a new instance of the page, or let Wicket do it via reflection? And if Wicket is doing it, then how do I inject the value? Thanks... Bill- On Tue, Jan 29, 2013 at 2:50 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, You can do something like: class MyPage extends WebPage { @Inject private DAO dao; @Inject @Nullable private UserBean currentUser; ... // use dao or currentUser anywhere in your class } And Guice will try to inject these beans if they are defined in a Guice module. See https://code.google.com/p/google-guice/wiki/UseNullable On Tue, Jan 29, 2013 at 2:27 AM, Bill Speirs bill.spe...@gmail.com wrote: Still struggling with how to do this. Martin, I understand that most people will simply call new PanelA and new PanelB inside their MyPage code instead of trying to inject them. However, how does one setup a page that requires some service (DAO for example) and that might optionally require a UserBean. So without using DI, I'd simply have 2 constructors: MyPage(DAO myDao) MyPage(DAO myDao, UserBean currentUser) But I cannot create that second constructor as I don't have anything to bind (using Guice terms) UserBean to. Am I required to make a factory for MyPage at that point? Is it bad/wrong to pass the UserBean into the constructor via a response page: setResponsePage(new MyPage(new DAO(), currentUser)); Thanks... Bill- On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Most of the time people inject services to their components. To test just components you can use WicketTester#startComponentInPage() methods. On Fri, Nov 30, 2012 at 3:18 AM, William Speirs wspe...@apache.org wrote: I'm having trouble understanding how to inject components into a page so that the page will be easy to unit test later. Say I have a page that contains two panels. I can easily use constructor injection to inject these panels into the page: class MyPage extends WebPage { @Inject public MyPage(PanelA a, PanelB b) { ... } } The problem is that all Panels require an id during construction.[1] How do I supply the id to my Panels? I could simply construct every PanelA with an id of panela and every PanelB with an id of panel, but that doesn't seem very flexible. What do other people do in this situation? The hope would be to pass mocked panels into the page during unit testing, the separately test each panel. What if instead of a panel it was a button where the onSubmit method must be specified by overriding the method. How does one go about injecting such a component so that it's still easy to test later in unit tests? All thoughts and/or best practices are greatly welcomed. For reference I'm using Guice as my dependency injection framework and GuiceWebApplicationFactory to inject components into pages. Thanks... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Pages, Panels, and Dependency Injection
Hi, Most people use the session approach. Keep an id (private key) as a field in the Wicket Session and load the real object on demand when needed. Similar solution is to make your bean Session scoped. The DI framework cares to extract it from the session for you. Some people prefer to be as stateless as possible and avoid using the session if possible. In this case you can use setResponsePage(Class, PageParameters) and transfer the id as a request parameter from page to page. The problem with setResponsePage(Page) is that it makes the page stateful and the ugly ?pageId appears in the url. If this doesn't bother you then it is very simple solution for your problem. On Tue, Jan 29, 2013 at 2:40 PM, Bill Speirs bill.spe...@gmail.com wrote: OK... but how do I pass the current UserBean from one page to another? I cannot bind it to Guice as I don't know what it is when I'm setting up my Guice Module. Currently I used setRedirectPage(new MyPage(currentUser)). From what I understand you're saying I can switch to setRedirectPage(MyPage.class), but then how do I set the UserBean property for that instance? Should these types of values be passed via the session instead? So I simply use setRedirectPage(MyPage.class), then inside that class get the current user from the session? The overall question is, what is the best practice for passing values to a WebPage from another WebPage via setRedirectPage()? Should you create a new instance of the page, or let Wicket do it via reflection? And if Wicket is doing it, then how do I inject the value? Thanks... Bill- On Tue, Jan 29, 2013 at 2:50 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, You can do something like: class MyPage extends WebPage { @Inject private DAO dao; @Inject @Nullable private UserBean currentUser; ... // use dao or currentUser anywhere in your class } And Guice will try to inject these beans if they are defined in a Guice module. See https://code.google.com/p/google-guice/wiki/UseNullable On Tue, Jan 29, 2013 at 2:27 AM, Bill Speirs bill.spe...@gmail.com wrote: Still struggling with how to do this. Martin, I understand that most people will simply call new PanelA and new PanelB inside their MyPage code instead of trying to inject them. However, how does one setup a page that requires some service (DAO for example) and that might optionally require a UserBean. So without using DI, I'd simply have 2 constructors: MyPage(DAO myDao) MyPage(DAO myDao, UserBean currentUser) But I cannot create that second constructor as I don't have anything to bind (using Guice terms) UserBean to. Am I required to make a factory for MyPage at that point? Is it bad/wrong to pass the UserBean into the constructor via a response page: setResponsePage(new MyPage(new DAO(), currentUser)); Thanks... Bill- On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Most of the time people inject services to their components. To test just components you can use WicketTester#startComponentInPage() methods. On Fri, Nov 30, 2012 at 3:18 AM, William Speirs wspe...@apache.org wrote: I'm having trouble understanding how to inject components into a page so that the page will be easy to unit test later. Say I have a page that contains two panels. I can easily use constructor injection to inject these panels into the page: class MyPage extends WebPage { @Inject public MyPage(PanelA a, PanelB b) { ... } } The problem is that all Panels require an id during construction.[1] How do I supply the id to my Panels? I could simply construct every PanelA with an id of panela and every PanelB with an id of panel, but that doesn't seem very flexible. What do other people do in this situation? The hope would be to pass mocked panels into the page during unit testing, the separately test each panel. What if instead of a panel it was a button where the onSubmit method must be specified by overriding the method. How does one go about injecting such a component so that it's still easy to test later in unit tests? All thoughts and/or best practices are greatly welcomed. For reference I'm using Guice as my dependency injection framework and GuiceWebApplicationFactory to inject components into pages. Thanks... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/panel/Panel.html -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com
Re: editable tree table: submit all changes at once
Sorry, I got the source code -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/editable-tree-table-make-an-editable-row-rather-than-an-editable-cell-tp4655768p4655879.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Select, Option and equals()
You can do that by using the decorator pattern : write a wrapper for the object and redefine equals and hashcode. François On Tue, Jan 29, 2013 at 2:38 PM, Sven Meier s...@meiers.net wrote: Hi all, I'm using Select/SelectOptions with model-objects that have a semantic equality but their #equals() method is not overriden :/. What is the recommended way to the have the correct option preselected, given that I cannot add #equals() to the implementation? Select#isSelected() has package access only, Select#compareModels() uses #equals() on the model-object and is private currently. Thanks Sven --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Select, Option and equals()
Ok, that would be a tedious solution ;). I think I would prefer an overrideable method in Select. Sven On 01/29/2013 04:04 PM, francois meillet wrote: You can do that by using the decorator pattern : write a wrapper for the object and redefine equals and hashcode. François On Tue, Jan 29, 2013 at 2:38 PM, Sven Meier s...@meiers.net wrote: Hi all, I'm using Select/SelectOptions with model-objects that have a semantic equality but their #equals() method is not overriden :/. What is the recommended way to the have the correct option preselected, given that I cannot add #equals() to the implementation? Select#isSelected() has package access only, Select#compareModels() uses #equals() on the model-object and is private currently. Thanks Sven --**--**- To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.orgusers-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
Re: editable tree table: submit all changes at once
Try to use that project out of the box, and if you find bugs or improvements feel free to contribute back :) It's better that way as it is mainted by a wide range of members rather than just your or your team. ~ Thank you, Paul Bors On Tue, Jan 29, 2013 at 9:54 AM, grazia grazia.russolass...@gmail.comwrote: Sorry, I got the source code -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/editable-tree-table-make-an-editable-row-rather-than-an-editable-cell-tp4655768p4655879.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issue with panel ,model refresh
Thank you sir! On Tue, Jan 29, 2013 at 3:04 AM, Martin Grigorov mgrigo...@apache.orgwrote: The examples for 1.5.x are online again. On Tue, Jan 29, 2013 at 8:54 AM, Martin Grigorov mgrigo...@apache.org wrote: The examples for 6.x are OK - http://www.wicket-library.com/wicket-examples-6.0.x/index.html I'll see what is the problem with 1.5.x On Tue, Jan 29, 2013 at 1:31 AM, Paul Bors p...@bors.ws wrote: Unfortunately the live wicket examples for the component references is offline right now so I can't point you to an Ajax example :( http://www.wicket-library.com/wicket-examples/compref/ But take a look at: http://wicket.apache.org/learn/examples/ajaxcounter.html Your code is too complex to follow for me to understand what you're doing wrong. Try simplifying the problem with the least code possible. ~ Thank you, Paul Bors On Mon, Jan 28, 2013 at 4:36 PM, mohallo moha...@qwest.com wrote: It works for the Label .Trying to implement the same for the Panel . -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655855.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Access, read and modify td Tag (cell tag) in Datatable
You were close, this is what I did to support ACC in simple tables: @Override protected ItemIColumnT newCellItem(final String id, final int index, final IModelIColumnT model) { ItemIColumnT item = super.newCellItem(id, index, model); item.add(new AttributeModifier(class, new ModelString(getCellStyleClass(; item.add(new AttributeModifier(headers, getAccHeaderId(index))); return item; } I guess you could pass the ItemIColumnT to your own getCellStyleClass() method and grab the model from that Item to decide what CSS to apply. ~ Thank you, Paul Bors On Tue, Jan 29, 2013 at 4:49 AM, brazz alexander.li...@man.eu wrote: Hi, I have a datatable, want to check a td element tag for a certain class attribute and add a class attribute in certain constellations (highlight cell items). Last option is to copy code from datatable and modify it, but not very nice. Ho can i access the cell items of the table? My datatable looks like this: i tried overriting newCellItem. But newCellItem never gets called. And in newRowItem i'm not able to access child elements (i'm able to add an AttributeModifier to the rowItem, but that's not enough, i need it for cell items). @Override protected ItemT newRowItem(String id, int index, IModelT model) { OddEvenItemT eventItem = new OddEvenItemT(id, index, model); eventItem.add(createOnclickBehavior(model, eventItem)); return eventItem; } @Override protected ItemT newCellItem(String id, int index, IModelT model) { // TODO Auto-generated method stub return super.newCellItem(id, index, model); } Many thanks for any suggestions! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Access-read-and-modify-td-Tag-cell-tag-in-Datatable-tp4655872.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issue with panel ,model refresh
Now that the live examples are back up, take a look at: http://www.wicket-library.com/wicket-examples/ajax/ To see how to swap out panels, see the Tabbed Panel example: http://www.wicket-library.com/wicket-examples/ajax/tabbed-panel?2 Have fun! ~ Thank you, Paul Bors - ~ Thank you, p...@bors.ws -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655885.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
display a set of data table
How can I display a set of DataTable. I don't known the tables number. es: T1|S1 T2|S1 T3|S1 1 23 23 2 1 23 23 2 1 23 23 2 1 23 23 2 1 23 23 2 bye -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-a-set-of-data-table-tp4655886.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: display a set of data table
Hi, Use another repeater, like RepeatingView or ListView, that has DataTable`s as children. On Tue, Jan 29, 2013 at 4:57 PM, lc991 lorenzoc...@live.it wrote: How can I display a set of DataTable. I don't known the tables number. es: T1|S1 T2|S1 T3|S1 1 23 23 2 1 23 23 2 1 23 23 2 1 23 23 2 1 23 23 2 bye -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-a-set-of-data-table-tp4655886.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Access, read and modify td Tag (cell tag) in Datatable
Thanks for your reply, there is only one method in class DataTable, but it is not called. Maybe it's because i work with wicket 1.4.7. protected ItemT newRowItem(final String id, int index, final IModelT model) { return new ItemT(id, index, model); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Access-read-and-modify-td-Tag-cell-tag-in-Datatable-tp4655872p4655888.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: display a set of data table
I create and inizialize a ListdefaultDataTable tables; then i create a ListView l = new ListView(list,table){ the problem is in the populateItem method of ListView. what should I write in this method. } excuse me for the bad english. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-a-set-of-data-table-tp4655886p4655889.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: display a set of data table
You should not make a list of DataTable objects but a list of data for the datatable. On Tue, Jan 29, 2013 at 5:06 PM, lc991 lorenzoc...@live.it wrote: I create and inizialize a ListdefaultDataTable tables; then i create a ListView l = new ListView(list,table){ the problem is in the populateItem method of ListView. what should I write in this method. } excuse me for the bad english. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/display-a-set-of-data-table-tp4655886p4655889.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: editable tree table: submit all changes at once
Why don't you just switch your code to use it and then put it to a test. See if it dose what you need, and if it's not then feel free to steal as much code from it as you please. I believe it's open source under the same license as Wicket (Apache 2.0). I don't use that particular editable tree table so I can't answer you directly, but I do use other components from Wicket Stuff. ~ Thank you, Paul Bors - ~ Thank you, p...@bors.ws -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/editable-tree-table-make-an-editable-row-rather-than-an-editable-cell-tp4655768p4655893.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Issue with panel ,model refresh
Thanks for your help . The only way I could get the getObject method called in the panel was by adding the getDefaultModelObject call in the Timer as follows . ajaxTimer = new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)){ public void onPostProcessTarget(AjaxRequestTarget target){ refreshPanel.getDefaultModelObject(); } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Issue-with-panel-model-refresh-tp4655775p4655894.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to disable ByteArrayResource cache?
ByteArrayResource pdfRes = new ByteArrayResource(application/pdf,myService.getPDF(); PopupSettings popupSettings = new PopupSettings(FILENAME, PopupSettings.RESIZABLE| PopupSettings.SCROLLBARS).setHeight(500).setWidth(700); ResourceLink pdfLink = (ResourceLink) new ResourceLink(pdfLink, pdfRes); pdfLink.setPopupSettings(popupSettings); I disable the page's cache but this resource still being cached. How can I disable resource cache? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-disable-ByteArrayResource-cache-tp4655897.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Introducing wicket-continuous-calendar
I needed a better way to select a data range and thus integrated Wicket 1.5.x with jQuery-Continuous-Calendar. http://Wicket-Continuous-Calendar.GoogleCode.com/ This is quite a young project so feel free to contribute. To see some life examples: http://reaktor.github.com/jquery-continuous-calendar/site/playground.html ~ Thank you, Paul Bors - ~ Thank you, p...@bors.ws -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Introducing-wicket-continuous-calendar-tp4655896.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Pages, Panels, and Dependency Injection
Webapps are excellent candidates for injecting into the 'thread' rather than providing every injectable class with its own special constructor (a lot of boring, mechanical work and problem not as run time efficient) and then setting up XML or annotations to configure the inject mechanisms. A simple servlet filter injects (attaches to) the thread on the way in to servicing the request and detaches from the thread on the way out. We created a very lightweight framework that uses thread injection for this purpose and it works magically and requires no special changes to UI or model code to work. It's called expojo (expose POJOs) and it's at expojo.com A 'ModelExposer' object is always available to any active thread via a call to ModelExposer.get(). The ModelExposer provides repositories (kind of like 'look up' DAOs that contain your query methods for your particular ORM) and services (DAOs that can make changes to the model). So from anywhere in your code you have access to all the repository and services you will every need. It's not the way Spring or Guice do it but it works really well and doesn't need any XML or annotations at all and doesn't require you change your model or UI objects. The exPOJO servlet also implements 'open session/persistence manager in view' so you can avoid all those nasty 'lazy load' exceptions with ease. -Original Message- From: Bill Speirs [mailto:bill.spe...@gmail.com] Sent: Tuesday, 29 January 2013 12:28 PM To: users@wicket.apache.org Subject: Re: Pages, Panels, and Dependency Injection Still struggling with how to do this. Martin, I understand that most people will simply call new PanelA and new PanelB inside their MyPage code instead of trying to inject them. However, how does one setup a page that requires some service (DAO for example) and that might optionally require a UserBean. So without using DI, I'd simply have 2 constructors: MyPage(DAO myDao) MyPage(DAO myDao, UserBean currentUser) But I cannot create that second constructor as I don't have anything to bind (using Guice terms) UserBean to. Am I required to make a factory for MyPage at that point? Is it bad/wrong to pass the UserBean into the constructor via a response page: setResponsePage(new MyPage(new DAO(), currentUser)); Thanks... Bill- On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Most of the time people inject services to their components. To test just components you can use WicketTester#startComponentInPage() methods. On Fri, Nov 30, 2012 at 3:18 AM, William Speirs wspe...@apache.org wrote: I'm having trouble understanding how to inject components into a page so that the page will be easy to unit test later. Say I have a page that contains two panels. I can easily use constructor injection to inject these panels into the page: class MyPage extends WebPage { @Inject public MyPage(PanelA a, PanelB b) { ... } } The problem is that all Panels require an id during construction.[1] How do I supply the id to my Panels? I could simply construct every PanelA with an id of panela and every PanelB with an id of panel, but that doesn't seem very flexible. What do other people do in this situation? The hope would be to pass mocked panels into the page during unit testing, the separately test each panel. What if instead of a panel it was a button where the onSubmit method must be specified by overriding the method. How does one go about injecting such a component so that it's still easy to test later in unit tests? All thoughts and/or best practices are greatly welcomed. For reference I'm using Guice as my dependency injection framework and GuiceWebApplicationFactory to inject components into pages. Thanks... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ma rkup /html/panel/Panel.html -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Pages, Panels, and Dependency Injection
@Martin sounds like session is the way to go because passing something as a page parameter means that the user could just simply change the ID to whatever they want... never trust the client :-) @Chris interesting project, I'll have to take a look. Thank you both! Bill- On Tue, Jan 29, 2013 at 8:13 PM, Chris Colman chr...@stepaheadsoftware.comwrote: Webapps are excellent candidates for injecting into the 'thread' rather than providing every injectable class with its own special constructor (a lot of boring, mechanical work and problem not as run time efficient) and then setting up XML or annotations to configure the inject mechanisms. A simple servlet filter injects (attaches to) the thread on the way in to servicing the request and detaches from the thread on the way out. We created a very lightweight framework that uses thread injection for this purpose and it works magically and requires no special changes to UI or model code to work. It's called expojo (expose POJOs) and it's at expojo.com A 'ModelExposer' object is always available to any active thread via a call to ModelExposer.get(). The ModelExposer provides repositories (kind of like 'look up' DAOs that contain your query methods for your particular ORM) and services (DAOs that can make changes to the model). So from anywhere in your code you have access to all the repository and services you will every need. It's not the way Spring or Guice do it but it works really well and doesn't need any XML or annotations at all and doesn't require you change your model or UI objects. The exPOJO servlet also implements 'open session/persistence manager in view' so you can avoid all those nasty 'lazy load' exceptions with ease. -Original Message- From: Bill Speirs [mailto:bill.spe...@gmail.com] Sent: Tuesday, 29 January 2013 12:28 PM To: users@wicket.apache.org Subject: Re: Pages, Panels, and Dependency Injection Still struggling with how to do this. Martin, I understand that most people will simply call new PanelA and new PanelB inside their MyPage code instead of trying to inject them. However, how does one setup a page that requires some service (DAO for example) and that might optionally require a UserBean. So without using DI, I'd simply have 2 constructors: MyPage(DAO myDao) MyPage(DAO myDao, UserBean currentUser) But I cannot create that second constructor as I don't have anything to bind (using Guice terms) UserBean to. Am I required to make a factory for MyPage at that point? Is it bad/wrong to pass the UserBean into the constructor via a response page: setResponsePage(new MyPage(new DAO(), currentUser)); Thanks... Bill- On Fri, Nov 30, 2012 at 3:35 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Most of the time people inject services to their components. To test just components you can use WicketTester#startComponentInPage() methods. On Fri, Nov 30, 2012 at 3:18 AM, William Speirs wspe...@apache.org wrote: I'm having trouble understanding how to inject components into a page so that the page will be easy to unit test later. Say I have a page that contains two panels. I can easily use constructor injection to inject these panels into the page: class MyPage extends WebPage { @Inject public MyPage(PanelA a, PanelB b) { ... } } The problem is that all Panels require an id during construction.[1] How do I supply the id to my Panels? I could simply construct every PanelA with an id of panela and every PanelB with an id of panel, but that doesn't seem very flexible. What do other people do in this situation? The hope would be to pass mocked panels into the page during unit testing, the separately test each panel. What if instead of a panel it was a button where the onSubmit method must be specified by overriding the method. How does one go about injecting such a component so that it's still easy to test later in unit tests? All thoughts and/or best practices are greatly welcomed. For reference I'm using Guice as my dependency injection framework and GuiceWebApplicationFactory to inject components into pages. Thanks... Bill- [1] http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ma rkup /html/panel/Panel.html -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to disable ByteArrayResource cache?
Hi, Override ByteArrayResource#configureResponse(final ResourceResponse response, final Attributes attributes) and do: response.setCacheDuration(Duration.NONE); On Wed, Jan 30, 2013 at 12:07 AM, Celia Xu wwx@gmail.com wrote: ByteArrayResource pdfRes = new ByteArrayResource(application/pdf,myService.getPDF(); PopupSettings popupSettings = new PopupSettings(FILENAME, PopupSettings.RESIZABLE| PopupSettings.SCROLLBARS).setHeight(500).setWidth(700); ResourceLink pdfLink = (ResourceLink) new ResourceLink(pdfLink, pdfRes); pdfLink.setPopupSettings(popupSettings); I disable the page's cache but this resource still being cached. How can I disable resource cache? Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-disable-ByteArrayResource-cache-tp4655897.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/