Success! Looks like we've fixed this one. According to our records the fix was applied for a bug in our system in a recent build.
  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    22
    Vote Rating
    0
    EthiC is on a distinguished road

      0  

    Default XTemplate bug found [Beta2]

    XTemplate bug found [Beta2]


    Today I was using XTemplates and stumbled upon a fairly harsh error:
    Code:
    [ERROR] [mockup] - Errors in 'generated://5024447DD15A3A8D9ED11B1F09E77F17/mockup/client/view/NewsTemplate_render_SafeHtml__NewsItem_item___SafeHtmlTemplates.java'
    [ERROR] [mockup] - Line 7: String literal is not properly closed by a double-quote
    I made a very simple html fragment: (named newstemplate.html)
    Code:
    <div>
    <h3>{item.title}</h3>
        <p>
             {item.text}
        </p>
    </div>
    While using this class:
    Code:
    public interface NewsTemplate extends XTemplates {
        @XTemplate(source = "newstemplate.html")
        SafeHtml render(NewsItem item);
    }
    Should work right? But no, it didn't. I copy/pasted the html code in the @XTemplate annotation as following:
    Code:
    public interface NewsTemplate extends XTemplates {
        @XTemplate(value ="<div><p><h3>{item.title}</h3>{item.text}<tpl if='item.moar'><span style='float: right;'><a href=''>Read more</a></span></tpl></p></div>")
        SafeHtml render(NewsItem item);
    }
    And it worked like it should, no problem there.
    So I went back and forth trying to find out what I did wrong in the .html file.
    While being spammed with (similar) errors from maven:
    Code:
    [INFO]       [ERROR] Line 30:  Failed to resolve 'x.mockup.client.view.NewsTemplate_rend
    er_SafeHtml__NewsItem_item___SafeHtmlTemplates' via deferred binding
    [INFO]    [ERROR] Errors in 'C:\Data\Java\WorkspaceGWT\mockup\target\.generated\x\mockup
    \client\view\NewsTemplate_render_SafeHtml__NewsItem_item___SafeHtmlTemplates.java'
    [INFO]       [ERROR] Line 7:  The annotation @SafeHtmlTemplates.Template is disallowed for this loca
    tion
    [INFO]       [ERROR] Line 7:  String literal is not properly closed by a double-quote
    [INFO]       [ERROR] Line 8:  span cannot be resolved to a type
    ...
    I took a look at the generated file as indicated by Maven and received something like:
    Code:
    public interface NewsTemplate_render_SafeHtml__NewsItem_item___SafeHtmlTemplates extends com.google.gwt.safehtml.client.SafeHtmlTemplates {
      @Template("<div><h3>{0}</h3><p>
    \n    {1}
    \n    </p></div>")
      SafeHtml render0(java.lang.String arg0, java.lang.String arg1);
    }
    I was directly wondering what the '\n's did there.
    So I stripped my html file to something like:
    Code:
    <div style="border: 1px solid black;">
        <h3>{item.title}</h3>
        <p>{item.text}</p>
    </div>
    and then it did work.
    To finally come to a conclusion, it seems that you can't put any newlines between your tags or they'll be incorrectly parsed to '\n's, causing the template not to work.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    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


    Thanks for this - we've seen one other report of this, and so far it seems specific to windows users, as on windows, newlines are typically /r/n, not just /n. Can you confirm that you are using Windows, or the developer who wrote that template was?

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    22
    Vote Rating
    0
    EthiC is on a distinguished road

      0  

    Default


    Yes, I'm using Windows

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    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


    Great, thanks - we'll update this thread when we have a fix.

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    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


    This fix is in SVN - \r\n newlines shouldn't affect XTemplates any longer.

  6. #6
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
    WesleyMoy is on a distinguished road

      0  

    Default


    This fix should now be reflected in beta 4. If you continue to notice any problems with line endings in XTemplate, post a message and I'll follow up with the team.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi