OFBiz
  1. OFBiz
  2. OFBIZ-4090

Add Support For Compound Screen Widget XML Files

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None

      Description

      Add the ability to include screen widgets, form widgets, menu widgets, and simple methods in a single XML file. This approach could be used in situations where the widgets share a logical grouping - so they can be kept in one place.

      1. CompoundWidgetFiles.patch
        471 kB
        Adrian Crum
      2. CompoundWidgetFiles.patch
        8 kB
        Adrian Crum

        Activity

        Hide
        Adrian Crum added a comment - - edited

        The attached patch demonstrates the concept.

        There is an issue preventing it from being committed: The XML validator reports errors because the schemas don't contain a target namespace. If I add a target namespace to the schemas, the validator reports errors because it was expecting the target namespace to be empty. I don't know how to solve that problem and I'm hoping an XML expert can figure it out.

        Show
        Adrian Crum added a comment - - edited The attached patch demonstrates the concept. There is an issue preventing it from being committed: The XML validator reports errors because the schemas don't contain a target namespace. If I add a target namespace to the schemas, the validator reports errors because it was expecting the target namespace to be empty. I don't know how to solve that problem and I'm hoping an XML expert can figure it out.
        Hide
        Adrian Crum added a comment -

        Updated patch file. XML parsing errors have been fixed with new schemas. Modifying the existing schemas didn't work because that caused parsing errors on existing screens (~1MB log entries per request).

        This patch also adds the ability to include a controller <site-conf> element in the compound widget file - an idea suggested by David.

        It all works and it is ready to commit if the community agrees it is a worthwhile improvement.

        Show
        Adrian Crum added a comment - Updated patch file. XML parsing errors have been fixed with new schemas. Modifying the existing schemas didn't work because that caused parsing errors on existing screens (~1MB log entries per request). This patch also adds the ability to include a controller <site-conf> element in the compound widget file - an idea suggested by David. It all works and it is ready to commit if the community agrees it is a worthwhile improvement.
        Hide
        Paul Foxworthy added a comment -

        I would prefer a more descriptive name than "root" for the root element. What about "widgets" or "ofbiz-widgets"?

        Shouldn't there be a schema for the root element, whatever name it has, specifying the valid name for the root element and valid subelements within it? It would be a very simple schema compared to the ones for screen widgets etc, but should be there for completeness, I think. Any reason why not?

        Show
        Paul Foxworthy added a comment - I would prefer a more descriptive name than "root" for the root element. What about "widgets" or "ofbiz-widgets"? Shouldn't there be a schema for the root element, whatever name it has, specifying the valid name for the root element and valid subelements within it? It would be a very simple schema compared to the ones for screen widgets etc, but should be there for completeness, I think. Any reason why not?
        Hide
        Adrian Crum added a comment -

        The root element could be called anything. "widgets" sounds good to me.

        I created a schema for the root element, but I couldn't get it to work. The file would parse fine, but in Eclipse all of the elements were shifted down one level - meaning auto-complete would insert values from child elements, not the selected element. Maybe it's just a problem with Eclipse - I don't know.

        If anyone can improve upon the patch, they are welcome to do so.

        Show
        Adrian Crum added a comment - The root element could be called anything. "widgets" sounds good to me. I created a schema for the root element, but I couldn't get it to work. The file would parse fine, but in Eclipse all of the elements were shifted down one level - meaning auto-complete would insert values from child elements, not the selected element. Maybe it's just a problem with Eclipse - I don't know. If anyone can improve upon the patch, they are welcome to do so.
        Hide
        Paul Foxworthy added a comment -

        Is it easy for you to post a screenshot showing the problem? I don't use Eclipse, so I can't see what you're seeing.

        Show
        Paul Foxworthy added a comment - Is it easy for you to post a screenshot showing the problem? I don't use Eclipse, so I can't see what you're seeing.
        Hide
        Adrian Crum added a comment -

        Here is the root schema I tried:

        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   elementFormDefault="qualified">
            <xs:element name="root">
                <xs:complexType>
                    <xs:all minOccurs="0" maxOccurs="1">
                        <xs:element name="site-conf"/>
                        <xs:element name="simple-methods"/>
                        <xs:element name="forms"/>
                        <xs:element name="menus"/>
                        <xs:element name="trees"/>
                        <xs:element name="screens"/>
                    </xs:all>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        

        In Eclipse, you can right-click on an XML element and a popup menu appears with valid selections for that element - based on the schema. I can't provide a screen shot because now the popup menu doesn't show any suggestions from the schema. I'm almost certain it's a bug in Eclipse's XML editor.

        Show
        Adrian Crum added a comment - Here is the root schema I tried: <xs:schema xmlns:xs= "http: //www.w3.org/2001/XMLSchema" elementFormDefault= "qualified" > <xs:element name= "root" > <xs:complexType> <xs:all minOccurs= "0" maxOccurs= "1" > <xs:element name= "site-conf" /> <xs:element name= "simple-methods" /> <xs:element name= "forms" /> <xs:element name= "menus" /> <xs:element name= "trees" /> <xs:element name= "screens" /> </xs:all> </xs:complexType> </xs:element> </xs:schema> In Eclipse, you can right-click on an XML element and a popup menu appears with valid selections for that element - based on the schema. I can't provide a screen shot because now the popup menu doesn't show any suggestions from the schema. I'm almost certain it's a bug in Eclipse's XML editor.

          People

          • Assignee:
            Unassigned
            Reporter:
            Adrian Crum
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development