-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello.
We decided yesterday to give ZK5 a spin. We have quite a big product that we've developed using ZK3.
I thought that resolving the compile problems should be enough for having the product migrated to the new ZK version. There were only a few compile problems which I managed to solve quite easily (most of them due to our customizations brought to the ZK framework itself). However, it seems that our product is no longer running as it should. We are now waiting for the source code of the EE so we can be more specific in presenting the problems.
However, could someone please tell if there should be/are any breaking changes (not compile-time, but run-time) when going from ZK3 to ZK5.
I will come back with more when I test the application more thoroughly.
Thanks in advance!
Best regards,
Dani
Hello,
Unfortunately you should expect many problems. I tried recently to upgrade my (rather small) project from version 3.6.3 to 5.0. I had no compile-time problems, but in run-time nothing worked as before. Window layout is often broken, I get many StackOverflow exceptions. Windows sizes are not the same as before and so on.
To me it looks like typical version '0' sindrome. I will not yet convert any existing project from 3.6.3 to 5.0, there is no way to estimate time required to fix all upgrade problems there is almost no information about common upgrade problems and ways to solve them.
So at the moment I would only use 5.0 if I start new project.
When upgrading your application please take a look at our upgrade notes. If you still experience problems please do not hesitate to leave a forum message with some sample code.
@nadestin: Thanks for your opinion!
@tmillsclare: I've seen the upgrade notes, it didn't help us a lot. Our application is entirely constructed using richlets (no ZUL pages) - so, no client-side source code to take care of (included java scripts, client-side events, etc). Regarding the source code: as I previously mentioned, this is a big project, I wouldn't know where to start. :)
So, I repost my question: Could someone please tell if there should be/are any breaking changes (not compile-time, but run-time) when going from ZK3 to ZK5?
Regards,
Dani
Hi~
@zknewbie
recently, I just upgrade few applications from ZK3 to ZK5, in my experience
1. include javascript
In ZK 3, when we use <script src="XXX" />, it will output as we expected.
In ZK 5, we have to change to use <?script src="XXX" ?>, this will include the javascript to header
2. hbox component
zk3 use valign="XXX" to set position, however, in ZK5, it doesn't use valign, it provide "pack" and "align"
3. event processing thread is disable in default
if in javacode, it use thread to get answer from dialog, have to rewrite this part, or simply enable the event thread
4. Custom component
if you have your own custom component in ZK 3, it will need to rewrite to ZK 5.
5. integration with others framework or other stuff
because ZK3 will generate html in server and send html to client;
but ZK 5 is totally different, it generate javascript code and send to client, after client receive javascript code, execute the code to generate html to user;
if you have to integrate with others, it may effect each other, because the behavior is different
6. action
java cod and zul file in ZK3 could use "action" to write client side javascript, however, in ZK5, it doesn't use action. it's marked deprecated, and it doesn't have compile-time error
in ZK 5, I have to rewrite those actions to use xxx.setWidgetListener();
that's the problem I faced. I am wondering do you use action in java code ?
besides those problem I faced, I don't have much trouble to upgrade.
I am wondering, in your project, do you have any runtime exception or javascript run-time error?
and what kind of problem do you have, the layout is not as the same as ZK3 ? or some component's behavior is different ?
if you could provide more information, it will help to narrow down the possible problem and try if I could help.
First of all, thanks, @samchuang. I will be right with you.
The first thing that I have in mind is if anyone can please try the following code (it doesn't work for me, the page gets refreshed on scroll):
package com.atoss.ses.ems; import java.util.ArrayList; import java.util.Iterator; import java.util.Random; import org.zkoss.zk.ui.GenericRichlet; import org.zkoss.zk.ui.Page; import org.zkoss.zul.AbstractListModel; import org.zkoss.zul.Html; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listhead; import org.zkoss.zul.Listheader; import org.zkoss.zul.Listitem; import org.zkoss.zul.ListitemRenderer; public class TestRichlet extends GenericRichlet { final int ROWS = 200; final int COLS = 10; final String COLORS[] = { "#ffffff", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "00ffff" }; /** * @see org.zkoss.zk.ui.Richlet#service(org.zkoss.zk.ui.Page) */ public void service(Page page) { final Renderer r = new Renderer(); final Listbox list = new Listbox(); list.setPage(page); list.setCheckmark(true); list.setRows(10); // list.setHeight("320px"); // list.setMold("paging"); // list.setPageSize(20); list.setMultiple(true); list.setItemRenderer(r); final ArrayList<ArrayList<String>> filteredElements = new ArrayList<ArrayList<String>>(); for (int i = 0; i < ROWS; i++) { final ArrayList<String> row = new ArrayList<String>(); for (int j = 0; j < COLS; ++j) { row.add("R " + i + " / C " + j); } filteredElements.add(row); } AbstractListModel model = new AbstractListModel() { public Object getElementAt(int index) { return filteredElements.get(index); } public int getSize() { return filteredElements.size(); } }; list.setModel(model); Listhead head = new Listhead(); head.setParent(list); for (int i = 0; i < COLS; i++) { Listheader h1 = new Listheader(); h1.setParent(head); h1.setValign("top"); String s = "Col " + i; if (i == 3) { s += "<br>abc"; } Html lb = new Html(s); lb.setParent(h1); } } private class Renderer implements ListitemRenderer { public void render(Listitem item, Object data) throws Exception { for (Iterator<String> iterator = ((ArrayList<String>) data).iterator(); iterator.hasNext();) { String value = iterator.next(); Listcell cell = new Listcell(value); String color = COLORS[new Random().nextInt(COLORS.length)]; cell.setStyle("border: 3px solid red; background-color: " + color + ";"); cell.setParent(item); } } } }
Thanks in advance!
Regards,
Dani
@samchuang: Thanks a lot for your comments! I will answer briefly to every question:
1. We are only using richlets. We do not use any ZUL files.
2. Yes, I am aware of this.
3. I am aware of this, too.
4. We only implemented some high-level components (deriving components)
5. Thanks for pointing that. I had no clue that they changed the way the output is generated. I think this should be specified somewhere in the documentation, or, at least in the release notes. Also, the "developer centric approach" should be presented more in-depth.
6. Could you please elaborate on this a little bit?
Once again, many thanks!
BTW, running the above code outputs in the Firebug console (after scrolling):
wgt is undefined [Break on this error] wgt.appendChild(child);
Regards,
Dani
Also, when uncommenting the following lines:
list.setMold("paging"); list.setPageSize(20);
wgt.getActivePage is not a function [Break on this error] ap = wgt.getActivePage(),\n
It's ZK EE (enterprise) 5.0.0 (final).
The errors are reproducible on both FF and IE.
Regards,
Dani
Asked: 2010-01-27 01:15:59 +0800
Seen: 1,804 times
Last updated: Feb 03 '10