Yep, but... this class is used for links that link to pages that are not bookmarkable pages. In other words, the pages that you don't want to make available without a session, and that can't simply be constructed with (or without) a couple of plain parameters.

What you are looking for are probably BookmarkablePageLinks, which you can add with minimal code, or if you don't want to use Javacode for that at all, you could look into autolinks.

Or, if you want to have an 'internal' link which is less verbose (and you don't care about checking whether the link should be rendered 'active'), just create a normal link, and set the response page you want when it is clicked (if you like, you can use the page factory, but you don't have to).


Eelco


Nick Heudecker wrote:

Alright, let me see if I've got this straight.  The link(...) method
returns a PageLink object that's used to create the href attribute to
an anchor tag.  And I have to not only create the link(...) method,
but I also have to call that method in each class that's going to link
to that page.  Then I need to put that hook into the HTML file.  Does
that sound right?  I hope I'm wrong, because that seems like a lot of
work for a simple page link.

On 7/11/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
The link method returns an instance of PageLink. I'm not sure if you're
aquinted to anonymous classes, but:

return new PageLink(name, new IPageLink()
{
  public Page getPage()
  {
    return new EditBook(Book.get(id));
  }

  public Class getPageIdentity()
  {
    return EditBook.class;
  }
});

Is an anonymous class of type PageLink (see
http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html)

The getPage method returns the page that should be navigated to, and
getPageIndentity is used to see whether a link should be rendered
'active' (points to another page than the current one), or 'inactive'
(the link points to the current page).

If you look at the onClick implementation of PageLink:

   public void onClick()
   {
       // Set page source's page as response page
       setResponsePage(pageLink.getPage());
   }

You can see that the getPage method is called not before it is actually
needed, thus saving session space.

Eelco


Nick Heudecker wrote:

Can someone explain what's going on in EditBook#link(String, Long):

      public static PageLink link(final String name, final long id)
      {
              return new PageLink(name, new IPageLink()
              {
                      public Page getPage()
                      {
                              return new EditBook(Book.get(id));
                      }

                      public Class getPageIdentity()
                      {
                              return EditBook.class;
                      }
              });
      }

I see <a wicket:id = "edit" href="EditBook.html">Edit</a> in
BookDetails.html and I'm fairly sure they're related, but I'm not
clear on that method body.

Thanks for your time.


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to