Quantcast

Cannot get the Dialog contrib (or any libraries) to load.

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cannot get the Dialog contrib (or any libraries) to load.

Nick Watkins
This is the first time I've had any trouble getting a contrib to function, but it's also the first that requires loading as a library. Here are the steps I've taken:

Made the change suggested a couple weeks ago to get around the new sourceforge uri format when including libraries remotely, and it downloads into the cache just fine.

Added under jobs:
"libraries" : {
        "library" : [
                {
                        "manifest" : "contrib://Dialog/trunk/Manifest.json",
                        "uri" : "../${CACHE}/downloads/Dialog/trunk"
                }
        ]
},

The uri has "../" added because my cache folder is in my project root directory and when I opened ./source/script/myproject.js, the uri that was generated was wrong. The uri is generated correctly now as:
"dialog":{"resourceUri":"../cache/downloads/Dialog/trunk/source/resource","sourceUri":"../cache/downloads/Dialog/trunk/source/class"

I added this to my project:
dialog.confirm("Do you really want to delete this?");

And I get the following error: "ReferenceError: Can't find variable: dialog", so I started hunting through my resources. None of the Dialog library files are being loaded, but I confirmed that they physically exist where it's pointing to them.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Alexander Schilling
I think you forgot to initialize the dialog components. Do so with:

dialog.Dialog.init()

This has to be called once before using the dialog shortcut calls.

Hope this helps.

Alexander
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
Hi,

I don't think this is the problem, because I have removed the need to call the init() function in the current trunk by using the defer key to initialize the shortcut methods of the dialog package. Seems like the liberaries are not correctly loaded since even the top-level "dialog" variable doesn't exist. Library specialists, anyone?

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Thomas Herchenroeder
In reply to this post by Nick Watkins


On 07/07/2010 08:41 PM, Nick Watkins wrote:

>
> This is the first time I've had any trouble getting a contrib to function,
> but it's also the first that requires loading as a library. Here are the
> steps I've taken:
>
> Made the change suggested a couple weeks ago to get around the new
> sourceforge uri format when including libraries remotely, and it downloads
> into the cache just fine.
>
> Added under jobs:
> "libraries" : {
> "library" : [
> {
> "manifest" : "contrib://Dialog/trunk/Manifest.json",
> "uri" : "../${CACHE}/downloads/Dialog/trunk"
> }
> ]
> },
>
> The uri has "../" added because my cache folder is in my project root

If you set your CACHE macro correctly (e.g. to "cache" or "./cache") you
shouldn't need that, as the lib uri is calculated from that.

> directory and when I opened ./source/script/myproject.js, the uri that was
> generated was wrong. The uri is generated correctly now as:
> "dialog":{"resourceUri":"../cache/downloads/Dialog/trunk/source/resource","sourceUri":"../cache/downloads/Dialog/trunk/source/class"

These are no URIs in the strict sense, but URI prefixes, used to access
various parts of a library. I presume you meant to say that these
prefixes were wrong.

>
> I added this to my project:
> dialog.confirm("Do you really want to delete this?");
>
> And I get the following error: "ReferenceError: Can't find variable:
> dialog",

I did the same setup as you, left away the "uri" parameter from the
library entry, set the CACHE macro to "cache", and ran generate.py
source. The result looks fine, the Dialog classes are included in the
loader script and being loaded into the browser. The confirm dialog is
displayed just fine.

T.


> so I started hunting through my resources. None of the Dialog
> library files are being loaded, but I confirmed that they physically exist
> where it's pointing to them.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Nick Watkins
There's definitely something I'm doing wrong, I'm just not sure what it is. I started a Hello World application called "test" and arrived at the exact same conclusion with the top level "dialog" variable missing. Here are the exact steps I took:

Created Hello World application called "test"
Opened test/config.json, changed the CACHE key to "cache"
Ran the generator, confirmed creation of the cache directory in the right place, confirmed that the application works as it should
Uncommented the "jobs" key in config.json, changed the manifest key from "contrib://SkeletonApplication/trunk/Manifest.json" to "contrib://Dialog/trunk/Manifest.json"
Opened Application.js, changed "alert("Hello World!");" on line 71 to dialog.alert("Hello World!");
Ran the generator again, it informs me " - downloaded contrib: Dialog/trunk", library directory in the cache was scanned, cleared my browser cache, and reloaded the test app page.

Result: same error when I click the button

Then I started experimenting with the Dialog demo that downloads with the Dialog library. I changed the config and generate.py to point at my qooxdoo installation, built it, and browsed the source. The demo works great. So I copied the meat from the demo's Application.js and pasted it into my test project's Application.js, built my test project, and now instead of 196 classes reported in the generator output, there are 274. Huzzah! My test app works with the demo's code. After looking closer at the demo's code, I don't find anything special that my test app didn't have, so I started removing chunks of it, rebuilding the source each time and refreshing in my browser. I found that when I take out the code to draw the "wizard" dialog, the dialog libraries are no longer included when you run the generator. I also noticed that the wizard dialog is the only one created with the "new" keyword. After more digging, it looks like the nature of the deferral in Dialog.js was causing my problems all along. All I had to do was change my "dialog.alert("Hello World!");" line to "new dialog.Alert({ "message":"Hello World", "callback":null, "context":null}).show();", the generator included the necessary files and it all worked.

********** CLIFF'S NOTES / TL;DR **********
The Dialog library files aren't included in the project unless you instantiate at least one class with the "new" keyword, so the "dialog" global is created. After that, the shortcut methods may be used.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Nick Watkins
After applying this logic to my main app, I go to generate the source and get the following generator error:
"Unfullfilled dependency of class 'dialog.Dialog'[0]: 'dialog.alert'"

Which I do not get in my test app. I commented out the deferred shortcut declarations in Dialog.js and all is right with the world, I just can't use the shortcuts. They sure seem to cause more problems (for me at least) than they solve.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
Hi Nick,

try this in your Application.js :

/* ************************************************************************
#require(qcl.ui.dialog.Dialog)
************************************************************************ */

I don't have any alert or confirm dialogs in my app that are instantiated with the new keyword, but this #require compiler hint. That might be why.

Cheers,
Christian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Thomas Herchenroeder
It's working for me in a minimally adapted skeleton app, just as I
described in my other mail. - Must be something else.

Also, I think the name space for the contrib is just "dialog", and not
"qcl.ui.dialog".

T.

>
> Hi Nick,
>
> try this in your Application.js :
>
> /*
> ************************************************************************
> #require(qcl.ui.dialog.Dialog)
> ************************************************************************
> */
>
> I don't have any alert or confirm dialogs in my app that are instantiated
> with the new keyword, but this #require compiler hint. That might be why.
>
> Cheers,
> Christian
> --
> View this message in context:
> http://qooxdoo.678.n2.nabble.com/Cannot-get-the-Dialog-contrib-or-any-libraries-to-load-tp5266735p5272086.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
>



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
thron7-2 wrote
Also, I think the name space for the contrib is just "dialog", and not
"qcl.ui.dialog".
You're right, sorry, that was the wrong line! Should have been

 /*
  ************************************************************************
 #require(dialog.Dialog)
 ************************************************************************
 */

but as you said, it should work without that.

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Thomas Herchenroeder
In reply to this post by Nick Watkins
I can reproduce it!

Please open a bug for it, attaching your minimal example. The generator
does not honor dependencies to name spaces, only classes. (There is also
no way for the generator to know that in order to derive 'dialog.alert'
it has to load dialog.Dialog :).

I.e., like Christian said, if you want to use the package functions
(like dialog.alert), you have to #use(dialog.Dialog) in your Application.js.

Thanks,
T.

On 07/08/2010 10:11 PM, Nick Watkins wrote:
>
> After applying this logic to my main app, I go to generate the source and get
> the following generator error:
> "Unfullfilled dependency of class 'dialog.Dialog'[0]: 'dialog.alert'"
>
> Which I do not get in my test app. I commented out the deferred shortcut
> declarations in Dialog.js and all is right with the world, I just can't use
> the shortcuts. They sure seem to cause more problems (for me at least) than
> they solve.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
Before I release the next stable version of the dialog package, I plan to split up the wholesale definitions of the shortcuts in the defer key of dialog.Dialog and move them to the defer keys of the respective dialog widgets. I think that this is a cleaner way and allows a more "plug-in"-like behavior, where the dialog.Dialog widget does not need to know about the implementation of individual widgets that derive from it.

This will mean, however, that you will have to explicitly declare a compiler hint, for example #use(dialog.Alert), if you want to use dialog.alert(), or batch include all of them by declaring #use(dialog.*).  I think that makes most sense.

Any opinions on that?

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
BTW, there is an open bug that I need help with that would be nice to get fixed before the next release:

http://bugzilla.qooxdoo.org/show_bug.cgi?id=3538

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Thomas Herchenroeder
In reply to this post by panyasan


On 07/09/2010 10:22 AM, panyasan wrote:

>
> Before I release the next stable version of the dialog package, I plan to
> split up the wholesale definitions of the shortcuts in the defer key of
> dialog.Dialog and move them to the defer keys of the respective dialog
> widgets. I think that this is a cleaner way and allows a more "plug-in"-like
> behavior, where the dialog.Dialog widget does not need to know about the
> implementation of individual widgets that derive from it.
>
> This will mean, however, that you will have to explicitly declare a compiler
> hint, for example #use(dialog.Alert), if you want to use dialog.alert(), or
> batch include all of them by declaring #use(dialog.*).  I think that makes
> most sense.
>
> Any opinions on that?

Sounds good to me. I think we've both been tricked into believing it
works without the #use if you just add a call like 'dialog.alert()'. But
thinking about it this can't work, and I tested it on a file where I
also had used 'new dialog.Alert()' before, and then forgot to re-run the
generator. So the code executed dialog.alert() faithfully, but the
dependencies were still in from the 'new dialog.Alert()' code :-(.
Re-running generate.py source showed Nick's problem.

I would still appreciate a bug in this matter, as I feel the dependency
handling of name space symbols should be revisited. Currently, top-level
name space symbols are auto-#ignore'd, and the tendency is to extend
this to sub name spaces too. But I'm not so sure about this any more...

T.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Christian Hagendorn
Administrator
In reply to this post by panyasan
  Hi Christian,

I added a patch to the bug report, which should fix the issue. Please
have a look on it.

Cheers,
Chris

Am 09.07.2010 10:24, schrieb panyasan:
> BTW, there is an open bug that I need help with that would be nice to get
> fixed before the next release:
>
> http://bugzilla.qooxdoo.org/show_bug.cgi?id=3538
>
> C.


--
Christian Hagendorn
Software Entwickler

1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe

Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Gert Nowotny, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
Chris:

thanks so much, that did it! Sometimes the answer is not difficult, but I wouldn't have known that this was the problem.

I have fixed it in my local working copy and will commit tonight when I get home.

BTW, I tried

#use(dialog.*)

to pull in all the classes, but this didn't work to activate the triggering of the "defer" function. I had to separately specify all the classes that were used:

#use(dialog.Alert)
#use(dialog.Prompt)
#use(dialog.Confirm)
#use(dialog.Select)
#use(dialog.Form)
#use(dialog.Wizard)

then it worked. I'll open up a bug for that tonight, too.

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Thomas Herchenroeder


On 07/09/2010 03:11 PM, panyasan wrote:

> #use(dialog.*)
>
> to pull in all the classes, but this didn't work to activate the triggering
> of the "defer" function. I had to separately specify all the classes that
> were used:
>
> #use(dialog.Alert)
> #use(dialog.Prompt)
> #use(dialog.Confirm)
> #use(dialog.Select)
> #use(dialog.Form)
> #use(dialog.Wizard)
>
> then it worked. I'll open up a bug for that tonight, too.

I'd rather have you not doing that. The #require and #use compiler hints
are not designed to accept wild cards, and I wouldn't want them to do
that. They're just helpers for the dependency analysis, and I wouldn't
want to them to function profusely. They should be used as sparse and as
specific as possible. Especially when a rather arcane feature is
concerned, like your functions-on-name-space-shortcuts. I'm not sure I
like it. The proper "qooxdoo'ish" way to achieve what you want is to
create a static class for these shortcuts. Think about it...

T.

>
> C.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Werner Thie


On 09.07.2010 15:43, thron7 wrote:

>
>
> On 07/09/2010 03:11 PM, panyasan wrote:
>> #use(dialog.*)
>>
>> to pull in all the classes, but this didn't work to activate the triggering
>> of the "defer" function. I had to separately specify all the classes that
>> were used:
>>
>> #use(dialog.Alert)
>> #use(dialog.Prompt)
>> #use(dialog.Confirm)
>> #use(dialog.Select)
>> #use(dialog.Form)
>> #use(dialog.Wizard)
>>
>> then it worked. I'll open up a bug for that tonight, too.
>
> I'd rather have you not doing that. The #require and #use compiler hints
> are not designed to accept wild cards, and I wouldn't want them to do
> that. They're just helpers for the dependency analysis, and I wouldn't
> want to them to function profusely. They should be used as sparse and as
> specific as possible. Especially when a rather arcane feature is
> concerned, like your functions-on-name-space-shortcuts. I'm not sure I
> like it. The proper "qooxdoo'ish" way to achieve what you want is to
> create a static class for these shortcuts. Think about it...
+1, this should remain a fine grained feature

Werner

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

werner.vcf (311 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

panyasan
In reply to this post by Thomas Herchenroeder
Hi Thomas,

thron7-2 wrote
I'd rather have you not doing that. The #require and #use compiler hints
are not designed to accept wild cards, and I wouldn't want them to do
Ok, I didn't know that - I always simply assumed their syntax would be like python or java import statements.

thron7-2 wrote
The proper "qooxdoo'ish" way to achieve what you want is to
create a static class for these shortcuts. Think about it...
I have no problem with a static class and might add it. However, I'll have to keep the shortcuts for backwards compatibility. What I liked about the shortcuts added to the namespace is that it requires less typing (although it doesn't allow autocompletion like a static class) and that it allows "plugin-like" behavior. The static class has to be modified each time a widget is added or altered. But that's not really a big problem.

C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cannot get the Dialog contrib (or any libraries) to load.

Nick Watkins
This post has NOT been accepted by the mailing list yet.
In reply to this post by Thomas Herchenroeder
Before I file a bug report, I assume we're considering this a "framework" bug since it deals with the generator, correct?

Aside from this issue with the generator, any ideas about why I'm getting "Unfullfilled dependency of class 'dialog.Dialog'[0]: 'dialog.alert'" in my main project but not my minimal one from before?

In my minimal one, I can simply use the "#require(dialog.Dialog)" hint and the generator brings in the new classes and I get no error. Somehow it is correctly fulfilling the dependencies between dialog.Dialog and the the other dialog classes like Alert.

In my main project however, adding the "#require(dialog.Dialog)" hint only adds 1 class (dialog.Dialog, I assume), and the generator stops with the error above. I'm not sure exactly how the dependencies are being handled, but I think this is evidence that they are being handled differently. As far as the dialog stuff is concerned, the two projects are identical; but my main project is much more complex obviously.
Loading...