Revision history [back]

click to hide/show revision 1
initial version

answered 2017-04-04 17:40:35 +0800

trapongx gravatar image trapongx

I checked for event firing from client the same way as you checked. In Chrome, "Inspect" then "network".

I found lang-addon.xml in zkbind-8.0.2.2.jar as you mentioned. I removed the Java annotation from JpaTextbox and added the XML annotation in my ownlang-addon.xml like you post above. It works also.

<?xml version="1.0" encoding="UTF-8"?>
<language-addon>
    <addon-name>myzkcomp</addon-name>
      <version>
      <version-class>net.bitreplay.Version</version-class>
      <version-uid>1.0-SNAPSHOT</version-uid>
      <zk-version>8.0.2.2</zk-version><!--

or later --> </version>

  <language-name>xul/html</language-name>

  <component>
      <component-name>jpatextbox</component-name>
      <component-class>net.bitreplay.JpaTextbox</component-class>
      <extends>textbox</extends>
      <annotation>
          <annotation-name>ZKBIND</annotation-name>
          <property-name>value</property-name>
          <attribute>
              <attribute-name>ACCESS</attribute-name>
              <attribute-value>both</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>SAVE_EVENT</attribute-name>
              <attribute-value>onChange</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>LOAD_REPLACEMENT</attribute-name>
              <attribute-value>rawValue</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>LOAD_TYPE</attribute-name>
              <attribute-value>java.lang.String</attribute-value>
          </attribute>
      </annotation>
      <annotation>
          <annotation-name>ZKBIND</annotation-name>
          <property-name>errorMessage</property-name>
          <attribute>
              <attribute-name>ACCESS</attribute-name>
              <attribute-value>load</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>CONVERTER</attribute-name>
              <attribute-value>org.zkoss.bind.converter.sys.ErrorMessageConverter</attribute-value>
          </attribute>
      </annotation>
  </component>
</language-addon>

Anyway, without this annotation it does not work for me while it work for you. So I inspect the LanguageDefinition using breakpoint debugger and what I get from (It's kotlin syntax)

LanguageDefinition._ldefByName.get("xul/html")._compdefs.get("textbox")._annots

is

[annot:{value={ZKBIND=[@ZKBIND(ACCESS=[both], SAVE_EVENT=[onChange], LOAD_REPLACEMENT=[rawValue], LOAD_TYPE=[java.lang.String])], default-bind=[@default-bind(access=[both], save-when=[self.onChange])]}, errorMessage={ZKBIND=[@ZKBIND(ACCESS=[load], CONVERTER=[org.zkoss.bind.converter.sys.ErrorMessageConverter])]}}]

And from

LanguageDefinition._ldefByName.get("xul/html")._compdefs.get("jpatextbox")._annots

I get null.

Is this the expected thing?

Below is the whole of my Gradle build file. I don't want to bother you too much so unless you are curious enough, please just ignore it.

buildscript {
    ext {
        kotlinVersion = '1.1.1'
        kotlinPluginVersion = '1.1.1'
        springBootVersion = '1.5.1.RELEASE'
        zkVersion = '8.0.2.2'
        zkSpringVersion = '3.2.0'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinPluginVersion}")
        classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinPluginVersion}")
    }
}

apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'

war {
    baseName = 'londrikt'
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url 'http://mavensync.zkoss.org/maven2' }
    maven { url 'http://mavensync.zkoss.org/eval' }
    jcenter()
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-aop')
    compile('org.springframework.boot:spring-boot-starter-cache')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.springframework.boot:spring-boot-starter-mail')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-social-facebook')
    compile('org.springframework.boot:spring-boot-starter-validation')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
    compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    runtime('org.springframework.boot:spring-boot-devtools')
    runtime('com.h2database:h2')
    runtime('mysql:mysql-connector-java')
    //providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testCompile('org.springframework.boot:spring-boot-starter-test')

    compile("org.zkoss.zk:zkbind:8.0.2.2")
    compile("org.zkoss.zk:zul:8.0.2.2")
    compile("org.zkoss.zk:zuti:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkmax:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkex:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkplus:8.0.2.2")
    compile("org.zkoss.zk:zhtml:8.0.2.2")
    compile("org.zkoss.zk:zkspring-core:3.2.0")

    compile("au.com.console:kotlin-jpa-specification-dsl:0.1.0")

    //runtime("org.hibernate:hibernate-validator:4.0.2.GA")
}

Thank you so much, chillworld, for your answer.

