This one is interesting... I'm sure there's a way to solve this, but I'm not thinking of it right now.

---------- Forwarded message ----------
From: Lincoln Baxter, III <lincolnbaxter@gmail.com>
Date: Mon, Sep 17, 2012 at 12:07 PM
Subject: Re: Dynamic adding of children to a template in Errai-UI
To: Daniel Sachse <sachsedaniel@gmail.com>


Yes, I see your point. Let me think about that.


On Mon, Sep 17, 2012 at 8:35 AM, Daniel Sachse <sachsedaniel@gmail.com> wrote:
Hey Lincoln,

don´t worry about that! I think we are all busy and such a response timeframe is absolutely normal ;)

Unfortunatly your example is not 100% solving my problem. The solution assumes, that the UL is a subcomponent of the template.

What I want to is the following:
-----------------------------------------
UL.html:

<ul class="super special">
<li class="class">1</li>
        <li>2</li>
</ul>
----------------------------------------
UL.java:

@Templated
public class UL extends Composite {

public void addLI(LI li) {
SOME_MAGIC_TO_ADD_LI_TO_UL(li);
}

}

I could solve the problem by surrounding the UL with a div as a temp. workaround. But If I then try to template an LI element, then I would run into:

<ul>
<div>
<li>…</li>
</div>
<div>
<li>…</li>
</div>
….
</ul>

I think that this is not a solution we all want for these kind of scenarios. I hope this example made it a little bit more clear what I am trying to do.

Regards,

Daniel

Am 17.09.2012 um 06:47 schrieb "Lincoln Baxter, III" <lincolnbaxter@gmail.com>:

Hey Daniel!

Sorry for the late reply - busy weekend :) I think this example shows how to do what you want to do.

https://github.com/ocpsoft/socialpm/blob/master/gwt/src/main/java/com/ocpsoft/socialpm/gwt/client/local/view/component/ProjectList.java

Let me know if it doesn't!

~Lincoln

On Sat, Sep 15, 2012 at 1:16 PM, Daniel Sachse <sachsedaniel@gmail.com> wrote:
Hey Lincoln,

I hope you are up well and had a nice time while I was off because of my holiday.

I started playing around with Errai-UI and one question came up to my mind:
I am building a Component with the @Templated mechanism. This all works fine so far(GREAT WORK!).
What I am now trying to do is to dynamically add Children to this template. Is this somehow possible? I saw that I can access the template widget by casting getWidget() to TemplateWidget, but I couldn´t find an appropriate add(..) method :( .
Would be cool if this could be done somehow.

Hope I was clear enough :)

Regards,

Daniel





--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."




--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."



--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."