Make sure to always check the JavaDocs -- they're pretty thorough and
often include examples. For instance, the JavaDoc for Link includes
the snippet that Igor gave you.
-Ryan
On Feb 22, 2007, at 6:57 AM, Jason Roelofs wrote:
> Wicketers (wicketeers?),
>
> I'm a newcomer to the Wicket framework and I have to say I'm
> impressed with what this library does. I'm an extensive Rails user,
> so when I was given a web project that had to be in Java, I spent a
> few days looking and trying out different frameworks, until I
> landed on Wicket. However, now I'm nothing but frustrated as I just
> don't understand how to use this framework. I've searched the
> documentation, I've tried searching the list (not sure what to
> search for, honestly), so now I'm posting here.
>
> I'm stuck on how to deal with object models in pages. I picked up
> Databinder for Hibernate mappings, which is working quite well, but
> now I cannot for the life of me figure out this very simple operation:
>
> I have a list of available objects displayed on my page as Links.
> When I click on these links, how are you supposed to know what you
> clicked on and load up that full object for further use? The
> relevant code I've got going so far (in a WebMarkupContainer,
> private class inside of IndexPage):
>
> IModel staticChainListModel = new HibernateListModel
> (StaticRuleChain.class, new ICriteriaBuilder() {
> public void build(Criteria criteria) {
> criteria.addOrder(Order.asc("name"));
> }
> });
>
> add(new PropertyListView("staticRuleChain", staticChainListModel) {
> @Override
> protected void populateItem(final ListItem item) {
> item.add(new Link("editLink") {
> @Override
> public void onClick() {
> System.out.println("Setting model to something
> static...");
>
> // What goes here? I want to use the model I clicked on!
> }
> }.add(new Label("name")));
> }
> });
>
> And in the constructor of IndexPage (currentRuleChainName is just a
> field to show that I actually have the object I'm looking for. I
> only ever see "Good Day my Friend"):
>
> // Display rule chain
> if (getModelObject() == null) {
> //this.setModelObject(new HibernateObjectModel
> (StaticRuleChain.class));
> add(new Label("currentRuleChainName", "Good Day my Friend"));
> } else {
> add(new Label("currentRuleChainName", new PropertyModel
> (getModelObject(), "name")));
> }
>
> For all I've searched, I've found only tidbits and tips on certain
> parts of the Wicket framework. I've tried looking through the
> examples, but none of them seem to do what I want, or are doing
> them in a different manner (mostly using Form, which I am not
> using). Are there any documents around that describe the Why and
> How of Wicket vs just the What?
>
> Thanks for your help, let me know if you need more information.
>
> Jason
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user