1

Here's what I've got. I have a tree in GWT set up to process only a certain level depth of children, retrieving from the server and only updating according to which children one clicks. I am familiar with addStyleName() functions and I have used this to style the foreground color of certain tree nodes, and it has appeared successfully on previous versions of my project (without the server calls).

The question boils down to if any of you familiar with GWT know any reason why my custom CSS would be overridden on a child update of a node. So for example, when the server processes a node, it shows up in my proper CSS color, but once the server shows that it has children, it does the addItem() to that node and the CSS of the text color of the parent is reverted back to default.

This is all under the assumption that I have no removeStyleName() calls or any deleting/recreating going on. Anyone familiar with a situation like this?

Thanks!

EDIT: Here's some code I've narrowed it down to

HTML

<html>
<head>
<link type="text/css" rel="stylesheet" href="test.css">
</head>
<body>
<p>blaghblagh</p>
<div class="Foreground1">
    hey
    <table style="white-space: nowrap;">
        <tbody>
        <td style="vertical-align: middle;">
            <div style="display: inline;">
                ContinuingPromise '08
            </div>
        </td>
    </tbody>

</table>

CSS:

body{
color: black;
}
.Foreground1{
color: green;
}

If you put this code up, you'll see the ContinuingPromise as black, although it is within the foreground div which should be green. Also, the word 'hey' will appear green. Am I missing something basic? Thanks again

Mojave Storm
  • 571
  • 2
  • 7
  • 18
  • Also, in firebug, the CSS of the node in question shows up (in firebug) as if the color is displaying properly, also firebug shows no overriding of the color by any other CSS rule. Maybe something within GWT? – Mojave Storm Jul 11 '10 at 03:04
  • A possible cause would be the main GWT CSS file (`standard.css`) overriding your CSS classes (although, Firebug seems to disagree) - have you tried putting your CSS file at "the top": http://stackoverflow.com/questions/2322779/gwt-theme-style-overrides-my-css-style/2323620#2323620? – Igor Klimer Jul 11 '10 at 14:58
  • I never see standard.css even linked when I view page source. What seems to happen is, the next color: rule applied is in the body { color: black; } and when I change this value, it affects the updated nodes color (the node in question). So for some reason when the node is updated, even though it is still within .Foreground1{color: green;} div, it reverts back to the body color definition. I did also try a !important but it had no affect. :( – Mojave Storm Jul 12 '10 at 20:35

1 Answers1

1

I'm not sure if this solved your original question, but the color problem is very likely caused by the doctype you're using. If the html page uses quirks mode, the style properties are not correctly inherited by the table. See http://reference.sitepoint.com/css/inheritance. Setting a doctype or different doctype might solve your problem. If you are using any of the GWT layout panels you need to set the doctype to <!DOCTYPE html>, see http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#Standards

Hilbrand Bouwkamp
  • 13,509
  • 1
  • 45
  • 52
  • Great, that will do it. I haven't ever really looked at the difference between quirks/standards mode but that all makes sense now that I actually ran into a problem with it haha. Although, since this is quite a large project that I am not too familiar with, I don't want to mess up any of the few panels that might still be buggy. I found a workaround to just add a * after each class that had this table within it, and it seemed to apply nicely. I will remember this in the future, thanks again. – Mojave Storm Jul 14 '10 at 18:25