[errai-dev] Dynamic adding of children to a template in Errai-UI

Lincoln Baxter, III lincolnbaxter at gmail.com
Mon Oct 15 17:32:22 EDT 2012


Hey Daniel,

I have a few thoughts about this. I think maybe the best solution is to
create a few convenience classes in Errai UI that handle wrapping Panels
for use in other objects, but yes, I did find something that I think will
help.

Could you just do something like this?

@DataField
> private HTMLPanel list = new HTMLPanel("ul", "");
>
> ...
> list.add(new ListItem());
>

Also, could I ask you to put this into a JIRA so the entire team can see
this and keep track of ideas?

https://issues.jboss.org/browse/ERRAI

I think the problem you are running in to is that you want to template an
LI, but you don't want to actually implement an LI widget? I think I'm
still missing a few details, sorry for being obtuse.

Also, perhaps you could ask in the #errai channel on IRC.freenode.net, I am
trying to get the team to monitor the dev list more, but for now, most
discussion happens on IRC. If nothing else, we can discuss on JIRA.

~Lincoln



On Tue, Oct 9, 2012 at 4:18 AM, Daniel Sachse <sachsedaniel at gmail.com>wrote:

> Hey Lincoln,
>
> How was JavaOne? Hope you had a great time and some nice talks.
> Did you find any solution for my problem?
>
> Regards,
>
> Daniel
>
> Am 17.09.2012 um 18:07 schrieb "Lincoln Baxter, III" <
> lincolnbaxter at gmail.com>:
>
> Yes, I see your point. Let me think about that.
>
> On Mon, Sep 17, 2012 at 8:35 AM, Daniel Sachse <sachsedaniel at 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 at 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 at 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."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/errai-dev/attachments/20121015/eac4fd44/attachment.html 


More information about the errai-dev mailing list