Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:56:20+00:00 2026-06-07T09:56:20+00:00

I need to use the same style in a few UI Binder templates so

  • 0

I need to use the same style in a few UI Binder templates so I did everything as described in: https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Using_an_external_resource .

So I did the following:

1. Created Resources interface:

public interface Resources extends ClientBundle {
    @Source("shared.css")
    Style style();

    public interface Style extends CssResource {
        String grayedOut();
    }
}

2. Created shared.css file in the same directory as Resources class:

.grayedOut{
    background-color: red;
}

3. Added with element to UI Binder template:
<ui:with type="correct.package.Resources" field="res"/>

4. Added reference to style in UI Binder template: addStyleNames="{res.style.grayedOut}"

However it doesn’t work. The view is rendered just as grayedOut style wasn’t applied at all.

But I observed two things:

  1. In Firebug/Chrome Dev Tools I can see that element has assigned an ofuscated style name corresponding to the style I’m trying to add: class="GAWERH0MI gwt-TabLayoutPanelContent" (GAWERH0MI seem to correspond to my grayedOut class) but I can’t locate it in “element styles” panel which probably means that this class is empty (no body). (I did experiment and assigned empty class to element with the same effect in that tools).
  2. When I change style name in .css, then I’m getting runtime error that style grayedOut couldn’t be found, which seem to mean that my style class is normally successfully found but from some reason doesn’t work as expected.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:56:22+00:00Added an answer on June 7, 2026 at 9:56 am

    You probably forgot to call ensureInjected() on a Resources.Style instance.

    This is done automatically for a <ui:style> (because you don’t code the ClientBundle and CssResource interfaces, they are generated for you by UiBinder), but not for any other CssResource.

    You can use @UiField Resources res though, that will be injected with the value of the <ui:with field="res">, and thus call res.style().ensureInjected() just after the call to createAndBindUi.
    IMO, you’d however better inject a Resources instance into your view and use @UiField(provided=true), and thus either make sure ensureInjected() is called before the instance is injected into your view, or choose to call ensureInjected() in each of your views. As in https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Share_resource_instances

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All my div blocks use the same class name and I need to append
I need to use unix Style line endings (only LF) in Zend Studio 8/9
I need a way to load multiple style sheets with the same rule names,
I need to use same widgets(buttons,editext,textviews) with same properties like width,height,textColor,size etc in multiple
I need use this method with three distinct classes: Orders, Customers, Suppliers public void
I need use this code: <%= button_tag :class => btn btn-primary do %> <%=
I have installed Matlab r2010a on my computer I need use the function xlsread
So, I need use this event so I can navigate trought blog posts. I
Need to use own imaged markers instead built-in pins. I have several questions. 1.
I need to use maps on running in a physical Android device, how do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.