Hi Jean-Baptiste,

Jean-Baptiste BRIAUD -- Novlog wrote:
> OK, thanks to you, it is clearer but still have things I don't understand :
> 
> I loop throw my widgets and 
> qx.dev.Debug.debugObject(widget.getDecorator()).
> The output show things like input, button, table but nothing like 
> Uniform, Single, ... (note the lack of first letter capitalized, it is 
> input and not Input or even qx.ui.decoration.Input or some other package)
Sorry, this was my fault. The return value of the "getDecorator" is a 
simple string (=the name of the decorator).

If you want to get the decorator instance you have to call

--snip--
// e.g. instance of the "input" decorator
qx.theme.manager.Decoration.getInstance().resolve("input");
--snip--

> So I can't apply the pattern "widgetInstance.getDecorator() instanceof" 
> since this decorator instance look like unknown : input.
> For example, I'm not able to find in the doc that input decorator.
If you use the "resolve" method above you can.

> Finally, I'm still unable to draw a red line around my widgets.
> 
> Can I add/remove decorator without breaking theme ? I was thinking to 
> add/remove dynamically a Single decorator instance to the widget candidate.
You can also create a decorator instance at runtime and set this 
instance with "setDecorator". The drawback is that you have multiple 
instances of a decorator (one per widget).

> Is there another direction/idea that would not involve decorator to just 
> draw red line around widget ?
Using decorators is the way to go.

cheers,
   Alex

> 
> On 24 Feb 2009, at 15:43, Alexander Back wrote:
> 
>> Hi Jean-Baptiste,
>>
>> Jean-Baptiste BRIAUD -- Novlog wrote:
>>> If I understood correctly the API, any widget have a getDecorator()
>>> method. It return "at least" a iDecorator instance.
>>> Unfortunatly, I can't see how to change the border on iDecorator,
>>> except maybe the tint method, but I have no idea witch element to
>>> provide ...
>> "iDecorator" is simply the Interface every decorator class has to
>> implement. The API should read "you get an instance which is implements
>> the interface 'iDecorator'".
>>
>>> On the other hand, I also see the classes like Single, Double,
>>> Uniform, ... decorators, but I just don't know witch one will I
>>> encounter on a given widget...
>>> On Single, I see this property : color (Property group to set the
>>> border color of all sides) but how to esure Uniform will always be the
>>> widget's border ?
>> The answer is: you can't. At least not in a way that you call
>> "getDecorator" on a widget and can be sure you have an "Uniform"
>> decorator. You have to check for the decorator instance and modify only
>> the border at decorators which are capable of.
>>
>>> Maybe I forgot to mention one point : I'm inside a generic method
>>> where all I know is that a widget parameter is a widget but it could
>>> be a table, a textarea, a textfield, any selectbox subclass, ...
>> Then you have to check for them as I already mentioned.
>>
>> --snip--
>> if (widgetInstance.getDecorator() instanceof qx.ui.decoration.Uniform)
>> {
>>   // code for uniform decorators
>> }
>> // etc.
>> --snip--
>>
>> cheers,
>>   Alex
>>
>>>
>>> On 24 Feb 2009, at 14:06, thron7 wrote:
>>>
>>>> the most direct way would be to retrieve the current decorator of the
>>>> desired element (with .getDecorator()), and set its border color to
>>>> red.
>>>>
>>>> thomas
>>>>
>>>> Jean-Baptiste BRIAUD -- Novlog wrote:
>>>>> Hi,
>>>>>
>>>>> I'd like to add a red border to some field (in case of inproper user
>>>>> input) but I though it might be a bad idea to change the decorator
>>>>> since I don't have time for implementing my own decorator right now.
>>>>> Also, it won't be what I want to change the foreground or background
>>>>> color ...
>>>>>
>>>>> Any idea ?
>>>>>
>>>>> Thanks !

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to