-
Notifications
You must be signed in to change notification settings - Fork 146
JDK-8091189: Make BehaviorBase Public API #241
Comments
This is tracked by JDK-8091189. The short answer is that we have no plans to do this. Making behaviors public is a very large project, and not something we would do without a compelling reason. It was originally proposed as part of JEP 253, but was decoupled after some investigation. Unlike the public Skin APIs, which were relatively straight-forward and are necessary to allow third-party developers to implement their own controls, a public Behavior API was larger in scope and not as clearly a requirement. Additionally, there was a not-fully-answered discussion about design direction. I recommend reading the long discussion in JDK-8091189 starting with about this comment to the end. |
@kevinrushforth thank you for the summary about the current state. I've also stumbled over the "problem", that I would like to model my applications according to the MVC pattern. The more important issue for me is, that I couldn't really find a guide, which explains the recommended way to implement custom components, i.e. how the different aspects of a custom component should be divided to different classes. Most articles I found about this topic suggest implementing the behavior part in a class extending the I believe it would help a lot of people (including myself), if someone, working on JavaFX/OpenJFX, writes a new article, which explains the current state and provides a recommendation about how a custom component should be implemented in a MVC way. |
The Skin could separate out the controller functionality into another class. Depending on the control you extends you would get the default behavior for that control, and still be able to implement additional behavior on top. From the Javadoc:
I have created a CustomBehavior for my CustomSkin, which does not extend anything, but is used from within the Skin to affect the behavior of the control. That way I get the separation of concern with MVC. |
We should have Behavior as public API, so we can get all aspect of MVC available in JavaFX.
Are there any plans for doing this?
This sentence has been a part of the JavaFX javadoc for a very long time.
I was creating my own Behavior class to use in my Skin. Since I do not want to rely on the private API com.sun.javafx.scene.control.behavior.BehaviorBase, my Behavior does not extend anything. It contains the behavior which is accessed from the Skin. I have done as suggested in the Javadoc to delegate out from the Skin the behavior in a seperate class.
This one here got me to laugh a bit while I was reading the code in TextFieldBehavior for inspiration.
Why does the behavior have an unholy back-reference? Perhaps some further explanation should be written along with this statement.
The text was updated successfully, but these errors were encountered: