Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EGL Development Tools » Extending the RUI widget set II(What do the parameters of egl.defineWidget mean?)
Extending the RUI widget set II [message #930575] Tue, 02 October 2012 12:51 Go to next message
Richard Moulton is currently offline Richard MoultonFriend
Messages: 92
Registered: August 2011
Location: Devon, UK
Member
I'm in the process of creating a new widget based on an external javascript but I'm having problems with the new widget, under certain circumstances. Whilst working on the the problem I suddenly realised that I have little idea on the relevance of the parameters immediately following the egl.defineWidget section.

Looking at the help text there is a brief example of an external javascript widget as follows:

egl.defineWidget( 'egl.rui.widgets', 'Button',
                  'egl.rui.widgets', 'Label',
                  'button', { } );


The help text describes these parameters as follows:

1) The name of the package in which the custom JavaScript resides. The package name is required, is case sensitive, and identifies the WebContent subfolder that contains the JavaScript.
Include dots in place of a forward slash for every subfolder under the first. For example, if your JavaScript is in folder WebContent/myPkg/test, the packageName value is myPkg.test.
2) The name of the widget class (for example, Button); that class name is the name of the external type you will create.
3) The package name of the EGL external type that defines the parent widget; however, if that parent type is widget (the most elemental choice), specify egl.ui.rui.
4) The name of the parent widget class (for example, Label).
5) The HTML element type (for example, button).

I understand the first two parameters, these make sense to me and I've set these accordingly but the next three parameters I'm very sketchy on.

3) I now understand this needs to be 'eglx.ui.rui'

4) In my widget I've set this parameter to 'Widget', the parent widget class

5) In my widget I've set this parameter to 'div', the HTML element type

How would I decide what the parent package, class and HTML element type should be? What are the effects of these parameters?

These parameters may not have anything to do with my problem but I don't like having too many Smile unexplainable lines of code in my application.

Richard
Re: Extending the RUI widget set II [message #930781 is a reply to message #930575] Tue, 02 October 2012 16:35 Go to previous messageGo to next message
Dan Darnell is currently offline Dan DarnellFriend
Messages: 145
Registered: November 2011
Location: Arkansas
Senior Member
Brian referenced some helpful documentation in this thread:

http://www.eclipse.org/forums/index.php/t/369772/

You probably already saw that though. Not sure if any of it answers your questions.

--Dan
Re: Extending the RUI widget set II [message #930813 is a reply to message #930575] Tue, 02 October 2012 17:06 Go to previous messageGo to next message
Ben Margolis is currently offline Ben MargolisFriend
Messages: 10
Registered: December 2011
Junior Member
New descriptions for parms 3-5:

* The package name of the EGL external type for the parent widget. You might be extending an external type of your own; but in most cases, the parent type is Widget, which is provided for you and is the basis of other EGL external-type widgets. If the parent type is Widget, the package name is eglx.ui.rui.

◦ The name of the EGL external type (for example, Widget) for the parent widget.

◦ The tag name (for example, button) of the DOM element for the new widget.

Let me know if this finds favor in your eyes.
Re: Extending the RUI widget set II [message #931070 is a reply to message #930813] Tue, 02 October 2012 22:40 Go to previous messageGo to next message
Richard Moulton is currently offline Richard MoultonFriend
Messages: 92
Registered: August 2011
Location: Devon, UK
Member
Hi Ben,

It's not so much a problem with the wording but more to do with my understanding, or lack of understanding.

I'm only just starting out on the road to learning javascript and although I'm familiar with the DOM as a concept, when I'm creating a new external type I don't understand why I would choose one package/parent/tag over another, what the options are for these parameters or indeed the consequences of those choices.

As with most things I find it easier to learn new topics by example, so it would be great if there was a worked example that explained the decision process used to build a new external type. I know, I'm always asking for more documentation, etc but I just find it so frustrating knowing that EGL can do all of these great things and not being able to find out how to do them. I know we'll get there eventually, in the meantime it's just really hard work trying to guess how things might work by trawling through source code. End of moan.

That being said I have been able to move forward now by examining the googlemap external type. I noticed that an egl.createChild function was being executed, to create a child.

I had previously been trying to create a new child in my external type using 'var audioObject = new Audio("");' and adding this to the DOM using 'document.getElementById('audio-object').appendChild(audioObject);'. Though this seemed to work OK when I set audio src within my application, after the handler had been initialised and presented, when I tried setting the src property on the widget declaration I was receiving a null exception error.

I now use 'this.audio = egl.createChild(this.eze$$DOMElement, "audio");' within my constructor function and this seems to be working well.

Dan - thanks, yes I had seen that post

Richard
Re: Extending the RUI widget set II [message #932021 is a reply to message #931070] Wed, 03 October 2012 19:03 Go to previous messageGo to next message
Ben Margolis is currently offline Ben MargolisFriend
Messages: 10
Registered: December 2011
Junior Member
You might take a look at the JavaScript for the EGL Dojo widgets. Specifically, the following project is made available to you when you create your first Web 2.0 application in a workspace:


org.eclipse.edt.rui.dojo.remote_0.x.y
(where x and y are integers
that represent the project's revision level)


Go to that project, expand Web Content > Dojo > widgets, and inspect DojoBase.js.
There, you'll find this, including function that is available to other Dojo widgets:

egl.defineClass(
'dojo.widgets', 'DojoBase',
'eglx.ui.rui', 'Widget', { ... })

The class is based on eglx.ui.rui.Widget; and you can review that EGL external type, as follows: In the project, expand EDT System Libraries > edtCompiler.eglar > eglx.rui.ui > widget.eglxml. The related JavaScript is not easily available, but you can inspect the eglxml file to see the function that is available to any widget that you might build.

In general, one definition builds on another. If you go back to the JavaScript files under Web Content > Dojo > widgets, you can review these files:

o DojoTextBase.js, which includes this:

egl.defineWidget(
'dojo.widgets', 'DojoTextBase',
'dojo.widgets', 'DojoBase',
'div', { ... })

o DojoValidationBase.js, which includes this:

egl.defineWidget(
'dojo.widgets', 'DojoValidationBase',
'dojo.widgets', 'DojoTextBase',
'div', { ... })

o DojoTextField.js, which includes this:

egl.defineWidget(
'dojo.widgets', 'DojoTextField',
'dojo.widgets', 'DojoValidationBase',
'div', { ... })

You can also review the EGLSource > dojo.widgets to see the EGL external types that are based on the JavaScript code just mentioned.

Widget development is partly from knowledge and partly from trial and error. After you've written a few Widget types and feel comfortable, please consider writing a "technology paper" for inclusion at the bottom of the following page:

http://www.eclipse.org/edt/#doc

-- Ben
Re: Extending the RUI widget set II [message #932816 is a reply to message #932021] Thu, 04 October 2012 13:06 Go to previous message
Richard Moulton is currently offline Richard MoultonFriend
Messages: 92
Registered: August 2011
Location: Devon, UK
Member
Hi Ben,

That looks really interesting, I'll have a good look at that, and yes I will endeavour to do my bit for the cause and update/create some documentation.

Many Thanks
Richard
Previous Topic:EGL test program part encounters error during "JNDI lookup"
Next Topic:EGL calling Java
Goto Forum:
  


Current Time: Fri Apr 19 00:16:00 GMT 2024

Powered by FUDForum. Page generated in 0.01987 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top