r2445 - in trunk/jaxx-demo/src: main/java/jaxx/demo/entities main/java/jaxx/demo/feature/validation main/java/jaxx/demo/feature/validation/list main/java/jaxx/demo/feature/validation/simple main/java/jaxx/demo/tree main/resources main/resources/i18n main/resources/jaxx/demo/entities test/java/jaxx/demo
Author: tchemit Date: 2012-07-27 16:34:57 +0200 (Fri, 27 Jul 2012) New Revision: 2445 Url: http://nuiton.org/repositories/revision/jaxx/2445 Log: refs #2210: Use new validation api from nuiton-utils (add it to demo) Added: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.css trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/PeopleTableModel.java trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByListDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByTableDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/Validation.css trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-error-validation.xml trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-info-validation.xml trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-warning-validation.xml Removed: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Validation.css trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/entities/Identity.java trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties trunk/jaxx-demo/src/main/resources/log4j.properties trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/entities/Identity.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/entities/Identity.java 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/entities/Identity.java 2012-07-27 14:34:57 UTC (rev 2445) @@ -28,9 +28,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.File; +import java.io.Serializable; -public class Identity { +public class Identity implements Serializable { + private static final long serialVersionUID = 1L; + protected String firstName = ""; protected String lastName = ""; Deleted: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Validation.css =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Validation.css 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Validation.css 2012-07-27 14:34:57 UTC (rev 2445) @@ -1,29 +0,0 @@ -/* - * #%L - * JAXX :: Demo - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -JSlider { - paintTicks: true; - minorTickSpacing: 5; - majorTickSpacing: 10; -} Deleted: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx 2012-07-27 14:34:57 UTC (rev 2445) @@ -1,372 +0,0 @@ -<!-- - #%L - JAXX :: Demo - - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> - <style source="Validation.css"/> - - <import> - javax.swing.JOptionPane - static org.nuiton.i18n.I18n.n_ - jaxx.demo.entities.Identity - jaxx.demo.entities.Model - jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer - jaxx.runtime.validator.swing.SwingValidatorMessageListModel - - java.io.File - </import> - - <script><![CDATA[ - -void $afterCompleteSetup() { -} - -@Override -protected String[] getSources() { - return new String[]{ getDefaultSource(), "Validation.css", - "Identity.java", "Identity-error-validation.xml", "Identity-info-validation.xml", "Identity-warning-validation.xml", - "Model.java", "Model-error-validation.xml", "Model-info-validation.xml", "Model-warning-validation.xml" - }; -} -]]> - </script> - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <SwingValidatorMessageListModel id='errorListModel' - onContentsChanged='ok.setEnabled(errorListModel.isEmpty())'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' - uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <Table fill='both' constraints='BorderLayout.CENTER'> - <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='{model1.getText()}' - _validatorLabel='{n_("form.text")}' - onKeyReleased='model1.setText(text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - _validatorLabel='{n_("form.text2")}' - onKeyReleased='model1.setText2(text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.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='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.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()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - 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='180'> - <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> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()+""}' - onKeyReleased='identity.setConfig(new File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()+""}' - onKeyReleased='identity.setDir(new File(dir.getText()))'/> - </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> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()+""}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' - layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane> - <JList id='errorList' model='{errorListModel}' - cellRenderer='{new SwingValidatorMessageListRenderer()}'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</jaxx.demo.DemoPanel> Deleted: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx 2012-07-27 14:34:57 UTC (rev 2445) @@ -1,377 +0,0 @@ -<!-- - #%L - JAXX :: Demo - - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> - <style source="Validation.css"/> - - <import> - javax.swing.JOptionPane - static org.nuiton.i18n.I18n.n_ - jaxx.demo.entities.Identity - jaxx.demo.entities.Model - jaxx.runtime.validator.swing.SwingValidatorUtil - jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer - jaxx.runtime.validator.swing.SwingValidatorMessageTableModel - - java.io.File - </import> - - <script><![CDATA[ -void $afterCompleteSetup() { - SwingValidatorUtil.installUI(errorTable, new SwingValidatorMessageTableRenderer()); -} - -@Override -protected String[] getSources() { - return new String[]{ getDefaultSource(), "Validation.css", - "Identity.java", "Identity-error-validation.xml", "Identity-info-validation.xml", "Identity-warning-validation.xml", - "Model.java", "Model-error-validation.xml", "Model-info-validation.xml", "Model-warning-validation.xml" - }; -} -]]></script> - - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <SwingValidatorMessageTableModel id='errorTableModel' - onTableChanged='ok.setEnabled(errorTableModel.getRowCount()==0)'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' - uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' - uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <Table fill='both' constraints='BorderLayout.CENTER'> - <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='{model1.getText()}' - onKeyReleased='model1.setText(text.getText())' - _validatorLabel='{n_("form.text")}' - /> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - onKeyReleased='model1.setText2(text2.getText())' - _validatorLabel='{n_("form.text2")}' - /> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.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='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.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()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - 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='180'> - <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> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()+""}' - onKeyReleased='identity.setConfig(new File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()+""}' - onKeyReleased='identity.setDir(new File(dir.getText()))'/> - </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> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()+""}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' - layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> - <JTable id='errorTable' model='{errorTableModel}' rowSelectionAllowed='true' - autoCreateRowSorter='true' - autoResizeMode='2' cellSelectionEnabled='false' - selectionMode='0'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</jaxx.demo.DemoPanel> Added: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.css =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.css (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.css 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,29 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id: Validation.css 2225 2011-02-19 20:15:00Z tchemit $ + * $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/featu... $ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +JSlider { + paintTicks: true; + minorTickSpacing: 5; + majorTickSpacing: 10; +} Added: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.jaxx =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.jaxx (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemo.jaxx 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,107 @@ +<!-- + #%L + JAXX :: Demo + + $Id: ValidationTableDemo.jaxx 2380 2012-07-04 16:12:58Z tchemit $ + $HeadURL: http://svn.nuiton.org/svn/jaxx/trunk/jaxx-demo/src/main/java/jaxx/demo/featu... $ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> + + <import> + javax.swing.JOptionPane + static org.nuiton.i18n.I18n.n_ + jaxx.demo.entities.People + org.nuiton.validator.bean.list.BeanListValidator + jaxx.runtime.validator.swing.SwingListValidatorMessageTableModel + + java.io.File + </import> + + <script><![CDATA[ +void $afterCompleteSetup() { + handler.initUI(); +} + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "ListBeanValidationDemo.css", + "People.java", "People-error-validation.xml", "People-info-validation.xml", "People-warning-validation.xml", + "ListBeanValidationDemoHandler.java", "PeopleTableModel.java" + }; +} +]]></script> + + <!-- Handler of this ui --> + <ListBeanValidationDemoHandler id='handler' constructorParams='this'/> + + <!-- model --> + <PeopleTableModel id='model'/> + + <!-- validator --> + <BeanListValidator id='validator' genericType='People' + initializer='BeanListValidator.newValidator(People.class, null)'/> + + <!-- errors model --> + <SwingListValidatorMessageTableModel id='errorTableModel' + onTableChanged='handler.updateOkEnabled()'/> + + <Table fill='both' constraints='BorderLayout.CENTER'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form")}' + layout='{new GridLayout()}' width='250' height='120'> + <JScrollPane id='dataTableScrollePane' constraints='BorderLayout.CENTER'> + <JTable id='dataTable' model='{model}' autoCreateRowSorter='true'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell fill="both"> + <JPanel layout='{new GridLayout(1,3,0,0)}'> + <JButton id='addIdentity' text='jaxx.demo.action.add' + onActionPerformed='handler.addIdentity()'/> + <JButton id='removeIdentity' text='jaxx.demo.action.remove' + onActionPerformed='handler.removeIdentity()'/> + <JButton id='ok' text='jaxx.demo.action.ok' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + + </JPanel> + </cell> + </row> + <row> + <cell fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' + layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' model='{errorTableModel}' + rowSelectionAllowed='true' + autoCreateRowSorter='true' + autoResizeMode='2' cellSelectionEnabled='false' + selectionMode='0'/> + </JScrollPane> + </JPanel> + </cell> + </row> + </Table> + +</jaxx.demo.DemoPanel> Added: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,150 @@ +package jaxx.demo.feature.validation.list; + +import jaxx.demo.entities.DemoDecoratorProvider; +import jaxx.demo.entities.People; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.validator.swing.SwingListValidatorDataLocator; +import jaxx.runtime.validator.swing.SwingListValidatorMessageTableModel; +import jaxx.runtime.validator.swing.SwingListValidatorMessageTableMouseListener; +import jaxx.runtime.validator.swing.SwingListValidatorMessageTableRenderer; +import jaxx.runtime.validator.swing.SwingListValidatorTableEditorModelListener; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.decorator.Decorator; +import org.nuiton.validator.bean.list.BeanListValidator; + +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.SortOrder; +import javax.swing.table.TableModel; +import java.util.Arrays; +import java.util.UUID; + +import static org.nuiton.i18n.I18n.n_; + +/** + * Handler of UI {@link ListBeanValidationDemo}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.5.3 + */ +public class ListBeanValidationDemoHandler { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(ListBeanValidationDemoHandler.class); + + private final ListBeanValidationDemo ui; + + public ListBeanValidationDemoHandler(ListBeanValidationDemo ui) { + this.ui = ui; + } + + public void initUI() { + + // customize data table + + JTable dataTable = ui.getDataTable(); + + dataTable.getRowSorter().setSortKeys( + Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + SwingUtil.setI18nTableHeaderRenderer( + dataTable, + n_("jaxx.demo.label.id"), + n_("jaxx.demo.label.id.tip"), + n_("jaxx.demo.label.firstName"), + n_("jaxx.demo.label.firstName.tip"), + n_("jaxx.demo.label.lastName"), + n_("jaxx.demo.label.lastName.tip"), + n_("jaxx.demo.label.age"), + n_("jaxx.demo.label.age.tip")); + + SwingUtil.fixTableColumnWidth(dataTable, 3, 35); + + // register validator + ui.getErrorTableModel().registerValidator(ui.getValidator()); + + // customize error table + + JTable errorTable = ui.getErrorTable(); + + SwingValidatorUtil.installUI(errorTable, new SwingListValidatorMessageTableRenderer() { + + private static final long serialVersionUID = 1L; + + Decorator<People> decorator + = new DemoDecoratorProvider().getDecoratorByType(People.class); + + @Override + protected String decorateBean(Object bean) { + return decorator.toString(bean); + } + }); + + IdentityValidatorDataLocator dataLocator = new IdentityValidatorDataLocator(); + + // add click listener to go to cell + errorTable.addMouseListener(new SwingListValidatorMessageTableMouseListener( + dataTable, + dataLocator + )); + + ui.getModel().addTableModelListener( + new SwingListValidatorTableEditorModelListener<People>(ui.getValidator(), dataLocator)); + } + + public void addIdentity() { + + People bean = new People(); + bean.setId(UUID.randomUUID().toString()); + + PeopleTableModel model = ui.getModel(); + model.addBean(bean); + + } + + public void removeIdentity() { + int selectedRow = ui.getDataTable().getSelectedRow(); + PeopleTableModel model = ui.getModel(); + model.removeBean(selectedRow); + } + + public void updateOkEnabled() { + SwingListValidatorMessageTableModel model = ui.getErrorTableModel(); + BeanListValidator<People> validator = ui.getValidator(); + boolean valid = !validator.hasErrors(); + ui.getOk().setEnabled(valid); + } + + private static class IdentityValidatorDataLocator implements SwingListValidatorDataLocator<People> { + + @Override + public Pair<Integer, Integer> locateDataCell(TableModel tableModel, + People bean, + String fieldName) { + PeopleTableModel model = (PeopleTableModel) tableModel; + + Pair<Integer, Integer> cell = + model.getCell((People) bean, fieldName); + return cell; + } + + @Override + public int locateBeanRowIndex(TableModel tableModel, People bean) { + PeopleTableModel model = (PeopleTableModel) tableModel; + return model.getBeanIndex(bean); + } + + @Override + public People locateBean(TableModel tableModel, int rowIndex) { + PeopleTableModel model = + (PeopleTableModel) tableModel; + return model.getBean(rowIndex); + } + } + +} + + Added: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/PeopleTableModel.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/PeopleTableModel.java (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/list/PeopleTableModel.java 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,123 @@ +package jaxx.demo.feature.validation.list; + +import com.google.common.collect.Lists; +import jaxx.demo.entities.Identity; +import jaxx.demo.entities.People; +import jaxx.runtime.SwingUtil; +import org.apache.commons.lang3.tuple.Pair; + +import javax.swing.table.AbstractTableModel; +import java.util.Arrays; +import java.util.List; + +/** + * Table model of {@link Identity}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.5.3 + */ +public class PeopleTableModel extends AbstractTableModel { + + private static final long serialVersionUID = 1L; + + public static final List<String> columnNames = + Arrays.asList(People.PROPERTY_ID, + People.PROPERTY_FIRST_NAME, + People.PROPERTY_LAST_NAME, + People.PROPERTY_AGE); + + public static final Class<?>[] columnClasses = + {String.class, String.class, Integer.class}; + + private final List<People> data = Lists.newArrayList(); + + @Override + public int getRowCount() { + return data.size(); + } + + @Override + public int getColumnCount() { + return columnNames.size(); + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex > 0; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + + SwingUtil.ensureColumnIndex(this, columnIndex); + SwingUtil.ensureRowIndex(this, rowIndex); + + People row = data.get(rowIndex); + if (columnIndex == 0) { + return row.getId(); + } + if (columnIndex == 1) { + return row.getFirstName(); + } + if (columnIndex == 2) { + return row.getLastName(); + } + if (columnIndex == 3) { + return row.getAge(); + } + + // should never come here + return null; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + SwingUtil.ensureColumnIndex(this, columnIndex); + SwingUtil.ensureRowIndex(this, rowIndex); + + People row = data.get(rowIndex); + + if (columnIndex == 0) { + row.setId(String.valueOf(aValue)); + } else if (columnIndex == 1) { + row.setFirstName(String.valueOf(aValue)); + } else if (columnIndex == 2) { + row.setLastName(String.valueOf(aValue)); + } else if (columnIndex == 3) { + row.setAge(Integer.valueOf(aValue.toString())); + } + } + + + public int getBeanIndex(People bean) { + int row = data.indexOf(bean); + return row; + } + + public People getBean(int row) { + SwingUtil.ensureRowIndex(this, row); + People bean = data.get(row); + return bean; + } + + public Pair<Integer, Integer> getCell(People bean, String fieldName) { + + int row = getBeanIndex(bean); + int col = columnNames.indexOf(fieldName); + + Pair<Integer, Integer> cell = Pair.of(row, col); + return cell; + } + + public void removeBean(int selectedRow) { + SwingUtil.ensureRowIndex(this, selectedRow); + data.remove(selectedRow); + fireTableRowsDeleted(selectedRow, selectedRow); + } + + public void addBean(People bean) { + data.add(bean); + int newrowIndex = data.size() - 1; + fireTableRowsInserted(newrowIndex, newrowIndex); + } +} Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByListDemo.jaxx (from rev 2442, trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx) =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByListDemo.jaxx (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByListDemo.jaxx 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,372 @@ +<!-- + #%L + JAXX :: Demo + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> + <style source="Validation.css"/> + + <import> + javax.swing.JOptionPane + static org.nuiton.i18n.I18n.n_ + jaxx.demo.entities.Identity + jaxx.demo.entities.Model + jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer + jaxx.runtime.validator.swing.SwingValidatorMessageListModel + + java.io.File + </import> + + <script><![CDATA[ + +void $afterCompleteSetup() { +} + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "Validation.css", + "Identity.java", "Identity-error-validation.xml", "Identity-info-validation.xml", "Identity-warning-validation.xml", + "Model.java", "Model-error-validation.xml", "Model-info-validation.xml", "Model-warning-validation.xml" + }; +} +]]> + </script> + <!-- models --> + <Model id='model1'/> + <Model id='model2'/> + <Identity id='identity'/> + + <!-- errors model --> + <SwingValidatorMessageListModel id='errorListModel' + onContentsChanged='ok.setEnabled(errorListModel.isEmpty())'/> + + <!-- validators --> + <BeanValidator id='validator' bean='model1' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="text"/> + <field name="text2"/> + <field name="ratio"/> + </BeanValidator> + <BeanValidator id='validator2' bean='model2' + uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> + <field name="text" component="_text"/> + <field name="text2" component="_text2"/> + <field name="ratio" component="_ratio"/> + </BeanValidator> + <BeanValidator id='validator3' autoField='true' bean='identity' + uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> + <field name="email" component="email2"/> + </BeanValidator> + + <Table fill='both' constraints='BorderLayout.CENTER'> + <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='{model1.getText()}' + _validatorLabel='{n_("form.text")}' + onKeyReleased='model1.setText(text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='text2' text='{model1.getText2()}' + _validatorLabel='{n_("form.text2")}' + onKeyReleased='model1.setText2(text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' + value='{model1.getRatio()}' + _validatorLabel='{n_("form.ratio")}' + onStateChanged='model1.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='{model1.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model1.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()}' + _validatorLabel='{n_("form2.text")}' + onKeyReleased='model2.setText(_text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text2' text='{model2.getText2()}' + _validatorLabel='{n_("form2.text2")}' + onKeyReleased='model2.setText2(_text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='_ratio' minimum='0' maximum='100' + value='{model2.getRatio()}' + _validatorLabel='{n_("form2.ratio")}' + 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='180'> + <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> + <row> + <cell> + <JLabel text='Config file :'/> + </cell> + <cell> + <JTextField id='config' text='{identity.getConfig()+""}' + onKeyReleased='identity.setConfig(new File(config.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Working directory:'/> + </cell> + <cell> + <JTextField id='dir' text='{identity.getDir()+""}' + onKeyReleased='identity.setDir(new File(dir.getText()))'/> + </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> + <row> + <cell> + <JLabel text='Config file:'/> + </cell> + <cell> + <JLabel text='{identity.getConfig()+""}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Directory file:'/> + </cell> + <cell> + <JLabel text='{identity.getDir()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' + layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane> + <JList id='errorList' model='{errorListModel}' + cellRenderer='{new SwingValidatorMessageListRenderer()}'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton id='cancel' text='cancel' + onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + <JButton id='ok' text='valid' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + </JPanel> + </cell> + </row> + </Table> + +</jaxx.demo.DemoPanel> Property changes on: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByListDemo.jaxx ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByTableDemo.jaxx (from rev 2442, trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx) =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByTableDemo.jaxx (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByTableDemo.jaxx 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,377 @@ +<!-- + #%L + JAXX :: Demo + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> + <style source="Validation.css"/> + + <import> + javax.swing.JOptionPane + static org.nuiton.i18n.I18n.n_ + jaxx.demo.entities.Identity + jaxx.demo.entities.Model + jaxx.runtime.validator.swing.SwingValidatorUtil + jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer + jaxx.runtime.validator.swing.SwingValidatorMessageTableModel + + java.io.File + </import> + + <script><![CDATA[ +void $afterCompleteSetup() { + SwingValidatorUtil.installUI(errorTable, new SwingValidatorMessageTableRenderer()); +} + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "Validation.css", + "Identity.java", "Identity-error-validation.xml", "Identity-info-validation.xml", "Identity-warning-validation.xml", + "Model.java", "Model-error-validation.xml", "Model-info-validation.xml", "Model-warning-validation.xml" + }; +} +]]></script> + + <!-- models --> + <Model id='model1'/> + <Model id='model2'/> + <Identity id='identity'/> + + <!-- errors model --> + <SwingValidatorMessageTableModel id='errorTableModel' + onTableChanged='ok.setEnabled(errorTableModel.getRowCount()==0)'/> + + <!-- validators --> + <BeanValidator id='validator' bean='model1' + uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> + <field name="text"/> + <field name="text2"/> + <field name="ratio"/> + </BeanValidator> + <BeanValidator id='validator2' bean='model2' + uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> + <field name="text" component="_text"/> + <field name="text2" component="_text2"/> + <field name="ratio" component="_ratio"/> + </BeanValidator> + <BeanValidator id='validator3' autoField='true' bean='identity' + uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> + <field name="email" component="email2"/> + </BeanValidator> + + <Table fill='both' constraints='BorderLayout.CENTER'> + <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='{model1.getText()}' + onKeyReleased='model1.setText(text.getText())' + _validatorLabel='{n_("form.text")}' + /> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='text2' text='{model1.getText2()}' + onKeyReleased='model1.setText2(text2.getText())' + _validatorLabel='{n_("form.text2")}' + /> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' + value='{model1.getRatio()}' + _validatorLabel='{n_("form.ratio")}' + onStateChanged='model1.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='{model1.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model1.getText2()}'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model1.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()}' + _validatorLabel='{n_("form2.text")}' + onKeyReleased='model2.setText(_text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text2' text='{model2.getText2()}' + _validatorLabel='{n_("form2.text2")}' + onKeyReleased='model2.setText2(_text2.getText())'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='_ratio' minimum='0' maximum='100' + value='{model2.getRatio()}' + _validatorLabel='{n_("form2.ratio")}' + 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='180'> + <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> + <row> + <cell> + <JLabel text='Config file :'/> + </cell> + <cell> + <JTextField id='config' text='{identity.getConfig()+""}' + onKeyReleased='identity.setConfig(new File(config.getText()))'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Working directory:'/> + </cell> + <cell> + <JTextField id='dir' text='{identity.getDir()+""}' + onKeyReleased='identity.setDir(new File(dir.getText()))'/> + </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> + <row> + <cell> + <JLabel text='Config file:'/> + </cell> + <cell> + <JLabel text='{identity.getConfig()+""}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Directory file:'/> + </cell> + <cell> + <JLabel text='{identity.getDir()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Messages")}' + layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> + <JTable id='errorTable' model='{errorTableModel}' rowSelectionAllowed='true' + autoCreateRowSorter='true' + autoResizeMode='2' cellSelectionEnabled='false' + selectionMode='0'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton id='cancel' text='cancel' + onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + <JButton id='ok' text='valid' + onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> + </JPanel> + </cell> + </row> + </Table> + +</jaxx.demo.DemoPanel> Property changes on: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/SimpleBeanValidationByTableDemo.jaxx ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/Validation.css (from rev 2442, trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Validation.css) =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/Validation.css (rev 0) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/Validation.css 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,29 @@ +/* + * #%L + * JAXX :: Demo + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2010 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +JSlider { + paintTicks: true; + minorTickSpacing: 5; + majorTickSpacing: 10; +} Property changes on: trunk/jaxx-demo/src/main/java/jaxx/demo/feature/validation/simple/Validation.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java =================================================================== --- trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java 2012-07-27 14:34:57 UTC (rev 2445) @@ -25,17 +25,13 @@ package jaxx.demo.tree; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import jaxx.demo.component.jaxx.BoxedDecoratorDemo; import jaxx.demo.component.jaxx.StatusMessagePanelDemo; import jaxx.demo.component.jaxx.editor.ComboEditorDemo; import jaxx.demo.component.jaxx.editor.DatePickerDemo; import jaxx.demo.component.jaxx.editor.FileEditorDemo; +import jaxx.demo.component.jaxx.editor.I18nEditorDemo; import jaxx.demo.component.jaxx.editor.ListSelectorDemo; -import jaxx.demo.component.jaxx.editor.I18nEditorDemo; import jaxx.demo.component.jaxx.editor.NumberEditorDemo; import jaxx.demo.component.jaxx.editor.TimeEditorDemo; import jaxx.demo.component.swing.HidorButtonDemo; @@ -59,8 +55,9 @@ import jaxx.demo.feature.databinding.BeanDataBindingDemo; import jaxx.demo.feature.databinding.BindingExtremeDemo; import jaxx.demo.feature.nav.NavDemo; -import jaxx.demo.feature.validation.ValidationListDemo; -import jaxx.demo.feature.validation.ValidationTableDemo; +import jaxx.demo.feature.validation.simple.SimpleBeanValidationByListDemo; +import jaxx.demo.feature.validation.simple.SimpleBeanValidationByTableDemo; +import jaxx.demo.feature.validation.list.ListBeanValidationDemo; import jaxx.demo.fun.CalculatorDemo; import jaxx.demo.fun.CounterDemo; import jaxx.demo.fun.LabelStyleDemo; @@ -68,6 +65,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static org.nuiton.i18n.I18n.n_; /** @@ -172,10 +174,18 @@ ); addMapping(n_("jaxxdemo.feature.validation"), - ValidationListDemo.class, - ValidationTableDemo.class + n_("jaxxdemo.feature.simple.validation"), + n_("jaxxdemo.feature.list.validation") ); + addMapping(n_("jaxxdemo.feature.simple.validation"), + SimpleBeanValidationByListDemo.class, + SimpleBeanValidationByTableDemo.class + ); + + addMapping(n_("jaxxdemo.feature.list.validation"), + ListBeanValidationDemo.class + ); addMapping(n_("jaxxdemo.feature.nav"), NavDemo.class ); Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties 2012-07-27 14:34:57 UTC (rev 2445) @@ -135,6 +135,17 @@ isF0()\ &&\ isF1()= isF0()\ ||\ isF1()= isF1()= +jaxx.demo.action.add=Add +jaxx.demo.action.ok=Ok +jaxx.demo.action.remove=Remove +jaxx.demo.label.age=Age +jaxx.demo.label.age.tip=Age +jaxx.demo.label.firstName=First name +jaxx.demo.label.firstName.tip=First name +jaxx.demo.label.id=Id +jaxx.demo.label.id.tip=Identifiant +jaxx.demo.label.lastName=Last name +jaxx.demo.label.lastName.tip=Last name jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, visit the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>. jaxxdemo.action.about=About... jaxxdemo.action.about.tip=About JAXXDemo... @@ -194,7 +205,9 @@ jaxxdemo.datePickerEditor.showPopupButton=Display popup button jaxxdemo.feature=Features jaxxdemo.feature.databinding=Data Binding +jaxxdemo.feature.list.validation=Multiple Bean Validation jaxxdemo.feature.nav=Jaxx nav API +jaxxdemo.feature.simple.validation=Simple Bean Validation jaxxdemo.feature.validation=Validation jaxxdemo.fileEditor.acceptAllFileFilterUsed=Allow all FileFilter jaxxdemo.fileEditor.directoryEnabled=Enable directory selection Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties 2012-07-27 14:34:57 UTC (rev 2445) @@ -135,6 +135,20 @@ isF0()\ &&\ isF1()= isF0()\ ||\ isF1()= isF1()= +jaxx.demo.action.add= +jaxx.demo.action.ok= +jaxx.demo.action.remove= +jaxx.demo.label.age= +jaxx.demo.label.age.tip= +jaxx.demo.label.email= +jaxx.demo.label.email.tip= +jaxx.demo.label.firstName= +jaxx.demo.label.firstName.tip= +jaxx.demo.label.id= +jaxx.demo.label.id.tip= +jaxx.demo.label.lasstName.tip= +jaxx.demo.label.lastName= +jaxx.demo.label.lastName.tip= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... @@ -194,7 +208,9 @@ jaxxdemo.datePickerEditor.showPopupButton=Afficher le boutton pour ouvrir la popup jaxxdemo.feature=Fonctionnalités jaxxdemo.feature.databinding=Data binding +jaxxdemo.feature.list.validation= jaxxdemo.feature.nav=API JAXX pour les arbres +jaxxdemo.feature.simple.validation= jaxxdemo.feature.validation=Validation jaxxdemo.fileEditor.acceptAllFileFilterUsed=Accèpte tout les FileFilter jaxxdemo.fileEditor.directoryEnabled=Activer la sélection des files Modified: trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties 2012-07-27 14:34:57 UTC (rev 2445) @@ -135,6 +135,17 @@ isF0()\ &&\ isF1()= isF0()\ ||\ isF1()= isF1()= +jaxx.demo.action.add=Ajouter +jaxx.demo.action.ok=Ok +jaxx.demo.action.remove=Supprimer +jaxx.demo.label.age=Age +jaxx.demo.label.age.tip=Age +jaxx.demo.label.firstName=Prénom +jaxx.demo.label.firstName.tip=Prénom +jaxx.demo.label.id=Id +jaxx.demo.label.id.tip=Identifiant +jaxx.demo.label.lastName=Nom +jaxx.demo.label.lastName.tip=Nom jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... @@ -194,7 +205,9 @@ jaxxdemo.datePickerEditor.showPopupButton=Afficher le boutton pour ouvrir la popup jaxxdemo.feature=Fonctionnalités jaxxdemo.feature.databinding=Data binding +jaxxdemo.feature.list.validation=Validation de liste jaxxdemo.feature.nav=API JAXX pour les arbres +jaxxdemo.feature.simple.validation=Validation simple jaxxdemo.feature.validation=Validation jaxxdemo.fileEditor.acceptAllFileFilterUsed=Accèpte tout les FileFilter jaxxdemo.fileEditor.directoryEnabled=Activer la sélection des files Added: trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-error-validation.xml =================================================================== --- trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-error-validation.xml (rev 0) +++ trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-error-validation.xml 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,21 @@ +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + <field name="firstName"> + <field-validator type="requiredstring" short-circuit="true"> + <message>You must enter a firstName.</message> + </field-validator> + </field> + <field name="lastName"> + <field-validator type="requiredstring" short-circuit="true"> + <message>You must enter a lastName.</message> + </field-validator> + </field> + <field name="age"> + <field-validator type="int"> + <param name="min">18</param> + <message>Your are too young (min ${min} )</message> + </field-validator> + </field> +</validators> \ No newline at end of file Added: trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-info-validation.xml =================================================================== --- trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-info-validation.xml (rev 0) +++ trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-info-validation.xml 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,12 @@ +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="age"> + <field-validator type="int"> + <param name="min">25</param> + <message>Info : You are still young ( old ${min} ) </message> + </field-validator> + </field> +</validators> \ No newline at end of file Added: trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-warning-validation.xml =================================================================== --- trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-warning-validation.xml (rev 0) +++ trunk/jaxx-demo/src/main/resources/jaxx/demo/entities/People-warning-validation.xml 2012-07-27 14:34:57 UTC (rev 2445) @@ -0,0 +1,12 @@ +<!DOCTYPE validators PUBLIC + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="age"> + <field-validator type="int"> + <param name="max">88</param> + <message>Hum Your are older than ${max} !</message> + </field-validator> + </field> +</validators> \ No newline at end of file Modified: trunk/jaxx-demo/src/main/resources/log4j.properties =================================================================== --- trunk/jaxx-demo/src/main/resources/log4j.properties 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/main/resources/log4j.properties 2012-07-27 14:34:57 UTC (rev 2445) @@ -23,7 +23,7 @@ # #L% ### # Global logging configuration -log4j.rootLogger=ERROR, stdout, jaxxDemoAppender +log4j.rootLogger=ERROR, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout Modified: trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java =================================================================== --- trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2012-07-27 14:34:35 UTC (rev 2444) +++ trunk/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java 2012-07-27 14:34:57 UTC (rev 2445) @@ -27,6 +27,7 @@ import jaxx.demo.entities.Identity; import jaxx.demo.entities.Model; +import jaxx.demo.entities.People; import org.junit.Assert; import org.junit.Test; import org.nuiton.validator.AbstractValidatorDetectorTest; @@ -52,12 +53,12 @@ NuitonValidator<?> validator; Iterator<NuitonValidator<?>> iterator; - // test with all context and all scopes : 2 validators (Identity+ Model) + // test with all context and all scopes - result = detectValidators(Identity.class, Model.class); + result = detectValidators(Identity.class, Model.class, People.class); Assert.assertNotNull(result); - Assert.assertEquals(2, result.size()); + Assert.assertEquals(3, result.size()); iterator = result.iterator(); @@ -73,6 +74,10 @@ assertValidatorEffectiveScopes(validator, NuitonValidatorScope.ERROR, NuitonValidatorScope.WARNING, NuitonValidatorScope.INFO); // ValidatorTestHelper.assertValidatorEffectiveFields(validator, NuitonValidatorScope.ERROR, Pet.PROPERTY_NAME); + validator = iterator.next(); + assertValidatorModel(validator, null, People.class, NuitonValidatorScope.values()); + assertValidatorEffectiveScopes(validator, NuitonValidatorScope.ERROR, NuitonValidatorScope.WARNING, NuitonValidatorScope.INFO); + } @Override
participants (1)
-
tchemit@users.nuiton.org