[Cosmo-dev] Getting a handle on specific UI elements

Matthew Eernisse mde at osafoundation.org
Mon Dec 11 13:27:35 PST 2006


Comments inline ...

Travis Vachon wrote:
>>
>>
>> My idea is fairly simple: give id's to all widgets/UI elements in a 
>> consistent, namespaced way, eg "detailPanel.CancelButton"
> +1

If this is done in some sort of automated way, I'm fine with it. If it's 
going to require us to set up and manage a separate, DOM-node-id-only 
namespace for each and every Cosmo UI element and its sub-elements, then 
I think this *may* not be the optimal approach.

> This is very easy to implement in our widget code, and really only 
> requires developers to make sure they're careful to provide a widgetId 
> whenever they create a widget, which they should anyway.

I don't necessarily agree with that. Obviously your pieces of UI have to 
be uniquely identifiable within the context of whatever container it's 
sitting in, so you can manipulate it in code (e.g., dojoattachpoint).

But putting the onus on the developer to make sure manually that it is 
also uniquely identifiable within the context of the entire app -- when 
code can do it for you -- just doesn't seem very efficient.

> Personally, I actually like option 1 better. For a little extra work at 
> the time developers write widget creation code/templates, ids are more 
> explicit in our code/templates, and we don't lose the flexibility to set 
> widgetIds to whatever we want.

It sounds like this option means:

1. Creating and managing a new, DOM-node-id-only namespace for all our 
widgets -- separate from the one that already exists in the JavaScript code.

2. Manually entering the entire path in that namespace (e.g., 
'appDialog.optionTab.smallDialog.buttonPanel.cancelButton') as the 
widgetId for each and every element I create in the UI.

Is that the case?


Matthew



More information about the cosmo-dev mailing list