I checked for event firing from client the same way as you checked. In Chrome, "Inspect" then "network".

I found lang-addon.xml in zkbind-8.0.2.2.jar as you mentioned. I removed the Java annotation from JpaTextbox and added the XML annotation in my ownlang-addon.xml like you post above. It works also.

<?xml version="1.0" encoding="UTF-8"?>
<language-addon>
    <addon-name>myzkcomp</addon-name>
      <version>
      <version-class>net.bitreplay.Version</version-class>
      <version-uid>1.0-SNAPSHOT</version-uid>
      <zk-version>8.0.2.2</zk-version><!--

or later --> </version>

  <language-name>xul/html</language-name>

  <component>
      <component-name>jpatextbox</component-name>
      <component-class>net.bitreplay.JpaTextbox</component-class>
      <extends>textbox</extends>
      <annotation>
          <annotation-name>ZKBIND</annotation-name>
          <property-name>value</property-name>
          <attribute>
              <attribute-name>ACCESS</attribute-name>
              <attribute-value>both</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>SAVE_EVENT</attribute-name>
              <attribute-value>onChange</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>LOAD_REPLACEMENT</attribute-name>
              <attribute-value>rawValue</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>LOAD_TYPE</attribute-name>
              <attribute-value>java.lang.String</attribute-value>
          </attribute>
      </annotation>
      <annotation>
          <annotation-name>ZKBIND</annotation-name>
          <property-name>errorMessage</property-name>
          <attribute>
              <attribute-name>ACCESS</attribute-name>
              <attribute-value>load</attribute-value>
          </attribute>
          <attribute>
              <attribute-name>CONVERTER</attribute-name>
              <attribute-value>org.zkoss.bind.converter.sys.ErrorMessageConverter</attribute-value>
          </attribute>
      </annotation>
  </component>
</language-addon>

Anyway, without this annotation it does not work for me while it work for you. So I inspect the LanguageDefinition using breakpoint debugger and what I get from (It's kotlin syntax)

LanguageDefinition._ldefByName.get("xul/html")._compdefs.get("textbox")._annots

is

[annot:{value={ZKBIND=[@ZKBIND(ACCESS=[both], SAVE_EVENT=[onChange], LOAD_REPLACEMENT=[rawValue], LOAD_TYPE=[java.lang.String])], default-bind=[@default-bind(access=[both], save-when=[self.onChange])]}, errorMessage={ZKBIND=[@ZKBIND(ACCESS=[load], CONVERTER=[org.zkoss.bind.converter.sys.ErrorMessageConverter])]}}]

And from

LanguageDefinition._ldefByName.get("xul/html")._compdefs.get("jpatextbox")._annots

I get null.

Is this the expected thing?

Below is the whole of my Gradle build file. I don't want to bother you too much so unless you are curious enough, please just ignore it.

buildscript {
    ext {
        kotlinVersion = '1.1.1'
        kotlinPluginVersion = '1.1.1'
        springBootVersion = '1.5.1.RELEASE'
        zkVersion = '8.0.2.2'
        zkSpringVersion = '3.2.0'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinPluginVersion}")
        classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinPluginVersion}")
    }
}

apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'

war {
    baseName = 'londrikt'
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    maven { url 'http://mavensync.zkoss.org/maven2' }
    maven { url 'http://mavensync.zkoss.org/eval' }
    jcenter()
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-aop')
    compile('org.springframework.boot:spring-boot-starter-cache')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.springframework.boot:spring-boot-starter-mail')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('org.springframework.boot:spring-boot-starter-social-facebook')
    compile('org.springframework.boot:spring-boot-starter-validation')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
    compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
    runtime('org.springframework.boot:spring-boot-devtools')
    runtime('com.h2database:h2')
    runtime('mysql:mysql-connector-java')
    //providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testCompile('org.springframework.boot:spring-boot-starter-test')

    compile("org.zkoss.zk:zkbind:8.0.2.2")
    compile("org.zkoss.zk:zul:8.0.2.2")
    compile("org.zkoss.zk:zuti:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkmax:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkex:8.0.2.2-Eval")
    compile("org.zkoss.zk:zkplus:8.0.2.2")
    compile("org.zkoss.zk:zhtml:8.0.2.2")
    compile("org.zkoss.zk:zkspring-core:3.2.0")

    compile("au.com.console:kotlin-jpa-specification-dsl:0.1.0")

    //runtime("org.hibernate:hibernate-validator:4.0.2.GA")
}
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More