Jaxx-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
December 2008
- 2 participants
- 69 discussions
[Buix-commits] r1050 - in lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst: . images
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
02 Dec '08
Author: tchemit
Date: 2008-12-02 01:00:12 +0000 (Tue, 02 Dec 2008)
New Revision: 1050
Added:
lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/images/BeanDataBinding-screenshot.png
Removed:
lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/images/Validation-screenshot.png
Modified:
lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/index.rst
Log:
fix BeanDataBinding site
Added: lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/images/BeanDataBinding-screenshot.png
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/images/BeanDataBinding-screenshot.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/images/Validation-screenshot.png
===================================================================
(Binary files differ)
Modified: lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/index.rst
===================================================================
--- lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/index.rst 2008-12-02 00:54:46 UTC (rev 1049)
+++ lutinjaxx/trunk/jaxx-example/BeanDataBinding/src/site/fr/rst/index.rst 2008-12-02 01:00:12 UTC (rev 1050)
@@ -1,14 +1,13 @@
-===================
-Examples/Validation
-===================
+========================
+Examples/BeanDataBinding
+========================
-This example program creates a number of components which are used to control the appearance of a JLabel.
-Everything is performed through data binding; there are no script tags or explicit event handlers anywhere.
+This example program tests the bean data binding with the full java bean support.
Screen shot
-----------
-.. image:: images/Validation-screenshot.png
+.. image:: images/BeanDataBinding-screenshot.png
Set it in action
----------------
@@ -25,4 +24,4 @@
.. |webstart| image:: images/webstart.gif
-.. _following link: ./launch-Validation.jnlp
+.. _following link: ./launch-BeanDataBinding.jnlp
1
0
[Buix-commits] r1049 - in lutinjaxx/trunk: jaxx-core jaxx-swing-action jaxx-util maven-jaxx-plugin
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
02 Dec '08
Author: tchemit
Date: 2008-12-02 00:54:46 +0000 (Tue, 02 Dec 2008)
New Revision: 1049
Modified:
lutinjaxx/trunk/jaxx-core/pom.xml
lutinjaxx/trunk/jaxx-swing-action/pom.xml
lutinjaxx/trunk/jaxx-util/pom.xml
lutinjaxx/trunk/maven-jaxx-plugin/pom.xml
Log:
fix scm values
Modified: lutinjaxx/trunk/jaxx-core/pom.xml
===================================================================
--- lutinjaxx/trunk/jaxx-core/pom.xml 2008-12-02 00:37:29 UTC (rev 1048)
+++ lutinjaxx/trunk/jaxx-core/pom.xml 2008-12-02 00:54:46 UTC (rev 1049)
@@ -56,8 +56,8 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.son}</connection>
- <developerConnection>${maven.scm.developerConnection.son}</developerConnection>
- <url>${maven.scm.url.son}</url>
+ <connection>${scm.connection.son}</connection>
+ <developerConnection>${scm.developerConnection.son}</developerConnection>
+ <url>${scm.url.son}</url>
</scm>
</project>
Modified: lutinjaxx/trunk/jaxx-swing-action/pom.xml
===================================================================
--- lutinjaxx/trunk/jaxx-swing-action/pom.xml 2008-12-02 00:37:29 UTC (rev 1048)
+++ lutinjaxx/trunk/jaxx-swing-action/pom.xml 2008-12-02 00:54:46 UTC (rev 1049)
@@ -72,9 +72,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.son}</connection>
- <developerConnection>${maven.scm.developerConnection.son}</developerConnection>
- <url>${maven.scm.url.son}</url>
+ <connection>${scm.connection.son}</connection>
+ <developerConnection>$scm.developerConnection.son}</developerConnection>
+ <url>${scm.url.son}</url>
</scm>
</project>
Modified: lutinjaxx/trunk/jaxx-util/pom.xml
===================================================================
--- lutinjaxx/trunk/jaxx-util/pom.xml 2008-12-02 00:37:29 UTC (rev 1048)
+++ lutinjaxx/trunk/jaxx-util/pom.xml 2008-12-02 00:54:46 UTC (rev 1049)
@@ -39,9 +39,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.son}</connection>
- <developerConnection>${maven.scm.developerConnection.son}</developerConnection>
- <url>${maven.scm.url.son}</url>
+ <connection>${scm.connection.son}</connection>
+ <developerConnection>${scm.developerConnection.son}</developerConnection>
+ <url>${scm.url.son}</url>
</scm>
</project>
Modified: lutinjaxx/trunk/maven-jaxx-plugin/pom.xml
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/pom.xml 2008-12-02 00:37:29 UTC (rev 1048)
+++ lutinjaxx/trunk/maven-jaxx-plugin/pom.xml 2008-12-02 00:54:46 UTC (rev 1049)
@@ -127,9 +127,9 @@
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
<scm>
- <connection>${maven.scm.connection.son}</connection>
- <developerConnection>${maven.scm.developerConnection.son}</developerConnection>
- <url>${maven.scm.url.son}</url>
+ <connection>${scm.connection.son}</connection>
+ <developerConnection>${scm.developerConnection.son}</developerConnection>
+ <url>${scm.url.son}</url>
</scm>
</project>
\ No newline at end of file
1
0
[Buix-commits] r1048 - in lutinjaxx/trunk: jaxx-core/src/main/java/jaxx/runtime/validator jaxx-core/src/main/java/jaxx/tags/validator maven-jaxx-plugin/src/test/java/org/codelutin/jaxx maven-jaxx-plugin/src/test/resources/testcases/validator/errors
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
by tchemit@users.labs.libre-entreprise.org 02 Dec '08
02 Dec '08
Author: tchemit
Date: 2008-12-02 00:37:29 +0000 (Tue, 02 Dec 2008)
New Revision: 1048
Removed:
lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/DuplicatedFieldInOtherValidator.jaxx
lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/FieldComponentDuplicated2.jaxx
Modified:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java
lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerTest.java
Log:
can authorize now to have a field of a bean manage by more than one validator (for example error validator and warning one)...
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java 2008-12-02 00:37:29 UTC (rev 1048)
@@ -398,6 +398,10 @@
//return validationContext.hasFieldErrors() || validationContext.hasActionErrors();
}
+ public boolean hasWarnings() {
+ return scope == Scope.WARNING && (validationContext.hasFieldErrors() || !conversionErrors.isEmpty());
+ }
+
/** install ui on required components */
public void installUIs() {
SwingUtilities.invokeLater(new Runnable() {
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java 2008-12-02 00:37:29 UTC (rev 1048)
@@ -103,7 +103,7 @@
}
protected <T> void fillNewErrors(BeanValidator<T> validator, List<BeanValidatorError> newErrors) {
- if (validator.hasErrors()) {
+ if (validator.hasErrors() || validator.hasWarnings()) {
// inject this validator errors
for (Object o : validator.getFieldErrors().entrySet()) {
Map.Entry<?, ?> r = (Map.Entry<?, ?>) o;
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java 2008-12-02 00:37:29 UTC (rev 1048)
@@ -529,11 +529,11 @@
// editor component not find on ui
continue;
}
- if (compiler.isComponentUsedByValidator(component)) {
+ /*if (compiler.isComponentUsedByValidator(component)) {
// component is already used by another validator
compiler.reportError("component '" + component + "' is already used by another validator.");
continue;
- }
+ }*/
String keyCode = TypeManager.getJavaCode(propertyName);
appendAdditionCode(getJavaCode() + ".setFieldRepresentation(" + keyCode + ", " + component + ");");
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerTest.java
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerTest.java 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/java/org/codelutin/jaxx/CompilerTest.java 2008-12-02 00:37:29 UTC (rev 1048)
@@ -2,8 +2,8 @@
import jaxx.compiler.JAXXCompiler;
import jaxx.compiler.JAXXCompilerHelper;
+import jaxx.runtime.DefaultJAXXContext;
import jaxx.runtime.JAXXContext;
-import jaxx.runtime.DefaultJAXXContext;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.junit.Assert;
@@ -135,7 +135,7 @@
} catch (IllegalArgumentException e) {
Assert.assertTrue(true);
}
-
+
mojo.setJaxxContextImplementorClass(JAXXContext.class.getName());
try {
mojo.init();
@@ -144,7 +144,7 @@
Assert.assertTrue(true);
}
- mojo.setJaxxContextImplementorClass(DefaultJAXXContext.class.getName());
+ mojo.setJaxxContextImplementorClass(DefaultJAXXContext.class.getName());
mojo.init();
Assert.assertTrue(true);
@@ -214,7 +214,7 @@
// init mojo to get alls files to treate
mojo.init();
String[] files = mojo.getFiles();
- assertEquals(17, mojo.getFiles().length);
+ assertEquals(15, mojo.getFiles().length);
mojo.setLog(new SystemStreamLog() {
@Override
public boolean isErrorEnabled() {
@@ -249,7 +249,7 @@
try {
mojo.doAction();
// should never pass
- fail();
+ fail("for file " + file);
} catch (MojoExecutionException e) {
// ok jaxx compiler failed
assertTrue(true);
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/DuplicatedFieldInOtherValidator.jaxx
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/DuplicatedFieldInOtherValidator.jaxx 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/DuplicatedFieldInOtherValidator.jaxx 2008-12-02 00:37:29 UTC (rev 1048)
@@ -1,266 +0,0 @@
-<Application title="Validation.jaxx">
-
- <!-- models -->
- <Model id='model'/>
- <Model id='model2'/>
-
- <!-- errors model -->
- <jaxx.runtime.validator.BeanValidatorErrorListModel id='errors' onContentsChanged='ok.setEnabled(errors.size()==0)'/>
-
- <!-- validators -->
- <BeanValidator id='validator' bean='model' errorListModel='errors'>
- <field name="text"/>
- <field name="text2"/>
- <field name="ratio"/>
- </BeanValidator>
- <BeanValidator id='validator2' bean='model2' errorListModel='errors' uiClass="jaxx.runtime.validator.ui.IconValidationUI">
- <field name="text" component="text"/>
- <field name="text2" component="_text2"/>
- <field name="ratio" component="_ratio"/>
- </BeanValidator>
-
- <Table fill='both'>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Form")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='text' text='{model.getText()}'
- onKeyReleased='model.setText(text.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='text2' text='{model.getText2()}'
- onKeyReleased='model.setText2(text2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}'
- onStateChanged='model.setRatio(ratio.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model.getText()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model.getText2()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JLabel text='{model.getRatio()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Form2")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='_text' text='{model2.getText()}'
- onKeyReleased='model2.setText(_text.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='_text2' text='{model2.getText2()}'
- onKeyReleased='model2.setText2(_text2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}'
- onStateChanged='model2.setRatio(_ratio.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Model2")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model2.getText()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model2.getText2()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JLabel text='{model2.getRatio()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}'
- layout='{new GridLayout()}' width='250' height='140'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='FirstName:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='firstName' text='{identity.getFirstName()}'
- onKeyReleased='identity.setFirstName(firstName.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='LastName:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='lastName' text='{identity.getLastName()}'
- onKeyReleased='identity.setLastName(lastName.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Email:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='email2' text='{identity.getEmail()}'
- onKeyReleased='identity.setEmail(email2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Age:'/>
- </cell>
- <cell>
- <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}'
- onStateChanged='identity.setAge(age.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='FirstName:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getFirstName()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='LastName:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getLastName()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Email:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getEmail()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Age:'/>
- </cell>
- <cell>
- <JLabel text='{identity.getAge()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='2' fill="both">
- <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' width='500'>
- <JScrollPane>
- <JList model='{errors}'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='2' fill="both">
- <JPanel layout='{new GridLayout(1,2,0,0)}'>
- <JButton text='cancel' onActionPerformed='dispose()'/>
- <JButton id='ok' text='valid' onActionPerformed='dispose()'/>
- </JPanel>
- </cell>
- </row>
-
- </Table>
-</Application>
Deleted: lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/FieldComponentDuplicated2.jaxx
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/FieldComponentDuplicated2.jaxx 2008-12-01 23:59:46 UTC (rev 1047)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/errors/FieldComponentDuplicated2.jaxx 2008-12-02 00:37:29 UTC (rev 1048)
@@ -1,266 +0,0 @@
-<Application title="Validation.jaxx">
-
- <!-- models -->
- <Model id='model'/>
- <Model id='model2'/>
-
- <!-- errors model -->
- <jaxx.runtime.validator.BeanValidatorErrorListModel id='errors' onContentsChanged='ok.setEnabled(errors.size()==0)'/>
-
- <!-- validators -->
- <BeanValidator id='validator' errorListModel='errors' bean="model">
- <field name="text" component="text"/>
- <field name="text2" />
- <field name="ratio"/>
- </BeanValidator>
- <BeanValidator id='validator2' bean='model2' errorListModel='errors' uiClass="jaxx.runtime.validator.ui.IconValidationUI">
- <field name="text" component="text"/>
- <field name="text2" component="_text2"/>
- <field name="ratio" component="_ratio"/>
- </BeanValidator>
-
- <Table fill='both'>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Form")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='text' text='{model.getText()}'
- onKeyReleased='model.setText(text.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='text2' text='{model.getText2()}'
- onKeyReleased='model.setText2(text2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}'
- onStateChanged='model.setRatio(ratio.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model.getText()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model.getText2()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JLabel text='{model.getRatio()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Form2")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='_text' text='{model2.getText()}'
- onKeyReleased='model2.setText(_text.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='_text2' text='{model2.getText2()}'
- onKeyReleased='model2.setText2(_text2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}'
- onStateChanged='model2.setRatio(_ratio.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Model2")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='Text:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model2.getText()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Text2:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{model2.getText2()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Ratio:'/>
- </cell>
- <cell>
- <JLabel text='{model2.getRatio()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}'
- layout='{new GridLayout()}' width='250' height='140'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='FirstName:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='firstName' text='{identity.getFirstName()}'
- onKeyReleased='identity.setFirstName(firstName.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='LastName:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='lastName' text='{identity.getLastName()}'
- onKeyReleased='identity.setLastName(lastName.getText())'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Email:'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='email2' text='{identity.getEmail()}'
- onKeyReleased='identity.setEmail(email2.getText())'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Age:'/>
- </cell>
- <cell>
- <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}'
- onStateChanged='identity.setAge(age.getValue())'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- <cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
- <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
- <row>
- <cell>
- <JLabel text='FirstName:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getFirstName()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='LastName:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getLastName()}'/>
- </cell>
- </row>
- <row>
- <cell>
- <JLabel text='Email:'/>
- </cell>
- <cell weightx='1'>
- <JLabel text='{identity.getEmail()}'/>
- </cell>
- </row>
-
- <row>
- <cell>
- <JLabel text='Age:'/>
- </cell>
- <cell>
- <JLabel text='{identity.getAge()}'/>
- </cell>
- </row>
- </Table>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='2' fill="both">
- <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' width='500'>
- <JScrollPane>
- <JList model='{errors}'/>
- </JScrollPane>
- </JPanel>
- </cell>
- </row>
- <row>
- <cell columns='2' fill="both">
- <JPanel layout='{new GridLayout(1,2,0,0)}'>
- <JButton text='cancel' onActionPerformed='dispose()'/>
- <JButton id='ok' text='valid' onActionPerformed='dispose()'/>
- </JPanel>
- </cell>
- </row>
-
- </Table>
-</Application>
1
0
[Buix-commits] r1047 - in lutinjaxx/trunk/jaxx-core: . src/main/java/jaxx/runtime src/test/java/jaxx/runtime
by tchemit@users.labs.libre-entreprise.org 01 Dec '08
by tchemit@users.labs.libre-entreprise.org 01 Dec '08
01 Dec '08
Author: tchemit
Date: 2008-12-01 23:59:46 +0000 (Mon, 01 Dec 2008)
New Revision: 1047
Modified:
lutinjaxx/trunk/jaxx-core/changelog
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Decorator.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JAXXContextEntryDef.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
Log:
implements jaxx.runtime.JXPathDecorator
add setcontextValue and removeContextValue on JAXXContextEntryDef
Modified: lutinjaxx/trunk/jaxx-core/changelog
===================================================================
--- lutinjaxx/trunk/jaxx-core/changelog 2008-12-01 17:10:17 UTC (rev 1046)
+++ lutinjaxx/trunk/jaxx-core/changelog 2008-12-01 23:59:46 UTC (rev 1047)
@@ -1,8 +1,10 @@
- 0.7 chemit
- * 20081201 [chemit] introduce scope in BeanValidator (ERROR or WARNING)
- * 20081201 [chemit] only enter once in $initialize method in generated code
+ 0.7 chemit 200812??
+ * 20081201 [chemit] - implements jaxx.runtime.JXPathDecorator
+ - add setcontextValue and removeContextValue on JAXXContextEntryDef
+ - introduce scope in BeanValidator (ERROR or WARNING) and related swing stuff
+ - only enter once in $initialize method in generated code
- 0.6 chemit 200811
+ 0.6 chemit 20081117
* 20081118 [chemit] introduce NavigationUtil, save in context selected node
* 20081107 [chemit] improve data binding and code generation :
- make possible inheritance in binding
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Decorator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Decorator.java 2008-12-01 17:10:17 UTC (rev 1046)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Decorator.java 2008-12-01 23:59:46 UTC (rev 1047)
@@ -10,7 +10,14 @@
protected final Class<O> internalClass;
private static final long serialVersionUID = -1L;
- public Decorator(Class<O> internalClass) {
+ /**
+ * @param internalClass the class of objects to be decorated.
+ * @throws NullPointerException if internalClass parameter is null
+ */
+ public Decorator(Class<O> internalClass) throws NullPointerException {
+ if (internalClass == null) {
+ throw new NullPointerException("internalClass can not be null.");
+ }
this.internalClass = internalClass;
}
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JAXXContextEntryDef.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JAXXContextEntryDef.java 2008-12-01 17:10:17 UTC (rev 1046)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JAXXContextEntryDef.java 2008-12-01 23:59:46 UTC (rev 1047)
@@ -52,6 +52,14 @@
return context.getContextValue(klass, name);
}
+ public void removeContextValue(JAXXContext context) {
+ context.removeContextValue(klass, name);
+ }
+
+ public void setContextValue(JAXXContext context, O value) {
+ context.setContextValue(value, name);
+ }
+
@Override
public String toString() {
return super.toString() + "<" + klass + ":" + name + ">";
@@ -103,11 +111,8 @@
}
public boolean accept2(Class<?> klass, String name) {
- if (klass == Object.class && this.klass != Object.class) {
- // block if looking for Object.class
- return false;
- }
- return this.klass.isAssignableFrom(klass) && (this.name == null && name == null
- || (this.name != null && name != null && this.name.equals(name)));
+ return !(klass == Object.class && this.klass != Object.class) &&
+ this.klass.isAssignableFrom(klass) && (this.name == null &&
+ name == null || (this.name != null && name != null && this.name.equals(name)));
}
}
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 17:10:17 UTC (rev 1046)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 23:59:46 UTC (rev 1047)
@@ -5,9 +5,28 @@
import org.apache.commons.logging.LogFactory;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
-/** @author chemit */
+/**
+ * JXPath decorator based on {@link String#format(String, Object[])} method.
+ * <p/>
+ * To use it, give to him a expression where all jxpath to apply on bean are boxed in <code>${}</code>.
+ * <p/>
+ * After the jxpath token you must specifiy the formatter to apply of the jxpath token.
+ * <p/>
+ * For example :
+ * <pre>
+ * Decorator<Object> d = JXPathDecorator.newDecorator(JXPathDecorator.class,"expr = ${expressions}$s");
+ * assert "expr = %1$s" == d.getExpression();
+ * assert 1 == d.getNbToken();
+ * assert java.util.Arrays.asList("expression") == d.getTokens();
+ * assert "expr = %1$s" == d.toString(d);
+ * </pre>
+ *
+ * @author chemit
+ * @see Decorator
+ */
public class JXPathDecorator<O> extends Decorator<O> {
/** to use log facility, just put in your code: log.info(\"...\"); */
@@ -15,76 +34,103 @@
private static final long serialVersionUID = 1L;
+ /**
+ * Factory method to instanciate a new {@link JXPathDecorator} for the given class {@link O} and expression.
+ *
+ * @param internalClass the class of the objects decorated by the new decorator
+ * @param expression the expression to use to decorated objects
+ * @param <O> the generic type of class to be decorated by the new decorator
+ * @return the new instanciated decorator
+ * @throws IllegalArgumentException if the expression is not valid, says:
+ * <p/>
+ * - a missing right brace was detected.
+ * <p/>
+ * - a ${ was found in a jxpath token.
+ * @throws NullPointerException if internalClass parameter is null.
+ */
+ public static <O> JXPathDecorator<O> newDecorator(Class<O> internalClass, String expression)
+ throws IllegalArgumentException, NullPointerException {
+ return new JXPathDecorator<O>(internalClass, expression);
+ }
+
+ /**
+ * expression to format using {@link String#format(String, Object[])}, all variables are compute
+ * using using the jxpath tokens.
+ */
protected String expression;
- protected String[] data;
+ /** list of jxpath tokens to apply on expression */
+ protected String[] tokens;
- protected Boolean[] jxPath;
-
+ /** nb jxpath tokens to compute */
protected int nbToken;
- public JXPathDecorator(Class<O> internalClass, String expression) {
+ protected JXPathDecorator(Class<O> internalClass, String expression) throws IllegalArgumentException, NullPointerException {
super(internalClass);
- this.expression = expression;
- List<String> lData = new ArrayList<String>();
- List<Boolean> ljxPath = new ArrayList<Boolean>();
-
- int index = expression.indexOf("${");
- boolean first = true;
- int end = expression.length();
- while (index > -1) {
- if (first) {
- first = false;
- if (index > 0) {
- // prefix before first jxpath
- lData.add(expression.substring(0, index ));
- ljxPath.add(false);
- }
+ List<String> lTokens = new ArrayList<String>();
+ StringBuilder buffer = new StringBuilder();
+ int size = expression.length();
+ int end = -1;
+ int start;
+ while ((start = expression.indexOf("${", end + 1)) > -1) {
+ if (start > end + 1) {
+ // prefix of next jxpath token
+ buffer.append(expression.substring(end + 1, start));
}
- // seek next }
- int last = expression.indexOf("}", index + 1);
- if (last != -1) {
- // jxpath detected
- String s = expression.substring(index + 2, last);
- lData.add(s);
- ljxPath.add(true);
+ // seek end of jxpath
+ end = expression.indexOf("}", start + 1);
+ if (end == -1) {
+ throw new IllegalArgumentException("could not find the rigth brace starting at car " + start + " : " + expression.substring(start + 2));
}
-
- index = expression.indexOf("${", last + 1);
- if (index > -1) {
- // inter jxpath code
- String s = expression.substring(last + 1, index);
- lData.add(s);
- ljxPath.add(false);
- } else {
- if (end > (last + 1)) {
- // suffix after last jxpath
- String s = expression.substring(last + 1);
- lData.add(s);
- ljxPath.add(false);
- }
+ String jxpath = expression.substring(start + 2, end);
+ // not allowed ${ inside a jxpath token
+ if (jxpath.indexOf("${") > -1) {
+ throw new IllegalArgumentException("could not find a ${ inside a jxpath expression at car " + (start + 2) + " : " + jxpath);
}
+ // save the jxpath token
+ lTokens.add(jxpath);
+ // replace jxpath token in expresion with a string format variable
+ buffer.append("%").append(lTokens.size());
}
- data = lData.toArray(new String[lData.size()]);
- jxPath = ljxPath.toArray(new Boolean[ljxPath.size()]);
- nbToken = data.length;
+ if (size > (end + 1)) {
+ // suffix after end jxpath (or all expression if no jxpath)
+ buffer.append(expression.substring(end + 1));
+ }
+
+ this.tokens = lTokens.toArray(new String[lTokens.size()]);
+ this.nbToken = tokens.length;
+ this.expression = buffer.toString();
if (log.isDebugEnabled()) {
- log.debug("lData : " + lData);
- log.debug("ljxPath : " + ljxPath);
+ log.debug(expression + " --> " + this);
}
-
}
public String toString(Object bean) {
+ if (bean == null) {
+ return null;
+ }
JXPathContext jxcontext = JXPathContext.newContext(bean);
- StringBuilder buffer = new StringBuilder();
+ Object[] args = new Object[nbToken];
for (int i = 0; i < nbToken; i++) {
- String s = data[i];
- if (jxPath[i]) {
- s = String.valueOf(jxcontext.getValue(s));
- }
- buffer.append(s);
+ args[i] = jxcontext.getValue(tokens[i]);
}
- return buffer.toString();
+ return String.format(expression, args);
}
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public String[] getTokens() {
+ return tokens;
+ }
+
+ public int getNbToken() {
+ return nbToken;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<expression:" + expression + ", tokens:" + Arrays.toString(tokens) + ">";
+ }
}
Modified: lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 17:10:17 UTC (rev 1046)
+++ lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 23:59:46 UTC (rev 1047)
@@ -1,65 +1,90 @@
package jaxx.runtime;
+import org.junit.After;
+import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.junit.Assert;
/** @author chemit */
public class JXPathDecoratorTest {
- public static class Model {
- protected String name;
+ protected JXPathDecorator<?> decorator;
+ protected String expected;
+ protected String result;
- protected int integervalue;
+ @After
+ public void after() {
+ decorator = null;
+ }
- public Model(String name, int integervalue) {
- this.name = name;
- this.integervalue = integervalue;
- }
+ @Test(expected = NullPointerException.class)
+ public void testNullInternalClass() throws Exception {
+ decorator = JXPathDecorator.newDecorator(null, "hello");
+ }
- public String getName() {
- return name;
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testMissingRightBrace() throws Exception {
+ decorator = JXPathDecorator.newDecorator(Object.class, "${haha");
+ }
- public void setName(String name) {
- this.name = name;
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testMissingRightBrace2() throws Exception {
+ decorator = JXPathDecorator.newDecorator(Object.class, "${haha${hum}");
+ }
- public int getIntegervalue() {
- return integervalue;
- }
+ @Test
+ public void testNullBean() throws Exception {
+ decorator = JXPathDecorator.newDecorator(Object.class, "hello");
+ expected = "hello";
+ assertEquals(expected, decorator.expression);
+ assertEquals(0, decorator.nbToken);
+ assertEquals(0, decorator.tokens.length);
- public void setIntegervalue(int integervalue) {
- this.integervalue = integervalue;
- }
+ result = decorator.toString(null);
+ assertEquals(null, result);
}
@Test
+ public void testNoJXPath() throws Exception {
+ decorator = JXPathDecorator.newDecorator(Object.class, "hello");
+ expected = "hello";
+ assertEquals(expected, decorator.expression);
+ assertEquals(0, decorator.nbToken);
+ assertEquals(0, decorator.tokens.length);
+
+ result = decorator.toString(this);
+ assertEquals(expected, result);
+ }
+
+
+ @Test
public void testDecorator() throws Exception {
- Decorator<Model> decorator;
- String expected;
- String result;
- Model m = new Model("name", 10);
+ decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s - ${nbToken}$d");
+ assertEquals("%1$s - %2$d", decorator.expression);
+ assertDecoratorInternal();
- decorator = new JXPathDecorator<Model>(Model.class,"${name} - ${integervalue}");
- expected = m.getName() + " - " + m.getIntegervalue();
- result = decorator.toString(m);
- Assert.assertEquals(expected, result);
+ decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}${nbToken}");
+ assertEquals("%1%2", decorator.expression);
+ assertDecoratorInternal();
- decorator = new JXPathDecorator<Model>(Model.class,"${name}${integervalue}");
- expected = m.getName() + m.getIntegervalue();
- result = decorator.toString(m);
- Assert.assertEquals(expected, result);
+ decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before ${expression}$s - ${nbToken}$d after");
+ assertEquals("before %1$s - %2$d after", decorator.expression);
+ assertDecoratorInternal();
- decorator = new JXPathDecorator<Model>(Model.class,"before ${name} - ${integervalue} after");
- expected = "before "+m.getName() + " - " + m.getIntegervalue()+" after";
- result = decorator.toString(m);
- Assert.assertEquals(expected, result);
+ decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before${expression}$s-${nbToken}$dafter");
+ assertEquals("before%1$s-%2$dafter", decorator.expression);
+ assertDecoratorInternal();
+ }
- decorator = new JXPathDecorator<Model>(Model.class,"before${name}-${integervalue}after");
- expected = "before"+m.getName() + "-" + m.getIntegervalue()+"after";
- result = decorator.toString(m);
- Assert.assertEquals(expected, result);
+ public void assertDecoratorInternal() {
+ assertEquals(2, decorator.nbToken);
+ assertEquals(2, decorator.tokens.length);
+ assertEquals("expression", decorator.tokens[0]);
+ assertEquals("nbToken", decorator.tokens[1]);
+ expected = String.format(decorator.expression, decorator.getExpression(), decorator.getNbToken());
+ result = decorator.toString(decorator);
+ assertEquals(expected, result);
}
+
}
1
0
[Buix-commits] r1046 - in lutinjaxx/trunk/jaxx-core/src: main/java/jaxx/runtime test/java/jaxx/runtime
by chemit@users.labs.libre-entreprise.org 01 Dec '08
by chemit@users.labs.libre-entreprise.org 01 Dec '08
01 Dec '08
Author: chemit
Date: 2008-12-01 17:10:17 +0000 (Mon, 01 Dec 2008)
New Revision: 1046
Modified:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
Log:
JXPathDecorator on rocks
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 17:09:43 UTC (rev 1045)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 17:10:17 UTC (rev 1046)
@@ -4,6 +4,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.ArrayList;
+import java.util.List;
+
/** @author chemit */
public class JXPathDecorator<O> extends Decorator<O> {
@@ -14,18 +17,74 @@
protected String expression;
+ protected String[] data;
+
+ protected Boolean[] jxPath;
+
+ protected int nbToken;
+
public JXPathDecorator(Class<O> internalClass, String expression) {
super(internalClass);
this.expression = expression;
+ List<String> lData = new ArrayList<String>();
+ List<Boolean> ljxPath = new ArrayList<Boolean>();
+
+ int index = expression.indexOf("${");
+ boolean first = true;
+ int end = expression.length();
+ while (index > -1) {
+ if (first) {
+ first = false;
+ if (index > 0) {
+ // prefix before first jxpath
+ lData.add(expression.substring(0, index ));
+ ljxPath.add(false);
+ }
+ }
+ // seek next }
+ int last = expression.indexOf("}", index + 1);
+ if (last != -1) {
+ // jxpath detected
+ String s = expression.substring(index + 2, last);
+ lData.add(s);
+ ljxPath.add(true);
+ }
+
+ index = expression.indexOf("${", last + 1);
+ if (index > -1) {
+ // inter jxpath code
+ String s = expression.substring(last + 1, index);
+ lData.add(s);
+ ljxPath.add(false);
+ } else {
+ if (end > (last + 1)) {
+ // suffix after last jxpath
+ String s = expression.substring(last + 1);
+ lData.add(s);
+ ljxPath.add(false);
+ }
+ }
+ }
+ data = lData.toArray(new String[lData.size()]);
+ jxPath = ljxPath.toArray(new Boolean[ljxPath.size()]);
+ nbToken = data.length;
+ if (log.isDebugEnabled()) {
+ log.debug("lData : " + lData);
+ log.debug("ljxPath : " + ljxPath);
+ }
+
}
public String toString(Object bean) {
- //todo check bean class
JXPathContext jxcontext = JXPathContext.newContext(bean);
- String result = (String) jxcontext.getValue(expression);
- if (log.isDebugEnabled()) {
- log.debug(expression + " : " + result);
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < nbToken; i++) {
+ String s = data[i];
+ if (jxPath[i]) {
+ s = String.valueOf(jxcontext.getValue(s));
+ }
+ buffer.append(s);
}
- return result;
+ return buffer.toString();
}
}
Modified: lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 17:09:43 UTC (rev 1045)
+++ lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 17:10:17 UTC (rev 1046)
@@ -1,6 +1,7 @@
package jaxx.runtime;
import org.junit.Test;
+import org.junit.Assert;
/** @author chemit */
public class JXPathDecoratorTest {
@@ -35,13 +36,30 @@
@Test
public void testDecorator() throws Exception {
- //fixme : make me work :)
- Decorator<Model> decorator = new JXPathDecorator<Model>(Model.class,"${name} - ${integerValue}");
+ Decorator<Model> decorator;
+ String expected;
+ String result;
Model m = new Model("name", 10);
-// String expected = m.getName() + " - " + m.getIntegervalue();
-// String result = decorator.toString(m);
- //org.junit.Assert.assertEquals(expected, result);
+ decorator = new JXPathDecorator<Model>(Model.class,"${name} - ${integervalue}");
+ expected = m.getName() + " - " + m.getIntegervalue();
+ result = decorator.toString(m);
+ Assert.assertEquals(expected, result);
+
+ decorator = new JXPathDecorator<Model>(Model.class,"${name}${integervalue}");
+ expected = m.getName() + m.getIntegervalue();
+ result = decorator.toString(m);
+ Assert.assertEquals(expected, result);
+
+ decorator = new JXPathDecorator<Model>(Model.class,"before ${name} - ${integervalue} after");
+ expected = "before "+m.getName() + " - " + m.getIntegervalue()+" after";
+ result = decorator.toString(m);
+ Assert.assertEquals(expected, result);
+
+ decorator = new JXPathDecorator<Model>(Model.class,"before${name}-${integervalue}after");
+ expected = "before"+m.getName() + "-" + m.getIntegervalue()+"after";
+ result = decorator.toString(m);
+ Assert.assertEquals(expected, result);
}
}
1
0
01 Dec '08
Author: chemit
Date: 2008-12-01 17:09:43 +0000 (Mon, 01 Dec 2008)
New Revision: 1045
Modified:
lutinjaxx/trunk/pom.xml
Log:
dump lutinproject to 3.1
Modified: lutinjaxx/trunk/pom.xml
===================================================================
--- lutinjaxx/trunk/pom.xml 2008-12-01 14:56:55 UTC (rev 1044)
+++ lutinjaxx/trunk/pom.xml 2008-12-01 17:09:43 UTC (rev 1045)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.0</version>
+ <version>3.1</version>
</parent>
<artifactId>lutinjaxx</artifactId>
@@ -49,7 +49,7 @@
<!--license-switcher.version>0.5-SNAPSHOT</license-switcher.version-->
<!-- current version -->
- <current.version>0.5-SNAPSHOT</current.version>
+ <current.version>0.7-SNAPSHOT</current.version>
<!-- id du projet du labs -->
<labs.id>38</labs.id>
1
0
[Buix-commits] r1044 - in lutinjaxx/trunk: . jaxx-core/src/main/java/jaxx/runtime jaxx-core/src/main/java/jaxx/runtime/swing/navigation jaxx-core/src/site/fr/rst jaxx-core/src/test/java/jaxx/runtime
by chemit@users.labs.libre-entreprise.org 01 Dec '08
by chemit@users.labs.libre-entreprise.org 01 Dec '08
01 Dec '08
Author: chemit
Date: 2008-12-01 14:56:55 +0000 (Mon, 01 Dec 2008)
New Revision: 1044
Added:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java
Removed:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationtreeSelectionAdapterWithCardLayout.java
Modified:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
lutinjaxx/trunk/jaxx-core/src/site/fr/rst/NavigationTreeModel.rst
lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
lutinjaxx/trunk/pom.xml
Log:
rename mistake , ...
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 08:10:22 UTC (rev 1043)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/JXPathDecorator.java 2008-12-01 14:56:55 UTC (rev 1044)
@@ -20,7 +20,7 @@
}
public String toString(Object bean) {
- //todo check bean class
+ //todo check bean class
JXPathContext jxcontext = JXPathContext.newContext(bean);
String result = (String) jxcontext.getValue(expression);
if (log.isDebugEnabled()) {
Copied: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java (from rev 1019, lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationtreeSelectionAdapterWithCardLayout.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java 2008-12-01 14:56:55 UTC (rev 1044)
@@ -0,0 +1,106 @@
+package jaxx.runtime.swing.navigation;
+
+import jaxx.runtime.JAXXAction;
+import jaxx.runtime.JAXXContext;
+import jaxx.runtime.JAXXInitialContext;
+import jaxx.runtime.JAXXObject;
+import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
+import jaxx.runtime.swing.CardLayout2;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JPanel;
+import javax.swing.event.TreeSelectionEvent;
+import java.awt.Component;
+
+/**
+ * Simple {@link NavigationTreeSelectionAdapter} implementation with a {@link jaxx.runtime.swing.CardLayout2} to manage components to
+ * associated with tree's nodes.
+ * <p/>
+ * For each node, the ui associated has a constraints in a cardlayout which is the node context path.
+ * <p/>
+ * A single container managed by the cardlayout is used to display the components associated with tree's nodes.
+ *
+ * @author chemit
+ */
+public abstract class NavigationTreeSelectionAdapterWithCardLayout extends NavigationTreeSelectionAdapter {
+
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private final Log log = LogFactory.getLog(NavigationTreeSelectionAdapterWithCardLayout.class);
+
+ /**
+ * All components associated with a tree's node is displayed in a single container.
+ *
+ * @return the containter of components
+ */
+ protected abstract JPanel getContentContainer();
+
+ /**
+ * the cardlayout managing components associated with tree node. The constraints
+ * of each component is the node contextPath.
+ *
+ * @return the layout used to display components associated with tree's nodes.
+ */
+ protected abstract CardLayout2 getContentLayout();
+
+ public NavigationTreeSelectionAdapterWithCardLayout(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context) {
+ super(defaultUIClass, defaultUIHandlerClass, context);
+
+ if (getContentContainer() == null) {
+ throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context);
+ }
+ if (getContentLayout() == null) {
+ throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context);
+ }
+ }
+
+ protected Component getCurrentUI() {
+ CardLayout2 layout = getContentLayout();
+ JPanel container = getContentContainer();
+ return layout.getVisibleComponent(container);
+ }
+
+ protected Component getNewUI(String path) {
+ CardLayout2 layout = getContentLayout();
+ JPanel container = getContentContainer();
+ return layout.contains(path) ? layout.getComponent(container, path) : null;
+ }
+
+ protected void openUI(Component newUI, NavigationTreeNode node) throws Exception {
+ CardLayout2 layout = getContentLayout();
+ JPanel container = getContentContainer();
+ // switch layout
+ layout.show(container, node.getContextPath());
+ }
+
+ protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception {
+ // by default, we says that component was succesfull closed
+ return true;
+ }
+
+ protected Component createUI(NavigationTreeNode node) throws Exception {
+ JAXXObject newUI;
+
+ if (node.getJaxxActionClass() != null) {
+ JAXXAction action = node.getJaxxActionClass().newInstance();
+ // init context with
+ JAXXInitialContext context = action.init(this.context);
+ // must instanciate the ui with an JAXXInitialContext
+ newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(context);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("no action associated with ui " + node.getJaxxClass());
+ }
+ // no action associated, just
+ newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(this.context);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("instanciate new ui " + newUI);
+ }
+
+ getContentContainer().add((Component) newUI, node.getContextPath());
+ return (Component) newUI;
+ }
+}
+
Deleted: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationtreeSelectionAdapterWithCardLayout.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationtreeSelectionAdapterWithCardLayout.java 2008-12-01 08:10:22 UTC (rev 1043)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/swing/navigation/NavigationtreeSelectionAdapterWithCardLayout.java 2008-12-01 14:56:55 UTC (rev 1044)
@@ -1,106 +0,0 @@
-package jaxx.runtime.swing.navigation;
-
-import jaxx.runtime.JAXXAction;
-import jaxx.runtime.JAXXContext;
-import jaxx.runtime.JAXXInitialContext;
-import jaxx.runtime.JAXXObject;
-import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode;
-import jaxx.runtime.swing.CardLayout2;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.swing.JPanel;
-import javax.swing.event.TreeSelectionEvent;
-import java.awt.Component;
-
-/**
- * Simple {@link NavigationTreeSelectionAdapter} implementation with a {@link jaxx.runtime.swing.CardLayout2} to manage components to
- * associated with tree's nodes.
- * <p/>
- * For each node, the ui associated has a constraints in a cardlayout which is the node context path.
- * <p/>
- * A single container managed by the cardlayout is used to display the components associated with tree's nodes.
- *
- * @author chemit
- */
-public abstract class NavigationtreeSelectionAdapterWithCardLayout extends NavigationTreeSelectionAdapter {
-
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private final Log log = LogFactory.getLog(NavigationtreeSelectionAdapterWithCardLayout.class);
-
- /**
- * All components associated with a tree's node is displayed in a single container.
- *
- * @return the containter of components
- */
- protected abstract JPanel getContentContainer();
-
- /**
- * the cardlayout managing components associated with tree node. The constraints
- * of each component is the node contextPath.
- *
- * @return the layout used to display components associated with tree's nodes.
- */
- protected abstract CardLayout2 getContentLayout();
-
- public NavigationtreeSelectionAdapterWithCardLayout(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context) {
- super(defaultUIClass, defaultUIHandlerClass, context);
-
- if (getContentContainer() == null) {
- throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context);
- }
- if (getContentLayout() == null) {
- throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context);
- }
- }
-
- protected Component getCurrentUI() {
- CardLayout2 layout = getContentLayout();
- JPanel container = getContentContainer();
- return layout.getVisibleComponent(container);
- }
-
- protected Component getNewUI(String path) {
- CardLayout2 layout = getContentLayout();
- JPanel container = getContentContainer();
- return layout.contains(path) ? layout.getComponent(container, path) : null;
- }
-
- protected void openUI(Component newUI, NavigationTreeNode node) throws Exception {
- CardLayout2 layout = getContentLayout();
- JPanel container = getContentContainer();
- // switch layout
- layout.show(container, node.getContextPath());
- }
-
- protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception {
- // by default, we says that component was succesfull closed
- return true;
- }
-
- protected Component createUI(NavigationTreeNode node) throws Exception {
- JAXXObject newUI;
-
- if (node.getJaxxActionClass() != null) {
- JAXXAction action = node.getJaxxActionClass().newInstance();
- // init context with
- JAXXInitialContext context = action.init(this.context);
- // must instanciate the ui with an JAXXInitialContext
- newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(context);
- } else {
- if (log.isWarnEnabled()) {
- log.warn("no action associated with ui " + node.getJaxxClass());
- }
- // no action associated, just
- newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(this.context);
- }
- if (log.isDebugEnabled()) {
- log.debug("instanciate new ui " + newUI);
- }
-
- getContentContainer().add((Component) newUI, node.getContextPath());
- return (Component) newUI;
- }
-}
-
Modified: lutinjaxx/trunk/jaxx-core/src/site/fr/rst/NavigationTreeModel.rst
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/site/fr/rst/NavigationTreeModel.rst 2008-12-01 08:10:22 UTC (rev 1043)
+++ lutinjaxx/trunk/jaxx-core/src/site/fr/rst/NavigationTreeModel.rst 2008-12-01 14:56:55 UTC (rev 1044)
@@ -148,7 +148,7 @@
Si une erreur survient lors de ces opérations, on entre dans la méthode *goBackToPreviousNode* qui est abstraite et permet de notifier les erreur de retourner au noeud précdent.
-jaxx.runtime.swing.navigation.NavigationtreeSelectionAdapterWithCardLayout
+jaxx.runtime.swing.navigation.NavigationTreeSelectionAdapterWithCardLayout
**************************************************************************
Il s'agit d'une implantation du listener précédent qui suppose que les uis associées aux noeuds sont affichées dans un
Modified: lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 08:10:22 UTC (rev 1043)
+++ lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/runtime/JXPathDecoratorTest.java 2008-12-01 14:56:55 UTC (rev 1044)
@@ -35,13 +35,12 @@
@Test
public void testDecorator() throws Exception {
- //fixme : make me works :)
-
- //Decorator<Model> decorator = new JXPathDecorator<Model>("./name (./integerValue");
+ //fixme : make me work :)
+ Decorator<Model> decorator = new JXPathDecorator<Model>(Model.class,"${name} - ${integerValue}");
- //Model m = new Model("name", 10);
- //String expected = m.getName() + " (" + m.getIntegervalue() + ")";
- //String result = decorator.toString(m);
+ Model m = new Model("name", 10);
+// String expected = m.getName() + " - " + m.getIntegervalue();
+// String result = decorator.toString(m);
//org.junit.Assert.assertEquals(expected, result);
}
Modified: lutinjaxx/trunk/pom.xml
===================================================================
--- lutinjaxx/trunk/pom.xml 2008-12-01 08:10:22 UTC (rev 1043)
+++ lutinjaxx/trunk/pom.xml 2008-12-01 14:56:55 UTC (rev 1044)
@@ -58,17 +58,17 @@
<!-- override this property to define scm url property -->
<scm.url.son>
- http://${labs.host}/plugins/scmsvn/viewcvs.php/lutinjaxx/trunk/${pom.artifactId}/?root=${labs.project}
+ http://${labs.host}/plugins/scmsvn/viewcvs.php/lutinjaxx/trunk/${project.artifactId}/?root=${labs.project}
</scm.url.son>
<!-- BEWARE, will be suffixed by /${pom.artifactId} by inheritance -->
<scm.developerConnection.son>
- scm:svn:svn+ssh://${username}@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/${pom.artifactId}
+ scm:svn:svn+ssh://${username}@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/${project.artifactId}
</scm.developerConnection.son>
<!-- BEWARE, will be suffixed by /${pom.artifactId} by inheritance -->
<scm.connection.son>
- scm:svn:svn://anonymous@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/${pom.artifactId}
+ scm:svn:svn://anonymous@${labs.host}/svnroot/${labs.project}/lutinjaxx/trunk/${project.artifactId}
</scm.connection.son>
</properties>
1
0
[Buix-commits] r1043 - lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator
by chemit@users.labs.libre-entreprise.org 01 Dec '08
by chemit@users.labs.libre-entreprise.org 01 Dec '08
01 Dec '08
Author: chemit
Date: 2008-12-01 08:10:22 +0000 (Mon, 01 Dec 2008)
New Revision: 1043
Added:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableRenderer.java
Removed:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java
Log:
rename ErrorTableRenderer
Deleted: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java 2008-12-01 02:50:26 UTC (rev 1042)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java 2008-12-01 08:10:22 UTC (rev 1043)
@@ -1,59 +0,0 @@
-package jaxx.runtime.validator;
-
-import jaxx.runtime.swing.Utils;
-import jaxx.runtime.validator.BeanValidator.Scope;
-import static org.codelutin.i18n.I18n._;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.Component;
-
-/** @author chemit */
-public class BeanValidationTableRenderer extends DefaultTableCellRenderer {
-
- ImageIcon errorIcon;
- ImageIcon warningIcon;
-
- public BeanValidationTableRenderer() {
- errorIcon = Utils.createImageIcon("error.png");
- warningIcon = Utils.createImageIcon("warning.png");
- }
-
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- JLabel rendererComponent = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-
- ImageIcon icon = null;
- String text = null;
- if (value instanceof Scope) {
-
- Scope scope = (Scope) value;
- switch (scope) {
- case ERROR:
- icon = errorIcon;
- break;
- case WARNING:
- icon = warningIcon;
- break;
- }
- //todo fix size of scope column
- /*rendererComponent.setSize(16,rendererComponent.getHeight());
- rendererComponent.setMaximumSize(new Dimension(16,rendererComponent.getHeight()));
- rendererComponent.setPreferredSize(new Dimension(16,rendererComponent.getHeight()));*/
- } else if (value instanceof BeanValidatorError) {
- text = _(((BeanValidatorError) value).getError());
- } else {
- // keep text rendered
- text = rendererComponent.getText();
- }
- rendererComponent.setText(text);
- rendererComponent.setIcon(icon);
- return rendererComponent;
- }
-
- @Override
- protected void setValue(Object value) {
- super.setValue(value);
- }
-}
Copied: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableRenderer.java (from rev 1042, lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableRenderer.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableRenderer.java 2008-12-01 08:10:22 UTC (rev 1043)
@@ -0,0 +1,55 @@
+package jaxx.runtime.validator;
+
+import jaxx.runtime.swing.Utils;
+import jaxx.runtime.validator.BeanValidator.Scope;
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+
+/** @author chemit */
+public class ErrorTableRenderer extends DefaultTableCellRenderer {
+
+ ImageIcon errorIcon;
+ ImageIcon warningIcon;
+
+ public ErrorTableRenderer() {
+ errorIcon = Utils.createImageIcon("error.png");
+ warningIcon = Utils.createImageIcon("warning.png");
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ JLabel rendererComponent = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+
+ ImageIcon icon = null;
+ String text = null;
+ if (value instanceof Scope) {
+
+ Scope scope = (Scope) value;
+ switch (scope) {
+ case ERROR:
+ icon = errorIcon;
+ break;
+ case WARNING:
+ icon = warningIcon;
+ break;
+ }
+ } else if (value instanceof BeanValidatorError) {
+ text = _(((BeanValidatorError) value).getError());
+ } else {
+ // keep text rendered
+ text = rendererComponent.getText();
+ }
+ rendererComponent.setText(text);
+ rendererComponent.setIcon(icon);
+ return rendererComponent;
+ }
+
+ @Override
+ protected void setValue(Object value) {
+ super.setValue(value);
+ }
+}
1
0
[Buix-commits] r1042 - in lutinjaxx/trunk: jaxx-core jaxx-core/src/main/java/jaxx jaxx-core/src/main/java/jaxx/runtime jaxx-core/src/main/java/jaxx/runtime/validator jaxx-core/src/main/java/jaxx/tags/validator jaxx-core/src/main/java/jaxx/types jaxx-core/src/main/resources jaxx-core/src/main/resources/icons jaxx-core/src/test/java/jaxx/junit maven-jaxx-plugin/src/test/resources/testcases/validator/ok
by chemit@users.labs.libre-entreprise.org 01 Dec '08
by chemit@users.labs.libre-entreprise.org 01 Dec '08
01 Dec '08
Author: chemit
Date: 2008-12-01 02:50:26 +0000 (Mon, 01 Dec 2008)
New Revision: 1042
Added:
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableMouseListener.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/BeanValidatorScopeConverter.java
lutinjaxx/trunk/jaxx-core/src/main/resources/icons/
lutinjaxx/trunk/jaxx-core/src/main/resources/icons/error.png
lutinjaxx/trunk/jaxx-core/src/main/resources/icons/warning.png
lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/BeanValidatorScopeConverterTest.java
Modified:
lutinjaxx/trunk/jaxx-core/changelog
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/DefaultInitializer.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorError.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorListModel.java
lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java
lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/Validation.jaxx
lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/ValidationBeanClass.jaxx
Log:
introduce scope in BeanValidator (ERROR or WARNING)
Modified: lutinjaxx/trunk/jaxx-core/changelog
===================================================================
--- lutinjaxx/trunk/jaxx-core/changelog 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/changelog 2008-12-01 02:50:26 UTC (rev 1042)
@@ -1,4 +1,8 @@
- 0.6 chemit 200811??
+ 0.7 chemit
+ * 20081201 [chemit] introduce scope in BeanValidator (ERROR or WARNING)
+ * 20081201 [chemit] only enter once in $initialize method in generated code
+
+ 0.6 chemit 200811
* 20081118 [chemit] introduce NavigationUtil, save in context selected node
* 20081107 [chemit] improve data binding and code generation :
- make possible inheritance in binding
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/DefaultInitializer.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/DefaultInitializer.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/DefaultInitializer.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -17,6 +17,8 @@
import jaxx.types.InsetsConverter;
import jaxx.types.PrimitiveConverter;
import jaxx.types.TypeManager;
+import jaxx.types.BeanValidatorScopeConverter;
+import jaxx.runtime.validator.BeanValidator.Scope;
import java.awt.Color;
import java.awt.Component;
@@ -55,5 +57,7 @@
TypeManager.registerTypeConverter(Color.class, new ColorConverter());
TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter());
TypeManager.registerTypeConverter(Insets.class, new InsetsConverter());
+
+ TypeManager.registerTypeConverter(Scope.class, new BeanValidatorScopeConverter());
}
}
\ No newline at end of file
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/Util.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -2,12 +2,14 @@
import jaxx.runtime.validator.BeanValidator;
import jaxx.runtime.validator.ErrorListMouseListener;
+import jaxx.runtime.validator.ErrorTableMouseListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.jxlayer.JXLayer;
import javax.swing.JComponent;
import javax.swing.JList;
+import javax.swing.JTable;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
@@ -397,6 +399,20 @@
list.addMouseListener(new ErrorListMouseListener());
}
+ public static void registerErrorTableMouseListener(JTable table) {
+ if (table == null) {
+ return;
+ }
+ for (MouseListener listener : table.getMouseListeners()) {
+ if (listener instanceof ErrorTableMouseListener) {
+ // already have a such listener
+ log.info("already registered a such MouseListener : " + listener);
+ return;
+ }
+ }
+ table.addMouseListener(new ErrorTableMouseListener());
+ }
+
/**
* Compute the string representation of an object.
* <p/>
Added: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidationTableRenderer.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -0,0 +1,59 @@
+package jaxx.runtime.validator;
+
+import jaxx.runtime.swing.Utils;
+import jaxx.runtime.validator.BeanValidator.Scope;
+import static org.codelutin.i18n.I18n._;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+
+/** @author chemit */
+public class BeanValidationTableRenderer extends DefaultTableCellRenderer {
+
+ ImageIcon errorIcon;
+ ImageIcon warningIcon;
+
+ public BeanValidationTableRenderer() {
+ errorIcon = Utils.createImageIcon("error.png");
+ warningIcon = Utils.createImageIcon("warning.png");
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ JLabel rendererComponent = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+
+ ImageIcon icon = null;
+ String text = null;
+ if (value instanceof Scope) {
+
+ Scope scope = (Scope) value;
+ switch (scope) {
+ case ERROR:
+ icon = errorIcon;
+ break;
+ case WARNING:
+ icon = warningIcon;
+ break;
+ }
+ //todo fix size of scope column
+ /*rendererComponent.setSize(16,rendererComponent.getHeight());
+ rendererComponent.setMaximumSize(new Dimension(16,rendererComponent.getHeight()));
+ rendererComponent.setPreferredSize(new Dimension(16,rendererComponent.getHeight()));*/
+ } else if (value instanceof BeanValidatorError) {
+ text = _(((BeanValidatorError) value).getError());
+ } else {
+ // keep text rendered
+ text = rendererComponent.getText();
+ }
+ rendererComponent.setText(text);
+ rendererComponent.setIcon(icon);
+ return rendererComponent;
+ }
+
+ @Override
+ protected void setValue(Object value) {
+ super.setValue(value);
+ }
+}
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidator.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -135,6 +135,17 @@
*/
public class BeanValidator<T> {
+ /**
+ * Pour definir le niveau de validation.
+ * <p/>
+ * Par défaut, le validateur est supposé géré des erreurs, mais on peut aussi l'utiliser
+ * pour consigner des warnings sur le bean surveiller.
+ */
+ public enum Scope {
+ ERROR,
+ WARNING
+ }
+
static public final String BEAN_PROERTY = "bean";
private static final String CONTEXT_NAME_PROPERTY = "contextName";
@@ -176,6 +187,9 @@
/** Object servant a contenir la liste des erreurs */
protected BeanValidatorErrorListModel errorListModel;
+ /** Object servant a contenir la liste des erreurs */
+ protected BeanValidatorErrorTableModel errorTableModel;
+
/** ui renderer class */
protected Class<? extends AbstractBeanValidatorUI> uiClass;
@@ -188,6 +202,7 @@
/** the validation named context */
protected String contextName;
+ protected Scope scope = Scope.ERROR;
public BeanValidator() {
pcs = new PropertyChangeSupport(this);
@@ -197,18 +212,6 @@
conversionErrors = new TreeMap<String, String>();
l = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- // only validate if the property has really changed...
- /*Object oldValue = evt.getOldValue();
- Object newValue = evt.getNewValue();
- if (oldValue == null && newValue == null) {
- return;
- }
- if ((oldValue != null && oldValue.equals(newValue)) || (newValue != null && newValue.equals(oldValue))) {
- return;
- }
- if (log.isDebugEnabled()) {
- log.debug("launch validation from event [name:" + evt.getPropertyName() + " <old:" + oldValue + ", new:" + newValue + ">]");
- }*/
validate();
setValid(!hasErrors());
setChanged(true);
@@ -236,10 +239,18 @@
return errorListModel;
}
+ public BeanValidatorErrorTableModel getErrorTableModel() {
+ return errorTableModel;
+ }
+
public JComponent getFieldRepresentation(String fieldname) {
return fieldRepresentation.get(fieldname);
}
+ public Scope getScope() {
+ return scope;
+ }
+
/**
* Retourne vrai si l'objet bean a ete modifie depuis le dernier
* {@link #setBean}
@@ -286,6 +297,14 @@
}
}
+ public void setErrorTableModel(BeanValidatorErrorTableModel errorTableModel) {
+ this.errorTableModel = errorTableModel;
+ if (errorTableModel != null) {
+ // register the validator in the model table
+ errorTableModel.registerValidator(this);
+ }
+ }
+
/**
* Permet d'indiquer le composant graphique responsable de l'affichage
* d'un attribut du bean
@@ -351,7 +370,7 @@
} else {
// must remove all errors from this validator on errorListModel
validationSupport.clearErrorsAndMessages();
- errorListModel.addErrors(this);
+ addErrors();
}
setValid(!hasErrors());
setChanged(false);
@@ -368,10 +387,14 @@
this.uiClass = uiClass;
}
+ public void setScope(Scope scope) {
+ this.scope = scope;
+ }
+
/** @return <code>true</code> if errors are detected, <code>false</code> otherwise */
public boolean hasErrors() {
//todo should also detecte actionErrors ?
- return validationContext.hasFieldErrors() || !conversionErrors.isEmpty();
+ return scope == Scope.ERROR && (validationContext.hasFieldErrors() || !conversionErrors.isEmpty());
//return validationContext.hasFieldErrors() || validationContext.hasActionErrors();
}
@@ -479,7 +502,7 @@
log.debug(this + " : " + validationContext.getFieldErrors());
}
// add errors
- errorListModel.addErrors(this);
+ addErrors();
for (String fieldname : fieldRepresentation.keySet()) {
JComponent c = fieldRepresentation.get(fieldname);
@@ -493,9 +516,9 @@
}
}
- /** @return <code>true</code> if validation is active, <code>false</code> otherwise. */
+ /** @return <code>true</code> if validation is not active , <code>false</code> otherwise. */
protected boolean checkState() {
- return bean == null || getErrorListModel() == null || fieldRepresentation.size() == 0;
+ return bean == null || (getErrorListModel() == null && getErrorTableModel() == null) || fieldRepresentation.size() == 0;
}
protected ActionValidatorManager getValidator() {
@@ -565,4 +588,13 @@
validationContext.setFieldErrors(map);
}
+ protected void addErrors() {
+ if (errorListModel != null) {
+ errorListModel.addErrors(this);
+ }
+ if (errorTableModel != null) {
+ errorTableModel.addErrors(this);
+ }
+ }
+
}
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorError.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorError.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorError.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -4,6 +4,8 @@
import javax.swing.JComponent;
+import jaxx.runtime.validator.BeanValidator.Scope;
+
/**
* The model of an error.
*
@@ -51,6 +53,10 @@
this.component = component;
}
+ public Scope getScope() {
+ return validator.getScope();
+ }
+
@Override
public String toString() {
return component.getName() + " : " + I18n._(error);
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorListModel.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorListModel.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorListModel.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -20,7 +20,7 @@
/** list of registred validators */
protected transient List<BeanValidator<?>> validators;
- /** comporatorof errors */
+ /** comporator of errors */
protected transient Comparator<BeanValidatorError> comparator;
public BeanValidatorErrorListModel() {
@@ -128,7 +128,7 @@
protected Comparator<BeanValidatorError> getComparator() {
if (comparator == null) {
comparator = new Comparator<BeanValidatorError>() {
- public int compare(BeanValidatorError o1, BeanValidatorError o2) {
+ public int compare(BeanValidatorError o1, BeanValidatorError o2) {
return o1.toString().compareTo(o2.toString());
}
};
Copied: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java (from rev 1003, lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorListModel.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -0,0 +1,164 @@
+package jaxx.runtime.validator;
+
+import jaxx.runtime.validator.BeanValidator.Scope;
+
+import javax.swing.JComponent;
+import javax.swing.table.DefaultTableModel;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * The model of the list of errors
+ *
+ * @author chemit
+ */
+public class BeanValidatorErrorTableModel extends DefaultTableModel {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String[] columnNames = {"validator.scope", "validator.field", "validator.message"};
+
+ /** list of registred validators */
+ protected transient List<BeanValidator<?>> validators;
+
+ /** comporator of errors */
+ protected transient Comparator<BeanValidatorError> comparator;
+
+ public BeanValidatorErrorTableModel() {
+ super(columnNames, 0);
+ validators = new ArrayList<BeanValidator<?>>();
+ }
+
+ public int getErrorColumn() {
+ return findColumn(BeanValidatorErrorTableModel.columnNames[2]);
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int column) {
+ // cells are never editable in this model
+ return false;
+ }
+
+ public void registerValidator(BeanValidator<?> validator) {
+ if (validators.contains(validator)) {
+ throw new IllegalArgumentException("the validator " + validator + " is already registred in " + this);
+ }
+ validators.add(validator);
+ }
+
+ public <T> void addErrors(BeanValidator<T> validator) {
+ if (!validators.contains(validator)) {
+ throw new IllegalArgumentException("the validator " + validator + " is not registred in " + this);
+ }
+
+ // new errors for the given validator
+ List<BeanValidatorError> newErrors = new ArrayList<BeanValidatorError>();
+ // old errors for the given validator
+ List<BeanValidatorError> oldErrors = new ArrayList<BeanValidatorError>();
+ // old errors for other validators
+ List<BeanValidatorError> oldOtherErrors = new ArrayList<BeanValidatorError>();
+
+ // split old errors from other validators
+ splitOldErrors(validator, oldErrors, oldOtherErrors);
+
+ // fill new errors
+ fillNewErrors(validator, newErrors);
+
+ // check if something has changed for the given validator
+ if (hasChanged(oldErrors, newErrors)) {
+
+ // reinject other errors
+ newErrors.addAll(oldOtherErrors);
+
+ // sort errors
+ Collections.sort(newErrors, getComparator());
+
+ // clean errors in model
+ getDataVector().clear();
+ Scope scope = validator.getScope();
+ // reinject in list model, all the errors
+ for (BeanValidatorError error : newErrors) {
+ addRow(new Object[]{scope, error.getFieldName(), error});
+ }
+
+ // notify thaht the model has changed
+ fireTableDataChanged();
+ }
+ }
+
+ protected boolean hasChanged(List<BeanValidatorError> oldErrors, List<BeanValidatorError> newErrors) {
+ if (oldErrors.size() != newErrors.size()) {
+ return true;
+ }
+ for (BeanValidatorError oldError : oldErrors) {
+ if (!newErrors.contains(oldError)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected <T> void fillNewErrors(BeanValidator<T> validator, List<BeanValidatorError> newErrors) {
+ if (validator.hasErrors()) {
+ // inject this validator errors
+ for (Object o : validator.getFieldErrors().entrySet()) {
+ Map.Entry<?, ?> r = (Map.Entry<?, ?>) o;
+ BeanValidatorError<T> error;
+ String field = (String) r.getKey();
+ JComponent component = validator.getFieldRepresentation(field);
+ if (component != null) {
+ for (Object errorString : (List<?>) r.getValue()) {
+ String error1 = (String) errorString;
+ error = new BeanValidatorError<T>();
+ error.setComponent(component);
+ error.setValidator(validator);
+ error.setError(error1);
+ error.setFieldName(field);
+ newErrors.add(error);
+ }
+ }
+ }
+ //todo should also do actionErrors
+ }
+ }
+
+ protected <T> void splitOldErrors(BeanValidator<T> validator, List<BeanValidatorError> oldErrors, List<BeanValidatorError> oldOtherErrors) {
+
+ int col = getErrorColumn();
+ for (Object o : super.getDataVector()) {
+ Vector row = (Vector) o;
+ BeanValidatorError<?> error = (BeanValidatorError<?>) row.get(col);
+ if (!error.getValidator().equals(validator)) {
+ // error from another validator, keep it
+ oldOtherErrors.add(error);
+ } else {
+ oldErrors.add(error);
+ }
+ }
+ }
+
+ protected Comparator<BeanValidatorError> getComparator() {
+ if (comparator == null) {
+ comparator = new Comparator<BeanValidatorError>() {
+ public int compare(BeanValidatorError o1, BeanValidatorError o2) {
+ // first sort on scope
+ int scope = o1.getScope().ordinal() - o2.getScope().ordinal();
+ if (scope != 0) {
+ return scope;
+ }
+ int field = o1.getFieldName().compareTo(o2.getFieldName());
+ if (field != 0) {
+ return field;
+ }
+ return o1.getError().compareTo(o2.getError());
+ }
+ };
+ }
+ return comparator;
+ }
+
+}
\ No newline at end of file
Property changes on: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/BeanValidatorErrorTableModel.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableMouseListener.java (from rev 1017, lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorListMouseListener.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableMouseListener.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableMouseListener.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -0,0 +1,62 @@
+package jaxx.runtime.validator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+/**
+ * A mouse listener to put on a {@link javax.swing.JList} with a {@link jaxx.runtime.validator.BeanValidatorErrorListModel} as a model.
+ * <p/>
+ * When a double click occurs, find the selected error in model and then focus to the associated component of error.
+ *
+ * @author chemit
+ */
+public class ErrorTableMouseListener extends MouseAdapter {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(ErrorTableMouseListener.class);
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ super.mouseClicked(e);
+ if (e.getClickCount() == 2) {
+
+ BeanValidatorError<?> entry = getSelectedError(e);
+ if (entry == null) {
+ // no entry found
+ return;
+ }
+ JComponent component = entry.getComponent();
+ if (component != null) {
+ component.requestFocus();
+ }
+ }
+ }
+
+
+ protected BeanValidatorError<?> getSelectedError(MouseEvent e) {
+ JTable table = (JTable) e.getSource();
+ if (!(table.getModel() instanceof BeanValidatorErrorTableModel)) {
+ log.warn("model must be a " + BeanValidatorErrorTableModel.class + ", but was " + table.getModel());
+ return null;
+ }
+
+ BeanValidatorErrorTableModel model = (BeanValidatorErrorTableModel) table.getModel();
+ int index = table.getSelectionModel().getMinSelectionIndex();
+ if (index == -1) {
+ // nothing is selected
+ return null;
+ }
+ int col = model.getErrorColumn();
+ BeanValidatorError<?> entry = (BeanValidatorError) model.getValueAt(index, col);
+ if (log.isDebugEnabled()) {
+ log.debug("selected index: " + index + " : error: " + entry);
+ }
+ return entry;
+ }
+
+}
\ No newline at end of file
Property changes on: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/runtime/validator/ErrorTableMouseListener.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -13,6 +13,7 @@
import jaxx.reflect.ClassDescriptorLoader;
import jaxx.runtime.Util;
import jaxx.runtime.validator.BeanValidator;
+import jaxx.runtime.validator.BeanValidator.Scope;
import jaxx.runtime.validator.ui.AbstractBeanValidatorUI;
import jaxx.tags.DefaultObjectHandler;
import jaxx.types.TypeManager;
@@ -34,9 +35,15 @@
public static final String BEAN_INITIALIZER_ATTRIBUTE = "beanInitializer";
public static final String ERROR_LIST_MODEL_ATTRIBUTE = "errorListModel";
+ public static final String ERROR_TABLE_MODEL_ATTRIBUTE = "errorTableModel";
public static final String ERROR_LIST_ATTRIBUTE = "errorList";
+ public static final String ERROR_TABLE_ATTRIBUTE = "errorTable";
+
public static final String ERROR_LIST_MODEL_DEFAULT = "errors";
+ public static final String ERROR_TABLE_MODEL_DEFAULT = "errors2";
+
public static final String ERROR_LIST_DEFAULT = "errorList";
+ public static final String ERROR_TABLE_DEFAULT = "errorTable";
public static final String AUTOFIELD_ATTRIBUTE = "autoField";
public static final String UI_CLASS_ATTRIBUTE = "uiClass";
@@ -44,6 +51,8 @@
public static final String CONTEXT_NAME_ATTRIBUTE = "contextName";
+ public static final String SCOPE_ATTRIBUTE = "scope";
+
/** to use log facility, just put in your code: log.info(\"...\"); */
static Log log = LogFactory.getLog(BeanValidatorHandler.class);
@@ -83,6 +92,14 @@
}
if (!error) {
+ error = info.addErrorTableModel(tag, this, compiler);
+ }
+
+ if (!error) {
+ error = info.addErrorTable(tag, compiler);
+ }
+
+ if (!error) {
error = info.addUiClass(this, compiler);
}
@@ -94,6 +111,10 @@
error = info.addContextName(this, compiler);
}
+ if (!error) {
+ error = info.addScope(this, compiler);
+ }
+
if (error) {
log.warn("error were detected in second compile pass of CompiledObject [" + info + "]");
}
@@ -128,13 +149,15 @@
protected String bean;
protected String beanClass;
protected String contextName;
- //protected String beanInitializer;
protected String uiClass;
protected String errorListModel;
protected String errorList;
protected Boolean autoField;
protected Boolean strictMode;
protected JAXXBeanInfo beanDescriptor;
+ protected String errorTableModel;
+ protected String errorTable;
+ protected Scope scope;
public CompiledBeanValidator(String id, ClassDescriptor objectClass, JAXXCompiler compiler) {
super(id, objectClass, compiler);
@@ -158,24 +181,20 @@
}
return;
}
+
if (CONTEXT_NAME_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
contextName = value.trim();
}
return;
}
+
if (BEAN_CLASS_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
beanClass = value.trim();
}
return;
}
- /*if (BEAN_INITIALIZER_ATTRIBUTE.equals(property)) {
- if (value != null && !value.trim().isEmpty()) {
- beanInitializer = value;
- }
- return;
- }*/
if (ERROR_LIST_MODEL_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
@@ -183,33 +202,56 @@
}
return;
}
+
if (ERROR_LIST_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
errorList = value.trim();
}
return;
}
+
+ if (ERROR_TABLE_MODEL_ATTRIBUTE.equals(property)) {
+ if (value != null && !value.trim().isEmpty()) {
+ errorTableModel = value.trim();
+ }
+ return;
+ }
+
+ if (ERROR_TABLE_ATTRIBUTE.equals(property)) {
+ if (value != null && !value.trim().isEmpty()) {
+ errorTable = value.trim();
+ }
+ return;
+ }
+
if (UI_CLASS_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
uiClass = value.trim();
}
return;
}
+
if (AUTOFIELD_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
-
autoField = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class);
}
return;
}
+
if (STRICT_MODE_ATTRIBUTE.equals(property)) {
if (value != null && !value.trim().isEmpty()) {
-
strictMode = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class);
}
return;
}
+ if (SCOPE_ATTRIBUTE.equals(property)) {
+ if (value != null && !value.trim().isEmpty()) {
+ scope = (Scope) TypeManager.convertFromString(value.trim(), Scope.class);
+ }
+ return;
+ }
+
throw new CompilerException("property " + property + " is not allowed on object " + this);
//todo should not allowed to find other attributes
@@ -244,6 +286,10 @@
return contextName;
}
+ public Scope getScope() {
+ return scope;
+ }
+
public JAXXBeanInfo getBeanDescriptor(JAXXCompiler compiler) {
if (beanDescriptor == null && foundBean()) {
@@ -324,6 +370,30 @@
}
+ protected boolean addErrorTableModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) {
+ if (errorTableModel == null) {
+ // try with the default "errors"
+ if (!compiler.checkReference(tag, ERROR_TABLE_MODEL_DEFAULT, false, ERROR_LIST_MODEL_ATTRIBUTE)) {
+ return false;
+ }
+ errorTableModel = ERROR_TABLE_MODEL_DEFAULT;
+ } else {
+ if (errorTableModel.startsWith("{") && errorTableModel.endsWith("}")) {
+ // this is a script, no check here
+ errorTableModel = errorTableModel.substring(1, errorTableModel.length() - 1).trim();
+ } else if (!compiler.checkReference(tag, errorTableModel, true, ERROR_TABLE_MODEL_ATTRIBUTE)) {
+ // errorListModel is not defined
+ return true;
+ }
+ }
+
+ String code = handler.getSetPropertyCode(getJavaCode(), ERROR_TABLE_MODEL_ATTRIBUTE, errorTableModel, compiler);
+ appendAdditionCode(code);
+
+ return false;
+
+ }
+
protected boolean addContextName(BeanValidatorHandler handler, JAXXCompiler compiler) {
if (contextName != null) {
String code = handler.getSetPropertyCode(getJavaCode(), CONTEXT_NAME_ATTRIBUTE, TypeManager.getJavaCode(contextName), compiler);
@@ -332,6 +402,14 @@
return false;
}
+ protected boolean addScope(BeanValidatorHandler handler, JAXXCompiler compiler) {
+ if (scope != null) {
+ String code = handler.getSetPropertyCode(getJavaCode(), SCOPE_ATTRIBUTE, TypeManager.getJavaCode(scope), compiler);
+ appendAdditionCode(code);
+ }
+ return false;
+ }
+
protected boolean addErrorList(Element tag, JAXXCompiler compiler) {
if (errorList == null) {
@@ -353,6 +431,27 @@
}
+ protected boolean addErrorTable(Element tag, JAXXCompiler compiler) {
+
+ if (errorTable == null) {
+ // try with the default "errorList"
+ if (!compiler.checkReference(tag, ERROR_TABLE_DEFAULT, false, ERROR_TABLE_ATTRIBUTE)) {
+ return false;
+ }
+ errorTable = ERROR_TABLE_DEFAULT;
+ } else {
+ if (!compiler.checkReference(tag, errorTable, true, ERROR_TABLE_ATTRIBUTE)) {
+ return true;
+ }
+ }
+
+ String code = Util.class.getName() + ".registerErrorTableMouseListener(" + errorTable + ");";
+ appendAdditionCode(code);
+
+ return false;
+
+ }
+
protected boolean addBean(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) {
if (!foundBean()) {
@@ -368,7 +467,7 @@
// just has an intializer
beanInitializer = bean.substring(1, bean.length() - 1);
// this is not a real bean, so delete it
- bean=null;
+ bean = null;
} else {
if (!compiler.checkReference(tag, bean, true, BEAN_ATTRIBUTE)) {
Copied: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/BeanValidatorScopeConverter.java (from rev 1005, lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/InsetsConverter.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/BeanValidatorScopeConverter.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/BeanValidatorScopeConverter.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2006 Ethan Nicholas. All rights reserved.
+ * Use is subject to license terms.
+ */
+package jaxx.types;
+
+import jaxx.runtime.validator.BeanValidator;
+import jaxx.runtime.validator.BeanValidator.Scope;
+
+public class BeanValidatorScopeConverter implements TypeConverter {
+
+ public String getJavaCode(Object object) {
+ Scope type = (Scope) object;
+ return BeanValidator.class.getName() + "." + Scope.class.getSimpleName() + "." + type.name();
+ }
+
+ public Object convertFromString(String string, Class type) {
+ if (type != Scope.class) {
+ throw new IllegalArgumentException("unsupported type: " + type);
+ }
+ try {
+ return Scope.valueOf(string);
+ } catch (IllegalArgumentException e) {
+ // do nothing
+ }
+
+ throw new IllegalArgumentException("unable to convert string '" + string + "' to " + Scope.class);
+ }
+}
\ No newline at end of file
Property changes on: lutinjaxx/trunk/jaxx-core/src/main/java/jaxx/types/BeanValidatorScopeConverter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: lutinjaxx/trunk/jaxx-core/src/main/resources/icons/error.png
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-core/src/main/resources/icons/error.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: lutinjaxx/trunk/jaxx-core/src/main/resources/icons/warning.png
===================================================================
(Binary files differ)
Property changes on: lutinjaxx/trunk/jaxx-core/src/main/resources/icons/warning.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/BeanValidatorScopeConverterTest.java (from rev 1011, lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/InsetsConverterTest.java)
===================================================================
--- lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/BeanValidatorScopeConverterTest.java (rev 0)
+++ lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/BeanValidatorScopeConverterTest.java 2008-12-01 02:50:26 UTC (rev 1042)
@@ -0,0 +1,46 @@
+package jaxx.junit;
+
+import jaxx.runtime.validator.BeanValidator;
+import jaxx.runtime.validator.BeanValidator.Scope;
+import jaxx.types.BeanValidatorScopeConverter;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BeanValidatorScopeConverterTest {
+
+ BeanValidatorScopeConverter converter;
+ Scope value;
+ String strValue;
+
+ @Before
+ public void before() {
+ converter = new BeanValidatorScopeConverter();
+ }
+
+ @Test
+ public void testConvertFromString() {
+ value = (Scope) converter.convertFromString("ERROR", Scope.class);
+ Assert.assertEquals(value, Scope.ERROR);
+
+ value = (Scope) converter.convertFromString("WARNING", Scope.class);
+ Assert.assertEquals(value, Scope.WARNING);
+ }
+
+ @Test
+ public void testGetJavaCode() {
+ value = Scope.ERROR;
+ strValue = converter.getJavaCode(value);
+ Assert.assertEquals(BeanValidator.class.getName() + "." + Scope.class.getSimpleName() + "." + value.name(), strValue);
+
+ value = Scope.WARNING;
+ strValue = converter.getJavaCode(value);
+ Assert.assertEquals(BeanValidator.class.getName() + "." + Scope.class.getSimpleName() + "." + value.name(), strValue);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testConvertFromStringError() {
+ converter.convertFromString("FAKE", Scope.class);
+ }
+
+}
\ No newline at end of file
Property changes on: lutinjaxx/trunk/jaxx-core/src/test/java/jaxx/junit/BeanValidatorScopeConverterTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/Validation.jaxx
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/Validation.jaxx 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/Validation.jaxx 2008-12-01 02:50:26 UTC (rev 1042)
@@ -6,20 +6,24 @@
<Identity id='identity'/>
<!-- errors model -->
- <jaxx.runtime.validator.BeanValidatorErrorListModel id='errors' onContentsChanged='ok.setEnabled(errors.size()==0)'/>
+ <jaxx.runtime.validator.BeanValidatorErrorListModel id='errors'
+ onContentsChanged='ok.setEnabled(errors.size()==0)'/>
<!-- validators -->
- <BeanValidator id='validator' bean='model' errorListModel='errors'>
+ <BeanValidator id='validator' bean='model' errorListModel='errors' scope='ERROR'>
<field name="text"/>
<field name="text2"/>
<field name="ratio"/>
</BeanValidator>
- <BeanValidator id='validator2' bean='model2' errorListModel='errors' uiClass="jaxx.runtime.validator.ui.IconValidationUI">
+ <BeanValidator id='validator2' bean='model2' errorListModel='errors'
+ uiClass="jaxx.runtime.validator.ui.IconValidationUI" scope="WARNING">
<field name="text" component="_text"/>
<field name="text2" component="_text2"/>
<field name="ratio" component="_ratio"/>
</BeanValidator>
- <BeanValidator id='validator3' autoField='true' bean='identity' errorListModel='errors' uiClass="jaxx.runtime.validator.ui.TranslucentValidationUI">
+ <BeanValidator id='validator3' autoField='true' bean='identity' errorListModel='errors'
+ uiClass="jaxx.runtime.validator.ui.TranslucentValidationUI"
+ scope='ERROR'>
<field name="email" component="email2"/>
</BeanValidator>
@@ -34,8 +38,8 @@
<JLabel text='Text:'/>
</cell>
<cell weightx='1'>
- <JTextField id='text' text='{model.getText()}'
- onKeyReleased='model.setText(text.getText())'/>
+ <JTextField id='text' text='{model.getText()}'
+ onKeyReleased='model.setText(text.getText())'/>
</cell>
</row>
<row>
@@ -43,8 +47,8 @@
<JLabel text='Text2:'/>
</cell>
<cell weightx='1'>
- <JTextField id='text2' text='{model.getText2()}'
- onKeyReleased='model.setText2(text2.getText())'/>
+ <JTextField id='text2' text='{model.getText2()}'
+ onKeyReleased='model.setText2(text2.getText())'/>
</cell>
</row>
@@ -53,8 +57,8 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}'
- onStateChanged='model.setRatio(ratio.getValue())'/>
+ <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}'
+ onStateChanged='model.setRatio(ratio.getValue())'/>
</cell>
</row>
</Table>
@@ -62,8 +66,8 @@
</cell>
<cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
<JPanel border='{BorderFactory.createTitledBorder("Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
+ layout='{new GridLayout()}' width='250' height='120'>
+ <Table anchor='west' fill='both'>
<row>
<cell>
<JLabel text='Text:'/>
@@ -89,7 +93,7 @@
<JLabel text='{model.getRatio()}'/>
</cell>
</row>
- </Table>
+ </Table>
</JPanel>
</cell>
</row>
@@ -103,8 +107,8 @@
<JLabel text='Text:'/>
</cell>
<cell weightx='1'>
- <JTextField id='_text' text='{model2.getText()}'
- onKeyReleased='model2.setText(_text.getText())'/>
+ <JTextField id='_text' text='{model2.getText()}'
+ onKeyReleased='model2.setText(_text.getText())'/>
</cell>
</row>
<row>
@@ -112,8 +116,8 @@
<JLabel text='Text2:'/>
</cell>
<cell weightx='1'>
- <JTextField id='_text2' text='{model2.getText2()}'
- onKeyReleased='model2.setText2(_text2.getText())'/>
+ <JTextField id='_text2' text='{model2.getText2()}'
+ onKeyReleased='model2.setText2(_text2.getText())'/>
</cell>
</row>
@@ -122,8 +126,8 @@
<JLabel text='Ratio:'/>
</cell>
<cell>
- <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}'
- onStateChanged='model2.setRatio(_ratio.getValue())'/>
+ <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}'
+ onStateChanged='model2.setRatio(_ratio.getValue())'/>
</cell>
</row>
</Table>
@@ -131,8 +135,8 @@
</cell>
<cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
<JPanel border='{BorderFactory.createTitledBorder("Model2")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
+ layout='{new GridLayout()}' width='250' height='120'>
+ <Table anchor='west' fill='both'>
<row>
<cell>
<JLabel text='Text:'/>
@@ -172,8 +176,8 @@
<JLabel text='FirstName:'/>
</cell>
<cell weightx='1'>
- <JTextField id='firstName' text='{identity.getFirstName()}'
- onKeyReleased='identity.setFirstName(firstName.getText())'/>
+ <JTextField id='firstName' text='{identity.getFirstName()}'
+ onKeyReleased='identity.setFirstName(firstName.getText())'/>
</cell>
</row>
<row>
@@ -181,8 +185,8 @@
<JLabel text='LastName:'/>
</cell>
<cell weightx='1'>
- <JTextField id='lastName' text='{identity.getLastName()}'
- onKeyReleased='identity.setLastName(lastName.getText())'/>
+ <JTextField id='lastName' text='{identity.getLastName()}'
+ onKeyReleased='identity.setLastName(lastName.getText())'/>
</cell>
</row>
<row>
@@ -190,8 +194,8 @@
<JLabel text='Email:'/>
</cell>
<cell weightx='1'>
- <JTextField id='email2' text='{identity.getEmail()}'
- onKeyReleased='identity.setEmail(email2.getText())'/>
+ <JTextField id='email2' text='{identity.getEmail()}'
+ onKeyReleased='identity.setEmail(email2.getText())'/>
</cell>
</row>
@@ -200,8 +204,8 @@
<JLabel text='Age:'/>
</cell>
<cell>
- <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}'
- onStateChanged='identity.setAge(age.getValue())'/>
+ <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}'
+ onStateChanged='identity.setAge(age.getValue())'/>
</cell>
</row>
</Table>
@@ -209,8 +213,8 @@
</cell>
<cell weightx='1' weighty='1' insets='6, 3, 0, 0'>
<JPanel border='{BorderFactory.createTitledBorder("Identity Model")}'
- layout='{new GridLayout()}' width='250' height='120'>
- <Table anchor='west' fill='both'>
+ layout='{new GridLayout()}' width='250' height='120'>
+ <Table anchor='west' fill='both'>
<row>
<cell>
<JLabel text='FirstName:'/>
@@ -227,8 +231,8 @@
<JLabel text='{identity.getLastName()}'/>
</cell>
</row>
- <row>
- <cell>
+ <row>
+ <cell>
<JLabel text='Email:'/>
</cell>
<cell weightx='1'>
@@ -250,7 +254,8 @@
</row>
<row>
<cell columns='2' fill="both">
- <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' width='500'>
+ <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200'
+ width='500'>
<JScrollPane>
<JList model='{errors}'/>
</JScrollPane>
Modified: lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/ValidationBeanClass.jaxx
===================================================================
--- lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/ValidationBeanClass.jaxx 2008-11-30 22:23:22 UTC (rev 1041)
+++ lutinjaxx/trunk/maven-jaxx-plugin/src/test/resources/testcases/validator/ok/ValidationBeanClass.jaxx 2008-12-01 02:50:26 UTC (rev 1042)
@@ -7,7 +7,8 @@
<jaxx.runtime.validator.BeanValidatorErrorListModel id='errors'/>
<!-- validators -->
- <BeanValidator id='validator3' autoField='true' beanClass='testcases.validator.ok.Identity' errorListModel='errors'>
+ <BeanValidator id='validator3' autoField='true' beanClass='testcases.validator.ok.Identity' errorListModel='errors'
+ scope='ERROR'>
<field name="email" component="email2"/>
</BeanValidator>
1
0