use-when for widget-screen.xsd

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

use-when for widget-screen.xsd

Harmeet Bedi
I would like to ask you what you think about having use-when attribute for various screen elements and defaulted to true.

The current condition check and widgets, fail-widgets mechanism is a bit wordy, does not allow easy switching for any type of element and is not as close in grammer to use-when in widget-form.xsd.. should make grammers closer if possible in various spots.

I was hoping it to have it for all elements. so for instance one could say something like this:

<include-form name="FormRef1" location="SomeLocation.xml" use-when="${showRef1}"/>
<include-form name="FormRef2" location="SomeLocation.xml" use-when="${showRef2}"/>

or container, or widget or etc..

<container use-when="${showSpecialCaseContainer}">
..
</container>


Thoughts ?
Harmeet
Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

Anil Patel-3
Harmeet,
Looks good, will be nice thing to add.

Regards
Anil Patel

On Jul 24, 2009, at 7:13 AM, Harmeet Bedi wrote:

> I would like to ask you what you think about having use-when  
> attribute for various screen elements and defaulted to true.
>
> The current condition check and widgets, fail-widgets mechanism is a  
> bit wordy, does not allow easy switching for any type of element and  
> is not as close in grammer to use-when in widget-form.xsd.. should  
> make grammers closer if possible in various spots.
>
> I was hoping it to have it for all elements. so for instance one  
> could say something like this:
>
> <include-form name="FormRef1" location="SomeLocation.xml" use-when="$
> {showRef1}"/>
> <include-form name="FormRef2" location="SomeLocation.xml" use-when="$
> {showRef2}"/>
>
> or container, or widget or etc..
>
> <container use-when="${showSpecialCaseContainer}">
> ..
> </container>
>
>
> Thoughts ?
> Harmeet

Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

awdesh parihar
+1 ,
It will help to avoid writing extra code in fail-widget .

--
--
Awdesh Parihar
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

Adrian Crum-2
In reply to this post by Harmeet Bedi

I'm glad this has been brought up. I agree that the current screen widget conditional logic is cumbersome to use.

The use-when attribute is one alternative, another approach would be to include support of the mini-lang if conditional element - so multiple screen widgets can be included in a conditional block (without the need for a section element).

While we're on the subject, the section element should be optional. According to David Jones' comments, the section element was meant to be a way to reuse sections of a screen. Yet that capability hasn't been implemented. Every screen must have one main section element. If you try to create more than one main section element the rest are ignored. The end result is, every screen definition has an unnecessary section element. From my perspective, a screen element should BE a section element (in other words, a screen IS a section) which would eliminate the need to create one, and section elements within the screen should require a name - since the intent is to reuse that section. If those rules were enforced, then the if element could control the display of portions of screens, and the screen sections are clearly meant to be reused.

-Adrian


--- On Thu, 7/23/09, Harmeet Bedi <[hidden email]> wrote:

> From: Harmeet Bedi <[hidden email]>
> Subject: use-when for widget-screen.xsd
> To: "dev" <[hidden email]>
> Date: Thursday, July 23, 2009, 6:43 PM
> I would like to ask you what you
> think about having use-when attribute for various screen
> elements and defaulted to true.
>
> The current condition check and widgets, fail-widgets
> mechanism is a bit wordy, does not allow easy switching for
> any type of element and is not as close in grammer to
> use-when in widget-form.xsd.. should make grammers closer if
> possible in various spots.
>
> I was hoping it to have it for all elements. so for
> instance one could say something like this:
>
> <include-form name="FormRef1"
> location="SomeLocation.xml" use-when="${showRef1}"/>
> <include-form name="FormRef2"
> location="SomeLocation.xml" use-when="${showRef2}"/>
>
> or container, or widget or etc..
>
> <container use-when="${showSpecialCaseContainer}">
> ..
> </container>
>
>
> Thoughts ?
> Harmeet
>


     
Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

David E. Jones-2
In reply to this post by Harmeet Bedi

To be honest I originally threw the use-when tag into the form field  
as a hack since I didn't want to implement more comprehensive  
conditionals at the time.

One big issue with the use-when tag is parse-ability, for certain  
machine things and also for certain people, and that was the reason in  
simple-methods and the screen widget for more comprehensive  
conditionals.

-David


On Jul 23, 2009, at 7:43 PM, Harmeet Bedi wrote:

> I would like to ask you what you think about having use-when  
> attribute for various screen elements and defaulted to true.
>
> The current condition check and widgets, fail-widgets mechanism is a  
> bit wordy, does not allow easy switching for any type of element and  
> is not as close in grammer to use-when in widget-form.xsd.. should  
> make grammers closer if possible in various spots.
>
> I was hoping it to have it for all elements. so for instance one  
> could say something like this:
>
> <include-form name="FormRef1" location="SomeLocation.xml" use-when="$
> {showRef1}"/>
> <include-form name="FormRef2" location="SomeLocation.xml" use-when="$
> {showRef2}"/>
>
> or container, or widget or etc..
>
> <container use-when="${showSpecialCaseContainer}">
> ..
> </container>
>
>
> Thoughts ?
> Harmeet

Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

David E. Jones-2
In reply to this post by Adrian Crum-2

On Jul 23, 2009, at 10:51 PM, Adrian Crum wrote:

