Hi,

Here is one approach:
show ExternalLink if there is a url or a Label/empty
WebMarkupContainer+FeedbackMessage when there is no such url.
pseudo code:
if (docRef != null)
  add(new FragmentWithExternalLink("someId"))
else
  add(new FragmentWithMessage("someId"))


On Tue, Apr 16, 2013 at 1:58 PM, hfriederichs <[email protected]> wrote:

> Hello to y'all,
>
> I'm facing a nasty problem for a very simple requirement. In my application
> a user can enter an application code for working with that application
> (deployments and so on).
> Now I want to add a button that opens a Wiki-documentation page for that
> application in a new browser tab. The URL for the wiki-page is stored in
> the
> same database table as is the application code. I implemented this at first
> with an ExternalLink, but I want to show an information message if the URL
> is not entered in the database.
>
> I can't get that done with an ExternalLink, so I used a Link instead. Well,
> that gives the possibility to display info messages, but then I have to
> open
> the URL myself by something like:
>
> public void onClick() {
>         String docRef = getRefFromDb();
>         if (docRef == null) {
>                 info("Please supply wiki-url first");
>                 return;
>         }
>         RedirectRequestHandler redirectRequestHandler = new
> RedirectRequestHandler(docRef);
>
>
> RequestCycle.get().scheduleRequestHandlerAfterCurrent(redirectRequestHandler);
> }
>
> Obviously I leave my page when the link is clicked, so I added
> onBeforeRender() in which I add PopupSettings if the url is found, so at
> least I have a new window for the wiki-page (but I want a new tab). And if
> not, I have to nullify the PopupSettings...
>
> This is very awkward.
>
> Please, anyone, a simple solution?
> Btw, I'm (still) using Wicket 1.5.4.
>
> Regards, Hans
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Infomessage-ExternalLink-in-case-of-a-missing-URL-tp4658015.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to