Re: [Wicket-user] constructors and on attach
On 9/16/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > It does one thing and one thing good: create a link to an already > existing page. We use it quite often in our apps. I'm +1(00) for the > constructor to stay. For what are you using it? Hopefully only for things like linking back to a page you passed in earlier. Which would easily be solved by: new Link(this, "back") { public void onClick() { setResponsePage(otherPage); } } and if you really use that a lot, create your own component: class MyPageLink extends Link { private final Page page; public MyPageLink(MarkupContainer parent, String id, Page page) { this.page = page; } public void onClick() { setResponsePage(page); } } That's not a lot of work, and at least the user would be fully aware of the consequences. > Read the docs and understand what you're doing. If we were to remove > everything that 'encourages' bad practice we wouldn't have a framework > left. Anything can and will be misused. Yeah, let's forget about private, final and all those things and let's just depend on the documentation. ;) Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
It does one thing and one thing good: create a link to an already existing page. We use it quite often in our apps. I'm +1(00) for the constructor to stay. Read the docs and understand what you're doing. If we were to remove everything that 'encourages' bad practice we wouldn't have a framework left. Anything can and will be misused. Martijn On 9/16/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > At the very least, I'd be +100 for removing the constructor with the > Page. The only thing that constructor does is encourage bad practice. > > Eelco > > > On 9/16/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > > PageLink also has constructors for a Class. > > A bookmarkable page link is what it says it creates a bookmarkable link But > > maybe you don't want that at all > > then you can use a PageLink and the PageLink class with the IPageLink param > > i the constructor is an easy think > > for lazy creating pages but directly with state. > > > > johan > > > > > > > > On 9/16/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote: > > > > > > > > > > > > > > > > > > > > > > Why would you even create the page while you're actually linking to > > > > it? E.g, when you do ( 2.0 code): > > > > > > > > > > > > > > > because he wants to link to a page, the obvious component is PageLink and > > it takes a Page instance in its contructor - so its the most obvious way to > > link to a page for a noob. you guys keep outvoting me on removing that > > constructor, but its just causing problems :) The whole class is not even > > necessary. You have Link and BookmarkableLink, implementing the auto-enable > > is as simple as overriding isenabled(). > > > > > > -Igor > > > > > > > > > > > > > > > > > - > > > Using Tomcat but need to do more? Need to support web services, security? > > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > ___ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > - > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
At the very least, I'd be +100 for removing the constructor with the Page. The only thing that constructor does is encourage bad practice. Eelco On 9/16/06, Johan Compagner <[EMAIL PROTECTED]> wrote: > PageLink also has constructors for a Class. > A bookmarkable page link is what it says it creates a bookmarkable link But > maybe you don't want that at all > then you can use a PageLink and the PageLink class with the IPageLink param > i the constructor is an easy think > for lazy creating pages but directly with state. > > johan > > > > On 9/16/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote: > > > > > > > > > > > > > > > Why would you even create the page while you're actually linking to > > > it? E.g, when you do ( 2.0 code): > > > > > > > > > > because he wants to link to a page, the obvious component is PageLink and > it takes a Page instance in its contructor - so its the most obvious way to > link to a page for a noob. you guys keep outvoting me on removing that > constructor, but its just causing problems :) The whole class is not even > necessary. You have Link and BookmarkableLink, implementing the auto-enable > is as simple as overriding isenabled(). > > > > -Igor > > > > > > > > > > > - > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
PageLink also has constructors for a Class.A bookmarkable page link is what it says it creates a bookmarkable link But maybe you don't want that at allthen you can use a PageLink and the PageLink class with the IPageLink param i the constructor is an easy think for lazy creating pages but directly with state.johanOn 9/16/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote: Why would you even create the page while you're actually linking toit? E.g, when you do ( 2.0 code):because he wants to link to a page, the obvious component is PageLink and it takes a Page instance in its contructor - so its the most obvious way to link to a page for a noob. you guys keep outvoting me on removing that constructor, but its just causing problems :) The whole class is not even necessary. You have Link and BookmarkableLink, implementing the auto-enable is as simple as overriding isenabled(). -Igor -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach 2
On 9/16/06, Scott Lusebrink <[EMAIL PROTECTED]> wrote: here is a sample of what i was doing, ( i don't have my code infront of me but i'll try to be close) new BookmarkableLink(new MyPage())new BookmarkableLink(MyPage.class); class MyPage public MyPage() {IModel choiceModel=new LoadableDetachableModel() { Object load() { return List options =DbUtil.getData() }}; List selected = new ArrayList() add(new Palette("palette",new Model(selected),choiceModel...) }now you dont create the page needlessly, and even if you do the data wont be loaded from db until the palette needs it.-Igor so if I have new bookmarkable link in a table wicket will go to the database and get data for every row of the table, instead of only getting the one set of data when you click the link. Hope this clearifize my problem -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach 2
Use new BookmarkableLink(MyPage.class); On 9/16/06, Scott Lusebrink <[EMAIL PROTECTED]> wrote: > > here is a sample of what i was doing, ( i don't have my code infront of me > but i'll try to be close) > new BookmarkableLink(new MyPage()) > > class MyPage > public MyPage() > { > List options =DbUtil.getData() > List selected = new ArrayList() > add(new Palette("palette",new Model(selected),new Mode(options)...) > } > > so if I have new bookmarkable link in a table wicket will go to the database > and get data for every row of the table, instead of only getting the one set > of data when you click the link. > > Hope this clearifize my problem > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > -- Download Wicket 1.2.2 now! New Ajax components: Tree, TreeTable and ModalWindow -- http://wicketframework.org - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] constructors and on attach 2
here is a sample of what i was doing, ( i don't have my code infront of me but i'll try to be close) new BookmarkableLink(new MyPage()) class MyPage public MyPage() { List options =DbUtil.getData() List selected = new ArrayList() add(new Palette("palette",new Model(selected),new Mode(options)...) } so if I have new bookmarkable link in a table wicket will go to the database and get data for every row of the table, instead of only getting the one set of data when you click the link. Hope this clearifize my problem - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
> because he wants to link to a page, the obvious component is PageLink and it > takes a Page instance in its contructor - so its the most obvious way to > link to a page for a noob. Erm. Maybe. I didn't get that from his email. > you guys keep outvoting me on removing that > constructor, but its just causing problems :) The whole class is not even > necessary. You have Link and BookmarkableLink, implementing the auto-enable > is as simple as overriding isenabled(). Huh? Who is 'you guys'? I don't remember a formal vote, and if there would have been any the last year I would have voted +1 for removal - certainly after we had setResponsePage. So start a vote then. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
Why would you even create the page while you're actually linking toit? E.g, when you do ( 2.0 code):because he wants to link to a page, the obvious component is PageLink and it takes a Page instance in its contructor - so its the most obvious way to link to a page for a noob. you guys keep outvoting me on removing that constructor, but its just causing problems :) The whole class is not even necessary. You have Link and BookmarkableLink, implementing the auto-enable is as simple as overriding isenabled(). -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] constructors and on attach
On 9/15/06, Scott Lusebrink <[EMAIL PROTECTED]> wrote: > I need a place where i can initialize a page, get data from the database and > set the models of my components. I assume I'm going to need the data before > i set the models. The models and the actual data they link to are different things. Wicket models are in fact locators for that data, and they will only be accessed (and attached if they are attachable) when needed. > I know some components constructors require models to be > passed in and can not be set later. Most default components do not though. Which ones are you referring to? Anyway, it doesn't matter much, as setting the model right on construction (either by passing into to the constructor using setModel) is the best practice. But you don't have to have the actual data yet. > The problem with doing this work in the > constructor is that when I"m making links to this page from somewhere else > it will run all this database work when your on the page that links to it. > (This really slows things down, i don't want to go to the DB until they > click the link) Why would you even create the page while you're actually linking to it? E.g, when you do (2.0 code): new Link(this, "link") { onClick() { setResponsePage(new MyPage()); } } MyPage will only be constructed when the link is clicked. Furthermore, look at PageLink and BookmarkablePageLink. Read more about models here: http://www.wicket-wiki.org.uk/wiki/index.php/Models or here http://www.apress.com/book/bookDisplay.html?bID=10189 and take a look at the wicket-examples project. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] constructors and on attach
I need a place where i can initialize a page, get data from the database and set the models of my components. I assume I'm going to need the data before i set the models. I know some components constructors require models to be passed in and can not be set later. The problem with doing this work in the constructor is that when I"m making links to this page from somewhere else it will run all this database work when your on the page that links to it. (This really slows things down, i don't want to go to the DB until they click the link) I've also tried onAttach but this doesn't work when the page reloads for any reason. it will try to re add the components and throw an error. Where can i get my data and set the models that the code will only be run once and not when making a link to this page from another. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user