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

Allow the title and message properties of Service to be set when Service has a state of Worker.State.READY.

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u40
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:

      Description

      I'm not sure which component this would be. It affects all versions. I didn't know if I should list it as a bug or an improvement.

      When working with javafx.concurrent.Service, both the title and message properties of the service will return empty strings whenever the service state is READY. This is because, when the Service is started, both properties are temporarily bound to matching properties in an underlying Task. When the Service is reset both properties are unbound and set to "" (empty). The explicit calls to set happen in the reset() method of Service.

      This makes it difficult to build a control that shows a list of Services that can be managed (started, cancelled, etc.) by the user. The title and message properties aren't usable because, assuming all Services are added to the list with a state of READY, all of the titles and messages are blank.

      I can think of a couple options to make the API a little more usable...

      1) Add something like readyTitle and readyMessage properties to Service. Alternate names could be idleTitle, unboundTitle, emptyTitle.
      2) Add protected methods that would allow sub-classes to supply values that are used when the title and message are unbound.

      Personally, I would prefer to set the title for a Service directly rather than having it bind to underlying task. Using either of the above suggestions I would have to ensure both the Service and underlying Task(s) are using the same title if I don't ever want the title to change.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rjaebjfx Ryan Jaeb (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: