You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Nick Makes <np...@yahoo.com> on 2014/07/03 18:27:56 UTC

LinkButton Formatting

Hi all,

I'm running into issues with styles and event handling on LinkButtons that I was hoping someone could help me out with. 

I'd like to control the hover and active/selected colors for these hyperlinks. I've managed the hover behavior by utilizing the mouseOver and mouseOut methods of the ComponentMouseListener. However, I think my mouseOut behavior (reverts the link's color back to the original state) overrides any color/style I'm setting in the mouseClick due to the fact you click only when the mouse is over the link, but then leave the hover area after clicking. 

Is there a better/more accepted way of doing this? Perhaps a style key itself called hoverColor or something like that?

Any info or advice here would be greatly appreciated.

Thanks,
Nick

Sent from my iPhone

RE: LinkButton Formatting

Posted by Roger Whitcomb <Ro...@actian.com>.
Hi Nick,
	A few suggestions:
1. Since the Pivot LinkButton only supports the "color" and "disabledColor" styles right now (you can see that in TerraLinkButtonSkin.java), you could totally manage the colors yourself in your mouse handling.  Sounds like you almost have this nailed.  Maybe you need to keep a little more state related to clicks?
2. You could create a custom LinkButtonDataRenderer, which does the painting, etc. the way you want it, then set that custom data renderer as the one used for all your LinkButtons.  This is (I think) the preferred way to do things.  This is the guy that actually does the underline painting, etc.  And this is totally customizable by creating a new renderer or just subclassing the default one.
3. You could create a custom component based on LinkButton, and make your own skin for it, based on the existing code, and add active/hover/whatever color styles and manage things that way.  You would probably end up also making a custom renderer as well.  If you look at the existing code, there's really not that much involved, but it is more work than option 2.
4. You could add these things to the Pivot code yourself, build from your custom build area, and submit a JIRA with a patch, and hope that we submit the code for the next release ;)  (sounds like a fine enhancement to me).

Would love to chat more about what you're doing :)

HTH,
~Roger

-----Original Message-----
From: Nick Makes [mailto:npm622@yahoo.com] 
Sent: Thursday, July 03, 2014 9:28 AM
To: user@pivot.apache.org
Subject: LinkButton Formatting

Hi all,

I'm running into issues with styles and event handling on LinkButtons that I was hoping someone could help me out with. 

I'd like to control the hover and active/selected colors for these hyperlinks. I've managed the hover behavior by utilizing the mouseOver and mouseOut methods of the ComponentMouseListener. However, I think my mouseOut behavior (reverts the link's color back to the original state) overrides any color/style I'm setting in the mouseClick due to the fact you click only when the mouse is over the link, but then leave the hover area after clicking. 

Is there a better/more accepted way of doing this? Perhaps a style key itself called hoverColor or something like that?

Any info or advice here would be greatly appreciated.

Thanks,
Nick

Sent from my iPhone