-
FEATURED COMPONENTS
First time here? Check out the FAQ!
In this Small Talk, Jimmy Shiau introduces us to ZK 5 component development by creating an image picking component to provide users with an easy way to select images. Check it out here!
Hi jimmy shiau,
I've been downloaded your imagepicker.war and deploy to my local development server, that's cool,
BTW I've created component in previous version of ZK 3.6.3 and need to recreate it again so it can run in the new version 5.0.0 since both version implement slightly different concept of component development. I thought your image picker is a good starting point for me to understand component development concept of ZK 5, learning by sample :).
I downloaded the imagepicker.war you put in the page, rename the extension into .zip an extract the content. thanks to you for attaching the original .java code thats allow me to rebuild the project in my netbeans IDE. I run the project and everything works fine. FYI I use the 5 zk core libraries that you are included in lib folder whichis zcommon.jar, zcommons-el.jar, zk.jar, zul.jar and zweb.jar.
But because I need to use the complete library of zk, then i replace those library with the complete zk library that i downloaded from ZK download page (ZK5 CE). unfortunately the project doesn't work any more even I don't make any change at all, only the zk library. the page keep showing processing waiting message.
Do You have any idea why that happend, are there any conflict with one of zk library?, i think the anomaly occurs in client side. Thank you for help
Hi, aktejo
We have changed some specifications
You have to modify zk.wpd
<package name="imagepicker" language="xul/html"> <widget name="Imagepicker"/> </package>
to
<package name="imagepicker" language="xul/html" depends="zul"> <widget name="Imagepicker"/> </package>
add depends="zul" attribute
and
change child._redrawHTML() to child.redrawHTML_() in Imagepicker.js line: 197 & 199
I also update the svn file
You can download lastest build jar file in dist\lib folder
Nice work..
Hi jimmy, thanks for d information, amazing, the image-picker is working after the modification, and also, my component finally works well in ZK version 5.0.0. Hopefully, i can get a zk wiki page to share it.
Little bit upset when i can't find adequate reference to do things in new javascript. Like when i need to do after-compose (then i found that it was bind_() function) or how to reference the url of web resource in the jar file, (then i found it was zk.ajaxURI(), you know, we previously using S{c:encodeURL(!~./...)}. But don't worry, everything is fine now, and once again, thanks very much for the information.
Btw, I'm curious about how to let my IDE's code hint recognize my components attributes. I guess, i will need to write an XML Schema and put it in metainfo/xml folder then add apropriate xml namespaces in my .zul page. But i don't know how to do that, cud you help me jimmy, thanks in advance
You can find zul.xsd in zul.jar\metainfo\xml and create a file that name is "zul.xsd " in your component project like zul.jar
Hi, aktejo
Why did you need to call javascript static method ?
Hi Jimmy,
because i need to execute javascript function from inside a flash object,.. then i will use some "callable" javascript function as a proxy. this function will have a component uiid from one of it args to get the reference of a component (widget), then i can do whatever i want to do with the component hosting the flash object, including notifying server for some flash activity, i.e a click on spesific flash component. hmm, i hope u re not confused,.
acctually i have just solved my problem, lil bit tricky, i create a static array of widget instance once it created (on bind_ method, and remove it again on unbind_), then search that array when i need to get the reference to one of its member.
i found somewhere that actually zk javascript api provide something like widget$(uiid) to query component instance, i am not sure about that.
Jimmy, acctually i have something else to ask. but its about HibernateUtil, i dont think i cant write it in this topic.
its about, what if i need to connect to more than one database connection (i thing i will need more than one hibernate.cfg), i dont think the single HibernateUtil can handle that ?
Yes, you can call widget.$(uuid) to get widget component instance,
about Multiple DB connection in java you can search from their forum
I found a solution that use JTA, refer to here
Asked: 2009-10-27 19:22:01 +0800
Seen: 2,220 times
Last updated: Mar 18 '10