Monday, October 3, 2011

Re: How to add style to Hyperlink in UiBinder?

Use the inline style sheet <ui:style></ui:style> tag in your ui.xml
file. Edit the property in your uibinder. In HyperLink class, set
the styleName property. Try the code below.

//ui.xml file

<?xml version="1.0" encoding="UTF-8"?>
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.lgLink
{
color:green;
}
.lgLink:visited
{
font:bold 20px arial, sans-serif;
color:#555555;
cursor:pointer;
cursor:hand;
}
.lgLink:hover
{
font:bold 20px arial, sans-serif;
color:red;
cursor:pointer;
cursor:hand;
}
</ui:style>
<g:Hyperlink ui:field='linkName' width='500px'
styleName='{style.lgLink}'/>
</UiBinder>

S. Abraham
www.DataStoreGwt.com
Persist objects directly in GAE


On Oct 3, 11:14 am, powwow <jimmy.w...@gmail.com> wrote:
> I've looked and looked but I can't figure it out.
>
> I am doing this:
>
> <g:Hyperlink ui:field='linkName' width='500px'
> styleName='{res.style.lgLink}'/>
>
> In my css I am doing this:
>
> .lgLink{
>         font:bold 20px arial, sans-serif;
>         color:#555555;
>         cursor:pointer;
>         cursor:hand;
>
> }
>
> In my ClientBundle I have this:
>
> public interface Style extends CssResource {
>                 String lgLink();
>
> }
>
> But it doesn't work with I use UiBinder.  How do I get the link to
> change color?  On visited?  hover? etc?
>
> I tried this but it doesn't work either:
>
> .lgLink:visited{
>         font:bold 20px arial, sans-serif;
>         color:#555555;
>         cursor:pointer;
>         cursor:hand;
>
> }
>
> I also tried:
>
> gwt-Hyperlink.lgLink:visited{
>         font:bold 20px arial, sans-serif;
>         color:#555555;
>         cursor:pointer;
>         cursor:hand;
>
> }
>
> But the ClientBundle doesn't link that.  Any ideas?  Thanks.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment