Change decorator-screen name in runtime

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Change decorator-screen name in runtime

Deepika1234
Hi All,


I have the following code in CommonScreens.xml, I  have set a session
attribute in the runtime , suppose " setType" ,it's value being  Blue.

Now what i want is , depending on the value of setType , i want to change
my decorator screen,

If setType="Blue" then, decorator-screen name is main-decorator, else if
setType="Green", i want the decorator-screen name to be main-decorator1

Is it possible ? please let me know.

Can we have an if condition in the code?

<screen name="findAmount">
                <section>
                        <actions>
                                <set field="MainColumnStyle" value=
"center" />
                                <script
                                        location=
"component://ecommerce/webapp/ecommerce/WEB-INF/actions/splash/findAmount.groovy"
/>
                                <set field="isCatalogLandingPage" value=
"Y" />
                        </actions>
                        <widgets>
                                <decorator-screen name="main-decorator"
                                        location=
"${parameters.mainDecoratorLocation}">
                                        <decorator-section name="body">
                                                <platform-specific>
                                                        <html>
                                                                <
html-template
                                                                       
location=
"component://ecommerce/webapp/ecommerce/ftl/catalog/findAmount.ftl" />
                                                        </html>

                                                </platform-specific>
                                        </decorator-section>
                                </decorator-screen>

                        </widgets>
                </section>
        </screen>



Regards,
Deepika Sahu
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you


Reply | Threaded
Open this post in threaded view
|

Re: Change decorator-screen name in runtime

Adrian Crum-3
That is a bad design pattern. Decorators are meant to contain screen
elements that are constant across screens. I recommend using the Content
component for what you describe.

-Adrian

On 4/18/2012 12:41 PM, Deepika1 S wrote:

> Hi All,
>
>
> I have the following code in CommonScreens.xml, I  have set a session
> attribute in the runtime , suppose " setType" ,it's value being  Blue.
>
> Now what i want is , depending on the value of setType , i want to change
> my decorator screen,
>
> If setType="Blue" then, decorator-screen name is main-decorator, else if
> setType="Green", i want the decorator-screen name to be main-decorator1
>
> Is it possible ? please let me know.
>
> Can we have an if condition in the code?
>
> <screen name="findAmount">
>                  <section>
>                          <actions>
>                                  <set field="MainColumnStyle" value=
> "center" />
>                                  <script
>                                          location=
> "component://ecommerce/webapp/ecommerce/WEB-INF/actions/splash/findAmount.groovy"
> />
>                                  <set field="isCatalogLandingPage" value=
> "Y" />
>                          </actions>
>                          <widgets>
>                                  <decorator-screen name="main-decorator"
>                                          location=
> "${parameters.mainDecoratorLocation}">
>                                          <decorator-section name="body">
>                                                  <platform-specific>
>                                                          <html>
>                                                                  <
> html-template
>
> location=
> "component://ecommerce/webapp/ecommerce/ftl/catalog/findAmount.ftl" />
>                                                          </html>
>
>                                                  </platform-specific>
>                                          </decorator-section>
>                                  </decorator-screen>
>
>                          </widgets>
>                  </section>
>          </screen>
>
>
>
> Regards,
> Deepika Sahu
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Change decorator-screen name in runtime

Ankit Jain-2
In reply to this post by Deepika1234
You can handle this with condition / widget / fail-widget tags and
also make two different screens for different decorators and in the
condition section check if it is blue then it will go to included
screen in widget section otherwise if it is green then it will go to
fail-widgets screen.


Regards,
Ankit Jain




On Wed, Apr 18, 2012 at 5:11 PM, Deepika1 S <[hidden email]> wrote:

> Hi All,
>
>
> I have the following code in CommonScreens.xml, I  have set a session
> attribute in the runtime , suppose " setType" ,it's value being  Blue.
>
> Now what i want is , depending on the value of setType , i want to change
> my decorator screen,
>
> If setType="Blue" then, decorator-screen name is main-decorator, else if
> setType="Green", i want the decorator-screen name to be main-decorator1
>
> Is it possible ? please let me know.
>
> Can we have an if condition in the code?
>
> <screen name="findAmount">
>                <section>
>                        <actions>
>                                <set field="MainColumnStyle" value=
> "center" />
>                                <script
>                                        location=
> "component://ecommerce/webapp/ecommerce/WEB-INF/actions/splash/findAmount.groovy"
> />
>                                <set field="isCatalogLandingPage" value=
> "Y" />
>                        </actions>
>                        <widgets>
>                                <decorator-screen name="main-decorator"
>                                        location=
> "${parameters.mainDecoratorLocation}">
>                                        <decorator-section name="body">
>                                                <platform-specific>
>                                                        <html>
>                                                                <
> html-template
>
> location=
> "component://ecommerce/webapp/ecommerce/ftl/catalog/findAmount.ftl" />
>                                                        </html>
>
>                                                </platform-specific>
>                                        </decorator-section>
>                                </decorator-screen>
>
>                        </widgets>
>                </section>
>        </screen>
>
>
>
> Regards,
> Deepika Sahu
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Change decorator-screen name in runtime

prasath
In reply to this post by Deepika1234
hi Deepika,

  You can do this.
   In decorator declaration,
   according to your condition you can turn decorator-name.

  <decorator-screen name="${decorator-name}" location="">
   location empty,if its in the same file.

Thanks








On Wed, Apr 18, 2012 at 5:11 PM, Deepika1 S <[hidden email]> wrote:

> Hi All,
>
>
> I have the following code in CommonScreens.xml, I  have set a session
> attribute in the runtime , suppose " setType" ,it's value being  Blue.
>
> Now what i want is , depending on the value of setType , i want to change
> my decorator screen,
>
> If setType="Blue" then, decorator-screen name is main-decorator, else if
> setType="Green", i want the decorator-screen name to be main-decorator1
>
> Is it possible ? please let me know.
>
> Can we have an if condition in the code?
>
> <screen name="findAmount">
>                <section>
>                        <actions>
>                                <set field="MainColumnStyle" value=
> "center" />
>                                <script
>                                        location=
>
> "component://ecommerce/webapp/ecommerce/WEB-INF/actions/splash/findAmount.groovy"
> />
>                                <set field="isCatalogLandingPage" value=
> "Y" />
>                        </actions>
>                        <widgets>
>                                <decorator-screen name="main-decorator"
>                                        location=
> "${parameters.mainDecoratorLocation}">
>                                        <decorator-section name="body">
>                                                <platform-specific>
>                                                        <html>
>                                                                <
> html-template
>
> location=
> "component://ecommerce/webapp/ecommerce/ftl/catalog/findAmount.ftl" />
>                                                        </html>
>
>                                                </platform-specific>
>                                        </decorator-section>
>                                </decorator-screen>
>
>                        </widgets>
>                </section>
>        </screen>
>
>
>
> Regards,
> Deepika Sahu
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
prasath rajan 9442369696