0

ZK 5 Component development - the Imagepicker

asked 2009-10-27 19:22:01 +0800

tmillsclare gravatar image tmillsclare
799 2 5 29

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!

delete flag offensive retag edit

9 Replies

Sort by ยป oldest newest

answered 2010-02-10 18:56:15 +0800

aktejo gravatar image aktejo
155 3

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

link publish delete flag offensive edit

answered 2010-02-11 04:38:04 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

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

link publish delete flag offensive edit

answered 2010-02-11 19:25:35 +0800

afpproject gravatar image afpproject
6

Nice work..

link publish delete flag offensive edit

answered 2010-02-14 10:45:10 +0800

aktejo gravatar image aktejo
155 3

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

link publish delete flag offensive edit

answered 2010-02-16 19:55:49 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

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

link publish delete flag offensive edit

answered 2010-03-09 16:30:44 +0800

aktejo gravatar image aktejo
155 3

as1225,
how to get reference of a javascript object of my component, i ineed to invoke one of its method from a javascript static method (the third argurment of "new" (constructor) )
tq in advance

link publish delete flag offensive edit

answered 2010-03-09 21:13:04 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi, aktejo
Why did you need to call javascript static method ?

link publish delete flag offensive edit

answered 2010-03-17 22:26:49 +0800

aktejo gravatar image aktejo
155 3

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 ?

link publish delete flag offensive edit

answered 2010-03-18 01:26:59 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-10-27 19:22:01 +0800

Seen: 2,219 times

Last updated: Mar 18 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More