This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit b12741015a10ab8044ec7e29dbadc94fe7814b8a Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 19:15:44 2009 +0000 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) --- jaxx-compiler/pom.xml | 16 +- .../src/main/java/jaxx/SwingInitializer.java | 81 +-- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 29 +- .../java/jaxx/tags/DefaultComponentHandler.java | 6 +- .../main/java/jaxx/tags/DefaultObjectHandler.java | 86 +-- .../src/main/java/jaxx/tags/TagManager.java | 26 +- .../java/jaxx/tags/swing/EnumEditorHandler.java | 56 -- .../src/main/java/jaxx/tags/swing/ItemHandler.java | 29 +- .../java/jaxx/tags/swing/JComboBoxHandler.java | 35 +- .../main/java/jaxx/tags/swing/JSliderHandler.java | 19 +- .../main/java/jaxx/tags/swing/JWindowHandler.java | 2 +- .../java/jaxx/tags/swing/LocaleEditorHandler.java | 56 -- .../src/main/java/jaxx/tags/swing/RowHandler.java | 5 +- .../src/main/java/jaxx/tags/swing/TabHandler.java | 2 + .../jaxx/tags/validator/BeanValidatorHandler.java | 2 +- .../validator/ExcludeFieldValidatorHandler.java | 2 + .../jaxx/tags/validator/FieldValidatorHandler.java | 2 + .../test/java/jaxx/beaninfos/BeanIntoUtilTest.java | 2 +- .../src/test/java/jaxx/junit/TagManagerTest.java | 6 +- .../swing/navigation/NavigationTreeModelTest.java | 394 -------------- jaxx-demo/pom.xml | 12 +- jaxx-demo/src/main/filters/jaxx-demo.properties | 3 + jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx | 195 ++++--- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 47 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.css | 33 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 192 ++++--- .../src/main/java/jaxx/demo/DemoUIHandler.java | 38 +- .../demo/component/jaxx/BoxedDecoratorDemo.jaxx | 20 + .../component/jaxx/StatusMessagePanelDemo.jaxx | 20 + .../component/jaxx/editor/ComboEditorDemo.jaxx | 20 + .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 20 + .../component/jaxx/editor/NumberEditorDemo.jaxx | 20 + .../jaxx/navigation/full/BaseContent.jaxx | 79 --- .../navigation/full/FullNavigationTreeDemo.jaxx | 58 -- .../navigation/full/FullNavigationTreeHelper.java | 230 -------- .../demo/component/jaxx/navigation/full/Movie.java | 127 ----- .../component/jaxx/navigation/full/People.java | 117 ---- .../navigation/item/ItemTreeNavigationDemo.jaxx | 20 + .../jaxx/demo/component/swing/JButtonDemo.jaxx | 20 + .../jaxx/demo/component/swing/JCheckBoxDemo.jaxx | 20 + .../component/swing/JCheckBoxMenuItemDemo.jaxx | 20 + .../jaxx/demo/component/swing/JComboBoxDemo.jaxx | 85 ++- .../jaxx/demo/component/swing/JDialogDemo.jaxx | 20 + .../java/jaxx/demo/component/swing/JListDemo.jaxx | 20 + .../jaxx/demo/component/swing/JMenuItemDemo.jaxx | 20 + .../demo/component/swing/JPasswordFieldDemo.jaxx | 20 + .../demo/component/swing/JProgressBarDemo.jaxx | 20 + .../demo/component/swing/JRadioButtonDemo.jaxx | 20 + .../component/swing/JRadioButtonMenuItemDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSliderDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSpinnerDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSplitPaneDemo.jaxx | 20 + .../jaxx/demo/component/swing/JTextAreaDemo.jaxx | 20 + .../jaxx/demo/component/swing/JTextFieldDemo.jaxx | 20 + .../demo/component/swing/JToggleButtonDemo.jaxx | 20 + .../feature/databinding/BaseBeanDataBinding.jaxx | 20 + .../feature/databinding/BeanDataBindingDemo.jaxx | 20 + .../feature/validation/ValidationListDemo.jaxx | 24 +- .../feature/validation/ValidationTableDemo.jaxx | 24 +- .../main/java/jaxx/demo/fun/CalculatorDemo.jaxx | 20 + .../src/main/java/jaxx/demo/fun/CounterDemo.jaxx | 20 + .../main/java/jaxx/demo/fun/LabelStyleDemo.jaxx | 20 + .../main/resources/i18n/jaxx-demo-en_GB.properties | 7 +- .../main/resources/i18n/jaxx-demo-fr_FR.properties | 7 +- jaxx-demo/src/main/resources/log4j.properties | 4 +- jaxx-example/changelog.txt | 18 - jaxx-example/pom.xml | 256 --------- .../main/java/jaxx/demo/BaseBeanDataBinding.jaxx | 21 - .../main/java/jaxx/demo/BeanDataBindingDemo.jaxx | 47 -- .../main/java/jaxx/demo/BoxedDecoratorDemo.jaxx | 91 ---- .../src/main/java/jaxx/demo/Calculator.css | 68 --- .../src/main/java/jaxx/demo/CalculatorDemo.jaxx | 89 ---- .../src/main/java/jaxx/demo/CalculatorEngine.java | 177 ------- .../src/main/java/jaxx/demo/ComboEditorDemo.jaxx | 35 -- .../src/main/java/jaxx/demo/CounterDemo.jaxx | 12 - .../src/main/java/jaxx/demo/DemoPanel.jaxx | 45 -- .../src/main/java/jaxx/demo/EmptyDemo.jaxx | 5 - .../demo/ExempleItemTreeNavigationAdapter.java | 60 --- .../src/main/java/jaxx/demo/I18nEditorDemo.jaxx | 46 -- jaxx-example/src/main/java/jaxx/demo/Identity.java | 103 ---- .../java/jaxx/demo/ItemTreeNavigationDemo.jaxx | 41 -- jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx | 134 ----- .../src/main/java/jaxx/demo/JButtonDemo.jaxx | 29 - .../src/main/java/jaxx/demo/JCheckBoxDemo.jaxx | 38 -- .../main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx | 59 --- .../src/main/java/jaxx/demo/JComboBoxDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JDialogDemo.jaxx | 79 --- .../src/main/java/jaxx/demo/JListDemo.jaxx | 59 --- .../src/main/java/jaxx/demo/JMenuItemDemo.jaxx | 23 - .../main/java/jaxx/demo/JPasswordFieldDemo.jaxx | 10 - .../src/main/java/jaxx/demo/JProgressBarDemo.jaxx | 77 --- .../src/main/java/jaxx/demo/JRadioButtonDemo.jaxx | 11 - .../java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx | 14 - .../src/main/java/jaxx/demo/JSliderDemo.jaxx | 12 - .../src/main/java/jaxx/demo/JSpinnerDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JSplitPaneDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JTextAreaDemo.jaxx | 33 -- .../src/main/java/jaxx/demo/JTextFieldDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JToggleButtonDemo.jaxx | 9 - .../src/main/java/jaxx/demo/LabelStyle.css | 43 -- .../src/main/java/jaxx/demo/LabelStyleDemo.jaxx | 85 --- jaxx-example/src/main/java/jaxx/demo/Model.java | 66 --- .../src/main/java/jaxx/demo/NumberEditorDemo.jaxx | 132 ----- .../main/java/jaxx/demo/NumberEditorDemoModel.java | 78 --- .../java/jaxx/demo/StatusMessagePanelDemo.jaxx | 11 - .../src/main/java/jaxx/demo/Validation.css | 5 - .../main/java/jaxx/demo/ValidationListDemo.jaxx | 325 ------------ .../main/java/jaxx/demo/ValidationTableDemo.jaxx | 331 ------------ jaxx-example/src/main/jnlp/jxlayer.jnlp | 12 - jaxx-example/src/main/jnlp/sun.jnlp | 12 - .../resources/i18n/jaxx-example-en_GB.properties | 142 ----- .../resources/i18n/jaxx-example-fr_FR.properties | 134 ----- .../src/main/resources/icons/action-accept.png | Bin 781 -> 0 bytes .../src/main/resources/icons/action-block.png | Bin 576 -> 0 bytes .../jaxx/demo/Identity-error-validation.xml | 49 -- .../jaxx/demo/Identity-info-validation.xml | 49 -- .../jaxx/demo/Identity-warning-validation.xml | 49 -- .../resources/jaxx/demo/Model-error-validation.xml | 35 -- .../resources/jaxx/demo/Model-info-validation.xml | 13 - .../jaxx/demo/Model-warning-validation.xml | 18 - .../main/resources/jaxx/demo/images/Amethyst.jpg | Bin 24619 -> 0 bytes .../src/main/resources/jaxx/demo/images/Lynx.jpg | Bin 40463 -> 0 bytes .../src/main/resources/jaxx/demo/images/Tomato.jpg | Bin 22862 -> 0 bytes .../resources/jaxx/demo/images/pencil_black.gif | Bin 190 -> 0 bytes jaxx-example/src/main/resources/log4j.properties | 10 - jaxx-example/src/site/site.xml | 27 - .../java/jaxx/demo/BeanValidatorDetectorTest.java | 34 -- .../src/main/java/jaxx/runtime/Decorator.java | 36 -- .../src/main/java/jaxx/runtime/DecoratorUtils.java | 111 ---- .../main/java/jaxx/runtime/JXPathDecorator.java | 278 ---------- .../java/jaxx/runtime/MultiJXPathDecorator.java | 129 ----- .../main/java/jaxx/runtime/PropertyDecorator.java | 94 ---- .../i18n/jaxx-runtime-api-en_GB.properties | 3 - .../i18n/jaxx-runtime-api-fr_FR.properties | 3 - .../java/jaxx/runtime/JXPathDecoratorTest.java | 163 ------ .../jaxx/runtime/MultiJXPathDecoratorTest.java | 184 ------- jaxx-runtime-swing-widget/LICENSE.txt | 166 ------ jaxx-runtime-swing-widget/README.txt | 2 - .../src/site/rst/images/Components-screenshot.gif | Bin 46663 -> 0 bytes .../src/site/rst/images/webstart.gif | Bin 1806 -> 0 bytes jaxx-runtime-swing-widget/src/site/rst/index.rst | 40 -- jaxx-runtime-swing/LICENSE.txt | 166 ------ jaxx-runtime-swing/README.txt | 2 - jaxx-runtime-swing/changelog.txt | 114 ---- jaxx-runtime-swing/pom.xml | 53 -- .../runtime/swing/DecoratorTableCellRenderer.java | 33 -- .../navigation/NavigationTreeCellRenderer.java | 137 ----- .../navigation/NavigationTreeContextHelper.java | 133 ----- .../swing/navigation/NavigationTreeHandler.java | 307 ----------- .../NavigationTreeHandlerWithCardLayout.java | 129 ----- .../swing/navigation/NavigationTreeHelper.java | 123 ----- .../swing/navigation/NavigationTreeModel.java | 589 --------------------- .../navigation/NavigationTreeModelBuilder.java | 210 -------- .../navigation/NavigationTreeSelectionAdapter.java | 248 --------- ...vigationTreeSelectionAdapterWithCardLayout.java | 110 ---- .../runtime/swing/navigation/NavigationUtil.java | 264 --------- .../i18n/jaxx-runtime-swing-en_GB.properties | 9 - jaxx-runtime-swing/src/site/site.xml | 25 - {jaxx-example => jaxx-runtime}/LICENSE.txt | 0 {jaxx-example => jaxx-runtime}/README.txt | 0 {jaxx-runtime-api => jaxx-runtime}/changelog.txt | 0 {jaxx-runtime-api => jaxx-runtime}/pom.xml | 16 +- .../src/main/java/jaxx/Base64Coder.java | 0 .../src/main/java/jaxx/beaninfos/HBoxBeanInfo.java | 0 .../src/main/java/jaxx/beaninfos/VBoxBeanInfo.java | 0 .../src/main/java/jaxx/css/Rule.java | 0 .../src/main/java/jaxx/css/Selector.java | 0 .../src/main/java/jaxx/css/Stylesheet.java | 0 .../java/jaxx/runtime/ComponentDescriptor.java | 0 .../java/jaxx/runtime/DataBindingListener.java | 0 .../jaxx/runtime/DataBindingUpdateListener.java | 0 .../src/main/java/jaxx/runtime/DataContext.java | 32 +- .../jaxx/runtime/DefaultApplicationContext.java | 8 +- .../main/java/jaxx/runtime/DefaultJAXXContext.java | 0 .../src/main/java/jaxx/runtime/JAXXAction.java | 0 .../src/main/java/jaxx/runtime/JAXXContext.java | 8 + .../java/jaxx/runtime/JAXXContextEntryDef.java | 0 .../main/java/jaxx/runtime/JAXXInitialContext.java | 0 .../src/main/java/jaxx/runtime/JAXXObject.java | 0 .../java/jaxx/runtime/JAXXObjectDescriptor.java | 0 .../src/main/java/jaxx/runtime/JAXXValidator.java | 0 .../src/main/java/jaxx/runtime/JaxxHelpUI.java | 0 .../src/main/java/jaxx/runtime/SwingUtil.java | 35 +- .../src/main/java/jaxx/runtime/Util.java | 72 +-- .../main/java/jaxx/runtime/css/DataBinding.java | 0 .../main/java/jaxx/runtime/css/Pseudoclasses.java | 0 .../main/java/jaxx/runtime/swing/Application.java | 0 .../java/jaxx/runtime/swing/BlockingLayerUI.java | 0 .../java/jaxx/runtime/swing/BlockingLayerUI2.java | 0 .../jaxx/runtime/swing/BooleanCellRenderer.java | 0 .../main/java/jaxx/runtime/swing/CardLayout2.java | 0 .../java/jaxx/runtime/swing/CardLayout2Ext.java | 0 .../swing/EmptyNumberTableCellRenderer.java | 0 .../jaxx/runtime/swing/EnumTableCellRenderer.java | 0 .../src/main/java/jaxx/runtime/swing/GBC.java | 0 .../src/main/java/jaxx/runtime/swing/HBox.java | 0 .../main/java/jaxx/runtime/swing/HBoxLayout.java | 0 .../jaxx/runtime/swing/I18nTableCellRenderer.java | 0 .../src/main/java/jaxx/runtime/swing/Item.java | 0 .../java/jaxx/runtime/swing/JAXXButtonGroup.java | 0 .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXList.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXTab.java | 0 .../java/jaxx/runtime/swing/JAXXToggleButton.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXTree.java | 518 +++++++++--------- .../java/jaxx/runtime/swing/JaxxHelpBroker.java | 0 .../jaxx/runtime/swing/LocaleListCellRenderer.java | 0 .../jaxx/runtime/swing/MyDefaultCellEditor.java | 0 .../runtime/swing/OneClicListSelectionModel.java | 0 .../src/main/java/jaxx/runtime/swing/Spacer.java | 0 .../src/main/java/jaxx/runtime/swing/TabInfo.java | 0 .../swing/TabInfoPropertyChangeListener.java | 0 .../src/main/java/jaxx/runtime/swing/Table.java | 0 .../src/main/java/jaxx/runtime/swing/VBox.java | 0 .../main/java/jaxx/runtime/swing/VBoxLayout.java | 0 .../jaxx/runtime/swing/editor/ClassCellEditor.java | 0 .../java/jaxx/runtime/swing/editor/EnumEditor.java | 0 .../jaxx/runtime/swing/editor/LocaleEditor.java | 0 .../swing/navigation/ItemNavigationCardPanel.java | 39 +- .../swing/navigation/ItemNavigationPanel.java | 0 .../navigation/ItemTreeNavigationAdapter.java | 0 .../jaxx/runtime/swing/wizard/WizardModel.java | 0 .../swing/wizard/WizardOperationAction.java | 0 .../swing/wizard/WizardOperationActionThread.java | 0 .../runtime/swing/wizard/WizardOperationModel.java | 0 .../runtime/swing/wizard/WizardOperationState.java | 0 .../runtime/swing/wizard/WizardOperationStep.java | 0 .../java/jaxx/runtime/swing/wizard/WizardStep.java | 0 .../jaxx/runtime/swing/wizard/WizardStepUI.java | 0 .../java/jaxx/runtime/swing/wizard/WizardUI.java | 0 .../jaxx/runtime/swing/wizard/WizardUILancher.java | 0 .../java/jaxx/runtime/swing/wizard/WizardUtil.java | 0 .../java/jaxx/runtime/swing/wizard/package.html | 0 .../java/jaxx/runtime/validator/BeanValidator.java | 1 - .../runtime/validator/BeanValidatorDetector.java | 0 .../jaxx/runtime/validator/BeanValidatorEvent.java | 8 +- .../jaxx/runtime/validator/BeanValidatorField.java | 4 +- .../runtime/validator/BeanValidatorListener.java | 0 .../runtime/validator/BeanValidatorMessage.java | 12 +- .../jaxx/runtime/validator/BeanValidatorScope.java | 0 .../jaxx/runtime/validator}/BeanValidatorUtil.java | 2 +- .../jaxx/runtime/validator/XWorkBeanValidator.java | 9 +- .../field/CollectionFieldExpressionValidator.java | 0 .../field/CollectionUniqueKeyValidator.java | 0 .../field/ExistingDirectoryFieldValidator.java | 1 + .../field/ExistingFileFieldValidator.java | 1 + .../field/FieldExpressionWithParamsValidator.java | 0 .../field/NotExistingDirectoryFieldValidator.java | 0 .../field/NotExistingFileFieldValidator.java | 0 .../field/RequiredFileFieldValidator.java | 1 + .../runtime/validator/swing/SwingValidator.java | 4 +- .../validator/swing/SwingValidatorMessage.java | 4 +- .../swing/SwingValidatorMessageListModel.java | 8 +- .../SwingValidatorMessageListMouseListener.java | 0 .../swing/SwingValidatorMessageListRenderer.java | 1 - .../swing/SwingValidatorMessageTableModel.java | 20 +- .../SwingValidatorMessageTableMouseListener.java | 0 .../swing/SwingValidatorMessageTableRenderer.java | 1 - .../validator/swing}/SwingValidatorUtil.java | 5 +- .../swing/ui/AbstractBeanValidatorUI.java | 4 +- .../validator/swing/ui/IconValidationUI.java | 2 +- .../validator/swing/ui/ImageValidationUI.java | 2 +- .../swing/ui/TranslucentValidationUI.java | 2 +- .../resources/i18n/jaxx-runtime-en_GB.properties | 12 + .../resources/i18n/jaxx-runtime-fr_FR.properties | 3 + .../src/main/resources/icons/action-delete.png | Bin .../resources/icons/action-wizard-config-16.png | Bin .../main/resources/icons/action-wizard-config.png | Bin .../resources/icons/action-wizard-message-16.png | Bin .../main/resources/icons/action-wizard-message.png | Bin .../main/resources/icons/action-wizard-next-16.png | Bin .../main/resources/icons/action-wizard-next.png | Bin .../resources/icons/action-wizard-pause-16.png | Bin .../main/resources/icons/action-wizard-pause.png | Bin .../resources/icons/action-wizard-previous-16.png | Bin .../resources/icons/action-wizard-previous.png | Bin .../resources/icons/action-wizard-refresh-16.png | Bin .../main/resources/icons/action-wizard-refresh.png | Bin .../resources/icons/action-wizard-start-16.png | Bin .../main/resources/icons/action-wizard-start.png | Bin .../icons/action-wizard-state-canceled-16.png | Bin .../icons/action-wizard-state-canceled.png | Bin .../icons/action-wizard-state-failed-16.png | Bin .../resources/icons/action-wizard-state-failed.png | Bin .../icons/action-wizard-state-need_fix-16.png | Bin .../icons/action-wizard-state-need_fix.png | Bin .../icons/action-wizard-state-pending-16.png | Bin .../icons/action-wizard-state-pending.png | Bin .../icons/action-wizard-state-running-16.png | Bin .../icons/action-wizard-state-running.png | Bin .../icons/action-wizard-state-successed-16.png | Bin .../icons/action-wizard-state-successed.png | Bin .../src/main/resources/icons/error.png | Bin .../src/main/resources/icons/info.png | Bin .../src/main/resources/icons/warning.png | Bin .../src/main/resources/validators.xml | 0 .../src/site/site.xml | 0 .../runtime/DefaultApplicationContextTest.java | 0 .../java/jaxx/runtime/DefaultJAXXContextTest.java | 0 .../src/test/java/jaxx/runtime/UtilTest.java | 0 .../AbstractBeanValidatorDetectorTest.java | 0 .../validator/BeanValidatorDetectorTest.java | 0 .../jaxx/runtime/validator/BeanValidatorTest.java | 0 .../java/jaxx/runtime/validator/SimpleBean.java | 0 .../runtime/validator/XWorkBeanValidatorTest.java | 0 .../field/AbstractFieldValidatorTest.java | 0 .../AbstractValidatorBeanFieldValidatorTest.java | 0 .../CollectionFieldExpressionValidatorTest.java | 0 .../field/CollectionUniqueKeyValidatorTest.java | 0 .../field/ExistingDirectoryFieldValidatorTest.java | 0 .../field/ExistingFileFieldValidatorTest.java | 0 .../validator/field/FieldExpressionBean.java | 0 .../FieldExpressionWithParamsValidatorTest.java | 0 .../NotExistingDirectoryFieldValidatorTest.java | 0 .../field/NotExistingFileFieldValidatorTest.java | 0 .../field/RequiredFileFieldValidatorTest.java | 0 .../runtime/validator/field/ValidatorBean.java | 0 .../validator/SimpleBean-error-validation.xml | 0 .../validator/SimpleBean-info-validation.xml | 0 .../validator/SimpleBean-simple-validation.xml | 0 .../validator/SimpleBean-warning-validation.xml | 0 .../field/FieldExpressionBean-error-validation.xml | 0 .../field/ValidatorBean-error-validation.xml | 0 .../src/test/resources/log4j.properties | 2 +- .../src/test/resources/validators.xml | 0 jaxx-swing-action/pom.xml | 8 +- {jaxx-runtime-api => jaxx-widgets}/LICENSE.txt | 0 {jaxx-runtime-api => jaxx-widgets}/README.txt | 0 .../changelog.txt | 0 .../pom.xml | 16 +- .../main/java/jaxx/runtime/swing/AboutPanel.jaxx | 0 .../main/java/jaxx/runtime/swing/ClockWidget.jaxx | 0 .../java/jaxx/runtime/swing/EntityComboBox.jaxx | 3 +- .../jaxx/runtime/swing/EntityComboBoxHandler.java | 15 +- .../java/jaxx/runtime/swing/ErrorDialogUI.jaxx | 0 .../jaxx/runtime/swing/MemoryStatusWidget.jaxx | 0 .../jaxx/runtime/swing/StatusMessagePanel.jaxx | 0 .../runtime/swing/StatusMessagePanelHandler.java | 0 .../jaxx/runtime/swing/editor/ColumnSelector.jaxx | 0 .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 0 .../jaxx/runtime/swing/editor/NumberEditor.jaxx | 0 .../runtime/swing/editor/NumberEditorHandler.java | 0 .../runtime/swing/editor/NumberEditorPopup.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.jaxx | 0 .../runtime/swing/editor/TimeEditorHandler.java | 0 .../swing/editor/config/ConfigCategoryUI.css | 0 .../swing/editor/config/ConfigCategoryUI.jaxx | 0 .../swing/editor/config/ConfigTableEditor.java | 0 .../swing/editor/config/ConfigTableRenderer.java | 0 .../jaxx/runtime/swing/editor/config/ConfigUI.css | 0 .../jaxx/runtime/swing/editor/config/ConfigUI.jaxx | 0 .../swing/editor/config/ConfigUIBuilder.java | 0 .../swing/editor/config/model/CategoryModel.java | 0 .../editor/config/model/ConfigTableModel.java | 0 .../swing/editor/config/model/ConfigUIModel.java | 0 .../swing/editor/config/model/OptionModel.java | 0 .../jaxx-runtime-swing-widget-en_GB.properties | 3 +- .../jaxx-runtime-swing-widget-fr_FR.properties | 3 +- .../main/resources/icons/action-config-quit.png | Bin .../main/resources/icons/action-config-reset.png | Bin .../main/resources/icons/action-config-save.png | Bin .../src/main/resources/icons/action-i18n-be.png | Bin .../src/main/resources/icons/action-i18n-ca.png | Bin .../src/main/resources/icons/action-i18n-ch.png | Bin .../src/main/resources/icons/action-i18n-de.png | Bin .../src/main/resources/icons/action-i18n-dk.png | Bin .../src/main/resources/icons/action-i18n-es.png | Bin .../src/main/resources/icons/action-i18n-fi.png | Bin .../src/main/resources/icons/action-i18n-fr.png | Bin .../src/main/resources/icons/action-i18n-gb.png | Bin .../src/main/resources/icons/action-i18n-it.png | Bin .../src/main/resources/icons/action-i18n-nl.png | Bin .../src/main/resources/icons/action-i18n-no.png | Bin .../src/main/resources/icons/action-i18n-se.png | Bin .../src/main/resources/icons/action-i18n-us.png | Bin .../icons/action-numbereditor-calculator.png | Bin .../resources/icons/action-numbereditor-reset.png | Bin .../icons/action-numbereditor-validate.png | Bin .../src/site/rst/images/Components-screenshot.gif | Bin .../src/site/rst/images/webstart.gif | Bin .../src/site/rst/index.rst | 0 .../src/site/site.xml | 0 maven-jaxx-plugin/pom.xml | 364 ++++++++++++- .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 40 -- .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 28 +- .../SpecialSubclassing/JComboBoxTest1.jaxx | 4 +- .../SpecialSubclassing/JComboBoxTest2.jaxx | 4 +- pom.xml | 15 +- 389 files changed, 1889 insertions(+), 9421 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 5b9c73a..4ce78f2 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,16 +22,10 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - <version>${project.version}</version> - </dependency> - + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -43,8 +37,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx compiler api</description> + <name>JAXX Compiler</name> + <description>JAXX Compiler api</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java index cdd4663..e849f42 100644 --- a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java @@ -4,64 +4,29 @@ */ package jaxx; -import jaxx.tags.swing.JTextComponentHandler; -import jaxx.tags.swing.JTabbedPaneHandler; -import jaxx.tags.swing.TabHandler; -import jaxx.tags.swing.CellHandler; -import jaxx.tags.swing.JComboBoxHandler; -import jaxx.tags.swing.JSliderHandler; -import jaxx.tags.swing.RowHandler; -import jaxx.tags.swing.JSpinnerHandler; -import jaxx.tags.swing.TableHandler; -import jaxx.tags.swing.JScrollPaneHandler; -import jaxx.tags.swing.JProgressBarHandler; -import jaxx.tags.swing.JInternalFrameHandler; -import jaxx.tags.swing.JToolBarHandler; -import jaxx.tags.swing.JRadioButtonHandler; -import jaxx.tags.swing.JSplitPaneHandler; -import jaxx.tags.swing.LocaleEditorHandler; -import jaxx.tags.swing.JCheckBoxHandler; -import jaxx.tags.swing.EnumEditorHandler; -import jaxx.tags.swing.JWindowHandler; -import jaxx.tags.swing.JAXXTabHandler; -import jaxx.tags.swing.JPasswordFieldHandler; -import jaxx.tags.swing.ApplicationHandler; -import jaxx.tags.swing.JMenuHandler; -import jaxx.tags.swing.ItemHandler; -import jaxx.tags.swing.JListHandler; -import jaxx.tags.swing.JPopupMenuHandler; -import jaxx.tags.swing.JTreeHandler; -import jaxx.tags.swing.*; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Application; -import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.runtime.swing.JAXXComboBox; -import jaxx.runtime.swing.JAXXList; -import jaxx.runtime.swing.JAXXTab; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.Table; -import jaxx.spi.Initializer; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; -import jaxx.types.ColorConverter; -import jaxx.types.GridBagConstraintsConverter; -import jaxx.types.InsetsConverter; -import jaxx.types.KeyStrokeConverter; -import jaxx.types.TypeManager; import jaxx.beaninfos.BeanInfoUtil; -import javax.swing.*; -import javax.swing.text.JTextComponent; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.Insets; +import jaxx.compiler.JAXXCompiler; import jaxx.compiler.BoxedCompiledObjectDecorator; import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.HelpRootCompiledObjectDecorator; + +import jaxx.reflect.ClassDescriptorLoader; + import jaxx.runtime.swing.editor.EnumEditor; import jaxx.runtime.swing.editor.LocaleEditor; +import jaxx.spi.Initializer; + +import jaxx.runtime.swing.*; +import jaxx.tags.*; +import jaxx.tags.swing.*; +import jaxx.types.*; + +import java.awt.*; +import javax.swing.text.JTextComponent; +import javax.swing.*; + public class SwingInitializer implements Initializer { @Override @@ -69,15 +34,21 @@ public class SwingInitializer implements Initializer { BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); - TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); + //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing + TagManager.registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); +// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), EnumEditorHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), LocaleEditorHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); - TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + //TC-20091005 : JAXXComboBox and JComboBox are not the same +// TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); +// TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JComboBox.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JAXXComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 6a22bb0..b34cd3a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -371,6 +371,7 @@ public class JAXXCompiler { final String finalClassName = fullClassName; registerInitializer(new Runnable() { // register an initializer which will create the CompiledObject after pass 1 + @Override public void run() { DefaultObjectHandler handler = (DefaultObjectHandler) TagManager.getTagHandler(null, finalClassName, JAXXCompiler.this); if (handler == null) { @@ -725,15 +726,15 @@ public class JAXXCompiler { lineNumber = lineAttr; } } - File src = sourceFiles.peek(); + File srcFile = sourceFiles.peek(); try { - src = src.getCanonicalFile(); + srcFile = srcFile.getCanonicalFile(); } catch (IOException e) { // ignore ? } - System.err.print(src); + System.err.print(srcFile); if (lineNumber != null) { System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); } @@ -789,17 +790,17 @@ public class JAXXCompiler { } public void reportError(int lineNumber, String error) { - File src = sourceFiles.isEmpty() ? null : sourceFiles.peek(); + File errorFile = sourceFiles.isEmpty() ? null : sourceFiles.peek(); try { - if (src != null) { - src = src.getCanonicalFile(); + if (errorFile != null) { + errorFile = errorFile.getCanonicalFile(); } } catch (IOException e) { // ignore ? } - System.err.print(src != null ? src.getPath() : "<unknown source>"); + System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>"); if (lineNumber > 0) { System.err.print(":" + lineNumber); } @@ -970,12 +971,12 @@ public class JAXXCompiler { components[i].getStyleClass(), parentIndex != -1 ? descriptors[parentIndex] : null); } - Stylesheet stylesheet = getStylesheet(); - if (stylesheet == null) { - stylesheet = new Stylesheet(); + Stylesheet css = getStylesheet(); + if (css == null) { + css = new Stylesheet(); } - return new JAXXObjectDescriptor(descriptors, stylesheet); + return new JAXXObjectDescriptor(descriptors, css); } /*---------------------------------------------------------------------------------*/ @@ -1227,6 +1228,7 @@ public class JAXXCompiler { break; } else { reportError("error parsing parameter list: " + parameters); + break; } default: current.append(c); @@ -1381,7 +1383,7 @@ public class JAXXCompiler { } // 1.5 adds getCanonicalName; unfortunately we can't depend on 1.5 features yet - public static String getCanonicalName(Class clazz) { + public static String getCanonicalName(Class<?> clazz) { if (clazz.isArray()) { String canonicalName = getCanonicalName(clazz.getComponentType()); if (canonicalName != null) { @@ -1496,14 +1498,17 @@ public class JAXXCompiler { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setErrorListener(new ErrorListener() { + @Override public void warning(TransformerException ex) throws TransformerException { throw ex; } + @Override public void error(TransformerException ex) throws TransformerException { throw ex; } + @Override public void fatalError(TransformerException ex) throws TransformerException { throw ex; } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java index 4b68988..4a63e97 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java @@ -183,9 +183,9 @@ public class DefaultComponentHandler extends DefaultObjectHandler { return ""; } if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame) - String containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); - if (containerDelegate != null) { - return id + '.' + containerDelegate + "().setLayout(" + valueCode + ");"; + String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); + if (cDelegate != null) { + return id + '.' + cDelegate + "().setLayout(" + valueCode + ");"; } } // ajout du support i18n diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java index 584b771..538a8dc 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java @@ -57,21 +57,17 @@ import jaxx.compiler.CompiledObjectDecorator; * name of a property (e.g. <code>"document"</code>). */ public class DefaultObjectHandler implements TagHandler { + /** The class that this handler provides support for. */ private ClassDescriptor beanClass; - /** The JAXXBeanInfo for the beanClass. */ protected JAXXBeanInfo jaxxBeanInfo; - /** Maps property names to their respective JAXXPropertyDescriptors. */ private Map<String, JAXXPropertyDescriptor> properties; - /** Maps event names to their respective JAXXEventSetDescriptors. */ private Map<String, JAXXEventSetDescriptor> events; - /** Maps property names to their respective ProxyEventInfos. */ private Map<String, ProxyEventInfo> eventInfos; - /** Maps XML tags to the CompiledObjects created from them. */ protected static Map<Element, CompiledObject> objectMap = new WeakHashMap<Element, CompiledObject>(); @@ -82,12 +78,11 @@ public class DefaultObjectHandler implements TagHandler { * normally throw something else, like <code>DocumentEvent</code>. */ private class ProxyEventInfo { + /** The name of the method or field being proxied, e.g. "getText". */ String memberName; - /** The "actual" event listener for the property in question, e.g. DocumentListener. */ ClassDescriptor listenerClass; - /** * In cases where a different object (such as a model) is more directly responsible for * managing the property, this is the name of the property where that object can be @@ -97,15 +92,12 @@ public class DefaultObjectHandler implements TagHandler { * attached to the new value, and the data binding to be processed. */ String modelName; - /** The name of the method used to add the "native" event listener, e.g. "addDocumentListener". */ String addMethod; - /** The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". */ String removeMethod; } - /** * Creates a new <code>DefaultObjectHandler</code> which provides support for the specified class. The * class is not actually introspected until the {@link #compileFirstPass} method is invoked. @@ -116,7 +108,6 @@ public class DefaultObjectHandler implements TagHandler { this.beanClass = beanClass; } - /** * Performs introspection on the beanClass and stores the results. * @@ -147,7 +138,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns * @@ -157,7 +147,6 @@ public class DefaultObjectHandler implements TagHandler { return beanClass; } - /** * @return the <code>JAXXBeanInfo</code> for the class which this <code>DefaultObjectHandler</code> * supports. @@ -171,7 +160,6 @@ public class DefaultObjectHandler implements TagHandler { return jaxxBeanInfo; } - /** * Returns the <code>JAXXBeanInfo</code> for the specified class. * @@ -184,7 +172,6 @@ public class DefaultObjectHandler implements TagHandler { return JAXXIntrospector.getJAXXBeanInfo(beanClass); } - /** * Returns the type of the named property. This is the return type of the property's <code>get</code> method; * for instance <code>JLabel</code>'s <code>text</code> property is a <code>String</code>. @@ -209,7 +196,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + propertyName + "' not found in " + object); } - /** * @param name ? * @return <code>true</code> if the named member is <i>bound</i> (fires <code>PropertyChangeEvent</code> @@ -253,12 +239,10 @@ public class DefaultObjectHandler implements TagHandler { } } - private static ClassDescriptor getEventClass(ClassDescriptor listenerClass) { return listenerClass.getMethodDescriptors()[0].getParameterTypes()[0]; } - /** * @param memberName name of the member * @return an array of members on which the given property depends. For @@ -270,7 +254,6 @@ public class DefaultObjectHandler implements TagHandler { return eventInfo == null ? null : new String[]{eventInfo.modelName}; } - /** * Returns a snippet of Java code which will cause a <code>PropertyChangeListener</code> to be notified * when the member's value changes. The <code>PropertyChangeListener</code> is provided in the form @@ -342,7 +325,6 @@ public class DefaultObjectHandler implements TagHandler { } } - public String getRemoveMemberListenerCode(String objectCode, String dataBinding, String memberName, String propertyChangeListenerCode, JAXXCompiler compiler) { if ("getClass".equals(memberName)) { return null; @@ -370,8 +352,7 @@ public class DefaultObjectHandler implements TagHandler { compiler)); } return result.toString(); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new CompilerException("Internal error: " + e); } } else { @@ -403,7 +384,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Configures the event handling for members which do not fire <code>PropertyChangeEvent</code> when * modified. The default implementation does nothing. Subclasses should override this method to call @@ -412,7 +392,6 @@ public class DefaultObjectHandler implements TagHandler { protected void configureProxyEventInfo() { } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -427,11 +406,10 @@ public class DefaultObjectHandler implements TagHandler { * @param memberName the name of the field or method being proxied * @param listenerClass the type of listener which receives events when the field or method is updated */ - public void addProxyEventInfo(String memberName, Class listenerClass) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass) { addProxyEventInfo(memberName, listenerClass, null); } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -453,16 +431,15 @@ public class DefaultObjectHandler implements TagHandler { * @param listenerClass the type of listener which receives events when the field or method is updated * @param modelName the JavaBeans-style name of the model property */ - public void addProxyEventInfo(String memberName, Class listenerClass, String modelName) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass, String modelName) { String listenerName = listenerClass.getName(); listenerName = listenerName.substring(listenerName.lastIndexOf(".") + 1); addProxyEventInfo(memberName, listenerClass, modelName, "add" + listenerName, "remove" + listenerName); } - // TODO: remove this temporary method, complete switchover to ClassDescriptors - public void addProxyEventInfo(String memberName, Class listenerClass, - String modelName, String addMethod, String removeMethod) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass, + String modelName, String addMethod, String removeMethod) { try { addProxyEventInfo(memberName, ClassDescriptorLoader.getClassDescriptor(listenerClass.getName()), modelName, addMethod, removeMethod); } catch (ClassNotFoundException e) { @@ -470,7 +447,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -499,7 +475,7 @@ public class DefaultObjectHandler implements TagHandler { * @param removeMethod remove method name */ public void addProxyEventInfo(String memberName, ClassDescriptor listenerClass, - String modelName, String addMethod, String removeMethod) { + String modelName, String addMethod, String removeMethod) { ProxyEventInfo info = new ProxyEventInfo(); info.memberName = memberName; info.listenerClass = listenerClass; @@ -512,14 +488,12 @@ public class DefaultObjectHandler implements TagHandler { eventInfos.put(memberName, info); } - @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { scanAttributesForDependencies(tag, compiler); compileChildrenFirstPass(tag, compiler); } - @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { try { @@ -548,7 +522,6 @@ public class DefaultObjectHandler implements TagHandler { compileChildrenSecondPass(tag, compiler); } - public void registerCompiledObject(Element tag, JAXXCompiler compiler) { String id = tag.getAttribute("id"); if (id == null || id.length() == 0) { @@ -563,7 +536,6 @@ public class DefaultObjectHandler implements TagHandler { compiler.registerCompiledObject(object); } - /** * Creates the <code>CompiledObject</code> which will represent the object created by this <code>TagHandler</code>. * @@ -575,7 +547,6 @@ public class DefaultObjectHandler implements TagHandler { return new CompiledObject(id, getBeanClass(), compiler); } - /** * Initializes the default settings of the object, prior to setting its attribute values. The default * implementation does nothing. @@ -587,7 +558,6 @@ public class DefaultObjectHandler implements TagHandler { protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) { } - /** * @param property property name to test * @return <code>true</code> if the specified property should be inherited by child components when specified @@ -599,7 +569,6 @@ public class DefaultObjectHandler implements TagHandler { return false; } - /** * @param name name of event * @return <code>true</code> if the specified name has the form of an event handler attribute @@ -609,7 +578,6 @@ public class DefaultObjectHandler implements TagHandler { return name.length() > 2 && name.startsWith("on") && Character.isUpperCase(name.charAt(2)); } - /** * Scans all attributes for any dependency classes and adds them to the current compilation * set. Called by <code>compileFirstPass()</code> (it is an error to add dependencies after @@ -632,7 +600,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("javaBean")) { //compiler.preprocessScript(value); continue; - } + } if (name.equals("constraints") || isEventHandlerName(name)) { compiler.preprocessScript(value); // adds dependencies as a side effect } else if (name.equals("constructorParams")) { @@ -645,7 +613,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Processes the attributes of an XML tag. Four kinds of attributes are supported: simple property values (of any * datatype supported by {@link #convertFromString}), data binding expressions (attributes containing curly-brace @@ -663,7 +630,7 @@ public class DefaultObjectHandler implements TagHandler { attributes.add((Attr) children.item(i)); } Collections.sort(attributes, getAttributeComparator()); - + for (Attr attribute : attributes) { String name = attribute.getName(); String value = attribute.getValue().trim(); @@ -702,7 +669,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("genericType")) { //TC-20090313 check after all atributes been processed - if (object == compiler.getRootObject() ) { + if (object == compiler.getRootObject()) { compiler.setGenericType(value); } else { object.setGenericTypes(value.split(",")); @@ -741,7 +708,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns a <code>Comparator</code> which defines the ordering in which the tag's attributes should be processed. The * default implementation sorts the attributes according to the order defined by the {@link #getAttributeOrdering} method. @@ -750,6 +716,7 @@ public class DefaultObjectHandler implements TagHandler { */ protected Comparator<Attr> getAttributeComparator() { return new Comparator<Attr>() { + @Override public int compare(Attr a, Attr b) { int aOrder = getAttributeOrdering(a); @@ -760,7 +727,6 @@ public class DefaultObjectHandler implements TagHandler { }; } - /** * Returns the priority with which a particular attribute should be processed. Lower numbers should be processed before * higher numbers. This value is used by the {@link #getAttributeComparator} method to define the sort ordering. @@ -775,7 +741,6 @@ public class DefaultObjectHandler implements TagHandler { return 0; } - public String getApplyPropertyOrDataBindingCode(CompiledObject object, String propertyName, String stringValue, JAXXCompiler compiler) { ClassDescriptor type = getPropertyType(object, propertyName, compiler); String binding = compiler.processDataBindings(stringValue, type); @@ -783,7 +748,7 @@ public class DefaultObjectHandler implements TagHandler { return ""; } try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); return getSetPropertyCode(object.getJavaCode(), propertyName, TypeManager.getJavaCode(value), compiler); } catch (NumberFormatException e) { @@ -796,7 +761,6 @@ public class DefaultObjectHandler implements TagHandler { return ""; } - /** * Set a single property on an object. The value may be either a simple value or contain data binding expressions. * Simple values are first converted to the property's type using {@link #convertFromString}. @@ -843,7 +807,7 @@ public class DefaultObjectHandler implements TagHandler { compiler.addInlineStyle(object, propertyName, false); } try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); setProperty(object, propertyName, value, compiler); } catch (NumberFormatException e) { @@ -859,17 +823,14 @@ public class DefaultObjectHandler implements TagHandler { } } - public void applyStylesheets(CompiledObject object, JAXXCompiler compiler) { applyStylesheets(object, compiler, null); } - private void applyStylesheets(final CompiledObject object, JAXXCompiler compiler, Stylesheet overrides) { applyStylesheets(object, compiler, overrides, true); } - private void applyStylesheets(final CompiledObject object, JAXXCompiler compiler, Stylesheet overrides, boolean recurse) { try { Stylesheet stylesheet = compiler.getStylesheet(); @@ -883,7 +844,7 @@ public class DefaultObjectHandler implements TagHandler { String id = isRoot ? object.getId() + ' ' + descriptor.getId() : "( " + object.getId() + " ) " + descriptor.getId(); CompiledObject child = new CompiledObject(id, "((" + JAXXCompiler.getCanonicalName(classDescriptor) + ") " + - object.getJavaCode() + ".getObjectById(" + TypeManager.getJavaCode(descriptor.getId()) + "))", + object.getJavaCode() + ".getObjectById(" + TypeManager.getJavaCode(descriptor.getId()) + "))", classDescriptor, compiler, true); @@ -916,15 +877,13 @@ public class DefaultObjectHandler implements TagHandler { } else if (stylesheet != null) { StylesheetHelper.applyTo(object, compiler, stylesheet, overrides); } - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new CompilerException(e); } catch (IllegalArgumentException e) { compiler.reportError(e.getMessage()); } } - /** * Adds the necessary Java code to a <code>CompiledObject</code> to add an event listener at runtime. * @@ -958,7 +917,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns a snippet of Java code which will retrieve an object property at runtime. Typically the code is * just a call to the property's <code>get</code> method, but it can be arbitrarily complex. @@ -986,7 +944,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + name + "' could not be found in class " + getBeanClass().getName()); } - /** * Returns a snippet of Java code which will set an object property at runtime. Typically the code is * just a call to the property's <code>set</code> method, but it can be arbitrarily complex. @@ -1009,7 +966,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + name + "' could not be found in class " + getBeanClass().getName()); } - /** * Appends Java code to a <code>CompiledObject</code> in order to implement a property assignment. * <code>setProperty</code> is invoked in response to most XML attributes (those which are not more @@ -1029,7 +985,6 @@ public class DefaultObjectHandler implements TagHandler { object.appendInitializationCode(getSetPropertyCode(object.getJavaCodeForProperty(name), name, TypeManager.getJavaCode(value), compiler)); } - /** * Maps string values onto integers, so that int-valued enumeration properties can be specified by strings. For * example, when passed a key of 'alignment', this method should normally map the values 'left', 'center', and @@ -1074,7 +1029,6 @@ public class DefaultObjectHandler implements TagHandler { throw new NumberFormatException(value); } - /** * As {@link TypeManager#convertFromString(String, Class)}, except that it additionally supports constant names * for <code>int</code>-valued types. @@ -1085,7 +1039,7 @@ public class DefaultObjectHandler implements TagHandler { * @return the converted object * @see #constantValue */ - protected Object convertFromString(String key, String value, Class type) { + protected Object convertFromString(String key, String value, Class<?> type) { if (type == null || type == Object.class) { return value; } @@ -1100,7 +1054,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. @@ -1122,7 +1075,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. @@ -1149,7 +1101,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileFirstPass}. @@ -1163,7 +1114,6 @@ public class DefaultObjectHandler implements TagHandler { compiler.compileFirstPass(tag); } - /** * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileSecondPass}. @@ -1181,4 +1131,4 @@ public class DefaultObjectHandler implements TagHandler { public String toString() { return getClass().getName() + "[" + getBeanClass().getName() + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java index 8c2090b..d4ae0f0 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java @@ -53,8 +53,9 @@ public class TagManager { private String localPart; public QName(String namespaceURI, String localPart) { - if (localPart == null) + if (localPart == null) { throw new NullPointerException(); + } this.namespaceURI = namespaceURI; this.localPart = localPart; } @@ -71,8 +72,9 @@ public class TagManager { @Override public boolean equals(Object o) { - if (o == null || !(o instanceof QName)) + if (o == null || !(o instanceof QName)) { return false; + } QName qname = (QName) o; return qname.getNamespaceURI().equals(getNamespaceURI()) && qname.getLocalPart().equals(getLocalPart()); } @@ -101,6 +103,7 @@ public class TagManager { * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified * <code>TagHandler</code> will be invoked to compile it. * + * @param <T> * @param beanClass the class to associate with a <code>TagHandler</code> * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code> * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code> @@ -152,6 +155,7 @@ public class TagManager { * It is not an error to register an already-registered tag and namespace combination. The new mapping * will replace the old mapping. * + * @param <T> * @param namespace the tag's namespace * @param tag the simple name of the tag * @param handler the <code>TagHandler</code> which should process the tag @@ -385,15 +389,18 @@ public class TagManager { * @return the resolved fqn class name */ public static String resolveClassName(String name, JAXXCompiler compiler) { - if (name.endsWith("[]")) + if (name.endsWith("[]")) { return resolveClassName(name.substring(0, name.length() - 2), compiler) + "[]"; - if (name.indexOf("<") != -1) + } + if (name.indexOf("<") != -1) { name = name.substring(0, name.indexOf("<")); // strip off generic types + } name = name.intern(); if (name.equals("boolean") || name.equals("byte") || name.equals("short") || name.equals("int") || - name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char")) + name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char")) { return name; + } String result = null; String originalName = name; @@ -452,14 +459,16 @@ public class TagManager { // else we found a class by the same name, but in the wrong package } - if (dotPos <= 0) + if (dotPos <= 0) { break; + } dotPos = originalName.lastIndexOf('.', dotPos - 1); } } - if (result != null && !result.equals(originalName)) + if (result != null && !result.equals(originalName)) { result = resolveClassName(result, compiler); // check for aliases against the new name as well + } return result; } @@ -468,8 +477,9 @@ public class TagManager { public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { try { className = resolveClassName(className, compiler); - if (className == null) + if (className == null) { return null; + } return ClassDescriptorLoader.getClassDescriptor(className, compiler.getClassLoader()); } catch (ClassNotFoundException e) { diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java deleted file mode 100644 index fda7b29..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; - -import java.awt.event.ItemListener; -import jaxx.runtime.swing.editor.EnumEditor; - -public class EnumEditorHandler extends DefaultComponentHandler { - - public EnumEditorHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, EnumEditor.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ItemListener.class); - addProxyEventInfo("getSelectedItem", ItemListener.class); - } - - @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } -// @Override -// public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { -// super.compileChildrenSecondPass(tag, compiler); -// CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); -// List<Item> items = list.getItems(); -// if (items != null && !items.isEmpty()) { -// String listName = list.getId() + "$items"; -// list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); -// for (Item item : items) { -// String id = item.getId(); -// CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); -// compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); -// compiler.registerCompiledObject(compiledItem); -// list.appendAdditionCode(listName + ".add(" + id + ");"); -// } -// list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); -// } -// } -} - - - diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java index 9de9b60..fa491a3 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java @@ -24,14 +24,17 @@ import java.util.List; public class ItemHandler implements TagHandler { private String DATA_BINDING = "<data binding has not been processed yet>"; + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { String id = tag.getAttribute("id"); - if (id == null || id.length() == 0) + if (id == null || id.length() == 0) { id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class)); + } String label = null; String value = null; boolean selected = false; @@ -47,10 +50,12 @@ public class ItemHandler implements TagHandler { } if (name.equals(Item.LABEL_PROPERTY)) { String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); - if (labelBinding != null) + if (labelBinding != null) { compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); - else + } + else { label = attrValue; + } continue; } if (name.equals(Item.VALUE_PROPERTY)) { @@ -58,16 +63,19 @@ public class ItemHandler implements TagHandler { if (valueBinding != null) { value = DATA_BINDING; compiler.registerDataBinding(valueBinding, id + ".value", id + ".setValue(" + valueBinding + ");"); - } else + } else { value = attrValue; + } continue; } if (name.equals(Item.SELECTED_PROPERTY)) { String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); - if (selectedBinding != null) + if (selectedBinding != null) { compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); - else + } + else { selected = (Boolean) TypeManager.convertFromString(attrValue, Boolean.class); + } continue; } @@ -78,8 +86,9 @@ public class ItemHandler implements TagHandler { Item item = new Item(id, label, value, selected); CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - if (value == null) + if (value == null) { compiler.reportError("<item> tag is missing required 'value' attribute"); + } else { if (!value.equals(DATA_BINDING)) { List<Item> items = list.getItems(); @@ -108,8 +117,9 @@ public class ItemHandler implements TagHandler { } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); - if (text.length() > 0) + if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } } } } @@ -126,8 +136,9 @@ public class ItemHandler implements TagHandler { } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); - if (text.length() > 0) + if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java index 56a1d8d..456ef98 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java @@ -4,26 +4,23 @@ */ package jaxx.tags.swing; +import java.io.IOException; import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXComboBox; import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; -import org.w3c.dom.Element; import java.awt.event.ItemListener; -import java.io.IOException; -import java.util.List; +import javax.swing.JComboBox; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; public class JComboBoxHandler extends DefaultComponentHandler { public JComboBoxHandler(ClassDescriptor beanClass) { super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXComboBox.class); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JComboBox.class); } @Override @@ -34,26 +31,10 @@ public class JComboBoxHandler extends DefaultComponentHandler { } @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - @Override public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = list.getItems(); - if (items != null && !items.isEmpty()) { - String listName = list.getId() + "$items"; - list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - list.appendAdditionCode(listName + ".add(" + id + ");"); - } - list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); + NodeList children = tag.getChildNodes(); + if (children.getLength() > 0) { + compiler.reportError("JComboBox does not accept childs"); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java index 195bf5c..a09a73d 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java @@ -17,29 +17,32 @@ import javax.swing.JSlider; import javax.swing.event.ChangeListener; public class JSliderHandler extends DefaultComponentHandler { + public JSliderHandler(ClassDescriptor beanClass) { super(beanClass); - if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) + if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) { throw new IllegalArgumentException(getClass().getName() + " does not support the class " + beanClass.getName()); + } } - + @Override protected int getAttributeOrdering(Attr attr) { - if (attr.getName().equals("value")) + if (attr.getName().equals("value")) { return 1; - else + } else { return super.getAttributeOrdering(attr); + } } - - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { super.setDefaults(object, tag, compiler); setAttribute(object, "value", "0", false, compiler); } - + @Override protected void configureProxyEventInfo() { super.configureProxyEventInfo(); addProxyEventInfo("getValue", ChangeListener.class, "model"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java index b5ae451..22a4c91 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java @@ -53,7 +53,7 @@ public class JWindowHandler extends DefaultComponentHandler { public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { super.compileSecondPass(tag, compiler); CompiledObject object = objectMap.get(tag); - Map properties = object.getProperties(); + Map<?,?> properties = object.getProperties(); if (!properties.containsKey("width") && !properties.containsKey("height")) { compiler.appendLateInitializer(object.getId() + ".pack();\n"); } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java deleted file mode 100644 index 256db56..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; - -import java.awt.event.ItemListener; -import jaxx.runtime.swing.editor.LocaleEditor; - -public class LocaleEditorHandler extends DefaultComponentHandler { - - public LocaleEditorHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, LocaleEditor.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ItemListener.class); - addProxyEventInfo("getSelectedItem", ItemListener.class); - } - - @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } -// @Override -// public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { -// super.compileChildrenSecondPass(tag, compiler); -// CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); -// List<Item> items = list.getItems(); -// if (items != null && !items.isEmpty()) { -// String listName = list.getId() + "$items"; -// list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); -// for (Item item : items) { -// String id = item.getId(); -// CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); -// compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); -// compiler.registerCompiledObject(compiledItem); -// list.appendAdditionCode(listName + ".add(" + id + ");"); -// } -// list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); -// } -// } -} - - - diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java index 61e1db8..a5db9a9 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java @@ -18,10 +18,13 @@ import java.awt.GridBagConstraints; import java.io.IOException; public class RowHandler implements TagHandler { + + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (!ClassDescriptorLoader.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { compiler.reportError("row tag may only appear within Table tag"); @@ -82,4 +85,4 @@ public class RowHandler implements TagHandler { protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileSecondPass(tag); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java index 913c9cc..a8b3b0f 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java @@ -26,11 +26,13 @@ import java.io.IOException; public class TabHandler implements TagHandler { + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { compiler.reportError("tab tag may only appear within JTabbedPane tag"); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java index c59423e..c4bd76d 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java @@ -11,7 +11,7 @@ import jaxx.introspection.JAXXBeanInfo; import jaxx.introspection.JAXXPropertyDescriptor; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidatorUtil; import jaxx.runtime.validator.swing.SwingValidator; import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; import jaxx.tags.DefaultObjectHandler; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java index 70aaafa..fbb6141 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java @@ -25,6 +25,7 @@ public class ExcludeFieldValidatorHandler implements TagHandler { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(ExcludeFieldValidatorHandler.class); + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); @@ -32,6 +33,7 @@ public class ExcludeFieldValidatorHandler implements TagHandler { //todo check there is no child } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.debug(tag); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java index 1a3167f..d5864ff 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java @@ -25,6 +25,7 @@ public class FieldValidatorHandler implements TagHandler { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(FieldValidatorHandler.class); + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); @@ -32,6 +33,7 @@ public class FieldValidatorHandler implements TagHandler { //todo check there is no child } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); diff --git a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java b/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java index 5852bb9..057f278 100644 --- a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java +++ b/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java @@ -21,7 +21,7 @@ public class BeanIntoUtilTest { BeanInfoUtil.reset(); Assert.assertEquals(searchPath0.length, Introspector.getBeanInfoSearchPath().length); - String packageName = getClass().getPackage().getName()+".dummy"; + String packageName = getClass().getPackage().getName() + ".dummy"; BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos", packageName); searchPath = Introspector.getBeanInfoSearchPath(); diff --git a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java b/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java index 446a4ac..0055cb6 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java @@ -135,8 +135,10 @@ public class TagManagerTest { @Test public void testAliasing() { - Assert.assertEquals("JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("JComboBox", compiler)); - Assert.assertEquals("javax.swing.JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("javax.swing.JComboBox", compiler)); + Assert.assertEquals("ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("ButtonGroup", compiler)); + Assert.assertEquals("javax.swing.ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("javax.swing.ButtonGroup", compiler)); +// Assert.assertEquals("JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("JComboBox", compiler)); +// Assert.assertEquals("javax.swing.JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("javax.swing.JComboBox", compiler)); } diff --git a/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java b/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java deleted file mode 100644 index 90564a7..0000000 --- a/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java +++ /dev/null @@ -1,394 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.swing.navigation.*; -import jaxx.runtime.DefaultJAXXContext; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - - -/** - * Test du model de navigation. - * - * @author chemit - */ -public class NavigationTreeModelTest { - - private static final String ROOT_CONTEXT = "$root"; - private static final String FAKE = "-fake"; - - private static final String separator = "/"; - - @Test - public void testFindNode() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - for (int i = 0; i < 4; i++) { - NavigationTreeNode sonNode = builder.build(rootNode, (String) null, (String) null, getNodeContext(i), null, null); - for (int j = 0; j < 4; j++) { - NavigationTreeNode sonSonNode = builder.build(sonNode, (String) null, (String) null, getNodeContext(i, j), null, null); - for (int k = 0; k < 4; k++) { - builder.build(sonSonNode, (String) null, (String) null, getNodeContext(i, j, k), null, null); - } - } - } - - NavigationTreeModel model = builder.getModel(); - - NavigationTreeNode node; - String contextPath; - String currentNode; - - contextPath = ROOT_CONTEXT; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, ROOT_CONTEXT, 0, node, true); - - node = model.findNode(ROOT_CONTEXT + FAKE); - Assert.assertNull(node); - - for (int i = 0; i < 4; i++) { - currentNode = getNodeContext(i); - contextPath = ROOT_CONTEXT + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 1, node, false); - - for (int j = 0; j < 4; j++) { - currentNode = getNodeContext(i, j); - contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 2, node, false); - - for (int k = 0; k < 4; k++) { - currentNode = getNodeContext(i, j, k); - contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 3, node, false); - } - - node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode + FAKE); - Assert.assertNull(node); - } - - node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode + FAKE); - Assert.assertNull(node); - - } - - } - - /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point - * as a bean. - * <p/> - * Tree is like this - * <pre> - * $root + - * - name <-- attached to context entry : java.lang.String.class,"name" - * - name2 <-- attached to context entry : java.lang.String.class,"name2" - * - model + <-- attached to context entry : Model.class,null - * - name - * -integerValue - * - sons + - * - 0 + - * - name - * - integerValue - * - sons - * - 1 + - * - name - * - integerValue - * - sons - * - 2 + - * - name - * - integerValue - * - sons - * </pre> - * <p/> - * With this tree, we will have to results : - * <pre> - * $root.name => context.get(String.class,"name") - * $root.name2 => context.get(String.class,"name2") - * $root.model => context.get(Model.class) - * $root.model.name => context.get(Model.class).getName() - * $root.model.integerValue => context.get(Model.class).getIntegerValue() - * $root.model.sons => context.get(Model.class).getSons() - * $root.model.sons.0 => context.get(Model.class).getSons().get(0) - * </pre> - * - * @throws Exception if any pb - */ - @Test - public void testGetJAXXContextValue() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - NavigationTreeNode sonNode; - NavigationTreeNode sonSonNode; - NavigationTreeNode sonSonSonNode; - - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name", String.class), "name", null, null); - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name2", String.class), "name2", null, null); - - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef(Model.class), "model", null, null); - - builder.build(sonNode, (String) null, "../name", "name", null, null); - builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null); - - sonSonNode = builder.build(sonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", 0 + "", null, null); - - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[2]", 1 + "", null, null); - - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, (String) null, 2 + "", null, null); - //sonSonSonNode = model.new NavigationTreeNode(null, "..[3]", 2 + "", null, null); - sonSonNode.insert(sonSonSonNode, 2); - builder.build(sonSonSonNode, (String) null, "../..[3]/name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../..[3]/integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../..[3]/sons", "sons", null, null); - - NavigationTreeModel model = builder.getModel(); - - JAXXContext context = new DefaultJAXXContext(); - context.setContextValue("the name", "name"); - context.setContextValue("the name2", "name2"); - - - context.setContextValue( - new Model("modelName", 10, - Arrays.asList( - new Model("one", 1, Collections.<Model>emptyList()), - new Model("two", 2, Collections.<Model>emptyList()), - new Model("three", 3, Collections.<Model>emptyList()) - ) - ) - ); - - Assert.assertNull(model.getJAXXContextValue(context, "$root.name" + FAKE)); - - testBinding(model, context, "$root/name", context.getContextValue(String.class, "name")); - testBinding(model, context, "$root/name2", context.getContextValue(String.class, "name2")); - - Model bean = context.getContextValue(Model.class); - - testBinding(model, context, "$root/model", bean); - testBinding(model, context, "$root/model/name", bean.getName()); - testBinding(model, context, "$root/model/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/model/sons", bean.getSons()); - - testBinding(model, context, "$root/model/sons/0/name", bean.getSons().get(0).getName()); - testBinding(model, context, "$root/model/sons/0/integerValue", bean.getSons().get(0).getIntegerValue()); - testBinding(model, context, "$root/model/sons/0/sons", bean.getSons().get(0).getSons()); - - - testBinding(model, context, "$root/model/sons/1/name", bean.getSons().get(1).getName()); - testBinding(model, context, "$root/model/sons/1/integerValue", bean.getSons().get(1).getIntegerValue()); - testBinding(model, context, "$root/model/sons/1/sons", bean.getSons().get(1).getSons()); - - testBinding(model, context, "$root/model/sons/2/name", bean.getSons().get(2).getName()); - testBinding(model, context, "$root/model/sons/2/integerValue", bean.getSons().get(2).getIntegerValue()); - testBinding(model, context, "$root/model/sons/2/sons", bean.getSons().get(2).getSons()); - } - - /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point - * as a list. - * <p/> - * Tree is like this - * <pre> - * $root + - * - models + <-- attached to context entry : java.util.List.class,"models" - * - 0 + - * - name - * -integerValue - * - sons + - * - 0 + - * - name - * - 1 + - * - name - * - integerValue - * - sons - * - 2 + - * - name - * - integerValue - * - sons - * </pre> - * <p/> - * With this tree, we will have to results : - * <pre> - * $root.models => context.get(List.class,"models") - * $root.models.0 => context.get(List.class,"models").get(0) - * $root.models.0.name => context.get(List.class,"models").get(0).getName() - * </pre> - * - * @throws Exception if any pb - */ - @Test - public void testGetJAXXContextValueFromList() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - NavigationTreeNode sonNode; - NavigationTreeNode sonSonNode; - NavigationTreeNode sonSonSonNode; - - // first son is a list of models - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newListDef("models"), "models", null, null); - - // first son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - sonSonNode = builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", "0", null, null); - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - - // second son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[2]", "1", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - // third son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[3]", "2", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - NavigationTreeModel model = builder.getModel(); - - - List<Model> list = Arrays.asList( - new Model("entryOne", 10, - Arrays.asList( - new Model("one", 1, Collections.<Model>emptyList()), - new Model("two", 2, Collections.<Model>emptyList()), - new Model("three", 3, Collections.<Model>emptyList()) - ) - ), - new Model("entryTwo", 20, - Arrays.asList( - new Model("2one", 1, Collections.<Model>emptyList()), - new Model("2two", 2, Collections.<Model>emptyList()), - new Model("2three", 3, Collections.<Model>emptyList()) - ) - ), - new Model("entryThree", 30, - Arrays.asList( - new Model("3one", 1, Collections.<Model>emptyList()), - new Model("3two", 2, Collections.<Model>emptyList()), - new Model("3three", 3, Collections.<Model>emptyList()) - ) - ) - ); - JAXXContext context = new DefaultJAXXContext(); - context.setContextValue(list, "models"); - - Model bean; - - testBinding(model, context, "$root/models", list); - - bean = list.get(0); - testBinding(model, context, "$root/models/0", bean); - testBinding(model, context, "$root/models/0/name", bean.getName()); - testBinding(model, context, "$root/models/0/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/0/sons", bean.getSons()); - testBinding(model, context, "$root/models/0/sons/0", bean.getSons().get(0)); - testBinding(model, context, "$root/models/0/sons/0/name", bean.getSons().get(0).getName()); - - bean = list.get(1); - testBinding(model, context, "$root/models/1", bean); - testBinding(model, context, "$root/models/1/name", bean.getName()); - testBinding(model, context, "$root/models/1/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/1/sons", bean.getSons()); - - bean = list.get(2); - testBinding(model, context, "$root/models/2", bean); - testBinding(model, context, "$root/models/2/name", bean.getName()); - testBinding(model, context, "$root/models/2/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/2/sons", bean.getSons()); - - } - - protected void testBinding(NavigationTreeModel model, JAXXContext context, String contextPath, Object expected) throws Exception { - - Object value; - value = model.getJAXXContextValue(context, contextPath); - Assert.assertNotNull(value); - Assert.assertEquals(expected, value); - } - - protected String getNodeContext(int... context) { - String result = ""; - for (int i : context) { - result += i; - } - return result; - } - - protected void assertNodeEquals(String contextPath, String nodeContext, int level, NavigationTreeNode node, boolean root) { - //System.out.println(contextPath + " : " + (node == null ? null : node.getContextPath())); - Assert.assertNotNull(node); - Assert.assertEquals(root, node.isRoot()); - Assert.assertEquals(level, node.getLevel()); - Assert.assertEquals(nodeContext, node.getNavigationPath()); - Assert.assertEquals(contextPath, node.getContextPath()); - } - - public static class Model { - - protected String name; - - protected int integerValue; - - protected List<Model> sons; - - public Model(String name, int integerValue, List<Model> sons) { - this.name = name; - this.integerValue = integerValue; - this.sons = sons; - } - - public String getName() { - return name; - } - - public int getIntegerValue() { - return integerValue; - } - - public List<Model> getSons() { - return sons; - } - - @Override - public String toString() { - return super.toString() + "<name:" + name + ",integerValue:" + integerValue + ",sons: " + sons + ">"; - } - } - -} diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index f468a2b..852b698 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,12 +22,12 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <version>${project.version}</version> </dependency> @@ -35,7 +35,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> <scope>test</scope> <classifier>tests</classifier> @@ -52,8 +52,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx Demo module</description> + <name>JAXX Demo</name> + <description>JAXX Demo</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-demo/src/main/filters/jaxx-demo.properties b/jaxx-demo/src/main/filters/jaxx-demo.properties index e518e36..4be97da 100644 --- a/jaxx-demo/src/main/filters/jaxx-demo.properties +++ b/jaxx-demo/src/main/filters/jaxx-demo.properties @@ -1,6 +1,9 @@ application.name=${project.name} application.version=${project.version} application.site.url=http://maven-site.nuiton.org/jaxx/jaxx-example +application.icon.path=/icons/jaxx.png +application.license.path=META-INF/${project.artifactId}-LICENSE.txt +application.third-party.path=META-INF/${project.artifactId}-THIRD-PARTY.txt #licence.name=${project.licenses[0].license.name} #licence.url=${project.licenses.0.url} application.organisation.name=${project.organization.name} diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx index 1bd60a2..73f77ce 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx @@ -1,87 +1,110 @@ - -<JTabbedPane id='top'> - - <script><![CDATA[ -import org.apache.commons.io.IOUtils; - -protected String[] getSources() { - if (getClass() == DemoPanel.class) { - return new String[0]; - } - return new String[]{ getDefaultSource() }; -} - -protected String getDefaultSource() { - return getClass().getSimpleName() + ".jaxx"; -} - -public String getLabel() { - String name = getClass().getSimpleName(); - if (name.endsWith("Demo")) { - name = name.substring(0, name.length() - "Demo".length()); - } - return name; -} - -public String getDemoTabTitle() { - return getLabel() + " Demo"; -} - -public String loadSource(String filename) { - try { - if (log.isDebugEnabled()) { - log.debug(filename + " from " + getClass()); - } - String result = IOUtils.toString(getClass().getResourceAsStream(filename)); - - return result; - } catch (Exception e) { - log.error("could not load file " + filename, e); - return "could not load file " + filename; - } -} - -private void $afterCompleteSetup() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - if (getSources().length == 0) { - top.remove(sourceTabs); - return; - } - for (String extra : getSources()) { - JScrollPane pane = new JScrollPane( - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - pane.setBorder(null); - // creation du contenu du fichier - JTextArea content = new JTextArea(); - content.setFont(content.getFont().deriveFont((float) 11)); - content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); - content.setEditable(false); - content.setWrapStyleWord(false); - content.setText(loadSource(extra)); - content.setColumns(80); - pane.getViewport().add(content); - // ajout de l'onglet - sourceTabs.addTab(extra, pane); - int index = sourceTabs.indexOfComponent(pane); - JLabel l = new JLabel(extra); - l.setFont(l.getFont().deriveFont((float) 10)); - sourceTabs.setTabComponentAt(index,l); - } - } - }); -} - ]]> - </script> - - <tab title='{getDemoTabTitle()}'> - <JPanel id='demoPanel'/> - </tab> - - <tab title='Sources'> - <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> - </tab> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> + +<JTabbedPane id='top'> + + <script><![CDATA[ +import org.apache.commons.io.IOUtils; + +protected String[] getSources() { + if (getClass() == DemoPanel.class) { + return new String[0]; + } + return new String[]{ getDefaultSource() }; +} + +protected String getDefaultSource() { + return getClass().getSimpleName() + ".jaxx"; +} + +public String getLabel() { + String name = getClass().getSimpleName(); + if (name.endsWith("Demo")) { + name = name.substring(0, name.length() - "Demo".length()); + } + return name; +} + +public String getDemoTabTitle() { + return getLabel() + " Demo"; +} + +public String loadSource(String filename) { + try { + if (log.isDebugEnabled()) { + log.debug(filename + " from " + getClass()); + } + String result = IOUtils.toString(getClass().getResourceAsStream(filename)); + + return result; + } catch (Exception e) { + log.error("could not load file " + filename, e); + return "could not load file " + filename; + } +} + +private void $afterCompleteSetup() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + if (getSources().length == 0) { + top.remove(sourceTabs); + return; + } + for (String extra : getSources()) { + JScrollPane pane = new JScrollPane( + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setBorder(null); + //pane.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); + // creation du contenu du fichier + JTextArea content = new JTextArea(); + content.setFont(content.getFont().deriveFont((float) 11)); + content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); + content.setEditable(false); + content.setWrapStyleWord(false); + content.setText(loadSource(extra)); + content.setColumns(80); + content.setLineWrap(true); + pane.getViewport().add(content); + content.setCaretPosition(0); + // ajout de l'onglet + sourceTabs.addTab(extra, pane); + int index = sourceTabs.indexOfComponent(pane); + JLabel l = new JLabel(extra); + l.setFont(l.getFont().deriveFont((float) 10)); + sourceTabs.setTabComponentAt(index,l); + } + } + }); +} + ]]> + </script> + + <tab title='{getDemoTabTitle()}'> + <JPanel id='demoPanel'/> + </tab> + + <tab title='Sources'> + <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> + </tab> </JTabbedPane> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index 130cfee..2450bce 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -25,8 +25,8 @@ import javax.swing.JPanel; import jaxx.demo.component.swing.*; import jaxx.demo.component.jaxx.*; import jaxx.demo.component.jaxx.editor.*; -import jaxx.demo.component.jaxx.navigation.full.FullNavigationTreeDemo; import jaxx.demo.component.jaxx.navigation.item.ItemTreeNavigationDemo; +import jaxx.demo.component.jaxx.tree.FullNavigationTreeDemo; import jaxx.demo.feature.databinding.BeanDataBindingDemo; import jaxx.demo.feature.validation.*; import jaxx.demo.fun.*; @@ -38,13 +38,8 @@ import jaxx.runtime.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeHandler; -import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; -import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeHelper; +import jaxx.runtime.swing.tree.*; +import jaxx.runtime.swing.tree.NavigationTreeHandler.Strategy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -67,7 +62,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { log.debug("start creating demo model"); } - TreeModelBuilder builder = new TreeModelBuilder(); + TreeModelBuilder builder = new TreeModelBuilder(context); builder.addText(n_("jaxxdemo.tree.component.swing")). addText(n_("jaxxdemo.tree.component.swing.buttons")). @@ -121,6 +116,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { addDemo(ValidationListDemo.class). addDemo(ValidationTableDemo.class). goUp(). + goUp(). addText(n_("jaxxdemo.tree.fun")). addDemo(LabelStyleDemo.class). addDemo(CounterDemo.class). @@ -129,7 +125,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { NavigationTreeModel model = builder.getModel(); if (log.isDebugEnabled()) { - builder.printModel(context, model.getRoot()); + builder.printModel(model.getRoot()); } // save tree model in context setTreeModel(context, model); @@ -139,10 +135,10 @@ public class DemoTreeHelper extends NavigationTreeHelper { @Override public NavigationTreeHandler createTreeHandler(JAXXObject context) { - NavigationTreeHandler handler = new NavigationTreeHandlerWithCardLayout( + NavigationTreeHandler handler; + + handler = new NavigationTreeHandlerWithCardLayout( getPrefix(), - DemoPanel.class, - null, context, Strategy.PER_UI_TYPE) { @@ -168,7 +164,8 @@ public class DemoTreeHelper extends NavigationTreeHelper { ErrorDialogUI.showError(e); } - protected DemoUI getContext() { + @Override + public DemoUI getContext() { return (DemoUI) context; } }; @@ -189,34 +186,34 @@ public class DemoTreeHelper extends NavigationTreeHelper { /** * la pile des noeuds parent */ - protected Stack<NavigationTreeNode> parentNodes; + protected Stack<NavigationTreeNode> nodes; - protected TreeModelBuilder() { - super("/"); - parentNodes = new Stack<NavigationTreeNode>(); - parentNodes.add(buildEmptyRoot(def, "$root")); + protected TreeModelBuilder(JAXXContext context) { + super("/", context, DemoPanel.class, null); + nodes = new Stack<NavigationTreeNode>(); + nodes.add(buildEmptyRoot(def, "$root")); } protected TreeModelBuilder goUp() { - parentNodes.pop(); + nodes.pop(); return this; } protected TreeModelBuilder addText(String label) { - NavigationTreeNode parentNode = parentNodes.peek(); + NavigationTreeNode parentNode = nodes.peek(); parentNode = build(parentNode, label, def, label, null, null); if (log.isDebugEnabled()) { - log.debug(label + " [" + parentNode.getContextPath() + "]"); + log.debug(label + " [" + parentNode.getFullPath() + "]"); } - parentNodes.push(parentNode); + nodes.push(parentNode); return this; } protected TreeModelBuilder addDemo(Class<? extends DemoPanel> demoClass) { - NavigationTreeNode parentNode = parentNodes.peek(); + NavigationTreeNode parentNode = nodes.peek(); String label = demoClass.getSimpleName(); if (log.isDebugEnabled()) { - log.debug(label + " [" + parentNode.getContextPath() + "]"); + log.debug(label + " [" + parentNode.getFullPath() + "]"); } build(parentNode, label, def, label, demoClass, null); return this; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css index b7a11f4..b111b55 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%* - */ +*/ JToolBar { borderPainted:false; floatable:false; @@ -28,6 +28,12 @@ JSplitPane { dividerSize:6; } +#mainFrame { + title:"JAXX Demo"; + iconImage:{jaxx.runtime.SwingUtil.createIcon(getConfig().getOption("application.icon.path")).getImage()}; + undecorated:{getConfig().isFullScreen()}; +} + #menu { _help:{"ui.main.menu"}; } @@ -61,8 +67,8 @@ JSplitPane { toolTipText:"jaxxdemo.action.locale.fr.tip"; actionIcon:"i18n-fr"; enabled:{!acceptLocale(getConfig().getLocale(), "fr_FR")}; - mnemonic:F; - _help:{"ui.main.menu.file.locale.fr"}; +mnemonic:F; +_help:{"ui.main.menu.file.locale.fr"}; } #menuFileLanguageUK { @@ -70,8 +76,8 @@ JSplitPane { toolTipText:"jaxxdemo.action.locale.uk.tip"; actionIcon:"i18n-uk"; enabled:{!acceptLocale(getConfig().getLocale(), "en_GB")}; - mnemonic:U; - _help:{"ui.main.menu.file.locale.uk"}; +mnemonic:U; +_help:{"ui.main.menu.file.locale.uk"}; } #menuFileFullscreen { @@ -80,7 +86,7 @@ JSplitPane { actionIcon:"fullscreen"; mnemonic:P; visible:{!isUndecorated()}; - _help:{"ui.main.menu.file.fullscreen"}; +_help:{"ui.main.menu.file.fullscreen"}; } #menuFileNormalscreen { @@ -89,7 +95,7 @@ JSplitPane { actionIcon:"leave-fullscreen"; mnemonic:N; visible:{isUndecorated()}; - _help:{"ui.main.menu.file.leave-fullscreen"}; +_help:{"ui.main.menu.file.leave-fullscreen"}; } #menuFileExit{ @@ -137,17 +143,24 @@ JSplitPane { visible:true; } +#navigationPane{ + border:{null}; +minimumSize:{new Dimension(230,0)}; +horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; +} + #navigation{ rootVisible:false; + showsRootHandles:false; largeModel:true; font-size:11; } -/* + #splitpane{ orientation:{JSplitPane.HORIZONTAL_SPLIT}; _help:{"ui.main.body.db"}; resizeWeight:1.0; -}*/ +} #contentLayout{ useOnlyVisibleComponentDimension:true; @@ -155,7 +168,7 @@ JSplitPane { #content{ layout:{contentLayout}; - _help:{"ui.main.body.db.view.content"}; +_help:{"ui.main.body.db.view.content"}; } /* #toolbar { diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index 09ad1e4..38ef966 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -1,81 +1,113 @@ - -<JFrame id='mainFrame' - title="JAXX Demo" - width='1024' - height='800' - decorator='help' - undecorated='{getConfig().isFullScreen()}' - onWindowClosing='getHandler().close(mainFrame)'> - - <style source='DemoUI.css'/> - - <jaxx.runtime.swing.CardLayout2 id='contentLayout'/> - - <script><![CDATA[ -import jaxx.runtime.swing.navigation.*; -import java.util.Locale; - -public DemoConfig getConfig() { - return getContextValue(DemoConfig.class); -} - -protected DemoUIHandler getHandler() { - return getContextValue(DemoUIHandler.class); -} - -protected DemoTreeHelper getTreeHelper() { - return getContextValue(DemoTreeHelper.class); -} - -public boolean acceptLocale(Locale l, String expected) { - return l !=null && l.toString().equals(expected); -} - -]]> - </script> - - <JMenuBar id='menu'> - - <JMenu id='menuFile'> - <JMenuItem id='menuFileConfiguration' - onActionPerformed="getHandler().showConfig(this)"/> - <JMenu id='menuFileLanguage'> - <JMenuItem id='menuFileLanguageFR' - onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> - <JMenuItem id='menuFileLanguageUK' - onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> - </JMenu> - <JSeparator/> - <JMenuItem id='menuFileFullscreen' - onActionPerformed="getHandler().changeScreen(this, true)"/> - <JMenuItem id='menuFileNormalscreen' - onActionPerformed="getHandler().changeScreen(this, false)"/> - <JSeparator/> - <JMenuItem id='menuFileExit' - onActionPerformed="getHandler().close(this)"/> - </JMenu> - - <JMenu id='menuHelp'> - <JMenuItem id='menuHelpHelp' - onActionPerformed="getHandler().showHelp(this, null)"/> - <JMenuItem id='menuHelpSite' - onActionPerformed="getHandler().gotoSite(this)"/> - <JMenuItem id='menuHelpAbout' - onActionPerformed="getHandler().showAbout(this)"/> - </JMenu> - - </JMenuBar> - - <JSplitPane id='splitPane'> - <JScrollPane border='{null}'> - <JTree id='navigation' - model='{getTreeHelper().createTreeModel(this)}' - selectionModel="{getTreeHelper().createTreeHandler(this)}" - cellRenderer='{new NavigationTreeCellRenderer(this, 200)}'> - </JTree> - </JScrollPane> - - <JPanel id='content'/> - - </JSplitPane> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> + +<JFrame id='mainFrame' width='1024' height='800' + decorator='help' + onWindowClosing='getHandler().close(mainFrame)'> + + <style source='DemoUI.css'/> + + <jaxx.runtime.swing.CardLayout2 id='contentLayout'/> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.tree.*; +import java.util.Locale; + +public DemoConfig getConfig() { + return getContextValue(DemoConfig.class); +} + +protected DemoUIHandler getHandler() { + return getContextValue(DemoUIHandler.class); +} + +protected DemoTreeHelper getTreeHelper() { + return getContextValue(DemoTreeHelper.class); +} + +public boolean acceptLocale(Locale l, String expected) { + return l !=null && l.toString().equals(expected); +} + +private void $afterCompleteSetup() { + // share the tree + getTreeHelper().setTree(this, navigation); + // auto-expand node when selected + SwingUtil.addExpandOnClickListener(navigation); + +} + +]]> + </script> + + <JMenuBar id='menu'> + + <JMenu id='menuFile'> + <JMenuItem id='menuFileConfiguration' + onActionPerformed="getHandler().showConfig(this)"/> + <JMenu id='menuFileLanguage'> + <JMenuItem id='menuFileLanguageFR' + onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> + <JMenuItem id='menuFileLanguageUK' + onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> + </JMenu> + <JSeparator/> + <JMenuItem id='menuFileFullscreen' + onActionPerformed="getHandler().changeScreen(this, true)"/> + <JMenuItem id='menuFileNormalscreen' + onActionPerformed="getHandler().changeScreen(this, false)"/> + <JSeparator/> + <JMenuItem id='menuFileExit' + onActionPerformed="getHandler().close(this)"/> + </JMenu> + + <JMenu id='menuHelp'> + <JMenuItem id='menuHelpHelp' + onActionPerformed="getHandler().showHelp(this, null)"/> + <JMenuItem id='menuHelpSite' + onActionPerformed="getHandler().gotoSite(this)"/> + <JMenuItem id='menuHelpAbout' + onActionPerformed="getHandler().showAbout(this)"/> + </JMenu> + + </JMenuBar> + + <JPanel id='mainPane' layout='{new BorderLayout()}'> + + <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> + <JScrollPane id='navigationPane'> + <JTree id='navigation' + model='{getTreeHelper().createTreeModel(this)}' + selectionModel="{getTreeHelper().createTreeHandler(this)}"> + <!--cellRenderer='{new NavigationTreeCellRenderer(this)}'>--> + <!--cellRenderer='{new NavigationTreeCellRenderer(this,185)}'>--> + </JTree> + </JScrollPane> + + <JPanel id='content'/> + + </JSplitPane> + + <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> + + </JPanel> </JFrame> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 8a66d58..d57e290 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -23,7 +23,7 @@ package jaxx.demo; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.JAXXContext; import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; +import jaxx.runtime.swing.tree.NavigationTreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import static org.nuiton.i18n.I18n._; @@ -102,8 +102,6 @@ public class DemoUIHandler { //implements JAXXHelp { @Override public void run() { -// // use best dimensions -// ui.getSplitPane().resetToPreferredSizes(); String path; if (node == null) { @@ -111,23 +109,25 @@ public class DemoUIHandler { //implements JAXXHelp { path = "$root/jaxxdemo.tree.component.swing"; } else { // take selected node - path = node.getContextPath(); + path = node.getFullPath(); } + log.info("node to re select " + path); // select node - ui.getTreeHelper().selectNode(ui, ui.getNavigation(), path); -// -// // show ui -// ui.setVisible(true); + ui.getTreeHelper().selectNode(ui, path); + + // use best dimensions + ui.getSplitPane().resetToPreferredSizes(); } }); + + // show ui after all (in another invocation, tu avoid layout adjustement + // to be seen). + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - // use best dimensions - ui.getSplitPane().resetToPreferredSizes(); - // show ui ui.setVisible(true); } @@ -154,7 +154,7 @@ public class DemoUIHandler { //implements JAXXHelp { node = ui.getTreeHelper().getSelectedNode(ui); if (node != null) { - log.info("selected node " + node.getContextPath()); + log.info("selected node " + node.getFullPath()); } ErrorDialogUI.init(null); @@ -284,14 +284,20 @@ public class DemoUIHandler { //implements JAXXHelp { public void showAbout(DemoUI ui) { - AboutPanel about = new AboutPanel(); + DemoConfig config = ui.getConfig(); + + String iconPath = config.getOption("application.icon.path"); + String licensePath = config.getOption("application.license.path"); + String thirdPartyPath = config.getOption("application.third-party.path"); + AboutPanel about = new AboutPanel(); about.setTitle(_("jaxxdemo.title.about")); - about.setIconPath("/icons/jaxx.png"); about.setAboutText(_("jaxxdemo.about.message")); about.setBottomText(ui.getConfig().getCopyrightText()); - about.setLicenseFile("META-INF/jaxx-example-LICENSE.txt"); - about.setThirdpartyFile("META-INF/jaxx-example-THIRD-PARTY.txt"); + about.setIconPath(iconPath); + about.setLicenseFile(licensePath); + about.setThirdpartyFile(thirdPartyPath); + about.buildTopPanel(); about.init(); about.showInDialog(ui, true); } diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx index 157068c..1343bd6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <jaxx.runtime.swing.BlockingLayerUI id='layerUI' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx index f6f4c61..89c2879 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel' layout='{new BorderLayout()}'> <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx index d72b548..7942049 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel' fill='both'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx index 8833eda..a3b706e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx index ce336ce..3357a6c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx deleted file mode 100644 index 7160eda..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx +++ /dev/null @@ -1,79 +0,0 @@ -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> - - <script><![CDATA[ -import jaxx.runtime.SwingUtil; - -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; - } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; - } - return data.getClass().getSimpleName(); -} - -String getContent(Object data) { - if (data == null) { - return "no content"; - } - StringBuilder buffer = new StringBuilder(); - if (data instanceof java.util.List) { - for (Object o : ((java.util.List)data)) { - buffer.append(o).append("\n"); - } - } else { - buffer.append(data); - } - return buffer.toString(); -} - -ImageIcon getImage(Object data) { - if (data == null) { - return null; - } - if (data instanceof Movie) { - return SwingUtil.createIcon(((Movie)data).getImage()); - } - if (data instanceof People) { - return SwingUtil.createIcon(((People)data).getImage()); - } - return null; -} - ]]> - </script> - - <JSplitPane id='splitPane' - orientation='{JSplitPane.VERTICAL_SPLIT}' - resizeWeight='0.5' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> - - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JTextPane border='{new TitledBorder("Content Type : " + getType(getData()))}' - editable='false' - font-size='11' - text='{getContent(getData())}'/> - </JScrollPane> - - <JScrollPane border='{new TitledBorder("Picture")}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' - minimumSize='{SwingUtil.newMinDimension()}'> - - <JLabel horizontalAlignment='center' icon='{getImage(getData())}'/> - - </JScrollPane> - - </JSplitPane> -</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx deleted file mode 100644 index 60479ff..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx +++ /dev/null @@ -1,58 +0,0 @@ - -<jaxx.demo.DemoPanel> - - <jaxx.runtime.swing.CardLayout2 id='contentLayout' - useOnlyVisibleComponentDimension='true'/> - - <script><![CDATA[ -import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer; - -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - -helper.createModel(this); - -@Override -protected String[] getSources() { - return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; -} - -private void $afterCompleteSetup() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - navigation.setSelectionInterval(0, 0); - splitPane.resetToPreferredSizes(); - } - }); - jaxx.runtime.SwingUtil.expandTree(navigation); -} - ]]> - </script> - - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - - <JSplitPane id='splitPane' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> - - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_NEVER}'> - - <JTree id="navigation" - font-size='11' - rootVisible='false' - model='{helper.createTreeModel(this)}' - selectionModel="{helper.createTreeHandler(this)}" - cellRenderer='{new NavigationTreeCellRenderer(this, 150)}' /> - - </JScrollPane> - - <JPanel id="content" layout="{contentLayout}" /> - - </JSplitPane> - - </JPanel> - -</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java deleted file mode 100644 index 862af11..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 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>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import java.util.Arrays; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; - -import static jaxx.runtime.JAXXContextEntryDef.newListDef; -import static org.nuiton.i18n.I18n._; - -import java.util.List; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.MultiJXPathDecorator; - - -import javax.swing.JPanel; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.navigation.NavigationTreeHandler; -import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; -import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeHelper; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author chemit - */ -public class FullNavigationTreeHelper extends NavigationTreeHelper { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(FullNavigationTreeHelper.class); - /** - * where the movies are hold in context - */ - static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXContextEntryDef.newListDef("movies"); - /** - * where the actors are hold in context - */ - static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXContextEntryDef.newListDef("actors"); - - public FullNavigationTreeHelper() { - super("full"); - } - - /** - * Create the model and store it in the given context. - * - * @param context the context where to hold the model - */ - public void createModel(JAXXContext context) { - People a = new People("0", "Jack", "Black", 0, "/jaxx/demo/images/jack.jpg"); - People a2 = new People("1", "Héctor", "Jiménez", 0, "/jaxx/demo/images/hector.jpg"); - People a3 = new People("2", "Ana", "de la Reguera", 0, "/jaxx/demo/images/ana.jpg"); - - Movie m = new Movie("0", "Nacho libre", 1996, "/jaxx/demo/images/nacho.jpg"); - m.addActor(a); - m.addActor(a2); - m.addActor(a3); - - Movie m2 = new Movie("1", "Nacho 2", 2009, "/jaxx/demo/images/nacho2.png"); - m2.addActor(a); - m2.addActor(a2); - - MOVIES.setContextValue(context, Arrays.asList(m, m2)); - ACTORS.setContextValue(context, Arrays.asList(a, a2, a3)); - } - - @Override - public NavigationTreeModel createTreeModel(JAXXContext context) { - - List<Movie> movies = MOVIES.getContextValue(context); - List<People> actors = ACTORS.getContextValue(context); - - if (log.isDebugEnabled()) { - log.debug("for " + movies.size() + " movie(s)"); - } - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - Decorator<Movie> mDecorator = MultiJXPathDecorator.newDecorator(Movie.class, "${title}$s##${year}$s", "##", " - "); - Decorator<People> pDecorator = MultiJXPathDecorator.newDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " "); - - // construction du noeud root - // il ne contient pas de context et ne sera pas visible - NavigationTreeNode rootNode = builder.buildEmptyRoot(null, "$root"); - - // construction du noeud avec les films recupere la liste des films - // dans le context avec la clef movies - // navigation path = $root/movies - NavigationTreeNode moviesNode = builder.build( - rootNode, - _("movies"), - newListDef("movies"), - "movies", - null, - null); - - for (Movie m : movies) { - - // navigation path = $root/movies/m.id - NavigationTreeNode movieNode = builder.build( - moviesNode, - mDecorator, - "..[@id=\"" + m.getId() + "\"]", - m.getId(), - null, - null); - - // navigation path = $root/movies/m.id/actors - NavigationTreeNode actorsNode = builder.build( - movieNode, - _("actors"), - "../actors", - "actors", - null, - null); - - for (People p : m.getActors()) { - // navigation path = $root/movies/m.id/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - } - - // construction du noeud avec les acteurs - NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), - newListDef("actors"), - "actors", null, null); - - for (People p : actors) { - // navigation path = $root/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - NavigationTreeModel model = builder.getModel(); - - if (log.isDebugEnabled()) { - builder.printModel(context, model.getRoot()); - } - - // save tree model in context - setTreeModel(context, model); - return model; - } - - @Override - public NavigationTreeHandler createTreeHandler(JAXXObject context) { - - if (log.isDebugEnabled()) { - log.debug("create handler"); - } - - NavigationTreeHandler handler = new NavigationTreeHandlerWithCardLayout( - getPrefix(), - BaseContent.class, - null, - context, - Strategy.PER_NODE) { - - private static final long serialVersionUID = 1L; - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return getSafeTreeModel(getContext()); - } - - @Override - protected JPanel getContentContainer() { - return getContext().getContent(); - } - - @Override - protected CardLayout2 getContentLayout() { - return getContext().getContentLayout(); - } - - @Override - protected void treateError(Exception e) { - ErrorDialogUI.showError(e); - } - - FullNavigationTreeDemo getContext() { - return (FullNavigationTreeDemo) this.context; - } - }; - // on ne peut selectionner qu'un seul noeud a la fois - handler.setSelectionMode(NavigationTreeHandler.SINGLE_TREE_SELECTION); - - // save handler in ui context - setTreeHandler(context, handler); - return handler; - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java deleted file mode 100644 index ec18350..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 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>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -/** - * - * @author chemit - */ -public class Movie { - - protected String id; - protected String title; - protected String image; - protected int year; - protected List<People> actors; - - public Movie(String id, String title, int year,String image) { - this(); - this.id = id; - this.title = title; - this.year = year; - this.image=image; - } - - public Movie() { - actors = new ArrayList<People>(); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List<People> getActors() { - return actors; - } - - public void setActors(List<People> actors) { - this.actors = actors; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public String getImage() { - return image; - } - - public void setImage(String image) { - this.image = image; - } - - public void addActor(People actor) { - actors.add(actor); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Movie other = (Movie) obj; - if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); - b.append("id", id); - b.append("title", title); - b.append("year", year); - b.append("actors", actors); - return b.toString(); - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java deleted file mode 100644 index 0a9ac0b..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 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>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -/** - * - * @author chemit - */ -public class People { - - protected String id; - protected String image; - protected String firstName; - protected String lastName; - protected int age; - - public People(String id, String firstName, String lastName, int age, String image) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - this.image = image; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getImage() { - return image; - } - - public void setImage(String image) { - this.image = image; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final People other = (People) obj; - if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); - b.append("id", id); - b.append("firstName", firstName); - b.append("lastName", lastName); - b.append("age", age); - return b.toString(); - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx index 4970c4f..de0ac8b 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <String id='string' javaBean='null'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx index a13b810..a1e8d16 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <style> JButton.fancy { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx index 3058d26..9ab5279 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ public String getText(boolean bold, boolean italic, boolean underline) { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx index 8769306..d63be41 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <JMenuItemDemo> <style> .form { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx index c551abc..f2d5141 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx @@ -1,22 +1,65 @@ - -<jaxx.demo.DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Button label:'/> - </cell> - - <cell> - <JComboBox id='comboBox' editable='true'> - <item value='OK' selected='true'/> - <item value='Cancel'/> - <item value='Help'/> - </JComboBox> - </cell> - - <cell> - <JButton text='{comboBox.getSelectedItem()}'/> - </cell> - </row> - </Table> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> + +<jaxx.demo.DemoPanel> + <script><![CDATA[ +import static org.nuiton.i18n.I18n.n_; + +private void $afterCompleteSetup() { + jaxxComboBox.setSelectedIndex(0); +} +]]> + </script> + <Table id='demoPanel'> + <row> + <cell> + <JLabel text='Button label:'/> + </cell> + + <cell> + <JAXXComboBox id='jaxxComboBox' editable='true'> + <item value='{_("OK")}' selected='true'/> + <item value='{_("Cancel")}'/> + <item value='{_("Help")}'/> + </JAXXComboBox> + </cell> + + <cell> + <JButton text='{jaxxComboBox.getSelectedItem()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Button label:'/> + </cell> + + <cell> + <JComboBox id='comboBox' + editable='true' + model='{new DefaultComboBoxModel(new Object[]{n_("OK"),n_("Cancel"),n_("Help")})}'/> + </cell> + + <cell> + <JButton text='{comboBox.getSelectedItem()}'/> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx index 6add75a..c6a870c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script> String username; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx index 8f77798..093f15d 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel'> <row> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx index e81da1b..7849888 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script> void $afterCompleteSetup(){} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx index 0a7bd43..f824ede 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <HBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx index df432e0..ac8f81e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ import javax.swing.Timer; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx index 388bd77..caf6633 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <VBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx index 62a3996..71f0b0e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <JMenuItemDemo> <JMenuBar id='menuBar'> <JMenu text='Font size'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx index dead1e8..200f208 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <VBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx index 9de8059..82e00d3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx index b2efd26..a14dd2a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel' layout='{new BorderLayout()}'> <JSplitPane> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx index 8184c53..b24accf 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel' anchor='northwest'> <row> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx index f6f78fb..20a4eec 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel'> <Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx index dbce7e0..8a32208 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <JToggleButton text='1' id='one'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx index 978930a..12f1096 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <!-- a full java bean property of the class --> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx index 6e79259..fc16673 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <BaseBeanDataBinding> <Boolean id='editing3' javaBean='true'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx index ed7a992..fcfcb1d 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx @@ -1,8 +1,30 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="Validation.css"/> <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer; + void $afterCompleteSetup() { } @Override @@ -310,7 +332,7 @@ protected String[] getSources() { width='500'> <JScrollPane> <JList id='errorList' model='{errors}' - cellRenderer='{new jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer()}'/> + cellRenderer='{new SwingValidatorMessageListRenderer()}'/> </JScrollPane> </JPanel> </cell> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx index 3bb0d23..a68c9c8 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="Validation.css"/> @@ -31,9 +51,11 @@ <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; import jaxx.runtime.SwingUtil; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; void $afterCompleteSetup() { - jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); + SwingValidatorUtil.installUI(errorTable, new SwingValidatorMessageTableRenderer()); } @Override diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx index fe6c850..d1d73b5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <style source='Calculator.css'/> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx index f4a954c..eeaa1f3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <script>int count;</script> <JPanel id='demoPanel'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx index c6e28be..88078b2 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 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>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="LabelStyle.css"/> <script><![CDATA[ diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 7876d4b..8d66355 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -47,6 +47,7 @@ Fool\ me\ twice= Green= Green\:= Greet= +Help= I18n\ editor\ with\ no\ icon\ \:= I18n\ editor\ with\ no\ text\ \:= I18n\ editor\:= @@ -111,7 +112,7 @@ form.text2=Text 2 form2.ratio=Form 2 Ratio form2.text=Form 2 Text form2.text2=Form 2 Text 2 -jaxxdemo.about.message=<h3>JAXX Demo</h3>Demo du framework JAXX <hr/><p>Ce projet a \u00E9t\u00E9 r\u00E9alis\u00E9 par la soci\u00E9t\u00E9 <a href\="http\://codelutin.com">Codelutin</a> en 2009.</p><br/><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-example">site du projet</a>. +jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste 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... jaxxdemo.action.configuration=Preferences @@ -120,7 +121,7 @@ jaxxdemo.action.exit=Quit jaxxdemo.action.exit.tip=Quit JAXXDemo jaxxdemo.action.fullscreen=Full screen jaxxdemo.action.fullscreen.tip=Change to full screen mode -jaxxdemo.action.help=Help +jaxxdemo.action.help= jaxxdemo.action.help.tip=Display help jaxxdemo.action.locale.fr=French jaxxdemo.action.locale.fr.tip=Change to french language @@ -142,7 +143,7 @@ jaxxdemo.init.context.done=Context initialized in %1$s jaxxdemo.init.ui.done=UI initialized. jaxxdemo.menu.file=File jaxxdemo.menu.file.locale=Languages -jaxxdemo.menu.help=Help +jaxxdemo.menu.help= jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded. jaxxdemo.message.goto.site=Go to JAXXDemo Web site jaxxdemo.title.about=About JAXXDemo... diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index b4f3013..033f0fe 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -20,7 +20,7 @@ Animal=Animal Blue=Bleu Blue\:=bleu \: Bold=En gras -Button\ label\:=Libell\u00E9 du label +Button\ label\:=Libell\u00E9 de l'action C=C CE=CE Cancel=Annuler @@ -47,6 +47,7 @@ Fool\ me\ twice= Green=Vert Green\:=Vert \: Greet= +Help= I18n\ editor\ with\ no\ icon\ \:=Editeur I18n sans icone \: I18n\ editor\ with\ no\ text\ \:=Editeur I18n sans texte \: I18n\ editor\:=Editeur I18n @@ -111,7 +112,7 @@ form.text2=Form \: text2 form2.ratio=Form2 \: ratio form2.text=Form2 \: text form2.text2=Form2 \: text2 -jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/kaxx/jaxx-demo">site du projet</a>. +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... jaxxdemo.action.configuration=Configuration @@ -159,7 +160,7 @@ jaxxdemo.tree.component.swing.window=Fen\u00EAtres jaxxdemo.tree.feature=Fonctionnalit\u00E9s jaxxdemo.tree.features.databinding=Data binding jaxxdemo.tree.features.validation=Validation -jaxxdemo.tree.fun=Contestes +jaxxdemo.tree.fun=Fun jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java. jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9 movies=Films diff --git a/jaxx-demo/src/main/resources/log4j.properties b/jaxx-demo/src/main/resources/log4j.properties index 30a3c28..d0a87ec 100644 --- a/jaxx-demo/src/main/resources/log4j.properties +++ b/jaxx-demo/src/main/resources/log4j.properties @@ -6,5 +6,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n log4j.logger.jaxx.demo=INFO -#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeHandler=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeCellRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeNodeRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeModel=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-example/changelog.txt b/jaxx-example/changelog.txt deleted file mode 100644 index bd48171..0000000 --- a/jaxx-example/changelog.txt +++ /dev/null @@ -1,18 +0,0 @@ -1.5 - * 20090404 [chemit] - use module jaxx-runtime-swing-widget - -1.3 chemit 20090409 - * 20090319 [chemit] - refactor Validator : now can deal with scopes, improve design - * 20090313 [chemit] - improve demo - -1.1 chemit 20090220 - * 20090202 [chemit] - no more scope attribute on validator - - fix I18NTableCellRenderer (must have tip inside) - * 20090122 [chemit] - refactor poms (sibling dependencies, pluginsManagment,...) - - rename i18n bundles according artifactId - -1.0 chemit 20090111 - * 20090111 [chemit] - use lutinproject 3.3 - - refactor examples : now onyl one module, with one webstart demo (cost very less time to release) -0.7 chemit 200812?? - * 20081207 [chemit] use lutinproject 3.1 \ No newline at end of file diff --git a/jaxx-example/pom.xml b/jaxx-example/pom.xml deleted file mode 100644 index 45d2135..0000000 --- a/jaxx-example/pom.xml +++ /dev/null @@ -1,256 +0,0 @@ - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-example</artifactId> - - <dependencies> - - <!-- sibiling dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- test dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> - <version>${project.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>${project.artifactId}</name> - <description>Jaxx Examples</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - - <packaging>jar</packaging> - - <properties> - - <maven.jar.main.class>jaxx.demo.JAXXDemo</maven.jar.main.class> - - <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath> - <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> - </properties> - - <build> - - <resources> - <resource> - <directory>src/main/java</directory> - <includes> - <include>**/*.jaxx</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - - <pluginManagement> - <plugins> - - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>./lib/</classpathPrefix> - </manifest> - </archive> - </configuration> - </plugin> - - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <configuration> - <jnlpExtensions> - <jnlpExtension> - <name>sun</name> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <includes> - <include>javax.help:javahelp</include> - </includes> - </jnlpExtension> - <jnlpExtension> - <name>jxlayer</name> - <title>Swing labs JXLayer </title> - <vendor>Swing Labs</vendor> - <includes> - <include>org.swinglabs:jxlayer</include> - </includes> - </jnlpExtension> - </jnlpExtensions> - <!--<sign> - <verify>false</verify> - </sign>--> - </configuration> - </plugin> - - </plugins> - - </pluginManagement> - - <plugins> - - <plugin> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>maven-jaxx-plugin</artifactId> - <version>${project.version}</version> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>maven-i18n-plugin</artifactId> - <configuration> - <entries> - <entry> - <basedir>${maven.gen.dir}/java/</basedir> - <includes> - <param>**\/**.java</param> - </includes> - </entry> - </entries> - </configuration> - <executions> - <execution> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </build> - - <reporting> - <plugins> - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2-cl_20091001</version> - </plugin> - </plugins> - </reporting> - - <!-- ************************************************************* --> - <!-- *** Build Environment ************************************** --> - <!-- ************************************************************* --> - - <profiles> - <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin --> - <profile> - <id>release-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <build> - <plugins> - <!-- key store secrets availables --> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin</artifactId> - <version>${helper.version}</version> - <executions> - <execution> - <id>get-jnlp-keystore</id> - <goals> - <goal>share-server-secret</goal> - </goals> - <phase>package</phase> - <configuration> - <serverId>codelutin-keystore</serverId> - <usernameOut>keystorepath</usernameOut> - <passwordOut>keystorepass</passwordOut> - </configuration> - </execution> - <execution> - <id>get-jnlp-key</id> - <goals> - <goal>share-server-secret</goal> - </goals> - <phase>package</phase> - <configuration> - <serverId>codelutin-keystore-nuiton-key</serverId> - <usernameOut>keyalias</usernameOut> - <passwordOut>keypass</passwordOut> - </configuration> - </execution> - </executions> - </plugin> - - <!-- make webstart --> - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <executions> - <execution> - <id>generate-jnlp</id> - <phase>package</phase> - <goals> - <goal>jnlp-inline</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - </profiles> - -</project> diff --git a/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx b/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx deleted file mode 100644 index 9ff1ab9..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx +++ /dev/null @@ -1,21 +0,0 @@ -<DemoPanel> - - <!-- a full java bean property of the class --> - <Boolean id='editing' javaBean='false'/> - - <!-- not full java bean property (must add script...) --> - <Boolean id='editing2' constructorParams='false'/> - - <String id='contentMessage' javaBean='"message..."'/> - - <script> - public Boolean isEditing2() { return editing2; } - - public void setEditing2(Boolean newValue) { - Boolean oldValue = this.editing2; - this.editing2 = newValue; - firePropertyChange("editing2", oldValue, newValue) ; - } - </script> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx deleted file mode 100644 index 031d308..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx +++ /dev/null @@ -1,47 +0,0 @@ -<BaseBeanDataBinding> - - <Boolean id='editing3' javaBean='true'/> - - <Table id='demoPanel'> - <row> - <cell columns='2'> - <JLabel text='{getContentMessage()}'/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing()}' text='edit' onActionPerformed='setEditing(true);'/> - <JButton visible='{isEditing()}' text='close' onActionPerformed='setEditing(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField enabled='{isEditing()}' text='to edit'/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing2()}' text='edit2' onActionPerformed='setEditing2(true);'/> - <JButton visible='{isEditing2()}' text='close2' onActionPerformed='setEditing2(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField enabled='{isEditing2()}' text="to edit 2"/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing3()}' text='edit3' onActionPerformed='setEditing3(true);'/> - <JButton visible='{isEditing3()}' text='close3' onActionPerformed='setEditing3(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField id='edit3' enabled='{isEditing3()}' text="{getContentMessage()}" - onKeyReleased='setContentMessage(edit3.getText())'/> - </cell> - </row> - </Table> - -</BaseBeanDataBinding> diff --git a/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx deleted file mode 100644 index 763199f..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx +++ /dev/null @@ -1,91 +0,0 @@ - -<DemoPanel> - <jaxx.runtime.swing.BlockingLayerUI id='layerUI' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - useIcon='true' - blockingColor='{new Color(50,50,50)}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <jaxx.runtime.swing.BlockingLayerUI2 id='layerUI2' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <script><![CDATA[ -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - SwingUtil.getLayer(boxed).setUI(layerUI2); - continue; - } - - jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); - if ( boxed == c) { - ui.setBlock(true); - } - SwingUtil.getLayer(boxed).setUI(ui); - } -} - -public void setLayer(boolean active) { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - continue; - } - jaxx.runtime.swing.BlockingLayerUI ui = (jaxx.runtime.swing.BlockingLayerUI)SwingUtil.getLayer(boxed).getUI(); - if ( boxed == c) { - ui.setBlock(active); - } - ui.setUseIcon(active); - } -} - -protected void accept(ActionEvent e, String suffix) { - JButton source = (JButton) e.getSource(); - String clickedMessage = (String) source.getClientProperty("clickedText"); - String msg = "'" + source.getText() + "' clicked - " + suffix + " : " + clickedMessage; - ((DefaultListModel)messages.getModel()).addElement(msg); -}]]> - </script> - <Table id='demoPanel' fill='both' weightx='1'> - <row> - <cell> - <JCheckBox id='toggle' selected='true' - text='{toggle.isSelected() ? "Active layer" : "No layer"}' - onActionPerformed='setLayer(toggle.isSelected());'/> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JPanel layout='{new GridLayout(1,3,3,3)}'> - <JButton text='button A' decorator='boxed' _clickedText='"button A was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton text='button B' decorator='boxed' _clickedText='"button B was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton id='c' text='button C (full block)' decorator='boxed' _clickedText='"button C was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - <JButton id='d' text='button D (full block 2)' decorator='boxed' _clickedText='"button D was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - </JPanel> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JScrollPane> - <JList id='messages' model='{new DefaultListModel()}'/> - </JScrollPane> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Calculator.css b/jaxx-example/src/main/java/jaxx/demo/Calculator.css deleted file mode 100644 index 9abfe7c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Calculator.css +++ /dev/null @@ -1,68 +0,0 @@ -#table { - border: { BorderFactory . createEmptyBorder( 4, 4, 4, 4 ) -} - -; -font-face: - -"Trebuchet MS" -; -} - -#display { - background: #BCE5AD; - opaque: true; - horizontalAlignment: right; - border: { BorderFactory . createBevelBorder( BevelBorder . LOWERED ) -} - -; -font-size: - -22 -; -font-weight: bold - -; -} - -#display:{ - object . getText( ) . startsWith( "-" ) -} - -{ -foreground: red - -; -} - -JButton { - font-size: 18; - width: 80; - height: 35; -} - -JButton.digit { - foreground: blue; -} - -JButton#dot { - font-size: 20; -} - -JButton.operator { - font-size: 16; - foreground: #009900; -} - -JButton.clear { - foreground: red; -} - -JButton:mouseover { - font-weight: bold; -} - -JButton.operator:mouseover { - font-weight: normal; -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx deleted file mode 100644 index ebc8134..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx +++ /dev/null @@ -1,89 +0,0 @@ -<DemoPanel> - <style source='Calculator.css'/> - <script><![CDATA[ - plus.setText("+"); - sign.setText("+/-"); -]]></script> - <!-- use fully-qualified name just in case this is compiled into a different package --> - <CalculatorEngine id='engine'/> - - <Table id='demoPanel' fill='both'> - <row> - <cell columns='4'> - <JLabel id='display' text='{engine.getDisplayText()}'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton id='c' text='C' onActionPerformed='engine.clear()' styleClass='clear'/> - </cell> - <cell> - <JButton id='ce' text='CE' onActionPerformed='engine.clearEntry()' styleClass='clear'/> - </cell> - <cell> - <JButton id='equals' text='=' onActionPerformed='engine.equal()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d7' text='7' onActionPerformed='engine.digit(7)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d8' text='8' onActionPerformed='engine.digit(8)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d9' text='9' onActionPerformed='engine.digit(9)' styleClass='digit'/> - </cell> - <cell> - <JButton id='plus' onActionPerformed='engine.add()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d4' text='4' onActionPerformed='engine.digit(4)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d5' text='5' onActionPerformed='engine.digit(5)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d6' text='6' onActionPerformed='engine.digit(6)' styleClass='digit'/> - </cell> - <cell> - <JButton id='subtract' text='-' onActionPerformed='engine.subtract()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d1' text='1' onActionPerformed='engine.digit(1)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d2' text='2' onActionPerformed='engine.digit(2)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d3' text='3' onActionPerformed='engine.digit(3)' styleClass='digit'/> - </cell> - <cell> - <JButton id='multiply' text='x' onActionPerformed='engine.multiply()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d0' text='0' onActionPerformed='engine.digit(0)' styleClass='digit'/> - </cell> - <cell> - <JButton id='sign' onActionPerformed='engine.toggleSign()' styleClass='operator'/> - </cell> - <cell> - <JButton id='dot' text='.' onActionPerformed='engine.dot()' styleClass='digit'/> - </cell> - <cell> - <JButton id='divide' text='÷' onActionPerformed='engine.divide()' styleClass='operator'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java b/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java deleted file mode 100644 index 7476e76..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java +++ /dev/null @@ -1,177 +0,0 @@ -package jaxx.demo; - -import java.beans.*; -import java.math.*; - -public class CalculatorEngine { - public static final String DISPLAY_TEXT_PROPERTY = "displayText"; - - public static final int ADD = 0; - public static final int SUBTRACT = 1; - public static final int MULTIPLY = 2; - public static final int DIVIDE = 3; - public static final int RESULT = 4; - - private int operation = -1; - private boolean clear = true; // true to clear on next key - private String displayText = "0"; - private BigDecimal value; - private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); - - - public String getDisplayText() { - return displayText; - } - - - public void setDisplayText(String displayText) { - String oldDisplayText = this.displayText; - this.displayText = displayText; - firePropertyChange(DISPLAY_TEXT_PROPERTY, oldDisplayText, displayText); - } - - - public void clear() { - clearEntry(); - value = new BigDecimal(0); - operation = -1; - } - - - public void clearEntry() { - setDisplayText("0"); - clear = true; - } - - - private void checkClear() { - if (clear) { - setDisplayText(""); - clear = false; - } - } - - - public void digit(int digit) { - checkClear(); - setDisplayText(getDisplayText() + String.valueOf(digit)); - } - - - public void dot() { - checkClear(); - if (getDisplayText().indexOf('.') == -1) { - if (getDisplayText().length() == 0) { - setDisplayText("0."); - } else { - setDisplayText(getDisplayText() + '.'); - } - } - } - - - public void toggleSign() { - String text = getDisplayText(); - if (text.startsWith("-")) { - text = text.substring(1); - } else if (!text.equals("0")) { - text = '-' + text; - } - setDisplayText(text); - } - - - public void equal() { - BigDecimal displayValue = new BigDecimal(getDisplayText()); - BigDecimal newValue = displayValue; - switch (operation) { - case ADD: - newValue = value.add(displayValue); - break; - case SUBTRACT: - newValue = value.subtract(displayValue); - break; - case MULTIPLY: - newValue = value.multiply(displayValue); - break; - case DIVIDE: - newValue = value.divide(displayValue, 8, BigDecimal.ROUND_HALF_UP); - break; - } - value = newValue; - setDisplayText(toString(newValue)); - clear = true; - operation = -1; - } - - - public static String toString(BigDecimal decimal) { - // can't use stripTrailingZeros, as it wasn't introduced until 1.5 - String result = decimal.toString(); - if (result.indexOf(".") != -1) { - while (result.endsWith("0")) { - result = result.substring(0, result.length() - 1); - } - if (result.endsWith(".")) { - result = result.substring(0, result.length() - 1); - } - } - return result; - } - - - public void operation(int operation) { - if (this.operation != -1) { - equal(); - } else { - value = new BigDecimal(getDisplayText()); - clear = true; - } - this.operation = operation; - } - - - public void add() { - operation(ADD); - } - - - public void subtract() { - operation(SUBTRACT); - } - - - public void multiply() { - operation(MULTIPLY); - } - - - public void divide() { - operation(DIVIDE); - } - - - public void addPropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(listener); - } - - - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(property, listener); - } - - - public void removePropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(listener); - } - - - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(property, listener); - } - - - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - propertyChangeSupport.firePropertyChange(property, oldValue, newValue); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx deleted file mode 100644 index d1cc7de..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx +++ /dev/null @@ -1,35 +0,0 @@ - -<DemoPanel> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Locale editor:' labelFor='{localeEditor}'/> - </cell> - - <cell> - <LocaleEditor id='localeEditor'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (language) :' labelFor='{languageEditor}'/> - </cell> - <cell> - <EnumEditor id='languageEditor' constructorParams='org.nuiton.i18n.LanguageEnum.class'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (country) :' labelFor='{countryEditor}'/> - </cell> - <cell> - <EnumEditor id='countryEditor' constructorParams='org.nuiton.i18n.CountryEnum.class'/> - </cell> - </row> - <row> - <cell columns="2"> - <JTextArea text='{"locale : "+ localeEditor.getSelectedItem() + "\nlanguage : "+ languageEditor.getSelectedItem() + "\ncountry : " + countryEditor.getSelectedItem()}'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx deleted file mode 100644 index 9f706ff..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx +++ /dev/null @@ -1,12 +0,0 @@ -<DemoPanel> - <script>int count;</script> - <JPanel id='demoPanel'> - <JTextField text='{count}' constraints='BorderLayout.NORTH'/> - <HBox constraints='BorderLayout.SOUTH'> - <JButton text='Dec (-)' onActionPerformed='count--'/> - <JButton text='Reset' onActionPerformed='count = 0'/> - <JButton text='Inc (+)' onActionPerformed='count++'/> - </HBox> - </JPanel> - -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx deleted file mode 100644 index 1d6fac5..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx +++ /dev/null @@ -1,45 +0,0 @@ -<JTabbedPane id='top'> - <script><![CDATA[ - import java.io.*; - - public String getLabel() { - String name = getClass().getName(); - name = name.substring(name.lastIndexOf(".") + 1); - if (name.endsWith("Demo")) - name = name.substring(0, name.length() - "Demo".length()); - return name; - } - - - public String getDemoTabTitle() { - return getLabel() + " Demo"; - } - - - public String loadSource() { - try { - String className = getClass().getName(); - Reader in = new InputStreamReader(getClass().getResourceAsStream(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")); - StringWriter out = new StringWriter(); - char[] buffer = new char[2048]; - int c; - while ((c = in.read(buffer)) > 0) - out.write(buffer, 0, c); - return out.toString(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - ]]></script> - - <tab title='{getDemoTabTitle()}'> - <JPanel id='demoPanel'/> - </tab> - - <tab title='Source'> - <JScrollPane height='100'> - <JTextArea text='{loadSource()}' editable='false'/> - </JScrollPane> - </tab> -</JTabbedPane> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx deleted file mode 100644 index 0c38829..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx +++ /dev/null @@ -1,5 +0,0 @@ -<DemoPanel> -<JPanel id='demoPanel'> - <JLabel text='emptyNode'/> -</JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java b/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java deleted file mode 100644 index b1dcfba..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Date; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.JAXXTree.JAXXTreeModel; -import jaxx.runtime.swing.navigation.ItemNavigationCardPanel; -import jaxx.runtime.swing.navigation.ItemTreeNavigationAdapter; - -/** - * - * @author letellier - */ -public class ExempleItemTreeNavigationAdapter extends ItemTreeNavigationAdapter{ - - Item currentItem = null; - - public ExempleItemTreeNavigationAdapter(JAXXObject context, JAXXTree tree, ItemNavigationCardPanel cardPanel){ - super(context, tree, cardPanel); - - ItemTreeNavigationDemo demo = (ItemTreeNavigationDemo)context; - demo.addPropertyChangeListener("date", new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (currentItem != null && !(currentItem.getValue() instanceof Class)){ - currentItem.setValue((Date)evt.getNewValue()); - } - } - }); - - demo.addPropertyChangeListener("string", new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (currentItem != null && !(currentItem.getValue() instanceof Class)){ - currentItem.setValue((String)evt.getNewValue()); - } - } - }); - } - - @Override - protected void valueChanged(Object data) { - ItemTreeNavigationDemo demo = (ItemTreeNavigationDemo)context; - currentItem = ((JAXXTreeModel)tree.getModel()).findItem(data); - if (data instanceof String){ - demo.setString((String)data); - } else if (data instanceof Date){ - demo.setDate((Date)data); - } else { - demo.setString(""); - demo.setDate(null); - } - } - -} diff --git a/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx deleted file mode 100644 index 2efd86a..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx +++ /dev/null @@ -1,46 +0,0 @@ - -<DemoPanel> - <script><![CDATA[ -//localeEditor.loadI18nBundles(); -]]> - </script> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Empty I18n editor:' labelFor='{localeEmptyEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEmptyEditor' /> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor:' labelFor='{localeEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no text :' labelFor='{localeWithNoTextEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoTextEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showText='false'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no icon :' labelFor='{localeWithNoIconEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoIconEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showIcon='false'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Identity.java b/jaxx-example/src/main/java/jaxx/demo/Identity.java deleted file mode 100644 index 2166c2c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Identity.java +++ /dev/null @@ -1,103 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.File; - -public class Identity { - - protected String firstName = ""; - - protected String lastName = ""; - - protected String email = "dummy@codelutin.com"; - - protected int age = 51; - - protected File config = new File("/tmp"); - - protected File dir = new File("/tmp"); - - PropertyChangeSupport p; - - public Identity() { - p = new PropertyChangeSupport(this); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } - - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public int getAge() { - return age; - } - - public File getConfig() { - return config; - } - - public File getDir() { - return dir; - } - - public void setFirstName(String firstName) { - String oldFirstName = this.firstName; - this.firstName = firstName; - p.firePropertyChange("firstName", oldFirstName, firstName); - } - - public void setLastName(String lastName) { - String oldLastName = this.lastName; - this.lastName = lastName; - p.firePropertyChange("lastName", oldLastName, lastName); - } - - public void setEmail(String email) { - String oldEmail = this.email; - this.email = email; - p.firePropertyChange("email", oldEmail, email); - } - - public void setAge(int age) { - int oldAge = this.age; - this.age = age; - p.firePropertyChange("age", oldAge, age); - } - - public void setConfig(File config) { - File oldConfig = this.config; - this.config = config; - p.firePropertyChange("config", oldConfig, config); - } - - public void setDir(File dir) { - File oldDir = this.dir; - this.dir = dir; - p.firePropertyChange("dir", oldDir, dir); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx deleted file mode 100644 index 130502c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx +++ /dev/null @@ -1,41 +0,0 @@ -<DemoPanel> - - <String id='string' javaBean='null'/> - <Date id='date' javaBean='null'/> - - <script> -import jaxx.runtime.swing.navigation.*; -import org.jdesktop.swingx.JXDatePicker; - -void $afterCompleteSetup() { - new ExempleItemTreeNavigationAdapter(this, nav, content); -} - </script> - - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JSplitPane constraints='BorderLayout.CENTER'> - <JScrollPane> - <JTree id='nav' rootVisible='{false}'> - <!-- Allow to diplay associated pane without value --> - <item id='stringItemParent' label='String' value='{String.class}'> - <item id='string1Item' label='String1' value='{new String("Ceci est un String")}' selected='true'/> - <item id='string2Item' label='String2' value='{new String("Celui-ci un autre")}'/> - </item> - <item id='dateItemParent' label='Date' value='{Date.class}'> - <item id='dateItem' label='CurrentDate' value='{new Date()}'/> - </item> - </JTree> - </JScrollPane> - <!-- Card panel, only ItemNavigationPanel children is alowed --> - <ItemNavigationCardPanel id="content"> - <!-- The associated type is passed by the constructor --> - <ItemNavigationPanel id='stringPanel' constructorParams='String.class' layout='{new FlowLayout()}'> - <JTextField id='stringTextField' text='{getString()}' onKeyReleased='setString(stringTextField.getText())'/> - </ItemNavigationPanel> - <ItemNavigationPanel id='datePanel' constructorParams='Date.class' layout='{new FlowLayout()}'> - <JXDatePicker id='datePicker' date='{getDate()}' onActionPerformed='setDate(datePicker.getDate())'/> - </ItemNavigationPanel> - </ItemNavigationCardPanel> - </JSplitPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx deleted file mode 100644 index beae928..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx +++ /dev/null @@ -1,134 +0,0 @@ -<Application title="JAXX Demo" width='1024' height='800' defaultCloseOperation='exit_on_close'> - <script><![CDATA[ - -static { -org.nuiton.i18n.I18n.init("fr", "FR"); -} - -void $afterCompleteSetup() { - - - try { jaxx.runtime.SwingUtil.initNimbusLoookAndFeel(); } catch (Exception e) { log.error(e.getMessage(), e); } - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - int i=0; - while( i < list.getRowCount()) { - list.expandRow(i++); - } - } - }); -} - -]]></script> - <JSplitPane> - <!--JSplitPane dividerLocation='200'--> - <JScrollPane> - <JTree id='list' showsRootHandles='true' - onValueChanged='cardLayout.show(preview, list.getSelectionValue() instanceof DemoPanel ? ((DemoPanel) list.getSelectionValue()).getLabel() : emptyDemo.getLabel())' - cellRenderer='{new javax.swing.tree.DefaultTreeCellRenderer() { - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - if (value instanceof DemoPanel) - value = ((DemoPanel) value).getLabel(); - return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - } - }'> - <item value="Components"> - <item value='Buttons'> - <item value='{buttonDemo}'/> - <item value='{checkBoxDemo}'/> - <item value='{radioButtonDemo}'/> - <item value='{toggleButtonDemo}'/> - </item> - - <item value='Form elements'> - <item value='Text'> - <item value='{passwordFieldDemo}'/> - <item value='{textFieldDemo}'/> - <item value='{textAreaDemo}'/> - </item> - - <item value='{comboBoxDemo}'/> - <item value='{listDemo}'/> - <item value='{sliderDemo}'/> - <item value='{spinnerDemo}'/> - </item> - - <item value='Layout components'> - <item value='{splitPaneDemo}'/> - </item> - - <item value='Menus'> - <item value='{menuItemDemo}'/> - <item value='{checkBoxMenuItemDemo}'/> - <item value='{radioButtonMenuItemDemo}'/> - </item> - - <item value='Windows'> - <item value='{dialogDemo}'/> - </item> - - <item value='{progressBarDemo}'/> - - </item> - - <item value='{labelStyleDemo}'/> - - <item value='{counterDemo}'/> - <item value='{calculatorDemo}'/> - - <item value='New features'> - <item value='Validation'> - <item value='{validationDemo1}'/> - <item value='{validationDemo2}'/> - </item> - <item value='{itemTreeNavigationDemo}'/> - <item value='{dataBindingDemo}'/> - <item value='{boxedDecoratorDemo}'/> - <item value='{statusMessagePanelDemo}'/> - <item value='Editors'> - <item value='{numberEditorDemo}'/> - <item value='{comboEditorDemo}'/> - <item value='{i18nEditorDemo}'/> - </item> - </item> - </JTree> - </JScrollPane> - - <java.awt.CardLayout id='cardLayout'/> - - <JPanel id='preview' layout='{cardLayout}'> - <EmptyDemo id='emptyDemo' constraints='emptyDemo.getLabel()'/> - <JButtonDemo id='buttonDemo' constraints='buttonDemo.getLabel()'/> - <JCheckBoxDemo id='checkBoxDemo' constraints='checkBoxDemo.getLabel()'/> - <JCheckBoxMenuItemDemo id='checkBoxMenuItemDemo' constraints='checkBoxMenuItemDemo.getLabel()'/> - <JComboBoxDemo id='comboBoxDemo' constraints='comboBoxDemo.getLabel()'/> - <JDialogDemo id='dialogDemo' constraints='dialogDemo.getLabel()'/> - <JListDemo id='listDemo' constraints='listDemo.getLabel()'/> - <JMenuItemDemo id='menuItemDemo' constraints='menuItemDemo.getLabel()'/> - <JPasswordFieldDemo id='passwordFieldDemo' constraints='passwordFieldDemo.getLabel()'/> - <JProgressBarDemo id='progressBarDemo' constraints='progressBarDemo.getLabel()'/> - <JSliderDemo id='sliderDemo' constraints='sliderDemo.getLabel()'/> - <JSpinnerDemo id='spinnerDemo' constraints='spinnerDemo.getLabel()'/> - <JSplitPaneDemo id='splitPaneDemo' constraints='splitPaneDemo.getLabel()'/> - <JRadioButtonDemo id='radioButtonDemo' constraints='radioButtonDemo.getLabel()'/> - <JRadioButtonMenuItemDemo id='radioButtonMenuItemDemo' constraints='radioButtonMenuItemDemo.getLabel()'/> - <JToggleButtonDemo id='toggleButtonDemo' constraints='toggleButtonDemo.getLabel()'/> - <JTextFieldDemo id='textFieldDemo' constraints='textFieldDemo.getLabel()'/> - <JTextAreaDemo id='textAreaDemo' constraints='textAreaDemo.getLabel()'/> - <ValidationListDemo id='validationDemo1' constraints='validationDemo1.getLabel()'/> - <ValidationTableDemo id='validationDemo2' constraints='validationDemo2.getLabel()'/> - <ItemTreeNavigationDemo id='itemTreeNavigationDemo' constraints='itemTreeNavigationDemo.getLabel()'/> - <BeanDataBindingDemo id='dataBindingDemo' constraints='dataBindingDemo.getLabel()'/> - <LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/> - <CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/> - <CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/> - <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/> - <NumberEditorDemo id='numberEditorDemo' constraints='numberEditorDemo.getLabel()'/> - <ComboEditorDemo id='comboEditorDemo' constraints='comboEditorDemo.getLabel()'/> - <I18nEditorDemo id='i18nEditorDemo' constraints='i18nEditorDemo.getLabel()'/> - <StatusMessagePanelDemo id='statusMessagePanelDemo' constraints='statusMessagePanelDemo.getLabel()'/> - </JPanel> - </JSplitPane> -</Application> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx deleted file mode 100644 index db42c63..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx +++ /dev/null @@ -1,29 +0,0 @@ -<DemoPanel> - <style> - JButton.fancy { - foreground: blue; - font-face: Arial; - font-size: 18; - } - - JButton.fancy:mouseover { - foreground: red; - font-style: italic; - } - </style> - - <script> - public void buttonClicked(JButton button) { - JOptionPane.showMessageDialog(this, button.getText() + " clicked!", "onActionPerformed", - JOptionPane.INFORMATION_MESSAGE); - } - </script> - - <javax.swing.ImageIcon id='pencil' constructorParams='getClass().getResource("images/pencil_black.gif")'/> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Simple Button' onActionPerformed='buttonClicked((JButton) event.getSource())'/> - <JButton text='Fancy Button' styleClass='fancy' icon='{pencil}' - onActionPerformed='buttonClicked((JButton) event.getSource())'/> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx deleted file mode 100644 index 19fb5ec..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx +++ /dev/null @@ -1,38 +0,0 @@ -<DemoPanel> - <script><![CDATA[ - public String getText(boolean bold, boolean italic, boolean underline) { - String text ="Sample Text"; - if (bold) - text = "<b>" + text + "</b>"; - if (italic) - text = "<i>" + text + "</i>"; - if (underline) - text = "<u>" + text + "</u>"; - return "<html>" + text; - } - ]]></script> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <Table anchor='west'> - <row> - <cell> - <JCheckBox id='bold' text='Bold' mnemonic='B'/> - </cell> - <cell rows='3'> - <JLabel font='{new Font("Arial", 0, 18)}' - text='{getText(bold.isSelected(), italic.isSelected(), underline.isSelected())}'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='italic' text='Italic' mnemonic='I'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='underline' text='Underline' mnemonic='U'/> - </cell> - </row> - </Table> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx deleted file mode 100644 index 8769306..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx +++ /dev/null @@ -1,59 +0,0 @@ -<JMenuItemDemo> - <style> - .form { - enabled: { enabledCheckBox.isSelected() }; - editable: { editableCheckBox.isSelected() }; - } - </style> - - <JMenuBar id='menuBar'> - <JMenu text='View'> - <JCheckBoxMenuItem id='enabledCheckBox' text='Enabled' selected='true'/> - <JCheckBoxMenuItem id='editableCheckBox' text='Editable' selected='true'/> - </JMenu> - </JMenuBar> - - <Table id='framePanel' anchor='northwest'> - <row> - <cell> - <JLabel text='First Name:' displayedMnemonic='F' labelFor='{firstName}'/> - </cell> - - <cell weightx='1' fill='horizontal'> - <JTextField id='firstName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Last Name:' displayedMnemonic='L' labelFor='{lastName}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='lastName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Email Address:' displayedMnemonic='E' labelFor='{email}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='email' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Comments:' displayedMnemonic='C' labelFor='{comments}'/> - </cell> - - <cell weightx='1' weighty='1' fill='both'> - <JScrollPane width='150' height='75'> - <JTextArea id='comments' styleClass="form"/> - </JScrollPane> - </cell> - </row> - </Table> -</JMenuItemDemo> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx deleted file mode 100644 index 1ce9790..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx +++ /dev/null @@ -1,22 +0,0 @@ - -<DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Button label:'/> - </cell> - - <cell> - <JComboBox id='comboBox' editable='true'> - <item value='OK' selected='true'/> - <item value='Cancel'/> - <item value='Help'/> - </JComboBox> - </cell> - - <cell> - <JButton text='{comboBox.getSelectedItem()}'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx deleted file mode 100644 index 565d5b2..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx +++ /dev/null @@ -1,79 +0,0 @@ -<DemoPanel> - <script> - String username; - String password; - - private class OKAction extends javax.swing.AbstractAction { - public OKAction() { - putValue(NAME, "OK"); - } - - - public void actionPerformed(ActionEvent e) { - username = usernameField.getText(); - password = new String(passwordField.getPassword()); - dialog.dispose(); - } - } - - - private class CancelAction extends javax.swing.AbstractAction { - public CancelAction() { - putValue(NAME, "Cancel"); - } - - - public void actionPerformed(ActionEvent e) { - dialog.dispose(); - } - } - { - JRootPane rootPane = dialog.getRootPane(); - rootPane.setDefaultButton(ok); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); - rootPane.getActionMap().put("cancel", new CancelAction()); - } - </script> - - <JDialog title='Sign on' id='dialog' modal='true' onWindowOpened='dialog.setLocationRelativeTo(demoPanel); - passwordField.setText("");'> - <Table> - <row> - <cell> - <JLabel text='Username:' displayedMnemonic='U' labelFor='{usernameField}'/> - </cell> - - <cell> - <JTextField id='usernameField'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{passwordField}'/> - </cell> - - <cell> - <JPasswordField id='passwordField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1, 0, 6, 6)}'> - <JButton id='ok' text='OK' action='{new OKAction()}'/> - <JButton text='Cancel' action='{new CancelAction()}'/> - </JPanel> - </cell> - </row> - </Table> - </JDialog> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Show password dialog' onActionPerformed='dialog.setVisible(true)'/> - <VBox> - <JLabel text='{username != null ? "Username: " + username : ""}'/> - <JLabel text='{password != null ? "Password: " + password : ""}'/> - </VBox> - </VBox> -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx deleted file mode 100644 index 6ec324f..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx +++ /dev/null @@ -1,59 +0,0 @@ -<DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Supported Swing components:'/> - </cell> - </row> - - <row> - <cell> - <JScrollPane> - <JList> - <item value='JApplet'/> - <item value='JButton'/> - <item value='JCheckBox'/> - <item value='JCheckBoxMenuItem'/> - <item value='JColorChooser'/> - <item value='JComboBox'/> - <item value='JDesktopPane'/> - <item value='JDialog'/> - <item value='JEditorPane'/> - <item value='JFileChooser'/> - <item value='JFormattedTextField'/> - <item value='JFrame'/> - <item value='JInternalFrame'/> - <item value='JLabel'/> - <item value='JLayeredPane'/> - <item value='JList'/> - <item value='JMenu'/> - <item value='JMenuBar'/> - <item value='JMenuItem'/> - <item value='JOptionPane'/> - <item value='JPanel'/> - <item value='JPasswordField'/> - <item value='JPopupMenu'/> - <item value='JProgressBar'/> - <item value='JRadioButton'/> - <item value='JRadioButtonMenuItem'/> - <item value='JScrollBar'/> - <item value='JScrollPane'/> - <item value='JSeparator'/> - <item value='JSlider'/> - <item value='JSpinner'/> - <item value='JSplitPane'/> - <item value='JTabbedPane'/> - <item value='JTable'/> - <item value='JTextArea'/> - <item value='JTextField'/> - <item value='JTextPane'/> - <item value='JToggleButton'/> - <item value='JToolBar'/> - <item value='JTree'/> - <item value='JWindow'/> - </JList> - </JScrollPane> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx deleted file mode 100644 index 8cd5da5..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx +++ /dev/null @@ -1,23 +0,0 @@ -<DemoPanel> - <script> - private void displayMessage() { - JOptionPane.showMessageDialog(demoPanel, "Menu item clicked"); - } - </script> - - <JPanel id='demoPanel'> - <JDesktopPane width='350' height='400' background='{null}'> - <JInternalFrame title='JMenu demo' width='300' height='250' resizable='true'> - <JMenuBar id='menuBar'> - <JMenu text='Demo'> - <JMenuItem text='Message Box' onActionPerformed='displayMessage()'/> - </JMenu> - </JMenuBar> - - <JPanel id='framePanel'> - <JLabel text='JMenu demo' id='demoMessage' horizontalAlignment='center'/> - </JPanel> - </JInternalFrame> - </JDesktopPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx deleted file mode 100644 index b266c65..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx +++ /dev/null @@ -1,10 +0,0 @@ -<DemoPanel> - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <HBox> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{password}'/> - <JPasswordField id='password'/> - </HBox> - - <JLabel text='You entered: {new String(password.getPassword())}'/> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx deleted file mode 100644 index 8c38933..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx +++ /dev/null @@ -1,77 +0,0 @@ -<DemoPanel> - <script><![CDATA[ - import javax.swing.Timer; - - int red = 0; - int green = 0; - int blue = 0; - int speed = 2; - int redDirection = 1; - int greenDirection = 1; - int blueDirection = 1; - - Timer redTimer = new Timer(5, new ActionListener() { - public void actionPerformed(ActionEvent e) { - red = Math.max(0, Math.min(255, red + speed * redDirection)); - if (red == 0 || red == 255) - redDirection = -redDirection; - } - }); - - Timer greenTimer = new Timer(50, new ActionListener() { - public void actionPerformed(ActionEvent e) { - green = Math.max(0, Math.min(255, green + speed * greenDirection)); - if (green == 0 || green == 255) - greenDirection = -greenDirection; - } - }); - - Timer blueTimer = new Timer(500, new ActionListener() { - public void actionPerformed(ActionEvent e) { - blue = Math.max(0, Math.min(255, blue + speed * blueDirection)); - if (blue == 0 || blue == 255) - blueDirection = -blueDirection; - } - }); - - redTimer.start(); - greenTimer.start(); - blueTimer.start(); - ]]></script> - - <Table insets='6' id='demoPanel'> - <row> - <cell columns='3'> - <JLabel text='Welcome to the JAXX framework!' font='{UIManager.getFont("Label.font").deriveFont(18f)}' - foreground='{new Color(red, green, blue)}'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(red, 0, 0)}' value='{red}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, green, 0)}' value='{green}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, 0, blue)}' value='{blue}' maximum='255'/> - </cell> - </row> - - <row> - <cell weightx='1' anchor='east'> - <JButton text='Start' onActionPerformed='redTimer.start(); greenTimer.start(); blueTimer.start()'/> - </cell> - <cell> - <JButton text='Stop' onActionPerformed='redTimer.stop(); greenTimer.stop(); blueTimer.stop()'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx deleted file mode 100644 index ccd4088..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx +++ /dev/null @@ -1,11 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JRadioButton text='Animal' value='Lynx.jpg' buttonGroup='radioButtons' selected='true'/> - <JRadioButton text='Vegetable' buttonGroup='radioButtons' value='Tomato.jpg'/> - <JRadioButton text='Mineral' buttonGroup='radioButtons' value='Amethyst.jpg'/> - </VBox> - - <JLabel icon='{new ImageIcon(getClass().getResource("images/" + radioButtons.getSelectedValue()))}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx deleted file mode 100644 index 62a3996..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx +++ /dev/null @@ -1,14 +0,0 @@ -<JMenuItemDemo> - <JMenuBar id='menuBar'> - <JMenu text='Font size'> - <JRadioButtonMenuItem text='10' value='{new Integer(10)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='12' value='{new Integer(12)}' buttonGroup='fontSize' selected='true'/> - <JRadioButtonMenuItem text='14' value='{new Integer(14)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='18' value='{new Integer(18)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='24' value='{new Integer(24)}' buttonGroup='fontSize'/> - </JMenu> - </JMenuBar> - - <JLabel id='demoMessage' text='Font size: {fontSize.getSelectedValue()}' horizontalAlignment='center' - font='{UIManager.getFont("Label.font").deriveFont(fontSize.getSelectedValue() != null ? (float) ((Integer) fontSize.getSelectedValue()).intValue() : 12)}'/> -</JMenuItemDemo> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx deleted file mode 100644 index fcebefb..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx +++ /dev/null @@ -1,12 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JSlider id='red' maximum='255' value='200'/> - <JSlider id='green' maximum='255' value='180'/> - <JSlider id='blue' maximum='255' value='240'/> - </VBox> - - <JPanel border='{BorderFactory.createEtchedBorder()}' width='64' height='64' - background='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx deleted file mode 100644 index a4c74ae..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx +++ /dev/null @@ -1,13 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> - - <JSpinner minimum='0' maximum='50' id='spinner'/> - - <VBox spacing='{((Integer) spinner.getValue()).intValue()}'> - <JLabel text='Use the spinner to'/> - <JLabel text='adjust the spacing'/> - <JLabel text='between these lines'/> - </VBox> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx deleted file mode 100644 index 4aafbc4..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx +++ /dev/null @@ -1,13 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JSplitPane> - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("images/Amethyst.jpg"))}'/> - </JScrollPane> - - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("images/Lynx.jpg"))}'/> - </JScrollPane> - </JSplitPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx deleted file mode 100644 index 4cac85a..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx +++ /dev/null @@ -1,33 +0,0 @@ -<DemoPanel> - <Table id='demoPanel' anchor='northwest'> - <row> - <cell> - <JLabel text='Normal text:' displayedMnemonic='N' labelFor='{textArea}'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea id='textArea' text='Try typing some text here.'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell> - <JLabel text='Upper case text:'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea editable='false' background='{null}' text='{textArea.getText().toUpperCase()}'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell weighty='1'> - <JPanel/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx deleted file mode 100644 index 584f6dc..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx +++ /dev/null @@ -1,22 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel'> - <Table> - <row> - <cell> - <JLabel text='Your name:' displayedMnemonic='n' labelFor='{textField}'/> - </cell> - - <cell> - <JTextField id='textField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton text='Greet' - onActionPerformed='JOptionPane.showMessageDialog(demoPanel, "Hello, " + textField.getText() + "!")'/> - </cell> - </row> - </Table> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx deleted file mode 100644 index 01f29de..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx +++ /dev/null @@ -1,9 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JToggleButton text='1' id='one'/> - <JToggleButton text='2' id='two'/> - <JToggleButton text='3' id='three'/> - - <JLabel text='Total: {(one.isSelected() ? 1 : 0) + (two.isSelected() ? 2 : 0) + (three.isSelected() ? 3 : 0)}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css b/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css deleted file mode 100644 index 8fe50a3..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css +++ /dev/null @@ -1,43 +0,0 @@ -JSlider { - paintTicks: true; -} - -JSlider.color { - minorTickSpacing: 10; - majorTickSpacing: 50; - border: { BorderFactory . createEmptyBorder( 1, 1, 1, 1 ) -} - -; -} - -JSlider.color:focused { - border: { BorderFactory . createLineBorder( Color . BLACK, 1 ) -} - -; -} - -JSlider#red:focused { - background: #E7ADAD; -} - -JSlider#green:focused { - background: #B2E7AD; -} - -JSlider#blue:focused { - background: #ADB2E7; -} - -JSlider#dummySize { - minorTickSpacing: 2; - majorTickSpacing: 6; -} - -JRadioButton { - enabled: { backgroundCheckbox . isSelected( ) -} - -; -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx deleted file mode 100644 index 8862635..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx +++ /dev/null @@ -1,85 +0,0 @@ -<DemoPanel> - <style source="LabelStyle.css"/> - - <Table id='demoPanel' anchor='north' fill='both'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='Data Binding'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Red:'/> - </cell> - <cell> - <JSlider id='red' value='128' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Green:'/> - </cell> - <cell> - <JSlider id='green' value='0' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Blue:'/> - </cell> - <cell> - <JSlider id='blue' value='255' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Size:'/> - </cell> - <cell> - <JSlider id='dummySize' value='36' minimum='6' maximum='60'/> - </cell> - </row> - - <row> - <cell columns='2' fill='both' weighty='1'> - <JPanel border='{BorderFactory.createTitledBorder("Preview")}' - height='90' - layout='{new BorderLayout()}'> - <VBox background='{(Color)( backgroundCheckbox.isSelected() ? backgroundColor.getSelectedValue() : null)}' - margin='0' - horizontalAlignment='center' - verticalAlignment='middle'> - <JLabel text='{text.getText()}' font-size='{dummySize.getValue()}' - foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </VBox> - </JPanel> - </cell> - </row> - </Table> - </cell> - - <cell> - <VBox spacing='0' border='{BorderFactory.createTitledBorder("Background")}'> - <JCheckBox id='backgroundCheckbox' text='Show Background'/> - <JRadioButton text='Red' buttonGroup='backgroundColor' value='{Color.RED}' selected='true'/> - <JRadioButton text='Orange' buttonGroup='backgroundColor' value='{Color.ORANGE}'/> - <JRadioButton text='Yellow' buttonGroup='backgroundColor' value='{Color.YELLOW}'/> - <JRadioButton text='Green' buttonGroup='backgroundColor' value='{Color.GREEN}'/> - <JRadioButton text='Cyan' buttonGroup='backgroundColor' value='{Color.CYAN}'/> - <JRadioButton text='Blue' buttonGroup='backgroundColor' value='{Color.BLUE}'/> - <JRadioButton text='Purple' buttonGroup='backgroundColor' value='{new Color(160, 30, 255)}'/> - </VBox> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Model.java b/jaxx-example/src/main/java/jaxx/demo/Model.java deleted file mode 100644 index 873d638..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Model.java +++ /dev/null @@ -1,66 +0,0 @@ -package jaxx.demo; - -import java.beans.*; - -public class Model { - - protected String text = "text"; - - protected String text2 = "text2"; - - protected int ratio = 51; - - - PropertyChangeSupport p; - - public Model() { - p = new PropertyChangeSupport(this); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } - - - public String getText() { - return text; - } - - public String getText2() { - return text2; - } - - public int getRatio() { - return ratio; - } - - public void setText(String text) { - String oldText = this.text; - this.text = text; - p.firePropertyChange("text", oldText, text); - } - - public void setText2(String text2) { - String oldText2 = this.text2; - this.text2 = text2; - p.firePropertyChange("text2", oldText2, text2); - } - - public void setRatio(int ratio) { - int oldRatio = this.ratio; - this.ratio = ratio; - p.firePropertyChange("ratio", oldRatio, ratio); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx deleted file mode 100644 index c7d822d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx +++ /dev/null @@ -1,132 +0,0 @@ - -<DemoPanel> - <script><![CDATA[ -import jaxx.runtime.swing.editor.NumberEditor; - -void $afterCompleteSetup() { - positifIntegerEditor.init(); - positifIntegerEditor2.init(); - normalIntegerEditor.init(); - normalIntegerEditor2.init(); - positifFloatEditor.init(); - positifFloatEditor2.init(); - normalFloatEditor.init(); - normalFloatEditor2.init(); -} -]]> - </script> - - <!-- model --> - <NumberEditorDemoModel id='demoModel'/> - - <Table id='demoPanel' insets='0' fill='both'> - <row> - <cell weightx='0.5'> - <JLabel horizontalAlignment='center' text='numbereditor.type'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.without.auto.popup'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.with.auto.popup'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.int", demoModel.getPositifInteger())}'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor2' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.int", demoModel.getNormalInteger())}'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor2' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.float", demoModel.getPositifFloat())}'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor2' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.float", demoModel.getNormalFloat())}'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor2' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - </Table> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java b/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java deleted file mode 100644 index 0e64f8d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -/** - * - * @author chemit - * @since 1.5 - */ -public class NumberEditorDemoModel { - - protected PropertyChangeSupport p; - protected int positifInteger; - protected int normalInteger; - protected float positifFloat; - protected float normalFloat; - - public NumberEditorDemoModel() { - p = new PropertyChangeSupport(this); - } - - public float getNormalFloat() { - return normalFloat; - } - - public int getNormalInteger() { - return normalInteger; - } - - public float getPositifFloat() { - return positifFloat; - } - - public int getPositifInteger() { - return positifInteger; - } - - public void setNormalFloat(float normalFloat) { - float old = this.normalFloat; - this.normalFloat = normalFloat; - p.firePropertyChange("normalFloat", old, normalFloat); - } - - public void setNormalInteger(int normalInteger) { - int old = this.normalInteger; - this.normalInteger = normalInteger; - p.firePropertyChange("normalInteger", old, normalInteger); - } - - public void setPositifFloat(float positifFloat) { - float old = this.positifFloat; - this.positifFloat = positifFloat; - p.firePropertyChange("positifFloat", old, positifFloat); - } - - public void setPositifInteger(int positifInteger) { - int old = this.positifInteger; - this.positifInteger = positifInteger; - p.firePropertyChange("positifInteger", old, positifInteger); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } -} diff --git a/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx deleted file mode 100644 index 45ee421..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx +++ /dev/null @@ -1,11 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> - <JButton text='Fool me once' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on you!")'/> - <JButton text='Fool me twice' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on ...")'/> - </JPanel> - <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Validation.css b/jaxx-example/src/main/java/jaxx/demo/Validation.css deleted file mode 100644 index 7479d16..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Validation.css +++ /dev/null @@ -1,5 +0,0 @@ -JSlider { - paintTicks: true; - minorTickSpacing: 5; - majorTickSpacing: 10; -} diff --git a/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx deleted file mode 100644 index 888c5df..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx +++ /dev/null @@ -1,325 +0,0 @@ -<DemoPanel> - <style source="Validation.css"/> - -<script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -void $afterCompleteSetup() { -}]]> -</script> - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageListModel id='errors'--> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' - onContentsChanged='ok.setEnabled(errors.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' id='demoPanel'> - <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 java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.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='{errors}' - cellRenderer='{new jaxx.runtime.validator.swing.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> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx deleted file mode 100644 index 41b586d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx +++ /dev/null @@ -1,331 +0,0 @@ -<DemoPanel> - <style source="Validation.css"/> - - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageTableModel id='errors2'/--> - <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errors2' - onTableChanged='ok.setEnabled(errors2.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> - - <script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); -} -]]></script> - - <Table fill='both' id='demoPanel'> - <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 java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.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='{errors2}' 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> - -</DemoPanel> diff --git a/jaxx-example/src/main/jnlp/jxlayer.jnlp b/jaxx-example/src/main/jnlp/jxlayer.jnlp deleted file mode 100644 index ef01376..0000000 --- a/jaxx-example/src/main/jnlp/jxlayer.jnlp +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<jnlp spec="1.0+" codebase="@url@" href="jxlayer.jnlp"> - <information> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <offline-allowed/> - </information> - <resources> - <jar href="lib/@lib@"/> - </resources> - <component-desc/> -</jnlp> \ No newline at end of file diff --git a/jaxx-example/src/main/jnlp/sun.jnlp b/jaxx-example/src/main/jnlp/sun.jnlp deleted file mode 100644 index f345d95..0000000 --- a/jaxx-example/src/main/jnlp/sun.jnlp +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> - <information> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <offline-allowed/> - </information> - <resources> - <jar href="lib/@lib@"/> - </resources> - <component-desc/> -</jnlp> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties b/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties deleted file mode 100644 index 48f0c56..0000000 --- a/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties +++ /dev/null @@ -1,142 +0,0 @@ --= -.= -0= -1= -10= -12= -14= -18= -2= -24= -3= -4= -5= -6= -7= -8= -9= -Age\:= -Animal= -Blue= -Blue\:= -Bold= -Button\ label\:= -C= -CE= -Cancel= -Change\ layer\ state= -Click\ me= -Comments\:= -Config\ file\ \:= -Config\ file\:= -Cyan= -Dec\ (-)= -Demo= -Directory\ file\:= -Editable= -Email\ Address\:= -Email\:= -Empty\ I18n\ editor\:= -Enabled= -EnumEditor\ (country)\ \:= -EnumEditor\ (language)\ \:= -Fancy\ Button= -First\ Name\:= -FirstName\:= -Font\ size= -Fool\ me\ once= -Fool\ me\ twice= -Green= -Green\:= -Greet= -I18n\ editor\ with\ no\ icon\ \:= -I18n\ editor\ with\ no\ text\ \:= -I18n\ editor\:= -Inc\ (+)= -Italic= -JAXX\ Demo= -JMenu\ demo= -Last\ Name\:= -LastName\:= -Locale\ editor\:= -Message\ Box= -Mineral= -Normal\ text\:= -OK= -Orange= -Password\:= -Purple= -Ratio\:= -Red= -Red\:= -Reset= -Show\ Background= -Show\ password\ dialog= -Sign\ on= -Simple\ Button= -Size\:= -Source= -Spacing\:= -Start= -Stop= -Supported\ Swing\ components\:= -Text2\:= -Text\:= -Underline= -Upper\ case\ text\:= -Use\ the\ spinner\ to= -Username\:= -Vegetable= -View= -Welcome\ to\ the\ JAXX\ framework\!= -Working\ directory\:= -Yellow= -Your\ name\:= -\\u00f7= -adjust\ the\ spacing= -between\ these\ lines= -button\ A= -button\ B= -button\ C= -button\ C\ (full\ block)= -button\ D\ (full\ block\ 2)= -button\ with\ layer= -cancel= -close= -close2= -close3= -edit= -edit2= -edit3= -emptyNode=< empty node > -form.ratio=Form \: ratio -form.text=Form \: text -form.text2=Form \: text2 -form2.ratio=Form2 \: ratio -form2.text=Form2 \: text -form2.text2=Form2 \: text2 -no\ layer= -numbereditor.normal.float= -numbereditor.normal.float.value= -numbereditor.normal.int= -numbereditor.normal.int.value= -numbereditor.positive.float= -numbereditor.positive.float.value= -numbereditor.positive.int= -numbereditor.positive.int.value= -numbereditor.positive.integer=Simple positive integer editor -numbereditor.type= -numbereditor.with.auto.popup= -numbereditor.without.auto.popup= -valid= -validator.field=Champ -validator.field.header.tip= -validator.field.tip= -validator.message=Message -validator.message.header.tip= -validator.message.tip= -validator.scope=... -validator.scope.header.tip= -validator.scope.tip= -with\ layer= -x= diff --git a/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties b/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties deleted file mode 100644 index d96a3a3..0000000 --- a/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties +++ /dev/null @@ -1,134 +0,0 @@ --= -.= -0= -1= -10= -12= -14= -18= -2= -24= -3= -4= -5= -6= -7= -8= -9= -Age\:= -Animal= -Blue= -Blue\:= -Bold= -Button\ label\:= -C= -CE= -Cancel= -Change\ layer\ state= -Click\ me= -Comments\:= -Config\ file\ \:= -Config\ file\:= -Cyan= -Dec\ (-)= -Demo= -Directory\ file\:= -Editable= -Email\ Address\:= -Email\:= -Empty\ I18n\ editor\:= -Enabled= -EnumEditor\ (country)\ \:= -EnumEditor\ (language)\ \:= -Fancy\ Button= -First\ Name\:= -FirstName\:= -Font\ size= -Fool\ me\ once= -Fool\ me\ twice= -Green= -Green\:= -Greet= -I18n\ editor\ with\ no\ icon\ \:= -I18n\ editor\ with\ no\ text\ \:= -I18n\ editor\:= -Inc\ (+)= -Italic= -JAXX\ Demo= -JMenu\ demo= -Last\ Name\:= -LastName\:= -Locale\ editor\:= -Message\ Box= -Mineral= -Normal\ text\:= -OK= -Orange= -Password\:= -Purple= -Ratio\:= -Red= -Red\:= -Reset= -Show\ Background= -Show\ password\ dialog= -Sign\ on= -Simple\ Button= -Size\:= -Source= -Spacing\:= -Start= -Stop= -Supported\ Swing\ components\:= -Text2\:= -Text\:= -Underline= -Upper\ case\ text\:= -Use\ the\ spinner\ to= -Username\:= -Vegetable= -View= -Welcome\ to\ the\ JAXX\ framework\!= -Working\ directory\:= -Yellow= -Your\ name\:= -\\u00f7= -adjust\ the\ spacing= -between\ these\ lines= -button\ A= -button\ B= -button\ C= -button\ C\ (full\ block)= -button\ D\ (full\ block\ 2)= -button\ with\ layer= -cancel= -close= -close2= -close3= -edit= -edit2= -edit3= -emptyNode=< empty node > -form.ratio=Form \: ratio -form.text=Form \: text -form.text2=Form \: text2 -form2.ratio=Form2 \: ratio -form2.text=Form2 \: text -form2.text2=Form2 \: text2 -no\ layer= -numbereditor.normal.float=D\u00E9cimal primitif \: [%1$s] -numbereditor.normal.int=Entier primitif \: [%1$s] -numbereditor.positive.float=D\u00E9cimal primitif positif \: [%1$s] -numbereditor.positive.int=Entier primitif positif \: [%1$s] -numbereditor.type=Type d'\u00E9diteur -numbereditor.with.auto.popup=Avec popup auto -numbereditor.without.auto.popup=Sans popup auto -valid= -validator.field= -validator.field.header.tip= -validator.message= -validator.message.header.tip= -validator.scope= -validator.scope.header.tip= -with\ layer= -x= diff --git a/jaxx-example/src/main/resources/icons/action-accept.png b/jaxx-example/src/main/resources/icons/action-accept.png deleted file mode 100644 index 89c8129..0000000 Binary files a/jaxx-example/src/main/resources/icons/action-accept.png and /dev/null differ diff --git a/jaxx-example/src/main/resources/icons/action-block.png b/jaxx-example/src/main/resources/icons/action-block.png deleted file mode 100644 index aba044b..0000000 Binary files a/jaxx-example/src/main/resources/icons/action-block.png and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml deleted file mode 100644 index 86da73d..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.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="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</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 diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml deleted file mode 100644 index b515a92..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.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="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</message> - </field-validator> - </field--> - - <field name="age"> - <field-validator type="int"> - <param name="min">25</param> - <message>You are still young ( old ${min} ) </message> - </field-validator> - </field> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml deleted file mode 100644 index ece44f3..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.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="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</message> - </field-validator> - </field--> - - <field name="age"> - <field-validator type="int"> - <param name="max">88</param> - <message>Info : Your are older than ${max} !</message> - </field-validator> - </field> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml deleted file mode 100644 index 05c0d34..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text.</message> - </field-validator> - </field> - - <field name="text2"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text2.</message> - </field-validator> - </field> - - <field name="ratio"> - <field-validator type="int"> - <param name="min">20</param> - <param name="max">50</param> - <message>Ratio needs to be between ${min} and ${max}</message> - </field-validator> - </field> - - <!-- Plain Validator 1 --> - <validator type="expression"> - <param name="expression">text.startsWith("poussin")</param> - <message>Email not starts with poussin</message> - </validator> - <validator type="expression"> - <param name="expression">text2.startsWith("chemit")</param> - <message>Email not starts with chemit</message> - </validator> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml deleted file mode 100644 index efd6249..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="fieldexpression"> - <param name="expression"><![CDATA[ text != null && text.length() > 10]]></param> - <message>Text should have more than 10 caracters</message> - </field-validator> - </field> - -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml deleted file mode 100644 index 2e2e90d..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail for text.</message> - </field-validator> - </field> - - <field name="text2"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text2.</message> - </field-validator> - </field> - -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg deleted file mode 100644 index 72aabd2..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg deleted file mode 100644 index 779ef43..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg deleted file mode 100644 index f6223b2..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif b/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif deleted file mode 100644 index 1dae579..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif and /dev/null differ diff --git a/jaxx-example/src/main/resources/log4j.properties b/jaxx-example/src/main/resources/log4j.properties deleted file mode 100644 index e49816c..0000000 --- a/jaxx-example/src/main/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Global logging configuration -log4j.rootLogger=ERROR, stdout -# Console output... -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n - -log4j.logger.demo=DEBUG -log4j.logger.jaxx=INFO -log4j.logger.org.nuiton=INFO diff --git a/jaxx-example/src/site/site.xml b/jaxx-example/src/site/site.xml deleted file mode 100644 index 9174ab8..0000000 --- a/jaxx-example/src/site/site.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="${project.name}"> - - <bannerLeft> - <name>${project.name}</name> - <src>${site.home.url}/jaxx.png</src> - <href>index.html</href> - </bannerLeft> - - <body> - - <breadcrumbs> - <item name="${project.name}" href="${project.url}" /> - </breadcrumbs> - - <menu ref="parent"/> - - <menu name="Utilisateur" inherited="top"> - <item name="Lancer la démo" href="launch-demo.jnlp"/> - </menu> - - <menu ref="reports"/> - - <menu ref="modules"/> - - </body> -</project> diff --git a/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java b/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java deleted file mode 100644 index e49ff8b..0000000 --- a/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package jaxx.demo; - -import java.io.File; -import java.util.Iterator; -import java.util.SortedSet; -import jaxx.runtime.validator.AbstractBeanValidatorDetectorTest; -import jaxx.runtime.validator.BeanValidator; -import org.junit.BeforeClass; -import static org.junit.Assert.*; - -/** - * - * @author chemit - */ -public class BeanValidatorDetectorTest extends AbstractBeanValidatorDetectorTest { - - @BeforeClass - public static void setUpClass() throws Exception { - AbstractBeanValidatorDetectorTest.setUpClass(); - } - - public BeanValidatorDetectorTest() { - super(new File(basedir, "src" + File.separator + "main" + File.separator + "resources"), Identity.class, Model.class); - } - - @Override - protected void assertDetect(SortedSet<BeanValidator<?>> validators) { - assertFalse(validators.isEmpty()); - assertEquals(2, validators.size()); - Iterator<BeanValidator<?>> itrV = validators.iterator(); - assertValidator(Identity.class, null, itrV.next()); - assertValidator(Model.class, null, itrV.next()); - } -} \ No newline at end of file diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java deleted file mode 100644 index 8cd51bb..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java +++ /dev/null @@ -1,36 +0,0 @@ -package jaxx.runtime; - -/** - * A simple contract to define a String decorator on any java objet. - * - * @param <O> the type of decorated object - * @author chemit - */ -public abstract class Decorator<O> implements java.io.Serializable { - - protected final Class<O> internalClass; - private static final long serialVersionUID = -1L; - - /** - * @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; - } - - /** - * @param bean the bean to decorate - * @return the string value of the given bean - */ - public abstract String toString(Object bean); - - - public final Class<O> getInternalClass() { - return internalClass; - } - -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java deleted file mode 100644 index f1e1916..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java +++ /dev/null @@ -1,111 +0,0 @@ -package jaxx.runtime; - -import java.util.List; - -/** - * - * Some usefull methods on {@link Decorator} to store and obtain decorators. - * - * Use the method {@link #registerDecorator(String, Decorator)} to register a new - * decorator. - * - * Use the method {@link #getDecorator(String)} to obtain a registred - * decorator based on his registred name. - * - * Use the method {@link #getDecorator(Class, tring)} to obtain a registred - * decorator based on the type of decorator and the registred name. - * - * @author tony - * @since 1.3 - */ -public class DecoratorUtils { - - protected static List<DecoratorContext<?>> cache; - - public static <T> void registerDecorator(String context, Decorator<T> decorator) { - DecoratorContext<T> result = getDecoratorContext(decorator.getInternalClass(), context); - - if (result != null) { - throw new IllegalArgumentException("there is an already register decorator " + result); - } - - if (cache == null) { - cache = new java.util.ArrayList<DecoratorContext<?>>(); - } - cache.add(new DecoratorContext<T>(context, decorator)); - } - - public static <T> Decorator<T> getDecorator(String context) { - Decorator<T> result = getDecorator(null, context); - return result; - } - - public static <T> Decorator<T> getDecorator(Class<T> type, String context) { - DecoratorContext<T> decoratorContext = getDecoratorContext(type, context); - Decorator<T> result = decoratorContext == null ? null : decoratorContext.getDecorator(); - return result; - } - - public static void clear() { - if (cache != null) { - cache.clear(); - } - } - - @SuppressWarnings({"unchecked"}) - protected static <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { - DecoratorContext<T> result = null; - if (cache != null) { - for (DecoratorContext<?> d : cache) { - if (type == null) { - if (d.accept(context)) { - result = (DecoratorContext<T>) d; - break; - } - continue; - } - if (d.accept(type, context)) { - result = (DecoratorContext<T>) d; - break; - } - } - } - return result; - } - - public static class DecoratorContext<T> { - - final String context; - final Decorator<T> decorator; - - public DecoratorContext(String context, Decorator<T> decorator) { - this.context = context; - this.decorator = decorator; - } - - public String getContext() { - return context; - } - - public Decorator<T> getDecorator() { - return decorator; - } - - public Class<T> getType() { - return decorator.getInternalClass(); - } - - public boolean accept(Class<?> type, String context) { - return getType().isAssignableFrom(type) && accept(context); - } - - public boolean accept(String context) { - return ((this.context == null && context == null) || (this.context != null && this.context.equals(context))); - } - - @Override - public String toString() { - return super.toString() + "<type: " + getType().getName() + ", context :" + context + ">"; - } - } -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java deleted file mode 100644 index 81458fb..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java +++ /dev/null @@ -1,278 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.jxpath.JXPathContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 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> - * - * @param <O> type of data - * @author chemit - * @see Decorator - */ -public class JXPathDecorator<O> extends Decorator<O> { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(JXPathDecorator.class); - 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, true); - } - - /** - * Sort a list of data based on the first token property of a given context - * in a given decorator. - * - * @param <O> type of data to sort - * @param decorator the decorator to use to sort - * @param datas the list of data to sort - * @param pos the index of context to used in decorator to obtain sorted property. - */ - public static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos) { - Comparator<O> c = null; - boolean cachedComparator = false; - try { - c = decorator.getComparator(pos); - cachedComparator = c instanceof JXPathComparator<?>; - - if (cachedComparator) { - ((JXPathComparator<O>) c).init(decorator, datas); - } - Collections.sort(datas, c); - } finally { - if (cachedComparator) { - ((JXPathComparator<?>) c).clear(); - } - } - } - - public static class JXPathComparator<O> implements Comparator<O> { - - protected Map<O, Comparable<Comparable<?>>> valueCache; - private final String expression; - - public JXPathComparator(String expression) { - this.expression = expression; - this.valueCache = new HashMap<O, Comparable<Comparable<?>>>(); - } - - @Override - public int compare(O o1, O o2) { - Comparable<Comparable<?>> c1 = valueCache.get(o1); - Comparable<Comparable<?>> c2 = valueCache.get(o2); - return c1.compareTo(c2); - } - - public void clear() { - valueCache.clear(); - } - - public void init(JXPathDecorator<O> decorator, List<O> datas) { - clear(); - for (O data : datas) { - JXPathContext jxcontext = JXPathContext.newContext(data); - Comparable<Comparable<?>> key = decorator.getTokenValue(jxcontext, expression); - valueCache.put(data, key); - } - } - } - - public static class Context<O> implements java.io.Serializable { - - /** - * expression to format using {@link String#format(String, Object[])}, all variables are compute - * using using the jxpath tokens. - */ - protected String expression; - /** list of jxpath tokens to apply on expression */ - protected String[] tokens; - protected transient Comparator<O> comparator; - private static final long serialVersionUID = 1L; - - public Context(String expression, String[] tokens) { - this.expression = expression; - this.tokens = tokens; - } - - public String getFirstProperty() { - return tokens[0]; - } - - public Comparator<O> getComparator(int pos) { - if (comparator == null) { - comparator = new JXPathComparator<O>(tokens[pos]); - } - return comparator; - } - - public void setComparator(Comparator<O> comparator) { - this.comparator = comparator; - } - - @Override - public String toString() { - return "<expression:" + expression + ", tokens:" + Arrays.toString(tokens) + ">"; - } - } - /** the computed context of the decorator */ - protected Context<O> context; - /** nb jxpath tokens to compute */ - protected int nbToken; - /** the initial expression used to compute the decorator context. */ - protected String initialExpression; - - @Override - public String toString(Object bean) { - if (bean == null) { - return null; - } - JXPathContext jxcontext = JXPathContext.newContext(bean); - Object[] args = new Object[nbToken]; - - for (int i = 0; i < nbToken; i++) { - try { - args[i] = getTokenValue(jxcontext, context.tokens[i]); - } catch (Exception e) { - log.error("can not obtain token " + context.tokens[i] + "on object " + bean + " for reason " + e.getMessage(), e); - - } - } - - return String.format(context.expression, args); - } - - @SuppressWarnings({"unchecked"}) - protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { - // assume all values are comparable - return (Comparable<Comparable<?>>) jxcontext.getValue(token); - } - - public String getProperty(int pos) { - return getTokens()[pos]; - } - - public String getExpression() { - return context.expression; - } - - public String[] getTokens() { - return context.tokens; - } - - public int getNbToken() { - return nbToken; - } - - public String getInitialExpression() { - return initialExpression; - } - - @Override - public String toString() { - return super.toString() + "<" + context + ">"; - } - - public void setContext(Context<O> context) { - this.context = context; - this.nbToken = context.tokens.length; - // always reset comparator - //this.context.comparator = null; - if (log.isDebugEnabled()) { - log.debug(context); - } - } - - public JXPathDecorator(Class<O> internalClass, String expression, boolean creatContext) throws IllegalArgumentException, NullPointerException { - super(internalClass); - this.initialExpression = expression; - if (creatContext) { - setContext(JXPathDecorator.<O>createInitialContext(expression)); - if (log.isDebugEnabled()) { - log.debug(expression + " --> " + this.context); - } - } - } - - @SuppressWarnings({"unchecked"}) - protected Comparator<O> getComparator(int pos) { - ensureTokenIndex(this, pos); - return context.getComparator(pos); - } - - public static <O> Context<O> createInitialContext(String expression) { - 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 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)); - } - 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()); - } - if (size > (end + 1)) { - // suffix after end jxpath (or all expression if no jxpath) - buffer.append(expression.substring(end + 1)); - } - return new Context<O>(buffer.toString(), lTokens.toArray(new String[lTokens.size()])); - } - - protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) { - if (pos < -1 || pos > decorator.getNbToken()) { - throw new ArrayIndexOutOfBoundsException("token index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.nbToken + "]"); - } - } -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java deleted file mode 100644 index 21eb609..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java +++ /dev/null @@ -1,129 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.StringTokenizer; - -/** - * TODO - * - * @param <O> type of decorated objects - * @author chemit - * @see jaxx.runtime.Decorator - */ -public class MultiJXPathDecorator<O> extends JXPathDecorator<O> { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(MultiJXPathDecorator.class); - - private static final long serialVersionUID = 1L; - - public static <O> MultiJXPathDecorator<O> newDecorator(Class<O> internalClass, - String expression, - String separator) - throws IllegalArgumentException, NullPointerException { - - return newDecorator(internalClass, expression, separator, separator); - } - - public static <O> MultiJXPathDecorator<O> newDecorator(Class<O> internalClass, - String expression, - String separator, - String separatorReplacement) - throws IllegalArgumentException, NullPointerException { - - Context<O>[] contexts = createInitialContexts(expression, separator, separatorReplacement); - - return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts); - } - - protected Context<O>[] contexts; - protected String separator; - protected String separatorReplacement; - - - public MultiJXPathDecorator(Class<O> internalClass, String expression, - String separator, String separatorReplacement, - Context<O>[] contexts) throws IllegalArgumentException, NullPointerException { - super(internalClass, expression, false); - this.separator = separator; - this.separatorReplacement = separatorReplacement; - this.contexts = contexts; - - setContextIndex(0); - - if (log.isDebugEnabled()) { - log.debug(expression + " --> " + this.context); - } - } - - public void setContextIndex(int index) { - ensureContextIndex(this, index); - setContext(contexts[index]); - } - - public int getNbContext() { - return contexts.length; - } - - public String getSeparator() { - return separator; - } - - public String getSeparatorReplacement() { - return separatorReplacement; - } - - @Override - protected Comparator<O> getComparator(int pos) { - ensureContextIndex(this, pos); - Context<O> context1 = contexts[pos]; - return context1.getComparator(0); - } - - public static <O> Context<O>[] createInitialContexts(String expression, String separator, String separatorReplacement) { - int sep = expression.indexOf(separator); - if (sep == -1) { - Context<O>[] result = MultiJXPathDecorator.newInstance(1); - result[0] = createInitialContext(expression); - return result; - } - - List<String> tokens = new ArrayList<String>(); - StringTokenizer stk = new StringTokenizer(expression, separator); - while (stk.hasMoreTokens()) { - tokens.add(stk.nextToken()); - } - - int nbTokens = tokens.size(); - Context<O>[] contexts = newInstance(nbTokens); - for (int i = 0; i < nbTokens; i++) { - StringBuilder buffer = new StringBuilder(expression.length()); - for (int j = 0; j < nbTokens; j++) { - int index = (i + j) % nbTokens; - String str = tokens.get(index); - //todo replace %index with %j - buffer.append(separatorReplacement).append(str); - } - contexts[i] = createInitialContext(buffer.substring(separatorReplacement.length())); - } - return contexts; - } - - protected static void ensureContextIndex(MultiJXPathDecorator<?> decorator, int pos) { - if (pos < -1 || pos > decorator.contexts.length) { - throw new ArrayIndexOutOfBoundsException("context index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.contexts.length + "]"); - } - } - - @SuppressWarnings("unchecked") - protected static <O> Context<O>[] newInstance(int size) { - // fixme how to instanciate a typed array with no checking warning ? - return new Context[size]; - } - -} \ No newline at end of file diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java deleted file mode 100644 index ce871a6..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java +++ /dev/null @@ -1,94 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; - -/** - * Simple property decorator based on {@link String#format(String, Object[])} method. - * <p/> - * To use it, give him a class and the property name to render. - * <p/> - * For example : - * <pre> - * Decorator<Object> d = PropertyDecorator.newDecorator(PropertyDecorator.class,"expressions"); - * </pre> - * - * @param <O> type of decorated objects - * @author chemit - * @see Decorator - */ -public class PropertyDecorator<O> extends Decorator<O> { - - private static final long serialVersionUID = 1L; - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(PropertyDecorator.class); - - /** - * Factory method to instanciate a new {@link jaxx.runtime.PropertyDecorator} for the given class {@link O} and a - * readable property name. - * - * @param internalClass the class of the objects decorated by the new decorator - * @param property the property - * @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> PropertyDecorator<O> newDecorator(Class<O> internalClass, String property) - throws IllegalArgumentException, NullPointerException { - return new PropertyDecorator<O>(internalClass, property); - } - - protected String property; - - protected transient Method m; - - @Override - public String toString(Object bean) { - try { - return getM().invoke(bean) + ""; - } catch (Exception e) { - log.error("could not convert for reason : " + e, e); - return ""; - } - } - - public String getProperty() { - return property; - } - - protected PropertyDecorator(Class<O> internalClass, String property) throws NullPointerException { - super(internalClass); - if (property == null) { - throw new NullPointerException("property can not be null."); - } - this.property = property; - // init method - getM(); - } - - - protected Method getM() { - if (m == null) { - for (PropertyDescriptor propertyDescriptor : PropertyUtils.getPropertyDescriptors(internalClass)) { - if (propertyDescriptor.getName().equals(property)) { - this.m = propertyDescriptor.getReadMethod(); - break; - } - } - if (m == null) { - throw new IllegalArgumentException("could not find the property " + property + " in " + internalClass); - } - } - return m; - } -} diff --git a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties b/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties deleted file mode 100644 index 0474916..0000000 --- a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties +++ /dev/null @@ -1,3 +0,0 @@ -validator.scope.error.label=Error -validator.scope.info.label=Information -validator.scope.warning.label=Warning diff --git a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties b/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties deleted file mode 100644 index 0e3fddc..0000000 --- a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties +++ /dev/null @@ -1,3 +0,0 @@ -validator.scope.error.label=Erreur -validator.scope.info.label=Information -validator.scope.warning.label=Avertissement diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java b/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java deleted file mode 100644 index a67d758..0000000 --- a/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package jaxx.runtime; - -import jaxx.runtime.JXPathDecorator.Context; -import org.junit.After; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** @author chemit */ -public class JXPathDecoratorTest { - - - protected JXPathDecorator<?> decorator; - protected String expected; - protected String result; - - @After - public void after() { - decorator = null; - } - - @Test(expected = NullPointerException.class) - public void testNullInternalClass() throws Exception { - decorator = JXPathDecorator.newDecorator(null, "hello"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "${haha"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace2() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "${haha${hum}"); - } - - @Test - public void testNullBean() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "hello"); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(null); - assertEquals(null, result); - } - - @Test - public void testNoJXPath() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "hello"); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(this); - assertEquals(expected, result); - } - - @Test - public void testDecorator() throws Exception { - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s - ${nbToken}$d"); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}${nbToken}"); - assertEquals("%1%2", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before ${expression}$s - ${nbToken}$d after"); - assertEquals("before %1$s - %2$d after", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before${expression}$s-${nbToken}$dafter"); - assertEquals("before%1$s-%2$dafter", decorator.getExpression()); - assertDecoratorInternal(); - } - - public static class Data { - int pos; - String name; - - protected static List<Data> generate(int nb) { - List<Data> datas = new ArrayList<Data>(nb); - for (int i = 0; i < nb; i++) { - datas.add(new Data(i, "name_" + (nb - i))); - } - return datas; - } - - Data(int pos, String name) { - this.pos = pos; - this.name = name; - } - - public int getPos() { - return pos; - } - - public String getName() { - return name; - } - - @Override - public String toString() { - return "Data{pos=" + pos + ", name='" + name + '\'' + '}'; - } - } - - @Test - public void testSort() throws Exception { - - List<Data> datas = Data.generate(10); - JXPathDecorator<Data> decorator = JXPathDecorator.newDecorator(Data.class, "${pos}$d ${name}$s"); - - List<Data> sortData = new ArrayList<Data>(datas); - JXPathDecorator.sort(decorator, sortData, 0); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - Collections.sort(datas, new Comparator<Data>() { - @Override - public int compare(Data o1, Data o2) { - return o1.name.compareTo(o2.name); - } - }); - Context<Data> context = decorator.context; - context.setComparator(null); - JXPathDecorator.sort(decorator, sortData, 1); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - } - - - public void assertDecoratorInternal(String... tokens) { - assertTokens(tokens); - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - private void assertTokens(String... tokens) { - if (tokens.length == 0) { - tokens = new String[]{"expression", "nbToken"}; - } - assertEquals(2, decorator.nbToken); - assertEquals(2, decorator.getTokens().length); - assertEquals(tokens[0], decorator.getTokens()[0]); - assertEquals(tokens[1], decorator.getTokens()[1]); - } - -} diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java b/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java deleted file mode 100644 index 4e3d4a4..0000000 --- a/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java +++ /dev/null @@ -1,184 +0,0 @@ -package jaxx.runtime; - -import jaxx.runtime.JXPathDecoratorTest.Data; -import org.junit.After; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** @author chemit */ -public class MultiJXPathDecoratorTest { - - - protected MultiJXPathDecorator<?> decorator; - protected String expected; - protected String result; - - @After - public void after() { - decorator = null; - } - - @Test(expected = NullPointerException.class) - public void testNullInternalClass() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(null, "hello", "#"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "${haha", "#"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace2() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "${haha${hum}", "#"); - } - - @Test - public void testNullBean() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "hello", ""); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(null); - assertEquals(null, result); - } - - @Test - public void testMultiDecorator() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d", "#", " - "); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - assertEquals(2, decorator.contexts.length); - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s", decorator.getExpression()); - assertTokens("nbToken", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s ## ${nbToken}$d", " ## ", " - "); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - assertEquals(2, decorator.contexts.length); - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s", decorator.getExpression()); - assertTokens("nbToken", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testMultiDecorator2() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s", "#", " - "); - - assertEquals("%1$s - %2$d - %3$s", decorator.getExpression()); - assertTokens("expression", "nbToken", "separator"); - assertEquals(3, decorator.contexts.length); - - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s - %3$s", decorator.getExpression()); - assertTokens("nbToken", "separator", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(2); - assertEquals("%1$s - %2$s - %3$d", decorator.getExpression()); - assertTokens("separator", "expression", "nbToken"); - - expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testMultiDecoratorWithMultiRef() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s %3$s", "#", " - "); - - assertEquals("%1$s - %2$d - %3$s %3$s", decorator.getExpression()); - assertTokens("expression", "nbToken", "separator"); - assertEquals(3, decorator.contexts.length); - - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s %3$s - %3$s", decorator.getExpression()); - assertTokens("nbToken", "separator", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(2); - assertEquals("%1$s %3$s - %2$s - %3$d", decorator.getExpression()); - assertTokens("separator", "expression", "nbToken"); - - expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testSort() throws Exception { - - List<Data> datas = Data.generate(10); - - MultiJXPathDecorator<Data> decorator = MultiJXPathDecorator.newDecorator(Data.class, "${pos}$d-${name}$s", "-"); - - List<Data> sortData = new ArrayList<Data>(datas); - JXPathDecorator.sort(decorator, sortData, 0); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - Collections.sort(datas, new Comparator<Data>() { - @Override - public int compare(Data o1, Data o2) { - return o1.name.compareTo(o2.name); - } - }); - decorator.setContextIndex(1); - JXPathDecorator.sort(decorator, sortData, 1); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - } - - public void assertDecoratorInternal(String... tokens) { - assertTokens(tokens); - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - private void assertTokens(String... tokens) { - if (tokens.length == 0) { - tokens = new String[]{"expression", "nbToken"}; - } - assertEquals(tokens.length, decorator.nbToken); - assertEquals(tokens.length, decorator.getTokens().length); - for (int i = 0; i < tokens.length; i++) { - assertEquals(tokens[i], decorator.getTokens()[i]); - } - } - -} \ No newline at end of file diff --git a/jaxx-runtime-swing-widget/LICENSE.txt b/jaxx-runtime-swing-widget/LICENSE.txt deleted file mode 100644 index 3f7b8b1..0000000 --- a/jaxx-runtime-swing-widget/LICENSE.txt +++ /dev/null @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - diff --git a/jaxx-runtime-swing-widget/README.txt b/jaxx-runtime-swing-widget/README.txt deleted file mode 100644 index d2e50d3..0000000 --- a/jaxx-runtime-swing-widget/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -To deploy new version of pom: mvn deploy -To install localy: mvn install diff --git a/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif b/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif deleted file mode 100644 index 68bec67..0000000 Binary files a/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif and /dev/null differ diff --git a/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif b/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif deleted file mode 100644 index 079fc1b..0000000 Binary files a/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif and /dev/null differ diff --git a/jaxx-runtime-swing-widget/src/site/rst/index.rst b/jaxx-runtime-swing-widget/src/site/rst/index.rst deleted file mode 100644 index 9e8f78f..0000000 --- a/jaxx-runtime-swing-widget/src/site/rst/index.rst +++ /dev/null @@ -1,40 +0,0 @@ -=================== -Examples/Components -=================== - -The Components demo displays many different Swing components being used in a variety of ways; it is JAXX's equivalent -of the SwingSet demo. Various pages use advanced features such as data binding, scripting, event handling, and -CSS stylesheets. - -Examples/Calculator -=================== - -This is an implementation of Challenge #2 from the `XUL Grand Coding Challenge 2004`_ . Because this example program -has been implemented in so many different languages, you can easily compare JAXX's -syntax against the competition and decide for yourself which you prefer. - -Screen shot ------------ - -.. image:: images/Components-screenshot.gif - -Set it in action ----------------- - -|webstart| - -To run this example in `Java Web Start`_, click the `following link`_. - - -Source code ------------ - -Unlike the other examples, the source code for Components is too big to display here. You can view it yourself by -downloading JAXX, and you can also view the source code for the individual demos by clicking the "Source" tabs. - - -.. _Java Web Start: http://java.sun.com/products/javawebstart/ - -.. |webstart| image:: images/webstart.gif - -.. _following link: ./launch-demo.jnlp diff --git a/jaxx-runtime-swing/LICENSE.txt b/jaxx-runtime-swing/LICENSE.txt deleted file mode 100644 index 3f7b8b1..0000000 --- a/jaxx-runtime-swing/LICENSE.txt +++ /dev/null @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - diff --git a/jaxx-runtime-swing/README.txt b/jaxx-runtime-swing/README.txt deleted file mode 100644 index d2e50d3..0000000 --- a/jaxx-runtime-swing/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -To deploy new version of pom: mvn deploy -To install localy: mvn install diff --git a/jaxx-runtime-swing/changelog.txt b/jaxx-runtime-swing/changelog.txt deleted file mode 100644 index 459960e..0000000 --- a/jaxx-runtime-swing/changelog.txt +++ /dev/null @@ -1,114 +0,0 @@ -1.5 - * 20090506 [chemit] - add some usefull renderer and other stuffs - -1.3 chemit 20090409 - * 20090404 [chemit] - introduce dimension factory in SwingUtil for min and max dimensions - * 20090327 [chemit] - add javax help mecanism - * 20090318 [chemit] - introduce the BlockingLayerUI2 class (should be merge with BlockingLayerUI) - * 20090318 [chemit] - introduce the CardLayout2Ext class - * 20090312 [chemit] - add some usefull code from ObServe (load Nimbus L&F, load ui configuration) - * 20090309 [chemit] - in BlockingLayerUI, add a new state 'block' to enable/disable blocking mode with a blockingColor - * 20090303 [chemit] - in BlockingLayerUI, add a new state 'useIcon' to enable/disable use of the action icon - - add a simple WizardModel - * 20090301 [chemit] - add usefull methods in JAXXButtonGroup - -1.2 letellier 2009022? - * 20090223 [chemit] - rename jaxx.runtime.swing.Utils to jaxx.runtime.SwingUtil - -1.1 chemit 20090220 - * 20090124 [chemit] - add a cache on context path to improve performance on NavigationTreeNode - - improve I18nTableCellRenderer to display toolTipText - * 20090123 [chemit] - improve NavigationTreeNodeRenderer (now can customized node internalClass) - * 20090121 [letellier] - add some usefull methods in JAXXList and JAXXComboBox - -1.0 chemit 20090111 - * 20090111 [chemit] - integrate new architecture to allow to have runtime code with NO link with compiler :) - * 20090105 [chemit] - improve CardLayout2 -0.8 ??? 200812?? - * 20081228 [chemit] - generify ClassDescriptor - - introduce StylesheetHelper helper class to detach Stylesheet, Rule and Selector classes from - JAXXCompiler and make possible to extract compiler engine from runtime - - * 20081227 [chemit] - add PCS on ValidatorErrorTable to be used by table validation - * 20081218 [chemit] - improve generation of methods - * 20081214 [chemit] - can now in validation, put error with args (all args must be separated by a ##) - - improve event naming : replace the $evXXX by doMEthodName__on__field (except with optimize option) - - add jaww.runtime.swing.Utils.fillComboBox to fill a combobox model from a collection - - add addSourcesToClassPath property to add sources directories in class-path - - improve classloader managment - - keep in DataSource objetCode - - fix bug when processDataBinding on a null objectCode - - always clean node cached values when selected it - - add usefull databinding method in Util - -* 20081213 [chemit] - improve navigation tree node rendering with some caches - - introduce a ChildBuilder to simplify building of child nodes from a collection or array - -0.7 chemit 20081210 -* 20081210 [chemit] - fix bug 1751 -* 20081210 [chemit] - improve JAXXButtonGroup (add ActionChangeListener and toolTipText mecanism) -* 20081208 [chemit] - javabBean attribute use to initialize bean - - introduce Base64Coder to fix bug 1750 and control serailVersionUI (put them to 1L for the moment) - - introduce MultiJXPathDecorator - - add a resetAfterCompile parameter toCompilerOption to keep in test used compilers - - * 20081207 [chemit] use lutinproject 3.1 - - can exclude field from validator - * 20081202 [chemit] - add strategy for loading ui in NavigationTreeSelectionAdapter - - fix bug when searching for a inner class - - * 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 20081117 - * 20081118 [chemit] introduce NavigationUtil, save in context selected node - * 20081107 [chemit] improve data binding and code generation : - - make possible inheritance in binding - - add an attribute javaBean to an object : will generate a full java bean support property - - make possible binding to the javaBean added properties - - clean generated code - - * 20081105 [chemit] - introduce a CardLayout2 to extends awt CardLayout - - introduce a NavigationTreeModel - - introduce a Decorator to render Object - - propagate constructor JAXXContext(JAXXContext) in JAXXObject generation - - begin of rst documentation - - * 20081104 [chemit] can add extra beanInfoSearchPath in SwingInitializer - * 20081104 [chemit] add jaxxContextImplementorClass in option to make possible use of other JAXXContext implementor. - * 20081102 [chemit] improve JAXXContext : - - introduce a JAXXContextEntryDef to qualify an entry of a JAXXContext - - do javadoc in JAXXContext - - add logic in DefaultJAXXContext : seek in parent context if entry not found - * 20081102 [chemit] improve tests : - - fix the last failed test from Jaxx original version :) - - dumps tests to JUnit4 :) - * 20081030 [chemit] improve BeanValidator : - - add full PropertyChangeEvent java-bean support and a property valid - - when remove bean from validator, must remove errors from model - - make possible to have a dynamic errorListModel in jaxx files - * 20081030 [chemit] improve JAXXContext : - - fix setContextValue bug when setting twice a same type for a same key - - implements a DefaultJAXXContext - - use this default implementation with delegate pattern in JAXXObject - * 20081030 [chemit] add JAXXAction contract to simplify init of ui with JAXXInitialContext - * 20081027 [chemit] fix bug 1722 - * 20081027 [chemit] add conversion support in validator - * 20081025 [chemit] improve BeanValidator tag : - - add a errorList attribute for set a ErrorListMouseListener on the errorList - - add a beanInitializer attribute for set the validator's bean at runtime - - add a default errorListModel value 'errors' - * 20081025 [chemit] introduce JAXXInitialContext to fill JAXXContext at runtime before $initialize() method - * 20081024 [chemit] fix validator context lost if UI is launched from another thread - ver-0-5 chemit 20081002 - * 20081017 [chemit] add validator support - * 20081013 [chemit] can generate logger on jaxx files - * 20081011 [chemit] improve site - * 20081011 [chemit] fix bug on JavaFileParser : works again - * 20081002 [chemit] Using lutinproject 3.0, changing groupId to org.codelutin - * 20081002 [chemit] use a single module jaxx-core (no more core, runtime and jaxx-swing modules) - * 20081002 [chemit] Introduce JAXXContext - * 20081002 [chemit] Fix bug on method creation via scripting - * 20081002 [chemit] Improve i18n integration (works now also for tabs) diff --git a/jaxx-runtime-swing/pom.xml b/jaxx-runtime-swing/pom.xml deleted file mode 100644 index b6ced8a..0000000 --- a/jaxx-runtime-swing/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - - <dependencies> - - <!-- sibling dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>${project.artifactId}</name> - <description>Jaxx runtime swing extension</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - <packaging>jar</packaging> - -</project> diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java deleted file mode 100644 index 0760f28..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -package jaxx.runtime.swing; - -import jaxx.runtime.Decorator; - -import javax.swing.JTable; -import javax.swing.table.TableCellRenderer; -import java.awt.Component; - -/** - * A simple TableCellRenderer using a delegate TableCellRenderer to render everything elese thant the text : - * the text is I18nalize. - * - * @author chemit - */ -public class DecoratorTableCellRenderer implements TableCellRenderer { - - /** the delegate cell renderer */ - protected TableCellRenderer delegate; - - protected Decorator decorator; - - public DecoratorTableCellRenderer(TableCellRenderer delegate, Decorator decorator) { - this.delegate = delegate; - this.decorator = decorator; - } - - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { - if (value != null) { - value = decorator.toString(value); - } - return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); - } -} \ No newline at end of file diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java deleted file mode 100644 index 4dd2a83..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java +++ /dev/null @@ -1,137 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.StringUtil; - -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeCellRenderer; -import javax.swing.tree.TreePath; -import java.awt.Component; -import java.awt.Dimension; - -/** - * A simple cell renderer which use the {@link NavigationTreeNode#renderer} - * to display node. - * - * @author chemit - */ -public class NavigationTreeCellRenderer implements TreeCellRenderer { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(NavigationTreeCellRenderer.class); - /** - * underlying context where to seek datas - */ - protected JAXXContext context; - /** - * delegate renderer which really render the node - */ - protected DefaultTreeCellRenderer delegate; - protected static long t = 0; - /** - * If set, will check to have a this minimum width on render component - * to fix some display issues of nodes (too much cache in TreeUI). - */ - protected Integer minWidth = null; - - public NavigationTreeCellRenderer(JAXXContext context) { - this(context, null, null); - } - - public NavigationTreeCellRenderer(JAXXContext context, Integer minWidth) { - this(context, null, minWidth); - } - - public NavigationTreeCellRenderer(JAXXContext context, DefaultTreeCellRenderer delegate) { - this(context, delegate, null); - } - - public NavigationTreeCellRenderer(JAXXContext context, DefaultTreeCellRenderer delegate, Integer minWidth) { - this.context = context; - this.delegate = delegate == null ? new DefaultTreeCellRenderer() : delegate; - this.minWidth = minWidth; - UIManager.put("Tree.rendererFillBackground", false); - } - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - Component result = delegate; - - TreePath path = tree.getPathForRow(row); - if (path != null) { - - if (value != null) { - long t0 = System.nanoTime(); - NodeRenderer renderer = getNodeRenderer(value); - long t1 = System.nanoTime(); - if (renderer != null) { - value = renderer.toString(context); - long t2 = System.nanoTime(); - if (log.isDebugEnabled()) { - log.debug("use renderer [" + (t++) + "]<" + row + ">" + renderer.decorator + " <" + StringUtil.convertTime(t0, t1) + "/" + StringUtil.convertTime(t1, t2) + ">"); - } - } - } - result = delegate.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - - if (minWidth != null) { - if (delegate.getPreferredSize().getWidth() < minWidth) { - delegate.setPreferredSize(new Dimension(minWidth, (int) delegate.getPreferredSize().getHeight())); - } - } - - return result; - } - - /** - * @param value the value which should be a node - * @return the nodeRenderer attached to node via the {@link NavigationTreeNode#userObject}, - * or <code>null</code> if value is null, or value is not int good type. - */ - protected NodeRenderer getNodeRenderer(Object value) { - NodeRenderer render = null; - - if (value != null) { - NavigationTreeNode node = getNode(value); - - if (node != null && node.getUserObject() instanceof NodeRenderer) { - render = (NodeRenderer) node.getUserObject(); - } - } - return render; - } - - /** - * @param value the value which should be a node - * @return the cast {@link NavigationTreeNode}, or <code>null</code> if value is null. - */ - protected NavigationTreeNode getNode(Object value) { - return value instanceof NavigationTreeNode ? (NavigationTreeNode) value : null; - } - - /** - * @return min width to decorate nodes - */ - public Integer getMinWidth() { - return minWidth; - } - - /** - * This hack remove the ... from the node. For not use this, MinWidth can be null (by default). - * bugfix from http://forums.sun.com/thread.jspa?forumID=256&threadID=277338 - * hack from : http://forums.sun.com/thread.jspa?threadID=542069&tstart=824 - * @param minWidth minimum width to decorate nodes - */ - public void setMinWidth(Integer minWidth) { - this.minWidth = minWidth; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java deleted file mode 100644 index 19415c5..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ /dev/null @@ -1,133 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; - -/** - * To help getting and setting navigation tree objects from a {@link JAXXContext}. - * <p/> - * There is four type of data which can be hold in a context : - * <ul> - * <li>tree model : the navigation tree model</li> - * <li>tree handler : the navigation tree handler</li> - * <li>selected path : the navigation path of the selected node</li> - * <li>selected node : the selected node</li> - * <li>selected bean : the selected bean</li> - * </ul> - * - * To make possible the use of more than one navigation tree system in a same - * context, we <b>MUST</b> distinguish the context entries definition. For this - * purpose, entries definition are normalized and prefixed by a unique {@link #prefix}. - * <p/> - * Here is the keys used : - * <ul> - * <li>tree model : {@code prefix + "-tree-model"}</li> - * <li>tree handler : {@code prefix + "-tree-handler"}</li> - * <li>selected path : {@code prefix + "-selected-path"}</li> - * <li>selected node : {@code prefix + "-selected-node"}</li> - * <li>selected bean : {@code prefix + "-selected-bean"}</li> - * </ul> - * - * @author chemit - * @since 1.7.2 - */ -public class NavigationTreeContextHelper { - - protected final String prefix; - protected JAXXContextEntryDef<String> selectedPathContextEntry; - protected JAXXContextEntryDef<Object> selectedBeanContextEntry; - protected JAXXContextEntryDef<NavigationTreeNode> selectedNodeContextEntry; - protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry; - protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry; - - public NavigationTreeContextHelper(String contextPrefix) { - this.prefix = contextPrefix; - treeModelContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-tree-model", NavigationTreeModel.class); - treeHandlerContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-tree-handler", NavigationTreeHandler.class); - selectedBeanContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-bean", Object.class); - selectedNodeContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-node", NavigationTreeNode.class); - selectedPathContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-path", String.class); - } - - public String getPrefix() { - return prefix; - } - - public NavigationTreeModel getTreeModel(JAXXContext context) { - NavigationTreeModel r = getTreeModelContextEntry().getContextValue(context); - return r; - } - - public NavigationTreeHandler getTreeHandler(JAXXContext context) { - NavigationTreeHandler r = getTreeHandlerContextEntry().getContextValue(context); - return r; - } - - public String getSelectedPath(JAXXContext context) { - String r = getSelectedPathContextEntry().getContextValue(context); - return r; - } - - public NavigationTreeNode getSelectedNode(JAXXContext context) { - NavigationTreeNode r = getSelectedNodeContextEntry().getContextValue(context); - return r; - } - - public Object getSelectedBean(JAXXContext context) { - Object r = getSelectedBeanContextEntry().getContextValue(context); - return r; - } - - public void setTreeModel(JAXXContext context, NavigationTreeModel model) { - getTreeModelContextEntry().setContextValue(context, model); - } - - public void setTreeHandler(JAXXContext context, NavigationTreeHandler handler) { - getTreeHandlerContextEntry().setContextValue(context, handler); - } - - public void setSelectedPath(JAXXContext context, String path) { - if (path == null) { - getSelectedPathContextEntry().removeContextValue(context); - } else { - getSelectedPathContextEntry().setContextValue(context, path); - } - } - - public void setSelectedNode(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - getSelectedNodeContextEntry().removeContextValue(context); - } else { - getSelectedNodeContextEntry().setContextValue(context, node); - } - } - - public void setSelectedBean(JAXXContext context, Object bean) { - if (bean == null) { - getSelectedBeanContextEntry().removeContextValue(context); - } else { - getSelectedBeanContextEntry().setContextValue(context, bean); - } - } - - public JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() { - return treeModelContextEntry; - } - - public JAXXContextEntryDef<NavigationTreeHandler> getTreeHandlerContextEntry() { - return treeHandlerContextEntry; - } - - public JAXXContextEntryDef<Object> getSelectedBeanContextEntry() { - return selectedBeanContextEntry; - } - - public JAXXContextEntryDef<NavigationTreeNode> getSelectedNodeContextEntry() { - return selectedNodeContextEntry; - } - - public JAXXContextEntryDef<String> getSelectedPathContextEntry() { - return selectedPathContextEntry; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java deleted file mode 100644 index 729c5a2..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ /dev/null @@ -1,307 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.awt.Component; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeSelectionModel; -import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * The handler of a navigation tree. - * - * This is also the selection model to use, since we must check before moving - * from a node we can not just listen selection model changed, we must control - * it. - * - * - * @author tony - * @since 1.3 - */ -public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { - - public static final String DEFAULT_CONTEXT_PREFIX = "navigation"; - private static final long serialVersionUID = 1L; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeHandler.class); - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final String NAVIGATION_SELECTED_BEAN = "navigation-selected-bean"; - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final JAXXContextEntryDef<String> NAVIGATION_SELECTED_PATH_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-path", String.class); - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final JAXXContextEntryDef<NavigationTreeNode> NAVIGATION_SELECTED_NODE_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-node", NavigationTreeNode.class); - - /** - * Define the stategy of instanciation of ui - */ - public enum Strategy { - - /** - * instanciate a ui for a node - */ - PER_NODE, - /** - * instanciate only one a ui for a type,nodes will share the instanciation - */ - PER_UI_TYPE - } - /** - * default ui class to use if node does not define an ui class - */ - protected Class<? extends JAXXObject> defaultUIClass; - /** - * [optional] default action class - */ - protected Class<? extends JAXXAction> defaultUIHandlerClass; - /** - * UI which contains navigation tree - */ - protected JAXXObject context; - /** - * UI Instanciation strategy - */ - protected Strategy strategy; - /** - * JAXXContext access helper. - * - * @since 1.7.2 - */ - protected NavigationTreeContextHelper contextHelper; - - protected NavigationTreeHandler(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this(DEFAULT_CONTEXT_PREFIX, defaultUIClass, defaultUIHandlerClass, context, strategy); - } - - protected NavigationTreeHandler(String contextPrefix, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this.contextHelper = new NavigationTreeContextHelper(contextPrefix); - this.defaultUIClass = defaultUIClass; - this.defaultUIHandlerClass = defaultUIHandlerClass; - this.context = context; - this.strategy = strategy; - addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent event) { - if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) { - // do not treate this if no path changed - return; - } - NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent(); - selectNodeUI(node); - } - }); - } - - /** - * @return le modèle de navigation associé - */ - protected abstract NavigationTreeModel getNavigationTreeModel(); - - /** - * @return le composent actuellement visible associé au noeud courant ou - * au noeud précédent lors d'un changement de noeud. - */ - protected abstract Component getCurrentUI(); - - /** - * @param node le noeud associé à l'ui à retrouver - * @return l'ui associé au novueau noeud sélectionné - */ - protected abstract Component getUI(NavigationTreeNode node); - - /** - * @param component le composent actuellement visible - * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon - * @throws Exception if any - */ - protected abstract boolean closeUI(Component component) throws Exception; - - /** - * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation - * - * @param node le noeud associé à l'ui à créer - * @return la nouvelle ui associée au noeud - * @throws Exception if any - */ - protected abstract Component createUI(NavigationTreeNode node) throws Exception; - - /** - * Prepare le context a utiliser pour initialiser une nouvelle ui. - * - * @param node le noeud associé à l'ui à créer - * @return le context à utiliser pour instancier l'ui - * @throws Exception if any - */ - protected abstract JAXXContext createUIContext(NavigationTreeNode node) throws Exception; - - /** - * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation. - * - * @param newUI l'ui associé au noeud sélectionné à ouvrir - * @param node le node de l'ui a ouvrir - * @throws Exception if any - */ - protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception; - - /** - * Traitement des exceptions. - * - * @param e l'erreur recontrée (ou null si pas d"erreur) - */ - protected abstract void treateError(Exception e); - - /** - * Prepare le nouveau noeud sélectionné. - * - * @param node le noeud a preparer - * @return le noeud selectionné et preparé - */ - protected NavigationTreeNode prepareNode(NavigationTreeNode node) { - - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - return node; - } - - @Override - public void setSelectionPath(TreePath path) { - if (path.equals(getSelectionPath())) { - // stay on same node, can skip - if (log.isDebugEnabled()) { - log.debug("skip stay on path " + path); - } - return; - } - Component component = getCurrentUI(); - - try { - if (!closeUI(component)) { - if (log.isDebugEnabled()) { - log.debug("changing node canceled!"); - } - // can not changed current node - return; - } - } catch (Exception ex) { - treateError(ex); - return; - } - if (log.isDebugEnabled()) { - log.debug("will select path " + path); - } - // ok can safely select the new path - super.setSelectionPath(path); - } - - public void selectNodeUI(NavigationTreeNode node) { - - try { - - node = prepareNode(node); - - String path = node.getContextPath(); - - if (log.isTraceEnabled()) { - log.trace(path); - } - - Component newUI = getUI(node); - - // now, we are free to open the ui associated with the selected node in navigation - - // always clean cache on the node before all - node.cachedBean = null; - if (node.renderer != null) { - node.renderer.setRendererCachedValue(null); - } - // before all, attach bean in context associated with the selected node in navigation tree - Object data = getNavigationTreeModel().getJAXXContextValue(context, path); - - addSelectedBeanInContext(node, data); - - if (newUI == null) { - // instanciate a new ui associated with the selected node - newUI = createUI(node); - } - - // save in context current node context path - getContextHelper().setSelectedPath(context, node.getContextPath()); -// NAVIGATION_SELECTED_PATH_ENTRY_DEF.setContextValue(context, node.getContextPath()); - - // save in context current node - getContextHelper().setSelectedNode(context, node); -// NAVIGATION_SELECTED_NODE_ENTRY_DEF.setContextValue(context, node); - - // really open the ui associated with the selected node - openUI(newUI, node); - - } catch (Exception e) { - // remove data from context - - // if any error, go back to previvous node - treateError(e); - } - } - - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - - getContextHelper().setSelectedBean(context, null); -// context.removeContextValue(Object.class, NAVIGATION_SELECTED_BEAN); - - if (data != null) { - getContextHelper().setSelectedBean(context, data); -// context.setContextValue(data, NAVIGATION_SELECTED_BEAN); - //todo should we not use this to avoid conflict in context ? - context.setContextValue(data); - } - } - - protected String getNodeConstraints(NavigationTreeNode node) { - String constraints; - switch (strategy) { - case PER_NODE: - constraints = node.getContextPath(); - break; - case PER_UI_TYPE: - constraints = node.getJaxxClass().getName(); - break; - default: - throw new IllegalArgumentException("could not find constraint for node : " + node); - } - return constraints; - } - - protected JAXXAction getJAXXAction(Class<? extends JAXXAction> jaxxActionClass) throws Exception { - JAXXAction action = jaxxActionClass.newInstance(); - return action; - } - - public NavigationTreeContextHelper getContextHelper() { - return contextHelper; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java deleted file mode 100644 index 1aa694a..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java +++ /dev/null @@ -1,129 +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.CardLayout2; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JPanel; -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 NavigationTreeHandlerWithCardLayout extends NavigationTreeHandler { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeHandlerWithCardLayout.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 NavigationTreeHandlerWithCardLayout(String contextPrefix, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - super(contextPrefix, defaultUIClass, defaultUIHandlerClass, context, strategy); - 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); - } - } - - public NavigationTreeHandlerWithCardLayout(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - super(defaultUIClass, defaultUIHandlerClass, context, strategy); - - 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); - } - } - - @Override - protected Component getCurrentUI() { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - return layout.getVisibleComponent(container); - } - - @Override - protected Component getUI(NavigationTreeNode node) { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - String path = getNodeConstraints(node); - return layout.contains(path) ? layout.getComponent(container, path) : null; - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - // switch layout - layout.show(container, getNodeConstraints(node)); - } - - @Override - protected boolean closeUI(Component component) throws Exception { - // by default, we says that component was succesfull closed - return true; - } - - @Override - protected JAXXContext createUIContext(NavigationTreeNode node) throws Exception { - - if (node.getJaxxActionClass() == null) { - if (log.isWarnEnabled()) { - log.warn("no action associated with ui " + node.getJaxxClass()); - } - // no action associated, just - return context; - } - - JAXXAction action = getJAXXAction(node.getJaxxActionClass()); - - // init context with - JAXXInitialContext uiContext = action.init(this.context); - return uiContext; - } - - @Override - protected Component createUI(NavigationTreeNode node) throws Exception { - - JAXXContext uiContext = createUIContext(node); - - JAXXObject newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(uiContext); - - if (log.isDebugEnabled()) { - log.debug("instanciate new ui " + newUI); - } - - getContentContainer().add((Component) newUI, getNodeConstraints(node)); - return (Component) newUI; - } -} - diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java deleted file mode 100644 index 86f9d18..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ /dev/null @@ -1,123 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.lang.reflect.InvocationTargetException; -import java.util.regex.Pattern; -import javax.swing.JTree; -import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Helper object associated to a given navigation tree system. - * - * To helper is context safe (base on a {@link NavigationTreeContextHelper}. - * - * @author chemit - * @since 1.7.2 - * @see NavigationTreeCellRenderer - */ -public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { - - static private final Log log = LogFactory.getLog(NavigationTreeHelper.class); - - public abstract NavigationTreeModel createTreeModel(JAXXContext context); - - public abstract NavigationTreeHandler createTreeHandler(JAXXObject context); - - public NavigationTreeHelper(String contextPrefix) { - super(contextPrefix); - } - - public Object getContextValue(JAXXContext context, String navigationPath) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.getJAXXContextValue(context, navigationPath); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath) { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, String regex) { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath, regex); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, Pattern regex) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath, regex); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, String regex, String suffix) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - - NavigationTreeNode navigationTreeNode = treeModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, Pattern regex, String suffix) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - - NavigationTreeNode navigationTreeNode = treeModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - /** - * Sélection d'un noeud dans l'arbre de navigation à partir de son path. - * - * @param context le contexte applicatif - * @param tree l'arbre - * @param contextPath le path absolue du noeud dans l'arbre - */ - public void selectNode(JAXXContext context, JTree tree, String contextPath) { - NavigationTreeNode node = findNode(context, contextPath); - if (log.isDebugEnabled()) { - log.debug(contextPath + " :: " + node); - } - if (node != null) { - selectNode(context, tree, node); - } - } - - /** - * Sélection d'un noeud dans l'arbre de navigation. - * - * @param context le contexte applicatif - * @param tree l'arbre - * @param node le noeud à sélectionner dans l'arbre - */ - public void selectNode(JAXXContext context, JTree tree, NavigationTreeNode node) { - - NavigationTreeModel navigationModel = getSafeTreeModel(context); - if (log.isDebugEnabled()) { - log.debug(node); - } - TreePath path = new TreePath(navigationModel.getPathToRoot(node)); - tree.setSelectionPath(path); - tree.scrollPathToVisible(path); - if (!node.isLeaf() && !tree.isExpanded(path)) { - // expand the node to avoid a click :) - tree.expandPath(path); - } - } - - public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException { - NavigationTreeModel treeModel = getTreeModel(context); - if (treeModel == null) { - throw new NullPointerException("could not find tree model with key " + getTreeModelContextEntry() + " in context " + context); - } - return treeModel; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java deleted file mode 100644 index 39215f1..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ /dev/null @@ -1,589 +0,0 @@ -package jaxx.runtime.swing.navigation; - - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.jxpath.JXPathContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeNode; -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Le modele utilisé pour un arbre de navigation. - * <p/> - * Il est composé de {@link NavigationTreeModel.NavigationTreeNode} - * - * @author chemit - */ -public class NavigationTreeModel extends DefaultTreeModel { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeModel.class); - - static private final long serialVersionUID = 1L; - - /** the separator char used to produce the navigation path of a node. */ - protected final String navigationPathSeparator; - - public NavigationTreeModel(TreeNode root, String navigationPathSeparator) { - super(root); - this.navigationPathSeparator = navigationPathSeparator; - } - - @Override - public NavigationTreeNode getRoot() { - return (NavigationTreeNode) super.getRoot(); - } - - /** - * Search from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by dot. - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @return the node matching the fully context from the root node, or <code>null</code> if not find. - */ - public NavigationTreeNode findNode(String path) { - return findNode(getRoot(), path, (Pattern) null); - } - - /** - * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null. - * <p/> - * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * <p/> - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @param regex a optional regex to apply to path before searching - * @return the node matching the fully context from the root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(String path, String regex) { - return findNode(getRoot(), path, regex); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @param regex a optional regex to apply to path before searching - * @return the node matching the fully context from the root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(String path, Pattern regex) { - return findNode(getRoot(), path, regex); - } - - - /** - * Search from a given root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path) { - return findNode(root, path, (Pattern) null); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from a given root node a node named by his fully path (concatenation of nodes) - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @param regex a previous regex to apply to path : must have a matches - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) { - return findNode(root, path, regex == null ? null : Pattern.compile(regex)); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from a given root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @param regex a previous regex to apply to path : must have a matches - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) { - if (regex != null) { - Matcher matcher = regex.matcher(path); - if (!matcher.matches() || matcher.groupCount() < 1) { - log.warn("no matching regex " + regex + " to " + path); - return null; - } - path = matcher.group(1); - if (log.isDebugEnabled()) { - log.debug("matching regex " + regex + " : " + path); - } - } - StringTokenizer stk = new StringTokenizer(path, navigationPathSeparator); - NavigationTreeNode result = root; - // pas the first token (matches the root node) - if (root.isRoot() && stk.hasMoreTokens()) { - String rootPath = stk.nextToken(); - if (!rootPath.equals(root.getNavigationPath())) { - return null; - } - } - while (stk.hasMoreTokens()) { - result = result.getChild(stk.nextToken()); - } - return result; - } - - - /** - * Obtain the associated bean value from context corresponding to node from given navigation path. - * - * @param context the context where to seek value - * @param navigationPath the current context path of the node - * @return the value associated in context with the given navigation path - */ - public Object getJAXXContextValue(JAXXContext context, String navigationPath) { - Object result; - NavigationTreeNode node = findNode(navigationPath, (Pattern) null); - result = getJAXXContextValue(context, node); - return result; - } - - /** - * Obtain the associated bean value from context corresponding to node - * - * @param context the context where to seek value - * @param node the current node - * @return the value associated in context with the given node. - */ - public Object getJAXXContextValue(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - return null; - //fixme should throw a NPE exception - //throw new NullPointerException("node can not be null"); - } - return node.getJAXXContextValue(context); - } - - - @Override - public void nodeChanged(TreeNode node) { - nodeChanged(node, false); - } - - public void nodeChanged(TreeNode node, boolean deep) { - NavigationTreeNode n = (NavigationTreeNode) node; - n.clearCache(!deep); - super.nodeChanged(node); - if (deep) { - Enumeration<?> childs = node.children(); - while (childs.hasMoreElements()) { - NavigationTreeNode o = (NavigationTreeNode) childs.nextElement(); - nodeChanged(o, true); - } - } - } - - /** - * la représentation d'un noeud dans le modele {@link NavigationTreeModel} - * - * @author chemit - */ - public class NavigationTreeNode extends DefaultMutableTreeNode { - - private static final long serialVersionUID = 1L; - - /** pour representer le context du noeud. */ - protected String navigationPath; - - /** - * the cached complete navigation path from root node - * used for performance issues. - */ - protected String cachedNavigationPath; - - /** the JAXXObject class associated with this node (can be null) */ - protected Class<? extends JAXXObject> jaxxClass; - - /** the JAXXAction class associated with this node and will be put in ui context */ - protected Class<? extends JAXXAction> jaxxActionClass; - - /** the definition of the JAXXContext entry associated to this node, if null will seek in parent */ - protected JAXXContextEntryDef<?> jaxxContextEntryDef; - - /** jxPath to process to obtain real value associated from context with the node (can be null) */ - protected String jaxxContextEntryPath; - - /** cache of bean associated with bean to improve performance */ - protected transient Object cachedBean; - - /** renderer of the node */ - protected NodeRenderer renderer; - - /** - * The type of the related bean associated with the node. - * <p/> - * Note: This type is here to override the NodeRenderer internalClass, since - * we could need to override this data. - * <p/> - * If this property is let to null, then we will use the NodeRenderer one - */ - protected Class<?> internalClass; - - public NavigationTreeNode(Object renderer, - Object jaxxContextEntryDef, - String navigationPath, - Class<? extends JAXXObject> jaxxClass, - Class<? extends JAXXAction> jaxxActionClass) { - super(renderer); - if (renderer instanceof NodeRenderer) { - // the renderer must keep a reference of the node - this.renderer = (NodeRenderer) renderer; - this.renderer.setNode(this); - } else if (renderer instanceof String) { - // nothing special to be done - } else if (renderer != null) { - // wrong renderer type - throw new IllegalArgumentException("to define a renderer, must be a String (simple libelle) or a " + NodeRenderer.class + ", but was " + renderer); - } - this.navigationPath = navigationPath; - this.jaxxClass = jaxxClass; - this.jaxxActionClass = jaxxActionClass; - - if (jaxxContextEntryDef instanceof JAXXContextEntryDef<?>) { - this.jaxxContextEntryDef = ((JAXXContextEntryDef<?>) jaxxContextEntryDef); - } else if (jaxxContextEntryDef instanceof String) { - this.jaxxContextEntryPath = (String) jaxxContextEntryDef; - } else if (jaxxContextEntryDef != null) { - // wrong context definition type - throw new IllegalArgumentException("to define a context link, must be a String (jxpath) or a " + JAXXContextEntryDef.class + ", but was " + jaxxContextEntryDef); - } - } - - public NavigationTreeNode(Object renderer, - JAXXContextEntryDef<?> jaxxContextEntryDef, - String jaxxContextEntryPath, - String navigationPath, - Class<? extends JAXXObject> jaxxClass, - Class<? extends JAXXAction> jaxxActionClass) { - super(renderer); - if (renderer instanceof NodeRenderer) { - // the renderer must keep a reference of the node - this.renderer = (NodeRenderer) renderer; - this.renderer.setNode(this); - } else if (renderer instanceof String) { - // nothing special to be done - } else if (renderer != null) { - // wrong renderer type - throw new IllegalArgumentException("to define a renderer, must be a String (simple libelle) or a " + NodeRenderer.class + ", but was " + renderer); - } - this.navigationPath = navigationPath; - this.jaxxClass = jaxxClass; - this.jaxxActionClass = jaxxActionClass; - this.jaxxContextEntryDef = jaxxContextEntryDef; - this.jaxxContextEntryPath = jaxxContextEntryPath; - } - - public String getNavigationPath() { - return navigationPath; - } - - public void setNavigationPath(String navigationPath) { - this.navigationPath = navigationPath; - } - - public Class<? extends JAXXObject> getJaxxClass() { - return jaxxClass; - } - - public void setJaxxClass(Class<? extends JAXXObject> jaxxClass) { - this.jaxxClass = jaxxClass; - } - - public void setInternalClass(Class<?> internalClass) { - this.internalClass = internalClass; - } - - public Class<? extends JAXXAction> getJaxxActionClass() { - return jaxxActionClass; - } - - public void setJaxxActionClass(Class<? extends JAXXAction> jaxxActionClass) { - this.jaxxActionClass = jaxxActionClass; - } - - public JAXXContextEntryDef<?> getJaxxContextEntryDef() { - return jaxxContextEntryDef; - } - - public void setJaxxContextEntryDef(JAXXContextEntryDef<?> jaxxContextEntryDef) { - this.jaxxContextEntryDef = jaxxContextEntryDef; - } - - public String getJaxxContextEntryPath() { - return jaxxContextEntryPath; - } - - public void setJaxxContextEntryPath(String jaxxContextEntryPath) { - this.jaxxContextEntryPath = jaxxContextEntryPath; - } - - public Class<?> getInternalClass() { - return internalClass == null ? renderer.getInternalClass() : internalClass; - } - - /** @return the fully context pathof the node from the root node to this. */ - public String getContextPath() { - if (cachedNavigationPath == null) { - TreeNode[] path = getPath(); - StringBuilder sb = new StringBuilder(); - for (TreeNode treeNode : path) { - NavigationTreeNode myNode = (NavigationTreeNode) treeNode; - sb.append(navigationPathSeparator).append(myNode.getNavigationPath()); - } - cachedNavigationPath = sb.substring(1); - } - return cachedNavigationPath; - } - - @Override - public NavigationTreeNode getChildAt(int index) { - return (NavigationTreeNode) super.getChildAt(index); - } - - @Override - public NavigationTreeNode getParent() { - return (NavigationTreeNode) super.getParent(); - } - - /** - * @param navigationPath the name of the {@link #navigationPath} to be matched in the cild of this node. - * @return the child of this node with given {@link # navigationPath} value. - */ - public NavigationTreeNode getChild(String navigationPath) { - for (int i = 0, max = getChildCount(); i < max; i++) { - NavigationTreeNode son = getChildAt(i); - if (navigationPath.equals(son.getNavigationPath())) { - return son; - } - } - return null; - } - - /** - * Obtain the associated bean value from context corresponding to node - * - * @param context the context to seek - * @return the value associated in context with the given context path - */ - public Object getJAXXContextValue(JAXXContext context) { - Object result; - - if (cachedBean != null) { - // use cached bean - return cachedBean; - } - - if (getJaxxContextEntryDef() != null && jaxxContextEntryPath == null) { - // the node maps directly a value in context, with no jxpath resolving - result = getJaxxContextEntryDef().getContextValue(context); - // save in cache - setCachedBean(result); - return result; - } - // find the first ancestor node with a context def - NavigationTreeNode parentNode = getFirstAncestorWithDef(); - if (parentNode == null) { - log.warn("could not find a ancestor node with a definition of a context entry from node (" + this + ")"); - // todo must be an error - // no parent found - return null; - } - - Object parentBean = parentNode.getJaxxContextEntryDef().getContextValue(context); - - if (parentBean == null) { - // must be an error no bean found - log.warn("culd not find a bean attached in context from context entry definition " + parentNode.getJaxxContextEntryDef()); - return null; - } - - if (parentNode.jaxxContextEntryPath != null) { - // apply the jxpath on parentBean - JXPathContext jxcontext = JXPathContext.newContext(parentBean); - - parentBean = jxcontext.getValue(parentNode.jaxxContextEntryPath); - } - - // save in cache - parentNode.setCachedBean(parentBean); - - if (this == parentNode) { - // current node is the node matching the context entry value and no jxpath is found - return parentBean; - } - - if (jaxxContextEntryPath == null) { - // todo must be an error - log.warn("must find a jaxxContextEntryPath on node (" + this + ")"); - return null; - } - - String jxpathExpression = computeJXPath(jaxxContextEntryPath, parentNode); - - if (jxpathExpression == null) { - /// todo must be an error - log.warn("could not build jxpath from node " + parentNode + " to " + this); - // could not retreave the jxpath... - return null; - } - if (jxpathExpression.startsWith("[")) { - // special case when we want to access a collection - jxpathExpression = '.' + jxpathExpression; - } - if (log.isDebugEnabled()) { - log.debug("jxpath : " + jxpathExpression); - } - - JXPathContext jxcontext = JXPathContext.newContext(parentBean); - - result = jxcontext.getValue(jxpathExpression); - - // save in cache - setCachedBean(result); - - return result; - } - - /** - * @return the first ancestor with a none null {@link #jaxxContextEntryDef} - * or <code>null</code> if none find.. - */ - protected NavigationTreeNode getFirstAncestorWithDef() { - if (jaxxContextEntryDef != null) { - return this; - } - return getParent() == null ? null : getParent().getFirstAncestorWithDef(); - } - - protected String computeJXPath(String expr, NavigationTreeNode parentNode) { - if (parentNode == this) { - // reach the parent limit node, return the expr computed - return expr; - } - int firstIndex = expr.indexOf(".."); - int lastIndex = expr.lastIndexOf(".."); - - if (firstIndex == -1) { - // this is a error, since current node is not parent limit node, - // we must find somewhere a way to go up in nodes - throw new IllegalArgumentException(expr + " should contains at least one \"..\""); - } - - if (firstIndex != 0) { - // this is a error, the ../ must be at the beginning of the expression - throw new IllegalArgumentException("\"..\" must be at the beginning but was : " + expr); - } - - NavigationTreeNode ancestor = getParent(); - - if (firstIndex == lastIndex) { - // found only one go up, so must be substitute by the parent node context - - String newExpr = expr.substring(2); - //String newExpr = expr.substring(expr.startsWith("../") ? 3 : 2); - - if (getParent().equals(parentNode)) { - - // parent node is the final parent node, so no substitution needed - return newExpr; - //return parentNode.computeJXPath(newExpr, parentNode); - } - - // ancestor must have a jaxxContextEntryPath - if (ancestor.jaxxContextEntryPath == null) { - throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node (" + ancestor + ") must have a jaxxContextEntryPath definition, but was not "); - } - - newExpr = ancestor.jaxxContextEntryPath + newExpr; - - return ancestor.computeJXPath(newExpr, parentNode); - } - - // have more than one go up, so the ancestor node can not have a jaxxContextEntryPath - if (ancestor.jaxxContextEntryPath != null) { - throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node can not have a jaxxContextEntryPath definition"); - } - - // substitute the last ..[/] and delegate to ancestor - String newExpr = expr.substring(0, lastIndex - 1) + expr.substring(lastIndex + (expr.charAt(lastIndex + 3) == '/' ? 3 : 2)); - - return ancestor.computeJXPath(newExpr, parentNode); - } - - public void clearCache() { - clearCache(false); - } - - public void clearCache(boolean deep) { - - // clear bean cache - cachedBean = null; - - // clear context navigation cache - cachedNavigationPath = null; - - // clear render cache - if (renderer != null) { - renderer.setRendererCachedValue(null); - } - - if (deep) { - // clear cache in childs - Enumeration<?> childs = this.children(); - while (childs.hasMoreElements()) { - NavigationTreeNode o = (NavigationTreeNode) childs.nextElement(); - o.clearCache(); - } - } - } - - public Object getCachedBean() { - return cachedBean; - } - - public void setCachedBean(Object cachedBean) { - this.cachedBean = cachedBean; - } - } - -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java deleted file mode 100644 index 1c69af6..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java +++ /dev/null @@ -1,210 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.util.Enumeration; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This object is design to build a {@link NavigationTreeModel}. - * - * - * @author chemit - */ -public class NavigationTreeModelBuilder { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(NavigationTreeModelBuilder.class); - /** - * The model deal by the builder. - * - * <b>Note:</b> It is a good idea to keep only one instance of the model. - * If reset is required, should empty the model but not reinstanciate it. - */ - protected NavigationTreeModel model; - - public NavigationTreeModelBuilder(String navigationSeparator) { - model = new NavigationTreeModel(null, navigationSeparator); - } - - public NavigationTreeModel getModel() { - return model; - } - - public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(""), entryDef, null, contextName, null, null); - return addChildNode(null, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - JAXXContextEntryDef<?> entryDef, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryDef, entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - JAXXContextEntryDef<?> entryDef, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryDef, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - JAXXContextEntryDef<?> entryDef, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryDef, entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - JAXXContextEntryDef<?> entryDef, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryDef, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - protected NavigationTreeNode addChildNode(NavigationTreeNode parentNode, NavigationTreeNode node) { - if (parentNode == null) { - model.setRoot(node); - } else { - parentNode.add(node); - } - model.nodeStructureChanged(parentNode); - return node; - } - - public NavigationTreeNode removeChildNode(NavigationTreeNode node) { - NavigationTreeNode parentNode = node.getParent(); - model.removeNodeFromParent(node); - return parentNode; - } - - public void finalizeModel(NavigationTreeNode node, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass) { - if (node == null) { - return; - } - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - Enumeration<?> children = node.children(); - while (children.hasMoreElements()) { - finalizeModel((NavigationTreeNode) children.nextElement(), defaultUIClass, defaultUIHandlerClass); - } - - } - - public void printModel(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - return; - } - log.info("node " + node.getContextPath() + ", jxpath: " + node.getJaxxContextEntryPath() + ", entryContextDef: " + node.getJaxxContextEntryDef()); - if (log.isDebugEnabled()) { - log.debug("node userObject" + node.getUserObject()); - log.debug("value from node " + node.getJAXXContextValue(context)); - log.debug("value from model " + model.getJAXXContextValue(context, node)); - } - Enumeration<?> children = node.children(); - while (children.hasMoreElements()) { - printModel(context, (NavigationTreeNode) children.nextElement()); - } - } - - public static abstract class ChildBuilder<O> { - - protected NavigationTreeModelBuilder builder; - - protected ChildBuilder(NavigationTreeModelBuilder builder) { - this.builder = builder; - } - - protected abstract void init(Class<? extends O> klass); - - protected abstract Decorator<? extends O> getDecorator(O child); - - protected abstract String getJXPath(O child); - - protected abstract String getNavigationPath(O child); - - public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, java.util.Collection<? extends O> beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { - - if (beans == null || beans.isEmpty()) { - // no bean to treate - return; - } - - init(klass); - - NavigationTreeNode node; - - for (O o : beans) { - node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); - if (cacheValues) { - // cache the bean value to improve performance - node.setCachedBean(o); - } - } - } - - public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, O[] beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { - - if (beans == null || beans.length == 0) { - // no bean to treate - return; - } - - init(klass); - - NavigationTreeNode node; - - for (O o : beans) { - node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); - if (cacheValues) { - // cache the bean value to improve performance - node.setCachedBean(o); - } - } - } - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java deleted file mode 100644 index 1564107..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java +++ /dev/null @@ -1,248 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreePath; -import java.awt.Component; - -/** - * A {@link javax.swing.event.TreeSelectionListener} implementation - * @author chemit - * @deprecated since 1.7.2, use now {@link NavigationTreeHandler} - */ -@Deprecated -public abstract class NavigationTreeSelectionAdapter implements TreeSelectionListener { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeSelectionAdapter.class); - - //static public final String NAVIGATION_CONTEXT_PATH = "navigation-context-path"; - - //static public final String NAVIGATION_SELECTED_NODE = "navigation-selected-node"; - - static public final String NAVIGATION_SELECTED_BEAN = "navigation-selected-bean"; - - static public final JAXXContextEntryDef<String> NAVIGATION_SELECTED_PATH_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-path", String.class); - - static public final JAXXContextEntryDef<NavigationTreeNode> NAVIGATION_SELECTED_NODE_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-node", NavigationTreeNode.class); - - static public final JAXXContextEntryDef<Boolean> GO_BACK_DEF = JAXXContextEntryDef.newDef("goBack", Boolean.class); - - /** defined the stategy of instanciation of ui */ - public enum Strategy { - /** instanciate a ui for a node */ - PER_NODE, - /** instanciate only one a ui for a type,nodes will share the instanciation */ - PER_UI_TYPE - } - - /** la classe d'ui par defaut, associé à un noeud de l'arbe */ - protected Class<? extends JAXXObject> defaultUIClass; - - protected Class<? extends JAXXAction> defaultUIHandlerClass; - - /** l'ui contenant l'arbre de navigation */ - protected JAXXObject context; - - protected Strategy strategy; - - protected NavigationTreeSelectionAdapter(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this.defaultUIClass = defaultUIClass; - this.defaultUIHandlerClass = defaultUIHandlerClass; - this.context = context; - this.strategy = strategy; - } - - - protected abstract NavigationTreeModel getNavigationTreeModel(); - - /** - * @return le composent actuellement visible associé au noeud courant ou au noeud précédent - * lors d'un changement de noeud. - */ - protected abstract Component getCurrentUI(); - - /** - * @param node le noeud associé à l'ui à retrouver - * @return l'ui associé au novueau noeud sélectionné - */ - protected abstract Component getUI(NavigationTreeNode node); - - /** - * @param event l'evenement de selection de noeud - * @param component le composent actuellement visible - * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon - * @throws Exception if any - */ - protected abstract boolean closeUI(TreeSelectionEvent event, Component component) throws Exception; - - /** - * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation - * - * @param node le noeud associé à l'ui à créer - * @return la nouvelle ui associée au noeud - * @throws Exception if any - */ - protected abstract Component createUI(NavigationTreeNode node) throws Exception; - - /** - * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation. - * - * @param newUI l'ui associé au noeud sélectionné à ouvrir - * @param node le node de l'ui a ouvrir - * @throws Exception if any - */ - protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception; - - /** - * Retourne au noeud précdemment sélectionné dans l'arbre de navigation, avec la possibilité de notifier - * une erreure survenue. - * - * @param event l'évènement de changement de noeud sélectionné. - * @param e l'erreur recontrée (ou null si pas d"erreur) - */ - protected abstract void goBackToPreviousNode(TreeSelectionEvent event, Exception e); - - /** - * Prepare le nouveau noeud sélectionné. - * - * @param event l'évènement de selection du noeud - * @return le noeud selectionné et preparé - */ - protected NavigationTreeNode prepareNode(TreeSelectionEvent event) { - NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent(); - - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - return node; - } - - @Override - public void valueChanged(TreeSelectionEvent event) { - if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) { - // do not treate this if no path changed - return; - } - - Boolean goBack = GO_BACK_DEF.getContextValue(context); - if (goBack != null && goBack) { - // do not treate this, apsecial flag told us :) - GO_BACK_DEF.removeContextValue(context); - return; - } - - try { - - NavigationTreeNode node = prepareNode(event); - - String path = node.getContextPath(); - - if (log.isTraceEnabled()) { - log.trace(path); - } - - Component newUI = getUI(node); - Component component = getCurrentUI(); - - if (newUI != null && strategy == Strategy.PER_NODE && newUI.equals(component)) { - // call back from goto back to previous node, do nothing - return; - } - - if (!closeUI(event, component)) { - GO_BACK_DEF.setContextValue(context, Boolean.TRUE); - // previous ui was not closed, so reselect the previous node in navigation - goBackToPreviousNode(event, null); - // and quit - return; - } - - // now, we are free to open the ui associated with the selected node in navigation - - // always clean cache on the node before all - node.cachedBean = null; - if (node.renderer != null) { - node.renderer.setRendererCachedValue(null); - } - // before all, attach bean in context associated with the selected node in naivgation tree - Object data = getNavigationTreeModel().getJAXXContextValue(context, path); - - addSelectedBeanInContext(node, data); - - if (newUI == null) { - // instanciate a new ui associated with the selected node - newUI = createUI(node); - } - - // save in context current node context path - NAVIGATION_SELECTED_PATH_ENTRY_DEF.setContextValue(context, node.getContextPath()); - - // save in context current node - NAVIGATION_SELECTED_NODE_ENTRY_DEF.setContextValue(context, node); - - // really open the ui associated with the selected node - openUI(newUI, node); - - } catch (Exception e) { - // remove data from context - - // if any error, go back to previvous node - goBackToPreviousNode(event, e); - } - } - - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - - context.removeContextValue(Object.class, NAVIGATION_SELECTED_BEAN); - - if (data != null) { - context.setContextValue(data, NAVIGATION_SELECTED_BEAN); - //todo should we not use this to avoid conflict in context ? - context.setContextValue(data); - } - } - - protected String getNodeConstraints(NavigationTreeNode node) { - String constraints; - switch (strategy) { - case PER_NODE: - constraints = node.getContextPath(); - break; - case PER_UI_TYPE: - constraints = node.getJaxxClass().getName(); - break; - default: - throw new IllegalArgumentException("could not find constraint for node : " + node); - } - return constraints; - } - - protected void returnToPreviousNode(JTree tree, TreeSelectionEvent event) { - // go back to previous node - // put in context a tag to not come back again here - TreePath oldPath = event.getOldLeadSelectionPath(); - //NavigationTreeNode oldNode = (NavigationTreeNode) oldPath.getLastPathComponent(); - if (oldPath != null) { - tree.setSelectionPath(oldPath); - } - } - -} \ No newline at end of file diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java deleted file mode 100644 index 1a79bd6..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java +++ /dev/null @@ -1,110 +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.CardLayout2; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -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 - * @deprecated since 1.7.2, use now {@link NavigationTreeHandler} - */ -@Deprecated -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, Strategy strategy) { - super(defaultUIClass, defaultUIHandlerClass, context,strategy); - - 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 getUI(NavigationTreeNode node) { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - String path = getNodeConstraints(node); - 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, getNodeConstraints(node)); - } - - 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, getNodeConstraints(node)); - return (Component) newUI; - } -} - diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java deleted file mode 100644 index 1c8eb1b..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java +++ /dev/null @@ -1,264 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; - -import java.lang.reflect.InvocationTargetException; -import java.util.regex.Pattern; - -/** - * Usefull methods on {@link NavigationTreeModel} and others. - * - * The class is deprecated since it is not safe context, and can not be used - * with more than one navigation tree in a same context. - * - * Now use the {@link NavigationTreeContextHelper} and {@link NavigationTreeHelper} - * which are context safe and more friendly. - * - * @author chemit - * - * @see jaxx.runtime.swing.navigation.NavigationTreeModel - * @see jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode - * - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} or - * {@link NavigationTreeContextHelper} to access data releated to a tree navigation - */ -@Deprecated -public class NavigationUtil { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationUtil.class); - - /** - * - * @param context - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static String getCurrentNavigationNath(JAXXContext context) { - return NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_PATH_ENTRY_DEF.getContextValue(context); - } - - /** - * - * @param context - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode getSelectedNode(JAXXContext context) { - return NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_NODE_ENTRY_DEF.getContextValue(context); - } - - /** - * - * @param <O> - * @param context - * @param clazz - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static <O> O getSelectedBean(JAXXContext context, Class<O> clazz) { - return context.getContextValue(clazz, NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_BEAN); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @return - * @throws InvocationTargetException - * @throws NoSuchMethodException - * @throws IllegalAccessException - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static Object getContextValue(JAXXContext context, String contextKey, String navigationPath) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.getJAXXContextValue(context, navigationPath); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, String regex) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath, regex); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, Pattern regex) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath, regex); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @param suffix - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, String regex, String suffix) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - NavigationTreeNode navigationTreeNode = navigationModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = navigationModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @param suffix - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, Pattern regex, String suffix) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - NavigationTreeNode navigationTreeNode = navigationModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = navigationModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - public static class NodeRenderer implements java.io.Serializable { - - protected String libelle; - - protected Decorator<?> decorator; - - protected NavigationTreeNode node; - - protected Class<?> internalClass; - - protected String rendererCachedValue; - - private static final long serialVersionUID = -1238962588426200861L; - - public NodeRenderer(String libelle) { - this.libelle = libelle; - this.internalClass = String.class; - } - - public NodeRenderer(Decorator<?> decorator) { - this.decorator = decorator; - this.internalClass = decorator.getInternalClass(); - } - - public String toString(JAXXContext context) { - if (rendererCachedValue != null) { - return rendererCachedValue; - } - - String result; - - if (libelle != null) { - // simple libelle renderer - result = _(libelle); - } else { - - // with decorator renderer - - try { - Object bean = node.getJAXXContextValue(context); - result = decorator.toString(bean); - - } catch (Exception e) { - result = ""; - } - } - setRendererCachedValue(result); - return result; - } - - public void setNode(NavigationTreeNode node) { - this.node = node; - } - - public Class<?> getInternalClass() { - return internalClass; - } - - public void setRendererCachedValue(String rendererCachedValue) { - this.rendererCachedValue = rendererCachedValue; - if (log.isDebugEnabled()) { - log.debug(rendererCachedValue); - } - } - - public String getRendererCachedValue() { - return rendererCachedValue; - } - - } - -} diff --git a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties b/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties deleted file mode 100644 index 0374c36..0000000 --- a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties +++ /dev/null @@ -1,9 +0,0 @@ -validator.field.header=Property -validator.field.header.tip=Property on which message occurs -validator.field.tip=Property '%1$s' -validator.message.header=Message -validator.message.header.tip=The message text -validator.message.tip=Message \: %1$s -validator.scope.header=... -validator.scope.header.tip=The message scope -validator.scope.tip=Message scope \: '%1$s' diff --git a/jaxx-runtime-swing/src/site/site.xml b/jaxx-runtime-swing/src/site/site.xml deleted file mode 100644 index 6c8144f..0000000 --- a/jaxx-runtime-swing/src/site/site.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="${project.name}"> - - <bannerLeft> - <name>${project.name}</name> - <src>${site.home.url}/jaxx.png</src> - <href>index.html</href> - </bannerLeft> - - <body> - - <breadcrumbs> - <item name="${project.name}" href="${project.url}" /> - </breadcrumbs> - - <menu ref="parent"/> - - <menu name="Utilisateur" inherited="top"/> - - <menu ref="reports"/> - - <menu ref="modules"/> - - </body> -</project> diff --git a/jaxx-example/LICENSE.txt b/jaxx-runtime/LICENSE.txt similarity index 100% rename from jaxx-example/LICENSE.txt rename to jaxx-runtime/LICENSE.txt diff --git a/jaxx-example/README.txt b/jaxx-runtime/README.txt similarity index 100% rename from jaxx-example/README.txt rename to jaxx-runtime/README.txt diff --git a/jaxx-runtime-api/changelog.txt b/jaxx-runtime/changelog.txt similarity index 100% rename from jaxx-runtime-api/changelog.txt rename to jaxx-runtime/changelog.txt diff --git a/jaxx-runtime-api/pom.xml b/jaxx-runtime/pom.xml similarity index 88% rename from jaxx-runtime-api/pom.xml rename to jaxx-runtime/pom.xml index 2792cdc..c0da43b 100644 --- a/jaxx-runtime-api/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,11 +10,11 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <dependencies> @@ -62,8 +62,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx runtime api</description> + <name>JAXX Runtime</name> + <description>JAXX Runtime api</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -81,6 +81,14 @@ <goal>parserJava</goal> <goal>gen</goal> </goals> + <configuration> + <treateDefaultEntry>false</treateDefaultEntry> + <entries> + <entry> + <basedir>src/main/java/jaxx/runtime/validator</basedir> + </entry> + </entries> + </configuration> </execution> </executions> </plugin> diff --git a/jaxx-runtime-api/src/main/java/jaxx/Base64Coder.java b/jaxx-runtime/src/main/java/jaxx/Base64Coder.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/Base64Coder.java rename to jaxx-runtime/src/main/java/jaxx/Base64Coder.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Rule.java b/jaxx-runtime/src/main/java/jaxx/css/Rule.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Rule.java rename to jaxx-runtime/src/main/java/jaxx/css/Rule.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Selector.java b/jaxx-runtime/src/main/java/jaxx/css/Selector.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Selector.java rename to jaxx-runtime/src/main/java/jaxx/css/Selector.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Stylesheet.java b/jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Stylesheet.java rename to jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/ComponentDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/ComponentDescriptor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingUpdateListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingUpdateListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java similarity index 91% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java index 4d014d0..9fbfeb1 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java @@ -150,12 +150,12 @@ public abstract class DataContext { return result; } - public void setContextValue(DataContextEntry entry, Object value, String key) { + public void setContextValue(DataContextEntry<?> entry, Object value, String key) { String contextKey = getKey(entry, key); delegate.setContextValue(value, contextKey); } - public void removeContextValue(DataContextEntry entry, Object value, String key) { + public void removeContextValue(DataContextEntry<?> entry, Object value, String key) { String contextKey = getKey(entry, key); delegate.removeContextValue(value.getClass(), contextKey); } @@ -246,7 +246,7 @@ public abstract class DataContext { pcs.firePropertyChange(name, oldValue, newValue); } - protected String getKey(DataContextEntry entry, String key) { + protected String getKey(DataContextEntry<?> entry, String key) { String result = null; if (key != null) { result = entry.hashCode() + "#" + key; @@ -259,7 +259,7 @@ public abstract class DataContext { // suppression des ecouteurs - for (PropertyChangeListener l : getPropertyChangeListeners()) { + for (PropertyChangeListener l : getPropertyChangeListeners()) { removePropertyChangeListener(l); } } @@ -272,14 +272,14 @@ public abstract class DataContext { private final int level; private final DataContextEntry<?> previous; - private final DataContextEntry[] parents; + private final DataContextEntry<?>[] parents; private Class<E> klass; public DataContextEntry(Class<E> klass, DataContextEntry<?> previous) { this.previous = previous; this.level = previous.level + 1; this.klass = klass; - this.parents = new DataContextEntry[level]; + this.parents = new DataContextEntry<?>[level]; int i = level; while (i > 0) { parents[--i] = previous; @@ -291,7 +291,7 @@ public abstract class DataContext { this.level = 0; this.klass = klass; this.previous = null; - this.parents = new DataContextEntry[0]; + this.parents = new DataContextEntry<?>[0]; } public Class<E> getKlass() { @@ -302,7 +302,7 @@ public abstract class DataContext { return level; } - public DataContextEntry[] getParents() { + public DataContextEntry<?>[] getParents() { return parents; } @@ -321,7 +321,7 @@ public abstract class DataContext { @Override public Iterator<DataContextEntry<?>> iterator() { int length = parents.length; - DataContextEntry[] t = new DataContextEntry[length + 1]; + DataContextEntry<?>[] t = new DataContextEntry<?>[length + 1]; System.arraycopy(parents, 0, t, 0, length); t[length] = this; return new DataContextEntryIterator(t, true); @@ -335,31 +335,31 @@ public abstract class DataContext { public static interface UpdateDataContext<D extends DataContext> { - void onRemovingData(D context, DataContextEntry<?> entry); + void onRemovingData(D context, DataContextEntry<D> entry); - void onAddingData(D context, DataContextEntry entry, String path); + void onAddingData(D context, DataContextEntry<D> entry, String path); } public static class DataContextEntryIterator implements Iterator<DataContextEntry<?>> { - protected final DataContextEntry[] datas; + protected final DataContextEntry<?>[] datas; protected final boolean reverse; protected final int level; protected int index; - public DataContextEntryIterator(DataContextEntry[] datas) { + public DataContextEntryIterator(DataContextEntry<?>[] datas) { this(datas, false, -1); } - public DataContextEntryIterator(DataContextEntry[] datas, int level) { + public DataContextEntryIterator(DataContextEntry<?>[] datas, int level) { this(datas, false, level); } - public DataContextEntryIterator(DataContextEntry[] datas, boolean reverse) { + public DataContextEntryIterator(DataContextEntry<?>[] datas, boolean reverse) { this(datas, reverse, -1); } - DataContextEntryIterator(DataContextEntry[] datas, boolean reverse, int level) { + DataContextEntryIterator(DataContextEntry<?>[] datas, boolean reverse, int level) { this.datas = datas; this.reverse = reverse; if (reverse) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java similarity index 97% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java index 895a32e..036be21 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java @@ -78,11 +78,11 @@ public class DefaultApplicationContext extends DefaultJAXXContext { /** * Map of forwarded classes (key) to classes (values). */ - protected Map<Class, Class> forwards; + protected Map<Class<?>, Class<?>> forwards; public DefaultApplicationContext() { super(); - forwards = new HashMap<Class, Class>(); + forwards = new HashMap<Class<?>, Class<?>>(); pcs = new PropertyChangeSupport(this); } @@ -165,10 +165,10 @@ public class DefaultApplicationContext extends DefaultJAXXContext { @Override public <T> void removeContextValue(Class<T> klazz, String name) { - Entry<Class, Class> entry; + Entry<Class<?>, Class<?>> entry; if (name == null && forwards.containsValue(klazz)) { // remove forward - Iterator<Entry<Class, Class>> itr = forwards.entrySet().iterator(); + Iterator<Entry<Class<?>, Class<?>>> itr = forwards.entrySet().iterator(); while (itr.hasNext()) { entry = itr.next(); if (entry.getValue().equals(klazz)) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultJAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXAction.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java similarity index 87% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index 4d4a421..85db035 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -29,6 +29,7 @@ public interface JAXXContext { * <p/> * If a previous entry exists in context (unamed and same class), it will be removed. * + * @param <T> type of data to set in context * @param o the value to push in context */ public <T> void setContextValue(T o); @@ -38,6 +39,7 @@ public interface JAXXContext { * <p/> * If a previous entry exists in context (same name and class), it will be removed. * + * @param <T> type of data to set in context * @param o the value to push in context * @param name the name of the new entry */ @@ -46,6 +48,7 @@ public interface JAXXContext { /** * Remove from context the value with the given klazz as an unamed entry * + * @param <T> type of data to remove from context * @param klazz the klazz entry */ public <T> void removeContextValue(Class<T> klazz); @@ -53,6 +56,7 @@ public interface JAXXContext { /** * Remove from context the value with the given klazz as an unamed (if name is null) or named entry * + * @param <T> type of data to remove from context * @param klazz the klazz entry * @param name extra name of the entry */ @@ -66,6 +70,7 @@ public interface JAXXContext { * <p/> * <code><JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/></code> * + * @param <T> type of data to obtain from context * @param clazz the class of unamed entry to seek in context * @return the value of the unamed entry for the given class, or <code>null</code> if no such entry. */ @@ -74,6 +79,7 @@ public interface JAXXContext { /** * Seek for a named entry in the context * + * @param <T> type of data to obtain from context * @param clazz the class of named entry to seek in context * @param name the name of the entry to seek in context * @return the value of the named entry for the given class, or <code>null</code> if no such entry. @@ -83,6 +89,7 @@ public interface JAXXContext { /** * Return parent's container corresponding to the Class clazz * + * @param <O> type of container to obtain from context * @param clazz clazz desired * @return parent's container */ @@ -91,6 +98,7 @@ public interface JAXXContext { /** * Return parent's container corresponding to the Class clazz * + * @param <O> type of container to obtain from context * @param top the top container * @param clazz desired * @return parent's container diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContextEntryDef.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXInitialContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObject.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/JaxxHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/JaxxHelpUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java similarity index 95% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index f195be8..13ab770 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -1,5 +1,6 @@ package jaxx.runtime; +import jaxx.runtime.*; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -38,13 +39,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Properties; -import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JLayeredPane; -import javax.swing.JList; import javax.swing.JRootPane; import javax.swing.JTabbedPane; import javax.swing.JTree; @@ -56,7 +55,6 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import jaxx.runtime.swing.BooleanCellRenderer; -import jaxx.runtime.swing.DecoratorTableCellRenderer; import jaxx.runtime.swing.EmptyNumberTableCellRenderer; import jaxx.runtime.swing.EnumTableCellRenderer; import jaxx.runtime.swing.I18nTableCellRenderer; @@ -660,33 +658,6 @@ public class SwingUtil extends Util { } } - /** - * Génère un renderer de liste graphique basée sur un décorateur donné. - * - * @param <O> le type des données gérées par le décorateur - * @param decorator le décorateur à encapsuler - * @return le nouveau renderer - * @see Decorator - */ - public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) { - return new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - String decorated; - if (value instanceof String) { - decorated = (String) value; - } else { - decorated = decorator.toString(value); - } - JComponent component = (JComponent) super.getListCellRendererComponent(list, decorated, index, isSelected, cellHasFocus); - return component; - } - }; - } - public static TableCellRenderer newDeleteCellRenderer(DefaultTableCellRenderer renderer) { Icon icon = UIManager.getIcon("Table.removeIcon"); if (icon == null) { @@ -700,10 +671,6 @@ public class SwingUtil extends Util { return new BooleanCellRenderer(renderer); } - public static DecoratorTableCellRenderer newDecorateTableCellRenderer(TableCellRenderer renderer, Decorator<?> decorator) { - return new DecoratorTableCellRenderer(renderer, decorator); - } - public static EmptyNumberTableCellRenderer newEmptyNumberTableCellRenderer(TableCellRenderer renderer) { return new EmptyNumberTableCellRenderer(renderer); } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java similarity index 92% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java rename to jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 1f1ec83..7f39843 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -4,11 +4,9 @@ import jaxx.Base64Coder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; -import javax.swing.JList; import javax.swing.UIManager; import java.awt.Component; import java.awt.Dimension; @@ -31,24 +29,20 @@ public class Util { public static final String DEFAULT_ICON_PATH = "/icons/"; public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path"; - /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(Util.class); - - // Maps root objects to lists of event listeners private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>(); private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>(); - private static class EventListenerDescriptor { - Class listenerClass; + + Class<?> listenerClass; String listenerMethodName; String methodName; Object eventListener; } - /** * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField @@ -66,16 +60,13 @@ public class Util { //descriptor.getBytes(0, descriptor.length(), data, 0); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data)); return (JAXXObjectDescriptor) in.readObject();*/ - } - catch (IOException e) { + } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Internal error: can't-happen error", e); } } - public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) { try { return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true); @@ -86,16 +77,13 @@ public class Util { //descriptor.getBytes(0, descriptor.length(), data, 0); ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data))); return (JAXXObjectDescriptor) in.readObject();*/ - } - catch (IOException e) { + } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Internal error: can't-happen error", e); } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer); List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null; @@ -131,22 +119,22 @@ public class Util { if (listenerMethodName != null && listenerMethod == null) { throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName()); } - Class[] parameterTypes = listenerMethods.get(0).getParameterTypes(); + Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes(); Class<?> methodContainerClass = methodContainer.getClass(); final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes); descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(), - new Class[]{listenerClass}, + new Class<?>[]{listenerClass}, new InvocationHandler() { + + @Override public Object invoke(Object proxy, Method method, Object[] args) { String methodName = method.getName(); if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) { try { return targetMethod.invoke(methodContainer, args); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new RuntimeException(e); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new RuntimeException(e); } } @@ -164,18 +152,15 @@ public class Util { }); descriptors.add(descriptor); return descriptor.eventListener; - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) { return getEventListener(listenerClass, null, methodContainer, methodName); } - public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) { WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object); List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get(); @@ -194,7 +179,6 @@ public class Util { return listener; } - public static void setComponentWidth(Component component, int width) { component.setSize(width, component.getHeight()); if (component instanceof JComponent) { @@ -207,7 +191,6 @@ public class Util { } } - public static void setComponentHeight(Component component, int height) { component.setSize(component.getWidth(), height); if (component instanceof JComponent) { @@ -220,55 +203,46 @@ public class Util { } } - public static boolean assignment(boolean value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static byte assignment(byte value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static short assignment(short value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static int assignment(int value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static long assignment(long value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static float assignment(float value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static double assignment(double value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static char assignment(char value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; @@ -346,24 +320,6 @@ public class Util { } } - public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) { - return new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - String decorated; - if (value instanceof String) { - decorated = (String) value; - } else { - decorated = decorator.toString(value); - } - return super.getListCellRendererComponent(list, decorated, index, isSelected, cellHasFocus); - } - }; - } - public static ImageIcon createIcon(String path) { java.net.URL imgURL = Util.class.getResource(path); if (imgURL != null) { @@ -400,7 +356,6 @@ public class Util { return getUIManagerIcon("action." + key); } - public static ImageIcon createActionIcon(String name) { String iconPath = getIconPath(); return createIcon(iconPath + "action-" + name + ".png"); @@ -461,5 +416,4 @@ public class Util { } return iconPath; } - } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/css/DataBinding.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/css/DataBinding.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/css/Pseudoclasses.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/css/Pseudoclasses.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Application.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Application.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/GBC.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/GBC.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBoxLayout.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Item.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Item.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXComboBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXComboBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTab.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTab.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java index 97f35d5..cdeda7f 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java @@ -1,259 +1,259 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JTree; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import java.awt.Component; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.List; - -public class JAXXTree extends JTree { - - private static final long serialVersionUID = 1L; - private static final String SYNTHETIC = "<synthetic root node>"; - - public class JAXXTreeModel implements TreeModel { - - private Item root; - private List<TreeModelListener> listeners = new ArrayList<TreeModelListener>(); - - public JAXXTreeModel(List<Item> items) { - if (items.size() == 1) { - this.root = items.get(0); - } else { - this.root = new Item(null, null, SYNTHETIC, false); - for (Item item : items) { - root.addChild(item); - } - } - - PropertyChangeListener listener = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent e) { - if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { - Item item = (Item) e.getSource(); - if (item.isSelected()) { - addSelectionPath(getTreePath(item)); - } else { - removeSelectionPath(getTreePath(item)); - } - } else { - Item item = (Item) e.getSource(); - boolean root = item.getParent() == null; - TreePath path = !root ? getTreePath(item.getParent()) : null; - fireTreeNodesChanged(new TreeModelEvent(JAXXTreeModel.this, path, - !root ? new int[]{item.getParent().getChildren().indexOf(item)} : null, - new Object[]{item.getValue()})); - } - } - }; - addPropertyChangeListener(root, listener); - } - - private void addPropertyChangeListener(Item item, PropertyChangeListener listener) { - item.addPropertyChangeListener(listener); - List<Item> children = item.getChildren(); - for (Item aChildren : children) { - addPropertyChangeListener(aChildren, listener); - } - } - - @Override - public void addTreeModelListener(TreeModelListener listener) { - listeners.add(listener); - } - - - /* This is an inefficient implementation, but hand-coded tree structures are unlikely to contain - enough nodes for that to really matter. This could be sped up with caching. */ - public Item findItem(Object value) { - return findItem(root, value); - } - - private Item findItem(Item node, Object value) { - if (node.getValue() == value) { - return node; - } else { - List<Item> children = node.getChildren(); - for (Item aChildren : children) { - Item result = findItem(aChildren, value); - if (result != null) { - return result; - } - } - return null; - } - } - - private TreePath getTreePath(Item node) { - List<Object> path = new ArrayList<Object>(); - while (node != null) { - path.add(0, node.getValue()); - node = node.getParent(); - } - return new TreePath(path.toArray()); - } - - @Override - public Object getChild(Object parent, int index) { - Item node = findItem(parent); - return node.getChildren().get(index).getValue(); - } - - @Override - public int getChildCount(Object parent) { - Item node = findItem(parent); - if (node == null){ - return 0; - } - return node.getChildren().size(); - } - - @Override - public int getIndexOfChild(Object parent, Object child) { - Item node = findItem(parent); - List<Item> children = node.getChildren(); - for (int i = 0, j = children.size(); i < j; i++) { - if (children.get(i).getValue() == child) { - return i; - } - } - return -1; - } - - @Override - public Object getRoot() { - return root.getValue(); - } - - public Item getRootItem() { - return root; - } - - @Override - public boolean isLeaf(Object node) { - Item item = findItem(node); - return item != null && item.getChildren().size() == 0; - } - - @Override - public void removeTreeModelListener(TreeModelListener listener) { - listeners.remove(listener); - } - - public void fireTreeNodesChanged(TreeModelEvent e) { - for (TreeModelListener listener : listeners) { - listener.treeNodesChanged(e); - } - } - - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - } - } - - public JAXXTree(TreeModel model) { - super(model); - } - - public JAXXTree() { - setCellRenderer(new DefaultTreeCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - TreeModel model = tree.getModel(); - if (model instanceof JAXXTreeModel) { - Item item = ((JAXXTreeModel) model).findItem(value); - if (item != null) { - String label = item.getLabel(); - if (label != null) { - value = label; - } - } - } - return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - }); - - addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent e) { - TreeModel model = getModel(); - if (model instanceof JAXXTreeModel) { - scan((JAXXTreeModel) model, ((JAXXTreeModel) model).root); - } - } - - private void scan(JAXXTreeModel model, Item item) { - TreePath path = model.getTreePath(item); - if (item.isSelected() != isPathSelected(path)) { - item.setSelected(!item.isSelected()); - } - List<Item> children = item.getChildren(); - for (Item aChildren : children) { - scan(model, aChildren); - } - } - }); - } - - public void setItem(Item items) { - List<Item> newItems = new ArrayList<Item>(); - newItems.add(items); - setItems(newItems); - } - - public void setItems(List<Item> items) { - // Create model - JAXXTreeModel model = new JAXXTreeModel(items); - if (model.getRoot() != null) { - setRootVisible(model.getRoot() != SYNTHETIC); - } - // Atach model - setModel(model); - - // Appli selected items - if (items != null){ - List<TreePath> treePathSelected = new ArrayList<TreePath>(); - for (Item i : items){ - if (i.isSelected()){ - treePathSelected.add(model.getTreePath(i)); - } - } - this.setSelectionPaths(convertToTreePathArray(treePathSelected.toArray())); - } - } - - public Object getSelectionValue() { - TreePath selectionPath = getSelectionPath(); - return selectionPath != null ? selectionPath.getLastPathComponent() : null; - } - - public Item getRootItem(){ - if (getModel() instanceof JAXXTreeModel){ - return ((JAXXTreeModel)getModel()).getRootItem(); - } - return null; - } - - protected TreePath[] convertToTreePathArray(Object[] datas){ - TreePath[] params = new TreePath[datas.length]; - System.arraycopy(datas, 0, params, 0, datas.length); - return params; - } -} +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.runtime.swing; + +import javax.swing.JTree; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import java.awt.Component; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.List; + +public class JAXXTree extends JTree { + + private static final long serialVersionUID = 1L; + private static final String SYNTHETIC = "<synthetic root node>"; + + public class JAXXTreeModel implements TreeModel { + + private Item root; + private List<TreeModelListener> listeners = new ArrayList<TreeModelListener>(); + + public JAXXTreeModel(List<Item> items) { + if (items.size() == 1) { + this.root = items.get(0); + } else { + this.root = new Item(null, null, SYNTHETIC, false); + for (Item item : items) { + root.addChild(item); + } + } + + PropertyChangeListener listener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent e) { + if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { + Item item = (Item) e.getSource(); + if (item.isSelected()) { + addSelectionPath(getTreePath(item)); + } else { + removeSelectionPath(getTreePath(item)); + } + } else { + Item item = (Item) e.getSource(); + boolean root = item.getParent() == null; + TreePath path = !root ? getTreePath(item.getParent()) : null; + fireTreeNodesChanged(new TreeModelEvent(JAXXTreeModel.this, path, + !root ? new int[]{item.getParent().getChildren().indexOf(item)} : null, + new Object[]{item.getValue()})); + } + } + }; + addPropertyChangeListener(root, listener); + } + + private void addPropertyChangeListener(Item item, PropertyChangeListener listener) { + item.addPropertyChangeListener(listener); + List<Item> children = item.getChildren(); + for (Item aChildren : children) { + addPropertyChangeListener(aChildren, listener); + } + } + + @Override + public void addTreeModelListener(TreeModelListener listener) { + listeners.add(listener); + } + + + /* This is an inefficient implementation, but hand-coded tree structures are unlikely to contain + enough nodes for that to really matter. This could be sped up with caching. */ + public Item findItem(Object value) { + return findItem(root, value); + } + + private Item findItem(Item node, Object value) { + if (node.getValue() == value) { + return node; + } else { + List<Item> children = node.getChildren(); + for (Item aChildren : children) { + Item result = findItem(aChildren, value); + if (result != null) { + return result; + } + } + return null; + } + } + + private TreePath getTreePath(Item node) { + List<Object> path = new ArrayList<Object>(); + while (node != null) { + path.add(0, node.getValue()); + node = node.getParent(); + } + return new TreePath(path.toArray()); + } + + @Override + public Object getChild(Object parent, int index) { + Item node = findItem(parent); + return node.getChildren().get(index).getValue(); + } + + @Override + public int getChildCount(Object parent) { + Item node = findItem(parent); + if (node == null){ + return 0; + } + return node.getChildren().size(); + } + + @Override + public int getIndexOfChild(Object parent, Object child) { + Item node = findItem(parent); + List<Item> children = node.getChildren(); + for (int i = 0, j = children.size(); i < j; i++) { + if (children.get(i).getValue() == child) { + return i; + } + } + return -1; + } + + @Override + public Object getRoot() { + return root.getValue(); + } + + public Item getRootItem() { + return root; + } + + @Override + public boolean isLeaf(Object node) { + Item item = findItem(node); + return item != null && item.getChildren().size() == 0; + } + + @Override + public void removeTreeModelListener(TreeModelListener listener) { + listeners.remove(listener); + } + + public void fireTreeNodesChanged(TreeModelEvent e) { + for (TreeModelListener listener : listeners) { + listener.treeNodesChanged(e); + } + } + + @Override + public void valueForPathChanged(TreePath path, Object newValue) { + } + } + + public JAXXTree(TreeModel model) { + super(model); + } + + public JAXXTree() { + setCellRenderer(new DefaultTreeCellRenderer() { + + private static final long serialVersionUID = 1L; + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { + TreeModel model = tree.getModel(); + if (model instanceof JAXXTreeModel) { + Item item = ((JAXXTreeModel) model).findItem(value); + if (item != null) { + String label = item.getLabel(); + if (label != null) { + value = label; + } + } + } + return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + } + }); + + addTreeSelectionListener(new TreeSelectionListener() { + + @Override + public void valueChanged(TreeSelectionEvent e) { + TreeModel model = getModel(); + if (model instanceof JAXXTreeModel) { + scan((JAXXTreeModel) model, ((JAXXTreeModel) model).root); + } + } + + private void scan(JAXXTreeModel model, Item item) { + TreePath path = model.getTreePath(item); + if (item.isSelected() != isPathSelected(path)) { + item.setSelected(!item.isSelected()); + } + List<Item> children = item.getChildren(); + for (Item aChildren : children) { + scan(model, aChildren); + } + } + }); + } + + public void setItem(Item items) { + List<Item> newItems = new ArrayList<Item>(); + newItems.add(items); + setItems(newItems); + } + + public void setItems(List<Item> items) { + // Create model + JAXXTreeModel model = new JAXXTreeModel(items); + if (model.getRoot() != null) { + setRootVisible(model.getRoot() != SYNTHETIC); + } + // Atach model + setModel(model); + + // Appli selected items + if (items != null){ + List<TreePath> treePathSelected = new ArrayList<TreePath>(); + for (Item i : items){ + if (i.isSelected()){ + treePathSelected.add(model.getTreePath(i)); + } + } + this.setSelectionPaths(convertToTreePathArray(treePathSelected.toArray())); + } + } + + public Object getSelectionValue() { + TreePath selectionPath = getSelectionPath(); + return selectionPath != null ? selectionPath.getLastPathComponent() : null; + } + + public Item getRootItem(){ + if (getModel() instanceof JAXXTreeModel){ + return ((JAXXTreeModel)getModel()).getRootItem(); + } + return null; + } + + protected TreePath[] convertToTreePathArray(Object[] datas){ + TreePath[] params = new TreePath[datas.length]; + System.arraycopy(datas, 0, params, 0, datas.length); + return params; + } +} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Spacer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Spacer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfo.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Table.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Table.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBoxLayout.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java similarity index 55% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java index addfb6f..e5de31d 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java @@ -1,8 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package jaxx.runtime.swing.navigation; import java.awt.CardLayout; @@ -15,38 +10,37 @@ import org.apache.commons.logging.LogFactory; /** * * @author letellier + * @since 1.7.2 */ -public class ItemNavigationCardPanel extends JPanel{ +public class ItemNavigationCardPanel extends JPanel { /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(ItemNavigationCardPanel.class); - private static final long serialVersionUID = 1L; - CardLayout layout; - public ItemNavigationCardPanel(){ + + public ItemNavigationCardPanel() { super(); layout = new CardLayout(); setLayout(layout); } - public void showItem(Item i){ - if (i != null && i.getValue() != null){ - if (i.getValue() instanceof Class){ + public void showItem(Item i) { + if (i != null && i.getValue() != null) { + if (i.getValue() instanceof Class<?>) { layout.show(this, i.getValue().getClass().getName()); - } - else { + } else { layout.show(this, i.getValue().getClass().getName()); } } } - public Component getShowedComponent(){ + public Component getShowedComponent() { Component[] components = getComponents(); - if (components != null){ - for (Component c : components){ - if (c.isVisible()){ + if (components != null) { + for (Component c : components) { + if (c.isVisible()) { return c; } } @@ -56,11 +50,10 @@ public class ItemNavigationCardPanel extends JPanel{ @Override public Component add(Component comp) { - if (!(comp instanceof ItemNavigationPanel)){ - throw new IllegalArgumentException("ItemNavigationCardPanel must be have only ItemNavigationPanel children"); + if (!(comp instanceof ItemNavigationPanel)) { + throw new IllegalArgumentException("ItemNavigationCardPanel must be have only ItemNavigationPanel children"); } - super.add(comp, ((ItemNavigationPanel)comp).getAssociatedClass().getName()); - return comp; + super.add(comp, ((ItemNavigationPanel) comp).getAssociatedClass().getName()); + return comp; } - } diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/package.html b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/package.html rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java index f3df692..dcb93ca 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java @@ -1,6 +1,5 @@ package jaxx.runtime.validator; -import jaxx.runtime.BeanValidatorUtil; import java.beans.EventSetDescriptor; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java similarity index 78% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java index 19d2069..7e212d2 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java @@ -17,7 +17,7 @@ public class BeanValidatorEvent extends java.util.EventObject { String[] messagestoAdd; String[] messagestoDelete; - public BeanValidatorEvent(BeanValidator source, BeanValidatorField<?> field, BeanValidatorScope scope, String[] toAdd, String[] toDelete) { + public BeanValidatorEvent(BeanValidator<?> source, BeanValidatorField<?> field, BeanValidatorScope scope, String[] toAdd, String[] toDelete) { super(source); this.field = field; this.scope = scope; @@ -26,8 +26,8 @@ public class BeanValidatorEvent extends java.util.EventObject { } @Override - public BeanValidator getSource() { - return (BeanValidator) super.getSource(); + public BeanValidator<?> getSource() { + return (BeanValidator<?>) super.getSource(); } public String getFieldName() { @@ -46,7 +46,7 @@ public class BeanValidatorEvent extends java.util.EventObject { return scope; } - public BeanValidatorField getField() { + public BeanValidatorField<?> getField() { return field; } } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java similarity index 98% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java index 7277ab2..f4ab4c6 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java @@ -192,11 +192,11 @@ public class BeanValidatorField<B> { if (this == o) { return true; } - if (!(o instanceof BeanValidatorField)) { + if (!(o instanceof BeanValidatorField<?>)) { return false; } - BeanValidatorField that = (BeanValidatorField) o; + BeanValidatorField<?> that = (BeanValidatorField<?>) o; return beanClass.equals(that.beanClass) && name.equals(that.name); } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java similarity index 80% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java index 6435c8a..34f3373 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java @@ -8,16 +8,16 @@ package jaxx.runtime.validator; * @author chemit * @since 1.3 */ -public class BeanValidatorMessage<E extends BeanValidatorMessage> implements Comparable<E> { +public class BeanValidatorMessage<E extends BeanValidatorMessage<?>> implements Comparable<E> { /** * the validator that produce the message */ - protected BeanValidator validator; + protected BeanValidator<?> validator; /** * the field thatproduce the message */ - protected BeanValidatorField field; + protected BeanValidatorField<?> field; /** * the label of the message (to be displayed somewhere) */ @@ -27,18 +27,18 @@ public class BeanValidatorMessage<E extends BeanValidatorMessage> implements Com */ protected BeanValidatorScope scope; - public BeanValidatorMessage(BeanValidator validator, BeanValidatorField field, String message, BeanValidatorScope scope) { + public BeanValidatorMessage(BeanValidator<?> validator, BeanValidatorField<?> field, String message, BeanValidatorScope scope) { this.field = field; this.validator = validator; this.message = message; this.scope = scope; } - public BeanValidator getValidator() { + public BeanValidator<?> getValidator() { return validator; } - public BeanValidatorField getField() { + public BeanValidatorField<?> getField() { return field; } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java index a819d04..aa4d9b6 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java @@ -1,4 +1,4 @@ -package jaxx.runtime; +package jaxx.runtime.validator; import jaxx.runtime.*; import com.opensymphony.xwork2.config.Configuration; diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java similarity index 96% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java index 7eced3d..007df28 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import jaxx.runtime.BeanValidatorUtil; /** * @@ -182,10 +181,10 @@ public class XWorkBeanValidator<B> { } if (validationContext.hasFieldErrors()) { - Map messages = validationContext.getFieldErrors(); + Map<?,?> messages = validationContext.getFieldErrors(); result = new HashMap<String, List<String>>(messages.size()); for (Object fieldName : messages.keySet()) { - Collection c = (Collection) messages.get(fieldName); + Collection<?> c = (Collection<?>) messages.get(fieldName); List<String> mm = new java.util.ArrayList<String>(c.size()); for (Object message : c) { mm.add(message + ""); @@ -225,7 +224,7 @@ public class XWorkBeanValidator<B> { int skip = 0; if (contextName != null && !includeDefaultContext) { // count the number of validator to skip - for (Validator v : validator.getValidators(beanClass, null)) { + for (Validator<?> v : validator.getValidators(beanClass, null)) { // we only work on FieldValidator at the moment if (v instanceof FieldValidator) { skip++; @@ -233,7 +232,7 @@ public class XWorkBeanValidator<B> { } } - for (Validator v : validator.getValidators(beanClass, contextName)) { + for (Validator<?> v : validator.getValidators(beanClass, contextName)) { // we only work on FieldValidator at the moment if (v instanceof FieldValidator) { if (skip > 0) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java index ee2e4a7..d37aa1d 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class ExistingDirectoryFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java index 72219b0..b7ef20a 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class ExistingFileFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java index 6bf973a..23f5f03 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class RequiredFileFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java similarity index 99% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java index a01110f..72c1f77 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java @@ -253,7 +253,7 @@ public class SwingValidator<B> extends BeanValidator<B> { if (old != null) { // suppression du jxlayer sous l'ancien composant Container container = old.getParent(); - if (container instanceof JXLayer) { + if (container instanceof JXLayer<?>) { JXLayer<?> jx = (JXLayer<?>) container; Object ui = jx.getUI(); if (ui != null && ui instanceof AbstractBeanValidatorUI) { @@ -266,7 +266,7 @@ public class SwingValidator<B> extends BeanValidator<B> { if (c != null) { // ajout du jxlayer sous ce composant Container container = c.getParent(); - if (container instanceof JXLayer) { + if (container instanceof JXLayer<?>) { Constructor<? extends AbstractBeanValidatorUI> cons = uiClass.getConstructor(BeanValidatorField.class); AbstractBeanValidatorUI ui = cons.newInstance(field); ui.setEnabled(true); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java similarity index 84% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java index cbb63c3..286a4d7 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java @@ -20,13 +20,13 @@ public class SwingValidatorMessage extends BeanValidatorMessage<SwingValidatorMe protected JComponent editor; protected String fieldName; - public SwingValidatorMessage(SwingValidator validator, BeanValidatorField field, String message, BeanValidatorScope scope, JComponent editor) { + public SwingValidatorMessage(SwingValidator<?> validator, BeanValidatorField<?> field, String message, BeanValidatorScope scope, JComponent editor) { super(validator, field, message, scope); this.fieldName = field.getName(); this.editor = editor; } - public SwingValidatorMessage(SwingValidator validator, String fieldName, String message, BeanValidatorScope scope, JComponent editor) { + public SwingValidatorMessage(SwingValidator<?> validator, String fieldName, String message, BeanValidatorScope scope, JComponent editor) { super(validator, null, message, scope); this.fieldName = fieldName; this.editor = editor; diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java similarity index 91% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java index a01ecf9..07d2d60 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java @@ -67,7 +67,7 @@ public class SwingValidatorMessageListModel public void onFieldChanged(BeanValidatorEvent event) { String[] toDelete = event.getMessagesToDelete(); String[] toAdd = event.getMessagesToAdd(); - BeanValidatorField field = event.getField(); + BeanValidatorField<?> field = event.getField(); BeanValidatorScope scope = event.getScope(); boolean mustAdd = toAdd != null && toAdd.length > 0; boolean mustDel = toDelete != null && toDelete.length > 0; @@ -78,7 +78,7 @@ public class SwingValidatorMessageListModel log.trace(field + " - (" + getSize() + ") toDelete " + mustDel); } - SwingValidator validator = (SwingValidator) event.getSource(); + SwingValidator<?> validator = (SwingValidator<?>) event.getSource(); if (mustDel) { @@ -99,7 +99,7 @@ public class SwingValidatorMessageListModel } } - protected void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator.getFieldRepresentation(field.getName()); // add new errors @@ -121,7 +121,7 @@ public class SwingValidatorMessageListModel } } - protected void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java index df6fcbd..5514f6e 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java @@ -6,7 +6,6 @@ import javax.swing.JList; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import jaxx.runtime.validator.BeanValidatorScope; -import jaxx.runtime.SwingValidatorUtil; import static org.nuiton.i18n.I18n._; /** diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java similarity index 90% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java index 400adab..3821695 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java @@ -54,7 +54,7 @@ public class SwingValidatorMessageTableModel validator.addBeanValidatorListener(this); } - public void addMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, String... messages) { + public void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages) { addMessages(validator, fieldName, scope, true, messages); } @@ -62,7 +62,7 @@ public class SwingValidatorMessageTableModel addMessages(editor, fieldName, scope, true, messages); } - public void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, String... messages) { + public void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages) { addMessages(validator, field, scope, true, messages); } @@ -81,7 +81,7 @@ public class SwingValidatorMessageTableModel } } - public void removeMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, String... messages) { + public void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages) { removeMessages(validator, fieldName, scope, true, messages); } @@ -89,7 +89,7 @@ public class SwingValidatorMessageTableModel removeMessages(editor, fieldName, scope, true); } - public void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, String... messages) { + public void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages) { removeMessages(validator, field, scope, true, messages); } @@ -134,7 +134,7 @@ public class SwingValidatorMessageTableModel public void onFieldChanged(BeanValidatorEvent event) { String[] toDelete = event.getMessagesToDelete(); String[] toAdd = event.getMessagesToAdd(); - BeanValidatorField field = event.getField(); + BeanValidatorField<?> field = event.getField(); BeanValidatorScope scope = event.getScope(); boolean mustAdd = toAdd != null && toAdd.length > 0; boolean mustDel = toDelete != null && toDelete.length > 0; @@ -145,7 +145,7 @@ public class SwingValidatorMessageTableModel log.trace(field + " - (" + getRowCount() + ") toDelete " + mustDel); } - SwingValidator validator = (SwingValidator) event.getSource(); + SwingValidator<?> validator = (SwingValidator<?>) event.getSource(); if (mustDel) { @@ -205,7 +205,7 @@ public class SwingValidatorMessageTableModel } } - protected void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator == null ? null : validator.getFieldRepresentation(field.getName()); // add new errors @@ -227,7 +227,7 @@ public class SwingValidatorMessageTableModel } } - protected void addMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator == null ? null : validator.getFieldRepresentation(fieldName); // add new errors @@ -270,7 +270,7 @@ public class SwingValidatorMessageTableModel } } - protected void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); @@ -289,7 +289,7 @@ public class SwingValidatorMessageTableModel } } - protected void removeMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java index d4e83bc..e770f42 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java @@ -6,7 +6,6 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.awt.Component; import jaxx.runtime.validator.BeanValidatorScope; -import jaxx.runtime.SwingValidatorUtil; import static org.nuiton.i18n.I18n._; /** diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java index bcb068e..fa7b4cd 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java @@ -1,7 +1,7 @@ -package jaxx.runtime; +package jaxx.runtime.validator.swing; import jaxx.runtime.*; -import jaxx.runtime.validator.BeanValidatorScope; +import jaxx.runtime.validator.BeanValidatorUtil; import jaxx.runtime.validator.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -61,6 +61,7 @@ public class SwingValidatorUtil extends BeanValidatorUtil { * Prepare the ui where to display the validators messages. * * @param errorTable the table where to display validators messages + * @param render renderer to use */ public static void installUI(JTable errorTable, SwingValidatorMessageTableRenderer render) { errorTable.setDefaultRenderer(Object.class, render); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java similarity index 90% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java index 38eb670..b8c0af9 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java @@ -17,9 +17,9 @@ public abstract class AbstractBeanValidatorUI extends AbstractLayerUI<javax.swin /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(AbstractBeanValidatorUI.class); /** the field to render */ - protected BeanValidatorField field; + protected BeanValidatorField<?> field; - public AbstractBeanValidatorUI(BeanValidatorField field) { + public AbstractBeanValidatorUI(BeanValidatorField<?> field) { this.field = field; if (log.isDebugEnabled()) { log.debug("install " + this + "<field:" + field + ">"); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java index 1e192ce..a4045b6 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java @@ -19,7 +19,7 @@ public class IconValidationUI extends AbstractBeanValidatorUI { protected static BufferedImage warningIcon; protected static BufferedImage infoIcon; - public IconValidationUI(BeanValidatorField field) { + public IconValidationUI(BeanValidatorField<?> field) { super(field); if (errorIcon == null) { errorIcon = prepareIcon(Color.RED); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java index 868e09e..adc7fb9 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java @@ -18,7 +18,7 @@ public class ImageValidationUI extends AbstractBeanValidatorUI { protected static BufferedImage warningIcon; protected static BufferedImage infoIcon; - public ImageValidationUI(BeanValidatorField field) { + public ImageValidationUI(BeanValidatorField<?> field) { super(field); if (errorIcon == null) { errorIcon = prepareIcon(jaxx.runtime.Util.createImageIcon("error.png")); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java similarity index 96% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java index ef21595..5057054 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java @@ -18,7 +18,7 @@ public class TranslucentValidationUI extends AbstractBeanValidatorUI { protected Color warningHightlight; protected Color infoHightlight; - public TranslucentValidationUI(BeanValidatorField field) { + public TranslucentValidationUI(BeanValidatorField<?> field) { super(field); errorHightlight = Color.RED; warningHightlight = Color.YELLOW; diff --git a/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties new file mode 100644 index 0000000..02a7317 --- /dev/null +++ b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties @@ -0,0 +1,12 @@ +validator.field.header=Field +validator.field.header.tip=The field involved +validator.field.tip=Property '%1$s' +validator.message.header=Message +validator.message.header.tip=Message +validator.message.tip=Message \: %1$s +validator.scope.error.label=Error +validator.scope.header=... +validator.scope.header.tip=Severity of the message +validator.scope.info.label=Information +validator.scope.tip=Message scope \: '%1$s' +validator.scope.warning.label=Warning diff --git a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties similarity index 76% rename from jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties rename to jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties index 77a14d0..8df2e5e 100644 --- a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties +++ b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties @@ -4,6 +4,9 @@ validator.field.tip=Propri\u00E9t\u00E9 '%1$s' validator.message.header=Message validator.message.header.tip=Le texte du message validator.message.tip=Message \: %1$s +validator.scope.error.label=Erreur validator.scope.header=... validator.scope.header.tip=Le de type de message +validator.scope.info.label=Information validator.scope.tip=Type de message \: '%1$s' +validator.scope.warning.label=Avertissement diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-delete.png b/jaxx-runtime/src/main/resources/icons/action-delete.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-delete.png rename to jaxx-runtime/src/main/resources/icons/action-delete.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-config-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-config-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-config-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-config-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-config.png b/jaxx-runtime/src/main/resources/icons/action-wizard-config.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-config.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-config.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-message-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-message-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-message-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-message-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-message.png b/jaxx-runtime/src/main/resources/icons/action-wizard-message.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-message.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-message.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-next-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-next-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-next-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-next-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-next.png b/jaxx-runtime/src/main/resources/icons/action-wizard-next.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-next.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-next.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-pause-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-pause-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause.png b/jaxx-runtime/src/main/resources/icons/action-wizard-pause.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-pause.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-previous-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-previous-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous.png b/jaxx-runtime/src/main/resources/icons/action-wizard-previous.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-previous.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-refresh-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-refresh-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh.png b/jaxx-runtime/src/main/resources/icons/action-wizard-refresh.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-refresh.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-start-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-start-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-start-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-start-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-start.png b/jaxx-runtime/src/main/resources/icons/action-wizard-start.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-start.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-start.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-failed-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-failed-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-failed.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-failed.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-pending-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-pending-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-pending.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-pending.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-running-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-running-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-running.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-running.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-successed-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-successed-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-successed.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-successed.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/error.png b/jaxx-runtime/src/main/resources/icons/error.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/error.png rename to jaxx-runtime/src/main/resources/icons/error.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/info.png b/jaxx-runtime/src/main/resources/icons/info.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/info.png rename to jaxx-runtime/src/main/resources/icons/info.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/warning.png b/jaxx-runtime/src/main/resources/icons/warning.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/warning.png rename to jaxx-runtime/src/main/resources/icons/warning.png diff --git a/jaxx-runtime-api/src/main/resources/validators.xml b/jaxx-runtime/src/main/resources/validators.xml similarity index 100% rename from jaxx-runtime-api/src/main/resources/validators.xml rename to jaxx-runtime/src/main/resources/validators.xml diff --git a/jaxx-runtime-api/src/site/site.xml b/jaxx-runtime/src/site/site.xml similarity index 100% rename from jaxx-runtime-api/src/site/site.xml rename to jaxx-runtime/src/site/site.xml diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/UtilTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/UtilTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/SimpleBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/SimpleBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/log4j.properties b/jaxx-runtime/src/test/resources/log4j.properties similarity index 91% rename from jaxx-runtime-api/src/test/resources/log4j.properties rename to jaxx-runtime/src/test/resources/log4j.properties index 8459ad0..7ff6dff 100644 --- a/jaxx-runtime-api/src/test/resources/log4j.properties +++ b/jaxx-runtime/src/test/resources/log4j.properties @@ -5,4 +5,4 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n -log4j.logger.jaxx=DEBUG +log4j.logger.jaxx=INFO diff --git a/jaxx-runtime-api/src/test/resources/validators.xml b/jaxx-runtime/src/test/resources/validators.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/validators.xml rename to jaxx-runtime/src/test/resources/validators.xml diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index 5f88aab..d304bb2 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -21,7 +21,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> @@ -42,8 +42,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx lutin library swing extension (tabs and actions)</description> + <name>JAXX Action</name> + <description>JAXX Action framework</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-runtime-api/LICENSE.txt b/jaxx-widgets/LICENSE.txt similarity index 100% rename from jaxx-runtime-api/LICENSE.txt rename to jaxx-widgets/LICENSE.txt diff --git a/jaxx-runtime-api/README.txt b/jaxx-widgets/README.txt similarity index 100% rename from jaxx-runtime-api/README.txt rename to jaxx-widgets/README.txt diff --git a/jaxx-runtime-swing-widget/changelog.txt b/jaxx-widgets/changelog.txt similarity index 100% rename from jaxx-runtime-swing-widget/changelog.txt rename to jaxx-widgets/changelog.txt diff --git a/jaxx-runtime-swing-widget/pom.xml b/jaxx-widgets/pom.xml similarity index 87% rename from jaxx-runtime-swing-widget/pom.xml rename to jaxx-widgets/pom.xml index 2b4e92c..2acd569 100644 --- a/jaxx-runtime-swing-widget/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,11 +10,11 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <dependencies> @@ -22,7 +22,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> @@ -47,8 +47,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx runtime swing widgets</description> + <name>JAXX Widgets</name> + <description>Collection of swing widgets wrote with JAXX</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -97,13 +97,9 @@ <groupId>org.nuiton.i18n</groupId> <artifactId>maven-i18n-plugin</artifactId> <configuration> - <silent>true</silent> <entries> <entry> - <basedir>${maven.gen.dir}/java/</basedir> - <includes> - <param>**\/**.java</param> - </includes> + <basedir>${maven.gen.dir}/java</basedir> </entry> </entries> </configuration> diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx similarity index 97% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx index f2cf273..47b2496 100644 --- a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx @@ -76,6 +76,7 @@ <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.decorator.JXPathDecorator; public static final String DEFAULT_POPUP_LABEL = n_("entitycombobox.popup.label"); @@ -83,7 +84,7 @@ public static final String DEFAULT_SELECTED_TOOLTIP = n_("entitycombobox.sort.on public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("entitycombobox.sort.off"); -public <O> void init(jaxx.runtime.JXPathDecorator<O> decorator, java.util.List<O> data) { +public <O> void init(JXPathDecorator<O> decorator, java.util.List<O> data) { handler.init(decorator, data); } diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java similarity index 96% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java index fcd3218..6c63f28 100644 --- a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java @@ -19,9 +19,6 @@ package jaxx.runtime.swing; import java.awt.Component; -import jaxx.runtime.JXPathDecorator; -import jaxx.runtime.MultiJXPathDecorator; -import jaxx.runtime.Util; import jaxx.runtime.SwingUtil; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; @@ -46,7 +43,11 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.List; import javax.swing.JComboBox; -import jaxx.runtime.Decorator; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.JXPathDecorator; +import jaxx.runtime.decorator.MultiJXPathDecorator; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.decorator.DecoratorUtils; import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener; /** @@ -119,12 +120,12 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { // should clone decorator ? d = (MultiJXPathDecorator<O>) decorator; } else { - d = MultiJXPathDecorator.newDecorator(decorator.getInternalClass(), decorator.getInitialExpression(), " - "); + d = DecoratorUtils.newMultiJXPathDecorator(decorator.getInternalClass(), decorator.getInitialExpression(), " - "); } this.decorator = d; // init combobox renderer base on given decorator - ui.getCombobox().setRenderer(Util.newDecoratedListCellRenderer(d)); + ui.getCombobox().setRenderer(new DecoratorListCellRenderer(d)); this.convertor = newDecoratedObjectToStringConverter(d); @@ -233,7 +234,7 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { try { // Sort data with the decorator jxpath tokens. - JXPathDecorator.sort(decorator, ui.getData(), newValue); + DecoratorUtils.sort(decorator, ui.getData(), newValue); } catch (Exception e) { log.warn(e.getMessage(), e); //System.out.println("newValue :: "+decorator+" : "+newValue); diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java diff --git a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties similarity index 98% rename from jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties rename to jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties index 27e055b..5430ac8 100644 --- a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties @@ -2,8 +2,7 @@ aboutframe.about=About aboutframe.license=License aboutframe.ok=OK aboutframe.thirdparty=Third party -columnselection.action.tip= -columnselector.action.tip= +columnselector.action.tip=Select the columns config.action.quit=Quit config.action.quit.tip=Quit the configuration editor config.action.reset=Cancel diff --git a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties similarity index 98% rename from jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties rename to jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties index 533b545..4cc23a4 100644 --- a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties @@ -2,8 +2,7 @@ aboutframe.about=\u00C0 propos aboutframe.license=Licence aboutframe.ok=OK aboutframe.thirdparty=Tierce partie -columnselection.action.tip= -columnselector.action.tip= +columnselector.action.tip=S\u00E9lectionner les colonnes config.action.quit=Quitter config.action.quit.tip=Quitter l'\u00E9diteur de configuration config.action.reset=Annuler diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png b/jaxx-widgets/src/main/resources/icons/action-config-quit.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png rename to jaxx-widgets/src/main/resources/icons/action-config-quit.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png b/jaxx-widgets/src/main/resources/icons/action-config-reset.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png rename to jaxx-widgets/src/main/resources/icons/action-config-reset.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png b/jaxx-widgets/src/main/resources/icons/action-config-save.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png rename to jaxx-widgets/src/main/resources/icons/action-config-save.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-be.png b/jaxx-widgets/src/main/resources/icons/action-i18n-be.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-be.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-be.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ca.png b/jaxx-widgets/src/main/resources/icons/action-i18n-ca.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ca.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-ca.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ch.png b/jaxx-widgets/src/main/resources/icons/action-i18n-ch.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ch.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-ch.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-de.png b/jaxx-widgets/src/main/resources/icons/action-i18n-de.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-de.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-de.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-dk.png b/jaxx-widgets/src/main/resources/icons/action-i18n-dk.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-dk.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-dk.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-es.png b/jaxx-widgets/src/main/resources/icons/action-i18n-es.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-es.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-es.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fi.png b/jaxx-widgets/src/main/resources/icons/action-i18n-fi.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fi.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-fi.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fr.png b/jaxx-widgets/src/main/resources/icons/action-i18n-fr.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fr.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-fr.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-gb.png b/jaxx-widgets/src/main/resources/icons/action-i18n-gb.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-gb.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-gb.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-it.png b/jaxx-widgets/src/main/resources/icons/action-i18n-it.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-it.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-it.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-nl.png b/jaxx-widgets/src/main/resources/icons/action-i18n-nl.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-nl.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-nl.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-no.png b/jaxx-widgets/src/main/resources/icons/action-i18n-no.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-no.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-no.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-se.png b/jaxx-widgets/src/main/resources/icons/action-i18n-se.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-se.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-se.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-us.png b/jaxx-widgets/src/main/resources/icons/action-i18n-us.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-us.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-us.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-calculator.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-calculator.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-calculator.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-calculator.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-reset.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-reset.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-reset.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-reset.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-validate.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-validate.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-validate.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-validate.png diff --git a/jaxx-example/src/site/rst/images/Components-screenshot.gif b/jaxx-widgets/src/site/rst/images/Components-screenshot.gif similarity index 100% rename from jaxx-example/src/site/rst/images/Components-screenshot.gif rename to jaxx-widgets/src/site/rst/images/Components-screenshot.gif diff --git a/jaxx-example/src/site/rst/images/webstart.gif b/jaxx-widgets/src/site/rst/images/webstart.gif similarity index 100% rename from jaxx-example/src/site/rst/images/webstart.gif rename to jaxx-widgets/src/site/rst/images/webstart.gif diff --git a/jaxx-example/src/site/rst/index.rst b/jaxx-widgets/src/site/rst/index.rst similarity index 100% rename from jaxx-example/src/site/rst/index.rst rename to jaxx-widgets/src/site/rst/index.rst diff --git a/jaxx-runtime-swing-widget/src/site/site.xml b/jaxx-widgets/src/site/site.xml similarity index 100% rename from jaxx-runtime-swing-widget/src/site/site.xml rename to jaxx-widgets/src/site/site.xml diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index d4b7be2..36922fd 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,6 +22,12 @@ <dependency> <groupId>${project.groupId}</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>jaxx-compiler</artifactId> <version>${project.version}</version> </dependency> @@ -108,10 +114,9 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> + <name>JAXX Maven plugin</name> <description> - Maven 2 plugin to generate java source from ui interface definitions - in jaxx format. + Maven 2 plugin to generate java sources from JAXX files. </description> <!-- ************************************************************* --> @@ -135,6 +140,188 @@ </plugin> </plugins> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${javadoc.version}</version> + <configuration> + <taglets> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + </taglets> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> </build> <reporting> @@ -142,6 +329,175 @@ <plugin> <artifactId>maven-plugin-plugin</artifactId> </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${javadoc.version}</version> + <configuration> + <taglets> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + </taglets> + </configuration> + </plugin> </plugins> </reporting> diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index 2b7690d..9669d8b 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -124,46 +124,6 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { protected boolean checkPackaging() { return project != null && !"pom".equals(project.getPackaging()) && !"site".equals(project.getPackaging()); } -// @Override -// public void execute() throws MojoExecutionException, MojoFailureException { -// -// try { -// init(); -// } catch (Exception e) { -// if (e instanceof MojoFailureException) { -// throw (MojoFailureException) e; -// } -// if (e instanceof MojoExecutionException) { -// throw (MojoExecutionException) e; -// } -// throw new MojoExecutionException("error in init : " + e.getMessage(), e); -// } -// -// if (skip) { -// if (verbose) { -// getLog().info("jaxx - skip!"); -// } -// return; -// } -// -// try { -// -// doAction(); -// -// } catch (Exception e) { -// //getLog().error(e); -// Throwable e2 = e; -// while (e2.getCause() != null) { -// e2 = e.getCause(); -// } -// getLog().error(e2); -// -// throw new MojoExecutionException(e2.getMessage(), e2); -// } finally { -// System.gc(); -// } -// -// } @Override public MavenProject getProject() { diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java index 4800041..7bfd8aa 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java @@ -182,9 +182,9 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { */ protected String jaxxContextImplementorClass; /** - * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(String[])}. + * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(java.lang.String[])}. * <p/> - * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(String[])} + * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String[])} * <p/> * and then will be use by {@link jaxx.tags.swing.SwingInitializer#initialize()}. * <p/> @@ -215,7 +215,8 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { * If not given, will use the one defined in validator * * @parameter expression="${jaxx.defaultErrorUIFQN}" - * @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS + * + * @see jaxx.runtime.validator.swing.SwingValidator */ protected String defaultErrorUIFQN; /** @@ -284,13 +285,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { if (skip) { return true; } -// -// if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) { -// // nothing to be done for this type of packaging -// skip = true; -// getLog().info("skip generate goal for packaging " + project.getPackaging()); -// return true; -// } if (generateHelp) { // check there is some bundle @@ -475,14 +469,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { return result; } - //TODO use the AbstractPublig method protected void fixCompileSourceRoots() { -// //fixme should remove this silly test when we will make real maven plugin tests :) -// if (project != null) { -// if (!project.getCompileSourceRoots().contains(outJava.getPath())) { -// project.addCompileSourceRoot(outJava.getPath()); -// } -// } if (project == null) { // no project defined, can not fix anything // this case could appears if we wanted to do some tests of the plugin @@ -525,13 +512,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { getLog().warn("??? : " + e.getMessage(), e); } } - - //fixme should remove this silly test when we will make real maven plugin tests :) - if (getPluginContext() != null) { - for (Object e : getPluginContext().keySet()) { - getLog().info("pluginContext " + e + " : " + getPluginContext().get(e)); - } - } } protected void checkJaxxContextImplementorClass() { diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx index 7a3d535..ee118a6 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx @@ -1,3 +1,3 @@ -<JComboBox> +<JAXXComboBox> <item value='Working' selected='true'/> -</JComboBox> \ No newline at end of file +</JAXXComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx index e522ac0..e42d431 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx @@ -1,3 +1,3 @@ -<JComboBox> +<JAXXComboBox> <item value='Failed!'/> -</JComboBox> \ No newline at end of file +</JAXXComboBox> \ No newline at end of file diff --git a/pom.xml b/pom.xml index f8e3aad..e35291c 100644 --- a/pom.xml +++ b/pom.xml @@ -14,18 +14,17 @@ </parent> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> <modules> - <module>jaxx-runtime-api</module> - <module>jaxx-runtime-swing</module> + <module>jaxx-runtime</module> <module>jaxx-compiler</module> <module>jaxx-swing-action</module> <module>maven-jaxx-plugin</module> - <module>jaxx-runtime-swing-widget</module> + <module>jaxx-widgets</module> <!-- deprecated since 1.7.2, will be removed before 2.0.0 <module>jaxx-example</module--> @@ -256,7 +255,7 @@ <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> - <version>1.2.9</version> + <version>1.2.14</version> </dependency> <dependency> @@ -308,8 +307,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx library parent pom</description> + <name>JAXX Project</name> + <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> <url>http://maven-site.nuiton.org/jaxx</url> @@ -325,7 +324,7 @@ <projectId>jaxx</projectId> <lutinutil.version>1.1.0</lutinutil.version> - <i18n.version>1.0.1-SNAPSHOT</i18n.version> + <i18n.version>1.0.2-SNAPSHOT</i18n.version> <jxlayer.version>3.0.3</jxlayer.version> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.