[
https://issues.apache.org/jira/browse/PIVOT-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888996#action_12888996
]
Michael Allman commented on PIVOT-573:
--------------------------------------
> The entire point of BXML is to instantiate and configure class instances.
And what I've proposed is a simple and, in my view, elegant solution to this
shortcoming. Factory methods have an established place in OO programming. Are
you suggesting Pivot users stop using factory methods to conform to this
limitation of BXML? Even if not, the fact that BXML does make it so much
easier to not use a factory method at least puts pressure on the developer to
use a named subclass where a factory method would be more appropriate.
On an aside, I think that the direction BXML is taking is putting the cart
before the horse. It's been moved out of the wtk source tree. While this
simplifies its mission, simple is not always easy. (Have I said this before?)
For example...
>> Why should "$" expressions be limited to variable references when it's easy
>> to support general expressions?
>
> Because it isn't necessary and it complicates the syntax. As I demonstrated
> in my previous comment, there are plenty of other ways you can accomplish this
> without needing to change the definition of the operator.
Well, you can say that about a lot of things. You don't need XML attributes in
BXML and they complicate the syntax in the sense that you have to parse them
differently than elements. After all, you can set properties in WTKX using
elements. I'm assuming this holds in BXML.
You don't need BXML at all. It just adds to the API. You can just as well
build a Pivot app with pure Java.
You don't need scripting support.
You don't need data binding.
You can do all of that with a smaller API. What is "necessary"? What does
"necessary" mean to you?
So, yeah, there are other ways to do what I want without changing a thing. But
what I propose makes some things (like using factory methods) easier, more
natural, and provides backwards compatibility. I even think you could create a
new prefix for these kinds of expressions, like # or whatever, but I think it
would be better to expand the capability of $ to keep things simpler. ;)
> Execute script expressions in WTKX component attributes
> -------------------------------------------------------
>
> Key: PIVOT-573
> URL: https://issues.apache.org/jira/browse/PIVOT-573
> Project: Pivot
> Issue Type: New Feature
> Components: wtk-wtkx
> Affects Versions: 1.5
> Environment: Using patched Pivot 1.5
> Reporter: Michael Allman
> Attachments: script_expressions_in_attributes.patch
>
>
> The attached patch allows users to put arbitrary script expressions in wtkx
> component attributes. This provides a superset of existing functionality,
> which allows the user to reference an object by its wtkx:id.
> For example, I have a Java class ms.allman.pivot.Validators with a static
> method getZipCodeValidator() that returns a Validator. Then the following
> WTKX fragment sets a zip code validator on the given TextInput:
> <TextInput
> validator="$Packages.ms.allman.pivot.Validators.getZipCodeValidator()"/>
> (This example assumes the use of the JavaScript engine for scripting.)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.