>
> I'm glad this has been brought up. I agree that the current screen  
> widget conditional logic is cumbersome to use.
>
> The use-when attribute is one alternative, another approach would be  
> to include support of the mini-lang if conditional element - so  
> multiple screen widgets can be included in a conditional block  
> (without the need for a section element).
>
> While we're on the subject, the section element should be optional.  
> According to David Jones' comments, the section element was meant to  
> be a way to reuse sections of a screen. Yet that capability hasn't  
> been implemented.

Actually, the real reason was to have a consistent structure for  
conditions, actions, and widgets regardless of whether it is the top-
level section or a section including as a widget (ie in the widgets  
part of a section).

The idea of reuse with a section name was an after thought, and like  
you say has not really been used or implemented for yet. However...  
that could change especially for alternatives to the decorator pattern  
(which some complain about as being overly complex).

-David


> Every screen must have one main section element. If you try to  
> create more than one main section element the rest are ignored. The  
> end result is, every screen definition has an unnecessary section  
> element. From my perspective, a screen element should BE a section  
> element (in other words, a screen IS a section) which would  
> eliminate the need to create one, and section elements within the  
> screen should require a name - since the intent is to reuse that  
> section. If those rules were enforced, then the if element could  
> control the display of portions of screens, and the screen sections  
> are clearly meant to be reused.
>
> -Adrian
>
>
> --- On Thu, 7/23/09, Harmeet Bedi <[hidden email]> wrote:
>
>> From: Harmeet Bedi <[hidden email]>
>> Subject: use-when for widget-screen.xsd
>> To: "dev" <[hidden email]>
>> Date: Thursday, July 23, 2009, 6:43 PM
>> I would like to ask you what you
>> think about having use-when attribute for various screen
>> elements and defaulted to true.
>>
>> The current condition check and widgets, fail-widgets
>> mechanism is a bit wordy, does not allow easy switching for
>> any type of element and is not as close in grammer to
>> use-when in widget-form.xsd.. should make grammers closer if
>> possible in various spots.
>>
>> I was hoping it to have it for all elements. so for
>> instance one could say something like this:
>>
>> <include-form name="FormRef1"
>> location="SomeLocation.xml" use-when="${showRef1}"/>
>> <include-form name="FormRef2"
>> location="SomeLocation.xml" use-when="${showRef2}"/>
>>
>> or container, or widget or etc..
>>
>> <container use-when="${showSpecialCaseContainer}">
>> ..
>> </container>
>>
>>
>> Thoughts ?
>> Harmeet
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: use-when for widget-screen.xsd

Harmeet Bedi
In reply to this post by Harmeet Bedi
mini-lang would be a nice add on but i think very convenient to have use-when. use-when is pretty popular in forms so will need very little training. I feel ofbiz should try to reuse grammer present in different xsds. Less concepts, less training.

Section optional seems like a great idea. We always use separate screens and call one from other using include-screen. Never thought about sections. It seems to add little from grammer pov. You are suggesting allowing sub elements of section (actions, widget etc.) to be under screen right ?

Harmeet

----- Original Message -----
From: "Adrian Crum" <[hidden email]>
To: [hidden email]
Sent: Friday, July 24, 2009 12:51:01 AM GMT -05:00 US/Canada Eastern
Subject: Re: use-when for widget-screen.xsd


I'm glad this has been brought up. I agree that the current screen widget conditional logic is cumbersome to use.

The use-when attribute is one alternative, another approach would be to include support of the mini-lang if conditional element - so multiple screen widgets can be included in a conditional block (without the need for a section element).

While we're on the subject, the section element should be optional. According to David Jones' comments, the section element was meant to be a way to reuse sections of a screen. Yet that capability hasn't been implemented. Every screen must have one main section element. If you try to create more than one main section element the rest are ignored. The end result is, every screen definition has an unnecessary section element. From my perspective, a screen element should BE a section element (in other words, a screen IS a section) which would eliminate the need to create one, and section elements within the screen should require a name - since the intent is to reuse that section. If those rules were enforced, then the if element could control the display of portions of screens, and the screen sections are clearly meant to be reused.

-Adrian


--- On Thu, 7/23/09, Harmeet Bedi <[hidden email]> wrote:

> From: Harmeet Bedi <[hidden email]>
> Subject: use-when for widget-screen.xsd
> To: "dev" <[hidden email]>
> Date: Thursday, July 23, 2009, 6:43 PM
> I would like to ask you what you
> think about having use-when attribute for various screen
> elements and defaulted to true.
>
> The current condition check and widgets, fail-widgets
> mechanism is a bit wordy, does not allow easy switching for
> any type of element and is not as close in grammer to
> use-when in widget-form.xsd.. should make grammers closer if
> possible in various spots.
>
> I was hoping it to have it for all elements. so for
> instance one could say something like this:
>
> <include-form name="FormRef1"
> location="SomeLocation.xml" use-when="${showRef1}"/>
> <include-form name="FormRef2"
> location="SomeLocation.xml" use-when="${showRef2}"/>
>
> or container, or widget or etc..
>
> <container use-when="${showSpecialCaseContainer}">
> ..
> </container>
>
>
> Thoughts ?
> Harmeet
>