[ 
https://issues.apache.org/jira/browse/PIVOT-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889856#action_12889856
 ] 

Greg Brown commented on PIVOT-573:
----------------------------------

There are several reasons that I am not supportive of this suggestion:

1) The syntax used by BXML's '$' operator and the scripting language may not be 
compatible. For example, "$a.b.c" is currently resolved by JSON.get(). In 
script, "a.b.c" might not even be resolvable, or might resolve differently. 
This would be confusing to developers.

2) We'd need to include logic that detects a reference to a script function and 
invokes the scripting engine rather than the existing code path. This logic 
could be complicated - it's not valid to assume that all languages call 
functions using the same syntax. It would also introduce additional processing 
overhead when handling the '$' operator.

3) The definition of this expression is ambiguous:  ${a.b.c.foo()}. What 
exactly is being bound to?

The only way I could see adding support for this is via another operator 
(perhaps '#'), since that would facilitate efficient and non-ambiguous 
processing of the inline script. However, since there are several other ways to 
accomplish this using the existing syntax, I don't see a strong use case for 
adding this feature.


> 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.

Reply via email to