PDA

View Full Version : Similar function as Ext.getCmp for Ext Gwt Application



kai_tea
27 Oct 2009, 10:43 AM
Hi Everyone,


Does anyone know if there is a similar "window.Ext.getCmp" (for Ext JS App) type of a call I can make on a Ext GWT application. I tried this function call but it does not work for a Ext GWT application. Your help will be greatly appreciated.

Thanks.

sven
27 Oct 2009, 10:53 AM
You can use the componentmanager for this.

kai_tea
27 Oct 2009, 4:39 PM
Thank you for the prompt reply.

I don't see the componentmanager in the DOM with Firebug. Is this exposed in the DOM?
What I am trying to do is something similar to this that can be done with ExtJS:
window.Ext.getCmp(’login-window’)

I want to execute some similar javascript as above with my test framework so that I can get back the id of the component and easily interact with it.

Thanks for your help.

sven
28 Oct 2009, 12:58 AM
You can expose componentmanager to javascript, but you really dont want to do this. If you need to do it, you should think about if it is correct what you are trying to do.

kai_tea
28 Oct 2009, 9:06 AM
Hi,

The reason I want to get a handle on the ComponentManager or something is similar is so I can execute some similar javascript code like this: "window.Ext.getCmp(’change-password-window’)"

I am using a testing framework called Selenium and want to execute the above Javascript with Selenium so that I can get the ID of the component and easily interact with it. Right now, writing xpaths to accomplish this makes the test case very brittle.

Is there a function that Ext GWT provides that will allow me to execute some javascript to get reference to the ExtGWT component and easily get its ID?

Thanks.

cabster
30 Dec 2009, 12:52 PM
Hi Everyone,


Does anyone know if there is a similar "window.Ext.getCmp" (for Ext JS App) type of a call I can make on a Ext GWT application. I tried this function call but it does not work for a Ext GWT application. Your help will be greatly appreciated.

Thanks.

Does anybody know the answer? I need a component id to see if it already exists.

darrellmeyer
31 Dec 2009, 11:07 AM
Components are not accessible via external JavaScript as GWT compiles the Java code into JavaScript. You can expose methods to external JavaScript with GWT. See http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#calling.

cabster
3 Jan 2010, 1:00 PM
The getCmp function helped me to see if a component already existed.

something like:




if(window.getCmp(id).exist()){
-> close window
}



Thats what i'm trying to do. Maybe there is an other method that can help me with this.

sven
3 Jan 2010, 1:34 PM
If the window is attached (shown) you can use the componentmanager. If not, you simple keep a reference to it somewhere.

cabster
3 Jan 2010, 2:07 PM
Thank you very much. That worked out