Hi Vitali,
I'm testing on Windows XP.
Here is the ProductPanel extends DecoratorPanel.
This class will populate the product details into the ProductPanel before
adding it into the HorizontalPanel:

class ProductPanel extends DecoratorPanel {
    ProductPanel(Product product) {
        VerticalPanel panel = new VerticalPanel();
        Image image = new Image(product.getUrl());
        Label code = new Label(product.getCode());
        code.addStyleName("product-code");
        Label price = new Label(product.getPrice().toString());
        price.addStyleName("product-code");
        panel.add(image);
        panel.add(code);
        panel.add(price);
        add(panel);
    }
}

Yes, I have the CSS in war directory and the CSS style "product-code" (see
above code) is picked up correctly.



On Fri, Apr 17, 2009 at 2:56 PM, Vitali Lovich <[email protected]> wrote:

> I'm assuming you have a file called shop.css in the same directory as
> shop.html?  What platform are you on?
>
>
> On Fri, Apr 17, 2009 at 2:46 AM, hezjing <[email protected]> wrote:
>
>> Hi
>>
>> Here are my .gwt.xml and HTML, both are generated by webAppCreator except
>> that I added two source paths in .gwt.xml:
>>
>> ----------------- Start of .gwt.xml
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.3//EN"
>> "
>> http://google-web-toolkit.googlecode.com/svn/tags/1.6.3/distro-source/core/src/gwt-module.dtd
>> ">
>> <module rename-to='shop'>
>>   <!-- Inherit the core Web Toolkit stuff.                        -->
>>   <inherits name='com.google.gwt.user.User' />
>>   <!-- Inherit the default GWT style sheet.  You can change       -->
>>   <!-- the theme of your GWT application by uncommenting          -->
>>   <!-- any one of the following lines.                            -->
>>   <inherits name='com.google.gwt.user.theme.standard.Standard' />
>>   <!-- Other module inherits                                      -->
>>   <source path='client' />
>>   <source path='domain' />
>>   <!-- Specify the app entry point class.                         -->
>>   <entry-point class='com.dummy.shop.client.Shop' />
>> </module>
>> ----------------- End of .gwt.xml
>>
>> ----------------- Start of HTML
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> <!-- The HTML 4.01 Transitional DOCTYPE declaration-->
>> <!-- above set at the top of the file will set     -->
>> <!-- the browser's rendering engine into           -->
>> <!-- "Quirks Mode". Replacing this declaration     -->
>> <!-- with a "Standards Mode" doctype is supported, -->
>> <!-- but may lead to some differences in layout.   -->
>> <html>
>>   <head>
>>     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
>>
>>     <!--                                                               -->
>>     <!-- Consider inlining CSS to reduce the number of requested files -->
>>     <!--                                                               -->
>>     <link type="text/css" rel="stylesheet" href="shop.css">
>>
>>     <!--                                           -->
>>     <!-- Any title is fine                         -->
>>     <!--                                           -->
>>     <title>Web Application Starter Project</title>
>>
>>     <!--                                           -->
>>     <!-- This script loads your compiled module.   -->
>>     <!-- If you add any GWT meta tags, they must   -->
>>     <!-- be added before this line.                -->
>>     <!--                                           -->
>>     <script type="text/javascript" language="javascript"
>> src="shop/shop.nocache.js"></script>
>>   </head>
>>
>>   <!--                                           -->
>>   <!-- The body can have arbitrary html, or      -->
>>   <!-- you can leave the body empty if you want  -->
>>   <!-- to create a completely dynamic UI.        -->
>>   <!--                                           -->
>>   <body>
>>
>>     <!-- OPTIONAL: include this if you want history support -->
>>     <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
>> style="position:absolute;width:0;height:0;border:0"></iframe>
>>
>>     <h1>Web Application Starter Project</h1>
>>
>>     <table align="center">
>>       <tr>
>>         <td colspan="2" style="font-weight:bold;">Please enter your
>> name:</td>
>>       </tr>
>>       <tr>
>>         <td id="nameFieldContainer"></td>
>>         <td id="sendButtonContainer"></td>
>>       </tr>
>>     </table>
>>   </body>
>> </html>
>> ----------------- End of HTML
>>
>>
>> On Fri, Apr 17, 2009 at 12:36 PM, Vitali Lovich <[email protected]>wrote:
>>
>>>
>>> Please post your .gwt.xml file & your html file.
>>>
>>> On a side note, I really do urge you to use OOPHM & Firebug - it'll
>>> help you track down this bug 100x faster because you'll be able to see
>>> the CSS rules that are being applied to the element & which are
>>> override each other.  That'll let you see if your rules are even being
>>> included & if they, if they're being overriden by another rule.
>>>
>>> On a side note, try adding !important to your styles.
>>>
>>> On Fri, Apr 17, 2009 at 12:15 AM, hezjing <[email protected]> wrote:
>>> > Thanks, Vitali.
>>> > Back to the problem, theoretically it should works by modifying the CSS
>>> as
>>> > described in the DecoratorPanel Javadoc, right?
>>> > Did I miss anything here?
>>> >
>>> > On Fri, Apr 17, 2009 at 12:05 PM, Vitali Lovich <[email protected]>
>>> wrote:
>>> >>
>>> >> I would recommend trunk & OOPHM mode which lets you run in hosted mode
>>> >> with native firefox.
>>> >>
>>> >> If that's not an option, you can try:
>>> >>
>>> >> public static native Element[] getElementsByClassName(String name)
>>> /*--{
>>> >>
>>> >> if (document.getElementsByClassName == undefined) {
>>> >>        document.getElementsByClassName = function(className)
>>> >>        {
>>> >>                var hasClassName = new RegExp("(?:^|\\s)" + className +
>>> >> "(?:$|\\s)");
>>> >>                var allElements = document.getElementsByTagName("*");
>>> >>                var results = [];
>>> >>
>>> >>                var element;
>>> >>                for (var i = 0; (element = allElements[i]) != null;
>>> i++) {
>>> >>                        var elementClass = element.className;
>>> >>                        if (elementClass &&
>>> elementClass.indexOf(className)
>>> >> != -1 &&
>>> >> hasClassName.test(elementClass))
>>> >>                                results.push(element);
>>> >>                }
>>> >>
>>> >>                return results;
>>> >>        }
>>> >> }
>>> >> return document.getElementsByClassName(name);
>>> >>
>>> >> }--*/;
>>> >>
>>> >> Element [] topLeft = getElementsByClassName("topLeft");
>>> >> assert topLeft != null;
>>> >>
>>> >> for (Element tl : topLeft) {
>>> >>  System.out.println("Found top left with background " +
>>> >> DOM.getStyleAttribute(tl, "background"));
>>> >> }
>>> >>
>>> >> rinse & repeat for the remaining corners.  Code not tested (just
>>> >> grabbed the native javascript from the web) so you're on your own if
>>> >> it doesn't work (at that point try gwtquery).
>>> >>
>>> >> On Thu, Apr 16, 2009 at 11:19 PM, hezjing <[email protected]> wrote:
>>> >> >
>>> >> > Hi Vitali
>>> >> > On Fri, Apr 17, 2009 at 11:05 AM, Vitali Lovich <[email protected]>
>>> >> > wrote:
>>> >> >>
>>> >> >> Have you used something like firebug to verify that the CSS on
>>> those
>>> >> >> elements is indeed correct?
>>> >> >
>>> >> > I'm not using Firefox and Firebug.
>>> >> > I'm testing this in hosted mode, is there an alternative way to
>>> verify
>>> >> > if the CSS is correct?
>>> >> >
>>> >> > --
>>> >> >
>>> >> > Hez
>>> >> >
>>> >> > >
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> >
>>> > Hez
>>> >
>>> > >
>>> >
>>>
>>>
>>>
>>
>>
>> --
>>
>> Hez
>>
>>
>>
>
> >
>


-- 

Hez

--~--~---------~--~----~------------~-------~--~----~
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