Pivot
  1. Pivot
  2. PIVOT-834

Form.getSection(Component) to return the section for nested components

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.0.1, 2.0.2, 2.0.3
    • Fix Version/s: 2.0.3
    • Component/s: wtk
    • Labels:
      None

      Description

      Form.getSection returns the Form.Section of the given component. However, it currently only works for top-level components and returns null for components nested inside other components.

      This request is for the method to return the correct form section for all components of a form, regardless of whether they are nested or not.

      1. pivot-834.patch
        2 kB
        Roger Whitcomb

        Activity

        Show
        Sandro Martini added a comment - Some info here: http://apache-pivot-users.399431.n3.nabble.com/Form-getSection-returns-null-for-nested-components-td3643647.html
        Hide
        Roger Whitcomb added a comment -

        In looking into this change, there are some subtle implications to changing the existing method:
        1) TerraFormSkin uses Form.getSection() in conjunction with section.indexOf() in the "labelChanged" method. This probably would break badly with the proposed change, and the follow-on changes to "getIndex" and etc. would quickly get to be very confusing.
        2) As someone noted this is easy enough to implement in an application by following the parent chain.

        So, I would propose adding another method: "Form.getEnclosingSection(Component)" that would do what is requested for when it is needed, but leave the existing method alone.

        Show
        Roger Whitcomb added a comment - In looking into this change, there are some subtle implications to changing the existing method: 1) TerraFormSkin uses Form.getSection() in conjunction with section.indexOf() in the "labelChanged" method. This probably would break badly with the proposed change, and the follow-on changes to "getIndex" and etc. would quickly get to be very confusing. 2) As someone noted this is easy enough to implement in an application by following the parent chain. So, I would propose adding another method: "Form.getEnclosingSection(Component)" that would do what is requested for when it is needed, but leave the existing method alone.
        Hide
        Roger Whitcomb added a comment -

        The "pivot-834.patch" file implements my suggestion (no change to "getSection", add a new "getEnclosingSection" method). Adds Javadoc to explain what each does.

        Show
        Roger Whitcomb added a comment - The "pivot-834.patch" file implements my suggestion (no change to "getSection", add a new "getEnclosingSection" method). Adds Javadoc to explain what each does.
        Hide
        Sandro Martini added a comment -

        To me the patch seems Ok, so unless objections I'd say to commit in 2.0.x (and as usual even in trunk), and reassign this to 2.0.3 .

        Show
        Sandro Martini added a comment - To me the patch seems Ok, so unless objections I'd say to commit in 2.0.x (and as usual even in trunk), and reassign this to 2.0.3 .
        Hide
        Roger Whitcomb added a comment -

        [trunk]
        Sending wtk\src\org\apache\pivot\wtk\Form.java
        Transmitting file data .
        Committed revision 1401781.

        [branches/2.0.x]
        Sending .
        Sending wtk\src\org\apache\pivot\wtk\Form.java
        Transmitting file data .
        Committed revision 1401783.

        Show
        Roger Whitcomb added a comment - [trunk] Sending wtk\src\org\apache\pivot\wtk\Form.java Transmitting file data . Committed revision 1401781. [branches/2.0.x] Sending . Sending wtk\src\org\apache\pivot\wtk\Form.java Transmitting file data . Committed revision 1401783.

          People

          • Assignee:
            Roger Whitcomb
            Reporter:
            David Keen
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development