"I found that if I do a DOM.getChild on the Hyperlink, then setClass
on
the child element, then I can get what should happen by default."

He can get the result he wants if he works into the DOM to access the
<a> tag and set its class there, so no CSS is being overwritten.
Browsers just don't apply styles on the div to children anchors unless
you specify a ".class a".

By the way, if ".my_link_style a" doesn't work, you can try
".my_link_style a:active, .my_link_style a:visited". Your problem is
fixable by setting <a> tag but since you want to use Hyperlink,
accessing the <a> part requires that method you mentioned as a
"workaround", but you can also fix the problem by fixing your CSS.

Blake

On Jul 12, 10:12 am, Ian Bambury <[email protected]> wrote:
> You probably have the default GWT css injected via your *.get.xml file which
> is overwriting what you are setting.
> Ian
>
> http://examples.roughian.com
>
> 2009/7/12 Rinpun <[email protected]>
>
>
>
>
>
> > Can you Window.alert(hyperlink.getElement().getString())? Due to
> > DOM.getChild working, GWT is probably wrapping the actual link tag in
> > something else. I checked and it's wrapping the a tag in a <div>. In
> > those situations the only way I've used that works is either
> > hyperlink.getElement().getFirstChildElement().setClassName
> > ("my_link_style") or your option, DOM.getChild(hyperlink.getElement
> > ()).setClassName("my_link_style").
>
> > On second thought, you could also change your style to ".my_link_style
> > a" in CSS. That will tell it to apply the CSS to all <a> children of
> > whatever tag is assigned to my_link_style.
>
> > Blake
>
> > On Jul 11, 8:43 pm, Nathan <[email protected]> wrote:
> > > The CSS didn't have to refresh, it works if I apply that name to other
> > > elements.
>
> > > I have quintuple-checked the style name.
>
> > > Hyperlink is the only class that's doing this to me, so if you're not
> > > familiar with it, I can see why you'd think it should just work as
> > > expected...:)
>
> > > I found that if I do a DOM.getChild on the Hyperlink, then setClass on
> > > the child element, then I can get what should happen by default.  So I
> > > have a work around, but if someone can tell me how to do this
> > > properly, I'd appreciate it.
>
> > > Thanks!
>
> > > -nathan
>
> > > On Jul 11, 7:04 pm, rjcarr <[email protected]> wrote:
>
> > > > I'm not very familiar with hyperlink but it is common that even if you
> > > > refresh a page the css isn't always refreshed.  Load your CSS
> > > > separately from your web page (refresh the CSS if necessary), and the
> > > > refresh the web page after.
>
> > > > If that doesn't help then you might have a typo with your style names.
>
> > > > On Jul 11, 3:32 pm, Nathan <[email protected]> wrote:
>
> > > > > Hey everyone.  New GWT user here, and I ran into a problem and I'm
> > > > > thoroughly confused.
> > > > >   I made an Anchor, with a link to another page.  I told it to use
> > the
> > > > > style "my_link_style," which has "text-decoration: none;" in it.  And
> > > > > it worked, there was no underline, and it was the color I wanted it
> > to
> > > > > be, whether or not it had been followed.
>
> > > > >   I then read about the GWT Hyperlink, and decided to switch ('cause
> > > > > that's kinda the point, at least for internal links, right? :) ) --
> > so
> > > > > I replaced my Anchor with a Hyperlink.  It works fine, but the style
> > > > > is no longer being used.  I have tried replacing/updating the ".gwt-
> > > > > Hyperlink { }" style, I've tried Hyperlink.setStyleName(...),
> > > > > HyperLink.addStyleName(...)... none of them work to change the style
> > > > > of the Hyperlink.
>
> > > > >   Am I missing something?  Any help would be appreciated.
>
> > > > >   Thanks,
>
> > > > > -nathan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to