Skip to main content

AbstractHyperlinkAction - How to control by row

5 replies [Last post]
martinm1000
Offline
Joined: 2003-06-12

Hi,

I'm trying to get a AbstractHyperlinkAction in a column table to be activated or not
depending if a URI is available for each row.

Right now, I don't see support for this ? Unless there is another way using a WrappingProvider or something ?

I want the HyperLink only for some rows; if not, I would like the normal cell renderer to be used.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
martinm1000
Offline
Joined: 2003-06-12

I was able to hack something, but it too ugly and will probably have problems under L&Fs.

In the swinglabs demo, in the JXTable demo, we see that if a movie title has no URI,
the cell is not painted, but is still a JXHyperLink (well a JXRendererHyperlink).

If we could switch to a normal cell renderer, or if the JXHyperLink could be configured to look like a normal JLabel, I would be happy ;-)

kleopatra
Offline
Joined: 2003-06-11

> I was able to hack something, but it too ugly and
> will probably have problems under L&Fs.

care to elaborate how :-?

>
> In the swinglabs demo, in the JXTable demo, we see
> that if a movie title has no URI,
> the cell is not painted, but is still a JXHyperLink
> (well a JXRendererHyperlink).
>

don't quite understand - what do you mean by "not painted"?

> If we could switch to a normal cell renderer, or if
> the JXHyperLink could be configured to look like a
> normal JLabel, I would be happy ;-)

Hmm ... good idea - adding a configuration option to the hyperlink/action would be my preference. Would you file an enhancement request, please?

Thanks
Jeanette

martinm1000
Offline
Joined: 2003-06-12

Welcome back from vacation !

> > I was able to hack something, but it too ugly and
> > will probably have problems under L&Fs.
>
> care to elaborate how :-?

I tried to get my own version of JXHyperLink to not behave like a link.
But I saw that those properties where done in a UI object - so LAF dependent...

>
> >
> > In the swinglabs demo, in the JXTable demo, we see
> > that if a movie title has no URI,
> > the cell is not painted, but is still a
> JXHyperLink
> > (well a JXRendererHyperlink).
> >
>
> don't quite understand - what do you mean by "not
> painted"?

There is no text shown at all (the movie title)
http://imgur.com/L2uP0.png

> > If we could switch to a normal cell renderer, or
> if
> > the JXHyperLink could be configured to look like a
> > normal JLabel, I would be happy ;-)
>
> Hmm ... good idea - adding a configuration option to
> the hyperlink/action would be my preference. Would
> you file an enhancement request, please?
>
> Thanks
> Jeanette

Doing that right now.
https://swingx.dev.java.net/issues/show_bug.cgi?id=1328

kleopatra
Offline
Joined: 2003-06-11

> Welcome back from vacation !

thanks - but not really back yet, just a day off vaction :-)

>
> I tried to get my own version of JXHyperLink to not
> behave like a link.
> But I saw that those properties where done in a UI
> object - so LAF dependent...
>

yeah, right now the only way to not make a hyperlink as as one is to disable it, either directly on the component or (preferred) in the action.

> >
> > don't quite understand - what do you mean by "not
> > painted"?
>
> There is no text shown at all (the movie title)
> http://imgur.com/L2uP0.png
>

ahh, I see - could be an application error, though, as the uri is looked up dynamically. On second thought, could well be an issue on the hyperlinkAction: don't recall what exactly happens if the uri is not found or invalid. Need to check, thanks for the alert!

>
> Doing that right now.

cool, thanks!

CU next week
Jeanette

martinm1000
Offline
Joined: 2003-06-12

Wow, a vacation day from a vacation !

I've looked at the code and from what I understood, you don't setName() (I think) the JXLabel - because it would look like an URL & you have code that popup a msgbox. there is no method to have it display like a label, kind of in black on while.

https://swingx.dev.java.net/issues/show_bug.cgi?id=1328