Several places:

The CSS resource processor expects to "obfuscate" the class names from your 
CSS file.  So, for example, "labels" might get turned into "GESPCACKI". 
That's why you have a method declared in the interface, so you can retrieve 
the obfuscated name string.

You don't explicitly see a method where you use "labels" in the Uibinder, 
but the attribute {res.style.labels} in the tag <g:Label 
ui:field="labUsername" addStyleNames="{res.style.labels}"> is actually 
invoking res.style().labels().

If you wish to use class names in the CSS file that you don't want 
obfuscated (like .gwt-Label, for example), you need to mark them with 
@external:

mycss.css : 

@external .headerPan, .textb, .button;

.headerPan {
    background-image:none;
    background-color:blue !important;
    height:40px;
    border-bottom:1px solid black;
    position : relative;
    font-size:10.0 em;
}
etc.

In these lines:

headerPanel.addStyleName("headerPan");
labPassword.addStyleName("labels");
username.addStyleName("textb");
validBtn.addStyleName("button");

The styles for headerPan, textb, and button will work as expected.  The 
statement 

labPassword.addStyleName("labels");

Will do nothing, since there is no class named labels in the CSS.  It 
should be

labPassword.addStyleName(res.style().labels());

And, somewhere before that you need to create res and inject the stylesheet:

example.resources.Resources res = 
GWT.create(example.resources.Resources.class);
res.style().ensureInjected();



On Friday, August 16, 2013 7:06:35 PM UTC-4, Laurent Bagno wrote:
>
> Hello,
>
> I have a problem at the compilation with this error : 
> "The following unobfuscated classes were present in a strict CssResource:
> textb
> button
> headerPan
> [ERROR] [gwtmobileexample] - Generator 
> 'com.google.gwt.resources.rebind.context.InlineClientBundleGenerator' threw 
> an exception while rebinding 'example.resources.Resources'"
>
> Below, it's my code.
>
> Where is the problem ? 
>
> Thank you
>
> AuthenticationPage.ui.xml
> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
>     xmlns:g="urn:import:com.google.gwt.user.client.ui"
>     xmlns:mgwt="urn:import:com.googlecode.mgwt.ui.client.widget">
>     <ui:with field='res' type='example.resources.Resources'/>
>
>     <mgwt:LayoutPanel>
>     <mgwt:HeaderPanel ui:field="headerPanel">
>             <mgwt:center>
>                 <g:HTML ui:field="center">Connection</g:HTML>
>             </mgwt:center>
>         </mgwt:HeaderPanel>
>    
>         <mgwt:WidgetList>
>             <g:Label ui:field="labUsername" 
> addStyleNames="{res.style.labels}">Username</g:Label>
>             <mgwt:MTextBox ui:field="username"></mgwt:MTextBox>
>             <g:Label ui:field="labPassword">Password</g:Label>
>             <mgwt:MPasswordTextBox 
> ui:field="password">dsdds</mgwt:MPasswordTextBox>
>             <mgwt:Button ui:field="validBtn">Valider</mgwt:Button>
>         </mgwt:WidgetList>
>     </mgwt:LayoutPanel>
> </ui:UiBinder> 
>
> AuthenticationPage.java :
>  
> package example.client;
> import org.apache.log4j.Logger;
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.uibinder.client.UiBinder;
> import com.google.gwt.uibinder.client.UiField;
> import com.google.gwt.user.client.ui.Composite;
> import com.google.gwt.user.client.ui.HasText;
> import com.google.gwt.user.client.ui.Label;
> import com.google.gwt.user.client.ui.Widget;
> import com.googlecode.mgwt.ui.client.widget.Button;
> import com.googlecode.mgwt.ui.client.widget.HeaderPanel;
> import com.googlecode.mgwt.ui.client.widget.MTextBox;
>
> import example.resources.Resources;
>
> public class AuthenticationPage extends Composite implements HasText {
>     @UiField
>     HeaderPanel headerPanel;
>     
>     @UiField
>     Label labUsername;
>     
>     @UiField
>     Label labPassword;
>     
>     @UiField
>     MTextBox username;
>     
>     @UiField
>     MTextBox password;
>     
>     @UiField
>     Button validBtn;
>     
>     private static AuthenticationPageUiBinder uiBinder = GWT
>             .create(AuthenticationPageUiBinder.class);
>
>     interface AuthenticationPageUiBinder extends
>             UiBinder<Widget, AuthenticationPage> {
>     }
>
>     public AuthenticationPage() {
>         initWidget(uiBinder.createAndBindUi(this));
>     
>         labPassword.setText("fdf");
>         
>         headerPanel.getElement().getStyle().clearBackgroundColor();
>         headerPanel.getElement().getStyle().clearBackgroundImage();
>         headerPanel.addStyleName("headerPan");
>         labPassword.addStyleName("labels");
>         username.addStyleName("textb");
>         validBtn.addStyleName("button");
>     }
>
>     @Override
>     public String getText() {
>         // TODO Auto-generated method stub
>         return null;
>     }
>
>
>     @Override
>     public void setText(String text) {
>         // TODO Auto-generated method stub
>         
>     }
> }
>
> Resources.java : 
> package example.resources;
>
> import com.google.gwt.core.shared.GWT;
> import com.google.gwt.resources.client.ClientBundle;
> import com.google.gwt.resources.client.CssResource;
>
> public interface Resources extends ClientBundle {
>     public static Resources R = GWT.create(Resources.class);
>     
>     @Source("mycss.css")
>     public Style style();
>     
>     public interface Style extends CssResource {
>         @ClassName("labels")
>         String labels();
>     }
> }
>
> mycss.css : 
>
> .headerPan {
>     background-image:none;
>     background-color:blue !important;
>     height:40px;
>     border-bottom:1px solid black;
>     position : relative;
>     font-size:10.0 em;
> }
>
> .labels {
>     color:blue;
> }
>
> .textb {
>     color : yellow;
> }
>
> .button {
>     background-color:blue;
> }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to