Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369081

Handling of lists in attributes differs depending on type of component

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      This relates to how the FXML loader is parsing the input.
      To supply multiple values to an attribute the standard behavior is that you separate the values with a comma (,), for instance, styleClass=niftystyle,evenniftierstyle. The expected behavior is that you now have two entries in the stylClass List. For some components however, this is not the case. The value is not split at the comma and you end up with one value in the styleClass List which is incorrect.
      Upon investigating the loading it seems that the "problematic" components are the ones which take @NamedArgs in the constructor. This is because these are handled in a separate branch in javafx.fxml.FXMLLoader.Element#processValue. Components without @NamedArg are handled in the branch where javafx.fxml.FXMLLoader.Element#populateListFromString is called. Components with @NamedArgs on the other side are handled in com.sun.javafx.fxml.builder.ProxyBuilder which does not have any parsing for lists.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create an XML file suitable for the FXML loader and include any component that takes @NamedArg in the constructor input. Add an attribute to, for instance, styleClass that contains several entries separated by commas. Note that the result in the component is not multiple elements as expected but one long string still containing commas.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The string is spit just as for "standard" components.
      ACTUAL -
      One long "unsplit" String in the list.

            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: