0

Upgrade to ZK5

asked 2010-01-27 01:15:59 +0800

zknewbie gravatar image zknewbie
108 2

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

delete flag offensive retag edit

14 Replies

Sort by ยป oldest newest

answered 2010-01-27 03:28:15 +0800

nadestin gravatar image nadestin
3

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.

link publish delete flag offensive edit

answered 2010-01-27 03:55:52 +0800

tmillsclare gravatar image tmillsclare
799 2 5 30

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.

link publish delete flag offensive edit

answered 2010-01-27 04:30:01 +0800

zknewbie gravatar image zknewbie
108 2

@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

link publish delete flag offensive edit

answered 2010-01-28 02:33:56 +0800

zknewbie gravatar image zknewbie
108 2

Any news on this...?

link publish delete flag offensive edit

answered 2010-01-28 03:39:56 +0800

samchuang gravatar image samchuang
4084 4

updated 2010-01-28 03:41:20 +0800

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.

link publish delete flag offensive edit

answered 2010-01-28 07:07:02 +0800

zknewbie gravatar image zknewbie
108 2

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

link publish delete flag offensive edit

answered 2010-01-28 07:22:38 +0800

zknewbie gravatar image zknewbie
108 2

@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

link publish delete flag offensive edit

answered 2010-01-28 07:28:23 +0800

zknewbie gravatar image zknewbie
108 2

updated 2010-01-28 07:28:41 +0800

Also, when uncommenting the following lines:

list.setMold("paging");
list.setPageSize(20);

I get something like:
wgt.getActivePage is not a function
[Break on this error] ap = wgt.getActivePage(),\n

link publish delete flag offensive edit

answered 2010-01-28 19:00:46 +0800

samchuang gravatar image samchuang
4084 4

Hi~~

I would like to try your code, but first, I need to know which version do you download, ZK 5.0.0. ? or ZK 5 RC2 ?
and which package do you use ZK CE, ZK PE(professional ) or ZK EE(enterprise )?

link publish delete flag offensive edit

answered 2010-01-29 01:03:49 +0800

zknewbie gravatar image zknewbie
108 2

updated 2010-01-29 01:14:07 +0800

It's ZK EE (enterprise) 5.0.0 (final).

The errors are reproducible on both FF and IE.

Regards,
Dani

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: 2010-01-27 01:15:59 +0800

Seen: 1,804 times

Last updated: Feb 03 '10

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