Hello Fabian,
thank you very much for the explanation. My documentation reference was
http://qooxdoo.org/documentation/0.8/interfaces (0.8 / Interfaces) which
according to you seems to be outdated.
The only question remaining: Why does Class.hasInterface() deliver
"false" (in the example below)? This is not important for my current
project - im just curious.
Regards, eB.
Fabian Jakobs schrieb:
> Hi Eric,
>
> With 0.8 we slightly changed the way interfaces are verified. Now we
> expect the verify methods to raise an exception if a precondition isn't
> satisfied. The reason for this change was that we ended up with lots of
> interface methods simply returning "true", further we unified all checks
> with the checks in "qx.core.Assertion".
>
> In the interface you can make use of all the assertion methods defined
> in MAssert:
>
> testMe: function() { this.fail("You should not see this!"); }
> testYou: function(you) { this.assertString(you); }
>
>
> Did you find any references in the documentation still mentioning the
> old behaviour?
>
>
> Best Fabian
>
>> Michael Helwig schrieb:
>>
>>
>>> Hey Eric,
>>>
>>> have you tried leaving the brackets "[" and "]" away in your interface
>>> declaration? I'm not sure what they are there for, I have never used
>>> them and my interface implementations work.
>>>
>>> Best,
>>>
>>> Michael
>>> Eric Brachmann schrieb:
>>>
>>>
>>>
>>>> Hello,
>>>>
>>>> working on a project with qooxdoo I recognized, that the preconditions I
>>>> set in an interface were not evaluated correctly. It seems that my
>>>> classes do not implement their interfaces at all, although the code
>>>> looks fine and no error is thrown.
>>>>
>>>> An example to illustrate the issue:
>>>>
>>>> IMyInterface.js:
>>>> qx.Interface.define("itest.IMyInterface",
>>>> {
>>>> members:
>>>> {
>>>> testMe: function() { return false; }
>>>> }
>>>> });
>>>>
>>>> MyClass.js
>>>> qx.Class.define("itest.MyClass",
>>>> {
>>>> extend: qx.core.Object,
>>>> implement: [itest.IMyInterface],
>>>>
>>>> members:
>>>> {
>>>> testMe: function() { alert("You should not see this!"); }
>>>> }
>>>> });
>>>>
>>>> Application.js (excerpt):
>>>> ...
>>>> var test = new itest.MyClass();
>>>>
>>>> alert("implements interface: "
>>>> + qx.Class.implementsInterface(test, itest.IMyInterface)
>>>> + ", has interface: "
>>>> + qx.Class.hasInterface(test, itest.IMyInterface));
>>>>
>>>> test.testMe();
>>>> ...
>>>>
>>>> The output is "implements interface: true, has interface: false" as if
>>>> the implement statement in the class definition is being ignored.
>>>> The testMe() method gets executed even though the precondition of the
>>>> interface evaluates to false.
>>>>
>>>> A project of this simple example is avaiable here:
>>>> http://www.hatter.de/studium/itest.zip
>>>>
>>>> It would be very kind if someone could enlighten me.
>>>>
>>>> Regards, eB.
>>>>
>>>>
>>>>
>>>>
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel