Uploaded image for project: 'Talend Component Kit'
  1. Talend Component Kit
  2. TCOMP-313

Improve readability of the "refreshLayout" method of ComponentProperties

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

    • New Feature
    • Resolution: Fixed
    • Minor
    • 0.1.0
    • None
    • None
    • None
    • All
    • GreenHopper Ranking:
      0|i0wvvv:
    • 9223372036854775807
    • Small

    Description

      The ComponentProperties contains a method called "refreshLayout".
      This method allow us to set is a property is visible or not.

      The API provide only a method to "hide" field, but no method to set them visible.
      This add an unnecessary complexity on the definition of the visibility of the element and could be solve with few method on the class Form and Widget.

      I propose to add:

      • a "setVisible" method;
      • imply the boolean when the developer do not specify it;
      • add the possibility for the Form to retrieve a Widget directly from a Property.

      Currently the code looks like:

      if (useOtherConnection) {
          form.getWidget(useDataSource.getName()).setHidden(true);
          form.getWidget(dataSource.getName()).setHidden(true);
      } else {
          form.getWidget(useDataSource.getName()).setHidden(false);
          form.getWidget(dataSource.getName()).setHidden(!useDataSource.getValue());
      }
      

      My proposal would allow the user to do:

      if (useOtherConnection) {
          form.getWidget(useDataSource).setHidden();
          form.getWidget(dataSource).setHidden();
      } else {
          form.getWidget(useDataSource).setVisible();
          form.getWidget(dataSource).setVisible(useDataSource);
      }
      

      Attachments

        Activity

          People

            pbailly Pierre Bailly
            pbailly Pierre Bailly
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: