Putting it all Together"
From Documentation
Tmillsclare (talk | contribs) m |
Tmillsclare (talk | contribs) m |
||
Line 3: | Line 3: | ||
The widget implementation must be placed in an independent JavaScript file. The file must be placed under the directory, /web/js/package-path, in the Java class path. Since the widget name is SimpleLabel and the package name is com.foo, the file path is /web/js/com/foo/SimpleLabel.js | The widget implementation must be placed in an independent JavaScript file. The file must be placed under the directory, /web/js/package-path, in the Java class path. Since the widget name is SimpleLabel and the package name is com.foo, the file path is /web/js/com/foo/SimpleLabel.js | ||
− | <source | + | <source lang="javascript"> |
zk.$package('simplelabel'); | zk.$package('simplelabel'); | ||
Revision as of 04:17, 14 July 2010
The widget implementation must be placed in an independent JavaScript file. The file must be placed under the directory, /web/js/package-path, in the Java class path. Since the widget name is SimpleLabel and the package name is com.foo, the file path is /web/js/com/foo/SimpleLabel.js
zk.$package('simplelabel');
com.foo.SimpleLabel = zk.$extends(zk.Widget, {
_value : '', // default value
getValue : function() {
return this._value;
},
setValue : function(value) {
if (this._value != value) {
this._value = value;
if (this.desktop)
this.$n().innerHTML = zUtl.encodeXML(value);
}
}
});
Having set-up the ability to handle states we now need to create the component view. This can be accomplished using two methods.