You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by SYSE | Edvin <es...@syse.no> on 2011/07/26 15:47:55 UTC
Is it possible to do setAttribute() with BXML?
I want to set an attribute on certain elements I've declared in a BXML file:
Instead of doing:
label.setAttribute(MyEnum.MyEnumValue, "myValue");
in Java-code, I would like to set the attribute from BXML:
<Label ... >
<Attribute key="" value=""/>
</Label>
Is this possible?
Re: Is it possible to do setAttribute() with BXML?
Posted by SYSE | Edvin <es...@syse.no>.
Den 26.07.2011 15:57, skrev Greg Brown:
> No, there is no way to do this. However, attributes are primarily intended for use by attached properties, which you can use in markup.
OK, I'll just do it programatically then :)
Re: Is it possible to do setAttribute() with BXML?
Posted by Edvin Syse <es...@syse.no>.
Nice, thanks :)
On 07/26/2011 04:57 PM, Greg Brown wrote:
>> Ah, I see that userData is a UserDataDictionary in Component, so that's kind of perfect. But can I set a property in the UserDataDictionary with BXML?
>
> <Label>
> <userData foo="bar"/>
> </Label>
>
Re: Is it possible to do setAttribute() with BXML?
Posted by Greg Brown <gk...@verizon.net>.
> Ah, I see that userData is a UserDataDictionary in Component, so that's kind of perfect. But can I set a property in the UserDataDictionary with BXML?
<Label>
<userData foo="bar"/>
</Label>
Re: Is it possible to do setAttribute() with BXML?
Posted by Edvin Syse <es...@syse.no>.
On 07/26/2011 04:49 PM, Edvin Syse wrote:
> On 07/26/2011 04:43 PM, Greg Brown wrote:
>> Can you use Component#getUserData() for this?
>
> I guess I could, but if I put this value in userData I kind of "use up"
> this variable for this sole purpose. Maybe it doesn't matter though.. I
> haven't used it so far for ui components, but I set userData extensively
> in TreeNodes, so it feels like kind of a mismatch to use it for id's in
> ui components.
Ah, I see that userData is a UserDataDictionary in Component, so that's
kind of perfect. But can I set a property in the UserDataDictionary with
BXML?
Re: Is it possible to do setAttribute() with BXML?
Posted by Edvin Syse <es...@syse.no>.
On 07/26/2011 04:43 PM, Greg Brown wrote:
> Can you use Component#getUserData() for this?
I guess I could, but if I put this value in userData I kind of "use up"
this variable for this sole purpose. Maybe it doesn't matter though.. I
haven't used it so far for ui components, but I set userData extensively
in TreeNodes, so it feels like kind of a mismatch to use it for id's in
ui components.
Re: Is it possible to do setAttribute() with BXML?
Posted by Greg Brown <gk...@verizon.net>.
Can you use Component#getUserData() for this?
On Jul 26, 2011, at 10:13 AM, SYSE | Edvin wrote:
> What I'm trying to accomplish, is to let each user of the app decide which fields in each editor to show/hide. For that, I need to find a "path" to a component within an editor. For example, if I'm editing an Article in ArticleEditor, and I want to show/hide the id Label, a path to this component could be:
>
> ArticleEditor.articleForm.id
>
> .. or something like that. I could ofcourse scan the whole component hierarchy and use custom knowledge of each ui element to extract a property value, for example using the textKey of a Label etc...
>
> What is the automationID by the way, can I exploit that somehow for my purpose?
>
> -- Edvin
>
> Den 26.07.2011 15:57, skrev Greg Brown:
>> No, there is no way to do this. However, attributes are primarily intended for use by attached properties, which you can use in markup.
>>
>> On Jul 26, 2011, at 9:47 AM, SYSE | Edvin wrote:
>>
>>> I want to set an attribute on certain elements I've declared in a BXML file:
>>>
>>> Instead of doing:
>>>
>>> label.setAttribute(MyEnum.MyEnumValue, "myValue");
>>>
>>> in Java-code, I would like to set the attribute from BXML:
>>>
>>> <Label ...>
>>> <Attribute key="" value=""/>
>>> </Label>
>>>
>>> Is this possible?
>>
Re: Is it possible to do setAttribute() with BXML?
Posted by SYSE | Edvin <es...@syse.no>.
What I'm trying to accomplish, is to let each user of the app decide
which fields in each editor to show/hide. For that, I need to find a
"path" to a component within an editor. For example, if I'm editing an
Article in ArticleEditor, and I want to show/hide the id Label, a path
to this component could be:
ArticleEditor.articleForm.id
.. or something like that. I could ofcourse scan the whole component
hierarchy and use custom knowledge of each ui element to extract a
property value, for example using the textKey of a Label etc...
What is the automationID by the way, can I exploit that somehow for my
purpose?
-- Edvin
Den 26.07.2011 15:57, skrev Greg Brown:
> No, there is no way to do this. However, attributes are primarily intended for use by attached properties, which you can use in markup.
>
> On Jul 26, 2011, at 9:47 AM, SYSE | Edvin wrote:
>
>> I want to set an attribute on certain elements I've declared in a BXML file:
>>
>> Instead of doing:
>>
>> label.setAttribute(MyEnum.MyEnumValue, "myValue");
>>
>> in Java-code, I would like to set the attribute from BXML:
>>
>> <Label ...>
>> <Attribute key="" value=""/>
>> </Label>
>>
>> Is this possible?
>
Re: Is it possible to do setAttribute() with BXML?
Posted by Greg Brown <gk...@verizon.net>.
No, there is no way to do this. However, attributes are primarily intended for use by attached properties, which you can use in markup.
On Jul 26, 2011, at 9:47 AM, SYSE | Edvin wrote:
> I want to set an attribute on certain elements I've declared in a BXML file:
>
> Instead of doing:
>
> label.setAttribute(MyEnum.MyEnumValue, "myValue");
>
> in Java-code, I would like to set the attribute from BXML:
>
> <Label ... >
> <Attribute key="" value=""/>
> </Label>
>
> Is this possible?