0

zk 8.6.0.1 custom constraint problem [closed]

asked 2019-01-08 16:01:26 +0800

filippoluchini gravatar image filippoluchini
1

Hello, I'm migrating from zk 7.0.8.1 to 8.6.0.1 and I'm facing some problems with custom constraints. I try to make a simple example that works with zk7 and doesn't work with zk8.

I'have a TestConstraint class that extends SimpleConstraint, like this:

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.SimpleConstraint;

public class TestConstraint extends SimpleConstraint {
    private static final long serialVersionUID = 694308029327860534L;

    public TestConstraint(String constraints) {
        super(constraints);
    }

    public TestConstraint(int flags) {
        super(flags);
    }

    @Override
    public void validate(Component comp, Object value) throws WrongValueException {
        super.validate(comp, value);
    }
}

In the VM I declare and instantiate my two simple constraints for having no empty values in my input element:

private transient TestConstraint constraintByString;
private transient TestConstraint constraintByFlag;

public TestConstraint getConstraintByString() {
    if (constraintByString == null) {
        constraintByString = new TestConstraint("no empty");
    }
    return constraintByString;
}

public TestConstraint getConstraintByFlag() {
    if (constraintByFlag == null) {
        constraintByFlag = new TestConstraint(256);
    }
    return constraintByFlag;
}

In the zul I use these constraints for two datebox:

<datebox value="@bind(vm.start)"
format="dd/MM/yyyy HH:mm:ss" cols="19"
constraint="${vm.constraintByString}" />

<datebox value="@bind(vm.start)"
format="dd/MM/yyyy HH:mm:ss" cols="19"
constraint="${vm.constraintByFlag}" />

With zk7 both the constraints work; with zk8 the first one works, the second one doesn't work. What am I doing wrong?

Thanks in advance.

Filippo

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by cor3000
close date 2019-01-31 11:06:02

2 Answers

Sort by » oldest newest most voted
0

answered 2019-01-10 17:23:58 +0800

cor3000 gravatar image cor3000
4952 2 7
ZK Team

updated 2019-01-28 12:14:00 +0800

thanks for posting this issue. I simplified the problem and posted the JIRA issue ZK-4190

A workaround is also provided in JIRA and can be applied to a zul file as in this example

UPDATE: ZK-4190 has been fixed in the latest FL version 8.6.1.FL.20190125

link publish delete flag offensive edit
0

answered 2019-01-10 19:42:35 +0800

filippoluchini gravatar image filippoluchini
1

Sorry @cor3000, yesterday I posted this JIRA issue ZK-4187!

link publish delete flag offensive edit

Comments

we noticed and marked them as duplicates (no harm caused). next time if you mention the JIRA ID here, we'll find it more easily.

cor3000 ( 2019-01-28 12:06:33 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-01-08 16:01:26 +0800

Seen: 11 times

Last updated: Jan 28

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