You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Tauren Mills (JIRA)" <ji...@apache.org> on 2007/09/28 02:16:50 UTC
[jira] Commented: (WICKET-1016) ExternalLink doesn't use model
[ https://issues.apache.org/jira/browse/WICKET-1016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530882 ]
Tauren Mills commented on WICKET-1016:
--------------------------------------
Martin,
That patch works for me! However, eclipse complained of an error (not a warning) in ExternalLinkPage_2.java:
The serializable class does not declare a static final serialVersionUID field of type long wicket/src/test/java/org/apache/wicket/markup/html/link ExternalLinkPage_2.java line 31
Once I added serialVersionUID to the anonymous class, the error went away:
public ExternalLinkPage_2()
{
add(new ExternalLink("myLink", new Model(null))
{
private static final long serialVersionUID = 1L;
public boolean isVisible()
{
return getModelObject() != null;
}
});
}
I thought this was strange because I normally get warnings about serialVersionUID, but in this case it was an error.
BTW, there was some discussion on the mailing list about ExternalLink models:
http://www.nabble.com/text-in-Link-vs-ExternalLink-tf939840.html#a2435084
I look forward to you committing this to trunk.
Thanks again!
Tauren
> ExternalLink doesn't use model
> ------------------------------
>
> Key: WICKET-1016
> URL: https://issues.apache.org/jira/browse/WICKET-1016
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Reporter: Tauren Mills
> Priority: Minor
> Attachments: ExternalLink.patch
>
>
> I don't understand why ExternalLink doesn't store the external href as
> the model. It stores it in an href property. It seems to not follow
> the normal wicket way.
> This makes it difficult to do things like display a link only if the
> model is not null. For instance:
> add(new ExternalLink("web", new PropertyModel(service,"web")) {
> @Override
> public boolean isVisible() {
> return getModelObject() != null;
> }
> });
> The problem is that getModelObject() is always null, because the
> PropertyModel is stored in the href property. And since isVisible()
> is part of Component, the href property isn't accessible.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.