Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OK Great so your smart on DOJO Widgets and DOJO Events lets see how we use these.

Tag Code

Lets start with looking at what a user of WW would include in their page, a JSP in this case:

...

This is just a standard framework component. All the attributes defined here must map to a component class thats defined in the taglib.tld. Were not going to go into how the componets work in this discussion, just be assured that nothing different happens here.

Component Template Code

The framework via the component system will read in the ajax/a.ftl file to determine how to generate the following html file. Again this is standard Component processing so we'll breeze over this.

Generated Code

Now lets look at what this snippet of code would generate for us in html:

...

Lets review this file. The dojoType type tells the dojo parser what to do with this tag. This is going to need to correspont to a call in our widge file like:
dojo.widget.tags.addParseTreeHandler("dojo:BindAnchor");
All the other attributes are basically passthrough from our component code to our widget code. No real magic happening w/ them.

Dojo Widget File

Next up lets look at some snippets of the widget file:

...

There are three aspects in this code snippet that are worth review. The declaration of the templatePath. This defines to DOJO where the prototype for its component lives. DOJO is going to read this component to determine what event binding needs to happen (TODO: a better description here). Were going to look at this template file in a moment, this file is where the real magic happens. The second aspect of this file is the kwConnect call... this is the ajax call to the remote source. I removed the snippet that happens afterwards but its not important here. And the final aspect worth understanding now is the last line. This tells dojo that this widget is registered as the name BindAchor... recall the dojoType="BindAnchor" in the above HTML snippet.

Dojo Template File

Now lets review the template file... BindAnchor.html... Understanding the template files were the big realization moment for me.

...