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 <harmeet.b...@gmail.com> wrote:

> From: Harmeet Bedi <harmeet.b...@gmail.com>
> Subject: use-when for widget-screen.xsd
> To: "dev" <dev@ofbiz.apache.org>
> 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 via email to