1. #1
    Sencha User
    Join Date
    Nov 2013
    Location
    Bangalore, India
    Posts
    98
    Answers
    15
    Vote Rating
    7
    vardhan22 is on a distinguished road

      0  

    Default Answered: Warning messages on Compilation

    Answered: Warning messages on Compilation


    Hi All,
    I wanted to give some custom icons to buttons. I have created 2 Classes for this.

    Class: 1
    Code:
    public interface SampleImages extends ClientBundle{
         public SampleImages INSTANCE = GWT.create(SampleImages.class);
         
         @Source("images/add.png")
         ImageResource addIcon();
         
         @Source("images/allocate.png")
         ImageResource allocateIcon();
         
         @Source("images/cancel.png")
         ImageResource cancelIcon();
         
         @Source("images/common.png")
         ImageResource commonIcon();
         
         @Source("images/comment.png")
         ImageResource commentIcon();
         
         @Source("images/delete.png")
         ImageResource deleteIcon();
         
         @Source("images/discard.png")
         ImageResource discardIcon();
    }
    Class: 2

    Code:
    public class ImageIconBuilder {
         public static final SampleImages IMAGES = GWT.create(SampleImages.class);
    
    
    }
    But, while compiling, i am getting this warning. Can anyBody explain to me why this warning comes.

    Then for any button
    Code:
    TextButton addButton = new TextButton("Add");
    addButton.setIcon(ImageIconBuilder.IMAGES.addIcon());
    At one other place, i am assigning icons to menu, but as what icons is need to be given, that is getting returned from a call from server, i need to give variable

    Code:
    public static ImageResource getIcon(String iconPath)
        {
            if(iconPath.equals("images/add.png"))
            {
                return ImageIconBuilder.IMAGES.addIcon();
            }
            else if(iconPath.equals("images/allocate.png"))
            {
                return ImageIconBuilder.IMAGES.allocateIcon();
            }
            else if(iconPath.equals("images/cancel.png"))
            {
                return ImageIconBuilder.IMAGES.cancelIcon();
            }
    }
    And i am using above class as:

    Code:
    MenuItem menuItem = new MenuItem(valueOf.getDisplayName());
                menuItem .setIcon(MenuIcons.getIcon(valueOf.getIcon()));
    valueOf.getDisplayName() and MenuIcons.getIcon(valueOf.getIcon()) Both are strings:

    Just want to understand the reason of this. I can continue my work with this warning also.

  2. Code:
    Constructing interface com.google.gwt.cell.client.ButtonCellBase.DefaultAppearance.Template
         [java]                   Generating method body for iconContentLayout()
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                   Generating method body for iconWrapper()
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
    As I've bolded above, this is a fault in the core GWT button cell, and in their TextButton. The GXT version of these cells/widgets will not have these problems.

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Code:
    Constructing interface com.google.gwt.cell.client.ButtonCellBase.DefaultAppearance.Template
         [java]                   Generating method body for iconContentLayout()
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                   Generating method body for iconWrapper()
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
         [java]                      [WARN] Template with variable in CSS attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeStyles to specify arguments in a CSS attribute context
    As I've bolded above, this is a fault in the core GWT button cell, and in their TextButton. The GXT version of these cells/widgets will not have these problems.

Thread Participants: 1

Tags for this Thread