You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Greg Brown (JIRA)" <ji...@apache.org> on 2010/06/08 23:58:11 UTC

[jira] Issue Comment Edited: (PIVOT-520) add a name property to Component

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

Greg Brown edited comment on PIVOT-520 at 6/8/10 5:56 PM:
----------------------------------------------------------

Just to be a bit more clear about what specifically I am disagreeing with - consider this Java code:

  PushButton myButton = new PushButton();

You wouldn't expect that calling myButton.getName() now would return "myButton", right? That's because there is no association between a Java variable name and the "name" bean property, The Java compiler isn't going to magically detect that PushButton defines a setName() method and call it for you. You need to do that yourself:

  myButton.setName("myButton");

This would be the equivalent code in WTKX:

  <PushButton wtkx:id="myButton" name="myButton"/>

WTKX IDs and the proposed "name" bean property simply address different use cases. A WTKX ID defines a variable that you can immediately reference in code, either in Java (via Bindable) or in script that you embed in the WTKX file, and the name becomes a key by which you can later obtain a reference to a value that you can use in code. IMO, it would introduce needless complexity to some highly critical code (WTKXSerializer) if we try to combine these two concepts.


      was (Author: gbrown):
    Just to be a bit more specific about what specifically I am disagreeing with - consider this Java code:

  PushButton myButton = new PushButton();

You wouldn't expect that calling myButton.getName() now would return "myButton", right? That's because there is no association between a Java variable name and the "name" bean property, The Java compiler isn't going to magically detect that PushButton defines a setName() method and call it for you. You need to do that yourself:

  myButton.setName("myButton");

This would be the equivalent code in WTKX:

  <PushButton wtkx:id="myButton" name="myButton"/>

WTKX IDs and the proposed "name" bean property simply address different use cases. A WTKX ID defines a variable that you can immediately reference in code, either in Java (via Bindable) or in script that you embed in the WTKX file, and the name becomes a key by which you can later obtain a reference to a value that you can use in code. IMO, it would introduce needless complexity to some highly critical code (WTKXSerializer) if we try to combine these two concepts.

  
> add a name property to Component
> --------------------------------
>
>                 Key: PIVOT-520
>                 URL: https://issues.apache.org/jira/browse/PIVOT-520
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>            Reporter: Appddevvv
>            Priority: Minor
>             Fix For: 1.6
>
>
> Add a name property to Component
> a) A getter/setter
> b) A method to Container for Component getNamedComponent(String componentName)
> The name should default to an the wtkx:id if one is specified for that component or if the name is not specified, null. If a name is specified and no wtkx:id is specified , it should become the wtkx:id of that component. The name must be a valid java identifier, otherwise an serialization exception should be thrown. The name used in the component should be left and right whitespace trimmed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.