Don't mind,
I finally found this solution:
        public boolean eval(Map<String, Object> context) {
            Map<String, Object> sectionsList =
UtilGenerics.toMap(context.get("sections"));
            return
!sectionsList.containsKey(this.decoratorSectionExdr.expandString(context));
        }

Thank you anyway.
-Bruno

2009/11/29 Bruno Busco <bruno.bu...@gmail.com>:
> I have added a new ScreenCondition in the ModelScreenCondition.java as 
> follows:
>    public static class IfEmptyDecoratorSection extends ScreenCondition {
>        protected FlexibleStringExpander decoratorSectionExdr;
>
>        public IfEmptyDecoratorSection(ModelScreen modelScreen,
> Element condElement) {
>            super (modelScreen, condElement);
>            this.decoratorSectionExdr =
> FlexibleStringExpander.getInstance(condElement.getAttribute("decorator-section"));
>        }
>
>       �...@override
>        public boolean eval(Map<String, Object> context) {
>            Debug.logWarning("if-empty-decorator-section TEST", module);
>            return false;
>        }
>    }
>
> but I do not understand how to actually check for the decorator
> section being empty or not.
> Could somebody help me?
> Thank you,
> Bruno
>
> 2009/11/28 Bruno Busco <bruno.bu...@gmail.com>:
>> Hi list,
>> could someone please tell me if there is any way to check in a screen
>> condition if a decorator section is empty?
>>
>> I would like to do something similar to this:
>>
>> <container style="contentarea">
>> <decorator-section-include name="pre-body"/>
>> <container id="column-container">
>>    <section>
>>        <condition>
>>            <if-decorator-section-empty decorator-section="left-bar"/>
>>        </condition>
>>        <widgets>
>>            <container id="content-main-section">
>>                <decorator-section-include name="body"/>
>>            </container>
>>        </widgets>
>>        <fail-widgets>
>>            <container style="left">
>>                <decorator-section-include name="left-bar"/>
>>            </container>
>>            <container id="content-main-section" style="leftonly">
>>                <decorator-section-include name="body"/>
>>            </container>
>>        </fail-widgets>
>>    </section>
>> </container>
>>
>> Basically this is used to have the leftbar filled using a new
>> decorator-section defined in the GlobalDecorator and not using any
>> more the leftbarScreenName and leftbarScreenLocation so that for
>> instance the CommonCatalogDecorator would change from
>>
>>    <screen name="CommonCatalogDecorator">
>>        <section>
>>            <actions>
>>                <set field="leftbarScreenName" value="leftbar"/>
>>                <set field="leftbarScreenLocation"
>> value="component://product/widget/catalog/CommonScreens.xml"/>
>>                <set field="MainColumnStyle" value="leftonly"/>
>>            </actions>
>>            <widgets>
>>                <decorator-screen name="main-decorator"
>> location="${parameters.mainDecoratorLocation}">
>>                    <decorator-section name="pre-body">
>>                        <section>
>>                            <!-- do check for CATALOG, _VIEW permission -->
>>                            <condition>
>>                                <and>
>> ..................
>> to
>>
>>    <screen name="CommonCatalogDecorator">
>>        <section>
>>            <widgets>
>>                <decorator-screen name="main-decorator"
>> location="${parameters.mainDecoratorLocation}">
>>                    <decorator-section name="left-bar">
>>                        <include-screen name="leftbar"/>
>>                    </decorator-section>
>>                    <decorator-section name="pre-body">
>>                        <section>
>>                            <!-- do check for CATALOG, _VIEW permission -->
>>                            <condition>
>>                                <and>
>>
>> The problem I have found is that the GlobalDecorator needs to apply
>> the "leftonly" style to the <container id="content-main-section"> only
>> if the leftbar does include content.
>>
>> Any thought about this?
>>
>> Thank you so much,
>> Bruno
>>
>

Reply via email to