You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Craig Tataryn <cr...@tataryn.net> on 2011/02/07 22:41:12 UTC

CSS Selector Enhancement

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

Re: CSS Selector Enhancement

Posted by Igor Vaynberg <ig...@gmail.com>.
cant be assigned to you because you dont have the developer role for
the wicket project in jira.

make a comment in the issue that you are working on it, that should be
good enough.

-igor


On Mon, Feb 7, 2011 at 2:56 PM, Craig Tataryn <cr...@tataryn.net> wrote:
> Would like to give this a shot, I created a JIRA for this enhancements, I was wondering if someone could assign it to me (uid: ctataryn):
>
> https://issues.apache.org/jira/browse/WICKET-3434
>
> Craig.
>
> On 2011-02-07, at 4:25 PM, Igor Vaynberg wrote:
>
>> what about listviews inside listviews? what would the selectors look
>> then? you would almost need "relative" selectors for it to work
>> correctly and not be overly verbose.
>>
>> -igor
>>
>> On Mon, Feb 7, 2011 at 2:03 PM, Craig Tataryn <cr...@tataryn.net> wrote:
>>>
>>> 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 <cr...@tataryn.net> 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
>>>
>>>
>
>

Re: CSS Selector Enhancement

Posted by Craig Tataryn <cr...@tataryn.net>.
Would like to give this a shot, I created a JIRA for this enhancements, I was wondering if someone could assign it to me (uid: ctataryn):

https://issues.apache.org/jira/browse/WICKET-3434

Craig.

On 2011-02-07, at 4:25 PM, Igor Vaynberg wrote:

> what about listviews inside listviews? what would the selectors look
> then? you would almost need "relative" selectors for it to work
> correctly and not be overly verbose.
> 
> -igor
> 
> On Mon, Feb 7, 2011 at 2:03 PM, Craig Tataryn <cr...@tataryn.net> wrote:
>> 
>> 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 <cr...@tataryn.net> 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
>> 
>> 


Re: CSS Selector Enhancement

Posted by Igor Vaynberg <ig...@gmail.com>.
what about listviews inside listviews? what would the selectors look
then? you would almost need "relative" selectors for it to work
correctly and not be overly verbose.

-igor

On Mon, Feb 7, 2011 at 2:03 PM, Craig Tataryn <cr...@tataryn.net> wrote:
>
> 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 <cr...@tataryn.net> 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
>
>

Re: CSS Selector Enhancement

Posted by Craig Tataryn <cr...@tataryn.net>.
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 <cr...@tataryn.net> 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


Re: CSS Selector Enhancement

Posted by Igor Vaynberg <ig...@gmail.com>.
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.

-igor


On Mon, Feb 7, 2011 at 1:41 PM, Craig Tataryn <cr...@tataryn.net> 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