On 2011-02-07, at 3:48 PM, Igor Vaynberg wrote:

> not sure how well this would work. looks like, at least from examples,
> in lift you bind data to template, not components. like a jsp. eg you
> bind a list to a set of li tags which you select via css selector. in
> wicket you would bind a listview and configure it.
> 

The way I'd see it working is like so:

<div id="products">
<ul>
   <li>Mock product 1</li>
   <li>Mock product 2</li>
</ul>
</div>

add(new ListView("#products ul", productList) {    
protected void populateItem(ListItem item) {
        Product prod = (Product) item.getModelObject();
        item.add( new Label("#products ul li", prod.getName()));
    }
});

Hopefully you see what I mean, even if the example isn't perfect.  Probably in 
the case of ListViews the selector could be truncated to apply to descendants 
of the selector chosen for the ListView (i.e. would only need to be "li" 
instead of the full path)

Craig.

> -igor
> 
> 
> On Mon, Feb 7, 2011 at 1:41 PM, Craig Tataryn <[email protected]> wrote:
>> In reading the "7 reason's why Lift is so freaking awesome" article [1] one 
>> thing that surprised me was Lift adopted "Designer Friendly Templates" in 
>> v2.2.  I never really gave Lift a serious look because it seemed like every 
>> other "hack the design" type framework.
>> 
>> As I read more I realized they not only support normal binding as you might 
>> find in Wicket (albeit a bit different in Lift), they also support binding 
>> components to markup via CSS Selectors [2].  I think this would be awesome 
>> in Wicket, it could literally take you to a "developer doesn't touch the 
>> template" type Utopia.
>> 
>> My questions are:
>> Has this been attempted or discussed before in Wicket?
>> If I were to implement this would the procedure be to add an enhancement 
>> JIRA then attach the patch when I'm done?
>> 
>> I'm assuming I'd add a new ComponentResolver to the Application's resolver 
>> chain to implement this?   Found a CSS selector library I'm hoping will 
>> prove good [3]
>> 
>> Craig.
>> 
>> [1] - http://seventhings.liftweb.net/templates
>> [2] - http://www.assembla.com/wiki/show/liftweb/Binding_via_CSS_Selectors
>> [3] - https://github.com/chrsan/css-selectors

Reply via email to