branch develop updated (1701747 -> 127f507)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git from 1701747 [iso] update libraries new 127f507 Clean code The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 127f5074c3d34828ac7617e6a23fcdd3dc52b725 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sat Dec 31 17:19:13 2016 +0100 Clean code Summary of changes: jaxx-compiler/pom.xml | 5 +- .../java/org/nuiton/jaxx/compiler/ClassMap.java | 4 +- .../org/nuiton/jaxx/compiler/CompiledObject.java | 12 +- .../compiler/DefaultCompilerConfiguration.java | 8 +- .../org/nuiton/jaxx/compiler/EventHandler.java | 4 +- .../java/org/nuiton/jaxx/compiler/I18nHelper.java | 4 +- .../java/org/nuiton/jaxx/compiler/IDHelper.java | 6 +- .../org/nuiton/jaxx/compiler/JAXXCompiler.java | 203 +++----- .../java/org/nuiton/jaxx/compiler/JAXXEngine.java | 12 +- .../java/org/nuiton/jaxx/compiler/JAXXFactory.java | 4 +- .../java/org/nuiton/jaxx/compiler/JAXXProfile.java | 6 +- .../nuiton/jaxx/compiler/binding/DataBinding.java | 8 +- .../jaxx/compiler/binding/DataBindingHelper.java | 8 +- .../nuiton/jaxx/compiler/binding/DataSource.java | 20 +- .../jaxx/compiler/binding/JavaParserUtil.java | 32 +- .../compiler/binding/PseudoClassDataBinding.java | 8 +- .../binding/writers/DefaultJAXXBindingWriter.java | 30 +- .../nuiton/jaxx/compiler/css/StylesheetHelper.java | 67 ++- .../jaxx/compiler/css/parser/SimpleCharStream.java | 4 +- .../jaxx/compiler/css/parser/TokenMgrError.java | 8 +- .../decorators/BoxedCompiledObjectDecorator.java | 2 +- .../decorators/DefaultCompiledObjectDecorator.java | 24 +- .../HelpRootCompiledObjectDecorator.java | 36 +- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 4 +- .../jaxx/compiler/finalizers/SwingFinalizer.java | 8 +- .../compiler/finalizers/ValidatorFinalizer.java | 52 +-- .../org/nuiton/jaxx/compiler/java/JavaField.java | 16 +- .../org/nuiton/jaxx/compiler/java/JavaFile.java | 67 +-- .../jaxx/compiler/java/JavaFileGenerator.java | 6 +- .../org/nuiton/jaxx/compiler/java/JavaMethod.java | 24 +- .../jaxx/compiler/java/parser/JavaCharStream.java | 12 +- .../jaxx/compiler/java/parser/JavaParser.java | 14 +- .../jaxx/compiler/java/parser/TokenMgrError.java | 8 +- .../jaxx/compiler/reflect/ClassDescriptor.java | 10 +- .../compiler/reflect/ClassDescriptorHelper.java | 24 +- .../ClassDescriptorResolverFromJavaClass.java | 4 +- .../ClassDescriptorResolverFromJavaFile.java | 19 +- .../ClassDescriptorResolverFromJaxxFile.java | 16 +- .../nuiton/jaxx/compiler/script/ScriptManager.java | 22 +- .../jaxx/compiler/spi/DefaultInitializer.java | 2 +- .../compiler/tags/DefaultComponentHandler.java | 26 +- .../jaxx/compiler/tags/DefaultObjectHandler.java | 68 ++- .../nuiton/jaxx/compiler/tags/ImportHandler.java | 9 +- .../nuiton/jaxx/compiler/tags/ScriptHandler.java | 8 +- .../nuiton/jaxx/compiler/tags/StyleHandler.java | 2 +- .../org/nuiton/jaxx/compiler/tags/TagManager.java | 56 +-- .../compiler/tags/swing/ApplicationHandler.java | 4 +- .../compiler/tags/swing/JRadioButtonHandler.java | 2 +- .../compiler/tags/swing/JScrollPaneHandler.java | 4 +- .../jaxx/compiler/tags/swing/JSpinnerHandler.java | 8 +- .../compiler/tags/swing/JSplitPaneHandler.java | 4 +- .../compiler/tags/swing/JTextComponentHandler.java | 4 +- .../jaxx/compiler/tags/swing/JToolBarHandler.java | 2 +- .../jaxx/compiler/tags/swing/JXLayerHandler.java | 4 +- .../jaxx/compiler/tags/swing/TabHandler.java | 2 +- .../jaxx/compiler/tags/swing/TableHandler.java | 2 +- .../tags/validator/BeanValidatorHandler.java | 70 ++- .../validator/ExcludeFieldValidatorHandler.java | 28 +- .../tags/validator/FieldValidatorHandler.java | 14 +- .../jaxx/compiler/tasks/CompileFirstPassTask.java | 4 +- .../jaxx/compiler/tasks/CompileSecondPassTask.java | 6 +- .../nuiton/jaxx/compiler/tasks/FinalizeTask.java | 4 +- .../compiler/tasks/GenerateConstructorsTask.java | 22 +- .../compiler/tasks/GenerateMissingRulesTask.java | 16 +- .../nuiton/jaxx/compiler/tasks/GenerateTask.java | 22 +- .../org/nuiton/jaxx/compiler/tasks/InitTask.java | 4 +- .../nuiton/jaxx/compiler/tasks/ProfileTask.java | 2 +- .../nuiton/jaxx/compiler/tasks/StyleSheetTask.java | 4 +- .../nuiton/jaxx/compiler/tools/PrintTagInfo.java | 2 +- .../compiler/tools/jaxxcapture/JAXXCapture.java | 2 +- .../types/GridBagConstraintsConverter.java | 4 +- .../jaxx/compiler/binding/JavaParserUtilTest.java | 11 +- .../nuiton/jaxx/compiler/java/JavaMethodTest.java | 2 +- .../jaxx/compiler/java/parser/JavaParserTest.java | 10 +- .../jaxx/compiler/reflect/MyAbstractClass.java | 2 +- .../nuiton/jaxx/compiler/reflect/MyChildClass.java | 2 +- .../nuiton/jaxx/compiler/reflect/MyInterface.java | 2 +- .../ClassDescriptorResolverFromJavaFileTest.java | 12 +- .../nuiton/jaxx/compiler/tags/TagManagerTest.java | 8 +- .../jaxx/compiler/types/ColorConverterTest.java | 2 +- jaxx-compiler/src/test/resources/log4j.properties | 1 - jaxx-demo/pom.xml | 11 +- .../nuiton/jaxx/demo/DemoApplicationContext.java | 6 +- .../main/java/org/nuiton/jaxx/demo/DemoConfig.java | 32 +- .../java/org/nuiton/jaxx/demo/DemoHelpBroker.java | 8 +- .../org/nuiton/jaxx/demo/DemoSourcesHandler.java | 11 +- .../java/org/nuiton/jaxx/demo/DemoUIHandler.java | 5 +- .../jaxx/editor/BeanComboBoxDemoHandler.java | 2 +- .../jaxx/editor/BeanDoubleListDemoHandler.java | 8 +- .../editor/BeanFilterableComboBoxDemoHandler.java | 2 +- .../select/FilterableDoubleListDemoHandler.java | 2 +- .../jaxx/demo/component/swing/HidorButtonDemo.jaxx | 8 +- .../jaxx/demo/entities/DemoDataProvider.java | 2 +- .../jaxx/demo/feature/nav/NavDemoHandler.java | 16 +- .../feature/nav/tree/ActorsTreeNodeLoador.java | 4 +- .../feature/nav/tree/MoviesTreeNodeLoador.java | 6 +- .../feature/nav/tree/NavDemoTreeCellRenderer.java | 2 +- .../demo/feature/nav/tree/NavDemoTreeHelper.java | 2 +- .../nav/treetable/ActorsTreeTableNodeLoador.java | 4 +- .../nav/treetable/MoviesTreeTableNodeLoador.java | 6 +- .../nav/treetable/NavDemoTreeTableHelper.java | 4 +- .../nav/treetable/NavDemoTreeTableModel.java | 4 +- .../list/ListBeanValidationDemoHandler.java | 12 +- .../feature/validation/list/PeopleTableModel.java | 2 +- .../nuiton/jaxx/demo/tree/DemoCellRenderer.java | 2 +- .../org/nuiton/jaxx/demo/tree/DemoNodeLoador.java | 4 +- jaxx-demo/src/main/resources/log4j.properties | 1 - .../demo/entities/Identity-error-validation.xml | 80 ++-- .../demo/entities/Identity-info-validation.xml | 80 ++-- .../demo/entities/Identity-warning-validation.xml | 80 ++-- .../jaxx/demo/entities/Model-error-validation.xml | 56 +-- .../jaxx/demo/entities/Model-info-validation.xml | 14 +- .../demo/entities/Model-warning-validation.xml | 24 +- .../jaxx/demo/entities/People-error-validation.xml | 4 +- .../jaxx/demo/entities/People-info-validation.xml | 6 +- .../demo/entities/People-warning-validation.xml | 4 +- jaxx-demo/src/main/resources/validators.xml | 53 ++- .../jaxx/demo/BeanValidatorDetectorTest.java | 4 +- jaxx-maven-plugin/pom.xml | 3 +- .../jaxx/plugin/AbstractGenerateHelpMojo.java | 8 +- .../nuiton/jaxx/plugin/GenerateHelpFilesMojo.java | 15 +- .../nuiton/jaxx/plugin/GenerateHelpIdsMojo.java | 20 +- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 6 +- .../nuiton/jaxx/plugin/GenerateHelpSearchMojo.java | 12 +- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 38 +- .../main/java/org/nuiton/jaxx/plugin/NodeItem.java | 6 +- .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 23 +- .../src/main/resources/defaultContent.html.vm | 6 +- .../src/main/resources/defaultHelpSet.hs.vm | 28 +- .../src/main/resources/defaultI18n.java.vm | 18 +- .../src/main/resources/defaultIndex.xml.vm | 23 +- .../src/main/resources/defaultMap.jhm.vm | 18 +- .../src/main/resources/defaultToc.xml.vm | 23 +- .../src/main/resources/log4j.properties | 1 - .../java/org/nuiton/jaxx/plugin/Bug1124Test.java | 13 +- .../java/org/nuiton/jaxx/plugin/Bug1404Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 7 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 2 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 6 +- .../nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 2 +- .../org/nuiton/jaxx/plugin/DataBindingTest.java | 4 +- .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 6 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 15 +- .../java/org/nuiton/jaxx/plugin/NodeItemTest.java | 4 +- .../compilerTest/classReferences/JavaTaist.java | 2 +- .../validator/ok/Identity.java | 2 +- .../compilerValidatorTest/validator/ok/Model.java | 5 +- .../src/test/resources/log4j.properties | 1 - .../nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml | 48 +- .../org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx | 6 +- .../org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx | 6 +- .../nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx | 2 +- .../nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml | 44 +- .../nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx | 10 +- .../jaxx/plugin/bug1722Test/JButtonDemo.jaxx | 6 +- .../nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml | 46 +- .../nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx | 26 +- .../nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml | 48 +- .../org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml | 42 +- .../org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx | 16 +- .../nuiton/jaxx/plugin/compilerTest/CSSTests.xml | 46 +- .../jaxx/plugin/compilerTest/ClassReferences.xml | 42 +- .../jaxx/plugin/compilerTest/ClientProperty.xml | 44 +- .../ErrorJaxxContextImplementorClass.xml | 44 +- .../org/nuiton/jaxx/plugin/compilerTest/Errors.xml | 52 +-- .../org/nuiton/jaxx/plugin/compilerTest/Force.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/Icon.xml | 48 +- .../nuiton/jaxx/plugin/compilerTest/ImportTag.xml | 40 +- .../jaxx/plugin/compilerTest/Initializers.xml | 42 +- .../jaxx/plugin/compilerTest/InnerClasses.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/NoLog.xml | 44 +- .../plugin/compilerTest/OverridingDataBindings.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/Script.xml | 42 +- .../plugin/compilerTest/SpecialSubclassing.xml | 42 +- .../nuiton/jaxx/plugin/compilerTest/WithLog.xml | 44 +- .../plugin/compilerTest/cSSTests/CSSTests.jaxx | 6 +- .../plugin/compilerTest/cSSTests/GrandChild.jaxx | 16 +- .../compilerTest/cSSTests/Pseudoclasses.jaxx | 44 +- .../plugin/compilerTest/cSSTests/SimpleCSS.jaxx | 6 +- .../classReferences/ClassReferences.jaxx | 4 +- .../classReferences/ConstructorReferenceTest.jaxx | 2 +- .../classReferences/JAXXReferenceTest.jaxx | 2 +- .../compilerTest/classReferences/JAXXTest.jaxx | 2 +- .../classReferences/StaticMethodTest.jaxx | 2 +- .../compilerTest/clientProperty/TestOne.jaxx | 2 +- .../plugin/compilerTest/errors/AmbiguousName.jaxx | 2 +- .../compilerTest/errors/CellOutsideOfRow.jaxx | 8 +- .../plugin/compilerTest/errors/MixedContent.jaxx | 8 +- .../compilerTest/errors/RowOutsideOfTable.jaxx | 8 +- .../plugin/compilerTest/errors/RowWrongChild.jaxx | 2 +- .../compilerTest/errors/StyleParseError.jaxx | 6 +- .../jaxx/plugin/compilerTest/icon/Test1.jaxx | 4 +- .../compilerTest/initializers/Initializers.jaxx | 36 +- .../overridingDataBindings/CurrentTime.jaxx | 12 +- .../OverridingDataBindings.jaxx | 2 +- .../compilerTest/script/JScriptInitializer.jaxx | 30 +- .../compilerValidatorTest/ValidatorErrors.xml | 44 +- .../plugin/compilerValidatorTest/ValidatorOk.xml | 44 +- .../errors/AutoFieldComponentNotFound.jaxx | 7 +- .../validator/errors/DuplicatedBean.jaxx | 2 +- .../validator/errors/DuplicatedBean2.jaxx | 6 +- .../validator/errors/DuplicatedErrorListModel.jaxx | 5 +- .../errors/DuplicatedErrorTableModel.jaxx | 5 +- .../errors/DuplicatedFieldInSameValidator.jaxx | 10 +- .../errors/FieldBeanPropertyNotFound.jaxx | 6 +- .../validator/errors/FieldComponentNotFound.jaxx | 6 +- .../validator/errors/FieldComponentNotFound2.jaxx | 6 +- .../validator/errors/FieldNoName.jaxx | 6 +- .../validator/errors/FieldNoName2.jaxx | 6 +- .../validator/errors/Model.java | 5 +- .../validator/errors/NoBean.jaxx | 2 +- .../validator/errors/UnfoundBean.jaxx | 2 +- .../validator/errors/UnfoundErrorList.jaxx | 2 +- .../validator/errors/UnfoundErrorListModel.jaxx | 2 +- .../validator/errors/UnfoundErrorTable.jaxx | 2 +- .../validator/errors/UnfoundErrorTableModel.jaxx | 2 +- .../validator/errors/UnfoundParentValidator.jaxx | 3 +- .../validator/ok/FieldComponentDuplicated.jaxx | 10 +- .../validator/ok/Validation.jaxx | 520 ++++++++++----------- .../validator/ok/ValidationBeanClass.jaxx | 209 ++++----- .../nuiton/jaxx/plugin/dataBindingTest/First.jaxx | 35 +- .../jaxx/plugin/dataBindingTest/simpleBinding.xml | 42 +- .../jaxx/plugin/decoratorTest/BoxedDecorator.jaxx | 2 +- .../nuiton/jaxx/plugin/decoratorTest/Decorator.xml | 44 +- .../nuiton/jaxx/plugin/evolution74Test/error.xml | 44 +- .../plugin/evolution74Test/error/swingcombo.jaxx | 2 +- .../plugin/evolution74Test/error/swinglist.jaxx | 2 +- .../plugin/evolution74Test/error/swingtree.jaxx | 2 +- .../org/nuiton/jaxx/plugin/evolution74Test/ok.xml | 42 +- .../jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx | 2 +- .../jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx | 2 +- .../jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx | 2 +- .../org/nuiton/jaxx/plugin/i18nTest/I18nText.xml | 44 +- .../org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml | 44 +- .../jaxx/plugin/i18nTest/I18nToolTipText.xml | 44 +- .../jaxx/plugin/i18nTest/title/JTabbedPane.jaxx | 4 +- .../jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx | 6 +- .../plugin/i18nTest/tooltiptext/JTabbedPane.jaxx | 4 +- .../plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx | 4 +- .../plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx | 6 +- .../org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml | 46 +- .../jaxx/plugin/lambdaTest/LambdaHandler.java | 4 +- jaxx-runtime/pom.xml | 55 +-- .../java/org/nuiton/jaxx/runtime/JAXXAction.java | 42 -- .../java/org/nuiton/jaxx/runtime/SwingUtil.java | 21 +- .../awt/visitor/GetCompopentAtPointVisitor.java | 4 +- .../nuiton/jaxx/runtime/bean/BeanTypeAware.java | 2 +- .../jaxx/runtime/binding/DefaultJAXXBinding.java | 4 +- .../nuiton/jaxx/runtime/context/DataContext.java | 430 ----------------- .../runtime/context/DefaultApplicationContext.java | 12 +- .../jaxx/runtime/context/DefaultJAXXContext.java | 10 +- .../jaxx/runtime/context/JAXXContextEntryDef.java | 14 +- .../org/nuiton/jaxx/runtime/css/Pseudoclasses.java | 12 +- .../nuiton/jaxx/runtime/swing/BlockingLayerUI.java | 4 +- .../jaxx/runtime/swing/BlockingLayerUI2.java | 4 +- .../org/nuiton/jaxx/runtime/swing/CardLayout2.java | 6 +- .../nuiton/jaxx/runtime/swing/CardLayout2Ext.java | 2 +- .../nuiton/jaxx/runtime/swing/ComponentMover.java | 4 +- .../jaxx/runtime/swing/ComponentResizer.java | 4 +- .../nuiton/jaxx/runtime/swing/CompoundIcon.java | 55 +-- .../nuiton/jaxx/runtime/swing/JAXXButtonGroup.java | 2 +- .../nuiton/jaxx/runtime/swing/JAXXComboBox.java | 2 +- .../org/nuiton/jaxx/runtime/swing/JAXXList.java | 12 +- .../runtime/swing/application/ActionExecutor.java | 10 +- .../runtime/swing/application/ActionWorker.java | 4 +- .../runtime/swing/editor/BooleanCellEditor.java | 7 +- .../jaxx/runtime/swing/editor/EnumEditor.java | 12 +- .../runtime/swing/editor/KeyStrokeCellEditor.java | 3 +- .../jaxx/runtime/swing/help/JAXXHelpBroker.java | 24 +- .../runtime/swing/list/ActionCheckListModel.java | 264 +++++------ .../nuiton/jaxx/runtime/swing/list/CheckList.java | 188 ++++---- .../jaxx/runtime/swing/list/CheckListAction.java | 50 +- .../jaxx/runtime/swing/list/CheckListEditor.java | 58 +-- .../jaxx/runtime/swing/list/CheckListModel.java | 56 +-- .../jaxx/runtime/swing/list/CheckListRenderer.java | 363 +++++++------- .../runtime/swing/list/DefaultCheckListModel.java | 155 +++--- .../swing/list/filter/CheckListFilterType.java | 50 +- .../filter/DefaultFilterableCheckListModel.java | 14 +- .../filter/FilterableActionCheckListModel.java | 8 +- .../swing/list/filter/FilterableCheckList.java | 8 +- .../list/filter/FilterableCheckListModel.java | 5 +- .../model/AbstractGenericListSelectionModel.java | 17 +- .../jaxx/runtime/swing/model/GenericListModel.java | 9 +- .../swing/model/GenericListSelectionModel.java | 2 +- .../swing/model/JaxxDefaultComboBoxModel.java | 6 +- .../runtime/swing/model/JaxxDefaultListModel.java | 6 +- .../swing/model/JaxxFilterableComboBoxModel.java | 8 +- .../swing/model/JaxxFilterableListModel.java | 13 +- .../jaxx/runtime/swing/nav/NavDataProvider.java | 2 +- .../nuiton/jaxx/runtime/swing/nav/NavHelper.java | 8 +- .../org/nuiton/jaxx/runtime/swing/nav/NavNode.java | 2 +- .../jaxx/runtime/swing/nav/NavNodeChildLoador.java | 2 +- .../nav/tree/AbstractNavTreeCellRenderer.java | 4 +- .../jaxx/runtime/swing/nav/tree/NavTreeBridge.java | 2 +- .../jaxx/runtime/swing/nav/tree/NavTreeNode.java | 4 +- .../swing/nav/treetable/NavTreeTableBridge.java | 2 +- .../swing/nav/treetable/NavTreeTableHelper.java | 4 +- .../swing/nav/treetable/NavTreeTableNode.java | 6 +- .../swing/renderer/BooleanCellRenderer.java | 2 +- .../swing/renderer/DecoratorListCellRenderer.java | 2 +- .../swing/renderer/DecoratorTableCellRenderer.java | 2 +- .../FilteredDecoratorListCellRenderer.java | 39 +- .../swing/renderer/I18nTableCellRenderer.java | 4 +- .../swing/renderer/LocaleListCellRenderer.java | 2 +- .../renderer/MultiDecoratorTableCelleRenderer.java | 2 +- .../runtime/swing/session/JSplitPaneState.java | 4 +- .../runtime/swing/session/JTabbedPaneState.java | 2 +- .../jaxx/runtime/swing/session/JTableState.java | 5 +- .../jaxx/runtime/swing/session/SwingSession.java | 7 +- .../jaxx/runtime/swing/session/WindowState.java | 14 +- .../swing/table/filter/AbstractTableFilter.java | 153 +++--- .../swing/table/filter/FilterChangeListener.java | 2 +- .../runtime/swing/table/filter/JTableFilter.java | 105 +++-- .../table/filter/TableAwareCheckListRenderer.java | 27 +- .../runtime/swing/table/filter/TableFilter.java | 119 ++--- .../swing/table/filter/TableFilterColumnPopup.java | 6 +- .../swing/table/filter/TableFilterState.java | 166 +++---- .../swing/table/filter/TableRowFilterSupport.java | 153 +++--- .../runtime/swing/wizard/BusyChangeListener.java | 2 +- .../jaxx/runtime/swing/wizard/WizardModel.java | 4 +- .../jaxx/runtime/swing/wizard/WizardUILancher.java | 4 +- .../runtime/swing/wizard/ext/WizardExtModel.java | 8 +- .../swing/wizard/ext/WizardExtStepModel.java | 2 +- .../runtime/swing/wizard/ext/WizardExtUtil.java | 4 +- .../java/org/nuiton/jaxx/runtime/UtilTest.java | 1 - .../context/DataContextEntryIteratorTest.java | 285 ----------- .../context/DefaultApplicationContextTest.java | 11 +- .../runtime/context/DefaultJAXXContextTest.java | 2 +- jaxx-runtime/src/test/resources/log4j.properties | 1 - jaxx-validator/pom.xml | 51 +- .../SimpleBeanValidatorMessageTableModel.java | 10 +- .../jaxx/validator/swing/SwingListValidator.java | 3 +- .../validator/swing/SwingListValidatorMessage.java | 4 +- .../swing/SwingListValidatorMessageTableModel.java | 14 +- ...wingListValidatorMessageTableMouseListener.java | 6 +- .../swing/SwingListValidatorMessageWidget.java | 6 +- ...SwingListValidatorTableEditorModelListener.java | 4 +- .../jaxx/validator/swing/SwingValidator.java | 19 +- .../validator/swing/SwingValidatorMessage.java | 2 +- .../swing/SwingValidatorMessageListModel.java | 10 +- .../SwingValidatorMessageListMouseListener.java | 4 +- .../swing/SwingValidatorMessageTableModel.java | 20 +- .../SwingValidatorMessageTableMouseListener.java | 4 +- .../swing/SwingValidatorMessageWidget.java | 9 +- .../jaxx/validator/swing/SwingValidatorUtil.java | 26 +- .../jaxx/validator/swing/ui/IconValidationUI.java | 2 +- .../jaxx/validator/swing/ui/ImageValidationUI.java | 2 +- .../swing/ui/TranslucentValidationUI.java | 2 +- .../swing/unified/UnifiedValidatorMessage.java | 13 +- .../unified/UnifiedValidatorMessageTableModel.java | 36 +- .../UnifiedValidatorMessageTableMouseListener.java | 8 +- .../UnifiedValidatorMessageTableRenderer.java | 2 +- .../swing/unified/UnifiedValidatorMessageUtil.java | 3 +- .../unified/UnifiedValidatorMessageWidget.java | 6 +- .../jaxx/validator/swing/unified/package-info.java | 1 + jaxx-validator/src/test/resources/log4j.properties | 1 - jaxx-validator/src/test/resources/validators.xml | 57 +-- jaxx-widgets-about/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/about/AboutUI.jaxx | 3 +- .../nuiton/jaxx/widgets/about/AboutUIBuilder.java | 4 +- jaxx-widgets-common/pom.xml | 3 +- .../nuiton/jaxx/widgets/DecoratorPopupHandler.java | 2 +- .../MutateOnConditionalPropertyChangeListener.java | 14 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-config/pom.xml | 5 +- .../jaxx/widgets/config/ConfigCallBackUI.jaxx | 4 +- .../widgets/config/ConfigCallBackUIHandler.java | 10 +- .../jaxx/widgets/config/ConfigCategoryUI.jaxx | 4 +- .../widgets/config/ConfigCategoryUIHandler.java | 12 +- .../jaxx/widgets/config/ConfigTableEditor.java | 6 +- .../jaxx/widgets/config/ConfigUIHandler.java | 16 +- .../nuiton/jaxx/widgets/config/ConfigUIHelper.java | 19 +- .../jaxx/widgets/config/model/CallBackEntry.java | 2 +- .../widgets/config/model/CallBacksManager.java | 16 +- .../jaxx/widgets/config/model/CategoryModel.java | 1 + .../jaxx/widgets/config/model/ConfigUIModel.java | 7 +- .../jaxx/widgets/config/model/OptionModel.java | 8 +- .../org/nuiton/jaxx/widgets/config/package.html | 8 +- .../widgets/config/model/MyDelegateConfigTest.java | 46 +- .../config/model/MyInheritedConfigTest.java | 105 +---- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-datetime/pom.xml | 3 +- .../jaxx/widgets/datetime/DateCellRenderer.java | 9 +- .../jaxx/widgets/datetime/DateTimeEditor.jaxx | 6 +- .../widgets/datetime/DateTimeEditorHandler.java | 12 +- .../jaxx/widgets/datetime/DateTimeEditorModel.java | 2 +- .../datetime/ExtendedBasicDatePickerUI.java | 2 +- .../nuiton/jaxx/widgets/datetime/TimeEditor.jaxx | 3 +- .../jaxx/widgets/datetime/TimeEditorHandler.java | 8 +- .../jaxx/widgets/datetime/TimeEditorModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-error/pom.xml | 3 +- .../nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx | 2 +- .../jaxx/widgets/error/ErrorDialogUIHandler.java | 5 +- jaxx-widgets-extra/pom.xml | 14 +- jaxx-widgets-extra/src/main/assembly/deps.xml | 86 ++-- jaxx-widgets-extra/src/main/assembly/full.xml | 90 ++-- .../org/nuiton/jaxx/widgets/extra/AboutFrame.java | 87 ++-- .../jaxx/widgets/extra/ApplicationAction.java | 7 +- .../widgets/extra/CustomFocusTraversalPolicy.java | 8 +- .../nuiton/jaxx/widgets/extra/GridFlowLayout.java | 59 ++- .../widgets/extra/JComboBoxAutoCompletionKit.java | 21 +- .../jaxx/widgets/extra/SimpleInternalFrame.java | 73 +-- .../nuiton/jaxx/widgets/extra/SplashScreen.java | 40 +- .../org/nuiton/jaxx/widgets/extra/SwingUtil.java | 5 +- .../org/nuiton/jaxx/widgets/extra/SwitchPane.java | 7 +- .../nuiton/jaxx/widgets/extra/UIFSplitPane.java | 103 ++-- .../org/nuiton/jaxx/widgets/extra/WidgetUtil.java | 2 +- .../nuiton/jaxx/widgets/extra/XMLGridLayout.java | 20 +- .../widgets/extra/XMLGridParseConstraints.java | 88 ++-- .../jaxx/widgets/extra/datatips/DataTipCell.java | 3 +- .../widgets/extra/datatips/DataTipComponent.java | 20 +- .../widgets/extra/datatips/DataTipListener.java | 88 ++-- .../widgets/extra/datatips/DataTipManager.java | 119 ++--- .../jaxx/widgets/extra/datatips/DataTipPopup.java | 11 +- .../widgets/extra/datatips/ListDataTipCell.java | 12 +- .../extra/datatips/ListDataTipListener.java | 9 +- .../widgets/extra/datatips/TableDataTipCell.java | 5 +- .../extra/datatips/TableDataTipListener.java | 11 +- .../widgets/extra/datatips/TreeDataTipCell.java | 15 +- .../extra/datatips/TreeDataTipListener.java | 9 +- .../jaxx/widgets/extra/datatips/package-info.java | 2 +- .../jaxx/widgets/extra/editor/DefaultEditor.java | 4 +- .../nuiton/jaxx/widgets/extra/editor/Editor.java | 113 +++-- .../jaxx/widgets/extra/editor/EditorHelper.java | 29 +- .../jaxx/widgets/extra/editor/EditorInterface.java | 24 +- .../jaxx/widgets/extra/editor/JEditEditor.java | 47 +- .../jaxx/widgets/extra/editor/NullEditor.java | 33 +- .../jaxx/widgets/extra/editor/RSyntaxEditor.java | 48 +- .../jaxx/widgets/extra/editor/SDocEditor.java | 28 +- .../org/nuiton/jaxx/widgets/extra/package.html | 6 +- .../jaxx/widgets/extra/tooltip/FocusableTip.java | 505 ++++++++++---------- .../jaxx/widgets/extra/tooltip/SizeGrip.java | 402 ++++++++-------- .../nuiton/jaxx/widgets/extra/tooltip/TipUtil.java | 168 +++---- .../jaxx/widgets/extra/tooltip/TipWindow.java | 470 +++++++++---------- .../jaxx/widgets/extra/tooltip/package-info.java | 4 +- .../jaxx/widgets/extra/tree/FilterTreeModel.java | 22 +- .../nuiton/jaxx/widgets/extra/tree/TreeFilter.java | 8 +- .../nuiton/jaxx/widgets/extra/AboutFrameTest.java | 22 +- .../nuiton/jaxx/widgets/extra/IconFactoryTest.java | 3 +- .../nuiton/jaxx/widgets/extra/WidgetUtilTest.java | 11 +- .../jaxx/widgets/extra/XMLGridLayoutTest.java | 7 +- .../jaxx/widgets/extra/editor/EditorMain.java | 11 +- .../extra/toolTip/FocusableToolTipMain.java | 10 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-file/pom.xml | 3 +- .../nuiton/jaxx/widgets/file/BaseActionPanel.java | 13 +- .../nuiton/jaxx/widgets/file/FileCellEditor.java | 5 +- .../jaxx/widgets/file/FileEditorHandler.java | 2 +- jaxx-widgets-font/pom.xml | 3 +- jaxx-widgets-gis/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/gis/DdCoordinate.java | 8 +- .../org/nuiton/jaxx/widgets/gis/DmdCoordinate.java | 10 +- .../org/nuiton/jaxx/widgets/gis/DmsCoordinate.java | 16 +- .../jaxx/widgets/gis/DmsCoordinateConverter.java | 4 +- .../widgets/gis/MaskFormatterFromConverter.java | 4 +- .../AbsoluteDdCoordinateEditorHandler.java | 14 +- .../AbsoluteDmdCoordinateEditorHandler.java | 18 +- .../AbsoluteDmsCoordinateEditorHandler.java | 18 +- .../widgets/gis/absolute/CoordinatesEditor.jaxx | 18 +- .../gis/absolute/CoordinatesEditorHandler.java | 8 +- .../jaxx/widgets/gis/absolute/package-info.java | 1 + .../signed/SignedDdCoordinateEditorHandler.java | 22 +- .../signed/SignedDmdCoordinateEditorHandler.java | 26 +- .../signed/SignedDmsCoordinateEditorHandler.java | 26 +- .../jaxx/widgets/gis/signed/package-info.java | 1 + .../nuiton/jaxx/widgets/gis/DdCoordinateTest.java | 6 +- .../gis/signed/SignedDmdCoordinateEditorTest.java | 6 +- .../gis/signed/SignedDmsCoordinateEditorTest.java | 6 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-hidor/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx | 2 +- jaxx-widgets-i18n/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx | 18 +- .../jaxx/widgets/i18n/I18nEditorHandler.java | 5 +- jaxx-widgets-number/pom.xml | 5 +- .../jaxx/widgets/number/NumberCellEditor.java | 2 +- .../jaxx/widgets/number/NumberEditorHandler.java | 13 +- .../jaxx/widgets/number/NumberEditorModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-select/pom.xml | 5 +- .../nuiton/jaxx/widgets/select/BeanComboBox.jaxx | 2 +- .../jaxx/widgets/select/BeanComboBoxHandler.java | 12 +- .../nuiton/jaxx/widgets/select/BeanDoubleList.jaxx | 26 +- .../jaxx/widgets/select/BeanDoubleListHandler.java | 71 ++- .../jaxx/widgets/select/BeanDoubleListModel.java | 21 +- .../widgets/select/BeanFilterableComboBox.jaxx | 2 +- .../select/BeanFilterableComboBoxHandler.java | 20 +- .../nuiton/jaxx/widgets/select/BeanListHeader.jaxx | 2 +- .../jaxx/widgets/select/BeanListHeaderHandler.java | 19 +- .../jaxx/widgets/select/FilterableDoubleList.jaxx | 10 +- .../select/FilterableDoubleListHandler.java | 54 +-- .../widgets/select/FilterableDoubleListModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-status/pom.xml | 3 +- .../jaxx/widgets/status/MemoryStatusWidget.jaxx | 2 +- .../widgets/status/MemoryStatusWidgetHandler.java | 6 +- .../jaxx/widgets/status/StatusMessagePanel.jaxx | 6 +- .../widgets/status/StatusMessagePanelHandler.java | 4 +- src/site/rst/BeanValidator.rst | 2 +- src/site/rst/demo.rst | 4 +- src/site/rst/index.rst | 2 +- src/site/rst/old-compiler-doc/BeanValidator.rst | 2 +- 504 files changed, 5586 insertions(+), 6553 deletions(-) delete mode 100644 jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JAXXAction.java delete mode 100644 jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DataContext.java delete mode 100644 jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DataContextEntryIteratorTest.java -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 127f5074c3d34828ac7617e6a23fcdd3dc52b725 Author: Tony CHEMIT <dev@tchemit.fr> Date: Sat Dec 31 17:19:13 2016 +0100 Clean code --- jaxx-compiler/pom.xml | 5 +- .../java/org/nuiton/jaxx/compiler/ClassMap.java | 4 +- .../org/nuiton/jaxx/compiler/CompiledObject.java | 12 +- .../compiler/DefaultCompilerConfiguration.java | 8 +- .../org/nuiton/jaxx/compiler/EventHandler.java | 4 +- .../java/org/nuiton/jaxx/compiler/I18nHelper.java | 4 +- .../java/org/nuiton/jaxx/compiler/IDHelper.java | 6 +- .../org/nuiton/jaxx/compiler/JAXXCompiler.java | 203 +++----- .../java/org/nuiton/jaxx/compiler/JAXXEngine.java | 12 +- .../java/org/nuiton/jaxx/compiler/JAXXFactory.java | 4 +- .../java/org/nuiton/jaxx/compiler/JAXXProfile.java | 6 +- .../nuiton/jaxx/compiler/binding/DataBinding.java | 8 +- .../jaxx/compiler/binding/DataBindingHelper.java | 8 +- .../nuiton/jaxx/compiler/binding/DataSource.java | 20 +- .../jaxx/compiler/binding/JavaParserUtil.java | 32 +- .../compiler/binding/PseudoClassDataBinding.java | 8 +- .../binding/writers/DefaultJAXXBindingWriter.java | 30 +- .../nuiton/jaxx/compiler/css/StylesheetHelper.java | 67 ++- .../jaxx/compiler/css/parser/SimpleCharStream.java | 4 +- .../jaxx/compiler/css/parser/TokenMgrError.java | 8 +- .../decorators/BoxedCompiledObjectDecorator.java | 2 +- .../decorators/DefaultCompiledObjectDecorator.java | 24 +- .../HelpRootCompiledObjectDecorator.java | 36 +- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 4 +- .../jaxx/compiler/finalizers/SwingFinalizer.java | 8 +- .../compiler/finalizers/ValidatorFinalizer.java | 52 +-- .../org/nuiton/jaxx/compiler/java/JavaField.java | 16 +- .../org/nuiton/jaxx/compiler/java/JavaFile.java | 67 +-- .../jaxx/compiler/java/JavaFileGenerator.java | 6 +- .../org/nuiton/jaxx/compiler/java/JavaMethod.java | 24 +- .../jaxx/compiler/java/parser/JavaCharStream.java | 12 +- .../jaxx/compiler/java/parser/JavaParser.java | 14 +- .../jaxx/compiler/java/parser/TokenMgrError.java | 8 +- .../jaxx/compiler/reflect/ClassDescriptor.java | 10 +- .../compiler/reflect/ClassDescriptorHelper.java | 24 +- .../ClassDescriptorResolverFromJavaClass.java | 4 +- .../ClassDescriptorResolverFromJavaFile.java | 19 +- .../ClassDescriptorResolverFromJaxxFile.java | 16 +- .../nuiton/jaxx/compiler/script/ScriptManager.java | 22 +- .../jaxx/compiler/spi/DefaultInitializer.java | 2 +- .../compiler/tags/DefaultComponentHandler.java | 26 +- .../jaxx/compiler/tags/DefaultObjectHandler.java | 68 ++- .../nuiton/jaxx/compiler/tags/ImportHandler.java | 9 +- .../nuiton/jaxx/compiler/tags/ScriptHandler.java | 8 +- .../nuiton/jaxx/compiler/tags/StyleHandler.java | 2 +- .../org/nuiton/jaxx/compiler/tags/TagManager.java | 56 +-- .../compiler/tags/swing/ApplicationHandler.java | 4 +- .../compiler/tags/swing/JRadioButtonHandler.java | 2 +- .../compiler/tags/swing/JScrollPaneHandler.java | 4 +- .../jaxx/compiler/tags/swing/JSpinnerHandler.java | 8 +- .../compiler/tags/swing/JSplitPaneHandler.java | 4 +- .../compiler/tags/swing/JTextComponentHandler.java | 4 +- .../jaxx/compiler/tags/swing/JToolBarHandler.java | 2 +- .../jaxx/compiler/tags/swing/JXLayerHandler.java | 4 +- .../jaxx/compiler/tags/swing/TabHandler.java | 2 +- .../jaxx/compiler/tags/swing/TableHandler.java | 2 +- .../tags/validator/BeanValidatorHandler.java | 70 ++- .../validator/ExcludeFieldValidatorHandler.java | 28 +- .../tags/validator/FieldValidatorHandler.java | 14 +- .../jaxx/compiler/tasks/CompileFirstPassTask.java | 4 +- .../jaxx/compiler/tasks/CompileSecondPassTask.java | 6 +- .../nuiton/jaxx/compiler/tasks/FinalizeTask.java | 4 +- .../compiler/tasks/GenerateConstructorsTask.java | 22 +- .../compiler/tasks/GenerateMissingRulesTask.java | 16 +- .../nuiton/jaxx/compiler/tasks/GenerateTask.java | 22 +- .../org/nuiton/jaxx/compiler/tasks/InitTask.java | 4 +- .../nuiton/jaxx/compiler/tasks/ProfileTask.java | 2 +- .../nuiton/jaxx/compiler/tasks/StyleSheetTask.java | 4 +- .../nuiton/jaxx/compiler/tools/PrintTagInfo.java | 2 +- .../compiler/tools/jaxxcapture/JAXXCapture.java | 2 +- .../types/GridBagConstraintsConverter.java | 4 +- .../jaxx/compiler/binding/JavaParserUtilTest.java | 11 +- .../nuiton/jaxx/compiler/java/JavaMethodTest.java | 2 +- .../jaxx/compiler/java/parser/JavaParserTest.java | 10 +- .../jaxx/compiler/reflect/MyAbstractClass.java | 2 +- .../nuiton/jaxx/compiler/reflect/MyChildClass.java | 2 +- .../nuiton/jaxx/compiler/reflect/MyInterface.java | 2 +- .../ClassDescriptorResolverFromJavaFileTest.java | 12 +- .../nuiton/jaxx/compiler/tags/TagManagerTest.java | 8 +- .../jaxx/compiler/types/ColorConverterTest.java | 2 +- jaxx-compiler/src/test/resources/log4j.properties | 1 - jaxx-demo/pom.xml | 11 +- .../nuiton/jaxx/demo/DemoApplicationContext.java | 6 +- .../main/java/org/nuiton/jaxx/demo/DemoConfig.java | 32 +- .../java/org/nuiton/jaxx/demo/DemoHelpBroker.java | 8 +- .../org/nuiton/jaxx/demo/DemoSourcesHandler.java | 11 +- .../java/org/nuiton/jaxx/demo/DemoUIHandler.java | 5 +- .../jaxx/editor/BeanComboBoxDemoHandler.java | 2 +- .../jaxx/editor/BeanDoubleListDemoHandler.java | 8 +- .../editor/BeanFilterableComboBoxDemoHandler.java | 2 +- .../select/FilterableDoubleListDemoHandler.java | 2 +- .../jaxx/demo/component/swing/HidorButtonDemo.jaxx | 8 +- .../jaxx/demo/entities/DemoDataProvider.java | 2 +- .../jaxx/demo/feature/nav/NavDemoHandler.java | 16 +- .../feature/nav/tree/ActorsTreeNodeLoador.java | 4 +- .../feature/nav/tree/MoviesTreeNodeLoador.java | 6 +- .../feature/nav/tree/NavDemoTreeCellRenderer.java | 2 +- .../demo/feature/nav/tree/NavDemoTreeHelper.java | 2 +- .../nav/treetable/ActorsTreeTableNodeLoador.java | 4 +- .../nav/treetable/MoviesTreeTableNodeLoador.java | 6 +- .../nav/treetable/NavDemoTreeTableHelper.java | 4 +- .../nav/treetable/NavDemoTreeTableModel.java | 4 +- .../list/ListBeanValidationDemoHandler.java | 12 +- .../feature/validation/list/PeopleTableModel.java | 2 +- .../nuiton/jaxx/demo/tree/DemoCellRenderer.java | 2 +- .../org/nuiton/jaxx/demo/tree/DemoNodeLoador.java | 4 +- jaxx-demo/src/main/resources/log4j.properties | 1 - .../demo/entities/Identity-error-validation.xml | 80 ++-- .../demo/entities/Identity-info-validation.xml | 80 ++-- .../demo/entities/Identity-warning-validation.xml | 80 ++-- .../jaxx/demo/entities/Model-error-validation.xml | 56 +-- .../jaxx/demo/entities/Model-info-validation.xml | 14 +- .../demo/entities/Model-warning-validation.xml | 24 +- .../jaxx/demo/entities/People-error-validation.xml | 4 +- .../jaxx/demo/entities/People-info-validation.xml | 6 +- .../demo/entities/People-warning-validation.xml | 4 +- jaxx-demo/src/main/resources/validators.xml | 53 ++- .../jaxx/demo/BeanValidatorDetectorTest.java | 4 +- jaxx-maven-plugin/pom.xml | 3 +- .../jaxx/plugin/AbstractGenerateHelpMojo.java | 8 +- .../nuiton/jaxx/plugin/GenerateHelpFilesMojo.java | 15 +- .../nuiton/jaxx/plugin/GenerateHelpIdsMojo.java | 20 +- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 6 +- .../nuiton/jaxx/plugin/GenerateHelpSearchMojo.java | 12 +- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 38 +- .../main/java/org/nuiton/jaxx/plugin/NodeItem.java | 6 +- .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 23 +- .../src/main/resources/defaultContent.html.vm | 6 +- .../src/main/resources/defaultHelpSet.hs.vm | 28 +- .../src/main/resources/defaultI18n.java.vm | 18 +- .../src/main/resources/defaultIndex.xml.vm | 23 +- .../src/main/resources/defaultMap.jhm.vm | 18 +- .../src/main/resources/defaultToc.xml.vm | 23 +- .../src/main/resources/log4j.properties | 1 - .../java/org/nuiton/jaxx/plugin/Bug1124Test.java | 13 +- .../java/org/nuiton/jaxx/plugin/Bug1404Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 7 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 2 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 6 +- .../nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 2 +- .../org/nuiton/jaxx/plugin/DataBindingTest.java | 4 +- .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 6 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 15 +- .../java/org/nuiton/jaxx/plugin/NodeItemTest.java | 4 +- .../compilerTest/classReferences/JavaTaist.java | 2 +- .../validator/ok/Identity.java | 2 +- .../compilerValidatorTest/validator/ok/Model.java | 5 +- .../src/test/resources/log4j.properties | 1 - .../nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml | 48 +- .../org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx | 6 +- .../org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx | 6 +- .../nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx | 2 +- .../nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml | 44 +- .../nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx | 10 +- .../jaxx/plugin/bug1722Test/JButtonDemo.jaxx | 6 +- .../nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml | 46 +- .../nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx | 26 +- .../nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml | 48 +- .../org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml | 42 +- .../org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx | 16 +- .../nuiton/jaxx/plugin/compilerTest/CSSTests.xml | 46 +- .../jaxx/plugin/compilerTest/ClassReferences.xml | 42 +- .../jaxx/plugin/compilerTest/ClientProperty.xml | 44 +- .../ErrorJaxxContextImplementorClass.xml | 44 +- .../org/nuiton/jaxx/plugin/compilerTest/Errors.xml | 52 +-- .../org/nuiton/jaxx/plugin/compilerTest/Force.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/Icon.xml | 48 +- .../nuiton/jaxx/plugin/compilerTest/ImportTag.xml | 40 +- .../jaxx/plugin/compilerTest/Initializers.xml | 42 +- .../jaxx/plugin/compilerTest/InnerClasses.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/NoLog.xml | 44 +- .../plugin/compilerTest/OverridingDataBindings.xml | 42 +- .../org/nuiton/jaxx/plugin/compilerTest/Script.xml | 42 +- .../plugin/compilerTest/SpecialSubclassing.xml | 42 +- .../nuiton/jaxx/plugin/compilerTest/WithLog.xml | 44 +- .../plugin/compilerTest/cSSTests/CSSTests.jaxx | 6 +- .../plugin/compilerTest/cSSTests/GrandChild.jaxx | 16 +- .../compilerTest/cSSTests/Pseudoclasses.jaxx | 44 +- .../plugin/compilerTest/cSSTests/SimpleCSS.jaxx | 6 +- .../classReferences/ClassReferences.jaxx | 4 +- .../classReferences/ConstructorReferenceTest.jaxx | 2 +- .../classReferences/JAXXReferenceTest.jaxx | 2 +- .../compilerTest/classReferences/JAXXTest.jaxx | 2 +- .../classReferences/StaticMethodTest.jaxx | 2 +- .../compilerTest/clientProperty/TestOne.jaxx | 2 +- .../plugin/compilerTest/errors/AmbiguousName.jaxx | 2 +- .../compilerTest/errors/CellOutsideOfRow.jaxx | 8 +- .../plugin/compilerTest/errors/MixedContent.jaxx | 8 +- .../compilerTest/errors/RowOutsideOfTable.jaxx | 8 +- .../plugin/compilerTest/errors/RowWrongChild.jaxx | 2 +- .../compilerTest/errors/StyleParseError.jaxx | 6 +- .../jaxx/plugin/compilerTest/icon/Test1.jaxx | 4 +- .../compilerTest/initializers/Initializers.jaxx | 36 +- .../overridingDataBindings/CurrentTime.jaxx | 12 +- .../OverridingDataBindings.jaxx | 2 +- .../compilerTest/script/JScriptInitializer.jaxx | 30 +- .../compilerValidatorTest/ValidatorErrors.xml | 44 +- .../plugin/compilerValidatorTest/ValidatorOk.xml | 44 +- .../errors/AutoFieldComponentNotFound.jaxx | 7 +- .../validator/errors/DuplicatedBean.jaxx | 2 +- .../validator/errors/DuplicatedBean2.jaxx | 6 +- .../validator/errors/DuplicatedErrorListModel.jaxx | 5 +- .../errors/DuplicatedErrorTableModel.jaxx | 5 +- .../errors/DuplicatedFieldInSameValidator.jaxx | 10 +- .../errors/FieldBeanPropertyNotFound.jaxx | 6 +- .../validator/errors/FieldComponentNotFound.jaxx | 6 +- .../validator/errors/FieldComponentNotFound2.jaxx | 6 +- .../validator/errors/FieldNoName.jaxx | 6 +- .../validator/errors/FieldNoName2.jaxx | 6 +- .../validator/errors/Model.java | 5 +- .../validator/errors/NoBean.jaxx | 2 +- .../validator/errors/UnfoundBean.jaxx | 2 +- .../validator/errors/UnfoundErrorList.jaxx | 2 +- .../validator/errors/UnfoundErrorListModel.jaxx | 2 +- .../validator/errors/UnfoundErrorTable.jaxx | 2 +- .../validator/errors/UnfoundErrorTableModel.jaxx | 2 +- .../validator/errors/UnfoundParentValidator.jaxx | 3 +- .../validator/ok/FieldComponentDuplicated.jaxx | 10 +- .../validator/ok/Validation.jaxx | 520 ++++++++++----------- .../validator/ok/ValidationBeanClass.jaxx | 209 ++++----- .../nuiton/jaxx/plugin/dataBindingTest/First.jaxx | 35 +- .../jaxx/plugin/dataBindingTest/simpleBinding.xml | 42 +- .../jaxx/plugin/decoratorTest/BoxedDecorator.jaxx | 2 +- .../nuiton/jaxx/plugin/decoratorTest/Decorator.xml | 44 +- .../nuiton/jaxx/plugin/evolution74Test/error.xml | 44 +- .../plugin/evolution74Test/error/swingcombo.jaxx | 2 +- .../plugin/evolution74Test/error/swinglist.jaxx | 2 +- .../plugin/evolution74Test/error/swingtree.jaxx | 2 +- .../org/nuiton/jaxx/plugin/evolution74Test/ok.xml | 42 +- .../jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx | 2 +- .../jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx | 2 +- .../jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx | 2 +- .../org/nuiton/jaxx/plugin/i18nTest/I18nText.xml | 44 +- .../org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml | 44 +- .../jaxx/plugin/i18nTest/I18nToolTipText.xml | 44 +- .../jaxx/plugin/i18nTest/title/JTabbedPane.jaxx | 4 +- .../jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx | 6 +- .../plugin/i18nTest/tooltiptext/JTabbedPane.jaxx | 4 +- .../plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx | 4 +- .../plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx | 6 +- .../org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml | 46 +- .../jaxx/plugin/lambdaTest/LambdaHandler.java | 4 +- jaxx-runtime/pom.xml | 55 +-- .../java/org/nuiton/jaxx/runtime/JAXXAction.java | 42 -- .../java/org/nuiton/jaxx/runtime/SwingUtil.java | 21 +- .../awt/visitor/GetCompopentAtPointVisitor.java | 4 +- .../nuiton/jaxx/runtime/bean/BeanTypeAware.java | 2 +- .../jaxx/runtime/binding/DefaultJAXXBinding.java | 4 +- .../nuiton/jaxx/runtime/context/DataContext.java | 430 ----------------- .../runtime/context/DefaultApplicationContext.java | 12 +- .../jaxx/runtime/context/DefaultJAXXContext.java | 10 +- .../jaxx/runtime/context/JAXXContextEntryDef.java | 14 +- .../org/nuiton/jaxx/runtime/css/Pseudoclasses.java | 12 +- .../nuiton/jaxx/runtime/swing/BlockingLayerUI.java | 4 +- .../jaxx/runtime/swing/BlockingLayerUI2.java | 4 +- .../org/nuiton/jaxx/runtime/swing/CardLayout2.java | 6 +- .../nuiton/jaxx/runtime/swing/CardLayout2Ext.java | 2 +- .../nuiton/jaxx/runtime/swing/ComponentMover.java | 4 +- .../jaxx/runtime/swing/ComponentResizer.java | 4 +- .../nuiton/jaxx/runtime/swing/CompoundIcon.java | 55 +-- .../nuiton/jaxx/runtime/swing/JAXXButtonGroup.java | 2 +- .../nuiton/jaxx/runtime/swing/JAXXComboBox.java | 2 +- .../org/nuiton/jaxx/runtime/swing/JAXXList.java | 12 +- .../runtime/swing/application/ActionExecutor.java | 10 +- .../runtime/swing/application/ActionWorker.java | 4 +- .../runtime/swing/editor/BooleanCellEditor.java | 7 +- .../jaxx/runtime/swing/editor/EnumEditor.java | 12 +- .../runtime/swing/editor/KeyStrokeCellEditor.java | 3 +- .../jaxx/runtime/swing/help/JAXXHelpBroker.java | 24 +- .../runtime/swing/list/ActionCheckListModel.java | 264 +++++------ .../nuiton/jaxx/runtime/swing/list/CheckList.java | 188 ++++---- .../jaxx/runtime/swing/list/CheckListAction.java | 50 +- .../jaxx/runtime/swing/list/CheckListEditor.java | 58 +-- .../jaxx/runtime/swing/list/CheckListModel.java | 56 +-- .../jaxx/runtime/swing/list/CheckListRenderer.java | 363 +++++++------- .../runtime/swing/list/DefaultCheckListModel.java | 155 +++--- .../swing/list/filter/CheckListFilterType.java | 50 +- .../filter/DefaultFilterableCheckListModel.java | 14 +- .../filter/FilterableActionCheckListModel.java | 8 +- .../swing/list/filter/FilterableCheckList.java | 8 +- .../list/filter/FilterableCheckListModel.java | 5 +- .../model/AbstractGenericListSelectionModel.java | 17 +- .../jaxx/runtime/swing/model/GenericListModel.java | 9 +- .../swing/model/GenericListSelectionModel.java | 2 +- .../swing/model/JaxxDefaultComboBoxModel.java | 6 +- .../runtime/swing/model/JaxxDefaultListModel.java | 6 +- .../swing/model/JaxxFilterableComboBoxModel.java | 8 +- .../swing/model/JaxxFilterableListModel.java | 13 +- .../jaxx/runtime/swing/nav/NavDataProvider.java | 2 +- .../nuiton/jaxx/runtime/swing/nav/NavHelper.java | 8 +- .../org/nuiton/jaxx/runtime/swing/nav/NavNode.java | 2 +- .../jaxx/runtime/swing/nav/NavNodeChildLoador.java | 2 +- .../nav/tree/AbstractNavTreeCellRenderer.java | 4 +- .../jaxx/runtime/swing/nav/tree/NavTreeBridge.java | 2 +- .../jaxx/runtime/swing/nav/tree/NavTreeNode.java | 4 +- .../swing/nav/treetable/NavTreeTableBridge.java | 2 +- .../swing/nav/treetable/NavTreeTableHelper.java | 4 +- .../swing/nav/treetable/NavTreeTableNode.java | 6 +- .../swing/renderer/BooleanCellRenderer.java | 2 +- .../swing/renderer/DecoratorListCellRenderer.java | 2 +- .../swing/renderer/DecoratorTableCellRenderer.java | 2 +- .../FilteredDecoratorListCellRenderer.java | 39 +- .../swing/renderer/I18nTableCellRenderer.java | 4 +- .../swing/renderer/LocaleListCellRenderer.java | 2 +- .../renderer/MultiDecoratorTableCelleRenderer.java | 2 +- .../runtime/swing/session/JSplitPaneState.java | 4 +- .../runtime/swing/session/JTabbedPaneState.java | 2 +- .../jaxx/runtime/swing/session/JTableState.java | 5 +- .../jaxx/runtime/swing/session/SwingSession.java | 7 +- .../jaxx/runtime/swing/session/WindowState.java | 14 +- .../swing/table/filter/AbstractTableFilter.java | 153 +++--- .../swing/table/filter/FilterChangeListener.java | 2 +- .../runtime/swing/table/filter/JTableFilter.java | 105 +++-- .../table/filter/TableAwareCheckListRenderer.java | 27 +- .../runtime/swing/table/filter/TableFilter.java | 119 ++--- .../swing/table/filter/TableFilterColumnPopup.java | 6 +- .../swing/table/filter/TableFilterState.java | 166 +++---- .../swing/table/filter/TableRowFilterSupport.java | 153 +++--- .../runtime/swing/wizard/BusyChangeListener.java | 2 +- .../jaxx/runtime/swing/wizard/WizardModel.java | 4 +- .../jaxx/runtime/swing/wizard/WizardUILancher.java | 4 +- .../runtime/swing/wizard/ext/WizardExtModel.java | 8 +- .../swing/wizard/ext/WizardExtStepModel.java | 2 +- .../runtime/swing/wizard/ext/WizardExtUtil.java | 4 +- .../java/org/nuiton/jaxx/runtime/UtilTest.java | 1 - .../context/DataContextEntryIteratorTest.java | 285 ----------- .../context/DefaultApplicationContextTest.java | 11 +- .../runtime/context/DefaultJAXXContextTest.java | 2 +- jaxx-runtime/src/test/resources/log4j.properties | 1 - jaxx-validator/pom.xml | 51 +- .../SimpleBeanValidatorMessageTableModel.java | 10 +- .../jaxx/validator/swing/SwingListValidator.java | 3 +- .../validator/swing/SwingListValidatorMessage.java | 4 +- .../swing/SwingListValidatorMessageTableModel.java | 14 +- ...wingListValidatorMessageTableMouseListener.java | 6 +- .../swing/SwingListValidatorMessageWidget.java | 6 +- ...SwingListValidatorTableEditorModelListener.java | 4 +- .../jaxx/validator/swing/SwingValidator.java | 19 +- .../validator/swing/SwingValidatorMessage.java | 2 +- .../swing/SwingValidatorMessageListModel.java | 10 +- .../SwingValidatorMessageListMouseListener.java | 4 +- .../swing/SwingValidatorMessageTableModel.java | 20 +- .../SwingValidatorMessageTableMouseListener.java | 4 +- .../swing/SwingValidatorMessageWidget.java | 9 +- .../jaxx/validator/swing/SwingValidatorUtil.java | 26 +- .../jaxx/validator/swing/ui/IconValidationUI.java | 2 +- .../jaxx/validator/swing/ui/ImageValidationUI.java | 2 +- .../swing/ui/TranslucentValidationUI.java | 2 +- .../swing/unified/UnifiedValidatorMessage.java | 13 +- .../unified/UnifiedValidatorMessageTableModel.java | 36 +- .../UnifiedValidatorMessageTableMouseListener.java | 8 +- .../UnifiedValidatorMessageTableRenderer.java | 2 +- .../swing/unified/UnifiedValidatorMessageUtil.java | 3 +- .../unified/UnifiedValidatorMessageWidget.java | 6 +- .../jaxx/validator/swing/unified/package-info.java | 1 + jaxx-validator/src/test/resources/log4j.properties | 1 - jaxx-validator/src/test/resources/validators.xml | 57 +-- jaxx-widgets-about/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/about/AboutUI.jaxx | 3 +- .../nuiton/jaxx/widgets/about/AboutUIBuilder.java | 4 +- jaxx-widgets-common/pom.xml | 3 +- .../nuiton/jaxx/widgets/DecoratorPopupHandler.java | 2 +- .../MutateOnConditionalPropertyChangeListener.java | 14 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-config/pom.xml | 5 +- .../jaxx/widgets/config/ConfigCallBackUI.jaxx | 4 +- .../widgets/config/ConfigCallBackUIHandler.java | 10 +- .../jaxx/widgets/config/ConfigCategoryUI.jaxx | 4 +- .../widgets/config/ConfigCategoryUIHandler.java | 12 +- .../jaxx/widgets/config/ConfigTableEditor.java | 6 +- .../jaxx/widgets/config/ConfigUIHandler.java | 16 +- .../nuiton/jaxx/widgets/config/ConfigUIHelper.java | 19 +- .../jaxx/widgets/config/model/CallBackEntry.java | 2 +- .../widgets/config/model/CallBacksManager.java | 16 +- .../jaxx/widgets/config/model/CategoryModel.java | 1 + .../jaxx/widgets/config/model/ConfigUIModel.java | 7 +- .../jaxx/widgets/config/model/OptionModel.java | 8 +- .../org/nuiton/jaxx/widgets/config/package.html | 8 +- .../widgets/config/model/MyDelegateConfigTest.java | 46 +- .../config/model/MyInheritedConfigTest.java | 105 +---- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-datetime/pom.xml | 3 +- .../jaxx/widgets/datetime/DateCellRenderer.java | 9 +- .../jaxx/widgets/datetime/DateTimeEditor.jaxx | 6 +- .../widgets/datetime/DateTimeEditorHandler.java | 12 +- .../jaxx/widgets/datetime/DateTimeEditorModel.java | 2 +- .../datetime/ExtendedBasicDatePickerUI.java | 2 +- .../nuiton/jaxx/widgets/datetime/TimeEditor.jaxx | 3 +- .../jaxx/widgets/datetime/TimeEditorHandler.java | 8 +- .../jaxx/widgets/datetime/TimeEditorModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-error/pom.xml | 3 +- .../nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx | 2 +- .../jaxx/widgets/error/ErrorDialogUIHandler.java | 5 +- jaxx-widgets-extra/pom.xml | 14 +- jaxx-widgets-extra/src/main/assembly/deps.xml | 86 ++-- jaxx-widgets-extra/src/main/assembly/full.xml | 90 ++-- .../org/nuiton/jaxx/widgets/extra/AboutFrame.java | 87 ++-- .../jaxx/widgets/extra/ApplicationAction.java | 7 +- .../widgets/extra/CustomFocusTraversalPolicy.java | 8 +- .../nuiton/jaxx/widgets/extra/GridFlowLayout.java | 59 ++- .../widgets/extra/JComboBoxAutoCompletionKit.java | 21 +- .../jaxx/widgets/extra/SimpleInternalFrame.java | 73 +-- .../nuiton/jaxx/widgets/extra/SplashScreen.java | 40 +- .../org/nuiton/jaxx/widgets/extra/SwingUtil.java | 5 +- .../org/nuiton/jaxx/widgets/extra/SwitchPane.java | 7 +- .../nuiton/jaxx/widgets/extra/UIFSplitPane.java | 103 ++-- .../org/nuiton/jaxx/widgets/extra/WidgetUtil.java | 2 +- .../nuiton/jaxx/widgets/extra/XMLGridLayout.java | 20 +- .../widgets/extra/XMLGridParseConstraints.java | 88 ++-- .../jaxx/widgets/extra/datatips/DataTipCell.java | 3 +- .../widgets/extra/datatips/DataTipComponent.java | 20 +- .../widgets/extra/datatips/DataTipListener.java | 88 ++-- .../widgets/extra/datatips/DataTipManager.java | 119 ++--- .../jaxx/widgets/extra/datatips/DataTipPopup.java | 11 +- .../widgets/extra/datatips/ListDataTipCell.java | 12 +- .../extra/datatips/ListDataTipListener.java | 9 +- .../widgets/extra/datatips/TableDataTipCell.java | 5 +- .../extra/datatips/TableDataTipListener.java | 11 +- .../widgets/extra/datatips/TreeDataTipCell.java | 15 +- .../extra/datatips/TreeDataTipListener.java | 9 +- .../jaxx/widgets/extra/datatips/package-info.java | 2 +- .../jaxx/widgets/extra/editor/DefaultEditor.java | 4 +- .../nuiton/jaxx/widgets/extra/editor/Editor.java | 113 +++-- .../jaxx/widgets/extra/editor/EditorHelper.java | 29 +- .../jaxx/widgets/extra/editor/EditorInterface.java | 24 +- .../jaxx/widgets/extra/editor/JEditEditor.java | 47 +- .../jaxx/widgets/extra/editor/NullEditor.java | 33 +- .../jaxx/widgets/extra/editor/RSyntaxEditor.java | 48 +- .../jaxx/widgets/extra/editor/SDocEditor.java | 28 +- .../org/nuiton/jaxx/widgets/extra/package.html | 6 +- .../jaxx/widgets/extra/tooltip/FocusableTip.java | 505 ++++++++++---------- .../jaxx/widgets/extra/tooltip/SizeGrip.java | 402 ++++++++-------- .../nuiton/jaxx/widgets/extra/tooltip/TipUtil.java | 168 +++---- .../jaxx/widgets/extra/tooltip/TipWindow.java | 470 +++++++++---------- .../jaxx/widgets/extra/tooltip/package-info.java | 4 +- .../jaxx/widgets/extra/tree/FilterTreeModel.java | 22 +- .../nuiton/jaxx/widgets/extra/tree/TreeFilter.java | 8 +- .../nuiton/jaxx/widgets/extra/AboutFrameTest.java | 22 +- .../nuiton/jaxx/widgets/extra/IconFactoryTest.java | 3 +- .../nuiton/jaxx/widgets/extra/WidgetUtilTest.java | 11 +- .../jaxx/widgets/extra/XMLGridLayoutTest.java | 7 +- .../jaxx/widgets/extra/editor/EditorMain.java | 11 +- .../extra/toolTip/FocusableToolTipMain.java | 10 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-file/pom.xml | 3 +- .../nuiton/jaxx/widgets/file/BaseActionPanel.java | 13 +- .../nuiton/jaxx/widgets/file/FileCellEditor.java | 5 +- .../jaxx/widgets/file/FileEditorHandler.java | 2 +- jaxx-widgets-font/pom.xml | 3 +- jaxx-widgets-gis/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/gis/DdCoordinate.java | 8 +- .../org/nuiton/jaxx/widgets/gis/DmdCoordinate.java | 10 +- .../org/nuiton/jaxx/widgets/gis/DmsCoordinate.java | 16 +- .../jaxx/widgets/gis/DmsCoordinateConverter.java | 4 +- .../widgets/gis/MaskFormatterFromConverter.java | 4 +- .../AbsoluteDdCoordinateEditorHandler.java | 14 +- .../AbsoluteDmdCoordinateEditorHandler.java | 18 +- .../AbsoluteDmsCoordinateEditorHandler.java | 18 +- .../widgets/gis/absolute/CoordinatesEditor.jaxx | 18 +- .../gis/absolute/CoordinatesEditorHandler.java | 8 +- .../jaxx/widgets/gis/absolute/package-info.java | 1 + .../signed/SignedDdCoordinateEditorHandler.java | 22 +- .../signed/SignedDmdCoordinateEditorHandler.java | 26 +- .../signed/SignedDmsCoordinateEditorHandler.java | 26 +- .../jaxx/widgets/gis/signed/package-info.java | 1 + .../nuiton/jaxx/widgets/gis/DdCoordinateTest.java | 6 +- .../gis/signed/SignedDmdCoordinateEditorTest.java | 6 +- .../gis/signed/SignedDmsCoordinateEditorTest.java | 6 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-hidor/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx | 2 +- jaxx-widgets-i18n/pom.xml | 3 +- .../org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx | 18 +- .../jaxx/widgets/i18n/I18nEditorHandler.java | 5 +- jaxx-widgets-number/pom.xml | 5 +- .../jaxx/widgets/number/NumberCellEditor.java | 2 +- .../jaxx/widgets/number/NumberEditorHandler.java | 13 +- .../jaxx/widgets/number/NumberEditorModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-select/pom.xml | 5 +- .../nuiton/jaxx/widgets/select/BeanComboBox.jaxx | 2 +- .../jaxx/widgets/select/BeanComboBoxHandler.java | 12 +- .../nuiton/jaxx/widgets/select/BeanDoubleList.jaxx | 26 +- .../jaxx/widgets/select/BeanDoubleListHandler.java | 71 ++- .../jaxx/widgets/select/BeanDoubleListModel.java | 21 +- .../widgets/select/BeanFilterableComboBox.jaxx | 2 +- .../select/BeanFilterableComboBoxHandler.java | 20 +- .../nuiton/jaxx/widgets/select/BeanListHeader.jaxx | 2 +- .../jaxx/widgets/select/BeanListHeaderHandler.java | 19 +- .../jaxx/widgets/select/FilterableDoubleList.jaxx | 10 +- .../select/FilterableDoubleListHandler.java | 54 +-- .../widgets/select/FilterableDoubleListModel.java | 2 +- .../src/test/resources/log4j.properties | 1 - jaxx-widgets-status/pom.xml | 3 +- .../jaxx/widgets/status/MemoryStatusWidget.jaxx | 2 +- .../widgets/status/MemoryStatusWidgetHandler.java | 6 +- .../jaxx/widgets/status/StatusMessagePanel.jaxx | 6 +- .../widgets/status/StatusMessagePanelHandler.java | 4 +- src/site/rst/BeanValidator.rst | 2 +- src/site/rst/demo.rst | 4 +- src/site/rst/index.rst | 2 +- src/site/rst/old-compiler-doc/BeanValidator.rst | 2 +- 504 files changed, 5586 insertions(+), 6553 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index c9b7300..52e8f6f 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -23,7 +23,8 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> -<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"> +<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> @@ -100,7 +101,7 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> - + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/ClassMap.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/ClassMap.java index 12b01ff..ca60b32 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/ClassMap.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/ClassMap.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.compiler; -import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; -import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; +import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import java.util.ArrayList; import java.util.HashMap; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/CompiledObject.java index 962a26f..8d0a617 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/CompiledObject.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.compiler; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; @@ -30,7 +31,6 @@ import org.nuiton.jaxx.compiler.tags.TagHandler; import org.nuiton.jaxx.compiler.tags.TagManager; import org.nuiton.jaxx.compiler.types.TypeManager; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.lang3.StringUtils; import java.awt.Container; import java.util.ArrayList; @@ -519,8 +519,8 @@ public class CompiledObject { //TC-20091026 use 'this' instead of root object javaCode //TC-20091105 JAXXUtil.getEventListener is generic, no more need cast and use simple name return getJavaCode() + '.' + addMethod.getName() + "(" + prefix + ".getEventListener(" + type + ".class, " + - TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + - TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); + TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + + TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); } /** @@ -679,14 +679,14 @@ public class CompiledObject { if (!child.isOverride()) { TagHandler tagHandler = TagManager.getTagHandler(getObjectClass()); if (tagHandler instanceof DefaultComponentHandler && - !((DefaultComponentHandler) tagHandler).isContainer()) { + !((DefaultComponentHandler) tagHandler).isContainer()) { compiler.reportError("component " + this + " may not have children"); } String containerDelegate = ((DefaultComponentHandler) tagHandler).getContainerDelegate(); String delegateCode = containerDelegate != null ? - "." + containerDelegate + "()" : - ""; + "." + containerDelegate + "()" : + ""; child.setParent(this); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/DefaultCompilerConfiguration.java index e2686ba..aa9707c 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/DefaultCompilerConfiguration.java @@ -22,15 +22,15 @@ package org.nuiton.jaxx.compiler; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.finalizers.JAXXCompilerFinalizer; import org.nuiton.jaxx.compiler.spi.Initializer; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.spi.UIHandler; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.UIManager; import java.io.File; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/EventHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/EventHandler.java index 4b5604f..ead1ae0 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/EventHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/EventHandler.java @@ -80,7 +80,7 @@ public class EventHandler { @Override public String toString() { return "EventHandler[" + eventId + ", " + - listenerClass.getName() + ", " + - objectCode + ", " + javaCode + "]"; + listenerClass.getName() + ", " + + objectCode + ", " + javaCode + "]"; } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/I18nHelper.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/I18nHelper.java index 6adac26..a95389f 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/I18nHelper.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/I18nHelper.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.compiler; -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.lang3.CharUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; +import org.nuiton.jaxx.runtime.SwingUtil; import java.util.Arrays; import java.util.List; @@ -139,6 +139,6 @@ public class I18nHelper { compiler); compiler.addImport(SwingUtil.class.getName()); return "{" + SwingUtil.class.getSimpleName() + - ".getFirstCharAt(" + stringValue + ",'Z')}"; + ".getFirstCharAt(" + stringValue + ",'Z')}"; } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/IDHelper.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/IDHelper.java index 13bc06c..10b44ba 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/IDHelper.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/IDHelper.java @@ -87,11 +87,7 @@ public class IDHelper { } public String getUniqueId(Object object) { - String result = uniqueIds.get(object); - if (result == null) { - result = "$u" + uniqueIds.size(); - uniqueIds.put(object, result); - } + String result = uniqueIds.computeIfAbsent(object, k -> "$u" + uniqueIds.size()); if (log.isTraceEnabled()) { log.trace("new uniqueid = " + result); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java index c6024aa..447c691 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXCompiler.java @@ -22,6 +22,10 @@ package org.nuiton.jaxx.compiler; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.eugene.java.JavaGeneratorUtil; import org.nuiton.jaxx.compiler.binding.DataBindingHelper; import org.nuiton.jaxx.compiler.css.StylesheetHelper; import org.nuiton.jaxx.compiler.finalizers.JAXXCompilerFinalizer; @@ -29,7 +33,6 @@ import org.nuiton.jaxx.compiler.java.JavaElementFactory; import org.nuiton.jaxx.compiler.java.JavaField; import org.nuiton.jaxx.compiler.java.JavaFile; import org.nuiton.jaxx.compiler.java.JavaFileGenerator; -import org.nuiton.jaxx.compiler.java.JavaMethod; import org.nuiton.jaxx.compiler.java.parser.ParseException; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; @@ -45,11 +48,6 @@ import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import org.nuiton.jaxx.runtime.css.Rule; import org.nuiton.jaxx.runtime.css.Stylesheet; import org.nuiton.jaxx.runtime.spi.UIHandler; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.eugene.java.JavaGeneratorUtil; -import org.nuiton.eugene.java.extension.ImportsManager; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.Attributes; @@ -371,7 +369,7 @@ public class JAXXCompiler { if (defaultDecorator == null) { throw new IllegalArgumentException( "could not find default decorator : " + - configuration.getDefaultDecoratorClass() + configuration.getDefaultDecoratorClass() ); } idHelper = new IDHelper(configuration.isOptimize()); @@ -510,14 +508,14 @@ public class JAXXCompiler { JavaGeneratorUtil.splitFqnList(interfacesStr, ','); if (log.isDebugEnabled()) { log.debug("detect interfaces : " + - Arrays.toString(interfaces)); + Arrays.toString(interfaces)); } symbolTable.setInterfaces(interfaces); } catch (Exception e) { // the syntax is not valid (missed one >) throw new CompilerException( "Syntax error of interfaces " + - interfacesStr); + interfacesStr); } // StringTokenizer stk = new StringTokenizer(interfacesStr, ","); // List<String> tmp = new ArrayList<String>(); @@ -567,14 +565,14 @@ public class JAXXCompiler { // handler if so. // The real handler is used during the second pass. TagHandler handler = namespace != null && namespace.endsWith("*") ? - firstPassClassTagHandler : - TagManager.getTagHandler(tag.getNamespaceURI(), - localName, - namespacePrefix, - this - ); + firstPassClassTagHandler : + TagManager.getTagHandler(tag.getNamespaceURI(), + localName, + namespacePrefix, + this + ); if (!firstPassClassTagHandler.equals(handler) && - handler instanceof DefaultObjectHandler) { + handler instanceof DefaultObjectHandler) { fullClassName = ((DefaultObjectHandler) handler).getBeanClass().getName(); handler = firstPassClassTagHandler; @@ -585,28 +583,24 @@ public class JAXXCompiler { // register an initializer which will create the // CompiledObject after pass 1 - registerInitializer(new Runnable() { - - @Override - public void run() { - DefaultObjectHandler handler = - (DefaultObjectHandler) TagManager.getTagHandler( - null, - finalClassName, - JAXXCompiler.this - ); - if (handler == null) { - throw new CompilerException( - "Internal error: missing TagHandler for '" + - finalClassName + "'"); - } - handler.registerCompiledObject(tag, JAXXCompiler.this); + registerInitializer(() -> { + DefaultObjectHandler handler1 = + (DefaultObjectHandler) TagManager.getTagHandler( + null, + finalClassName, + JAXXCompiler.this + ); + if (handler1 == null) { + throw new CompilerException( + "Internal error: missing TagHandler for '" + + finalClassName + "'"); } + handler1.registerCompiledObject(tag, JAXXCompiler.this); }); } if (handler == null) { reportError("Could not find a Java class corresponding to: <" + - tag.getTagName() + ">"); + tag.getTagName() + ">"); failed = true; } else { try { @@ -620,7 +614,7 @@ public class JAXXCompiler { if (finished != tag) { throw new IllegalStateException( "internal error: just finished compiling " + tag + - ", but top of tagsBeingCompiled stack is " + finished); + ", but top of tagsBeingCompiled stack is " + finished); } } @@ -636,7 +630,7 @@ public class JAXXCompiler { if (handler == null) { reportError("Could not find a Java class corresponding to: <" + - tag.getTagName() + ">"); + tag.getTagName() + ">"); failed = true; } else { handler.compileSecondPass(tag, this); @@ -646,7 +640,7 @@ public class JAXXCompiler { if (!tag.equals(finished)) { throw new RuntimeException( "internal error: just finished compiling " + tag + - ", but top of tagsBeingCompiled stack is " + finished); + ", but top of tagsBeingCompiled stack is " + finished); } } @@ -731,7 +725,7 @@ public class JAXXCompiler { if (!tagsBeingCompiled.isEmpty()) { throw new RuntimeException( "Internal error: starting pass two, but tagsBeingCompiled" + - " is not empty: " + tagsBeingCompiled); + " is not empty: " + tagsBeingCompiled); } if (isUseHandler()) { @@ -758,7 +752,7 @@ public class JAXXCompiler { } } catch (ClassNotFoundException e) { - throw new RuntimeException("Coul not find class ",e); + throw new RuntimeException("Coul not find class ", e); } JavaField field = JavaElementFactory.newField( @@ -843,9 +837,9 @@ public class JAXXCompiler { String id = object.getId(); if (ids.containsKey(object)) { reportError("object '" + object + - "' is already registered with id '" + - ids.get(object) + "', cannot re-register as '" + id + - "'" + "' is already registered with id '" + + ids.get(object) + "', cannot re-register as '" + id + + "'" ); } if (objects.containsKey(id) && !(objects.get(id) instanceof Element)) { @@ -868,7 +862,7 @@ public class JAXXCompiler { public boolean inlineCreation(CompiledObject object) { return object.getId().startsWith("$") && - object.getInitializationCode(this).length() < INLINE_THRESHOLD; + object.getInitializationCode(this).length() < INLINE_THRESHOLD; } public void checkOverride(CompiledObject object) throws CompilerException { @@ -887,9 +881,9 @@ public class JAXXCompiler { if (!f.getType().isAssignableFrom(object.getObjectClass())) { reportError( "attempting to redefine superclass member '" + - fieldName + "' as incompatible type (was " + - f.getType() + ", redefined as " + - object.getObjectClass() + ")" + fieldName + "' as incompatible type (was " + + f.getType() + ", redefined as " + + object.getObjectClass() + ")" ); } object.setOverride(true); @@ -901,9 +895,9 @@ public class JAXXCompiler { getImportedType(getCanonicalName(object)); if (log.isDebugEnabled()) { log.debug("Simple type for " + object.getId() - + " : " + getCanonicalName(object) + - " against : " + - getCanonicalName(f.getType())); + + " : " + getCanonicalName(object) + + " against : " + + getCanonicalName(f.getType())); } object.setSimpleType(simpleType); } @@ -927,18 +921,9 @@ public class JAXXCompiler { public void registerEventHandler(EventHandler handler) { String objectCode = handler.getObjectCode(); - Map<ClassDescriptor, List<EventHandler>> listeners = - eventHandlers.get(objectCode); - if (listeners == null) { - listeners = new HashMap<>(); - eventHandlers.put(objectCode, listeners); - } + Map<ClassDescriptor, List<EventHandler>> listeners = eventHandlers.computeIfAbsent(objectCode, k -> new HashMap<>()); ClassDescriptor listenerClass = handler.getListenerClass(); - List<EventHandler> handlerList = listeners.get(listenerClass); - if (handlerList == null) { - handlerList = new ArrayList<>(); - listeners.put(listenerClass, handlerList); - } + List<EventHandler> handlerList = listeners.computeIfAbsent(listenerClass, k -> new ArrayList<>()); handlerList.add(handler); } @@ -981,8 +966,8 @@ public class JAXXCompiler { public void addScriptMethod(MethodDescriptor method) { if (method.getName().equals("main") && - method.getParameterTypes().length == 1 && - method.getParameterTypes()[0].getName().equals("[Ljava.lang.String;")) { + method.getParameterTypes().length == 1 && + method.getParameterTypes()[0].getName().equals("[Ljava.lang.String;")) { setMainDeclared(true); } symbolTable.getScriptMethods().add(method); @@ -999,7 +984,7 @@ public class JAXXCompiler { } script = script.trim(); if (!"".equals(script) && !script.endsWith("}") && - !script.endsWith(";")) { + !script.endsWith(";")) { script += ";"; } scriptManager.registerScript(script); @@ -1009,8 +994,8 @@ public class JAXXCompiler { if (!sourceFile.equals(pop)) { throw new RuntimeException( "leaving registerScript(), but " + sourceFile + - " was not the top entry on the stack (found " + pop - + " instead)"); + " was not the top entry on the stack (found " + pop + + " instead)"); } } } @@ -1053,7 +1038,7 @@ public class JAXXCompiler { Stylesheet style = StylesheetHelper.processStylesheet(content); registerStylesheet(style); } catch (CompilerException e) { - String message= "Css file content is not valid :" + styleFile; + String message = "Css file content is not valid :" + styleFile; if (e instanceof org.nuiton.jaxx.compiler.css.parser.ParseException) { org.nuiton.jaxx.compiler.css.parser.ParseException parseException = (org.nuiton.jaxx.compiler.css.parser.ParseException) e; @@ -1070,11 +1055,10 @@ public class JAXXCompiler { public void applyStylesheets() { for (Object o : new ArrayList<>(objects.values())) { CompiledObject object = (CompiledObject) o; - DefaultObjectHandler tagHandler = - TagManager.getTagHandler(object.getObjectClass()); + DefaultObjectHandler tagHandler = TagManager.getTagHandler(object.getObjectClass()); if (log.isDebugEnabled()) { log.debug("will apply css on object " + object.getId() + - " from handler " + tagHandler); + " from handler " + tagHandler); } tagHandler.applyStylesheets(object, this); } @@ -1131,8 +1115,8 @@ public class JAXXCompiler { if (lineNumber != null) { buffer.append(":"); buffer.append(sourceFiles.size() == 1 ? - Integer.parseInt(lineNumber) + lineOffset : - lineOffset + 1 + Integer.parseInt(lineNumber) + lineOffset : + lineOffset + 1 ); } buffer.append(getLineSeparator()).append(warning.trim()); @@ -1158,7 +1142,7 @@ public class JAXXCompiler { public void reportError(String extraMessage, CompilerException ex) { String message = ex.getMessage(); if (UnsupportedAttributeException.class.equals(ex.getClass()) || - UnsupportedTagException.class.equals(ex.getClass())) { + UnsupportedTagException.class.equals(ex.getClass())) { String exceptionName = ex.getClass().getName(); message = exceptionName.substring( exceptionName.lastIndexOf(".") + 1) + ": " + message; @@ -1174,8 +1158,8 @@ public class JAXXCompiler { currentTag = tagsBeingCompiled.peek(); } reportError(currentTag, extraMessage != null ? - extraMessage + message : - message, lineOffset + extraMessage + message : + message, lineOffset ); } @@ -1207,7 +1191,7 @@ public class JAXXCompiler { } StringBuilder buffer = new StringBuilder(); buffer.append(errorFile != null ? errorFile.getPath() : - "<unknown source>"); + "<unknown source>"); if (lineNumber > 0) { buffer.append(":").append(lineNumber); } @@ -1294,12 +1278,6 @@ public class JAXXCompiler { return null; } - public MethodDescriptor[] getScriptMethods() { - List<MethodDescriptor> scriptMethods = symbolTable.getScriptMethods(); - return scriptMethods.toArray( - new MethodDescriptor[scriptMethods.size()]); - } - public MethodDescriptor getScriptMethod(String methodName) { for (MethodDescriptor m : symbolTable.getScriptMethods()) { if (methodName.equals(m.getName())) { @@ -1313,10 +1291,6 @@ public class JAXXCompiler { return failed; } - public IDHelper getIdHelper() { - return idHelper; - } - /** * Returns a <code>ClassLoader</code> which searches the user-specified * class path in addition to the normal system class path. @@ -1331,7 +1305,7 @@ public class JAXXCompiler { } else { throw new NullPointerException( "compiler configuration requires a classLoader! :\n" + - configuration); + configuration); } } @@ -1456,15 +1430,6 @@ public class JAXXCompiler { lateInitializer.append(code); } - public boolean hasMethod(String methodName) { - for (JavaMethod method : getJavaFile().getMethods()) { - if (methodName.equals(method.getName())) { - return true; - } - } - return false; - } - /*------------------------------------------------------------------------*/ /*-- Other methods -------------------------------------------------------*/ /*------------------------------------------------------------------------*/ @@ -1514,7 +1479,7 @@ public class JAXXCompiler { if (!engine.isCompileFirstPassTask()) { throw new IllegalStateException( "Internal error: adding dependency class " + - className + " during second compilation pass"); + className + " during second compilation pass"); } //FIXME tchemit 20100518 Must unify this with ClassDescriptorHelper to use the less costless resource @@ -1528,11 +1493,11 @@ public class JAXXCompiler { } String jaxxFileName = className.substring(className.lastIndexOf(".") + 1) + - ".jaxx"; + ".jaxx"; assert jaxxFile.getName().equalsIgnoreCase(jaxxFileName) : "expecting file name to match " + - className + ", but found " + jaxxFile.getName(); + className + ", but found " + jaxxFile.getName(); if (jaxxFile.getName().equals(jaxxFileName)) { engine.addFileToCompile(jaxxFile, className); } @@ -1565,7 +1530,7 @@ public class JAXXCompiler { } } catch (IOException e) { reportError("Could not read file " + file + " for reason " + - e.getMessage()); + e.getMessage()); return ""; } } @@ -1607,11 +1572,11 @@ public class JAXXCompiler { String msg; if (attribute != null) { msg = "tag '" + tag.getLocalName() + - "' could not find the reference '" + reference + - "' on attribute [" + attribute + "]"; + "' could not find the reference '" + reference + + "' on attribute [" + attribute + "]"; } else { msg = "tag '" + tag.getLocalName() + - "' could not find the reference '" + reference + "'"; + "' could not find the reference '" + reference + "'"; } reportError(msg); } @@ -1672,7 +1637,7 @@ public class JAXXCompiler { } else { int dotPos = outputClassName.lastIndexOf("."); String packageName = dotPos != -1 ? - outputClassName.substring(0, dotPos) : null; + outputClassName.substring(0, dotPos) : null; String simpleClassName = outputClassName.substring(dotPos + 1); javaFile = JavaElementFactory.newFile( @@ -1687,7 +1652,7 @@ public class JAXXCompiler { int dotPos = getOutputClassName().lastIndexOf("."); String packageName = dotPos != -1 ? - getOutputClassName().substring(0, dotPos) : null; + getOutputClassName().substring(0, dotPos) : null; String simpleClassName = getOutputClassName().substring(dotPos + 1); CompiledObject compiledObject = getRootObject(); @@ -1900,7 +1865,7 @@ public class JAXXCompiler { } urlString = urlString.substring("file:".length()); if (urlString.startsWith("/") && - System.getProperty("os.name").startsWith("Windows")) { + System.getProperty("os.name").startsWith("Windows")) { urlString = urlString.substring(1); } try { @@ -2058,36 +2023,6 @@ public class JAXXCompiler { return result; } - /** - * @return the javafile import manager - * @since 2.4 - * @deprecated since 2.4.1, will be removed in version 3.0 : do not want - * to expose eugene export manager in rest of api, this is purpose of - * JavaFile only - */ - @Deprecated - public ImportsManager getImportManager() { - return getJavaFile().getImportManager(); - } - - /** - * @since 2.4 - * @deprecated since 2.4.1, will be removed in version 3.0, has no effect do not use it... - */ - @Deprecated - public boolean isNeedSwingUtil() { - return needSwingUtil; - } - - /** - * @since 2.4 - * @deprecated since 2.4.1, will be removed in version 3.0, has no effect do not use it... - */ - @Deprecated - public void setNeedSwingUtil(boolean needSwingUtil) { - this.needSwingUtil = needSwingUtil; - } - protected String uiHandler; public String getUiHandler() { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXEngine.java index e7b8349..602ad7c 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXEngine.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tasks.CompileFirstPassTask; import org.nuiton.jaxx.compiler.tasks.CompileSecondPassTask; @@ -33,8 +35,6 @@ import org.nuiton.jaxx.compiler.tasks.InitTask; import org.nuiton.jaxx.compiler.tasks.JAXXEngineTask; import org.nuiton.jaxx.compiler.tasks.ProfileTask; import org.nuiton.jaxx.compiler.tasks.StyleSheetTask; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.nuiton.util.StringUtil; import java.io.File; @@ -189,7 +189,7 @@ public class JAXXEngine { public boolean isCompileFirstPassTask() { return currentTask != null && - CompileFirstPassTask.TASK_NAME.equals(currentTask.getName()); + CompileFirstPassTask.TASK_NAME.equals(currentTask.getName()); } /** Resets all state in preparation for a new compilation session. */ @@ -264,7 +264,7 @@ public class JAXXEngine { if (decorator == null) { throw new IllegalArgumentException( "could not find decorator with key " + name + - " (known decorators : " + decorators.keySet() + ")"); + " (known decorators : " + decorators.keySet() + ")"); } return decorator; } @@ -324,12 +324,12 @@ public class JAXXEngine { long t0 = System.nanoTime(); if (isVerbose()) { log.info("Start task '" + task.getName() + "' on " + - compilingFiles.size() + " file(s)"); + compilingFiles.size() + " file(s)"); } success = task.perform(this); if (isVerbose()) { log.info("task '" + task.getName() + "' done in " + - StringUtil.convertTime(System.nanoTime() - t0) + StringUtil.convertTime(System.nanoTime() - t0) ); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXFactory.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXFactory.java index b404bee..ce7a999 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXFactory.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXFactory.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.compiler; -import org.nuiton.jaxx.compiler.spi.Initializer; -import org.nuiton.jaxx.compiler.tags.TagManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.spi.Initializer; +import org.nuiton.jaxx.compiler.tags.TagManager; import java.io.File; import java.util.ServiceLoader; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXProfile.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXProfile.java index 34c0e4c..f0bbc88 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXProfile.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/JAXXProfile.java @@ -137,12 +137,12 @@ public class JAXXProfile { if (t0 == null) { throw new NullPointerException( "could not find time for " + keyOne + - " on compiler " + c.getOutputClassName()); + " on compiler " + c.getOutputClassName()); } if (t1 == null) { throw new NullPointerException( "could not find time for " + keyTwo + - " on compiler " + c.getOutputClassName()); + " on compiler " + c.getOutputClassName()); } long delta = t1 - t0; result.put(c, delta); @@ -198,7 +198,7 @@ public class JAXXProfile { ProfileResult total = newProfileResult(cfp, csp, ssp, fp, gp); String reportPattern = "\n|%1$-" + maxLength + - "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|%7$15s|"; + "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|%7$15s|"; char[] tmpC = new char[maxLength]; Arrays.fill(tmpC, '-'); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBinding.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBinding.java index c89a396..74b24f3 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBinding.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBinding.java @@ -22,16 +22,16 @@ package org.nuiton.jaxx.compiler.binding; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.java.JavaFileGenerator; import org.nuiton.jaxx.compiler.java.JavaMethod; import org.nuiton.jaxx.compiler.types.TypeManager; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBindingHelper.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBindingHelper.java index 9fc97d1..8569a76 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBindingHelper.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataBindingHelper.java @@ -237,11 +237,11 @@ public class DataBindingHelper { while (openCount > 0) { pos++; int leftPos = leftBraceMatcher.find(pos) ? - Math.max(leftBraceMatcher.start(1), leftBraceMatcher.start(2)) : - -1; + Math.max(leftBraceMatcher.start(1), leftBraceMatcher.start(2)) : + -1; rightPos = rightBraceMatcher.find(pos) ? - Math.max(rightBraceMatcher.start(1), rightBraceMatcher.start(2)) : - -1; + Math.max(rightBraceMatcher.start(1), rightBraceMatcher.start(2)) : + -1; assert leftPos == -1 || leftPos >= pos; assert rightPos == -1 || rightPos >= pos; if (leftPos != -1 && leftPos < rightPos) { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataSource.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataSource.java index 691a332..a90b9cc 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataSource.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/DataSource.java @@ -22,6 +22,11 @@ package org.nuiton.jaxx.compiler.binding; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -42,11 +47,6 @@ import org.nuiton.jaxx.compiler.tags.DefaultObjectHandler; import org.nuiton.jaxx.compiler.tags.TagManager; import org.nuiton.jaxx.compiler.types.TypeManager; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.beans.Introspector; import java.io.StringReader; @@ -259,7 +259,7 @@ public class DataSource { */ private void scanNode(SimpleNode node) throws CompilerException { if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION || - node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { + node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { return; } if (log.isTraceEnabled()) { @@ -599,14 +599,14 @@ public class DataSource { objectCode = objectCode.trim(); } boolean needTest = objectCode != null && - !compiler.getRootObject().getId().equals(objectCode); + !compiler.getRootObject().getId().equals(objectCode); if (!needTest) { objectCode = null; } if (log.isDebugEnabled()) { log.debug("try to add listener [dependencySymbol:" + - dependencySymbol + ", objectCode:" + objectCode + - ", addCode:" + addCode + "]"); + dependencySymbol + ", objectCode:" + objectCode + + ", addCode:" + addCode + "]"); } for (DataListener tracker : trackers) { @@ -868,7 +868,7 @@ public class DataSource { MethodDescriptor method) { ClassDescriptor returnType = method.getReturnType(); if (returnType == null && - contextClass.equals(compiler.getRootObject().getObjectClass())) { + contextClass.equals(compiler.getRootObject().getObjectClass())) { // special case to deal with generics (we need to // have the concrete type)... diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/JavaParserUtil.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/JavaParserUtil.java index 8bf9c93..e4ba505 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/JavaParserUtil.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/JavaParserUtil.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.compiler.binding; -import org.nuiton.jaxx.compiler.java.parser.JavaParserTreeConstants; -import org.nuiton.jaxx.compiler.java.parser.SimpleNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.java.parser.JavaParserTreeConstants; +import org.nuiton.jaxx.compiler.java.parser.SimpleNode; import java.beans.Introspector; import java.util.ArrayList; @@ -52,13 +52,7 @@ public class JavaParserUtil { */ private static final Log log = LogFactory.getLog(JavaParserUtil.class); - private static final Comparator<String> STRING_LENGTH_COMPARATOR = new Comparator<String>() { - - @Override - public int compare(String o1, String o2) { - return o1.length() - o2.length(); - } - }; + private static final Comparator<String> STRING_LENGTH_COMPARATOR = Comparator.comparingInt(String::length); /** * Obtain all expressions of a node and store them in {@code store} with their dependencies expressions. @@ -73,7 +67,7 @@ public class JavaParserUtil { public static void getExpressions(SimpleNode node, Map<SimpleNode, List<SimpleNode>> store, List<SimpleNode> literals, Map<SimpleNode, List<SimpleNode>> casts) { if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION || - node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { + node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { //TODO add all others non intressing type of node to reject directly return; } @@ -194,7 +188,7 @@ public class JavaParserUtil { expression = tmp; } } - if (expression.indexOf(".") == -1) { + if (!expression.contains(".")) { // not an expression to keep // a simple field use like 'isEnabled()' or 'field' // or a not method invocation @@ -203,7 +197,7 @@ public class JavaParserUtil { } continue; } - if (expression.indexOf("(") == -1) { + if (!expression.contains("(")) { // expression with no called method, probably is a constant // should test it, but for the moment just limits bindings to interfield expressions : a.b // is not possible, use a.getB() instead of @@ -223,7 +217,7 @@ public class JavaParserUtil { return null; } - Collections.sort(result, STRING_LENGTH_COMPARATOR); + result.sort(STRING_LENGTH_COMPARATOR); if (log.isDebugEnabled()) { log.debug("======= start with values : " + result); } @@ -250,7 +244,7 @@ public class JavaParserUtil { StringBuilder buffer = new StringBuilder(); String last = paths[0].trim(); - if (last.indexOf("(") > -1) { + if (last.contains("(")) { // first path is a method invocation or a cast // at the moment allow cast only on the first member and do no perform any check @@ -343,19 +337,13 @@ public class JavaParserUtil { if (log.isDebugEnabled()) { log.debug("detected cast " + nodeExpression + " for last expression " + lastExpressionNode.getText()); } - List<SimpleNode> simpleNodeList = casts.get(lastExpressionNode); - if (simpleNodeList == null) { - simpleNodeList = new ArrayList<>(); - casts.put(lastExpressionNode, simpleNodeList); - } + List<SimpleNode> simpleNodeList = casts.computeIfAbsent(lastExpressionNode, k -> new ArrayList<>()); simpleNodeList.add(node); } if (node.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION) { - if (store.get(node) == null) { - store.put(node, new ArrayList<SimpleNode>()); - } + store.computeIfAbsent(node, k -> new ArrayList<>()); if (lastExpressionNode == null) { // premiere entree dans la methode (detection d'une nouvelle expression) diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/PseudoClassDataBinding.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/PseudoClassDataBinding.java index 5ad25b5..2b4f83e 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/PseudoClassDataBinding.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/PseudoClassDataBinding.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.binding; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -29,8 +31,6 @@ import org.nuiton.jaxx.compiler.java.JavaFileGenerator; import org.nuiton.jaxx.compiler.java.parser.JavaParser; import org.nuiton.jaxx.compiler.java.parser.JavaParserTreeConstants; import org.nuiton.jaxx.compiler.java.parser.SimpleNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.io.StringReader; @@ -88,8 +88,8 @@ public class PseudoClassDataBinding extends DataBinding { if (node.getId() == JavaParserTreeConstants.JJTNAME) { String name = node.getText(); if (name.equals("object") || - (name.indexOf(".") != -1 && - name.substring(0, name.indexOf(".")).trim().equals("object"))) { + (name.contains(".") && + name.substring(0, name.indexOf(".")).trim().equals("object"))) { node.firstToken.image = id; } } else { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/writers/DefaultJAXXBindingWriter.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/writers/DefaultJAXXBindingWriter.java index be879dc..8414e77 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/writers/DefaultJAXXBindingWriter.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/binding/writers/DefaultJAXXBindingWriter.java @@ -93,25 +93,25 @@ public class DefaultJAXXBindingWriter extends AbstractJAXXBindingWriter<DefaultJ List<JavaMethod> bMethods = binding.getMethods(); bMethods.add(0, JavaElementFactory.newMethod( - PUBLIC, - JAXXCompilerFinalizer.TYPE_VOID, - DefaultFinalizer.METHOD_NAME_REMOVE_DATA_BINDING, - removeBuffer.toString(), - true) + PUBLIC, + JAXXCompilerFinalizer.TYPE_VOID, + DefaultFinalizer.METHOD_NAME_REMOVE_DATA_BINDING, + removeBuffer.toString(), + true) ); bMethods.add(0, JavaElementFactory.newMethod( - PUBLIC, - JAXXCompilerFinalizer.TYPE_VOID, - DefaultFinalizer.METHOD_NAME_PROCESS_DATA_BINDING, - binding.getProcessDataBinding(), - true) + PUBLIC, + JAXXCompilerFinalizer.TYPE_VOID, + DefaultFinalizer.METHOD_NAME_PROCESS_DATA_BINDING, + binding.getProcessDataBinding(), + true) ); bMethods.add(0, JavaElementFactory.newMethod( - PUBLIC, - JAXXCompilerFinalizer.TYPE_VOID, - DefaultFinalizer.METHOD_NAME_APPLY_DATA_BINDING, - addBuffer.toString(), - true) + PUBLIC, + JAXXCompilerFinalizer.TYPE_VOID, + DefaultFinalizer.METHOD_NAME_APPLY_DATA_BINDING, + addBuffer.toString(), + true) ); writeInvocationMethod(binding, trackers, generator, buffer, bMethods); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/StylesheetHelper.java index 06bacae..8f0a7b1 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/StylesheetHelper.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.css; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -43,8 +45,6 @@ import org.nuiton.jaxx.runtime.css.Pseudoclasses; import org.nuiton.jaxx.runtime.css.Rule; import org.nuiton.jaxx.runtime.css.Selector; import org.nuiton.jaxx.runtime.css.Stylesheet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -150,7 +150,7 @@ public class StylesheetHelper { default: throw new IllegalStateException( "unexpected child of Selector node, type=" + - child.getId()); + child.getId()); } } @@ -248,7 +248,7 @@ public class StylesheetHelper { for (Map.Entry<String, String> e : properties.entrySet()) { String value = e.getValue(); if (value.equals(Rule.INLINE_ATTRIBUTE) || - value.equals(Rule.DATA_BINDING)) { + value.equals(Rule.DATA_BINDING)) { continue; } @@ -269,17 +269,12 @@ public class StylesheetHelper { Selector[] selectors = pseudoClass1.getSelectors(); for (Selector selector : selectors) { if (appliesTo(selector, object) == - Selector.PSEUDOCLASS_APPLIES) { + Selector.PSEUDOCLASS_APPLIES) { properties = pseudoClass1.getProperties(); String pseudoClass = selector.getPseudoClass(); // TODO: overrides by downstream pseudoclasses are not handled Map<String, String> combinedProperties = - combinedPseudoClasses.get(pseudoClass); - if (combinedProperties == null) { - combinedProperties = new HashMap<>(); - combinedPseudoClasses.put(pseudoClass, - combinedProperties); - } + combinedPseudoClasses.computeIfAbsent(pseudoClass, k -> new HashMap<>()); combinedProperties.putAll(properties); } } @@ -376,7 +371,7 @@ public class StylesheetHelper { ); if (log.isDebugEnabled()) { log.debug("will test if databinding : [" + e.getValue() + - "] type=" + type); + "] type=" + type); } String dataBindingCode = DataBindingHelper.processDataBindings(e.getValue()); @@ -386,7 +381,7 @@ public class StylesheetHelper { if (dataBindingCode != null) { String code = object.getId() + "." + property + "." + priority; valueCode = "new " + dataBindingPrefix + "(" + - TypeManager.getJavaCode(code) + ")"; + TypeManager.getJavaCode(code) + ")"; DataBinding binding = new DataBinding( code, dataBindingCode, @@ -403,11 +398,11 @@ public class StylesheetHelper { } else { try { Class<?> typeClass = type != null ? - ClassDescriptorHelper.getClass( - type.getName(), - type.getClassLoader() - ) : - null; + ClassDescriptorHelper.getClass( + type.getName(), + type.getClassLoader() + ) : + null; valueCode = TypeManager.getJavaCode( TypeManager.convertFromString(e.getValue(), typeClass) ); @@ -493,8 +488,8 @@ public class StylesheetHelper { try { Class<?> typeClass = type != null ? - ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : - null; + ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : + null; valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass)); } catch (ClassNotFoundException ex) { compiler.reportError("could not find class " + type.getName()); @@ -533,10 +528,10 @@ public class StylesheetHelper { String unwrappedValue = unwrap(type, "value"); buffer.append(" "); buffer.append(handler.getSetPropertyCode( - object.getJavaCode(), - property, - "(" + simpleType + ") " + unwrappedValue, - compiler) + object.getJavaCode(), + property, + "(" + simpleType + ") " + unwrappedValue, + compiler) ); buffer.append(eol); buffer.append("}").append(eol); @@ -593,7 +588,7 @@ public class StylesheetHelper { for (Rule rule : s.getRules()) { int apply = appliesTo(rule, object); if (apply == Selector.ALWAYS_APPLIES || - apply == Selector.ALWAYS_APPLIES_INHERIT_ONLY) { + apply == Selector.ALWAYS_APPLIES_INHERIT_ONLY) { if (result == null) { result = new HashMap<>(); } @@ -601,7 +596,7 @@ public class StylesheetHelper { rule.getProperties().entrySet()) { String property = entry.getKey(); if (apply == Selector.ALWAYS_APPLIES || - handler.isPropertyInherited(property)) { + handler.isPropertyInherited(property)) { result.put(property, entry.getValue()); } } @@ -629,8 +624,8 @@ public class StylesheetHelper { boolean dataBinding) { Map<String, String> properties = new HashMap<>(); properties.put(propertyName, dataBinding ? - Rule.DATA_BINDING : - Rule.INLINE_ATTRIBUTE); + Rule.DATA_BINDING : + Rule.INLINE_ATTRIBUTE); return new Rule(new Selector[]{ new Selector(null, null, null, object.getId(), true)}, properties @@ -643,7 +638,7 @@ public class StylesheetHelper { for (Selector selector : rule.getSelectors()) { appliesTo = Math.max(appliesTo(selector, object), appliesTo); if (appliesTo == Selector.ALWAYS_APPLIES || - appliesTo == Selector.ALWAYS_APPLIES_INHERIT_ONLY) { + appliesTo == Selector.ALWAYS_APPLIES_INHERIT_ONLY) { break; } } @@ -665,7 +660,7 @@ public class StylesheetHelper { do { String name = javaClass.getName(); if (name.equals(javaClassName) || - name.substring(name.lastIndexOf(".") + 1).equals(javaClassName)) { + name.substring(name.lastIndexOf(".") + 1).equals(javaClassName)) { classMatch = true; break; } @@ -674,22 +669,22 @@ public class StylesheetHelper { } boolean styleClassMatch = styleClass == null || - styleClass.equals(parent.getStyleClass()); + styleClass.equals(parent.getStyleClass()); String objectId = parent.getId(); objectId = objectId.substring(objectId.lastIndexOf(".") + 1); boolean idMatch = id == null || - (' ' + objectId + ' ').contains(' ' + id + ' '); + (' ' + objectId + ' ').contains(' ' + id + ' '); if (classMatch && styleClassMatch && idMatch) { if (pseudoClass != null) { return inheritOnly ? - Selector.PSEUDOCLASS_APPLIES_INHERIT_ONLY : - Selector.PSEUDOCLASS_APPLIES; + Selector.PSEUDOCLASS_APPLIES_INHERIT_ONLY : + Selector.PSEUDOCLASS_APPLIES; } else { return inheritOnly ? - Selector.ALWAYS_APPLIES_INHERIT_ONLY : - Selector.ALWAYS_APPLIES; + Selector.ALWAYS_APPLIES_INHERIT_ONLY : + Selector.ALWAYS_APPLIES; } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/SimpleCharStream.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/SimpleCharStream.java index 8a8fb2c..0c81fd2 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/SimpleCharStream.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/SimpleCharStream.java @@ -359,7 +359,7 @@ public class SimpleCharStream { return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); + new String(buffer, 0, bufpos + 1); } public char[] GetSuffix(int len) { @@ -402,7 +402,7 @@ public class SimpleCharStream { int nextColDiff, columnDiff = 0; while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/TokenMgrError.java index 2223c92..e6199d9 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/css/parser/TokenMgrError.java @@ -111,10 +111,10 @@ public class TokenMgrError extends Error { */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return "Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : "\"" + addEscapes(String.valueOf(curChar)) + "\"" + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""; + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : "\"" + addEscapes(String.valueOf(curChar)) + "\"" + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""; } /** diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java index c6220f4..0e77230 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -61,7 +61,7 @@ public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator String type = compiler.getImportedType(SwingUtil.class); child.setChildJavaCode( type + - ".boxComponentWithJxLayer(" + javaCode + ")"); + ".boxComponentWithJxLayer(" + javaCode + ")"); break; } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index d5747a7..b11c288 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -22,6 +22,9 @@ package org.nuiton.jaxx.compiler.decorators; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompiledObjectDecorator; import org.nuiton.jaxx.compiler.CompilerException; @@ -33,9 +36,6 @@ import org.nuiton.jaxx.compiler.java.JavaFile; import org.nuiton.jaxx.compiler.java.JavaMethod; import org.nuiton.jaxx.compiler.script.ScriptInitializer; import org.nuiton.jaxx.compiler.types.TypeManager; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.lang.reflect.Modifier; import java.util.Map.Entry; @@ -110,7 +110,7 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { } else { int access = id.startsWith("$") ? Modifier.PRIVATE : - Modifier.PROTECTED; + Modifier.PROTECTED; if (root.equals(object)) { // add the generic type if required @@ -171,7 +171,7 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { StringBuilder init = new StringBuilder(); if (compiler.getRootObject().equals(object) || - compiler.inlineCreation(object)) { + compiler.inlineCreation(object)) { result.append("// inline creation of ").append(object.getId()); } @@ -240,8 +240,8 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { String code = result.toString(); if (!compiler.inlineCreation(object) && - object.isOverride() && - superCall.equals(code.trim())) { + object.isOverride() && + superCall.equals(code.trim())) { // special case : when override but do nothing more // method creation can be skipped @@ -279,11 +279,11 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { code.append(object.getAdditionMethodName()).append("();").append(eol); // additionCode = "if (!allComponentsCreated) {" + eol + " return;" + eol + "}" + eol + additionCode; javaFile.addMethod(JavaElementFactory.newMethod( - Modifier.PROTECTED, - JAXXCompilerFinalizer.TYPE_VOID, - object.getAdditionMethodName(), - additionCode, - false) + Modifier.PROTECTED, + JAXXCompilerFinalizer.TYPE_VOID, + object.getAdditionMethodName(), + additionCode, + false) ); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index f1c778f..cc13ceb 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -102,33 +102,33 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora if (log.isDebugEnabled()) { log.debug("Add " + validatorInterface + " on " + - javaFile.getName() + " : parent " + - JAXXCompiler.getCanonicalName( - compiler.getRootObject())); + javaFile.getName() + " : parent " + + JAXXCompiler.getCanonicalName( + compiler.getRootObject())); } javaFile.addInterface(validatorInterface.getName() + - "<" + helpBrokerFQN + ">"); + "<" + helpBrokerFQN + ">"); } javaFile.addMethod(JavaElementFactory.newMethod( - Modifier.PUBLIC, - JAXXCompilerFinalizer.TYPE_VOID, - "registerHelpId", - "broker.installUI(component, helpId);", - true, - newArgument(helpBrokerFQN, "broker"), - newArgument(Component.class.getName(), "component"), - newArgument(JAXXCompilerFinalizer.TYPE_STRING, "helpId")) + Modifier.PUBLIC, + JAXXCompilerFinalizer.TYPE_VOID, + "registerHelpId", + "broker.installUI(component, helpId);", + true, + newArgument(helpBrokerFQN, "broker"), + newArgument(Component.class.getName(), "component"), + newArgument(JAXXCompilerFinalizer.TYPE_STRING, "helpId")) ); javaFile.addMethod(JavaElementFactory.newMethod( - Modifier.PUBLIC, - JAXXCompilerFinalizer.TYPE_VOID, - "showHelp", - "getBroker().showHelp(this, helpId);", - true, - newArgument(JAXXCompilerFinalizer.TYPE_STRING, "helpId")) + Modifier.PUBLIC, + JAXXCompilerFinalizer.TYPE_VOID, + "showHelp", + "getBroker().showHelp(this, helpId);", + true, + newArgument(JAXXCompilerFinalizer.TYPE_STRING, "helpId")) ); StringBuilder buffer = new StringBuilder(); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java index ccdfc1d..3b1d778 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.finalizers; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompiledObjectDecorator; import org.nuiton.jaxx.compiler.CompilerException; @@ -48,8 +50,6 @@ import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.SwingUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.awt.Container; import java.beans.PropertyChangeListener; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/SwingFinalizer.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/SwingFinalizer.java index 9fef3a5..65f054c 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/SwingFinalizer.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/SwingFinalizer.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.finalizers; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.java.JavaElementFactory; @@ -29,8 +31,6 @@ import org.nuiton.jaxx.compiler.java.JavaFile; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.runtime.swing.Application; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.SwingUtilities; import java.lang.reflect.Modifier; @@ -76,8 +76,8 @@ public class SwingFinalizer extends AbstractFinalizer { javaFile.addImport(SwingUtilities.class); String code = "SwingUtilities.invokeLater(new Runnable() { " + - "public void run() { new " + className + - "().setVisible(true); } });"; + "public void run() { new " + className + + "().setVisible(true); } });"; javaFile.addMethod(JavaElementFactory.newMethod( Modifier.PUBLIC | Modifier.STATIC, TYPE_VOID, diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/ValidatorFinalizer.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/ValidatorFinalizer.java index a943f34..abef1a5 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/ValidatorFinalizer.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/finalizers/ValidatorFinalizer.java @@ -24,6 +24,8 @@ package org.nuiton.jaxx.compiler.finalizers; import com.google.common.base.Joiner; import com.google.common.collect.Lists; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompiledObject.ChildRef; import org.nuiton.jaxx.compiler.CompilerException; @@ -35,14 +37,12 @@ import org.nuiton.jaxx.compiler.java.JavaFile; import org.nuiton.jaxx.compiler.tags.validator.BeanValidatorHandler; import org.nuiton.jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import org.nuiton.jaxx.compiler.types.TypeManager; -import org.nuiton.jaxx.validator.JAXXValidator; import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.validator.JAXXValidator; import org.nuiton.jaxx.validator.swing.SwingValidator; import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.jaxx.validator.swing.meta.Validator; import org.nuiton.jaxx.validator.swing.meta.ValidatorField; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -106,7 +106,7 @@ public class ValidatorFinalizer extends AbstractFinalizer { // box the child component in a JxLayer child.setChildJavaCode( type + - ".boxComponentWithJxLayer(" + javaCode + ")"); + ".boxComponentWithJxLayer(" + javaCode + ")"); } } } @@ -120,14 +120,14 @@ public class ValidatorFinalizer extends AbstractFinalizer { // javaFile.addImport(SwingValidatorUtil.class); String validatorUtilPrefix = compiler.getImportedType(SwingValidatorUtil.class) + - "."; + "."; compiler.getJavaFile().addMethod(JavaElementFactory.newMethod( - Modifier.PUBLIC, - TYPE_VOID, - "registerValidatorFields", - validatorUtilPrefix + "detectValidatorFields(this);", - true) + Modifier.PUBLIC, + TYPE_VOID, + "registerValidatorFields", + validatorUtilPrefix + "detectValidatorFields(this);", + true) ); builder.append("// register "); builder.append(validators.size()); @@ -176,17 +176,17 @@ public class ValidatorFinalizer extends AbstractFinalizer { String type = compiler.getImportedType(validatorClass); String initializer = "return (" + type + - "<?>) (validatorIds.contains(validatorId) ? " + - "getObjectById(validatorId) : null);"; + "<?>) (validatorIds.contains(validatorId) ? " + + "getObjectById(validatorId) : null);"; javaFile.addMethod(JavaElementFactory.newMethod( - Modifier.PUBLIC, - type + "<?>", - "getValidator", - initializer, - true, - JavaElementFactory.newArgument(TYPE_STRING, "validatorId")) + Modifier.PUBLIC, + type + "<?>", + "getValidator", + initializer, + true, + JavaElementFactory.newArgument(TYPE_STRING, "validatorId")) ); } @@ -202,7 +202,7 @@ public class ValidatorFinalizer extends AbstractFinalizer { String fieldType = compiler.getImportedType(ValidatorField.class); String validatorAnnotation = type + - "( validatorId = " + validatorId + ")"; + "( validatorId = " + validatorId + ")"; validatorField.addAnnotation(validatorAnnotation); // Map<String, String> fields = validator.getFields(); @@ -235,8 +235,8 @@ public class ValidatorFinalizer extends AbstractFinalizer { if (editor == null) { if (log.isDebugEnabled()) { String message = "Could not find editor [" + component + - "] for property(ies) [" + propertyNames + - "] for file " + javaFile.getName(); + "] for property(ies) [" + propertyNames + + "] for file " + javaFile.getName(); log.debug(message); } @@ -251,8 +251,8 @@ public class ValidatorFinalizer extends AbstractFinalizer { String errorMessage = "Could not find editor [" + component + - "] for property(ies) [" + propertyNames + - "] for file " + javaFile.getName(); + "] for property(ies) [" + propertyNames + + "] for file " + javaFile.getName(); throw new CompilerException(errorMessage); } @@ -269,9 +269,9 @@ public class ValidatorFinalizer extends AbstractFinalizer { } String annotation = fieldType + - "( validatorId = " + validatorId + "," + - " propertyName = " + keyCode + "," + - " editorName = " + editorCode + "" + ")"; + "( validatorId = " + validatorId + "," + + " propertyName = " + keyCode + "," + + " editorName = " + editorCode + "" + ")"; editor.addAnnotation(annotation); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaField.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaField.java index fc79758..0cb563d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaField.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaField.java @@ -131,7 +131,7 @@ public class JavaField extends JavaElement implements Comparable<JavaField> { @Override public String toString() { return super.toString() + " " + getName() + ", type:" + - getType() + ", modifiers:" + Modifier.toString(getModifiers()); + getType() + ", modifiers:" + Modifier.toString(getModifiers()); } public void setType(String type) { @@ -157,7 +157,7 @@ public class JavaField extends JavaElement implements Comparable<JavaField> { @Override public boolean accept(JavaField field) { return field.getName().startsWith("BINDING_") && - Modifier.isPublic(field.getModifiers()); + Modifier.isPublic(field.getModifiers()); } }, @@ -166,7 +166,7 @@ public class JavaField extends JavaElement implements Comparable<JavaField> { @Override public boolean accept(JavaField field) { return field.getName().startsWith("BINDING_$") && - Modifier.isPrivate(field.getModifiers()); + Modifier.isPrivate(field.getModifiers()); } }, @@ -232,7 +232,7 @@ public class JavaField extends JavaElement implements Comparable<JavaField> { } throw new IllegalArgumentException( "could not find a " + FieldOrder.class + - " for method " + method); + " for method " + method); } } @@ -241,15 +241,15 @@ public class JavaField extends JavaElement implements Comparable<JavaField> { EnumMap<FieldOrder, List<JavaField>> result = new EnumMap<>(FieldOrder.class); for (FieldOrder fieldOrder : FieldOrder.values()) { - result.put(fieldOrder, new ArrayList<JavaField>()); + result.put(fieldOrder, new ArrayList<>()); } EnumSet<FieldOrder> allConstants = EnumSet.allOf(FieldOrder.class); List<JavaField> allFields = new ArrayList<>(fields); int[] scopes = new int[]{Modifier.STATIC, - Modifier.PUBLIC, - Modifier.PROTECTED, - Modifier.PRIVATE + Modifier.PUBLIC, + Modifier.PROTECTED, + Modifier.PRIVATE }; for (int scope : scopes) { EnumSet<FieldOrder> constants = diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFile.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFile.java index e3c848f..fd589d3 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFile.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFile.java @@ -22,13 +22,12 @@ package org.nuiton.jaxx.compiler.java; -import org.nuiton.jaxx.compiler.finalizers.JAXXCompilerFinalizer; -import org.nuiton.jaxx.compiler.types.TypeManager; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.eugene.java.extension.ImportsManager; +import org.nuiton.jaxx.compiler.finalizers.JAXXCompilerFinalizer; +import org.nuiton.jaxx.compiler.types.TypeManager; import java.lang.reflect.Modifier; import java.util.ArrayList; @@ -88,42 +87,6 @@ public class JavaFile extends JavaElement { importManager.addImport(className); } - /** @deprecated since 2.4, never be used */ - @Deprecated - JavaFile() { - this(0, ""); - } - - /** - * @param modifiers - * @param className - * @param superClass - * @deprecated since 2.4, never be used - */ - @Deprecated - JavaFile(int modifiers, String className, String superClass) { - this(modifiers, className, superClass, null); - } - - /** - * @param modifiers - * @param className - * @param superClass - * @param interfaces - * @deprecated since 2.4, never be used - */ - @Deprecated - JavaFile(int modifiers, - String className, - String superClass, - List<String> interfaces) { - this(modifiers, className); - setSuperClass(superClass); - if (CollectionUtils.isNotEmpty(interfaces)) { - addInterface(interfaces.toArray(new String[interfaces.size()])); - } - } - public String getPackageName() { String name = getName(); @@ -258,7 +221,7 @@ public class JavaFile extends JavaElement { anInterface = importManager.getType(anInterface); } catch (Exception e) { log.error("Could not determine simple name of interface " + - anInterface); + anInterface); } simpleInterfaces.add(anInterface); } @@ -276,7 +239,7 @@ public class JavaFile extends JavaElement { method.setReturnType(type); } catch (Exception e) { log.error("Could not determine simple name of return type " + - returnType + " for method " + method.getName()); + returnType + " for method " + method.getName()); } for (JavaArgument argument : method.getArguments()) { String argumentType = argument.getType(); @@ -285,8 +248,8 @@ public class JavaFile extends JavaElement { argument.setType(type); } catch (Exception e) { log.error("Could not determine simple name of argument type " + - argumentType + " of argument " + argument.getName() + - " for method " + method.getName()); + argumentType + " of argument " + argument.getName() + + " for method " + method.getName()); } } @@ -298,7 +261,7 @@ public class JavaFile extends JavaElement { exceptions[i] = exceptionSimple; } catch (Exception e) { log.error("Could not determine simple name of exception " + - exception + " for method " + method.getName()); + exception + " for method " + method.getName()); } } @@ -338,9 +301,9 @@ public class JavaFile extends JavaElement { } public JavaMethod addOverrideGetterMethod(String id, - int modifiers, - String type, - boolean useOverride) { + int modifiers, + String type, + boolean useOverride) { String capitalizedName = StringUtils.capitalize(id); String methodName = "get" + capitalizedName; @@ -369,7 +332,7 @@ public class JavaFile extends JavaElement { // add accessor method int modifiers = Modifier.isProtected(field.getModifiers()) ? - Modifier.PUBLIC : Modifier.PROTECTED; + Modifier.PUBLIC : Modifier.PROTECTED; addGetterMethod(id, modifiers, @@ -385,9 +348,9 @@ public class JavaFile extends JavaElement { String constantId = TypeManager.convertVariableNameToConstantName( "property" + capitalizedName); addSimpleField(JavaElementFactory.newField( - Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL, - JAXXCompilerFinalizer.TYPE_STRING, - constantId, false, "\"" + id + "\"") + Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL, + JAXXCompilerFinalizer.TYPE_STRING, + constantId, false, "\"" + id + "\"") ); if (Boolean.class.getSimpleName().equals(field.getType())) { @@ -429,7 +392,7 @@ public class JavaFile extends JavaElement { field.setType(type); } catch (Exception e) { log.error("Could not determine simple name of field [" + - field.getName() + "] type " + fieldType); + field.getName() + "] type " + fieldType); } if (field.hasInitializerTypes()) { String code = simplifyCode(field.getInitializer(), diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFileGenerator.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFileGenerator.java index a8bfb0e..d897f14 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFileGenerator.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaFileGenerator.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.compiler.java; -import org.nuiton.jaxx.compiler.JAXXCompiler; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.JAXXCompiler; import java.io.PrintWriter; import java.util.Arrays; @@ -59,8 +59,8 @@ public class JavaFileGenerator { String eol = JAXXCompiler.getLineSeparator(); return all + eol + "/*--" + new String(prefix) + - " " + header + " " + new String(prefix) + "--*/" + eol + all + - eol; + " " + header + " " + new String(prefix) + "--*/" + eol + all + + eol; } /** End of line */ diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaMethod.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaMethod.java index 7968864..942216d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaMethod.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/JavaMethod.java @@ -195,14 +195,14 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { return method.getName().startsWith("do") && - method.getName().contains("__"); + method.getName().contains("__"); } }, publicGetters(Modifier.PUBLIC, "Public acessor methods") { @Override public boolean accept(JavaMethod method) { return method.getName().startsWith("get") || - method.getName().startsWith("is"); + method.getName().startsWith("is"); } }, publicSetters(Modifier.PUBLIC, "Public mutator methods") { @@ -221,7 +221,7 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { return method.getName().startsWith("get") || - method.getName().startsWith("is"); + method.getName().startsWith("is"); } }, createMethod(Modifier.PROTECTED | Modifier.PRIVATE, @@ -229,7 +229,7 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { return method.getName().startsWith("create") || - method.getName().startsWith("add"); + method.getName().startsWith("add"); } }, internalMethod(Modifier.PROTECTED, "Internal jaxx methods") { @@ -253,8 +253,8 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { @Override public boolean accept(int mod) { return !Modifier.isStatic(mod) && - !Modifier.isPublic(mod) && - !Modifier.isProtected(mod); + !Modifier.isPublic(mod) && + !Modifier.isProtected(mod); } }, privates(Modifier.PRIVATE, "Other private methods"); @@ -292,7 +292,7 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { } throw new IllegalArgumentException( "could not find a " + MethodOrder.class + - " for method " + method); + " for method " + method); } } @@ -301,15 +301,15 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { EnumMap<MethodOrder, List<JavaMethod>> result = new EnumMap<>(MethodOrder.class); for (MethodOrder methodOrder : MethodOrder.values()) { - result.put(methodOrder, new ArrayList<JavaMethod>()); + result.put(methodOrder, new ArrayList<>()); } EnumSet<MethodOrder> allConstants = EnumSet.allOf(MethodOrder.class); List<JavaMethod> allMethods = new ArrayList<>(methods); int[] scopes = new int[]{Modifier.STATIC, - Modifier.PUBLIC, - Modifier.PROTECTED, - Modifier.PRIVATE + Modifier.PUBLIC, + Modifier.PROTECTED, + Modifier.PRIVATE }; for (int scope : scopes) { EnumSet<MethodOrder> constants = @@ -332,7 +332,7 @@ public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { if (!allMethods.isEmpty()) { throw new IllegalArgumentException( "could not find a " + MethodOrder.class + - " for method " + allMethods); + " for method " + allMethods); } for (MethodOrder methodOrder : MethodOrder.values()) { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaCharStream.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaCharStream.java index b06b013..60347b3 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaCharStream.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaCharStream.java @@ -314,14 +314,14 @@ public class JavaCharStream { ++column; buffer[bufpos] = c = (char) (hexval(c) << 12 | - hexval(ReadByte()) << 8 | - hexval(ReadByte()) << 4 | - hexval(ReadByte())); + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); column += 4; } catch (java.io.IOException e) { throw new Error("Invalid escape character at line " + line + - " column " + column + "."); + " column " + column + "."); } if (backSlashCnt == 1) @@ -489,7 +489,7 @@ public class JavaCharStream { return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); + new String(buffer, 0, bufpos + 1); } public char[] GetSuffix(int len) { @@ -533,7 +533,7 @@ public class JavaCharStream { int nextColDiff, columnDiff = 0; while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaParser.java index 168b803..f5a7b31 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/JavaParser.java @@ -1935,7 +1935,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } Token token = jj_consume_token(jj_ntk); if (lbraceNb > 0) { - if (token.specialToken !=null) { + if (token.specialToken != null) { constructoRawBody.append(token.specialToken); } constructoRawBody.append(token.image); @@ -5904,7 +5904,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav jjtreeOpenNodeScope(jjtn000); try { if (getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) { + ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) { } else { jj_consume_token(-1); @@ -5929,7 +5929,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav jjtreeOpenNodeScope(jjtn000); try { if (getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT) { + ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT) { } else { jj_consume_token(-1); @@ -7982,7 +7982,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav xsp = jj_scanpos; lookingAhead = true; jj_semLA = getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT; + ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT; lookingAhead = false; if (!jj_semLA || jj_3R_113()) return true; if (jj_scan_token(GT)) return true; @@ -8026,7 +8026,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav xsp = jj_scanpos; lookingAhead = true; jj_semLA = getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT; + ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT; lookingAhead = false; if (!jj_semLA || jj_3R_114()) return true; if (jj_scan_token(GT)) return true; @@ -9918,7 +9918,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } public JavaParser(java.io.Reader stream, boolean parseMethodBody) { - this.parseMethodBody=parseMethodBody; + this.parseMethodBody = parseMethodBody; jj_input_stream = new JavaCharStream(stream, 1, 1); token_source = new JavaParserTokenManager(jj_input_stream); token = new Token(); @@ -9934,7 +9934,7 @@ public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, Jav } public JavaParser(JavaParserTokenManager tm, boolean parseMethodBody) { - this.parseMethodBody =parseMethodBody; + this.parseMethodBody = parseMethodBody; token_source = tm; token = new Token(); jj_ntk = -1; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/TokenMgrError.java index 0407744..b824c2d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/java/parser/TokenMgrError.java @@ -111,10 +111,10 @@ public class TokenMgrError extends Error { */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return "Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : "\"" + addEscapes(String.valueOf(curChar)) + "\"" + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""; + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : "\"" + addEscapes(String.valueOf(curChar)) + "\"" + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""; } /** diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptor.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptor.java index 2d7ee1b..1271651 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptor.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptor.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.compiler.reflect; -import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import java.util.Arrays; @@ -82,7 +82,7 @@ public abstract class ClassDescriptor { if (name.equals(descriptor.getName())) { if (log.isDebugEnabled()) { log.debug("Using a declared field descriptor [" + name + - "] for " + getName()); + "] for " + getName()); } return descriptor; } @@ -210,14 +210,14 @@ public abstract class ClassDescriptor { ClassDescriptor... parameterTypes) throws NoSuchMethodException { for (MethodDescriptor m : methodDescriptors) { if (m.getName().equals(name) && - m.getParameterTypes().length == parameterTypes.length && - Arrays.equals(m.getParameterTypes(), parameterTypes)) { + m.getParameterTypes().length == parameterTypes.length && + Arrays.equals(m.getParameterTypes(), parameterTypes)) { return m; } } throw new NoSuchMethodException( "Could not find method " + name + "(" + - Arrays.asList(parameterTypes) + ") in " + getName()); + Arrays.asList(parameterTypes) + ") in " + getName()); } public FieldDescriptor[] getFieldDescriptors() { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptorHelper.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptorHelper.java index 4590230..190703d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptorHelper.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/ClassDescriptorHelper.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.reflect; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; @@ -32,8 +34,6 @@ import org.nuiton.jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJav import org.nuiton.jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJaxxFile; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -144,7 +144,7 @@ public class ClassDescriptorHelper { } JAXXEngine engine = JAXXFactory.isEngineRegistred() ? - JAXXFactory.getEngine() : null; + JAXXFactory.getEngine() : null; String relativePathPattern = ".*";// + className + ".*"; // used to ensure that the located resource has the right character cases @@ -181,8 +181,8 @@ public class ClassDescriptorHelper { long javaLastModified = -1; URL javaFile = getURL(classLoader, className, "java"); if (javaFile != null && - javaFile.toString().startsWith("file:") && - javaFile.toString().matches(relativePathPattern)) { + javaFile.toString().startsWith("file:") && + javaFile.toString().matches(relativePathPattern)) { javaLastModified = JAXXCompiler.URLtoFile(javaFile).lastModified(); if (log.isTraceEnabled()) { log.trace("[" + className + "] javaFile lastModified " + javaLastModified); @@ -192,8 +192,8 @@ public class ClassDescriptorHelper { long classLastModified = -1; URL classFile = getURL(classLoader, className, "class"); if (classFile != null && - classFile.toString().startsWith("file:") && - classFile.toString().matches(relativePathPattern)) { + classFile.toString().startsWith("file:") && + classFile.toString().matches(relativePathPattern)) { classLastModified = JAXXCompiler.URLtoFile(classFile).lastModified(); if (log.isTraceEnabled()) { log.trace("[" + className + "] class lastModified " + classLastModified); @@ -257,7 +257,7 @@ public class ClassDescriptorHelper { if (log.isDebugEnabled()) { log.debug("Loading class descriptor for [" + className + - "] with " + resolverType); + "] with " + resolverType); } Map<ResolverType, ClassDescriptorResolver> resolvers = @@ -385,8 +385,8 @@ public class ClassDescriptorHelper { } try { return classLoader != null ? - Class.forName(className, true, classLoader) : - Class.forName(className); + Class.forName(className, true, classLoader) : + Class.forName(className); } catch (ClassNotFoundException e) { // perharps we are in a inner class ? @@ -511,8 +511,8 @@ public class ClassDescriptorHelper { public static JAXXObjectDescriptor getJAXXObjectDescriptor(Class<?> jaxxClass) { if (!JAXXObject.class.isAssignableFrom(jaxxClass) || - JAXXObject.class.equals(jaxxClass) || - jaxxClass.isInterface()) { + JAXXObject.class.equals(jaxxClass) || + jaxxClass.isInterface()) { return null; } try { diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java index 098a374..c227a7d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaClass.java @@ -21,14 +21,14 @@ */ package org.nuiton.jaxx.compiler.reflect.resolvers; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorResolver; import org.nuiton.jaxx.compiler.reflect.FieldDescriptor; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.lang.reflect.Constructor; import java.lang.reflect.Field; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java index 73a5b8d..02a35b5 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFile.java @@ -21,6 +21,8 @@ */ package org.nuiton.jaxx.compiler.reflect.resolvers; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXFactory; @@ -35,8 +37,6 @@ import org.nuiton.jaxx.compiler.reflect.FieldDescriptor; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.compiler.tags.TagManager; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.InputStreamReader; @@ -66,6 +66,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver public ClassDescriptorResolverFromJavaFile() { this(false); } + public ClassDescriptorResolverFromJavaFile(boolean parseMethodBody) { super(ClassDescriptorHelper.ResolverType.JAVA_FILE); this.parseMethodBody = parseMethodBody; @@ -78,8 +79,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver ClassLoader classLoader = getClassLoader(); try { - Reader reader = new InputStreamReader(source.openStream(), "utf-8"); - try { + try (Reader reader = new InputStreamReader(source.openStream(), "utf-8")) { String displayName = source.toString(); if (log.isDebugEnabled()) { @@ -92,14 +92,9 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver try { parser.doParse(displayName, reader); } catch (Exception e) { -// log.error(e.getMessage()); throw new RuntimeException(e); } return new JavaFileClassDescriptor(parser, classLoader); - - } finally { - - reader.close(); } } catch (IOException e) { throw new ClassNotFoundException( @@ -221,7 +216,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver */ private boolean firstTypeScanned; - protected JavaFileParser(ClassLoader classLoader,boolean parseMethodBody) { + protected JavaFileParser(ClassLoader classLoader, boolean parseMethodBody) { this.parseMethodBody = parseMethodBody; //FIXME-TC-20100504 : shoudl remove this to make the parser free of jaxx :) // We could imagine just to offers to the parser a list of namespaces @@ -458,7 +453,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver if (log.isDebugEnabled()) { log.debug("field [" + declaration + "] modifiers == " + - Modifier.toString(modifiers)); + Modifier.toString(modifiers)); } String[] declarationTokens = declaration.split("\\s"); @@ -489,7 +484,7 @@ public class ClassDescriptorResolverFromJavaFile extends ClassDescriptorResolver if (log.isDebugEnabled()) { log.debug("detected a $jaxxObjectDescriptor = " + - jaxxObjectDescriptorValue); + jaxxObjectDescriptorValue); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java index e884b72..dfa6348 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJaxxFile.java @@ -92,20 +92,8 @@ public class ClassDescriptorResolverFromJaxxFile extends ClassDescriptorResolver List<FieldDescriptor> publicFields = symbolTable.getScriptFields(); //List<MethodDescriptor> declaredMethods = new ArrayList<MethodDescriptor>(publicMethods); //List<FieldDescriptor> declaredFields = new ArrayList<FieldDescriptor>(publicFields); - Iterator<MethodDescriptor> methods = publicMethods.iterator(); - while (methods.hasNext()) { - MethodDescriptor method = methods.next(); - if (!Modifier.isPublic(method.getModifiers())) { - methods.remove(); - } - } - Iterator<FieldDescriptor> fields = publicFields.iterator(); - while (fields.hasNext()) { - FieldDescriptor field = fields.next(); - if (!Modifier.isPublic(field.getModifiers())) { - fields.remove(); - } - } + publicMethods.removeIf(method -> !Modifier.isPublic(method.getModifiers())); + publicFields.removeIf(field -> !Modifier.isPublic(field.getModifiers())); Set<String> interfaces = new HashSet<>(); if (symbolTable.getInterfaces() != null) { // having interfaces diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/script/ScriptManager.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/script/ScriptManager.java index a764981..08457db 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/script/ScriptManager.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/script/ScriptManager.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.script; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.java.JavaArgument; @@ -34,8 +36,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.FieldDescriptor; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.compiler.tags.TagManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.io.StringReader; import java.lang.reflect.Modifier; @@ -131,7 +131,7 @@ public class ScriptManager { int id = node.getId(); if (id == JavaParserTreeConstants.JJTNAME || - id == JavaParserTreeConstants.JJTCLASSORINTERFACETYPE) { + id == JavaParserTreeConstants.JJTCLASSORINTERFACETYPE) { scanCompoundSymbol(node.getText()); } //tchemit 2011-02-02 I never understand this code @@ -288,7 +288,7 @@ public class ScriptManager { compiler.appendBodyCode(node.getText()); compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader())); } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION || - nodeType == JavaParserTreeConstants.JJTINITIALIZER) { + nodeType == JavaParserTreeConstants.JJTINITIALIZER) { String str = node.getText().trim(); if (str.endsWith(";")) { str += ";"; @@ -345,14 +345,14 @@ public class ScriptManager { String className = declarationTokens[declarationTokens.length - 2]; if (log.isDebugEnabled()) { log.debug("Found type : " + className + " : " + - Arrays.toString(declarationTokens)); + Arrays.toString(declarationTokens)); } String type = TagManager.resolveClassName(className, compiler); if (type == null) { throw new CompilerException( "Could not find type of " + className + - " for expression " + text); + " for expression " + text); } compiler.addScriptField(new FieldDescriptor(name, Modifier.PUBLIC, @@ -369,14 +369,8 @@ public class ScriptManager { initializer = "new " + type + " " + initializer; } final String finalInitializer = name + " = " + initializer; - compiler.registerInitializer(new Runnable() { - - @Override - public void run() { - compiler.registerCompiledObject(new ScriptInitializer( - finalInitializer, compiler)); - } - }); + compiler.registerInitializer(() -> compiler.registerCompiledObject(new ScriptInitializer( + finalInitializer, compiler))); } else { compiler.appendBodyCode(text); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/spi/DefaultInitializer.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/spi/DefaultInitializer.java index 6d7918c..e616106 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/spi/DefaultInitializer.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/spi/DefaultInitializer.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.compiler.spi; +import org.jdesktop.jxlayer.JXLayer; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.beans.BeanInfoUtil; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; @@ -75,7 +76,6 @@ import org.nuiton.jaxx.runtime.swing.Table; import org.nuiton.jaxx.runtime.swing.editor.EnumEditor; import org.nuiton.jaxx.runtime.swing.editor.LocaleEditor; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.jdesktop.jxlayer.JXLayer; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultComponentHandler.java index 86a11e8..c7db649 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultComponentHandler.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.tags; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.I18nHelper; @@ -31,8 +33,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.types.TypeManager; import org.nuiton.jaxx.runtime.SwingUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -178,15 +178,15 @@ public class DefaultComponentHandler extends DefaultObjectHandler { String propertyName, JAXXCompiler compiler) throws CompilerException { if (X_ATTRIBUTE.equals(propertyName) || - Y_ATTRIBUTE.equals(propertyName) || - WIDTH_ATTRIBUTE.equals(propertyName) || - HEIGHT_ATTRIBUTE.equals(propertyName) || - FONT_SIZE_ATTRIBUTE.equals(propertyName)) { + Y_ATTRIBUTE.equals(propertyName) || + WIDTH_ATTRIBUTE.equals(propertyName) || + HEIGHT_ATTRIBUTE.equals(propertyName) || + FONT_SIZE_ATTRIBUTE.equals(propertyName)) { return ClassDescriptorHelper.getClassDescriptor(Integer.class); } if (FONT_FACE_ATTRIBUTE.equals(propertyName) || - FONT_STYLE_ATTRIBUTE.equals(propertyName) || - FONT_WEIGHT_ATTRIBUTE.equals(propertyName)) { + FONT_STYLE_ATTRIBUTE.equals(propertyName) || + FONT_WEIGHT_ATTRIBUTE.equals(propertyName)) { return ClassDescriptorHelper.getClassDescriptor(String.class); } return super.getPropertyType(object, propertyName, compiler); @@ -253,8 +253,8 @@ public class DefaultComponentHandler extends DefaultObjectHandler { if (!valueCode.startsWith("\"")) { String type = compiler.getImportedType(Font.class); return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | " + type + ".BOLD));\n } else {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~" + type + ".BOLD));\n }\n}"; + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | " + type + ".BOLD));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~" + type + ".BOLD));\n }\n}"; } compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode); return ""; @@ -271,8 +271,8 @@ public class DefaultComponentHandler extends DefaultObjectHandler { if (!valueCode.startsWith("\"")) { String type = compiler.getImportedType(Font.class); return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | " + type + ".ITALIC));\n } else {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~" + type + ".ITALIC));\n }\n}"; + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | " + type + ".ITALIC));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~" + type + ".ITALIC));\n }\n}"; } compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode); return ""; @@ -407,7 +407,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { @Override protected int constantValue(String key, String value) { if (key.equals(MNEMONIC_ATTRIBUTE) || - key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE)) { + key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE)) { if (value.length() == 1) { return value.charAt(0); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultObjectHandler.java index f175b41..4a9a695 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/DefaultObjectHandler.java @@ -22,6 +22,9 @@ package org.nuiton.jaxx.compiler.tags; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompiledObjectDecorator; import org.nuiton.jaxx.compiler.CompilerException; @@ -45,9 +48,6 @@ import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import org.nuiton.jaxx.runtime.bean.BeanTypeAware; import org.nuiton.jaxx.runtime.css.Stylesheet; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -314,7 +314,7 @@ public class DefaultObjectHandler implements TagHandler { propertyName = Introspector.decapitalize(name.substring("is".length())); } JAXXPropertyDescriptor property = propertyName != null ? - properties.get(propertyName) : null; + properties.get(propertyName) : null; if (property != null) { return property.isBound(); } @@ -474,8 +474,8 @@ public class DefaultObjectHandler implements TagHandler { if (object == null) { throw new IllegalStateException( "unable to find CompiledObject associated with tag <" + - tag.getTagName() + ">; should have been registered " + - "before second pass" + tag.getTagName() + ">; should have been registered " + + "before second pass" ); } compiler.checkOverride(object); @@ -556,8 +556,8 @@ public class DefaultObjectHandler implements TagHandler { */ public boolean isEventHandlerName(String name) { return name.length() > 2 && - name.startsWith("on") && - Character.isUpperCase(name.charAt(2)); + name.startsWith("on") && + Character.isUpperCase(name.charAt(2)); } /** @@ -575,7 +575,7 @@ public class DefaultObjectHandler implements TagHandler { for (int i = 0; i < children.getLength(); i++) { attributes.add((Attr) children.item(i)); } - Collections.sort(attributes, getAttributeComparator()); + attributes.sort(getAttributeComparator()); for (Attr attribute : attributes) { String name = attribute.getName(); @@ -585,7 +585,7 @@ public class DefaultObjectHandler implements TagHandler { continue; } if (name.equals(CONSTRAINTS_ATTRIBUTE) || - isEventHandlerName(name)) { + isEventHandlerName(name)) { // adds dependencies as a side effect compiler.preprocessScript(value); } else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) { @@ -621,7 +621,7 @@ public class DefaultObjectHandler implements TagHandler { for (int i = 0; i < children.getLength(); i++) { attributes.add((Attr) children.item(i)); } - Collections.sort(attributes, getAttributeComparator()); + attributes.sort(getAttributeComparator()); CompiledObject rootObject = compiler.getRootObject(); @@ -630,11 +630,11 @@ public class DefaultObjectHandler implements TagHandler { String name = attribute.getName(); String value = attribute.getValue().trim(); if (name.equals(ID_ATTRIBUTE) || - name.equals(CONSTRAINTS_ATTRIBUTE) || - name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE) || - name.equals(STYLE_CLASS_ATTRIBUTE) || - name.startsWith(XMLNS_ATTRIBUTE) || - JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + name.equals(CONSTRAINTS_ATTRIBUTE) || + name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE) || + name.equals(STYLE_CLASS_ATTRIBUTE) || + name.startsWith(XMLNS_ATTRIBUTE) || + JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { // ignore, already handled continue; } @@ -762,15 +762,11 @@ public class DefaultObjectHandler implements TagHandler { * @return a <code>Comparator</code> defining the order of attribute processing */ protected Comparator<Attr> getAttributeComparator() { - return new Comparator<Attr>() { + return (a, b) -> { + int aOrder = getAttributeOrdering(a); + int bOrder = getAttributeOrdering(b); - @Override - public int compare(Attr a, Attr b) { - int aOrder = getAttributeOrdering(a); - int bOrder = getAttributeOrdering(b); - - return aOrder - bOrder; - } + return aOrder - bOrder; }; } @@ -783,8 +779,8 @@ public class DefaultObjectHandler implements TagHandler { */ protected int getAttributeOrdering(Attr attr) { if (attr.getName().equals(DISPLAYED_MNEMONIC_INDEX_ATTRIBUTE) || - attr.getName().equals(DISPLAYED_MNEMONIC_ATTRIBUTE) || - attr.getName().equals(MNEMONIC_ATTRIBUTE)) { + attr.getName().equals(DISPLAYED_MNEMONIC_ATTRIBUTE) || + attr.getName().equals(MNEMONIC_ATTRIBUTE)) { return 1; } return 0; @@ -821,8 +817,8 @@ public class DefaultObjectHandler implements TagHandler { try { Class<?> typeClass = type != null ? - ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : - null; + ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : + null; Object value = convertFromString(propertyName, stringValue, typeClass @@ -915,8 +911,8 @@ public class DefaultObjectHandler implements TagHandler { // no bindings, convert from string try { Class<?> typeClass = type != null ? - ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : - null; + ClassDescriptorHelper.getClass(type.getName(), type.getClassLoader()) : + null; Object value = convertFromString(propertyName, stringValue, typeClass @@ -978,9 +974,9 @@ public class DefaultObjectHandler implements TagHandler { // autoRecurseInCss is set to false since this does not work boolean applyInside = recurse && - jaxxObjectClassDescriptor.isAssignableFrom(objectClass) && - // new since 2.0.2 to skip old buggy mode - compiler.getConfiguration().isAutoRecurseInCss(); + jaxxObjectClassDescriptor.isAssignableFrom(objectClass) && + // new since 2.0.2 to skip old buggy mode + compiler.getConfiguration().isAutoRecurseInCss(); try { @@ -1014,7 +1010,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); @@ -1045,7 +1041,7 @@ public class DefaultObjectHandler implements TagHandler { object.appendInitializationCode(child.getInitializationCode(compiler)); } } catch (ParseException e) { - compiler.reportError("Java parser exception on "+object+" in his css rules: "+e.getMessage()); + compiler.reportError("Java parser exception on " + object + " in his css rules: " + e.getMessage()); } catch (ClassNotFoundException e) { throw new CompilerException(e); } catch (IllegalArgumentException e) { @@ -1214,7 +1210,7 @@ public class DefaultObjectHandler implements TagHandler { StringBuilder message = new StringBuilder("value of '" + - key + "' must be one of: ["); + key + "' must be one of: ["); for (int j = 0; j < values.length - 2; j += 3) { if (j != 0) { message.append(", "); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ImportHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ImportHandler.java index 917ec52..f7287f8 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ImportHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ImportHandler.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.compiler.tags; -import org.nuiton.jaxx.compiler.JAXXCompiler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.JAXXCompiler; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -60,7 +60,7 @@ public class ImportHandler implements TagHandler { case Node.ELEMENT_NODE: compiler.reportError( "<import> tag may not contain child elements: " + - tag); + tag); case Node.TEXT_NODE: // fall through case Node.CDATA_SECTION_NODE: String txt = ((Text) child).getData(); @@ -68,8 +68,7 @@ public class ImportHandler implements TagHandler { log.debug("Will treate imports :[\n" + txt + "\n]"); } String eol = JAXXCompiler.getLineSeparator(); - LineNumberReader reader = new LineNumberReader(new StringReader(txt.trim())); - try { + try (LineNumberReader reader = new LineNumberReader(new StringReader(txt.trim()))) { String line; while ((line = reader.readLine()) != null) { line = line.trim(); @@ -82,8 +81,6 @@ public class ImportHandler implements TagHandler { } script.append(eol); } - } finally { - reader.close(); } } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ScriptHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ScriptHandler.java index 3d61efb..7e8c7a7 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ScriptHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/ScriptHandler.java @@ -76,8 +76,8 @@ public class ScriptHandler implements TagHandler { // } // compiler.registerScript(scriptBuffer.toString(), scriptFile); } else if (!name.startsWith(XMLNS_ATTRIBUTE) && - !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals( - attribute.getNamespaceURI())) { + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals( + attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); } } @@ -90,7 +90,7 @@ public class ScriptHandler implements TagHandler { case Node.ELEMENT_NODE: compiler.reportError( "<script> tag may not contain child elements: " + - tag); + tag); case Node.TEXT_NODE: // fall through case Node.CDATA_SECTION_NODE: script.append(((Text) child).getData()); @@ -102,7 +102,7 @@ public class ScriptHandler implements TagHandler { if (scriptFile != null) { compiler.reportError( "<script> tag has both a source attribute and an " + - "inline script"); + "inline script"); } compiler.registerScript(script.toString()); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/StyleHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/StyleHandler.java index b275db1..ee4e6eb 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/StyleHandler.java @@ -65,7 +65,7 @@ public class StyleHandler implements TagHandler { compiler.registerStyleSheetFile(styleFile, true); } } else if (!name.startsWith(XMLNS_ATTRIBUTE) && - !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/TagManager.java index d674139..66fb7d4 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/TagManager.java @@ -22,13 +22,13 @@ package org.nuiton.jaxx.compiler.tags; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.ClassMap; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -99,13 +99,13 @@ public class TagManager { } QName qname = (QName) o; return qname.getNamespaceURI().equals(getNamespaceURI()) && - qname.getLocalPart().equals(getLocalPart()); + qname.getLocalPart().equals(getLocalPart()); } @Override public int hashCode() { return (namespaceURI != null ? namespaceURI.hashCode() : 0) ^ - getLocalPart().hashCode(); + getLocalPart().hashCode(); } } @@ -167,7 +167,7 @@ public class TagManager { */ public static void registerDefaultNamespace(String tag, String namespace) { if (defaultNamespaces.containsKey(tag) && - !defaultNamespaces.get(tag).equals(namespace)) { + !defaultNamespaces.get(tag).equals(namespace)) { defaultNamespaces.put(tag, null); // tag name is now ambiguous } else { defaultNamespaces.put(tag, namespace); @@ -339,7 +339,7 @@ public class TagManager { for (String className : classes) { // search class imports (e.g. import java.util.Date;) if (className.equals(simpleClassName) || - className.endsWith("." + simpleClassName)) { + className.endsWith("." + simpleClassName)) { namespace = className.substring(0, className.lastIndexOf(".") + 1) + "*"; } } @@ -350,7 +350,7 @@ public class TagManager { if (!defaultPackage.endsWith("*")) { throw new IllegalArgumentException( "defaultPackage must end in '*', found '" + - defaultPackage + "'"); + defaultPackage + "'"); } String fqn = defaultPackage.substring( 0, defaultPackage.length() - 1) + simpleClassName; @@ -365,11 +365,11 @@ public class TagManager { // we've already found the same name in another package compiler.reportError( "symbol '" + simpleClassName + - "' is ambiguous, found matching classes " + - namespace.substring(0, namespace.length() - 1) + - simpleClassName + " and " + currentPackage + - simpleClassName + - ". Use fully-qualified name to disambiguate." + "' is ambiguous, found matching classes " + + namespace.substring(0, namespace.length() - 1) + + simpleClassName + " and " + currentPackage + + simpleClassName + + ". Use fully-qualified name to disambiguate." ); return null; } @@ -418,8 +418,8 @@ public class TagManager { // there to indicate ambiguity compiler.reportError( "tag '" + tag + "' is ambiguous; specify " + - "fully-qualified name (package and class) to " + - "disambiguate" + "fully-qualified name (package and class) to " + + "disambiguate" ); return null; } @@ -437,10 +437,10 @@ public class TagManager { if (className == null) { className = resolveClassName(tag, compiler); if (namespacePrefix && - !className.startsWith( - namespace.substring( - 0, - namespace.length() - 1))) { + !className.startsWith( + namespace.substring( + 0, + namespace.length() - 1))) { // namespace was specified, but we found it in a // different package - ignore @@ -503,13 +503,13 @@ public class TagManager { 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("byte") || + name.equals("short") || + name.equals("int") || + name.equals("long") || + name.equals("float") || + name.equals("double") || + name.equals("char")) { return name; } @@ -524,8 +524,8 @@ public class TagManager { // there to indicate ambiguity compiler.reportError( "class '" + name + "' is ambiguous; specify " + - "fully-qualified name (package and class) to " + - "disambiguate" + "fully-qualified name (package and class) to " + + "disambiguate" ); return null; } @@ -569,7 +569,7 @@ public class TagManager { if (packageName != null) { assert packageName.endsWith("*"); if (packageName.equals(namespace) || - namespace.equals("*")) { + namespace.equals("*")) { // check for an alias (like javax.swing.JComboBox actually being org.nuiton.jaxx.runtime.swing.JAXXComboBox) TagHandler handler = registeredTags.get(new QName(namespace, name)); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/ApplicationHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/ApplicationHandler.java index 4838bdf..48cf276 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/ApplicationHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/ApplicationHandler.java @@ -54,8 +54,8 @@ public class ApplicationHandler extends JWindowHandler { boolean inline, JAXXCompiler compiler) throws CompilerException { if (propertyName.equals(ATTRIBUTE_LOOK_AND_FEEL) && - stringValue != null && - !stringValue.trim().startsWith("{")) { + stringValue != null && + !stringValue.trim().startsWith("{")) { compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + TypeManager.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator()); } else { super.setAttribute(object, diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JRadioButtonHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JRadioButtonHandler.java index 5e94241..6284cde 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JRadioButtonHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JRadioButtonHandler.java @@ -98,7 +98,7 @@ public class JRadioButtonHandler extends DefaultComponentHandler { String type = compiler.getImportedType( JAXXButtonGroup.class.getName()); return "{ " + id + ".putClientProperty(\"" + JAXXButtonGroup.VALUE_CLIENT_PROPERTY + "\", " + valueCode + "); Object $buttonGroup = " + id + ".getClientProperty(\"" + JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY + "\");" + - " if ($buttonGroup instanceof " + type + ") { ((" + type + ") $buttonGroup).updateSelectedValue(); } }\n"; + " if ($buttonGroup instanceof " + type + ") { ((" + type + ") $buttonGroup).updateSelectedValue(); } }\n"; } else { return super.getSetPropertyCode(id, name, valueCode, compiler); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JScrollPaneHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JScrollPaneHandler.java index c407027..8c02723 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JScrollPaneHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JScrollPaneHandler.java @@ -22,13 +22,13 @@ package org.nuiton.jaxx.compiler.tags.swing; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tags.DefaultComponentHandler; -import org.apache.commons.lang3.StringUtils; import javax.swing.JScrollPane; @@ -73,7 +73,7 @@ public class JScrollPaneHandler extends DefaultComponentHandler { log.info("property to match " + property + " against child " + child.getId()); } if (!StringUtils.isEmpty(property) && - ("{" + child.getId() + "}").equals(property)) { + ("{" + child.getId() + "}").equals(property)) { hasColumnViewHeader = true; return; } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSpinnerHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSpinnerHandler.java index 9e3396c..2cadfc8 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSpinnerHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSpinnerHandler.java @@ -74,7 +74,7 @@ public class JSpinnerHandler extends DefaultComponentHandler { @Override public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { if (propertyName.equals(MINIMUM_PROPERTY) || propertyName.equals(MAXIMUM_PROPERTY) || - propertyName.equals(VALUE_PROPERTY)) { + propertyName.equals(VALUE_PROPERTY)) { return ClassDescriptorHelper.getClassDescriptor(Integer.class); } return super.getPropertyType(object, propertyName, compiler); @@ -97,8 +97,8 @@ public class JSpinnerHandler extends DefaultComponentHandler { protected void closeComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { CompiledSpinner spinner = (CompiledSpinner) object; if (spinner.minimum != null || - spinner.maximum != null || - spinner.value != null) { + spinner.maximum != null || + spinner.value != null) { if (spinner.getConstructorParams() != null) { compiler.reportError("constructorParams and minimum/maximum may not both be specified for the same JSpinner"); } @@ -106,7 +106,7 @@ public class JSpinnerHandler extends DefaultComponentHandler { spinner.minimum = Math.min(0, spinner.maximum != null ? spinner.maximum : 0); } if (spinner.maximum == null) { - spinner.maximum = Math.max(100, spinner.minimum.intValue()); + spinner.maximum = Math.max(100, spinner.minimum); } if (spinner.value == null) { spinner.value = spinner.minimum; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSplitPaneHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSplitPaneHandler.java index cabbef6..ffb376a 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSplitPaneHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JSplitPaneHandler.java @@ -62,11 +62,11 @@ public class JSplitPaneHandler extends DefaultComponentHandler { if (key.equals(ATTRIBUTE_ORIENTATION)) { value = value.trim().toLowerCase(); if (value.equals(ORIENTATION_VALUE_HORIZONTAL) || - value.equals(ORIENTATION_VALUE_HORIZONTAL_SPLIT)) { + value.equals(ORIENTATION_VALUE_HORIZONTAL_SPLIT)) { return JSplitPane.HORIZONTAL_SPLIT; } if (value.equals(ORIENTATION_VALUE_VERTICAL) || - value.equals(ORIENTATION_VALUE_VERTICAL_SPLIT)) { + value.equals(ORIENTATION_VALUE_VERTICAL_SPLIT)) { return JSplitPane.VERTICAL_SPLIT; } throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'"); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JTextComponentHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JTextComponentHandler.java index dd3adfb..9069d5e 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JTextComponentHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JTextComponentHandler.java @@ -88,8 +88,8 @@ public class JTextComponentHandler extends DefaultComponentHandler { if (name.equals(ATTRIBUTE_TEXT)) { String prefix = compiler.getImportedType(SwingUtil.class); return prefix + ".setText(" + - id + ", " + valueCode + ");" + - JAXXCompiler.getLineSeparator(); + id + ", " + valueCode + ");" + + JAXXCompiler.getLineSeparator(); } return super.getSetPropertyCode(id, name, valueCode, compiler); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JToolBarHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JToolBarHandler.java index 1fb70e4..03c0c3d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JToolBarHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JToolBarHandler.java @@ -69,7 +69,7 @@ public class JToolBarHandler extends DefaultComponentHandler { if (fill == null) { throw new CompilerException( "invalid value for orientation attribute: '" + value + - "'"); + "'"); } return fill.getIntValue(); } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JXLayerHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JXLayerHandler.java index dae4f76..ca9cf2c 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JXLayerHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/JXLayerHandler.java @@ -21,14 +21,14 @@ */ package org.nuiton.jaxx.compiler.tags.swing; +import org.apache.commons.collections4.CollectionUtils; +import org.jdesktop.jxlayer.JXLayer; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tags.DefaultComponentHandler; -import org.apache.commons.collections4.CollectionUtils; -import org.jdesktop.jxlayer.JXLayer; import java.awt.Component; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TabHandler.java index 15aa7c3..1a490c6 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TabHandler.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.compiler.tags.swing; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.I18nHelper; @@ -31,7 +32,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tags.TagHandler; import org.nuiton.jaxx.compiler.types.TypeManager; import org.nuiton.jaxx.runtime.swing.TabInfo; -import org.apache.commons.lang3.StringUtils; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TableHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TableHandler.java index 2c8cfcc..9836576 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TableHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/swing/TableHandler.java @@ -160,7 +160,7 @@ public class TableHandler extends DefaultComponentHandler { emptyCell = true; rowConstraints.gridx++; while (rowConstraints.gridx < rowSpans.size() && - rowSpans.get(rowConstraints.gridx) > 0) { + rowSpans.get(rowConstraints.gridx) > 0) { rowConstraints.gridx++; } cellConstraints = (GridBagConstraints) rowConstraints.clone(); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/BeanValidatorHandler.java index ea60db4..ea7346b 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/BeanValidatorHandler.java @@ -24,6 +24,8 @@ package org.nuiton.jaxx.compiler.tags.validator; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -37,8 +39,6 @@ import org.nuiton.jaxx.compiler.types.TypeManager; import org.nuiton.jaxx.validator.swing.SwingValidator; import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.jaxx.validator.swing.ui.AbstractBeanValidatorUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; import java.io.IOException; @@ -127,8 +127,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) { compiler.reportError( "tag '" + tag.getParentNode().getLocalName() + - "' may only contain " + FieldValidatorHandler.TAG + - " as children, but found : " + tag.getLocalName()); + "' may only contain " + FieldValidatorHandler.TAG + + " as children, but found : " + tag.getLocalName()); } else { compiler.compileFirstPass(tag); } @@ -170,7 +170,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (error) { log.warn("error were detected in second compile pass " + - "of CompiledObject [" + info + "]"); + "of CompiledObject [" + info + "]"); } // close the compiled object @@ -439,7 +439,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { } throw new CompilerException("property " + property + - " is not allowed on object " + this); + " is not allowed on object " + this); } public String getBean() { @@ -509,7 +509,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { JAXXCompiler compiler) throws CompilerException { // do nothing compiler.reportError("can not add CompiledObject in the tag '" + - TAG + " (only field tags)"); + TAG + " (only field tags)"); } public boolean foundBean() { @@ -520,7 +520,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { JAXXCompiler compiler) { boolean withError = false; if (uiClass == null && - compiler.getConfiguration().getDefaultErrorUI() != null) { + compiler.getConfiguration().getDefaultErrorUI() != null) { uiClass = compiler.getConfiguration().getDefaultErrorUI().getName(); } if (uiClass != null) { @@ -530,8 +530,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (!ClassDescriptorHelper.getClassDescriptor(AbstractBeanValidatorUI.class).isAssignableFrom(uiClazz)) { compiler.reportError( "attribute 'ui' :'" + uiClass + - "' is not assignable from class " + - AbstractBeanValidatorUI.class + "' is not assignable from class " + + AbstractBeanValidatorUI.class ); withError = true; } else { @@ -568,7 +568,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { errorListModel = ERROR_LIST_MODEL_DEFAULT; } else { if (errorListModel.startsWith("{") && - errorListModel.endsWith("}")) { + errorListModel.endsWith("}")) { // this is a script, no check here errorListModel = errorListModel.substring( 1, @@ -609,7 +609,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { errorTableModel = ERROR_TABLE_MODEL_DEFAULT; } else { if (errorTableModel.startsWith("{") && - errorTableModel.endsWith("}")) { + errorTableModel.endsWith("}")) { // this is a script, no check here errorTableModel = errorTableModel.substring( 1, errorTableModel.length() - 1).trim(); @@ -641,7 +641,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (parentValidator != null) { String initializer; if (parentValidator.startsWith("{") && - parentValidator.endsWith("}")) { + parentValidator.endsWith("}")) { // todo : should be able to bind initializer = parentValidator.substring( @@ -697,7 +697,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { String prefix = compiler.getImportedType(SwingValidatorUtil.class); String code = prefix + - ".registerErrorListMouseListener(" + errorList + ");"; + ".registerErrorListMouseListener(" + errorList + ");"; appendAdditionCode(code); return false; @@ -726,8 +726,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { String prefix = compiler.getImportedType(SwingValidatorUtil.class); String code = prefix + - ".registerErrorTableMouseListener(" + errorTable + - ");"; + ".registerErrorTableMouseListener(" + errorTable + + ");"; appendAdditionCode(code); return false; @@ -744,7 +744,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (beanClass == null) { compiler.reportError( "could not find class of the bean '" + bean + - "', and no beanClass was setted"); + "', and no beanClass was setted"); return true; } } @@ -752,8 +752,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (beanClass == null) { compiler.reportError( "tag '" + tag + "' requires a 'beanClass' attribute, " + - "and could not guest it from 'bean' attribute " + - "(no bean attribute setted...)"); + "and could not guest it from 'bean' attribute " + + "(no bean attribute setted...)"); return true; } @@ -797,8 +797,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (isBeanUsedByValidator(compiler, bean)) { compiler.reportError( "the bean '" + bean + "' is already used in " + - "another the validator, can not used it in '" + - tag + "'" + "another the validator, can not used it in '" + + tag + "'" ); return true; } @@ -824,7 +824,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { String type = compiler.getImportedType(beanClassName); // contextName must be in constructor to able to init validator with his correct contextName String constructorParams = type + ".class, " + - TypeManager.getJavaCode(context); + TypeManager.getJavaCode(context); // setConstructorParams(constructorParams); String validatorFactoryFqn = compiler.getConfiguration().getValidatorFactoryFQN(); @@ -857,18 +857,10 @@ public class BeanValidatorHandler extends DefaultObjectHandler { private void registerValidator( JAXXCompiler compiler, CompiledBeanValidator compiledBeanValidator) { - List<CompiledBeanValidator> vals = validators.get(compiler); - if (vals == null) { - vals = new ArrayList<>(); - validators.put(compiler, vals); - } + List<CompiledBeanValidator> vals = validators.computeIfAbsent(compiler, k -> new ArrayList<>()); vals.add(compiledBeanValidator); - List<String> ids = validatedComponents.get(compiler); - if (ids == null) { - ids = new ArrayList<>(); - validatedComponents.put(compiler, ids); - } -// ids.addAll(compiledBeanValidator.getFields().values()); + List<String> ids = validatedComponents.computeIfAbsent(compiler, k -> new ArrayList<>()); + // ids.addAll(compiledBeanValidator.getFields().values()); ids.addAll(compiledBeanValidator.getFieldEditors()); } @@ -940,8 +932,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { String descriptionName = beanProperty.getName(); if (log.isDebugEnabled()) { log.debug("try to bind on bean " + - beanInfo.getJAXXBeanDescriptor().getName() + - " property " + descriptionName); + beanInfo.getJAXXBeanDescriptor().getName() + + " property " + descriptionName); } if (beanProperty.getWriteMethodDescriptor() == null) { // read-only property @@ -975,8 +967,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (containsFieldPropertyName(key)) { compiler.reportWarning( "field '" + key + "' can not be used and " + - "excluded at same time ! (field is skipped) " + - "for validator " + this + "excluded at same time ! (field is skipped) " + + "for validator " + this ); // fields.remove(key); removeFieldPropertyName(key); @@ -1027,7 +1019,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { // read-onlyproperty compiler.reportError( "could not bind the readonly property '" + - propertyName + "' on bean [" + getBean() + "] "); + propertyName + "' on bean [" + getBean() + "] "); return false; } return true; @@ -1035,7 +1027,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { } compiler.reportError( "could not find the property '" + propertyName + - "' on bean [" + getBean() + "] "); + "' on bean [" + getBean() + "] "); return false; } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java index 5704fea..2fef194 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.compiler.tags.validator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; @@ -29,8 +31,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tags.TagHandler; import org.nuiton.jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; import java.io.IOException; @@ -67,8 +67,8 @@ public class ExcludeFieldValidatorHandler implements TagHandler { if (!descriptor.isAssignableFrom( compiler.getOpenComponent().getObjectClass())) { compiler.reportError(TAG + " tag may only appear within " + - BeanValidatorHandler.TAG + " tag but was " + - tag); + BeanValidatorHandler.TAG + " tag but was " + + tag); return; } @@ -76,14 +76,14 @@ public class ExcludeFieldValidatorHandler implements TagHandler { (CompiledBeanValidator) compiler.getOpenComponent(); if (!info.getAutoField()) { compiler.reportError(TAG + " tag can not be used without an " + - "'autoField' validator : " + tag); + "'autoField' validator : " + tag); return; } String name = tag.getAttribute(NAME_ATTRIBUTE); String component = tag.getAttribute(COMPONENT_ATTRIBUTE); if (name == null || name.trim().isEmpty()) { compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + - " attribute"); + " attribute"); return; } name = name.trim(); @@ -91,10 +91,10 @@ public class ExcludeFieldValidatorHandler implements TagHandler { // try to use the name as component if (!compiler.checkReference(tag, name, false, name)) { compiler.reportError(TAG + " tag requires a " + - COMPONENT_ATTRIBUTE + " attribute, try " + - "to use the name attribute [" + name + - "] for the component, but no such " + - "component found"); + COMPONENT_ATTRIBUTE + " attribute, try " + + "to use the name attribute [" + name + + "] for the component, but no such " + + "component found"); return; } component = name; @@ -105,15 +105,15 @@ public class ExcludeFieldValidatorHandler implements TagHandler { // if (info.getFields().containsValue(component)) { if (info.containsFieldEditor(component)) { compiler.reportError(TAG + " tag found a attribute " + - COMPONENT_ATTRIBUTE + " [" + component + - "] already used in this validator"); + COMPONENT_ATTRIBUTE + " [" + component + + "] already used in this validator"); return; } // if (info.getExcludeFields().containsValue(component)) { if (info.containsExcludeFieldEditor(component)) { compiler.reportError(TAG + " tag found a attribute " + - COMPONENT_ATTRIBUTE + " [" + component + - "] already used in this validator"); + COMPONENT_ATTRIBUTE + " [" + component + + "] already used in this validator"); return; } // check component exist (again perharps, but let the error knows exactly which tag failed...) diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/FieldValidatorHandler.java index 7c60f71..45a8e54 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tags/validator/FieldValidatorHandler.java @@ -22,6 +22,9 @@ package org.nuiton.jaxx.compiler.tags.validator; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.binding.DataBindingHelper; @@ -30,9 +33,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.tags.TagHandler; import org.nuiton.jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; import java.io.IOException; @@ -69,7 +69,7 @@ public class FieldValidatorHandler implements TagHandler { compiler.getOpenComponent().getObjectClass())) { compiler.reportError( TAG + " tag may only appear within " + - BeanValidatorHandler.TAG + " tag but was " + tag); + BeanValidatorHandler.TAG + " tag but was " + tag); return; } @@ -79,7 +79,7 @@ public class FieldValidatorHandler implements TagHandler { String name = tag.getAttribute(NAME_ATTRIBUTE); if (StringUtils.isEmpty(name)) { compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + - " attribute"); + " attribute"); return; } name = name.trim(); @@ -90,8 +90,8 @@ public class FieldValidatorHandler implements TagHandler { if (!compiler.checkReference(tag, name, false, name)) { compiler.reportError( TAG + " tag requires a " + COMPONENT_ATTRIBUTE + - " attribute, try to use the name attribute [" + name + - "] for the component, but no such component found"); + " attribute, try to use the name attribute [" + name + + "] for the component, but no such component found"); return; } component = name; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileFirstPassTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileFirstPassTask.java index 911245e..125e012 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileFirstPassTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileFirstPassTask.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.io.File; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileSecondPassTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileSecondPassTask.java index 2cb5eb3..315b3de 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileSecondPassTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/CompileSecondPassTask.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Task to execute the Second round of compile. @@ -79,7 +79,7 @@ public class CompileSecondPassTask extends JAXXEngineTask { addEndProfileTime(engine, compiler); if (log.isDebugEnabled()) { log.debug("done with result [" + !compiler.isFailed() + - "] for " + className); + "] for " + className); } if (compiler.isFailed()) { success = false; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/FinalizeTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/FinalizeTask.java index 443c6a3..594451d 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/FinalizeTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/FinalizeTask.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Task to execute after stylesheet tasks and juste before generation task. diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateConstructorsTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateConstructorsTask.java index 6bb6d40..08df680 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateConstructorsTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateConstructorsTask.java @@ -21,6 +21,8 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -37,8 +39,6 @@ import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.compiler.tags.TagManager; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.Iterator; @@ -92,7 +92,7 @@ public class GenerateConstructorsTask extends JAXXEngineTask { if (isVerbose) { log.info("Round " + round++ + ", still " + - compilers.size() + " compilers to treat."); + compilers.size() + " compilers to treat."); } // launch a round since there is still some compiler to treat @@ -108,7 +108,7 @@ public class GenerateConstructorsTask extends JAXXEngineTask { if (log.isDebugEnabled()) { log.debug("Compute constructor from non super " + - "jaxx object file " + javaFile.getName()); + "jaxx object file " + javaFile.getName()); } // get the constructors of the parent class @@ -123,14 +123,14 @@ public class GenerateConstructorsTask extends JAXXEngineTask { ClassDescriptor parentClassDescriptor = rootObject.getObjectClass(); if (parentClassDescriptor.getResolverType() - != ClassDescriptorHelper.ResolverType.JAXX_FILE) { + != ClassDescriptorHelper.ResolverType.JAXX_FILE) { // the parent was not generated by this engine; we can safely // use it if (log.isDebugEnabled()) { log.debug("Compute constructor from outside super " + - "jaxx object file " + javaFile.getName()); + "jaxx object file " + javaFile.getName()); } addConstructorsForSuperClassJaxx(engine, compiler, null); itr.remove(); @@ -149,7 +149,7 @@ public class GenerateConstructorsTask extends JAXXEngineTask { if (log.isDebugEnabled()) { log.debug("Compute constructor from inside super " + - "jaxx object file " + javaFile.getName()); + "jaxx object file " + javaFile.getName()); } addConstructorsForSuperClassJaxx(engine, compiler, parentCompiler); @@ -160,8 +160,8 @@ public class GenerateConstructorsTask extends JAXXEngineTask { // can not treate at the moment... if (log.isDebugEnabled()) { log.debug("Can not compute constructors for " + - compiler.getRootObject().getId() + - " waits fro his parent to be treated..."); + compiler.getRootObject().getId() + + " waits fro his parent to be treated..."); } } } @@ -189,7 +189,7 @@ public class GenerateConstructorsTask extends JAXXEngineTask { if (javaFile.isSuperclassIsJAXXObject()) { throw new IllegalStateException( "This method does not accept compiler that " + - "inheritates from a jaxx file."); + "inheritates from a jaxx file."); } String className = javaFile.getSimpleName(); @@ -270,7 +270,7 @@ public class GenerateConstructorsTask extends JAXXEngineTask { if (!javaFile.isSuperclassIsJAXXObject()) { throw new IllegalStateException( "This method does not accept compiler that " + - "inheritates not from a jaxx file."); + "inheritates not from a jaxx file."); } String className = javaFile.getSimpleName(); diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateMissingRulesTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateMissingRulesTask.java index 1f94b5a..b129f7f 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateMissingRulesTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateMissingRulesTask.java @@ -21,16 +21,18 @@ */ package org.nuiton.jaxx.compiler.tasks; -import org.nuiton.jaxx.compiler.CompiledObject; -import org.nuiton.jaxx.compiler.JAXXCompiler; -import org.nuiton.jaxx.compiler.JAXXCompilerFile; -import org.nuiton.jaxx.compiler.JAXXEngine; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.CompiledObject; +import org.nuiton.jaxx.compiler.JAXXCompiler; +import org.nuiton.jaxx.compiler.JAXXCompilerFile; +import org.nuiton.jaxx.compiler.JAXXEngine; import java.io.File; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -75,7 +77,7 @@ public class GenerateMissingRulesTask extends JAXXEngineTask { File cssFile = jaxxFile.getCssFile(); - String cssContent = FileUtils.readFileToString(cssFile); + String cssContent = new String(Files.readAllBytes(cssFile.toPath()), StandardCharsets.UTF_8); Map<String, CompiledObject> objects = compiler.getObjects(); @@ -98,7 +100,7 @@ public class GenerateMissingRulesTask extends JAXXEngineTask { if (log.isInfoEnabled()) { log.info("add css rule for #" + id + " in " + cssFile.getName()); } - cssRulesToAdd.add( "\n\n/* #" + id + " {} */"); + cssRulesToAdd.add("\n\n/* #" + id + " {} */"); } } @@ -110,7 +112,7 @@ public class GenerateMissingRulesTask extends JAXXEngineTask { if (log.isInfoEnabled()) { log.info("add css rule for ." + styleClass + " in " + cssFile.getName()); } - cssRulesToAdd.add( "\n\n/* ." + styleClass + " {} */"); + cssRulesToAdd.add("\n\n/* ." + styleClass + " {} */"); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateTask.java index a2c6040..10e7666 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/GenerateTask.java @@ -21,6 +21,9 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.eugene.java.extension.ImportsManager; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; @@ -28,9 +31,6 @@ import org.nuiton.jaxx.compiler.java.JavaArgument; import org.nuiton.jaxx.compiler.java.JavaConstructor; import org.nuiton.jaxx.compiler.java.JavaFile; import org.nuiton.jaxx.compiler.java.JavaFileGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.eugene.java.extension.ImportsManager; import java.io.IOException; import java.util.ArrayList; @@ -106,7 +106,7 @@ public class GenerateTask extends JAXXEngineTask { // push back previous imports for (String importFQN : javaFile.getImports()) { if (!packageToExclude.equals(importFQN) && - !imports.contains(importFQN)) { + !imports.contains(importFQN)) { imports.add(importFQN); } } @@ -140,8 +140,8 @@ public class GenerateTask extends JAXXEngineTask { f.setSuperClass(type); } catch (Exception e) { log.error("file [" + f.getName() + - "] Could not determine simple name of super class " + - superClass); + "] Could not determine simple name of super class " + + superClass); } } @@ -153,8 +153,8 @@ public class GenerateTask extends JAXXEngineTask { interfaces2.add(newInterface); } catch (Exception e) { log.error("file [" + f.getName() + - "] Could not get interface " + anInterface + " :: " + - e.getMessage()); + "] Could not get interface " + anInterface + " :: " + + e.getMessage()); interfaces2.add(anInterface); } } @@ -173,7 +173,7 @@ public class GenerateTask extends JAXXEngineTask { result.remove(packageName + ".*"); if (log.isDebugEnabled()) { log.debug("[" + f.getName() + "] Detect " + result.size() + - " imports to add."); + " imports to add."); for (String s : result) { log.debug(" " + s); } @@ -195,8 +195,8 @@ public class GenerateTask extends JAXXEngineTask { argument.setType(simpleType); } catch (Exception e) { log.error("file [" + f.getName() + - "] Could not get simple type of constructor paramter " + type + " :: " + - e.getMessage()); + "] Could not get simple type of constructor paramter " + type + " :: " + + e.getMessage()); } } diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/InitTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/InitTask.java index e13a09d..60d8908 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/InitTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/InitTask.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.CompilerConfiguration; import org.nuiton.jaxx.compiler.JAXXEngine; import org.nuiton.jaxx.compiler.JAXXFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * The init task to be launched first. diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/ProfileTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/ProfileTask.java index 27135a2..a0d08df 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/ProfileTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/ProfileTask.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.compiler.tasks; -import org.nuiton.jaxx.compiler.JAXXEngine; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.compiler.JAXXEngine; /** * A task to display result of profile mode diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/StyleSheetTask.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/StyleSheetTask.java index a936973..1fd3da9 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/StyleSheetTask.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tasks/StyleSheetTask.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.compiler.tasks; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Task to apply css stylesheet on objects after second round of compilation. diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/PrintTagInfo.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/PrintTagInfo.java index e2637e4..6352155 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/PrintTagInfo.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/PrintTagInfo.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.compiler.tools; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.compiler.DefaultCompilerConfiguration; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXFactory; @@ -31,7 +32,6 @@ import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.compiler.tags.DefaultObjectHandler; import org.nuiton.jaxx.compiler.tags.TagManager; -import org.apache.commons.lang3.StringUtils; import java.io.BufferedWriter; import java.io.FileWriter; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java index 78767ec..f572a75 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java @@ -22,6 +22,7 @@ package org.nuiton.jaxx.compiler.tools.jaxxcapture; +import org.apache.commons.lang3.StringUtils; import org.nuiton.jaxx.compiler.ClassMap; import org.nuiton.jaxx.compiler.CompiledObject; import org.nuiton.jaxx.compiler.JAXXCompiler; @@ -31,7 +32,6 @@ import org.nuiton.jaxx.compiler.tools.jaxxcapture.handlers.JTabbedPaneHandler; import org.nuiton.jaxx.compiler.tools.jaxxcapture.handlers.ObjectHandler; import org.nuiton.jaxx.compiler.tools.jaxxcapture.handlers.TableHandler; import org.nuiton.jaxx.compiler.types.TypeManager; -import org.apache.commons.lang3.StringUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; diff --git a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/types/GridBagConstraintsConverter.java b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/types/GridBagConstraintsConverter.java index e1c3310..2d857bd 100644 --- a/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/types/GridBagConstraintsConverter.java +++ b/jaxx-compiler/src/main/java/org/nuiton/jaxx/compiler/types/GridBagConstraintsConverter.java @@ -37,8 +37,8 @@ public class GridBagConstraintsConverter implements TypeConverter { public String getJavaCode(Object object) { GridBagConstraints g = (GridBagConstraints) object; return "new GridBagConstraints(" + g.gridx + ", " + g.gridy + ", " + g.gridwidth + ", " + g.gridheight + ", " + - g.weightx + ", " + g.weighty + ", " + g.anchor + ", " + g.fill + ", " + - TypeManager.getJavaCode(g.insets) + ", " + g.ipadx + ", " + g.ipady + ")"; + g.weightx + ", " + g.weighty + ", " + g.anchor + ", " + g.fill + ", " + + TypeManager.getJavaCode(g.insets) + ", " + g.ipadx + ", " + g.ipady + ")"; } @Override diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/binding/JavaParserUtilTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/binding/JavaParserUtilTest.java index 3daf310..6ca454e 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/binding/JavaParserUtilTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/binding/JavaParserUtilTest.java @@ -21,15 +21,20 @@ */ package org.nuiton.jaxx.compiler.binding; -import org.nuiton.jaxx.compiler.java.parser.JavaParser; -import org.nuiton.jaxx.compiler.java.parser.SimpleNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.Test; +import org.nuiton.jaxx.compiler.java.parser.JavaParser; +import org.nuiton.jaxx.compiler.java.parser.SimpleNode; import java.io.StringReader; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Created: 5 déc. 2009 diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/JavaMethodTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/JavaMethodTest.java index e65526f..d9815ea 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/JavaMethodTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/JavaMethodTest.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.compiler.java; -import org.nuiton.jaxx.compiler.java.JavaMethod.MethodOrder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.Test; +import org.nuiton.jaxx.compiler.java.JavaMethod.MethodOrder; import java.lang.reflect.Modifier; import java.util.EnumSet; diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/parser/JavaParserTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/parser/JavaParserTest.java index 9f36fa9..514510a 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/parser/JavaParserTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/java/parser/JavaParserTest.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.compiler.java.parser; * #L% */ +import org.junit.Assert; +import org.junit.Test; import org.nuiton.jaxx.compiler.CompilerException; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.MethodDescriptor; import org.nuiton.jaxx.compiler.reflect.resolvers.ClassDescriptorResolverFromJavaFile; -import org.junit.Assert; -import org.junit.Test; import org.nuiton.util.FileUtil; import java.io.BufferedReader; @@ -64,7 +64,7 @@ public class JavaParserTest { ClassDescriptor yo = resolver.resolvDescriptor("yo", thisClassJavaFile.toURI().toURL()); MethodDescriptor[] methodDescriptors = yo.getMethodDescriptors(); - Assert.assertTrue(methodDescriptors.length>3); + Assert.assertTrue(methodDescriptors.length > 3); { MethodDescriptor method = yo.getMethodDescriptor("testParseClassButNotMethodBody"); @@ -113,12 +113,12 @@ public class JavaParserTest { } - public void methodWithTryResourceInside() { + public void methodWithTryResourceInside() { try (BufferedReader reader = Files.newBufferedReader(new File("").toPath(), Charset.forName("UTF-8"))) { System.out.println(reader); - } catch (IOException | RuntimeException e ) { + } catch (IOException | RuntimeException e) { e.printStackTrace(); } diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyAbstractClass.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyAbstractClass.java index aae04ef..72d3f28 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyAbstractClass.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyAbstractClass.java @@ -30,6 +30,6 @@ package org.nuiton.jaxx.compiler.reflect; public abstract class MyAbstractClass implements MyInterface { protected void myAbstractMethod() { - + } } diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyChildClass.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyChildClass.java index 03b1f41..ab14fcb 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyChildClass.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyChildClass.java @@ -29,7 +29,7 @@ package org.nuiton.jaxx.compiler.reflect; * @author Tony Chemit - dev@tchemit.fr * @since 2.4.2 */ -public class MyChildClass extends MyClass implements Cloneable{ +public class MyChildClass extends MyClass implements Cloneable { private static final long serialVersionUID = 2L; diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyInterface.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyInterface.java index 989149e..f53226b 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyInterface.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/MyInterface.java @@ -28,7 +28,7 @@ package org.nuiton.jaxx.compiler.reflect; * @since 2.0.2 */ public interface MyInterface { - + String MY_CONSTANT = "constant"; void myMethod(); diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java index c1f5ce3..e33d1f2 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/reflect/resolvers/ClassDescriptorResolverFromJavaFileTest.java @@ -21,6 +21,12 @@ */ package org.nuiton.jaxx.compiler.reflect.resolvers; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.nuiton.config.ConfigOptionDef; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; import org.nuiton.jaxx.compiler.reflect.FieldDescriptor; @@ -32,12 +38,6 @@ import org.nuiton.jaxx.compiler.reflect.MyEnum; import org.nuiton.jaxx.compiler.reflect.MyInterface; import org.nuiton.jaxx.compiler.reflect.MyInterface2; import org.nuiton.jaxx.compiler.reflect.MyInterface3; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.nuiton.config.ConfigOptionDef; import org.nuiton.util.FileUtil; import java.io.File; diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/tags/TagManagerTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/tags/TagManagerTest.java index 5423305..268d650 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/tags/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/tags/TagManagerTest.java @@ -22,16 +22,16 @@ package org.nuiton.jaxx.compiler.tags; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; import org.nuiton.jaxx.compiler.CompilerConfiguration; import org.nuiton.jaxx.compiler.DefaultCompilerConfiguration; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXFactory; import org.nuiton.jaxx.compiler.reflect.ClassDescriptor; import org.nuiton.jaxx.compiler.reflect.ClassDescriptorHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; import javax.swing.JPopupMenu; import java.io.ByteArrayOutputStream; diff --git a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/types/ColorConverterTest.java b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/types/ColorConverterTest.java index 8d53def..1b7b77e 100644 --- a/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/types/ColorConverterTest.java +++ b/jaxx-compiler/src/test/java/org/nuiton/jaxx/compiler/types/ColorConverterTest.java @@ -26,7 +26,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.awt.*; +import java.awt.Color; public class ColorConverterTest { diff --git a/jaxx-compiler/src/test/resources/log4j.properties b/jaxx-compiler/src/test/resources/log4j.properties index bd8e0e8..5725721 100644 --- a/jaxx-compiler/src/test/resources/log4j.properties +++ b/jaxx-compiler/src/test/resources/log4j.properties @@ -25,5 +25,4 @@ log4j.rootLogger=ERROR, stdout 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.org.nuiton.jaxx=INFO diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index 79c8300..263932a 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> <parent> @@ -488,8 +489,12 @@ <phase>process-resources</phase> <configuration> <target> - <copy failonerror="true" overwrite="true" file="${project.build.directory}/changelog/${project.parent.artifactId}-${project.version}-changelog.pom" tofile="${project.build.directory}/generated-sources/license/CHANGELOG.txt" /> - <copy failonerror="true" overwrite="true" file="${project.build.directory}/changelog/${project.parent.artifactId}-${project.version}-changelog.pom" tofile="${project.build.directory}/generated-sources/license/META-INF/jaxx-demo-CHANGELOG.txt" /> + <copy failonerror="true" overwrite="true" + file="${project.build.directory}/changelog/${project.parent.artifactId}-${project.version}-changelog.pom" + tofile="${project.build.directory}/generated-sources/license/CHANGELOG.txt"/> + <copy failonerror="true" overwrite="true" + file="${project.build.directory}/changelog/${project.parent.artifactId}-${project.version}-changelog.pom" + tofile="${project.build.directory}/generated-sources/license/META-INF/jaxx-demo-CHANGELOG.txt"/> </target> </configuration> <goals> diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoApplicationContext.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoApplicationContext.java index d1651a7..a21502e 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoApplicationContext.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoApplicationContext.java @@ -22,15 +22,15 @@ package org.nuiton.jaxx.demo; * #L% */ +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.context.DefaultApplicationContext; import org.nuiton.jaxx.runtime.context.JAXXContextEntryDef; import org.nuiton.jaxx.runtime.swing.help.JAXXHelpBroker; import org.nuiton.jaxx.runtime.swing.help.JAXXHelpUIHandler; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.io.InputStream; import java.net.URI; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoConfig.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoConfig.java index 39c80e2..50cc5bd 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoConfig.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoConfig.java @@ -23,7 +23,6 @@ package org.nuiton.jaxx.demo; import com.google.common.base.Supplier; -import org.nuiton.jaxx.runtime.JAXXUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.beans.AbstractBean; @@ -31,6 +30,7 @@ import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ArgumentsParserException; import org.nuiton.config.ConfigOptionDef; import org.nuiton.jaxx.demo.component.swing.JButtonDemo; +import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.version.Version; import org.nuiton.version.Versions; @@ -204,48 +204,39 @@ public class DemoConfig extends AbstractBean implements Supplier<ApplicationConf /** @return la version de l'application. */ public Version getVersion() { - Version option = applicationConfig.getOption(Version.class, "version"); - return option; + return applicationConfig.getOption(Version.class, "version"); } public boolean isFullScreen() { - boolean result = applicationConfig.getOptionAsBoolean(Option.FULL_SCREEN.key); - return result; + return applicationConfig.getOptionAsBoolean(Option.FULL_SCREEN.key); } public Locale getLocale() { - Locale result = applicationConfig.getOption(Locale.class, Option.LOCALE.key); - return result; + return applicationConfig.getOption(Locale.class, Option.LOCALE.key); } public String getDemoPath() { - String result = applicationConfig.getOption(Option.DEMO_PATH.key); - return result; + return applicationConfig.getOption(Option.DEMO_PATH.key); } public Float getFontSize() { - Float result = applicationConfig.getOption(Float.class, Option.FONT_SIZE.key); - return result; + return applicationConfig.getOption(Float.class, Option.FONT_SIZE.key); } public Color getDemoColor() { - Color result = applicationConfig.getOptionAsColor(Option.DEMO_COLOR.key); - return result; + return applicationConfig.getOptionAsColor(Option.DEMO_COLOR.key); } public Class<?> getDemoClass() { - Class<?> result = applicationConfig.getOptionAsClass(Option.DEMO_CLASS.key); - return result; + return applicationConfig.getOptionAsClass(Option.DEMO_CLASS.key); } public String getLogLevel() { - String level = applicationConfig.getOption(Option.LOG_LEVEL.key); - return level; + return applicationConfig.getOption(Option.LOG_LEVEL.key); } public String getLogPatternLayout() { - String result = applicationConfig.getOption(Option.LOG_PATTERN_LAYOUT.key); - return result; + return applicationConfig.getOption(Option.LOG_PATTERN_LAYOUT.key); } public KeyStroke getKeyOpenConfig() { @@ -353,10 +344,9 @@ public class DemoConfig extends AbstractBean implements Supplier<ApplicationConf } public String getHelpResourceWithLocale(String value) { - String result = getHelpLocation() + "/" + + return getHelpLocation() + "/" + getLocale().getLanguage() + "/" + value; - return result; } ////////////////////////////////////////////////// diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoHelpBroker.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoHelpBroker.java index 7a0741b..1c79728 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoHelpBroker.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoHelpBroker.java @@ -22,7 +22,8 @@ package org.nuiton.jaxx.demo; * #L% */ -import com.google.common.base.Preconditions; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.runtime.awt.visitor.BuildTreeVisitor; @@ -31,8 +32,6 @@ import org.nuiton.jaxx.runtime.awt.visitor.DebugComponentTreeNodeVisitor; import org.nuiton.jaxx.runtime.awt.visitor.GetCompopentAtPointVisitor; import org.nuiton.jaxx.runtime.swing.help.JAXXHelpBroker; import org.nuiton.jaxx.runtime.swing.help.JAXXHelpUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.AbstractButton; import java.awt.Component; @@ -40,6 +39,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; +import java.util.Objects; /** * Help broker. @@ -61,7 +61,7 @@ public class DemoHelpBroker extends JAXXHelpBroker { @Override public void prepareUI(JAXXObject c) { - Preconditions.checkNotNull(c, "parameter c can not be null!"); + Objects.requireNonNull(c, "parameter c can not be null!"); // l'ui doit avoir un boutton showHelp AbstractButton help = getShowHelpButton(c); diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoSourcesHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoSourcesHandler.java index 19b15bd..3439a5d 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoSourcesHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoSourcesHandler.java @@ -22,17 +22,18 @@ package org.nuiton.jaxx.demo; import com.google.common.collect.Lists; -import org.nuiton.jaxx.runtime.JAXXObject; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.spi.UIHandler; -import org.nuiton.jaxx.widgets.font.FontSizor; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +import org.nuiton.jaxx.runtime.JAXXObject; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.widgets.font.FontSizor; import java.awt.event.ItemEvent; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -104,7 +105,7 @@ public class DemoSourcesHandler implements UIHandler<DemoSources> { int lastDotIndex = name.lastIndexOf(""); String path = "/" + name.substring(0, lastDotIndex).replaceAll("\\.", "/"); path += name.substring(lastDotIndex); - result = IOUtils.toString(ui.getIncomingClass().getResourceAsStream(path)); + result = IOUtils.toString(ui.getIncomingClass().getResourceAsStream(path), StandardCharsets.UTF_8); if (log.isDebugEnabled()) { log.debug("source [" + name + "], loaded content =\n" + result); } diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoUIHandler.java index 962069c..5a2c152 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/DemoUIHandler.java @@ -26,7 +26,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorProvider; import org.nuiton.i18n.I18n; -import org.nuiton.jaxx.widgets.config.ConfigUIHelper; import org.nuiton.jaxx.demo.tree.DemoNode; import org.nuiton.jaxx.demo.tree.DemoTreeHelper; import org.nuiton.jaxx.runtime.JAXXContext; @@ -39,6 +38,7 @@ import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import org.nuiton.jaxx.widgets.about.AboutUI; import org.nuiton.jaxx.widgets.about.AboutUIBuilder; +import org.nuiton.jaxx.widgets.config.ConfigUIHelper; import org.nuiton.jaxx.widgets.error.ErrorDialogUI; import javax.swing.AbstractAction; @@ -516,7 +516,6 @@ public class DemoUIHandler implements UIHandler<DemoUI> { if (context instanceof DemoUI) { return (DemoUI) context; } - DemoUI ui = MAIN_UI_ENTRY_DEF.getContextValue(context); - return ui; + return MAIN_UI_ENTRY_DEF.getContextValue(context); } } diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanComboBoxDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanComboBoxDemoHandler.java index e17d52f..af3b37e 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanComboBoxDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanComboBoxDemoHandler.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.demo.component.jaxx.editor; * #L% */ -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.DemoDecoratorProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.spi.UIHandler; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanDoubleListDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanDoubleListDemoHandler.java index fe61fdd..13d530a 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanDoubleListDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanDoubleListDemoHandler.java @@ -26,13 +26,13 @@ package org.nuiton.jaxx.demo.component.jaxx.editor; * #L% */ -import com.google.common.base.Predicate; -import org.nuiton.jaxx.runtime.spi.UIHandler; +import java.util.function.Predicate; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.DemoDecoratorProvider; import org.nuiton.jaxx.demo.entities.Movie; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.spi.UIHandler; import java.util.List; @@ -53,8 +53,8 @@ public class BeanDoubleListDemoHandler implements UIHandler<BeanDoubleListDemo> JXPathDecorator<People> decorator = (JXPathDecorator<People>) new DemoDecoratorProvider().getDecoratorByType(People.class); ui.getDoubleList().init(decorator, data, data.subList(0, 1)); - final Movie nacho = demoDataProvider.getMovie("0"); - final Predicate<People> filter = input -> nacho.getActors().contains(input); + Movie nacho = demoDataProvider.getMovie("0"); + Predicate<People> filter = input -> nacho.getActors().contains(input); ui.getFilterOnNachoButton().addChangeListener(e -> { if (BeanDoubleListDemoHandler.this.ui.getFilterOnNachoButton().isSelected()) { BeanDoubleListDemoHandler.this.ui.getDoubleList().getHandler().addFilter(filter); diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanFilterableComboBoxDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanFilterableComboBoxDemoHandler.java index ae92ba8..bef0d6b 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanFilterableComboBoxDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/editor/BeanFilterableComboBoxDemoHandler.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.demo.component.jaxx.editor; * #L% */ -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.DemoDecoratorProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.spi.UIHandler; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/widgets/select/FilterableDoubleListDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/widgets/select/FilterableDoubleListDemoHandler.java index fd174a4..3f3be95 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/widgets/select/FilterableDoubleListDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/jaxx/widgets/select/FilterableDoubleListDemoHandler.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.demo.component.jaxx.widgets.select; * #L% */ -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.DemoDecoratorProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.select.FilterableDoubleList; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/swing/HidorButtonDemo.jaxx b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/swing/HidorButtonDemo.jaxx index b06b2a7..42ccb65 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/swing/HidorButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/component/swing/HidorButtonDemo.jaxx @@ -25,16 +25,16 @@ <HBox horizontalAlignment='center' verticalAlignment='middle'> <org.nuiton.jaxx.widgets.hidor.HidorButton target='{hidor1}' showText="show label1" - hideText='hide label1' - targetVisible='{true}'/> + hideText='hide label1' + targetVisible='{true}'/> <JLabel id='hidor1' text='Label 1'/> </HBox> <HBox horizontalAlignment='center' verticalAlignment='middle'> <org.nuiton.jaxx.widgets.hidor.HidorButton target='{hidor2}' showText="show label2" - hideText='hide label2' - targetVisible='{false}'/> + hideText='hide label2' + targetVisible='{false}'/> <JLabel id='hidor2' text='Label 2'/> </HBox> diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/entities/DemoDataProvider.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/entities/DemoDataProvider.java index 5751ef1..2ef3c1e 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/entities/DemoDataProvider.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/entities/DemoDataProvider.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.demo.entities; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; import java.util.ArrayList; import java.util.HashMap; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/NavDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/NavDemoHandler.java index 6b9bbd5..cb3a96f 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/NavDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/NavDemoHandler.java @@ -21,12 +21,6 @@ */ package org.nuiton.jaxx.demo.feature.nav; -import org.nuiton.jaxx.runtime.JAXXContext; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.spi.UIHandler; -import org.nuiton.jaxx.runtime.swing.CardLayout2; -import org.nuiton.jaxx.widgets.error.ErrorDialogUI; -import org.nuiton.jaxx.runtime.swing.nav.NavNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTreeTable; @@ -44,6 +38,12 @@ import org.nuiton.jaxx.demo.feature.nav.content.MoviesContentUI; import org.nuiton.jaxx.demo.feature.nav.tree.NavDemoTreeCellRenderer; import org.nuiton.jaxx.demo.feature.nav.tree.NavDemoTreeNode; import org.nuiton.jaxx.demo.feature.nav.treetable.NavDemoTreeTableNode; +import org.nuiton.jaxx.runtime.JAXXContext; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.runtime.swing.CardLayout2; +import org.nuiton.jaxx.runtime.swing.nav.NavNode; +import org.nuiton.jaxx.widgets.error.ErrorDialogUI; import javax.swing.ImageIcon; import javax.swing.JPanel; @@ -177,9 +177,7 @@ public class NavDemoHandler implements UIHandler<NavDemo> { if (data == null) { return "no content"; } - StringBuilder buffer = new StringBuilder(); - buffer.append(data); - return buffer.toString(); + return String.valueOf(data); } public ImageIcon getImage(AbstractDemoBean data) { diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/ActorsTreeNodeLoador.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/ActorsTreeNodeLoador.java index ee84932..a09f92e 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/ActorsTreeNodeLoador.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/ActorsTreeNodeLoador.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.demo.feature.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/MoviesTreeNodeLoador.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/MoviesTreeNodeLoador.java index 891776f..05c8778 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/MoviesTreeNodeLoador.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/MoviesTreeNodeLoador.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.demo.feature.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.NavHelper; -import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.Movie; import org.nuiton.jaxx.demo.feature.nav.NavDemoHandler; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.NavHelper; +import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeCellRenderer.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeCellRenderer.java index f4b7209..6dba11a 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeCellRenderer.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeCellRenderer.java @@ -22,7 +22,6 @@ package org.nuiton.jaxx.demo.feature.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.Decorator; @@ -30,6 +29,7 @@ import org.nuiton.decorator.DecoratorProvider; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.Movie; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import javax.swing.JTree; import javax.swing.tree.DefaultTreeModel; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeHelper.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeHelper.java index 9f7530c..d0a308b 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeHelper.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/tree/NavDemoTreeHelper.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.demo.feature.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeHelper; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.feature.nav.NavDemoHandler; +import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeHelper; import javax.swing.tree.DefaultTreeModel; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/ActorsTreeTableNodeLoador.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/ActorsTreeTableNodeLoador.java index 75cc275..e1e56d6 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/ActorsTreeTableNodeLoador.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/ActorsTreeTableNodeLoador.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.demo.feature.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableNodeChildLoador; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableNodeChildLoador; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/MoviesTreeTableNodeLoador.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/MoviesTreeTableNodeLoador.java index a84c111..8b9a8b2 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/MoviesTreeTableNodeLoador.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/MoviesTreeTableNodeLoador.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.demo.feature.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.NavHelper; -import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableNodeChildLoador; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.Movie; import org.nuiton.jaxx.demo.feature.nav.NavDemoHandler; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.NavHelper; +import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableNodeChildLoador; import java.util.List; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableHelper.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableHelper.java index d4ea20d..eac405c 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableHelper.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableHelper.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.demo.feature.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableHelper; -import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableModel; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.feature.nav.NavDemoHandler; +import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableHelper; +import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableModel; /** * @author Sylvain Lletellier diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableModel.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableModel.java index de4288e..3ad877d 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableModel.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/nav/treetable/NavDemoTreeTableModel.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.demo.feature.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavNode; -import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableModel; import org.nuiton.jaxx.demo.entities.DemoDataProvider; import org.nuiton.jaxx.demo.entities.Movie; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.swing.nav.NavNode; +import org.nuiton.jaxx.runtime.swing.nav.treetable.NavTreeTableModel; import static org.nuiton.i18n.I18n.t; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java index e17f4a7..c37bd72 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/ListBeanValidationDemoHandler.java @@ -21,13 +21,13 @@ package org.nuiton.jaxx.demo.feature.validation.list; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.lang3.tuple.Pair; import org.jdesktop.swingx.JXTable; import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.demo.entities.DemoDecoratorProvider; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.validator.swing.SwingListValidatorDataLocator; import org.nuiton.jaxx.validator.swing.SwingListValidatorMessageTableRenderer; import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; @@ -38,7 +38,7 @@ import javax.swing.JTable; import javax.swing.RowSorter; import javax.swing.SortOrder; import javax.swing.table.TableModel; -import java.util.Arrays; +import java.util.Collections; import java.util.UUID; import static org.nuiton.i18n.I18n.n; @@ -66,7 +66,7 @@ public class ListBeanValidationDemoHandler implements UIHandler<ListBeanValidati JXTable dataTable = ui.getDataTable(); dataTable.getRowSorter().setSortKeys( - Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + Collections.singletonList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); SwingUtil.setI18nTableHeaderRenderer( dataTable, n("jaxx.demo.label.id"), @@ -163,9 +163,7 @@ public class ListBeanValidationDemoHandler implements UIHandler<ListBeanValidati String fieldName) { PeopleTableModel model = (PeopleTableModel) tableModel; - Pair<Integer, Integer> cell = - model.getCell(bean, fieldName); - return cell; + return model.getCell(bean, fieldName); } @Override diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/PeopleTableModel.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/PeopleTableModel.java index 0ad30e2..9c4a5e7 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/PeopleTableModel.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/feature/validation/list/PeopleTableModel.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.demo.feature.validation.list; */ import com.google.common.collect.Lists; -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.lang3.tuple.Pair; import org.nuiton.jaxx.demo.entities.Identity; import org.nuiton.jaxx.demo.entities.People; +import org.nuiton.jaxx.runtime.SwingUtil; import javax.swing.table.AbstractTableModel; import java.util.Arrays; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoCellRenderer.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoCellRenderer.java index a388b2c..18dbea6 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoCellRenderer.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoCellRenderer.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.demo.tree; -import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import javax.swing.JTree; import javax.swing.tree.DefaultTreeModel; diff --git a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoNodeLoador.java b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoNodeLoador.java index 63255d0..0da1e51 100644 --- a/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoNodeLoador.java +++ b/jaxx-demo/src/main/java/org/nuiton/jaxx/demo/tree/DemoNodeLoador.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.demo.tree; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; import org.nuiton.jaxx.runtime.swing.nav.NavNodeChildLoador; import org.nuiton.jaxx.runtime.swing.nav.tree.NavTreeNodeChildLoador; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.util.List; diff --git a/jaxx-demo/src/main/resources/log4j.properties b/jaxx-demo/src/main/resources/log4j.properties index 259ff8a..3cacc29 100644 --- a/jaxx-demo/src/main/resources/log4j.properties +++ b/jaxx-demo/src/main/resources/log4j.properties @@ -25,6 +25,5 @@ log4j.rootLogger=ERROR, stdout 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.org.nuiton=WARN log4j.logger.org.nuiton.jaxx=INFO diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-error-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-error-validation.xml index de7ab3e..495a379 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-error-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-error-validation.xml @@ -23,48 +23,48 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> - <field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> + <field name="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="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="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="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> + <field name="age"> + <field-validator type="int"> + <param name="min">18</param> + <message>Your are too young (min ${min} )</message> + </field-validator> + </field> </validators> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-info-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-info-validation.xml index 0f4d539..bdcebb3 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-info-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-info-validation.xml @@ -23,48 +23,48 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> - <!--field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> + <!--field name="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="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="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="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> + <field name="age"> + <field-validator type="int"> + <param name="min">25</param> + <message>You are still young ( old ${min} )</message> + </field-validator> + </field> </validators> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-warning-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-warning-validation.xml index 0a21a08..17483b5 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-warning-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Identity-warning-validation.xml @@ -23,48 +23,48 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> - <!--field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> + <!--field name="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="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="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="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> + <field name="age"> + <field-validator type="int"> + <param name="max">88</param> + <message>Info : Your are older than ${max} !</message> + </field-validator> + </field> </validators> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-error-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-error-validation.xml index 512ce31..54e8a12 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-error-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-error-validation.xml @@ -23,34 +23,34 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.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 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="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> + <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> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-info-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-info-validation.xml index aa87606..6901f8d 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-info-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-info-validation.xml @@ -23,12 +23,12 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.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> + <!-- 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> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-warning-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-warning-validation.xml index ccf0bd9..dcf65b1 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-warning-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/Model-warning-validation.xml @@ -23,17 +23,17 @@ "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.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 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> - <field name="text2"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text2.</message> - </field-validator> - </field> - </validators> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-error-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-error-validation.xml index 31db586..44971c6 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-error-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-error-validation.xml @@ -20,8 +20,8 @@ #L% --> <!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> <field name="firstName"> <field-validator type="requiredstring" short-circuit="true"> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-info-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-info-validation.xml index c745aac..32c990a 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-info-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-info-validation.xml @@ -20,14 +20,14 @@ #L% --> <!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> <field name="age"> <field-validator type="int"> <param name="min">25</param> - <message>Info : You are still young ( old ${min} ) </message> + <message>Info : You are still young ( old ${min} )</message> </field-validator> </field> </validators> diff --git a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-warning-validation.xml b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-warning-validation.xml index 940d88b..1a710c9 100644 --- a/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-warning-validation.xml +++ b/jaxx-demo/src/main/resources/org/nuiton/jaxx/demo/entities/People-warning-validation.xml @@ -20,8 +20,8 @@ #L% --> <!DOCTYPE validators PUBLIC - "-//Apache Struts//XWork Validator 1.0.3//EN" - "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> + "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> <validators> <field name="age"> diff --git a/jaxx-demo/src/main/resources/validators.xml b/jaxx-demo/src/main/resources/validators.xml index 3030a90..baac862 100644 --- a/jaxx-demo/src/main/resources/validators.xml +++ b/jaxx-demo/src/main/resources/validators.xml @@ -25,31 +25,34 @@ "-//Apache Struts//XWork Validator Config 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd"> <validators> - <!-- les validateurs fournis par XWork --> - <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> - <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> - <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> - <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> - <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> - <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> - <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> - <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> - <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> - <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> - <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/> - <validator name="url" class="com.opensymphony.xwork2.validator.validators.URLValidator"/> - - <validator name="visitor" class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/> - <validator name="conditionalvisitor" class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/> + <!-- les validateurs fournis par XWork --> + <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> + <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> + <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> + <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> + <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> + <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> + <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> + <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> + <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> + <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> + <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/> + <validator name="url" class="com.opensymphony.xwork2.validator.validators.URLValidator"/> - <!-- les validateurs fournis par Nuiton-validator --> - <validator name="collectionFieldExpression" class="org.nuiton.validator.xwork2.field.CollectionFieldExpressionValidator"/> - <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> - <validator name="requiredFile" class="org.nuiton.validator.xwork2.field.RequiredFileFieldValidator"/> - <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> - <validator name="notExistingFile" class="org.nuiton.validator.xwork2.field.NotExistingFileFieldValidator"/> - <validator name="existingDirectory" class="org.nuiton.validator.xwork2.field.ExistingDirectoryFieldValidator"/> - <validator name="notExistingDirectory" class="org.nuiton.validator.xwork2.field.NotExistingDirectoryFieldValidator"/> - <validator name="fieldexpressionwithparams" class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> + <validator name="visitor" class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/> + <validator name="conditionalvisitor" + class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/> + + <!-- les validateurs fournis par Nuiton-validator --> + <validator name="collectionFieldExpression" + class="org.nuiton.validator.xwork2.field.CollectionFieldExpressionValidator"/> + <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> + <validator name="requiredFile" class="org.nuiton.validator.xwork2.field.RequiredFileFieldValidator"/> + <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> + <validator name="notExistingFile" class="org.nuiton.validator.xwork2.field.NotExistingFileFieldValidator"/> + <validator name="existingDirectory" class="org.nuiton.validator.xwork2.field.ExistingDirectoryFieldValidator"/> + <validator name="notExistingDirectory" class="org.nuiton.validator.xwork2.field.NotExistingDirectoryFieldValidator"/> + <validator name="fieldexpressionwithparams" + class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> </validators> diff --git a/jaxx-demo/src/test/java/org/nuiton/jaxx/demo/BeanValidatorDetectorTest.java b/jaxx-demo/src/test/java/org/nuiton/jaxx/demo/BeanValidatorDetectorTest.java index be93d21..c4bab6b 100644 --- a/jaxx-demo/src/test/java/org/nuiton/jaxx/demo/BeanValidatorDetectorTest.java +++ b/jaxx-demo/src/test/java/org/nuiton/jaxx/demo/BeanValidatorDetectorTest.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.demo; +import org.junit.Assert; +import org.junit.Test; import org.nuiton.jaxx.demo.entities.Identity; import org.nuiton.jaxx.demo.entities.Model; import org.nuiton.jaxx.demo.entities.People; -import org.junit.Assert; -import org.junit.Test; import org.nuiton.validator.AbstractValidatorDetectorTest; import org.nuiton.validator.NuitonValidator; import org.nuiton.validator.NuitonValidatorScope; diff --git a/jaxx-maven-plugin/pom.xml b/jaxx-maven-plugin/pom.xml index 5563a70..fb7b4b9 100644 --- a/jaxx-maven-plugin/pom.xml +++ b/jaxx-maven-plugin/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java index 0c6b3e9..7c2aae2 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractGenerateHelpMojo.java @@ -125,7 +125,7 @@ public abstract class AbstractGenerateHelpMojo extends AbstractJaxxMojo { if (StringUtils.isEmpty(locales)) { throw new MojoFailureException( "You must set the 'locales' property properly (was " + - locales + ")."); + locales + ")."); } // check there is a outHelp @@ -194,12 +194,12 @@ public abstract class AbstractGenerateHelpMojo extends AbstractJaxxMojo { public File getHelpIdsStoreFile() { return outputHelpIds == null ? null : - new File(outputHelpIds, helpIdsFilename); + new File(outputHelpIds, helpIdsFilename); } public File getMergeHelpIdsStoreFile() { return outputHelpIds == null ? null : - new File(outputHelpIds, mergeHelpIdsFilename); + new File(outputHelpIds, mergeHelpIdsFilename); } public String getHelpIdsFilename() { @@ -248,7 +248,7 @@ public abstract class AbstractGenerateHelpMojo extends AbstractJaxxMojo { } if (isVerbose()) { getLog().info("load " + result.size() + - " help ids from file " + file); + " help ids from file " + file); } return result; } finally { diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java index 5879d10..9f60258 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpFilesMojo.java @@ -22,7 +22,6 @@ package org.nuiton.jaxx.plugin; -import org.apache.commons.io.FileUtils; import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -34,6 +33,8 @@ import org.nuiton.util.SortedProperties; import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.Enumeration; import java.util.Locale; import java.util.Properties; @@ -46,9 +47,9 @@ import java.util.Set; * @since 2.0.0 */ @Mojo(name = "generate-help-files", - defaultPhase = LifecyclePhase.PROCESS_SOURCES, - requiresProject = true, - requiresDependencyResolution = ResolutionScope.COMPILE) + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + requiresProject = true, + requiresDependencyResolution = ResolutionScope.COMPILE) @Execute(goal = "generate-help-ids") public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo { @@ -196,7 +197,7 @@ public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo { // pas de fichier a traiter if (isForce()) { getLog().info("Force flag is on, but no helpIdStore-all" + - " to react at " + idsFile); + " to react at " + idsFile); } else { getLog().info("no helpIdStore to react at " + idsFile); } @@ -311,7 +312,7 @@ public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo { boolean exist = f.exists(); if (exist) { // check if there is a autoremoveLine in content - String content = FileUtils.readFileToString(f); + String content = new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8); if (!content.contains(AUTOREMOVE_LINE)) { // no regenerate marker detected, so skip this file if (isVerbose()) { @@ -341,7 +342,7 @@ public class GenerateHelpFilesMojo extends AbstractGenerateHelpMojo { if (file.exists()) { // check the autoremove line presence - String content = FileUtils.readFileToString(file); + String content = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); if (!content.contains(AUTOREMOVE_LINE)) { // no regenerate marker detected, so skip this file if (isVerbose()) { diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java index ee88b68..8128d58 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpIdsMojo.java @@ -24,12 +24,12 @@ package org.nuiton.jaxx.plugin; import com.google.common.base.Charsets; import com.google.common.io.Closeables; import com.google.common.io.Files; -import org.nuiton.jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.nuiton.jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; import org.nuiton.util.SortedProperties; import java.io.File; @@ -49,7 +49,7 @@ import java.util.Set; * @since 2.0.0 */ @Mojo(name = "generate-help-ids", - defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = true) + defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresProject = true) public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo { public static final String INPUT_FILENAME_FULL_FORMAT = "%s-%s_%s.properties"; @@ -62,8 +62,8 @@ public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo { * @since 2.5.12 */ @Parameter(property = "jaxx.mergeIdsToInput", - defaultValue = "false", - required = true) + defaultValue = "false", + required = true) protected boolean mergeIdsToInput; /** @@ -79,8 +79,8 @@ public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo { * @since 2.5.12 */ @Parameter(property = "jaxx.strictMode", - defaultValue = "false", - required = true) + defaultValue = "false", + required = true) protected boolean strictMode; /** @@ -92,8 +92,8 @@ public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo { * @since 2.5.12 */ @Parameter(property = "jaxx.inputHelpDirectory", - defaultValue = "src/main/help", - required = true) + defaultValue = "src/main/help", + required = true) protected File inputHelpDirectory; /** @@ -108,8 +108,8 @@ public class GenerateHelpIdsMojo extends AbstractGenerateHelpMojo { * @since 2.5.12 */ @Parameter(property = "jaxx.inputHelpFilenamePrefix", - defaultValue = "helpMapping", - required = true) + defaultValue = "helpMapping", + required = true) protected String inputHelpFilenamePrefix; /** help ids to react. */ diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java index cb325f4..4189298 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -40,9 +40,9 @@ import java.util.Locale; * @since 1.3 */ @Mojo(name = "generate-help", - defaultPhase = LifecyclePhase.PROCESS_SOURCES, - requiresProject = true, - requiresDependencyResolution = ResolutionScope.COMPILE) + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + requiresProject = true, + requiresDependencyResolution = ResolutionScope.COMPILE) @Execute(goal = "generate-help-search") public class GenerateHelpMojo extends AbstractGenerateHelpMojo { diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java index 818b646..f5c6e3b 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpSearchMojo.java @@ -49,9 +49,9 @@ import java.util.Locale; * @since 2.0.0 */ @Mojo(name = "generate-help-search", - defaultPhase = LifecyclePhase.PROCESS_SOURCES, - requiresProject = true, - requiresDependencyResolution = ResolutionScope.COMPILE) + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + requiresProject = true, + requiresDependencyResolution = ResolutionScope.COMPILE) @Execute(goal = "generate-help-files") public class GenerateHelpSearchMojo extends AbstractGenerateHelpMojo { @@ -147,7 +147,7 @@ public class GenerateHelpSearchMojo extends AbstractGenerateHelpMojo { } if (targetLast == null || sourceLast == null || - targetLast < sourceLast) { + targetLast < sourceLast) { // something is newer in source than in target @@ -158,7 +158,7 @@ public class GenerateHelpSearchMojo extends AbstractGenerateHelpMojo { if (!generate) { getLog().info("Nothing to generate for language " + language + - " - all files are up to date."); + " - all files are up to date."); return; } @@ -232,7 +232,7 @@ public class GenerateHelpSearchMojo extends AbstractGenerateHelpMojo { if (isVerbose()) { getLog().info( "Search Index generated for " + locale + " in " + - PluginHelper.convertTime(System.nanoTime() - t0)); + PluginHelper.convertTime(System.nanoTime() - t0)); } } diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index c43f47c..e6057e8 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -22,6 +22,16 @@ package org.nuiton.jaxx.plugin; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.nuiton.i18n.I18n; +import org.nuiton.io.MirroredFileUpdater; import org.nuiton.jaxx.compiler.CompiledObjectDecorator; import org.nuiton.jaxx.compiler.CompilerConfiguration; import org.nuiton.jaxx.compiler.I18nHelper; @@ -38,16 +48,6 @@ import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.help.JAXXHelpBroker; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.nuiton.i18n.I18n; -import org.nuiton.io.MirroredFileUpdater; import org.nuiton.plugin.PluginHelper; import java.beans.Introspector; @@ -391,7 +391,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } fixCompileSourceRoots(); - if (cssExtension==null) { + if (cssExtension == null) { cssExtension = DEFAULT_CSS_EXTENSION; } @@ -399,7 +399,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat // use default includes includes = new String[]{"**/*.jaxx", "**/*." + cssExtension}; } - + updater = new JaxxFileUpdater(cssExtension, src, outJava); Map<File, String[]> result = new HashMap<>(); @@ -426,7 +426,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat if (f.exists()) { if (isVerbose()) { getLog().info("will treate jaxx file from css " + - f); + f); } filterFiles.add(jaxxFilePath); } @@ -448,12 +448,12 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } cl = initClassLoader(getProject(), - src, - addSourcesToClassPath, - testPhase, - addResourcesToClassPath, - addCompileClassPath, - addProjectClassPath); + src, + addSourcesToClassPath, + testPhase, + addResourcesToClassPath, + addCompileClassPath, + addProjectClassPath); Thread.currentThread().setContextClassLoader(cl); diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java index 7e91518..cd8cf92 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java @@ -25,6 +25,7 @@ package org.nuiton.jaxx.plugin; import java.util.ArrayList; import java.util.List; import java.util.Set; + import static org.nuiton.i18n.I18n.t; public class NodeItem { @@ -64,8 +65,7 @@ public class NodeItem { public NodeItem findChild(String path) { NodeItem result = null; String[] paths = path.split("\\."); - for (int i = 0, j = paths.length; i < j; i++) { - String p = paths[i]; + for (String p : paths) { if (result == null) { // first node @@ -159,6 +159,6 @@ public class NodeItem { @Override public String toString() { return super.toString() + "<target:" + target + ", text:" + text + - ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">"; + ", nbChilds:" + (isLeaf() ? 0 : childs.size()) + ">"; } } diff --git a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java index bd194ce..94cacce 100644 --- a/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java +++ b/jaxx-maven-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java @@ -22,12 +22,6 @@ package org.nuiton.jaxx.plugin; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; -import java.util.Stack; import org.apache.maven.plugin.logging.Log; import org.nuiton.util.SortedProperties; import org.xml.sax.Attributes; @@ -38,6 +32,13 @@ import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.Stack; + /** * To load {@link NodeItem} from xml. * @@ -76,11 +77,8 @@ public class XmlHelper { } }); - InputStream s = new FileInputStream(file); - try { + try (InputStream s = new FileInputStream(file)) { parser.parse(new InputSource(s)); - } finally { - s.close(); } return result; } @@ -95,12 +93,9 @@ public class XmlHelper { parser.setContentHandler(handler); NodeItem rootItem = null; - InputStream s = new FileInputStream(file); - try { + try (InputStream s = new FileInputStream(file)) { parser.parse(new InputSource(s)); rootItem = handler.rootItem; - } finally { - s.close(); } return rootItem; } diff --git a/jaxx-maven-plugin/src/main/resources/defaultContent.html.vm b/jaxx-maven-plugin/src/main/resources/defaultContent.html.vm index ac806dc..b8a17b3 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultContent.html.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultContent.html.vm @@ -1,9 +1,9 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> -<TITLE> -$helpId -</TITLE> + <TITLE> + $helpId + </TITLE> </HEAD> <BODY BGCOLOR="#ffffff"> <H1>$helpId</H1> diff --git a/jaxx-maven-plugin/src/main/resources/defaultHelpSet.hs.vm b/jaxx-maven-plugin/src/main/resources/defaultHelpSet.hs.vm index 5b941b4..32c2886 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultHelpSet.hs.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultHelpSet.hs.vm @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE helpset - PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" - "http://java.sun.com/products/javahelp/helpset_1_0.dtd"> + PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" + "http://java.sun.com/products/javahelp/helpset_1_0.dtd"> <helpset version="1.0" xml:lang="$locale"> @@ -12,8 +12,8 @@ <!-- maps --> <maps> - <homeID>top</homeID> - <mapref location="$localePath/$mapFileName"/> + <homeID>top</homeID> + <mapref location="$localePath/$mapFileName"/> </maps> <!-- views --> @@ -31,14 +31,14 @@ <data>$localePath/$indexFileName</data> </view> -#if ( $generateSearch ) - <view> - <name>Search</name> - <label>Search</label> - <type>javax.help.SearchView</type> - <data engine="com.sun.java.help.search.DefaultSearchEngine"> - $localePath/JavaHelpSearch - </data> - </view> -#end + #if ( $generateSearch ) + <view> + <name>Search</name> + <label>Search</label> + <type>javax.help.SearchView</type> + <data engine="com.sun.java.help.search.DefaultSearchEngine"> + $localePath/JavaHelpSearch + </data> + </view> + #end </helpset> diff --git a/jaxx-maven-plugin/src/main/resources/defaultI18n.java.vm b/jaxx-maven-plugin/src/main/resources/defaultI18n.java.vm index b11615e..8db6089 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultI18n.java.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultI18n.java.vm @@ -1,16 +1,18 @@ -package $packageName; +package + + $packageName; $!commentaire public class $className { // $className -{ + { // BEGIN DO NOT REMOVE : used to detect helper i18n keys // -#foreach( $key in $keys ) -// _("$key"); -#end -// + #foreach( $key in $keys ) + // _("$key"); + #end + // // END DO NOT REMOVE : used to detect helper i18n keys -} + } -} // $className \ No newline at end of file + } // $className \ No newline at end of file diff --git a/jaxx-maven-plugin/src/main/resources/defaultIndex.xml.vm b/jaxx-maven-plugin/src/main/resources/defaultIndex.xml.vm index e880e18..5e00846 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultIndex.xml.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultIndex.xml.vm @@ -1,21 +1,22 @@ <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE index - PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN" - "http://buix.labs.libre-entreprise.org/javahelp/index_1_0.dtd"> + PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN" + "http://buix.labs.libre-entreprise.org/javahelp/index_1_0.dtd"> ## pour afficher un org.nuiton.jaxx.NodeItem #macro ( renderItem $item $prefix ) -#if ( $item.isLeaf() ) -$prefix<indexitem target="$item.absoluteTarget" text="$!item.text"/> -#else -$prefix<indexitem target="$item.absoluteTarget" text="$!item.text"> -#foreach( $child in $item.getChilds() ) -#renderItem( $child "$prefix$separator" ) -#end + #if ( $item.isLeaf() ) + $prefix + <indexitem target="$item.absoluteTarget" text="$!item.text"/> + #else + $prefix<indexitem target="$item.absoluteTarget" text="$!item.text"> + #foreach( $child in $item.getChilds() ) + #renderItem( $child "$prefix$separator" ) + #end $prefix</indexitem> -#end + #end #end <index version="1.0"> -#renderItem( $rootItem $separator ) + #renderItem( $rootItem $separator ) </index> diff --git a/jaxx-maven-plugin/src/main/resources/defaultMap.jhm.vm b/jaxx-maven-plugin/src/main/resources/defaultMap.jhm.vm index 83fe6ee..d26e9c9 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultMap.jhm.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultMap.jhm.vm @@ -1,16 +1,16 @@ <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE map - PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN" - "http://java.sun.com/products/javahelp/map_1_0.dtd"> + PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN" + "http://java.sun.com/products/javahelp/map_1_0.dtd"> <map version="1.0"> -#if ( !$helpIds.get("toplevelfolder")) - <!-- use this entry to go up in navigation --> - <!--mapID target="toplevelfolder" url="images/toplevel.gif" /--> -#end + #if ( !$helpIds.get("toplevelfolder")) + <!-- use this entry to go up in navigation --> + <!--mapID target="toplevelfolder" url="images/toplevel.gif" /--> + #end -#foreach( $key in $helpIds.keys() ) - <mapID target="$key" url="$helpIds.get($key)" /> -#end + #foreach( $key in $helpIds.keys() ) + <mapID target="$key" url="$helpIds.get($key)"/> + #end </map> diff --git a/jaxx-maven-plugin/src/main/resources/defaultToc.xml.vm b/jaxx-maven-plugin/src/main/resources/defaultToc.xml.vm index d3e5e57..581a50e 100644 --- a/jaxx-maven-plugin/src/main/resources/defaultToc.xml.vm +++ b/jaxx-maven-plugin/src/main/resources/defaultToc.xml.vm @@ -1,20 +1,21 @@ <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE toc - PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN" - "http://buix.labs.libre-entreprise.org/javahelp/toc_1_0.dtd"> + PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN" + "http://buix.labs.libre-entreprise.org/javahelp/toc_1_0.dtd"> ## pour afficher un org.nuiton.jaxx.NodeItem #macro ( renderItem $item $prefix ) -#if ( $item.isLeaf() ) -$prefix<tocitem target="$item.absoluteTarget" text="$!item.text"/> -#else -$prefix<tocitem target="$item.absoluteTarget" text="$!item.text"> -#foreach( $child in $item.getChilds() ) -#renderItem( $child "$prefix$separator" ) -#end + #if ( $item.isLeaf() ) + $prefix + <tocitem target="$item.absoluteTarget" text="$!item.text"/> + #else + $prefix<tocitem target="$item.absoluteTarget" text="$!item.text"> + #foreach( $child in $item.getChilds() ) + #renderItem( $child "$prefix$separator" ) + #end $prefix</tocitem> -#end + #end #end <toc version="1.0"> -#renderItem( $rootItem $separator ) + #renderItem( $rootItem $separator ) </toc> diff --git a/jaxx-maven-plugin/src/main/resources/log4j.properties b/jaxx-maven-plugin/src/main/resources/log4j.properties index 7086f56..65ded02 100644 --- a/jaxx-maven-plugin/src/main/resources/log4j.properties +++ b/jaxx-maven-plugin/src/main/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=WARN, stdout 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.org.nuiton.i18n=ERROR log4j.logger.jaxx=INFO #log4j.logger.jaxx.compiler=DEBUG diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1124Test.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1124Test.java index 9db12f6..0e4175a 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1124Test.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1124Test.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.plugin; -import org.nuiton.jaxx.runtime.JAXXUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.Test; +import org.nuiton.jaxx.runtime.JAXXUtil; import javax.swing.event.ChangeEvent; import javax.swing.event.TableColumnModelEvent; @@ -40,13 +40,14 @@ import javax.swing.table.TableColumnModel; * @author Tony Chemit - dev@tchemit.fr * @since 2.2.4 */ -public class Bug1124Test { +public class Bug1124Test { protected static final Log log = LogFactory.getLog(Bug1124Test.class); int i; + @Test - public void testColumnMarginChanged() throws Exception { + public void testColumnMarginChanged() throws Exception { TableColumnModel model = new DefaultTableColumnModel(); @@ -63,11 +64,11 @@ public class Bug1124Test { model.addColumnModelListener(listener); - Assert.assertEquals(0,i); + Assert.assertEquals(0, i); model.addColumn(new TableColumn(0)); - Assert.assertEquals(1,i); + Assert.assertEquals(1, i); listener = JAXXUtil.getEventListener( TableColumnModelListener.class, @@ -79,7 +80,7 @@ public class Bug1124Test { model.addColumnModelListener(listener); model.setColumnMargin(12); - Assert.assertEquals(2,i); + Assert.assertEquals(2, i); // listener.columnMarginChanged(new ChangeEvent(this)); } diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java index 261940d..fd804e0 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1404Test.java @@ -29,7 +29,7 @@ import org.junit.Test; * @author Tony Chemit - dev@tchemit.fr * @since 2.4.1 */ -public class Bug1404Test extends JaxxBaseTest { +public class Bug1404Test extends JaxxBaseTest { @Test public void Bug_1404() throws Exception { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java index fe688ea..a89cc75 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java @@ -22,13 +22,14 @@ package org.nuiton.jaxx.plugin; -import org.nuiton.jaxx.runtime.Base64Coder; +import org.junit.Test; import org.nuiton.jaxx.compiler.JAXXCompiler; +import org.nuiton.jaxx.runtime.Base64Coder; import org.nuiton.jaxx.runtime.JAXXObjectDescriptor; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** @author Tony Chemit - dev@tchemit.fr */ public class Bug1750Test extends JaxxBaseTest { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index 6cedf01..5cf3ad1 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -22,13 +22,13 @@ package org.nuiton.jaxx.plugin; -import org.nuiton.jaxx.runtime.context.DefaultJAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.SystemStreamLog; import org.junit.Test; +import org.nuiton.jaxx.runtime.context.DefaultJAXXContext; import java.io.File; diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index 51a980e..9e9f60b 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -26,11 +26,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; - - import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.*; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; @Ignore public class CompilerValidatorTest extends JaxxBaseTest { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java index 96615bb..942ed3a 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java @@ -24,7 +24,7 @@ package org.nuiton.jaxx.plugin.DataBinding; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -public class BeanImpl implements Bean{ +public class BeanImpl implements Bean { protected String text; final PropertyChangeSupport p; diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java index dd41693..c930836 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.plugin; -import java.io.IOException; import org.junit.Test; +import java.io.IOException; + /** - * * @author Tony Chemit - dev@tchemit.fr * @since 2.0.0 */ diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java index 6d2927f..1117518 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java @@ -33,5 +33,5 @@ public class DecoratorTest extends JaxxBaseTest { assertNumberJaxxFiles(1); checkPattern(mojo, "add(SwingUtil.boxComponentWithJxLayer(boxedButton))", true); } - + } diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 51b5e89..5bc4a5f 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -25,11 +25,11 @@ package org.nuiton.jaxx.plugin; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.plugin.MojoExecutionException; - - import org.apache.maven.plugin.logging.SystemStreamLog; import org.junit.Test; -import static org.junit.Assert.*; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; public class Evolution74Test extends JaxxBaseTest { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index e82d18c..923d1b0 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -22,20 +22,21 @@ package org.nuiton.jaxx.plugin; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Rule; import org.nuiton.jaxx.compiler.JAXXCompiler; import org.nuiton.jaxx.compiler.JAXXCompilerFile; import org.nuiton.jaxx.compiler.JAXXEngine; import org.nuiton.jaxx.compiler.decorators.DefaultCompiledObjectDecorator; import org.nuiton.jaxx.runtime.context.DefaultJAXXContext; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Rule; import org.nuiton.plugin.MojoTestRule; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.List; import static org.junit.Assert.assertEquals; @@ -47,7 +48,7 @@ import static org.junit.Assert.assertTrue; * @author Tony Chemit - dev@tchemit.fr * @see GenerateMojo */ -public abstract class JaxxBaseTest { +public abstract class JaxxBaseTest { /** Logger. */ private static final Log log = LogFactory.getLog(JaxxBaseTest.class); @@ -66,7 +67,7 @@ public abstract class JaxxBaseTest { } } mojo.setEncoding("UTF-8"); - mojo.validatorFactoryFQN= SwingValidator.class.getName(); + mojo.validatorFactoryFQN = SwingValidator.class.getName(); mojo.jaxxContextFQN = DefaultJAXXContext.class.getName(); mojo.compilerFQN = JAXXCompiler.class.getName(); mojo.defaultDecoratorFQN = DefaultCompiledObjectDecorator.class.getName(); @@ -111,7 +112,7 @@ public abstract class JaxxBaseTest { } assertTrue("generated file " + f + " was not found...", f.exists()); - String content = FileUtils.readFileToString( f ); + String content = new String(Files.readAllBytes(f.toPath()), StandardCharsets.UTF_8); String errorMessage = required ? "could not find the pattern : " : "should not have found pattern :"; assertEquals(errorMessage + pattern + " in file " + f, required, content.contains(pattern)); diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java index 1812138..13aace1 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java @@ -24,10 +24,10 @@ package org.nuiton.jaxx.plugin; import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.*; + +import static org.junit.Assert.assertTrue; /** - * * @author Tony Chemit - dev@tchemit.fr */ public class NodeItemTest { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java index 5a9a664..1669b4a 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java @@ -21,7 +21,7 @@ */ package org.nuiton.jaxx.plugin.compilerTest.classReferences; -import javax.swing.*; +import javax.swing.JLabel; public class JavaTaist extends JLabel { public void setCustomProperty(String label) { diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java index 1833c6b..a08dc15 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java @@ -87,7 +87,7 @@ public class Identity { } public void setEmail(String email) { - String oldEmail =this.email; + String oldEmail = this.email; this.email = email; p.firePropertyChange("email", oldEmail, email); } diff --git a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java index 3dd6318..f018217 100644 --- a/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java +++ b/jaxx-maven-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java @@ -21,7 +21,8 @@ */ package org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok; -import java.beans.*; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; public class Model { @@ -82,6 +83,6 @@ public class Model { public void setRatio(int ratio) { int oldRatio = this.ratio; this.ratio = ratio; - p.firePropertyChange("ratio",oldRatio, ratio); + p.firePropertyChange("ratio", oldRatio, ratio); } } diff --git a/jaxx-maven-plugin/src/test/resources/log4j.properties b/jaxx-maven-plugin/src/test/resources/log4j.properties index abd3e87..bc4ab61 100644 --- a/jaxx-maven-plugin/src/test/resources/log4j.properties +++ b/jaxx-maven-plugin/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.org.nuiton.plugin.AbstractMojoTest=INFO log4j.logger.org.nuiton.jaxx=INFO log4j.logger.jaxx.compiler=INFO diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml index 650599f..dbea831 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Bug_1404.xml @@ -23,28 +23,28 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <i18nable>true</i18nable> - <force>true</force> - <!--<verbose>true</verbose>--> - <resetAfterCompile>false</resetAfterCompile> - <includes> - <value>**/bug1404Test/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <i18nable>true</i18nable> + <force>true</force> + <!--<verbose>true</verbose>--> + <resetAfterCompile>false</resetAfterCompile> + <includes> + <value>**/bug1404Test/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx index d0c1631..18dd095 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test1.jaxx @@ -19,6 +19,6 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <TestParent> - <JLabel id='label' decorator='boxed'/> - </TestParent> +<TestParent> + <JLabel id='label' decorator='boxed'/> +</TestParent> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx index f1a59da..65ce488 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/Test2.jaxx @@ -19,6 +19,6 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <TestParent> - <JLabel id='icon' icon='myicon.png'/> - </TestParent> +<TestParent> + <JLabel id='icon' icon='myicon.png'/> +</TestParent> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx index 3a95885..e7d286b 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1404Test/TestParent.jaxx @@ -19,4 +19,4 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <JPanel id='content'/> +<JPanel id='content'/> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml index 3012916..a71a11f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <!--<verbose>true</verbose>--> - <includes> - <value>**/bug1722Test/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <!--<verbose>true</verbose>--> + <includes> + <value>**/bug1722Test/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx index 05f4c2f..9ac3d4a 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx @@ -20,9 +20,9 @@ #L% --> <JTabbedPane id='top'> - <tab title='Title'> - <JPanel id='demoPanel'> - <JLabel text='override'/> - </JPanel> - </tab> + <tab title='Title'> + <JPanel id='demoPanel'> + <JLabel text='override'/> + </JPanel> + </tab> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx index a0db197..bfff80f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx @@ -20,7 +20,7 @@ #L% --> <DemoPanel> - <JPanel id='demoPanel'> - <JLabel text='override'/> - </JPanel> + <JPanel id='demoPanel'> + <JLabel text='override'/> + </JPanel> </DemoPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml index de6e660..3c1307b 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml @@ -24,27 +24,27 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <!--<verbose>true</verbose>--> - <resetAfterCompile>false</resetAfterCompile> - <includes> - <value>**/bug1750Test/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <!--<verbose>true</verbose>--> + <resetAfterCompile>false</resetAfterCompile> + <includes> + <value>**/bug1750Test/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx index a68872a..57c36c9 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx @@ -21,19 +21,19 @@ --> <Table> - <!-- selectedItem state --> - <Object id='selectedItem' javaBean=''/> + <!-- selectedItem state --> + <Object id='selectedItem' javaBean=''/> - <!-- check state --> - <Boolean id='check' constructorParams='false' javaBean=''/> + <!-- check state --> + <Boolean id='check' constructorParams='false' javaBean=''/> - <row> - <cell> - <JComboBox id='combobox' selectedItem='{getSelectedItem()}' - onItemStateChanged='setSelectedItem(combobox.getSelectedItem())'/> - </cell> - <cell> - <JCheckBox id='checkbox' selected='{isCheck()}' onActionPerformed='setCheck(checkbox.isSelected())'/> - </cell> - </row> + <row> + <cell> + <JComboBox id='combobox' selectedItem='{getSelectedItem()}' + onItemStateChanged='setSelectedItem(combobox.getSelectedItem())'/> + </cell> + <cell> + <JCheckBox id='checkbox' selected='{isCheck()}' onActionPerformed='setCheck(checkbox.isSelected())'/> + </cell> + </row> </Table> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml index 47de879..b1edc80 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml @@ -24,28 +24,28 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <i18nable>true</i18nable> - <force>true</force> - <!--<verbose>true</verbose>--> - <resetAfterCompile>false</resetAfterCompile> - <includes> - <value>**/bug1751Test/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <i18nable>true</i18nable> + <force>true</force> + <!--<verbose>true</verbose>--> + <resetAfterCompile>false</resetAfterCompile> + <includes> + <value>**/bug1751Test/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml index de3ab1b..54f3fc1 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/Bug_184.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <force>true</force> - <verbose>true</verbose> - <includes> - <value>**/bug184Test/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <force>true</force> + <verbose>true</verbose> + <includes> + <value>**/bug184Test/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx index f4be134..8352628 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug184Test/MyPanel.jaxx @@ -21,14 +21,14 @@ --> <JPanel> -<script> + <script> -private static final int[] yo = new int[]{65,66,67}; - -protected String myMethod(String a, String b, String c) { + private static final int[] yo = new int[]{65,66,67}; + + protected String myMethod(String a, String b, String c) { return ""; -} - -</script> - <JButton constructorParams='myMethod("a", new String(yo, 1, 2), "c")'/> + } + + </script> + <JButton constructorParams='myMethod("a", new String(yo, 1, 2), "c")'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml index 0016303..a0aeb57 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml @@ -24,27 +24,27 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <i18nable>false</i18nable> - <verbose>true</verbose> - <includes> - <value>**/compilerTest/cSSTests/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <i18nable>false</i18nable> + <verbose>true</verbose> + <includes> + <value>**/compilerTest/cSSTests/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml index a5a2ba2..3c8c6bd 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/classReferences/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/classReferences/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml index c9d443b..d572574 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <addLogger>false</addLogger> - <includes> - <value>**/compilerTest/clientProperty/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <addLogger>false</addLogger> + <includes> + <value>**/compilerTest/clientProperty/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml index 283c6c0..58e35f3 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <jaxxContextFQN>java.lang.String</jaxxContextFQN> - <force>true</force> - <includes> - <value>**/evolution74Test/ok/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <jaxxContextFQN>java.lang.String</jaxxContextFQN> + <force>true</force> + <includes> + <value>**/evolution74Test/ok/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml index 3631bde..b673f16 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml @@ -24,30 +24,30 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <cssExtension>jcss</cssExtension> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <autoRecurseInCss>true</autoRecurseInCss> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/errors/*.jaxx</value> - </includes> - <excludes> - <value>**/compilerTest/validator/errors/*.jaxx</value> - </excludes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <cssExtension>jcss</cssExtension> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <autoRecurseInCss>true</autoRecurseInCss> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/errors/*.jaxx</value> + </includes> + <excludes> + <value>**/compilerTest/validator/errors/*.jaxx</value> + </excludes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml index c98657e..828185c 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/force/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/force/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml index b683ee4..7b48226 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml @@ -24,28 +24,28 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <i18nable>false</i18nable> - <force>true</force> - <!--<verbose>true</verbose>--> - <resetAfterCompile>true</resetAfterCompile> - <includes> - <value>**/compilerTest/icon/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <i18nable>false</i18nable> + <force>true</force> + <!--<verbose>true</verbose>--> + <resetAfterCompile>true</resetAfterCompile> + <includes> + <value>**/compilerTest/icon/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml index 187d798..69e5429 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ImportTag.xml @@ -24,24 +24,24 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <force>true</force> - <includes> - <value>**/compilerTest/importTag/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <force>true</force> + <includes> + <value>**/compilerTest/importTag/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml index bf15868..5dc14c8 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/initializers/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/initializers/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml index d40fb19..e0c6dab 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/innerClasses/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/innerClasses/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml index ce3a760..c6599cc 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <addLogger>false</addLogger> - <includes> - <value>**/compilerTest/log/nolog/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <addLogger>false</addLogger> + <includes> + <value>**/compilerTest/log/nolog/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml index 565939a..99bf5fa 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/overridingDataBindings/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/overridingDataBindings/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml index 66cbdad..c5a67d8 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/script/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/script/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml index 1a8226e..1aa90c3 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/compilerTest/specialSubclassing/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/compilerTest/specialSubclassing/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml index 21fe67f..fdddbdb 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <addLogger>true</addLogger> - <includes> - <value>**/compilerTest/log/withlog/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <addLogger>true</addLogger> + <includes> + <value>**/compilerTest/log/withlog/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx index eaaeba6..69d2161 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx @@ -23,7 +23,7 @@ <style> Application { lookAndFeel: {String.valueOf(lookAndFeel.getSelectedValue())}; } </style> - + <JMenuBar> <JMenu text='View'> <JMenu text='Look and Feel'> @@ -32,12 +32,12 @@ </JMenu> </JMenu> </JMenuBar> - + <JTabbedPane> <tab title='Simple Tests'> <SimpleCSS/> </tab> - + <tab title='Pseudoclasses'> <Pseudoclasses/> </tab> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx index fe95118..6c29472 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx @@ -25,28 +25,28 @@ </import> <script> public String getText() { - return grandChild.getText(); + return grandChild.getText(); } public void setText(String Text) { - grandChild.setText(Text); + grandChild.setText(Text); } public Color getForeground() { - if (grandChild != null) - return grandChild.getForeground(); - else - return Color.BLACK; + if (grandChild != null) + return grandChild.getForeground(); + else + return Color.BLACK; } public void setForeground(Color foreground) { if (grandChild != null) - grandChild.setForeground(foreground); + grandChild.setForeground(foreground); } </script> - + <GrandChildButton id='grandChild'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx index 3e63b82..613d777 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx @@ -26,19 +26,19 @@ <style> #test1:enabled { text: "Enabled"; } #test1:disabled { text: "Disabled"; } - + #test2:enabled { text: "Enabled"; } #test2:disabled { text: "Disabled"; } #test2:focused { text: "Focused"; } #test2:unfocused { text: "Unfocused"; } - + #test3:enabled { text: "Enabled"; } #test3:disabled { text: "Disabled"; } #test3:focused { text: "Focused"; } #test3:unfocused { text: "Unfocused"; } #test3:selected { text: "Selected"; } #test3:deselected { text: "Deselected"; } - + #test4:enabled { text: "Enabled"; } #test4:disabled { text: "Disabled"; } #test4:focused { text: "Focused"; } @@ -47,7 +47,7 @@ #test4:deselected { text: "Deselected"; } #test4:mouseover { text: "Mouseover"; } #test4:mouseout { text: "Mouseout"; } - + #test5:enabled { text: "Enabled"; } #test5:disabled { text: "Disabled"; } #test5:focused { text: "Focused"; } @@ -58,61 +58,61 @@ #test5:mouseout { text: "Mouseout"; } #test5:mousedown { text: "Mousedown"; } #test5:mouseup { text: "Mouseup"; } - + #test6:{object.isSelected()} { text: "Selected"; } - + #test7:selected { text: { "you shouldn't see this".toUpperCase() } } #test7:selected { text: { currentTime }; } #test8:mouseover { text: { test8Field.getText() }; } </style> - + <script> import java.text.*; import javax.swing.Timer; - + DateFormat dateFormat = DateFormat.getTimeInstance(); String currentTime = dateFormat.format(new Date()); - + Timer timer = new Timer(1000, new ActionListener() { - public void actionPerformed(ActionEvent e) { - currentTime = dateFormat.format(new Date()); - } + public void actionPerformed(ActionEvent e) { + currentTime = dateFormat.format(new Date()); + } }); - + timer.start(); </script> <JPanel border='{BorderFactory.createTitledBorder("Enabled/Disabled")}'> - <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test1'/> + <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test1'/> </JPanel> - + <JPanel border='{BorderFactory.createTitledBorder("Focused/Unfocused")}'> - <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test2'/> + <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test2'/> </JPanel> <JPanel border='{BorderFactory.createTitledBorder("Selected/Deselected")}'> - <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test3'/> + <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test3'/> </JPanel> <JPanel border='{BorderFactory.createTitledBorder("Mouseover/Mouseout")}'> - <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test4'/> + <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test4'/> </JPanel> <JPanel border='{BorderFactory.createTitledBorder("Mouseup/Mousedown")}'> - <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test5'/> + <JCheckBox text="You shouldn't see this" enabled='{enabledCB.isSelected()}' id='test5'/> </JPanel> <JPanel border='{BorderFactory.createTitledBorder("Programmatic Selected")}'> - <JCheckBox text='Unselected' enabled='{enabledCB.isSelected()}' id='test6'/> + <JCheckBox text='Unselected' enabled='{enabledCB.isSelected()}' id='test6'/> </JPanel> <JPanel border='{BorderFactory.createTitledBorder("Pseudoclass Data Binding")}'> - <JCheckBox text='Select to see current time' enabled='{enabledCB.isSelected()}' id='test7'/> + <JCheckBox text='Select to see current time' enabled='{enabledCB.isSelected()}' id='test7'/> </JPanel> <VBox border='{BorderFactory.createTitledBorder("Pseudoclass Proxy Data Binding")}'> - <JCheckBox text='Mouse over to see the below text' enabled='{enabledCB.isSelected()}' id='test8'/> + <JCheckBox text='Mouse over to see the below text' enabled='{enabledCB.isSelected()}' id='test8'/> <JTextField id='test8Field'/> </VBox> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx index 099aeb0..148e27a 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx @@ -26,7 +26,7 @@ </import> <style> JPanel { border: {null}; font-size: 18; } - + JButton { foreground: red } JButton.green { foreground: green; } AbstractButton.blue { foreground: blue } @@ -38,13 +38,13 @@ #B8 { foreground: black } #B8.yellow { foreground: { new Color(0, 0, 0) } } </style> - + <JButton id='B1' text='Red'/> <JButton id='B2' text='Green' styleClass='green'/> <JButton id='B3' text='Blue' styleClass='blue'/> <GrandChild id='B4' text='Orange'/> <Child id='B5' text='Yellow'/> - <Child id='B6' text='White' styleClass='idTest'/> + <Child id='B6' text='White' styleClass='idTest'/> <Child id='B7' text='Cyan'/> <Child2 id='B8' text='Pink' styleClass='yellow'/> <Child2 id='B9' text='Purple' foreground='#aa20ff'/> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx index 9128fad..3d84477 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx @@ -29,9 +29,9 @@ box.add(new JLabel(StaticMethodTest.getText())); </script> - + <VBox id='box'> - <!-- TODO Ce cas ne fonctionne plus (il faut posséder cette classe compilée ? --> + <!-- TODO Ce cas ne fonctionne plus (il faut posséder cette classe compilée ? --> <!--ClassTest customProperty='Compiled class file worked'/--> <JAXXTest customProperty='Uncompiled JAXX file worked'/> <JavaTaist customProperty='Uncompiled Java file worked'/> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx index e5bc4ea..d5bcae4 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx @@ -22,7 +22,7 @@ <Object> <script> public String toString() { - return "Constructor reference worked"; + return "Constructor reference worked"; } </script> </Object> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx index 60691e8..ffcf4ce 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx @@ -22,7 +22,7 @@ <JLabel> <script> public void setCustomProperty(String label) { - setText(label); + setText(label); } </script> </JLabel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx index 60691e8..ffcf4ce 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx @@ -22,7 +22,7 @@ <JLabel> <script> public void setCustomProperty(String label) { - setText(label); + setText(label); } </script> </JLabel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx index a8d4eab..98c58fa 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx @@ -22,7 +22,7 @@ <Object> <script> public static String getText() { - return "Static method reference worked"; + return "Static method reference worked"; } </script> </Object> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx index 56f84ea..6201f58 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx @@ -20,5 +20,5 @@ #L% --> <JPanel id='root'> - <JButton id='boxedButton' _testOne='"oneTest"' _testTwo='{"anotherTest"}'/> + <JButton id='boxedButton' _testOne='"oneTest"' _testTwo='{"anotherTest"}'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx index 9c2f85d..035132f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx @@ -25,7 +25,7 @@ import java.sql.*; import java.util.*; </script> - + <List/> <Date/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx index 309bb47..4c30d44 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx @@ -20,7 +20,11 @@ #L% --> <JPanel> - <cell><JButton/></cell> + <cell> + <JButton/> + </cell> - <cell><JLabel/></cell> + <cell> + <JLabel/> + </cell> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx index 009a00f..5198855 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx @@ -21,19 +21,19 @@ --> <JPanel> mixed1 - + <Table> <row> mixed2 - + <cell>mixed3</cell> </row> </Table> - + <JList> <item>mixed4</item> </JList> - + <JTabbedPane> <tab>mixed5</tab> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx index f010124..686cc0d 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx @@ -21,10 +21,14 @@ --> <JPanel> <row> - <cell><JButton/></cell> + <cell> + <JButton/> + </cell> </row> <row> - <cell><JLabel/></cell> + <cell> + <JLabel/> + </cell> </row> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx index e98d59e..fcd1951 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx @@ -23,7 +23,7 @@ <row> <JPanel/> </row> - + <row> <JScrollPane/> </row> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx index 46e0e8c..30566b0 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx @@ -22,9 +22,9 @@ <JFileChooser> <style> JButton { - foreground: blue; - label: "Parse error on next line"; - *: false; + foreground: blue; + label: "Parse error on next line"; + *: false; } </style> </JFileChooser> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx index 2cec992..7c054e1 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx @@ -20,6 +20,6 @@ #L% --> <JPanel> - <JLabel icon='myIcon.png'/> - <JLabel actionIcon='myActionIcon.png'/> + <JLabel icon='myIcon.png'/> + <JLabel actionIcon='myActionIcon.png'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx index a0198f0..4af0651 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx @@ -21,33 +21,33 @@ --> <Application> <script> - private static String staticInitializerText = "Static initializer FAILED"; - - static { - staticInitializerText = "Static initializer worked!"; + private static String staticInitializerText = "Static initializer FAILED"; + + static { + staticInitializerText = "Static initializer worked!"; } - + { initializerTest.setText("Initializer worked!"); } - + public Initializers(String label) { - this(1, "Custom constructor test 2 worked!"); - constructorTest1.setText(label); + this(1, "Custom constructor test 2 worked!"); + constructorTest1.setText(label); } - - + + public Initializers(int dummy, String label) { - super("Test 3 worked! "+dummy); - constructorTest2.setText(label); + super("Test 3 worked! "+dummy); + constructorTest2.setText(label); } - - + + public static void main(String[] arg) { // test custom main method - Initializers test = new Initializers("Custom constructor test 1 worked!"); - test.mainTest.setText("Custom main method worked!"); - test.setVisible(true); + Initializers test = new Initializers("Custom constructor test 1 worked!"); + test.mainTest.setText("Custom main method worked!"); + test.setVisible(true); } </script> - + <VBox> <JLabel id='mainTest' text='Custom main method FAILED'/> <JLabel id='constructorTest1' text='Custom constructor TEST 1 FAILED'/> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx index fcdd001..6d13be7 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx @@ -23,16 +23,16 @@ <script> import java.text.*; import javax.swing.Timer; - + DateFormat dateFormat = DateFormat.getTimeInstance(); String currentTime = dateFormat.format(new Date()); - + Timer timer = new Timer(1000, new ActionListener() { - public void actionPerformed(ActionEvent e) { - currentTime = dateFormat.format(new Date()); - } + public void actionPerformed(ActionEvent e) { + currentTime = dateFormat.format(new Date()); + } }); - + timer.start(); </script> </JLabel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx index c28687b..e0aa664 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx @@ -23,7 +23,7 @@ <VBox> <JLabel text='The text below should display the time'/> <CurrentTime/> - + <JLabel text='The text below should read "Child Working"'/> <CurrentTime text='Child Working'/> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx index 7050037..4e15079 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx @@ -20,21 +20,21 @@ #L% --> <JDialog> - <script> - protected boolean value - </script> - <script> - value=false - </script> + <script> + protected boolean value + </script> + <script> + value=false + </script> - <script> - value=getOk(); + <script> + value=getOk(); - public boolean getOk() { - return true; - } - </script> - <VBox> - <JButton text='close' onActionPerformed="dispose()"/> - </VBox> + public boolean getOk() { + return true; + } + </script> + <VBox> + <JButton text='close' onActionPerformed="dispose()"/> + </VBox> </JDialog> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml index 4ed03e0..58c0821 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml @@ -24,27 +24,27 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <!--<verbose>true</verbose>--> - <includes> - <value>**/compilerValidatorTest/validator/errors/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <!--<verbose>true</verbose>--> + <includes> + <value>**/compilerValidatorTest/validator/errors/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml index 5f4d580..5e8eff4 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <!--<verbose>true</verbose>--> - <includes> - <value>**/compilerValidatorTest/validator/ok/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <!--<verbose>true</verbose>--> + <includes> + <value>**/compilerValidatorTest/validator/ok/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx index 533dae5..075a196 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx @@ -20,7 +20,8 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model" autoField='true' strictMode='true'/> - <JTextField id='text'/> - <JTextField id='text2'/> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model" autoField='true' + strictMode='true'/> + <JTextField id='text'/> + <JTextField id='text2'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx index a072eb2..373ae9a 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator bean='model' errorListModel='errors' bean='yo'/> + <BeanValidator bean='model' errorListModel='errors' bean='yo'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx index be2b921..a0a3b05 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <Model id='model'/> - <BeanValidator bean='model'/> - <BeanValidator bean='model'/> + <Model id='model'/> + <BeanValidator bean='model'/> + <BeanValidator bean='model'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx index 181d19d..df829f3 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx @@ -20,6 +20,7 @@ #L% --> <Application> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='errors' errorListModel='fake'/> + <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='errors' + errorListModel='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx index 127e2c0..5f65590 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx @@ -20,6 +20,7 @@ #L% --> <Application> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTableModel='errors' errorTableModel='fake'/> + <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' + errorTableModel='errors' errorTableModel='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx index cfb4237..6398d5e 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx @@ -20,9 +20,9 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field name="text"/> - <field name="text"/> - </BeanValidator> - <JTextField id='text'/> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field name="text"/> + <field name="text"/> + </BeanValidator> + <JTextField id='text'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx index 591365e..6eff49b 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field name="fake"/> - </BeanValidator> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field name="fake"/> + </BeanValidator> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx index aaf32a4..7c6a9c7 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field name="text" component="fake"/> - </BeanValidator> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field name="text" component="fake"/> + </BeanValidator> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx index 591365e..6eff49b 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field name="fake"/> - </BeanValidator> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field name="fake"/> + </BeanValidator> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx index 295be36..08846c0 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field/> - </BeanValidator> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field/> + </BeanValidator> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx index 57cfcec..2e6f044 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx @@ -20,7 +20,7 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field component="text"/> - </BeanValidator> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field component="text"/> + </BeanValidator> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java index c18b240..97c8f9f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java @@ -21,7 +21,8 @@ */ package org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors; -import java.beans.*; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; public class Model { @@ -82,6 +83,6 @@ public class Model { public void setRatio(int ratio) { int oldRatio = this.ratio; this.ratio = ratio; - p.firePropertyChange("ratio",oldRatio, ratio); + p.firePropertyChange("ratio", oldRatio, ratio); } } diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx index 212242b..711b1b6 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx @@ -21,6 +21,6 @@ --> <Application> - <BeanValidator id='validator'/> + <BeanValidator id='validator'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx index 7018f92..05773d3 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator bean='fake'/> + <BeanValidator bean='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx index f9e8c69..76ad61d 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorList='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorList='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx index 7b8d8f3..a8c805f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx index 3d1ff65..04c0a4f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTable='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTable='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx index 6f4c298..3e4e420 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx @@ -20,5 +20,5 @@ #L% --> <Application> - <BeanValidator bean='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTableModel='fake'/> + <BeanValidator bean='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTableModel='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx index 7b6d72e..20ac45d 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx @@ -20,5 +20,6 @@ #L% --> <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' parentValidator='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' + parentValidator='fake'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/FieldComponentDuplicated.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/FieldComponentDuplicated.jaxx index a01d0d3..9234fcd 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/FieldComponentDuplicated.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/FieldComponentDuplicated.jaxx @@ -20,9 +20,9 @@ #L% --> <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> - <field name="text2" component="text"/> - <field name="text" component="text"/> - </BeanValidator> - <JTextField id='text'/> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> + <field name="text2" component="text"/> + <field name="text" component="text"/> + </BeanValidator> + <JTextField id='text'/> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx index 1b9bdf5..f0abe8f 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx @@ -21,275 +21,275 @@ --> <Application title="Validation.jaxx"> - <!-- models --> - <Model id='model'/> - <Model id='model2'/> - <Identity id='identity'/> + <!-- models --> + <Model id='model'/> + <Model id='model2'/> + <Identity id='identity'/> - <!-- errors model --> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' + <!-- errors model --> + <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' onContentsChanged='ok.setEnabled(errors.isEmpty())'/> - <!-- validators --> - <BeanValidator id='validator' bean='model' errorListModel='errors'> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' errorListModel='errors' - uiClass="org.nuiton.jaxx.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' errorListModel='errors' - uiClass="org.nuiton.jaxx.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> + <!-- validators --> + <BeanValidator id='validator' bean='model' errorListModel='errors'> + <field name="text"/> + <field name="text2"/> + <field name="ratio"/> + </BeanValidator> + <BeanValidator id='validator2' bean='model2' errorListModel='errors' + uiClass="org.nuiton.jaxx.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' errorListModel='errors' + uiClass="org.nuiton.jaxx.validator.swing.ui.TranslucentValidationUI"> + <field name="email" component="email2"/> + </BeanValidator> - <Table fill='both'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='{model.getText()}' - onKeyReleased='model.setText(text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model.getText2()}' - onKeyReleased='model.setText2(text2.getText())'/> - </cell> - </row> + <Table fill='both'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='text' text='{model.getText()}' + onKeyReleased='model.setText(text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='text2' text='{model.getText2()}' + onKeyReleased='model.setText2(text2.getText())'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}' - onStateChanged='model.setRatio(ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model.getText2()}'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='ratio' minimum='0' maximum='100' value='{model.getRatio()}' + onStateChanged='model.setRatio(ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model.getText2()}'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model.getRatio()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text' text='{model2.getText()}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model.getRatio()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Form2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text' text='{model2.getText()}' + onKeyReleased='model2.setText(_text.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JTextField id='_text2' text='{model2.getText2()}' + onKeyReleased='model2.setText2(_text2.getText())'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}' - onStateChanged='model2.setRatio(_ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText2()}'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}' + onStateChanged='model2.setRatio(_ratio.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Model2")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='Text:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Text2:'/> + </cell> + <cell weightx='1'> + <JLabel text='{model2.getText2()}'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model2.getRatio()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='140'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Ratio:'/> + </cell> + <cell> + <JLabel text='{model2.getRatio()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' + layout='{new GridLayout()}' width='250' height='140'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JTextField id='firstName' text='{identity.getFirstName()}' + onKeyReleased='identity.setFirstName(firstName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JTextField id='lastName' text='{identity.getLastName()}' + onKeyReleased='identity.setLastName(lastName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JTextField id='email2' text='{identity.getEmail()}' + onKeyReleased='identity.setEmail(email2.getText())'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' + onStateChanged='identity.setAge(age.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getFirstName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getLastName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getEmail()}'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane> - <JList model='{errors}'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton text='cancel' onActionPerformed='dispose()'/> - <JButton id='ok' text='valid' onActionPerformed='dispose()'/> - </JPanel> - </cell> - </row> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JLabel text='{identity.getAge()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane> + <JList model='{errors}'/> + </JScrollPane> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel layout='{new GridLayout(1,2,0,0)}'> + <JButton text='cancel' onActionPerformed='dispose()'/> + <JButton id='ok' text='valid' onActionPerformed='dispose()'/> + </JPanel> + </cell> + </row> - </Table> + </Table> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx index 2af1e2c..06c9645 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx @@ -21,113 +21,114 @@ --> <Application title="Validation.jaxx"> - <!-- models --> - <Identity id='identity'/> + <!-- models --> + <Identity id='identity'/> - <!-- errors model --> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> + <!-- errors model --> + <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> - <!-- validators --> - <BeanValidator id='validator3' autoField='true' beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok.Identity' errorListModel='errors'> - <field name="email" component="email2"/> - </BeanValidator> + <!-- validators --> + <BeanValidator id='validator3' autoField='true' + beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok.Identity' errorListModel='errors'> + <field name="email" component="email2"/> + </BeanValidator> - <Table fill='both'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='140'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> + <Table fill='both'> + <row> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' + layout='{new GridLayout()}' width='250' height='140'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JTextField id='firstName' text='{identity.getFirstName()}' + onKeyReleased='identity.setFirstName(firstName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JTextField id='lastName' text='{identity.getLastName()}' + onKeyReleased='identity.setLastName(lastName.getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JTextField id='email2' text='{identity.getEmail()}' + onKeyReleased='identity.setEmail(email2.getText())'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' + onStateChanged='identity.setAge(age.getValue())'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> + <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' + layout='{new GridLayout()}' width='250' height='120'> + <Table anchor='west' fill='both'> + <row> + <cell> + <JLabel text='FirstName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getFirstName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='LastName:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getLastName()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Email:'/> + </cell> + <cell weightx='1'> + <JLabel text='{identity.getEmail()}'/> + </cell> + </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()+""}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane> - <JList model='{errors}'/> - </JScrollPane> - </JPanel> - </cell> - </row> - </Table> + <row> + <cell> + <JLabel text='Age:'/> + </cell> + <cell> + <JLabel text='{identity.getAge()+""}'/> + </cell> + </row> + </Table> + </JPanel> + </cell> + </row> + <row> + <cell columns='2' fill="both"> + <JPanel border='{BorderFactory.createTitledBorder("Errors")}' layout='{new GridLayout()}' height='200' + width='500'> + <JScrollPane> + <JList model='{errors}'/> + </JScrollPane> + </JPanel> + </cell> + </row> + </Table> </Application> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx index 8ce1109..1199a4e 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx @@ -22,24 +22,25 @@ <JPanel> - <java.io.File id='file' constructorParams='""'/> - <java.io.File id='file2' javaBean='new File("")'/> - - <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> - <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> + <java.io.File id='file' constructorParams='""'/> + <java.io.File id='file2' javaBean='new File("")'/> - <JLabel id='nobinding1' text='{file.getAbsolutePath()}'/> - <JLabel id='nobinding2' text='{getFile().getAbsolutePath()}'/> + <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> + <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' + javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> - <JLabel id='binding0' text='{file2.getAbsolutePath()}' javaBean='new JLabel()'/> - <JLabel id='binding1' text='{this.getFile2().getAbsolutePath()}'/> - <JLabel id='binding2' text='{getFile2().getAbsolutePath()}'/> - <JLabel id='binding3' text='{bean.getText()}'/> - <JLabel id='binding4' text='{getBean().getText()}'/> - <JLabel id='binding5' text='{beanImpl.getText()}'/> - <JLabel id='binding6' text='{getBeanImpl().getText()}'/> - <JLabel id='binding7' text='{binding0.getText()}'/> - <JLabel id='binding8' text='{getBinding0().getText()}'/> - <JLabel id='binding9' text='{binding0.getText() + binding1.getText()}'/> + <JLabel id='nobinding1' text='{file.getAbsolutePath()}'/> + <JLabel id='nobinding2' text='{getFile().getAbsolutePath()}'/> + + <JLabel id='binding0' text='{file2.getAbsolutePath()}' javaBean='new JLabel()'/> + <JLabel id='binding1' text='{this.getFile2().getAbsolutePath()}'/> + <JLabel id='binding2' text='{getFile2().getAbsolutePath()}'/> + <JLabel id='binding3' text='{bean.getText()}'/> + <JLabel id='binding4' text='{getBean().getText()}'/> + <JLabel id='binding5' text='{beanImpl.getText()}'/> + <JLabel id='binding6' text='{getBeanImpl().getText()}'/> + <JLabel id='binding7' text='{binding0.getText()}'/> + <JLabel id='binding8' text='{getBinding0().getText()}'/> + <JLabel id='binding9' text='{binding0.getText() + binding1.getText()}'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml index 3d538bb..2e789bf 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <force>true</force> - <!--<verbose>true</verbose>--> - <includes> - <value>**/dataBindingTest/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <force>true</force> + <!--<verbose>true</verbose>--> + <includes> + <value>**/dataBindingTest/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx index 65ae956..d1f3f42 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx @@ -20,5 +20,5 @@ #L% --> <JPanel> - <JButton id='boxedButton' decorator='boxed'/> + <JButton id='boxedButton' decorator='boxed'/> </JPanel> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml index 31c743d..fa71a17 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <addLogger>false</addLogger> - <includes> - <value>**/decoratorTest/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <addLogger>false</addLogger> + <includes> + <value>**/decoratorTest/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml index cd1c958..adc7249 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <!--<verbose>true</verbose>--> - <includes> - <value>**/evolution74Test/error/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <!--<verbose>true</verbose>--> + <includes> + <value>**/evolution74Test/error/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx index 1fdd082..9d4fb1c 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx @@ -21,5 +21,5 @@ --> <JComboBox id='comboBox'> - <item value='{_("OK")}' selected='true'/> + <item value='{_("OK")}' selected='true'/> </JComboBox> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx index a24db47..a558c65 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx @@ -21,5 +21,5 @@ --> <JList> - <item value='OK'/> + <item value='OK'/> </JList> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx index e7f3203..afad00b 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx @@ -21,5 +21,5 @@ --> <JTree> - <item value='OK'/> + <item value='OK'/> </JTree> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml index 0a25814..a86bb25 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml @@ -24,25 +24,25 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <includes> - <value>**/evolution74Test/ok/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <includes> + <value>**/evolution74Test/ok/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx index 9a02bf0..7e388f5 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx @@ -21,5 +21,5 @@ --> <JAXXComboBox> - <item value='OK'/> + <item value='OK'/> </JAXXComboBox> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx index 82dcbec..ccac775 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx @@ -21,5 +21,5 @@ --> <JAXXList> - <item value='OK'/> + <item value='OK'/> </JAXXList> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx index 584db5d..c63e652 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx @@ -21,5 +21,5 @@ --> <JAXXTree> - <item value='OK'/> + <item value='OK'/> </JAXXTree> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml index 6364278..715f040 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <i18nable>true</i18nable> - <includes> - <value>**/i18nTest/text/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <i18nable>true</i18nable> + <includes> + <value>**/i18nTest/text/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml index fddc836..6834dd8 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <i18nable>true</i18nable> - <includes> - <value>**/i18nTest/title/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <i18nable>true</i18nable> + <includes> + <value>**/i18nTest/title/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml index 1bdf0f3..73565d0 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml @@ -24,26 +24,26 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> - <force>true</force> - <i18nable>true</i18nable> - <includes> - <value>**/i18nTest/tooltiptext/*.jaxx</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <force>true</force> + <i18nable>true</i18nable> + <includes> + <value>**/i18nTest/tooltiptext/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx index 3ce456e..15f2201 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx @@ -19,6 +19,6 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <JTabbedPane> - <tab title='test.title'/> +<JTabbedPane> + <tab title='test.title'/> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx index cce5e3d..dcec412 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx @@ -20,7 +20,7 @@ #L% --> <JTabbedPane> - <tab title='test.title'> - <JLabel text='testLabel'/> - </tab> + <tab title='test.title'> + <JLabel text='testLabel'/> + </tab> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx index e399a1e..5bfc649 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx @@ -19,6 +19,6 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <JTabbedPane toolTipText='test.toolTipText'> - <tab title="text"/> +<JTabbedPane toolTipText='test.toolTipText'> + <tab title="text"/> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx index 55847f0..3b1b66a 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx @@ -19,6 +19,6 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> - <JTabbedPane> - <tab toolTipText='test.toolTipText'/> +<JTabbedPane> + <tab toolTipText='test.toolTipText'/> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx index 9965f49..624d185 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx @@ -20,7 +20,7 @@ #L% --> <JTabbedPane> - <tab toolTipText='test.toolTipText'> - <JLabel text='yo'/> - </tab> + <tab toolTipText='test.toolTipText'> + <JLabel text='yo'/> + </tab> </JTabbedPane> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml index 09dc990..7144487 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/Lambda.xml @@ -24,27 +24,27 @@ <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> - <groupId>org.nuiton.jaxx.test</groupId> - <artifactId>test</artifactId> - <version>0</version> - <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>jaxx-maven-plugin</artifactId> - <configuration> - <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/generated-sources/test-java</outJava> - <force>true</force> - <resetAfterCompile>false</resetAfterCompile> - <addAutoHandlerUI>true</addAutoHandlerUI> - <includes> - <value>**/lambdaTest/*.jaxx</value> - <value>**/lambdaTest/*.java</value> - </includes> - </configuration> - </plugin> - </plugins> - </build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/generated-sources/test-java</outJava> + <force>true</force> + <resetAfterCompile>false</resetAfterCompile> + <addAutoHandlerUI>true</addAutoHandlerUI> + <includes> + <value>**/lambdaTest/*.jaxx</value> + <value>**/lambdaTest/*.java</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/LambdaHandler.java b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/LambdaHandler.java index 49b3d6e..e051fdd 100644 --- a/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/LambdaHandler.java +++ b/jaxx-maven-plugin/src/test/resources/org/nuiton/jaxx/plugin/lambdaTest/LambdaHandler.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.plugin.lambdaTest; * #L% */ -import org.nuiton.jaxx.runtime.JAXXObject; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXObject; +import org.nuiton.jaxx.runtime.spi.UIHandler; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index 85d49c4..d66192f 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> - <!-- - #%L - JAXX :: Runtime - - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> -<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"> +<!-- +#%L +JAXX :: Runtime + +$Id$ +$HeadURL$ +%% +Copyright (C) 2008 - 2010 CodeLutin +%% +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Lesser Public License for more details. + +You should have received a copy of the GNU General Lesser Public +License along with this program. If not, see +<http://www.gnu.org/licenses/lgpl-3.0.html>. +#L% +--> +<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> @@ -69,7 +70,7 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> - + <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> @@ -79,7 +80,7 @@ <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> </dependency> - + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JAXXAction.java deleted file mode 100644 index b2610d7..0000000 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/JAXXAction.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * #%L - * JAXX :: Runtime - * %% - * Copyright (C) 2008 - 2016 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.jaxx.runtime; - -import org.nuiton.jaxx.runtime.context.JAXXInitialContext; - -/** - * This is the contract to be realized by any class to be used as Action class for an ui. - * - * @author Tony Chemit - dev@tchemit.fr - */ -public interface JAXXAction { - - /** - * Prepare the initial context of the ui. - * - * @param parentContent the context of the parent of the ui (can be null if no parent is required) - * @param datas other datas to inject in initial context - * @return the {@link JAXXInitialContext} to be injected in the ui via the constructor of the {@link JAXXObject} - */ - JAXXInitialContext init(JAXXContext parentContent, Object... datas); - -} diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/SwingUtil.java index de272bf..2f9b320 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/SwingUtil.java @@ -21,7 +21,11 @@ */ package org.nuiton.jaxx.runtime; -import com.google.common.base.Predicate; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.jxlayer.JXLayer; +import org.jdesktop.jxlayer.plaf.LayerUI; +import org.jdesktop.swingx.JXTreeTable; import org.nuiton.jaxx.runtime.swing.Item; import org.nuiton.jaxx.runtime.swing.JAXXComboBox; import org.nuiton.jaxx.runtime.swing.editor.BooleanCellEditor; @@ -31,11 +35,6 @@ import org.nuiton.jaxx.runtime.swing.renderer.BooleanCellRenderer; import org.nuiton.jaxx.runtime.swing.renderer.EmptyNumberTableCellRenderer; import org.nuiton.jaxx.runtime.swing.renderer.EnumTableCellRenderer; import org.nuiton.jaxx.runtime.swing.renderer.I18nTableCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.jxlayer.JXLayer; -import org.jdesktop.jxlayer.plaf.LayerUI; -import org.jdesktop.swingx.JXTreeTable; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; @@ -98,6 +97,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Properties; +import java.util.function.Predicate; import static org.nuiton.i18n.I18n.t; @@ -189,8 +189,7 @@ public class SwingUtil extends JAXXUtil { * @param data data ot inject in combo * @param select the object to select in combo after reflling his model */ - public static void fillComboBox(JComboBox combo, Collection<?> data, - Object select) { + public static void fillComboBox(JComboBox combo, Collection<?> data, Object select) { ComboBoxModel comboBoxModel = combo.getModel(); @@ -338,9 +337,7 @@ public class SwingUtil extends JAXXUtil { return (O) parent; } - public static int computeTableColumnWidth(JTable table, - Font font, - int columnIndex, String suffix) { + public static int computeTableColumnWidth(JTable table, Font font, int columnIndex, String suffix) { int width = 0; if (font == null) { font = table.getFont(); @@ -399,7 +396,7 @@ public class SwingUtil extends JAXXUtil { return new DefaultTableCellRenderer() { - private static final long serialVersionUID = 1l; + private static final long serialVersionUID = 1L; @Override public Component getTableCellRendererComponent( diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/awt/visitor/GetCompopentAtPointVisitor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/awt/visitor/GetCompopentAtPointVisitor.java index 56a33ed..8b3be48 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/awt/visitor/GetCompopentAtPointVisitor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/awt/visitor/GetCompopentAtPointVisitor.java @@ -81,8 +81,8 @@ public class GetCompopentAtPointVisitor implements ComponentTreeNodeVisitor { if (!(component.isVisible() && component.isShowing())) { if (log.isDebugEnabled()) { log.debug("Skip invisible component: " + - component.getClass().getSimpleName() + "::" + - component.getName()); + component.getClass().getSimpleName() + "::" + + component.getName()); } return; } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/bean/BeanTypeAware.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/bean/BeanTypeAware.java index 0d865d9..213b705 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/bean/BeanTypeAware.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/bean/BeanTypeAware.java @@ -33,7 +33,7 @@ package org.nuiton.jaxx.runtime.bean; */ public interface BeanTypeAware<O> { - String PROPERTY_BEAN_TYPE= "beanType"; + String PROPERTY_BEAN_TYPE = "beanType"; Class<O> getBeanType(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/binding/DefaultJAXXBinding.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/binding/DefaultJAXXBinding.java index a63d514..6d104ac 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/binding/DefaultJAXXBinding.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/binding/DefaultJAXXBinding.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.runtime.binding; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXBinding; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.beans.PropertyChangeEvent; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DataContext.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DataContext.java deleted file mode 100644 index 6b42b17..0000000 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DataContext.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * #%L - * JAXX :: Runtime - * %% - * Copyright (C) 2008 - 2016 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.jaxx.runtime.context; - -import org.nuiton.jaxx.runtime.JAXXContext; -import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.regex.Pattern; - -/** - * Un contexte de données qui permet l'utilisation des bindings sur les - * entrées du contexte. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 1.3 - */ -public abstract class DataContext { - - /** Logger */ - static private final Log log = LogFactory.getLog(DataContext.class); - - public static final DataContextEntry<?>[] EMPTY_DATA_CONTEXT_ENTRY_ARRAY = - new DataContextEntry<?>[0]; - - /** le context qui contient les données */ - protected final DefaultJAXXContext delegate; - - /** la definition de l'entree actuallement selectionnee */ - protected DataContextEntry<?> currentEntry; - - /** to manage properties modifications */ - protected final PropertyChangeSupport pcs; - - protected final DataContextEntry<?>[] entries; - - protected final String[] DEFAULT_JAXX_PCS; - - public abstract String getContextPath(Object... e); - - public DataContext(String[] DEFAULT_JAXX_PCS, - DataContextEntry<?>[] entries) { - this.DEFAULT_JAXX_PCS = DEFAULT_JAXX_PCS; - this.entries = entries; - delegate = new DefaultJAXXContext() { - - @Override - protected void setParentContext(JAXXContext parentContext) { - throw new IllegalStateException( - "can not use this method for this type of context"); - } - - @Override - protected JAXXContext getParentContext() { - return null; - } - - @Override - public <T> void removeContextValue(Class<T> klazz, String name) { - if (log.isTraceEnabled()) { - log.trace(klazz + " - " + name); - } - super.removeContextValue(klazz, name); - } - - @Override - public <T> void setContextValue(T o, String name) { - if (log.isTraceEnabled()) { - log.trace(name + " - " + o.getClass()); - } - super.setContextValue(o, name); - } - }; - pcs = new PropertyChangeSupport(this); - } - - public DefaultJAXXContext getDelegate() { - return delegate; - } - - public Iterable<? extends DataContextEntry<?>> iterateOnAll() { - return (Iterable<DataContextEntry<?>>) () -> new DataContextEntryIterator(entries); - } - - public Iterable<? extends DataContextEntry<?>> iterateToLevel( - final int level) { - return (Iterable<DataContextEntry<?>>) () -> new DataContextEntryIterator(entries, level); - } - - public Iterable<? extends DataContextEntry<?>> reverseIterateOnAll() { - - return (Iterable<DataContextEntry<?>>) () -> new DataContextEntryIterator(entries, true); - } - - public DataContextEntry<?> getCurrentEntry() { - return currentEntry; - } - - public DataContextEntry<?> getEntry(String path) { - for (DataContextEntry<?> scope : reverseIterateOnAll()) { - if (scope.acceptPath(path)) { - return scope; - } - } - return null; - } - - public DataContextEntry<?> getEntry(Class<?> type) { - for (DataContextEntry<?> scope : iterateOnAll()) { - if (scope.acceptType(type)) { - return scope; - } - } - return null; - } - - public <T> T getContextValue(DataContextEntry<T> entry, String key) { - String contextKey = getKey(entry, key); - return delegate.getContextValue(entry.getKlass(), contextKey); - } - - public void setContextValue(DataContextEntry<?> entry, - Object value, - String key) { - String contextKey = getKey(entry, key); - delegate.setContextValue(value, contextKey); - } - - /** - * @param entry - * @param klass - * @param key - */ - public void removeContextValue(DataContextEntry<?> entry, - Class<?> klass, - String key) { - String contextKey = getKey(entry, key); - delegate.removeContextValue(klass, key); - } - - public void removeContextValue(DataContextEntry<?> entry, - String key) { - String contextKey = getKey(entry, key); - delegate.removeContextValue(entry.getKlass(), contextKey); - } - - @SuppressWarnings("unchecked") - public void updateSelectedData(String path, - Object data, - UpdateDataContext updator) { - - if (log.isDebugEnabled()) { - log.debug("-----------------------------------------------------" + - "-----------"); - } - if (currentEntry != null) { - - if (log.isDebugEnabled()) { - log.debug("remove from old entry " + currentEntry); - } - for (DataContextEntry<?> s : currentEntry) { - if (log.isDebugEnabled()) { - log.debug("remove entry " + s); - } - updator.onRemovingData(this, s); - } - } - - currentEntry = getEntry(path); - - if (log.isDebugEnabled()) { - log.debug("new entry " + currentEntry + " for path " + path); - } - - if (currentEntry != null) { - - for (DataContextEntry<?> s : - iterateToLevel(currentEntry.getLevel())) { - - if (log.isDebugEnabled()) { - log.debug("add entry " + s); - } - updator.onAddingData(this, s, path); - } - } - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - pcs.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, - PropertyChangeListener listener) { - pcs.removePropertyChangeListener(propertyName, listener); - } - - public synchronized boolean hasListeners(String propertyName) { - return pcs.hasListeners(propertyName); - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners( - String propertyName) { - return pcs.getPropertyChangeListeners(propertyName); - } - - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - return pcs.getPropertyChangeListeners(); - } - - public void removeJaxxPropertyChangeListener() { - PropertyChangeListener[] toRemove = - JAXXUtil.findJaxxPropertyChangeListener( - DEFAULT_JAXX_PCS, getPropertyChangeListeners()); - if (toRemove == null || toRemove.length == 0) { - return; - } - if (log.isDebugEnabled()) { - log.debug("before remove : " + getPropertyChangeListeners().length); - log.debug("toRemove : " + toRemove.length); - } - for (PropertyChangeListener listener : toRemove) { - removePropertyChangeListener(listener); - } - if (log.isDebugEnabled()) { - log.debug("after remove : " + getPropertyChangeListeners().length); - } - } - - protected void firePropertyChange(String name, - Object oldValue, - Object newValue) { - pcs.firePropertyChange(name, oldValue, newValue); - } - - protected String getKey(DataContextEntry<?> entry, String key) { - String result = null; - if (key != null) { - result = entry.hashCode() + "#" + key; - } - return result; - } - - public void close() { - clear(); - - // suppression des ecouteurs - - for (PropertyChangeListener l : getPropertyChangeListeners()) { - removePropertyChangeListener(l); - } - } - - public void clear() { - delegate.clear(); - } - - public static abstract class DataContextEntry<E> implements Iterable<DataContextEntry<?>> { - - private final int level; - - private final DataContextEntry<?> previous; - - private final DataContextEntry<?>[] parents; - - private final Class<E> klass; - - public DataContextEntry(Class<E> klass, DataContextEntry<?> previous) { - this.previous = previous; - level = previous.level + 1; - this.klass = klass; - parents = new DataContextEntry<?>[level]; - int i = level; - while (i > 0) { - parents[--i] = previous; - previous = previous.previous; - } - } - - public DataContextEntry(Class<E> klass) { - level = 0; - this.klass = klass; - previous = null; - parents = EMPTY_DATA_CONTEXT_ENTRY_ARRAY; - } - - public Class<E> getKlass() { - return klass; - } - - public int getLevel() { - return level; - } - - public DataContextEntry<?>[] getParents() { - return parents; - } - - public abstract Pattern getPattern(); - - public abstract String getContextPath(Object... args); - - public boolean acceptPath(String path) { - return getPattern().matcher(path).matches(); - } - - public boolean acceptType(Class<?> type) { - return klass.isAssignableFrom(type); - } - - @Override - public Iterator<DataContextEntry<?>> iterator() { - int length = parents.length; - DataContextEntry<?>[] t = new DataContextEntry<?>[length + 1]; - System.arraycopy(parents, 0, t, 0, length); - t[length] = this; - return new DataContextEntryIterator(t, true); - } - - @Override - public String toString() { - return super.toString() + "<type: " + klass.getSimpleName() + ">"; - } - } - - public interface UpdateDataContext<D extends DataContext> { - - void onRemovingData(D context, DataContextEntry<D> entry); - - void onAddingData(D context, DataContextEntry<D> entry, String path); - } - - public static class DataContextEntryIterator implements Iterator<DataContextEntry<?>> { - - protected final DataContextEntry<?>[] datas; - - protected final boolean reverse; - - protected final int level; - - protected int index; - - public DataContextEntryIterator(DataContextEntry<?>[] datas) { - this(datas, false, -1); - } - - public DataContextEntryIterator(DataContextEntry<?>[] datas, - int level) { - this(datas, false, level); - } - - public DataContextEntryIterator(DataContextEntry<?>[] datas, - boolean reverse) { - this(datas, reverse, -1); - } - - DataContextEntryIterator(DataContextEntry<?>[] datas, - boolean reverse, - int level) { - this.datas = datas; - this.reverse = reverse; - if (reverse) { - index = datas.length; - } else { - index = -1; - } - this.level = level; - } - - @Override - public boolean hasNext() { - if (reverse) { - return index > 0; - } else { - return index + 1 < datas.length && - (level == -1 || datas[index + 1].getLevel() <= level); - } - } - - @Override - public DataContextEntry<?> next() { - if (!hasNext()) { - throw new NoSuchElementException(); - } - if (reverse) { - index--; - } else { - index++; - } - return datas[index]; - } - - @Override - public void remove() { - throw new UnsupportedOperationException("Not supported yet."); - } - } -} diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContext.java index 164af0f..b5cc66c 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContext.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.context; -import org.nuiton.jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXContext; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; @@ -136,7 +136,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { value = getContextValue(realClass, null); if (log.isDebugEnabled()) { log.debug("detect forward from " + clazz + " to " + realClass + - " (" + value + ")"); + " (" + value + ")"); } } else { @@ -157,7 +157,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { if (name != null) { throw new IllegalArgumentException( "an " + AutoLoad.class.getName() + " can not have " + - "a named context but was call with this one : " + name); + "a named context but was call with this one : " + name); } value = newInstance(clazz); if (!anno.initMethod().trim().isEmpty()) { @@ -183,7 +183,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { forwards.put(targetClass, clazz); if (log.isDebugEnabled()) { log.debug("register forward from " + targetClass + - " to " + clazz); + " to " + clazz); } } } @@ -208,7 +208,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { itr.remove(); if (log.isDebugEnabled()) { log.debug("removed forward from " + entry.getKey() + - " to " + klass); + " to " + klass); } break; } @@ -241,7 +241,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { if (oldValue != null) { if (log.isDebugEnabled()) { log.debug("remove value " + oldValue.getClass() + " for " + - entry); + entry); } } // then can put safely diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContext.java index b71edf7..57e456a 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContext.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.runtime.context; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.JAXXUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.HashMap; @@ -84,7 +84,7 @@ public class DefaultJAXXContext implements JAXXContext { if (oldValue != null) { if (log.isDebugEnabled()) { log.debug("remove value " + oldValue.getClass() + " for " + - entry); + entry); } } // then can put safely @@ -100,8 +100,8 @@ public class DefaultJAXXContext implements JAXXContext { @Override public <T> T getContextValue(Class<T> clazz, String name) { if (parentContext != null && - parentContext.getClass().equals(clazz) || - PARENT_CONTEXT_ENTRY.accept(clazz, name)) { + parentContext.getClass().equals(clazz) || + PARENT_CONTEXT_ENTRY.accept(clazz, name)) { return (T) getParentContext(); } for (Entry<JAXXContextEntryDef<?>, Object> entry : data.entrySet()) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/JAXXContextEntryDef.java index 7e60d18..d3ba57e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/JAXXContextEntryDef.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/context/JAXXContextEntryDef.java @@ -109,7 +109,7 @@ public class JAXXContextEntryDef<O> implements Serializable { } JAXXContextEntryDef<?> that = (JAXXContextEntryDef<?>) o; return klass.equals(that.klass) && - !(name != null ? !name.equals(that.name) : that.name != null); + !(name != null ? !name.equals(that.name) : that.name != null); } @Override @@ -124,15 +124,15 @@ public class JAXXContextEntryDef<O> implements Serializable { return this.name != null && name != null && this.name.equals(name); } return klass.isAssignableFrom(this.klass) && (this.name == null && name == null - || (this.name != null && name != null && this.name.equals(name))); + || (this.name != null && name != null && this.name.equals(name))); } public boolean accept2(Class<?> klass, String name) { return !(Object.class.equals(klass) && - !Object.class.equals(this.klass)) && - this.klass.isAssignableFrom(klass) && - (this.name == null && name == null || - (this.name != null && name != null && this.name.equals(name)) - ); + !Object.class.equals(this.klass)) && + this.klass.isAssignableFrom(klass) && + (this.name == null && name == null || + (this.name != null && name != null && this.name.equals(name)) + ); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/css/Pseudoclasses.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/css/Pseudoclasses.java index 417afb7..d7bfd5a 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/css/Pseudoclasses.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/css/Pseudoclasses.java @@ -87,17 +87,9 @@ public class Pseudoclasses { } private static List<PropertyValue> getPropertyList(Object object, String property) { - Map<String, List<PropertyValue>> propertyMap = properties.get(object); - if (propertyMap == null) { - propertyMap = new HashMap<>(); - properties.put(object, propertyMap); - } + Map<String, List<PropertyValue>> propertyMap = properties.computeIfAbsent(object, k -> new HashMap<>()); - List<PropertyValue> propertyList = propertyMap.get(property); - if (propertyList == null) { - propertyList = new ArrayList<>(); - propertyMap.put(property, propertyList); - } + List<PropertyValue> propertyList = propertyMap.computeIfAbsent(property, k -> new ArrayList<>()); return propertyList; } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI.java index 73f4534..27d45e3 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI.java @@ -188,8 +188,8 @@ public class BlockingLayerUI extends AbstractLayerUI<JComponent> { } @Override - public BlockingLayerUI clone() { - BlockingLayerUI clone = new BlockingLayerUI(); + public BlockingLayerUI clone() throws CloneNotSupportedException { + BlockingLayerUI clone = (BlockingLayerUI) super.clone(); clone.acceptAction = acceptAction; clone.acceptIcon = acceptIcon; clone.blockIcon = blockIcon; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI2.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI2.java index 23487ee..3ae4c9a 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI2.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/BlockingLayerUI2.java @@ -131,8 +131,8 @@ public class BlockingLayerUI2 extends AbstractLayerUI<JComponent> { } @Override - public BlockingLayerUI2 clone() { - BlockingLayerUI2 clone = new BlockingLayerUI2(); + public BlockingLayerUI2 clone() throws CloneNotSupportedException { + BlockingLayerUI2 clone = (BlockingLayerUI2) super.clone(); clone.acceptAction = acceptAction; clone.acceptIcon = acceptIcon; clone.blockIcon = blockIcon; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2.java index 3ef6a45..d61382a 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2.java @@ -84,7 +84,7 @@ public class CardLayout2 extends CardLayout { * * @param constraints l'identifiant a tester * @return {@code true} si l'identifiant est deja present dans le - * layout, {@code false} otherwise. + * layout, {@code false} otherwise. */ public boolean contains(Serializable constraints) { return contexts.contains(constraints); @@ -120,7 +120,7 @@ public class CardLayout2 extends CardLayout { * * @param parent the parent container in which to do the layout * @return the preferred dimensions to lay out the subcomponents - * of the specified container + * of the specified container * @see Container#getPreferredSize * @see CardLayout#minimumLayoutSize */ @@ -144,7 +144,7 @@ public class CardLayout2 extends CardLayout { * * @param parent the parent container in which to do the layout * @return the minimum dimensions required to lay out the - * subcomponents of the specified container + * subcomponents of the specified container * @see Container#doLayout * @see CardLayout#preferredLayoutSize */ diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2Ext.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2Ext.java index 58ec954..b7df529 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2Ext.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CardLayout2Ext.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing; -import org.nuiton.jaxx.runtime.JAXXObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXObject; import java.awt.Container; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentMover.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentMover.java index d4edc31..bb0b5de 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentMover.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentMover.java @@ -50,7 +50,7 @@ import java.awt.event.MouseEvent; * * Components can be registered when the class is created. Additional * components can be added at any time using the registerComponent() method. - * + * * @since 2.5.10 */ public class ComponentMover extends MouseAdapter { @@ -232,7 +232,7 @@ public class ComponentMover extends MouseAdapter { */ public void setSnapSize(Dimension snapSize) { if (snapSize.width < 1 - || snapSize.height < 1) + || snapSize.height < 1) throw new IllegalArgumentException("Snap sizes must be greater than 0"); this.snapSize = snapSize; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentResizer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentResizer.java index 9ad3f6b..7919433 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentResizer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/ComponentResizer.java @@ -41,7 +41,7 @@ import java.util.Map; /** * The ComponentResizer allows you to resize a component by dragging a border * of the component. - * + * * @since 2.5.10 */ public class ComponentResizer extends MouseAdapter { @@ -270,7 +270,7 @@ public class ComponentResizer extends MouseAdapter { int minimumHeight = drag.top + drag.bottom; if (minimum.width < minimumWidth - || minimum.height < minimumHeight) { + || minimum.height < minimumHeight) { String message = "Minimum size cannot be less than drag insets"; throw new IllegalArgumentException(message); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CompoundIcon.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CompoundIcon.java index 7020167..ec4fc59 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CompoundIcon.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/CompoundIcon.java @@ -31,8 +31,9 @@ */ package org.nuiton.jaxx.runtime.swing; -import java.awt.*; -import javax.swing.*; +import javax.swing.Icon; +import java.awt.Component; +import java.awt.Graphics; /** * The CompoundIcon will paint two, or more, Icons as a single Icon. The Icons @@ -44,7 +45,6 @@ import javax.swing.*; * <li>Vertically * <li>Stacked * </ul> - * */ public class CompoundIcon implements Icon { public enum Layout { @@ -71,8 +71,7 @@ public class CompoundIcon implements Icon { * laid out horizontally, the gap is 0 and the X/Y alignments will default * to CENTER. * - * @param icons - * the Icons to be painted as part of the CompoundIcon + * @param icons the Icons to be painted as part of the CompoundIcon */ public CompoundIcon(Icon... icons) { this(Layout.HORIZONTAL, icons); @@ -82,10 +81,8 @@ public class CompoundIcon implements Icon { * Convenience constructor for creating a CompoundIcon where the gap is 0 * and the X/Y alignments will default to CENTER. * - * @param layout - * the layout used to lay out the icons for painting. - * @param icons - * the Icons to be painted as part of the CompoundIcon + * @param layout the layout used to lay out the icons for painting. + * @param icons the Icons to be painted as part of the CompoundIcon */ public CompoundIcon(Layout layout, Icon... icons) { this(layout, 0, icons); @@ -95,12 +92,9 @@ public class CompoundIcon implements Icon { * Convenience constructor for creating a CompoundIcon where the X/Y * alignments will default to CENTER. * - * @param layout - * the layout used to lay out the icons for painting - * @param gap - * the gap between the icons - * @param icons - * the Icons to be painted as part of the CompoundIcon + * @param layout the layout used to lay out the icons for painting + * @param gap the gap between the icons + * @param icons the Icons to be painted as part of the CompoundIcon */ public CompoundIcon(Layout layout, int gap, Icon... icons) { this(layout, gap, CENTER, CENTER, icons); @@ -109,18 +103,13 @@ public class CompoundIcon implements Icon { /** * Create a CompoundIcon specifying all the properties. * - * @param layout - * the layout used to lay out the icons for painting - * @param gap - * the gap between the icons - * @param alignmentX - * the X alignment of the icons. Common values are LEFT, CENTER, - * RIGHT. Can be any value between 0.0 and 1.0 - * @param alignmentY - * the Y alignment of the icons. Common values are TOP, CENTER, - * BOTTOM. Can be any value between 0.0 and 1.0 - * @param icons - * the Icons to be painted as part of the CompoundIcon + * @param layout the layout used to lay out the icons for painting + * @param gap the gap between the icons + * @param alignmentX the X alignment of the icons. Common values are LEFT, CENTER, + * RIGHT. Can be any value between 0.0 and 1.0 + * @param alignmentY the Y alignment of the icons. Common values are TOP, CENTER, + * BOTTOM. Can be any value between 0.0 and 1.0 + * @param icons the Icons to be painted as part of the CompoundIcon */ public CompoundIcon(Layout layout, int gap, float alignmentX, float alignmentY, Icon... icons) { @@ -189,11 +178,9 @@ public class CompoundIcon implements Icon { /** * Get the Icon at the specified index. * - * @param index - * the index of the Icon to be returned + * @param index the index of the Icon to be returned * @return the Icon at the specified index - * @exception IndexOutOfBoundsException - * if the index is out of range + * @throws IndexOutOfBoundsException if the index is out of range */ public Icon getIcon(int index) { return icons[index]; @@ -251,13 +238,9 @@ public class CompoundIcon implements Icon { * Paint the icons of this compound icon at the specified location * * @param c The component on which the icon is painted - * * @param g the graphics context - * * @param x the X coordinate of the icon's top-left corner - * * @param y the Y coordinate of the icon's top-left corner - * */ @Override public void paintIcon(Component c, Graphics g, int x, int y) { @@ -277,7 +260,7 @@ public class CompoundIcon implements Icon { icon.paintIcon(c, g, x + iconX, y); y += icon.getIconHeight() + gap; } - } else {// must be Z_layout + } else {// must be Z_layout int width = getIconWidth(); int height = getIconHeight(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXButtonGroup.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXButtonGroup.java index 895ea23..d120ef9 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXButtonGroup.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXButtonGroup.java @@ -218,7 +218,7 @@ public class JAXXButtonGroup extends ButtonGroup { * to this AbstractButton with addChangeListener(). * * @return all of the <code>ChangeListener</code>s added or an empty - * array if no listeners have been added + * array if no listeners have been added * @since 1.4 */ public ChangeListener[] getChangeListeners() { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXComboBox.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXComboBox.java index 265939f..e8d525b 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXComboBox.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXComboBox.java @@ -125,7 +125,7 @@ public class JAXXComboBox extends JComboBox { @Override public void setSelectedItem(Object selectedItem) { if (this.selectedItem != null && !this.selectedItem.equals(selectedItem) || - this.selectedItem == null && selectedItem != null) { + this.selectedItem == null && selectedItem != null) { this.selectedItem = selectedItem; fireContentsChanged(this, -1, -1); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXList.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXList.java index 76a92b6..5ba033c 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXList.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/JAXXList.java @@ -33,11 +33,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -public class JAXXList extends JList { +public class JAXXList extends JList<Item> { private static final long serialVersionUID = 1L; - public class JAXXListModel extends AbstractListModel { + public class JAXXListModel extends AbstractListModel<Item> { private final List<Item> items; @@ -99,8 +99,8 @@ public class JAXXList extends JList { } @Override - public Object getElementAt(int i) { - return items.get(i).getValue(); + public Item getElementAt(int i) { + return items.get(i); } @Override @@ -196,7 +196,7 @@ public class JAXXList extends JList { } int[] ints = new int[selectedIndices.size()]; for (int i = 0; i < ints.length; i++) { - ints[i] = selectedIndices.get(i).intValue(); + ints[i] = selectedIndices.get(i); } setSelectedIndices(ints); } else { @@ -228,7 +228,7 @@ public class JAXXList extends JList { } public List<Item> getSelectedItems() { - Object[] selected = super.getSelectedValues(); + List<Item> selected = super.getSelectedValuesList(); java.util.List<Item> itemsSelected = new ArrayList<>(); for (Object s : selected) { itemsSelected.add(findItem(s)); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionExecutor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionExecutor.java index c759e2b..c8af632 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionExecutor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionExecutor.java @@ -92,9 +92,9 @@ public abstract class ActionExecutor { workerListener = evt -> { if (log.isDebugEnabled()) { log.debug("action " + evt.getSource() + " property " + - evt.getPropertyName() + " changed <" + - evt.getOldValue() + " - " + evt.getNewValue() + - '>'); + evt.getPropertyName() + " changed <" + + evt.getOldValue() + " - " + evt.getNewValue() + + '>'); } if ("state".equals(evt.getPropertyName())) { @@ -116,7 +116,7 @@ public abstract class ActionExecutor { ActionWorker.ActionStatus status = source.getStatus(); if (log.isDebugEnabled()) { log.debug("Action [" + source.getActionLabel() + - "] status = " + status); + "] status = " + status); } try { switch (status) { @@ -242,7 +242,7 @@ public abstract class ActionExecutor { } catch (IllegalAccessException e) { throw new RuntimeException( "could not invoke on container " + - methodContainer, e); + methodContainer, e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionWorker.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionWorker.java index 2ef718c..c6fd5dc 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionWorker.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/application/ActionWorker.java @@ -21,12 +21,12 @@ */ package org.nuiton.jaxx.runtime.swing.application; -import com.google.common.base.Preconditions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.StringUtil; import javax.swing.SwingWorker; +import java.util.Objects; import java.util.concurrent.Callable; /** @@ -81,7 +81,7 @@ public class ActionWorker<R, P> extends SwingWorker<R, P> { @Override protected R doInBackground() throws Exception { - Preconditions.checkNotNull(target != null, "Targe field can not be null here."); + Objects.requireNonNull(target != null, "Targe field can not be null here."); startTime = System.nanoTime(); if (log.isDebugEnabled()) { log.debug("Action [" + getActionLabel() + "] is starting..."); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/BooleanCellEditor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/BooleanCellEditor.java index dba488f..8151ade 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/BooleanCellEditor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/BooleanCellEditor.java @@ -21,7 +21,8 @@ */ package org.nuiton.jaxx.runtime.swing.editor; -import java.awt.Component; +import org.jdesktop.swingx.JXTable; + import javax.swing.AbstractCellEditor; import javax.swing.Icon; import javax.swing.JCheckBox; @@ -30,7 +31,7 @@ import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; -import org.jdesktop.swingx.JXTable; +import java.awt.Component; /** * @author Tony Chemit - dev@tchemit.fr @@ -59,7 +60,7 @@ public class BooleanCellEditor extends AbstractCellEditor implements TableCellRe public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent rendered = (JComponent) rendererDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (rendered instanceof JCheckBox) { - JCheckBox checkBox = (JCheckBox)rendered; + JCheckBox checkBox = (JCheckBox) rendered; checkBox.setHorizontalAlignment(JLabel.CENTER); checkBox.setVerticalTextPosition(JLabel.TOP); checkBox.setBorderPainted(true); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/EnumEditor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/EnumEditor.java index 2259b82..0830297 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/EnumEditor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/EnumEditor.java @@ -102,12 +102,12 @@ public class EnumEditor<E extends Enum<E>> extends JComboBox { public EnumEditor(Class<E> type) { super(buildModel(type)); - this.type=type; + this.type = type; } public EnumEditor(Class<E> type, int maxOrdinal) { super(buildModel(type, maxOrdinal)); - this.type=type; + this.type = type; } public EnumEditor(E... universe) { @@ -134,13 +134,7 @@ public class EnumEditor<E extends Enum<E>> extends JComboBox { int maxOrdinal) { Class<E> enumClass = ReflectUtil.getEnumClass(type); EnumSet<E> result = EnumSet.allOf(enumClass); - Iterator<E> itr = result.iterator(); - while (itr.hasNext()) { - E e = itr.next(); - if (e.ordinal() > maxOrdinal) { - itr.remove(); - } - } + result.removeIf(e -> e.ordinal() > maxOrdinal); return result.toArray(new Object[result.size()]); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/KeyStrokeCellEditor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/KeyStrokeCellEditor.java index a406715..77a73ad 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/KeyStrokeCellEditor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/editor/KeyStrokeCellEditor.java @@ -21,12 +21,11 @@ */ package org.nuiton.jaxx.runtime.swing.editor; -import java.awt.Component; import javax.swing.AbstractCellEditor; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.table.TableCellEditor; -import org.nuiton.jaxx.runtime.swing.editor.KeyStrokeEditor; +import java.awt.Component; /** * @author Sylvain Lletellier diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/help/JAXXHelpBroker.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/help/JAXXHelpBroker.java index 312aa17..8c74b15 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/help/JAXXHelpBroker.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/help/JAXXHelpBroker.java @@ -21,14 +21,13 @@ */ package org.nuiton.jaxx.runtime.swing.help; -import com.google.common.base.Preconditions; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.JAXXObject; import org.nuiton.jaxx.runtime.awt.visitor.BuildTreeVisitor; import org.nuiton.jaxx.runtime.awt.visitor.ComponentTreeNode; import org.nuiton.jaxx.runtime.awt.visitor.GetCompopentAtPointVisitor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.help.CSH; import javax.help.HelpBroker; @@ -61,6 +60,7 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Vector; /** @@ -238,7 +238,7 @@ public class JAXXHelpBroker { onItemCursor = BasicCursorFactory.getOnItemCursor(); UIManager.put("HelpOnItemCursor", onItemCursor); } - Preconditions.checkNotNull(onItemCursor, "A cursor is missing (add HelpOnItemCursor cursor in UIManager)."); + Objects.requireNonNull(onItemCursor, "A cursor is missing (add HelpOnItemCursor cursor in UIManager)."); Vector<?> topComponents = null; cursors = null; @@ -466,7 +466,7 @@ public class JAXXHelpBroker { * method returns when stopModal is invoked. * * @return MouseEvent The mouse event occurred. Null if - * cancelled on an undetermined object. + * cancelled on an undetermined object. */ public static MouseEvent getMouseEvent() { // Should the cursor change to a quesiton mark here or @@ -536,7 +536,7 @@ public class JAXXHelpBroker { // if this is the cancel key then exit // otherwise pass all other keys up if (e.getKeyCode() == KeyEvent.VK_CANCEL || - e.getKeyCode() == KeyEvent.VK_ESCAPE) { + e.getKeyCode() == KeyEvent.VK_ESCAPE) { e.consume(); return null; } else { @@ -548,9 +548,9 @@ public class JAXXHelpBroker { int eID = e.getID(); if ((eID == MouseEvent.MOUSE_CLICKED || - eID == MouseEvent.MOUSE_PRESSED || - eID == MouseEvent.MOUSE_RELEASED) && - SwingUtilities.isRightMouseButton(e)) { + eID == MouseEvent.MOUSE_PRESSED || + eID == MouseEvent.MOUSE_RELEASED) && + SwingUtilities.isRightMouseButton(e)) { // cancel tracking e.consume(); if (log.isDebugEnabled()) { @@ -560,9 +560,9 @@ public class JAXXHelpBroker { } if ((eID == MouseEvent.MOUSE_CLICKED || - eID == MouseEvent.MOUSE_PRESSED || - eID == MouseEvent.MOUSE_RELEASED) && - SwingUtilities.isLeftMouseButton(e)) { + eID == MouseEvent.MOUSE_PRESSED || + eID == MouseEvent.MOUSE_RELEASED) && + SwingUtilities.isLeftMouseButton(e)) { if (eID == MouseEvent.MOUSE_CLICKED) { if (eventNumber == 0) { dispatchEvent(event); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/ActionCheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/ActionCheckListModel.java index 2fd0aca..3fb43fc 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/ActionCheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/ActionCheckListModel.java @@ -32,6 +32,8 @@ package org.nuiton.jaxx.runtime.swing.list; +import javax.swing.event.ListDataEvent; +import javax.swing.event.ListDataListener; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -40,149 +42,147 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; - public class ActionCheckListModel<T> implements CheckListModel<T> { - protected final List<ListDataListener> listeners = Collections.synchronizedList( new ArrayList<ListDataListener>()); - protected final CheckListModel<T> originalModel; + protected final List<ListDataListener> listeners = Collections.synchronizedList(new ArrayList<ListDataListener>()); + protected final CheckListModel<T> originalModel; protected final CheckListAction<T> actionCheckAll = new CheckListAction.CheckAll<>(); - - @SuppressWarnings("unchecked") - protected final List<CheckListAction<T>> actionItems = Arrays.asList( actionCheckAll ); + + @SuppressWarnings("unchecked") + protected final List<CheckListAction<T>> actionItems = Collections.singletonList(actionCheckAll); protected final Set<CheckListAction<T>> checks = new HashSet<>(); - - public ActionCheckListModel( final CheckListModel<T> originalModel ) { - - if ( originalModel == null ) throw new NullPointerException(); - this.originalModel = originalModel; - - //react on original model changes - this.originalModel.addListDataListener( new ListDataListener () { - - @Override - public void intervalAdded(ListDataEvent e) { - ListDataEvent event = toDecoratedEvent(e); - for( ListDataListener l: listeners ) { - l.intervalAdded(event); - } - } - - @Override - public void intervalRemoved(ListDataEvent e) { - ListDataEvent event = toDecoratedEvent(e); - for( ListDataListener l: listeners ) { - l.intervalRemoved(event); - } - } - - @Override - public void contentsChanged(ListDataEvent e) { - ListDataEvent event = toDecoratedEvent(e); - for( ListDataListener l: listeners ) { - l.contentsChanged(event); - } - if ( originalModel.getCheckedItems().size() < originalModel.getOriginalSize() ) { - checks.remove(actionCheckAll); - } else { - checks.add(actionCheckAll); - } - fireListDataChanged(); - } - }); - } - - @Override - public int getSize() { - return originalModel.getSize() + actionItems.size(); - } + + public ActionCheckListModel(final CheckListModel<T> originalModel) { + + if (originalModel == null) throw new NullPointerException(); + this.originalModel = originalModel; + + //react on original model changes + this.originalModel.addListDataListener(new ListDataListener() { + + @Override + public void intervalAdded(ListDataEvent e) { + ListDataEvent event = toDecoratedEvent(e); + for (ListDataListener l : listeners) { + l.intervalAdded(event); + } + } + + @Override + public void intervalRemoved(ListDataEvent e) { + ListDataEvent event = toDecoratedEvent(e); + for (ListDataListener l : listeners) { + l.intervalRemoved(event); + } + } + + @Override + public void contentsChanged(ListDataEvent e) { + ListDataEvent event = toDecoratedEvent(e); + for (ListDataListener l : listeners) { + l.contentsChanged(event); + } + if (originalModel.getCheckedItems().size() < originalModel.getOriginalSize()) { + checks.remove(actionCheckAll); + } else { + checks.add(actionCheckAll); + } + fireListDataChanged(); + } + }); + } + + @Override + public int getSize() { + return originalModel.getSize() + actionItems.size(); + } @Override public int getOriginalSize() { return originalModel.getOriginalSize() + actionItems.size(); } - @Override - public Object getElementAt(int index) { - if ( isDecoratedIndex(index)) { - return actionItems.get(index); - } else { - return originalModel.getElementAt( toOriginalIndex(index)); - } - } - - private int toOriginalIndex( int index ) { - return index - actionItems.size(); - } - - private int toDecoratedIndex( int index ) { - return index + actionItems.size(); - } - - private boolean isDecoratedIndex( int index ) { - int size = actionItems.size(); - return size > 0 && index >= 0 && index < size; - } - - - @Override - public void addListDataListener(ListDataListener l) { - listeners.add(l); - } - - @Override - public void removeListDataListener(ListDataListener l) { - listeners.remove(l); - } - - private void fireListDataChanged() { - ListDataEvent e = new ListDataEvent( this, 0, 0, getSize() ); - for( ListDataListener l: listeners ) { - l.contentsChanged(e); - } - } - - private ListDataEvent toDecoratedEvent( ListDataEvent e ) { - return new ListDataEvent( - e.getSource(), - e.getType(), - toDecoratedIndex(e.getIndex0()), - toDecoratedIndex(e.getIndex1())); - } - - @Override - public boolean isCheckedIndex(int index) { - if ( isDecoratedIndex(index)) { - return checks.contains(actionItems.get(index)); - } else { - return originalModel.isCheckedIndex( toOriginalIndex(index)); - } - - } - - @Override - public void setCheckedIndex(int index, boolean value) { - if ( isDecoratedIndex(index)) { - CheckListAction<T> item = actionItems.get(index); - item.check(originalModel, value); - if ( value ) checks.add(item); else checks.remove(item); - fireListDataChanged(); - } else { - originalModel.setCheckedIndex( toOriginalIndex(index), value); - } - } - - @Override - public Collection<T> getCheckedItems() { - return originalModel.getCheckedItems(); - } - - @Override - public void setCheckedItems(Collection<T> items) { - originalModel.setCheckedItems(items); - } + @Override + public Object getElementAt(int index) { + if (isDecoratedIndex(index)) { + return actionItems.get(index); + } else { + return originalModel.getElementAt(toOriginalIndex(index)); + } + } + + private int toOriginalIndex(int index) { + return index - actionItems.size(); + } + + private int toDecoratedIndex(int index) { + return index + actionItems.size(); + } + + private boolean isDecoratedIndex(int index) { + int size = actionItems.size(); + return size > 0 && index >= 0 && index < size; + } + + + @Override + public void addListDataListener(ListDataListener l) { + listeners.add(l); + } + + @Override + public void removeListDataListener(ListDataListener l) { + listeners.remove(l); + } + + private void fireListDataChanged() { + ListDataEvent e = new ListDataEvent(this, 0, 0, getSize()); + for (ListDataListener l : listeners) { + l.contentsChanged(e); + } + } + + private ListDataEvent toDecoratedEvent(ListDataEvent e) { + return new ListDataEvent( + e.getSource(), + e.getType(), + toDecoratedIndex(e.getIndex0()), + toDecoratedIndex(e.getIndex1())); + } + + @Override + public boolean isCheckedIndex(int index) { + if (isDecoratedIndex(index)) { + return checks.contains(actionItems.get(index)); + } else { + return originalModel.isCheckedIndex(toOriginalIndex(index)); + } + + } + + @Override + public void setCheckedIndex(int index, boolean value) { + if (isDecoratedIndex(index)) { + CheckListAction<T> item = actionItems.get(index); + item.check(originalModel, value); + if (value) checks.add(item); + else checks.remove(item); + fireListDataChanged(); + } else { + originalModel.setCheckedIndex(toOriginalIndex(index), value); + } + } + + @Override + public Collection<T> getCheckedItems() { + return originalModel.getCheckedItems(); + } + + @Override + public void setCheckedItems(Collection<T> items) { + originalModel.setCheckedItems(items); + } // @Override // public void filter(String filter, Decorator<Object> decorator, CheckListFilterType filterType) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckList.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckList.java index 95d38a9..ba72e3d 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckList.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckList.java @@ -33,112 +33,116 @@ package org.nuiton.jaxx.runtime.swing.list; +import javax.swing.AbstractAction; +import javax.swing.JList; +import javax.swing.KeyStroke; +import javax.swing.ListSelectionModel; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseListener; import java.util.Collection; -import javax.swing.AbstractAction; -import javax.swing.JList; -import javax.swing.KeyStroke; -import javax.swing.ListSelectionModel; - /** * The decorator for JList which makes it work like check list * UI can be designed using JList and which can be later decorated to become a check list - * @author Eugene Ryzhikov - * @author Kevin Morin * * @param <T> list item type + * @author Eugene Ryzhikov + * @author Kevin Morin */ public class CheckList<T> { - private final JList list; - private static final MouseAdapter checkBoxEditor = new CheckListEditor(); - - /** - * Wraps the standard JList and makes it work like check list - */ - public CheckList() { + private final JList list; + private static final MouseAdapter checkBoxEditor = new CheckListEditor(); + + /** + * Wraps the standard JList and makes it work like check list + */ + public CheckList() { this.list = new JList(); - this.list.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION); - - if ( !isEditorAttached() ) list.addMouseListener(checkBoxEditor); - this.list.setCellRenderer(new CheckListRenderer()); - - setupKeyboardActions(list); - - } - - @SuppressWarnings("serial") - private void setupKeyboardActions(final JList list) { - String actionKey = "toggle-check"; - list.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,0), actionKey); - list.getActionMap().put(actionKey, new AbstractAction(){ - - @Override - public void actionPerformed(ActionEvent e) { - toggleIndex(list.getSelectedIndex()); - }}); - } - - private boolean isEditorAttached() { - - for( MouseListener ml: list.getMouseListeners() ) { - if ( ml instanceof CheckListEditor ) return true; - } - return false; - - } - - public JList getList() { - return list; - } - - /** - * Sets data to a check list. Simplification for setting new the model - * @param data - */ - public void setData( Collection<T> data ) { - setModel(new DefaultCheckListModel<>(data)); - } - - /** - * Sets the model for check list. - * @param model - */ - public void setModel( CheckListModel<T> model ) { - list.setModel(model); - } - - @SuppressWarnings("unchecked") - public CheckListModel<T> getModel() { - return (CheckListModel<T>) list.getModel(); - } - - /** - * Returns a collection of checked items. - * @return collection of checked items. Empty collection if nothing is selected - */ - public Collection<T> getCheckedItems() { - return getModel().getCheckedItems(); - } - - /** - * Resets checked elements - * @param elements - */ - public void setCheckedItems( Collection<T> elements ) { - getModel().setCheckedItems(elements); - } - - public void toggleIndex( int index ) { - if ( index >= 0 && index < list.getModel().getSize()) { - CheckListModel<T> model = getModel(); - model.setCheckedIndex(index, !model.isCheckedIndex(index)); - } - } - + this.list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + if (!isEditorAttached()) list.addMouseListener(checkBoxEditor); + this.list.setCellRenderer(new CheckListRenderer()); + + setupKeyboardActions(list); + + } + + @SuppressWarnings("serial") + private void setupKeyboardActions(final JList list) { + String actionKey = "toggle-check"; + list.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), actionKey); + list.getActionMap().put(actionKey, new AbstractAction() { + + @Override + public void actionPerformed(ActionEvent e) { + toggleIndex(list.getSelectedIndex()); + } + }); + } + + private boolean isEditorAttached() { + + for (MouseListener ml : list.getMouseListeners()) { + if (ml instanceof CheckListEditor) return true; + } + return false; + + } + + public JList getList() { + return list; + } + + /** + * Sets data to a check list. Simplification for setting new the model + * + * @param data + */ + public void setData(Collection<T> data) { + setModel(new DefaultCheckListModel<>(data)); + } + + /** + * Sets the model for check list. + * + * @param model + */ + public void setModel(CheckListModel<T> model) { + list.setModel(model); + } + + @SuppressWarnings("unchecked") + public CheckListModel<T> getModel() { + return (CheckListModel<T>) list.getModel(); + } + + /** + * Returns a collection of checked items. + * + * @return collection of checked items. Empty collection if nothing is selected + */ + public Collection<T> getCheckedItems() { + return getModel().getCheckedItems(); + } + + /** + * Resets checked elements + * + * @param elements + */ + public void setCheckedItems(Collection<T> elements) { + getModel().setCheckedItems(elements); + } + + public void toggleIndex(int index) { + if (index >= 0 && index < list.getModel().getSize()) { + CheckListModel<T> model = getModel(); + model.setCheckedIndex(index, !model.isCheckedIndex(index)); + } + } + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListAction.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListAction.java index d4a5391..1b4d75f 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListAction.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListAction.java @@ -30,29 +30,29 @@ import static org.nuiton.i18n.I18n.t; public interface CheckListAction<T> { - - void check( CheckListModel<T> model, boolean value ); - - class CheckAll<T> implements CheckListAction<T> { - - @Override - public String toString() { - return "(" + t("jaxx.list.check.all") + ")"; - } - - @SuppressWarnings("unchecked") - @Override - public void check(CheckListModel<T> model, boolean value) { - Collection<T> items = new ArrayList<>(); - if (value) { - for( int i=0, s=model.getSize(); i<s; i++ ) { - items.add((T) model.getElementAt(i)); - } - } - model.setCheckedItems( items ); - - } - - } - + + void check(CheckListModel<T> model, boolean value); + + class CheckAll<T> implements CheckListAction<T> { + + @Override + public String toString() { + return "(" + t("jaxx.list.check.all") + ")"; + } + + @SuppressWarnings("unchecked") + @Override + public void check(CheckListModel<T> model, boolean value) { + Collection<T> items = new ArrayList<>(); + if (value) { + for (int i = 0, s = model.getSize(); i < s; i++) { + items.add((T) model.getElementAt(i)); + } + } + model.setCheckedItems(items); + + } + + } + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListEditor.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListEditor.java index a58ec67..49fe931 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListEditor.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListEditor.java @@ -32,55 +32,55 @@ package org.nuiton.jaxx.runtime.swing.list; +import javax.swing.JList; +import javax.swing.SwingUtilities; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Arrays; - -import javax.swing.JList; -import javax.swing.SwingUtilities; +import java.util.Collections; /** - * Determines mouse click and + * Determines mouse click and * 1. Toggles the check on selected item if clicked once * 2. Clears checks and checks selected item if clicked more then once - * + * * Created on Feb 4, 2011 + * * @author Eugene Ryzhikov * @author Kevin Morin - * */ final class CheckListEditor extends MouseAdapter { - @Override - public void mouseClicked(MouseEvent e) { + @Override + public void mouseClicked(MouseEvent e) { + + if (!SwingUtilities.isLeftMouseButton(e)) return; - if (!SwingUtilities.isLeftMouseButton(e)) return; + JList list = (JList) e.getSource(); + if (!list.isEnabled() || (!(list.getModel() instanceof CheckListModel<?>))) return; - JList list = (JList) e.getSource(); - if ( !list.isEnabled() || (!(list.getModel() instanceof CheckListModel<?>))) return; + int index = list.locationToIndex(e.getPoint()); + if (index < 0) return; - int index = list.locationToIndex(e.getPoint()); - if (index < 0) return; + Rectangle bounds = list.getCellBounds(index, index); - Rectangle bounds = list.getCellBounds(index, index); + if (bounds.contains(e.getPoint())) { - if ( bounds.contains(e.getPoint()) ) { - - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") CheckListModel<Object> model = (CheckListModel<Object>) list.getModel(); - - if ( e.getClickCount() > 1 ) { - // clear all and check selected for more then 1 clicks - model.setCheckedItems( Arrays.asList( model.getElementAt(index))); - } else { - // simple toggle for 1 click - model.setCheckedIndex(index, !model.isCheckedIndex(index)); - } - e.consume(); - } - } - + if (e.getClickCount() > 1) { + // clear all and check selected for more then 1 clicks + model.setCheckedItems(Collections.singletonList(model.getElementAt(index))); + } else { + // simple toggle for 1 click + model.setCheckedIndex(index, !model.isCheckedIndex(index)); + } + e.consume(); + } + + } + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListModel.java index cace614..30baf4c 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListModel.java @@ -32,42 +32,46 @@ package org.nuiton.jaxx.runtime.swing.list; -import java.util.Collection; - import javax.swing.ListModel; +import java.util.Collection; public interface CheckListModel<T> extends ListModel { - /** - * Returns the check state of the element at specified position - * @param index element index - * @return true if element at specified position is checked - * @throws IndexOutOfBoundsException if index is out of range - */ - boolean isCheckedIndex(int index); + /** + * Returns the check state of the element at specified position + * + * @param index element index + * @return true if element at specified position is checked + * @throws IndexOutOfBoundsException if index is out of range + */ + boolean isCheckedIndex(int index); - /** - * Sets the check state of the element at specified position - * @param index element index - * @param value - * @throws IndexOutOfBoundsException if index is out of range - */ - void setCheckedIndex(int index, boolean value); + /** + * Sets the check state of the element at specified position + * + * @param index element index + * @param value + * @throws IndexOutOfBoundsException if index is out of range + */ + void setCheckedIndex(int index, boolean value); - /** - * Returns a collections of checked items - * @return - */ - Collection<T> getCheckedItems(); + /** + * Returns a collections of checked items + * + * @return + */ + Collection<T> getCheckedItems(); - /** - * Sets checked items - * @param items - */ - void setCheckedItems(Collection<T> items); + /** + * Sets checked items + * + * @param items + */ + void setCheckedItems(Collection<T> items); /** * Returns the number of items before the filter was applied + * * @return */ int getOriginalSize(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListRenderer.java index ee296d0..7f7b961 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/CheckListRenderer.java @@ -32,11 +32,6 @@ package org.nuiton.jaxx.runtime.swing.list; -import java.awt.Color; -import java.awt.Component; -import java.awt.Rectangle; -import java.io.Serializable; - import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.JCheckBox; @@ -45,185 +40,189 @@ import javax.swing.ListCellRenderer; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; +import java.awt.Color; +import java.awt.Component; +import java.awt.Rectangle; +import java.io.Serializable; public class CheckListRenderer extends JCheckBox implements ListCellRenderer, Serializable { - private static final long serialVersionUID = 1L; - - private static final Border NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); - private static final Border SAFE_NO_FOCUS_BORDER = NO_FOCUS_BORDER; // may change in the feature - - /** - * Constructs a default renderer object for an item in a list. - */ - public CheckListRenderer() { - super(); - setOpaque(true); - setBorder(getNoFocusBorder()); - } - - private static Border getNoFocusBorder() { - if (System.getSecurityManager() != null) { - return SAFE_NO_FOCUS_BORDER; - } else { - return NO_FOCUS_BORDER; - } - } - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, - boolean cellHasFocus) { - - setComponentOrientation(list.getComponentOrientation()); - - Color bg = null; - Color fg = null; - - JList.DropLocation dropLocation = list.getDropLocation(); - if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) { - - bg = UIManager.getColor("List.dropCellBackground"); - fg = UIManager.getColor("List.dropCellForeground"); - - isSelected = true; - } - - if (isSelected) { - setBackground(bg == null ? list.getSelectionBackground() : bg); - setForeground(fg == null ? list.getSelectionForeground() : fg); - } else { - setBackground(list.getBackground()); - setForeground(list.getForeground()); - } - - if (value instanceof Icon) { - setIcon((Icon) value); - setText(""); - } else { - setIcon(null); - setText(getObjectAsText(value)); - } - - setSelected( isChecked(list, index)); - - setEnabled(list.isEnabled()); - setFont(list.getFont()); - - Border border = null; - if (cellHasFocus) { - if (isSelected) { - border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); - } - if (border == null) { - border = UIManager.getBorder("List.focusCellHighlightBorder"); - } - } else { - border = getNoFocusBorder(); - } - setBorder(border); - - return this; - } - - protected String getObjectAsText(Object obj) { - return (obj == null) ? "" : obj.toString(); - } - - private boolean isChecked(JList list, int index) { - - if (list.getModel() instanceof CheckListModel<?>) { - return ((CheckListModel<?>) list.getModel()).isCheckedIndex(index); - } else { - return false; - } - - } - - /** - * @return true if the background is opaque and differs from the JList's background; false otherwise - */ - @Override - public boolean isOpaque() { - Color back = getBackground(); - Component p = getParent(); - if (p != null) { - p = p.getParent(); - } - // p should now be the JList. - boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque(); - return !colorMatch && super.isOpaque(); - } - - @Override - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - - if ("text".equals(propertyName) || - (("font".equals(propertyName) || "foreground".equals(propertyName)) && - oldValue != newValue && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) { - - super.firePropertyChange(propertyName, oldValue, newValue); - } - } - - // Methods below are overridden for performance reasons. - - @Override - public void validate() { - } - - @Override - public void invalidate() { - } - - @Override - public void repaint() { - } - - @Override - public void revalidate() { - } - - @Override - public void repaint(long tm, int x, int y, int width, int height) { - } - - @Override - public void repaint(Rectangle r) { - } - - @Override - public void firePropertyChange(String propertyName, byte oldValue, byte newValue) { - } - - @Override - public void firePropertyChange(String propertyName, char oldValue, char newValue) { - } - - @Override - public void firePropertyChange(String propertyName, short oldValue, short newValue) { - } - - @Override - public void firePropertyChange(String propertyName, int oldValue, int newValue) { - } - - @Override - public void firePropertyChange(String propertyName, long oldValue, long newValue) { - } - - @Override - public void firePropertyChange(String propertyName, float oldValue, float newValue) { - } - - @Override - public void firePropertyChange(String propertyName, double oldValue, double newValue) { - } - - @Override - public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { - } - - @SuppressWarnings("serial") - public static class UIResource extends DefaultListCellRenderer implements javax.swing.plaf.UIResource { - } + private static final long serialVersionUID = 1L; + + private static final Border NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); + private static final Border SAFE_NO_FOCUS_BORDER = NO_FOCUS_BORDER; // may change in the feature + + /** + * Constructs a default renderer object for an item in a list. + */ + public CheckListRenderer() { + super(); + setOpaque(true); + setBorder(getNoFocusBorder()); + } + + private static Border getNoFocusBorder() { + if (System.getSecurityManager() != null) { + return SAFE_NO_FOCUS_BORDER; + } else { + return NO_FOCUS_BORDER; + } + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + + setComponentOrientation(list.getComponentOrientation()); + + Color bg = null; + Color fg = null; + + JList.DropLocation dropLocation = list.getDropLocation(); + if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) { + + bg = UIManager.getColor("List.dropCellBackground"); + fg = UIManager.getColor("List.dropCellForeground"); + + isSelected = true; + } + + if (isSelected) { + setBackground(bg == null ? list.getSelectionBackground() : bg); + setForeground(fg == null ? list.getSelectionForeground() : fg); + } else { + setBackground(list.getBackground()); + setForeground(list.getForeground()); + } + + if (value instanceof Icon) { + setIcon((Icon) value); + setText(""); + } else { + setIcon(null); + setText(getObjectAsText(value)); + } + + setSelected(isChecked(list, index)); + + setEnabled(list.isEnabled()); + setFont(list.getFont()); + + Border border = null; + if (cellHasFocus) { + if (isSelected) { + border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); + } + if (border == null) { + border = UIManager.getBorder("List.focusCellHighlightBorder"); + } + } else { + border = getNoFocusBorder(); + } + setBorder(border); + + return this; + } + + protected String getObjectAsText(Object obj) { + return (obj == null) ? "" : obj.toString(); + } + + private boolean isChecked(JList list, int index) { + + if (list.getModel() instanceof CheckListModel<?>) { + return ((CheckListModel<?>) list.getModel()).isCheckedIndex(index); + } else { + return false; + } + + } + + /** + * @return true if the background is opaque and differs from the JList's background; false otherwise + */ + @Override + public boolean isOpaque() { + Color back = getBackground(); + Component p = getParent(); + if (p != null) { + p = p.getParent(); + } + // p should now be the JList. + boolean colorMatch = (back != null) && (p != null) && back.equals(p.getBackground()) && p.isOpaque(); + return !colorMatch && super.isOpaque(); + } + + @Override + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + + if ("text".equals(propertyName) || + (("font".equals(propertyName) || "foreground".equals(propertyName)) && + oldValue != newValue && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) { + + super.firePropertyChange(propertyName, oldValue, newValue); + } + } + + // Methods below are overridden for performance reasons. + + @Override + public void validate() { + } + + @Override + public void invalidate() { + } + + @Override + public void repaint() { + } + + @Override + public void revalidate() { + } + + @Override + public void repaint(long tm, int x, int y, int width, int height) { + } + + @Override + public void repaint(Rectangle r) { + } + + @Override + public void firePropertyChange(String propertyName, byte oldValue, byte newValue) { + } + + @Override + public void firePropertyChange(String propertyName, char oldValue, char newValue) { + } + + @Override + public void firePropertyChange(String propertyName, short oldValue, short newValue) { + } + + @Override + public void firePropertyChange(String propertyName, int oldValue, int newValue) { + } + + @Override + public void firePropertyChange(String propertyName, long oldValue, long newValue) { + } + + @Override + public void firePropertyChange(String propertyName, float oldValue, float newValue) { + } + + @Override + public void firePropertyChange(String propertyName, double oldValue, double newValue) { + } + + @Override + public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { + } + + @SuppressWarnings("serial") + public static class UIResource extends DefaultListCellRenderer implements javax.swing.plaf.UIResource { + } } \ No newline at end of file diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/DefaultCheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/DefaultCheckListModel.java index 9eb57b0..0fb30f2 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/DefaultCheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/DefaultCheckListModel.java @@ -32,6 +32,7 @@ package org.nuiton.jaxx.runtime.swing.list; +import javax.swing.AbstractListModel; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -40,103 +41,101 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import javax.swing.AbstractListModel; - /** * Default model for check list. It is based on the list of items * Implementation of checks is based on HashSet of checked items * + * @param <T> list element type * @author Eugene Ryzhikov * @author Kevin Morin - * - * @param <T> list element type */ public class DefaultCheckListModel<T> extends AbstractListModel implements CheckListModel<T> { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - protected final List<T> data = new ArrayList<>(); + protected final List<T> data = new ArrayList<>(); protected final Set<T> checks = new HashSet<>(); - public DefaultCheckListModel( Collection<? extends T> data ) { + public DefaultCheckListModel(Collection<? extends T> data) { - if ( data == null ) return; - for (T object : data) { - this.data.add( object ); - checks.clear(); - } - } + if (data == null) return; + for (T object : data) { + this.data.add(object); + checks.clear(); + } + } - public DefaultCheckListModel( T... data ) { - this( Arrays.asList( data )); - } + public DefaultCheckListModel(T... data) { + this(Arrays.asList(data)); + } - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#getSize() - */ - @Override - public int getSize() { + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#getSize() + */ + @Override + public int getSize() { return data().size(); } @Override public int getOriginalSize() { - return data.size(); - } - - protected List<T> data() { - return data; - } - - - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#getElementAt(int) - */ - @Override - public Object getElementAt(int index) { - return data().get(index); - } - - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#isChecked(int) - */ - @Override - public boolean isCheckedIndex( int index ) { - return checks.contains( data().get(index)); - } - - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(int, boolean) - */ - @Override - public void setCheckedIndex( int index, boolean value ) { - T o = data().get(index); - if ( value ) checks.add(o); else checks.remove(o); - fireContentsChanged(this, index, index); - } - - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#getChecked() - */ - @Override - public Collection<T> getCheckedItems() { - List<T> items = new ArrayList<>(checks); - items.retainAll(data); - return Collections.unmodifiableList( items ); - } - - /* (non-Javadoc) - * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(java.util.Collection) - */ - @Override - public void setCheckedItems( Collection<T> items ) { - - List<T> correctedItems = new ArrayList<>(items); - correctedItems.retainAll(data); - - checks.clear(); - checks.addAll( correctedItems ); - fireContentsChanged(this, 0, checks.size()-1); - } + return data.size(); + } + + protected List<T> data() { + return data; + } + + + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#getElementAt(int) + */ + @Override + public Object getElementAt(int index) { + return data().get(index); + } + + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#isChecked(int) + */ + @Override + public boolean isCheckedIndex(int index) { + return checks.contains(data().get(index)); + } + + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(int, boolean) + */ + @Override + public void setCheckedIndex(int index, boolean value) { + T o = data().get(index); + if (value) checks.add(o); + else checks.remove(o); + fireContentsChanged(this, index, index); + } + + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#getChecked() + */ + @Override + public Collection<T> getCheckedItems() { + List<T> items = new ArrayList<>(checks); + items.retainAll(data); + return Collections.unmodifiableList(items); + } + + /* (non-Javadoc) + * @see org.oxbow.swingbits.list.ICheckListModel#setChecked(java.util.Collection) + */ + @Override + public void setCheckedItems(Collection<T> items) { + + List<T> correctedItems = new ArrayList<>(items); + correctedItems.retainAll(data); + + checks.clear(); + checks.addAll(correctedItems); + fireContentsChanged(this, 0, checks.size() - 1); + } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/CheckListFilterType.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/CheckListFilterType.java index 0374a54..2fb35ea 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/CheckListFilterType.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/CheckListFilterType.java @@ -25,30 +25,28 @@ package org.nuiton.jaxx.runtime.swing.list.filter; public enum CheckListFilterType { - STARTS_WITH { - - @Override - public boolean include( String element, String filter ) { - - if ( element == null || filter == null ) return false; - return element.startsWith(filter); - - } - - }, - - CONTAINS { - - @Override - public boolean include( String element, String filter ) { - - if ( element == null || filter == null ) return false; - return element.toLowerCase().contains(filter.toLowerCase()); - - } - - }; - - public abstract boolean include( String element, String filter ); - + STARTS_WITH { + @Override + public boolean include(String element, String filter) { + + if (element == null || filter == null) return false; + return element.startsWith(filter); + + } + + }, + + CONTAINS { + @Override + public boolean include(String element, String filter) { + + if (element == null || filter == null) return false; + return element.toLowerCase().contains(filter.toLowerCase()); + + } + + }; + + public abstract boolean include(String element, String filter); + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/DefaultFilterableCheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/DefaultFilterableCheckListModel.java index 2f77d52..fd6fa91 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/DefaultFilterableCheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/DefaultFilterableCheckListModel.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.runtime.swing.list.filter; * #L% */ +import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.swing.list.DefaultCheckListModel; -import org.nuiton.decorator.Decorator; import java.util.ArrayList; import java.util.Arrays; @@ -48,37 +48,37 @@ public class DefaultFilterableCheckListModel<T> extends DefaultCheckListModel<T> } protected List<T> data() { - return filteredData == null ? data: filteredData; + return filteredData == null ? data : filteredData; } @Override public void filter(String filter, Decorator<Object> decorator, CheckListFilterType filterType) { - if ( filter == null || filter.trim().length() == 0 ) { + if (filter == null || filter.trim().length() == 0) { filteredData = null; } else { - CheckListFilterType ft = filterType == null? CheckListFilterType.CONTAINS: filterType; + CheckListFilterType ft = filterType == null ? CheckListFilterType.CONTAINS : filterType; String f = filter.toLowerCase(); List<T> fData = new ArrayList<>(); - for( T o: data ) { + for (T o : data) { String decorated; if (o != null && decorator != null) { decorated = decorator.toString(o); } else { decorated = JAXXUtil.getStringValue(o); } - if ( ft.include(decorated, f)) { + if (ft.include(decorated, f)) { fData.add(o); } } filteredData = fData; } - fireContentsChanged( this, 0, data.size()-1); + fireContentsChanged(this, 0, data.size() - 1); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableActionCheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableActionCheckListModel.java index 4dfd6d5..d9be0fa 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableActionCheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableActionCheckListModel.java @@ -32,14 +32,14 @@ package org.nuiton.jaxx.runtime.swing.list.filter; -import org.nuiton.jaxx.runtime.swing.list.ActionCheckListModel; import org.nuiton.decorator.Decorator; +import org.nuiton.jaxx.runtime.swing.list.ActionCheckListModel; public class FilterableActionCheckListModel<T> extends ActionCheckListModel<T> implements FilterableCheckListModel<T> { - public FilterableActionCheckListModel(final DefaultFilterableCheckListModel<T> originalModel) { - super(originalModel); - } + public FilterableActionCheckListModel(final DefaultFilterableCheckListModel<T> originalModel) { + super(originalModel); + } @Override public void filter(String filter, Decorator<Object> decorator, CheckListFilterType filterType) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckList.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckList.java index ad45db0..5d7a87b 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckList.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckList.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.runtime.swing.list.filter; * #L% */ +import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.runtime.swing.list.CheckList; import org.nuiton.jaxx.runtime.swing.list.CheckListModel; -import org.nuiton.decorator.Decorator; /** * @author Kevin Morin (Code Lutin) @@ -34,9 +34,10 @@ public class FilterableCheckList<T> extends CheckList<T> { /** * Sets the model for check list. + * * @param model */ - public void setModel( CheckListModel<T> model ) { + public void setModel(CheckListModel<T> model) { getList().setModel(model); } @@ -47,9 +48,10 @@ public class FilterableCheckList<T> extends CheckList<T> { /** * Filters list view without losing actual data + * * @param filter */ - public void filter( String filter, Decorator<Object> decorator, CheckListFilterType filterType ) { + public void filter(String filter, Decorator<Object> decorator, CheckListFilterType filterType) { getModel().filter(filter, decorator, filterType); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckListModel.java index 9d325a7..5782213 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/list/filter/FilterableCheckListModel.java @@ -22,8 +22,8 @@ package org.nuiton.jaxx.runtime.swing.list.filter; * #L% */ -import org.nuiton.jaxx.runtime.swing.list.CheckListModel; import org.nuiton.decorator.Decorator; +import org.nuiton.jaxx.runtime.swing.list.CheckListModel; /** * @author Kevin Morin (Code Lutin) @@ -33,8 +33,9 @@ public interface FilterableCheckListModel<T> extends CheckListModel<T> { /** * Filters list view without losing actual data + * * @param filter */ - void filter( String filter, Decorator<Object> decorator, CheckListFilterType filterType ); + void filter(String filter, Decorator<Object> decorator, CheckListFilterType filterType); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/AbstractGenericListSelectionModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/AbstractGenericListSelectionModel.java index bfd1ffc..bb929a4 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/AbstractGenericListSelectionModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/AbstractGenericListSelectionModel.java @@ -22,12 +22,13 @@ package org.nuiton.jaxx.runtime.swing.model; import com.google.common.collect.Lists; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.event.EventListenerList; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.Collection; import java.util.List; -import javax.swing.DefaultListSelectionModel; -import javax.swing.event.EventListenerList; /** * @author Sylvain Lletellier @@ -133,7 +134,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe index1 = index0; index0 = tmp; } - for (int i=index0;i<=index1;i++) { + for (int i = index0; i <= index1; i++) { if (selectedValues.size() > i && i != -1) { selectedValues.remove(i); } @@ -147,7 +148,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe index1 = index0; index0 = tmp; } - for (int i=index0;i<=index1;i++) { + for (int i = index0; i <= index1; i++) { if (getSize() > i && i != -1) { B value = getValueAt(i); @@ -187,7 +188,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe if (e == null) { e = new GenericListEvent<>(this, values); } - ((GenericListListener)listeners[i+1]).valuesAdded(e); + ((GenericListListener) listeners[i + 1]).valuesAdded(e); } } } @@ -204,7 +205,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe if (e == null) { e = new GenericListEvent<>(this, values); } - ((GenericListListener)listeners[i+1]).valuesRemoved(e); + ((GenericListListener) listeners[i + 1]).valuesRemoved(e); } } } @@ -221,7 +222,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe if (e == null) { e = new GenericListEvent<>(this, selectedValues); } - ((GenericListListener)listeners[i+1]).selectionAdded(e); + ((GenericListListener) listeners[i + 1]).selectionAdded(e); } } } @@ -238,7 +239,7 @@ public abstract class AbstractGenericListSelectionModel<B> extends DefaultListSe if (e == null) { e = new GenericListEvent<>(this, selectedValues); } - ((GenericListListener)listeners[i+1]).selectionAdded(e); + ((GenericListListener) listeners[i + 1]).selectionAdded(e); } } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListModel.java index 11441d0..736bf83 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListModel.java @@ -22,12 +22,13 @@ package org.nuiton.jaxx.runtime.swing.model; import com.google.common.collect.Lists; -import java.util.Collection; -import java.util.List; + import javax.swing.ComboBoxModel; import javax.swing.DefaultListModel; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; +import java.util.Collection; +import java.util.List; /** * @author Sylvain Lletellier @@ -69,7 +70,7 @@ public class GenericListModel<B> extends GenericListSelectionModel<B> implements public Collection<B> getElements() { int size = getListModel().getSize(); Collection<B> result = Lists.newArrayList(); - for (int i=0;i<size;i++) { + for (int i = 0; i < size; i++) { result.add((B) getListModel().get(i)); } return result; @@ -155,7 +156,7 @@ public class GenericListModel<B> extends GenericListSelectionModel<B> implements if (e == null) { e = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED, index0, index1); } - ((ListDataListener)listeners[i+1]).contentsChanged(e); + ((ListDataListener) listeners[i + 1]).contentsChanged(e); } } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListSelectionModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListSelectionModel.java index 70f6b9e..8744164 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListSelectionModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/GenericListSelectionModel.java @@ -46,6 +46,6 @@ public class GenericListSelectionModel<B> extends AbstractGenericListSelectionMo @Override public B getValueAt(int i) { - return (B)listModel.getElementAt(i); + return (B) listModel.getElementAt(i); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultComboBoxModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultComboBoxModel.java index 4bfbb32..25ca3cb 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultComboBoxModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultComboBoxModel.java @@ -77,7 +77,7 @@ public class JaxxDefaultComboBoxModel<E> extends AbstractListModel implements Mu @Override public void setSelectedItem(Object anObject) { if ((selectedObject != null && !selectedObject.equals(anObject)) || - selectedObject == null && anObject != null) { + selectedObject == null && anObject != null) { try { fireSelectedItemWillChanged(selectedObject, anObject); @@ -210,9 +210,9 @@ public class JaxxDefaultComboBoxModel<E> extends AbstractListModel implements Mu if (listeners[i] == WillChangeSelectedItemListener.class) { // Lazily create the event: if (e == null) - e = new ComboBoxSelectionEvent(this, (Serializable)currentSelectedItem, (Serializable) newSelectedItem); + e = new ComboBoxSelectionEvent(this, (Serializable) currentSelectedItem, (Serializable) newSelectedItem); ((WillChangeSelectedItemListener) listeners[i + 1]). - selectedItemWillChanged(e); + selectedItemWillChanged(e); } } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultListModel.java index ceb7ad6..2814d83 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxDefaultListModel.java @@ -38,7 +38,7 @@ import java.util.Vector; * @author Tony Chemit - dev@tchemit.fr * @since 2.5.10 */ -public class JaxxDefaultListModel<E> extends AbstractListModel { +public class JaxxDefaultListModel<E> extends AbstractListModel<E> { private static final long serialVersionUID = 1L; @@ -445,8 +445,8 @@ public class JaxxDefaultListModel<E> extends AbstractListModel { * @return an array containing the elements of the list * @see Vector#toArray() */ - public Object[] toArray() { - return delegate.toArray(); + public E[] toArray() { + return (E[]) delegate.toArray(); } /** diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableComboBoxModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableComboBoxModel.java index b0cdfe3..113a731 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableComboBoxModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableComboBoxModel.java @@ -22,7 +22,7 @@ package org.nuiton.jaxx.runtime.swing.model; * #L% */ -import com.google.common.base.Predicate; +import java.util.function.Predicate; import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -189,14 +189,14 @@ public class JaxxFilterableComboBoxModel<E> extends JaxxDefaultComboBoxModel<E> filteredItems.clear(); if ((StringUtils.isEmpty(filterText) - || wildcardCharacter != null && StringUtils.isEmpty(StringUtils.remove(filterText, wildcardCharacter))) + || wildcardCharacter != null && StringUtils.isEmpty(StringUtils.remove(filterText, wildcardCharacter))) && filters.isEmpty()) { filteredItems.addAll(delegate); } else { Pattern pattern = null; if (!StringUtils.isBlank(filterText)) { - String patternText= Pattern.quote(filterText); + String patternText = Pattern.quote(filterText); if (wildcardCharacter == null) { patternText = ".*" + patternText; @@ -219,7 +219,7 @@ public class JaxxFilterableComboBoxModel<E> extends JaxxDefaultComboBoxModel<E> decoratedElement = String.valueOf(element); } boolean matches = pattern == null - || pattern.matcher(decoratedElement).matches(); + || pattern.matcher(decoratedElement).matches(); if (matches && addElement) { filteredItems.add(element); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableListModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableListModel.java index a1ee2ca..20df26d 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableListModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/model/JaxxFilterableListModel.java @@ -22,14 +22,15 @@ package org.nuiton.jaxx.runtime.swing.model; * #L% */ -import com.google.common.base.Predicate; import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.decorator.JXPathDecorator; + import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.function.Predicate; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.decorator.JXPathDecorator; /** * List model for filterable lists. @@ -228,17 +229,15 @@ public class JaxxFilterableListModel<E> extends JaxxDefaultListModel<E> { filteredItems.addAll(delegate); } else { - int itemNumber = delegate.size(); Pattern pattern = null; if (!StringUtils.isBlank(filterText)) { String patternText = Pattern.quote(filterText).replace("*", "\\E.*\\Q") + ".*"; pattern = Pattern.compile(patternText, Pattern.CASE_INSENSITIVE); } - for (int i = 0 ; i < itemNumber ; i++) { - E element = delegate.get(i); + for (E element : delegate) { boolean addElement = true; for (Predicate<E> filter : filters) { - addElement &= filter.apply(element); + addElement &= filter.test(element); } String decoratedElement; if (decorator != null) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavDataProvider.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavDataProvider.java index f357c65..7038925 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavDataProvider.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavDataProvider.java @@ -36,7 +36,7 @@ public interface NavDataProvider { /** * @return {@code true} is provider is enabled and can provide datas, - * {@code false} otherwise. + * {@code false} otherwise. */ boolean isEnabled(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavHelper.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavHelper.java index a0e854b..c38f69f 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavHelper.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavHelper.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.nav; -import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeModelEvent; @@ -167,7 +167,7 @@ public abstract class NavHelper<M, U, B extends NavBridge<M, N>, N extends NavNo * registred tree. * * @return the renderer of the registred tree or null if no tree was - * registred nor the renderer is a {@link AbstractNavTreeCellRenderer}. + * registred nor the renderer is a {@link AbstractNavTreeCellRenderer}. */ public abstract AbstractNavTreeCellRenderer<M, N> getTreeCellRenderer(); @@ -175,7 +175,7 @@ public abstract class NavHelper<M, U, B extends NavBridge<M, N>, N extends NavNo * Obtains the selected node of the registred tree. * * @return the selected tree or {@code null} if no registred tree nor - * selection empty. + * selection empty. */ public abstract N getSelectedNode(); @@ -183,7 +183,7 @@ public abstract class NavHelper<M, U, B extends NavBridge<M, N>, N extends NavNo * Obtains the selected nodes of the registred tree. * * @return the selected tree or {@code null} if no registred tree nor - * selection empty. + * selection empty. */ public abstract List<N> getSelectedNodes(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNode.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNode.java index 1591200..b9e3978 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNode.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNode.java @@ -111,7 +111,7 @@ public interface NavNode<M, N extends NavNode<M, N>> extends Cloneable, TreeNode * A {@code static} node has no {@code childLoador}. * * @return {@code true} when the node is static : says, the node has - * no {@code childLoador}. + * no {@code childLoador}. */ boolean isStaticNode(); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNodeChildLoador.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNodeChildLoador.java index 7e0bb4a..576e5e8 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNodeChildLoador.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/NavNodeChildLoador.java @@ -122,7 +122,7 @@ public abstract class NavNodeChildLoador<T, O, M, B extends NavBridge<M, N>, N e } else { if (log.isDebugEnabled()) { log.debug("search data for " + containerNode.getInternalClass() + - " : " + containerNode.getId()); + " : " + containerNode.getId()); } // recuperation des objets fils diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/AbstractNavTreeCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/AbstractNavTreeCellRenderer.java index d33c46d..76618a8 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/AbstractNavTreeCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/AbstractNavTreeCellRenderer.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.runtime.swing.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.NavNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.NavNode; import javax.swing.tree.DefaultTreeCellRenderer; import java.util.HashMap; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeBridge.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeBridge.java index 259921a..28857c5 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeBridge.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeBridge.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.nav.tree; -import org.nuiton.jaxx.runtime.swing.nav.NavBridge; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.nav.NavBridge; import javax.swing.event.TreeModelListener; import javax.swing.tree.DefaultTreeModel; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeNode.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeNode.java index 8d57c63..1cbc08e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeNode.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/tree/NavTreeNode.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.runtime.swing.nav.tree; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.swing.nav.NavBridge; import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; import org.nuiton.jaxx.runtime.swing.nav.NavNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableBridge.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableBridge.java index 5274dd0..6a22744 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableBridge.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableBridge.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.runtime.swing.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavBridge; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.treetable.TreeTableNode; +import org.nuiton.jaxx.runtime.swing.nav.NavBridge; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeNode; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableHelper.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableHelper.java index 9c161b9..e6c5e2e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableHelper.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableHelper.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.runtime.swing.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavHelper; -import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTreeTable; +import org.nuiton.jaxx.runtime.swing.nav.NavHelper; +import org.nuiton.jaxx.runtime.swing.nav.tree.AbstractNavTreeCellRenderer; import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeWillExpandListener; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableNode.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableNode.java index 62ffd04..2e42104 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableNode.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/nav/treetable/NavTreeTableNode.java @@ -21,14 +21,14 @@ */ package org.nuiton.jaxx.runtime.swing.nav.treetable; -import org.nuiton.jaxx.runtime.swing.nav.NavBridge; -import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; -import org.nuiton.jaxx.runtime.swing.nav.NavNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.MutableTreeTableNode; +import org.nuiton.jaxx.runtime.swing.nav.NavBridge; +import org.nuiton.jaxx.runtime.swing.nav.NavDataProvider; +import org.nuiton.jaxx.runtime.swing.nav.NavNode; import java.util.ArrayList; import java.util.Collections; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/BooleanCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/BooleanCellRenderer.java index 3b948b0..ef30fb4 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/BooleanCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/BooleanCellRenderer.java @@ -21,7 +21,7 @@ */ package org.nuiton.jaxx.runtime.swing.renderer; -import com.google.common.base.Predicate; +import java.util.function.Predicate; import javax.swing.Icon; import javax.swing.JCheckBox; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java index 9933467..885206e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java @@ -68,7 +68,7 @@ public class DecoratorListCellRenderer implements ListCellRenderer { ); } - protected Object decorateValue(Object value,int index) { + protected Object decorateValue(Object value, int index) { if (value == null) { value = " "; } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java index 8cd4433..c48f631 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java @@ -23,11 +23,11 @@ package org.nuiton.jaxx.runtime.swing.renderer; import org.nuiton.decorator.Decorator; +import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import java.awt.Component; -import javax.swing.JComponent; /** * A {@link TableCellRenderer} which compute text with the given {@link #decorator} diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/FilteredDecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/FilteredDecoratorListCellRenderer.java index 9d21ae1..cf12490 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/FilteredDecoratorListCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/FilteredDecoratorListCellRenderer.java @@ -21,13 +21,14 @@ */ package org.nuiton.jaxx.runtime.swing.renderer; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.decorator.Decorator; + +import javax.swing.JList; +import javax.swing.ListCellRenderer; import java.awt.Component; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.swing.JList; -import javax.swing.ListCellRenderer; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.decorator.Decorator; /** * A {@link ListCellRenderer} which compute text with the given {@link #decorator}, @@ -41,23 +42,23 @@ public class FilteredDecoratorListCellRenderer extends DecoratorListCellRenderer /** text to highlight */ protected String filterText; - + protected Pattern pattern; - + protected boolean highlightFilterText = false; - + public FilteredDecoratorListCellRenderer(Decorator<?> decorator) { super(decorator); } public FilteredDecoratorListCellRenderer(ListCellRenderer delegate, - Decorator<?> decorator) { + Decorator<?> decorator) { super(delegate, decorator); } - + public FilteredDecoratorListCellRenderer(ListCellRenderer delegate, - Decorator<?> decorator, - boolean highlightFilterText) { + Decorator<?> decorator, + boolean highlightFilterText) { super(delegate, decorator); this.highlightFilterText = highlightFilterText; } @@ -79,14 +80,14 @@ public class FilteredDecoratorListCellRenderer extends DecoratorListCellRenderer this.highlightFilterText = highlightFilterText; computePattern(); } - + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - + if (!(value instanceof String) && decorator != null) { value = decorator.toString(value); } @@ -99,13 +100,13 @@ public class FilteredDecoratorListCellRenderer extends DecoratorListCellRenderer // and the current group and surround the group with the highlighter StringBuilder sb = new StringBuilder(); int i = 0; - for (int g = 1 ; g <= matcher.groupCount() ; g++) { + for (int g = 1; g <= matcher.groupCount(); g++) { String match = matcher.group(g); int indexOfMatch = stringValue.indexOf(match, i); sb.append(stringValue.substring(i, indexOfMatch)) - .append("<span style='background:#FFFF00'>") - .append(match) - .append("</span>"); + .append("<span style='background:#FFFF00'>") + .append(match) + .append("</span>"); i = indexOfMatch + match.length(); } sb.append(stringValue.substring(i)); @@ -121,13 +122,13 @@ public class FilteredDecoratorListCellRenderer extends DecoratorListCellRenderer } protected void computePattern() { - if (highlightFilterText + if (highlightFilterText && !StringUtils.isEmpty(StringUtils.remove(filterText, '*'))) { // add the groups in the pattern String patternText = "(" + filterText.replace("*", ").*(") + ").*"; patternText = StringUtils.remove(patternText, "()"); pattern = Pattern.compile(patternText, Pattern.CASE_INSENSITIVE); - + } else { pattern = null; } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java index 0564df9..bd9a1e6 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java @@ -52,12 +52,12 @@ public class I18nTableCellRenderer implements TableCellRenderer { if (keysAndTips.length == 0) { throw new IllegalArgumentException( "can not have empty keysAndTips parameters (means no " + - "column ?)"); + "column ?)"); } if (keysAndTips.length % 2 == 1) { throw new IllegalArgumentException( "must have some couple (text,tooltTipText), but had an" + - " even number of data in keysAndTips parameter"); + " even number of data in keysAndTips parameter"); } int size = keysAndTips.length / 2; keys = new String[size]; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java index 4c33096..f12150d 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.renderer; -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java index 542de87..dcc2581 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java @@ -64,7 +64,7 @@ public class MultiDecoratorTableCelleRenderer implements TableCellRenderer { if (types.contains(d.getType())) { throw new IllegalArgumentException( "can not have twice a decorator of type " + - d.getType()); + d.getType()); } types.add(d.getType()); tmp.add(d); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JSplitPaneState.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JSplitPaneState.java index cb4b7a8..5771538 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JSplitPaneState.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JSplitPaneState.java @@ -22,7 +22,7 @@ package org.nuiton.jaxx.runtime.swing.session; * #L% */ -import javax.swing.*; +import javax.swing.JSplitPane; /** * State for JSplit @@ -34,7 +34,7 @@ import javax.swing.*; */ public class JSplitPaneState implements State { - protected int dividerLocation = -1; + protected int dividerLocation = -1; protected int orientation = JSplitPane.HORIZONTAL_SPLIT; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTabbedPaneState.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTabbedPaneState.java index de2cc5e..374164e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTabbedPaneState.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTabbedPaneState.java @@ -22,7 +22,7 @@ package org.nuiton.jaxx.runtime.swing.session; * #L% */ -import javax.swing.*; +import javax.swing.JTabbedPane; /** * State for the JTabbedPane diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTableState.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTableState.java index 3ee4aa7..db09ab0 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTableState.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/JTableState.java @@ -25,7 +25,9 @@ package org.nuiton.jaxx.runtime.swing.session; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.*; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.SortOrder; import javax.swing.table.TableColumn; import java.util.ArrayList; import java.util.HashMap; @@ -39,7 +41,6 @@ import java.util.Map; * @author poussin * @author Kevin Morin - morin@codelutin.com * @since 2.5.16 - * */ public class JTableState implements State { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/SwingSession.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/SwingSession.java index d13144e..4c918b8 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/SwingSession.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/SwingSession.java @@ -157,7 +157,7 @@ public class SwingSession { } else { - states =Maps.newHashMap(); + states = Maps.newHashMap(); } @@ -175,6 +175,7 @@ public class SwingSession { * Loads safely the states from the {@link #file}. * * If could not read the internal file, then will try to delete it. + * * @since 2.10 */ public void loadSafeStates() { @@ -346,10 +347,10 @@ public class SwingSession { final String cName = getComponentName(c); Object existingComponent = CollectionUtils.find(registeredComponent, o -> { - Component comp = (Component) o; + Component comp = o; String compName = getComponentName(comp); return c.getClass().equals(comp.getClass()) - && cName.equals(compName); + && cName.equals(compName); }); if (existingComponent != null) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/WindowState.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/WindowState.java index 854bfdd..8f92f1f 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/WindowState.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/session/WindowState.java @@ -22,8 +22,14 @@ package org.nuiton.jaxx.runtime.swing.session; * #L% */ -import javax.swing.*; -import java.awt.*; +import javax.swing.JFrame; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.Window; /** * State for Window @@ -86,6 +92,7 @@ public class WindowState implements State { /** * Checks whether the window supports resizing + * * @param window the {@code Window} to be checked * @return true if the window supports resizing */ @@ -101,6 +108,7 @@ public class WindowState implements State { /** * Gets {@code Window} bounds from the client property + * * @param window the source {@code Window} * @return bounds from the client property */ @@ -119,6 +127,7 @@ public class WindowState implements State { /** * Calculates virtual graphic bounds. * On multiscreen systems all screens are united into one virtual screen. + * * @return the graphic bounds */ public static Rectangle computeVirtualGraphicsBounds() { @@ -134,6 +143,7 @@ public class WindowState implements State { /** * Puts {@code Window} bounds to client property. + * * @param window the target {@code Window} * @param bounds bounds */ diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/AbstractTableFilter.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/AbstractTableFilter.java index e030122..d8d23b0 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/AbstractTableFilter.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/AbstractTableFilter.java @@ -35,8 +35,8 @@ package org.nuiton.jaxx.runtime.swing.table.filter; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ComparatorUtils; import org.apache.commons.collections4.Transformer; -import org.apache.commons.lang3.ObjectUtils; +import javax.swing.JTable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -44,72 +44,71 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; -import javax.swing.JTable; - /** * Partial implementation of table filter * * Created on Feb 10, 2011 - * @author Eugene Ryzhikov - * @author Kevin Morin * * @param <T> + * @author Eugene Ryzhikov + * @author Kevin Morin */ @SuppressWarnings("serial") public abstract class AbstractTableFilter<T extends JTable> implements TableFilter<T> { - private final Set<FilterChangeListener> listeners = Collections.synchronizedSet( new HashSet<FilterChangeListener>()); + private final Set<FilterChangeListener> listeners = Collections.synchronizedSet(new HashSet<FilterChangeListener>()); - private final T table; - private final TableFilterState filterState = new TableFilterState(); + private final T table; + private final TableFilterState filterState = new TableFilterState(); private final Map<Integer, Integer> columnDistnctIntemNumbers = new HashMap<>(); - public AbstractTableFilter( T table ) { - this.table = table; - } - - @Override - public T getTable() { - return table; - } - - protected abstract boolean execute(int col, Collection<Object> items); - - @Override - public boolean apply(int col, Collection<Object> items) { - setFilterState(col, items); - boolean result; - if ( result = execute( col, items ) ) fireFilterChange(); - return result; - } - - @Override - public final void addChangeListener( FilterChangeListener listener ) { - if ( listener != null ) listeners.add(listener); - } - - @Override - public final void removeChangeListener( FilterChangeListener listener ) { - if ( listener != null ) listeners.remove(listener); - } - - public final void fireFilterChange() { - for( FilterChangeListener l: listeners ) { - l.filterChanged(AbstractTableFilter.this); - } - } - - @Override - public Collection<Object> getDistinctColumnItems( int column ) { - Collection<Object> result = collectDistinctColumnItems( column ); + public AbstractTableFilter(T table) { + this.table = table; + } + + @Override + public T getTable() { + return table; + } + + protected abstract boolean execute(int col, Collection<Object> items); + + @Override + public boolean apply(int col, Collection<Object> items) { + setFilterState(col, items); + boolean result; + if (result = execute(col, items)) fireFilterChange(); + return result; + } + + @Override + public final void addChangeListener(FilterChangeListener listener) { + if (listener != null) listeners.add(listener); + } + + @Override + public final void removeChangeListener(FilterChangeListener listener) { + if (listener != null) listeners.remove(listener); + } + + public final void fireFilterChange() { + for (FilterChangeListener l : listeners) { + l.filterChanged(AbstractTableFilter.this); + } + } + + @Override + public Collection<Object> getDistinctColumnItems(int column) { + Collection<Object> result = collectDistinctColumnItems(column); columnDistnctIntemNumbers.put(column, result != null ? result.size() : 0); - return result; + return result; - } + } - private Collection<Object> collectDistinctColumnItems( final int column ) { + private Collection<Object> collectDistinctColumnItems(final int column) { // Set<Object> set = new HashSet<Object>(); // to collect unique items // int nullIndex = -1; // for( int row=0; row<table.getModel().getRowCount(); row++) { @@ -125,38 +124,38 @@ public abstract class AbstractTableFilter<T extends JTable> implements TableFilt List<Object> result = null; if (set != null) { result = new ArrayList<>(set); - // if ( nullIndex >= 0 ) result.add(0, null); // add null to resulting collection if we had it + // if ( nullIndex >= 0 ) result.add(0, null); // add null to resulting collection if we had it result.sort((o1, o2) -> ComparatorUtils.transformedComparator(ComparatorUtils.NATURAL_COMPARATOR, - (Transformer<Object, Comparable>) AbstractTableFilter.this::toString).compare(o1, o2)); + (Transformer<Object, Comparable>) AbstractTableFilter.this::toString).compare(o1, o2)); } return result; - } - - @Override - public Collection<Object> getFilterState( int column ) { - return filterState.getValues(column); - } - - @Override - public boolean isFiltered( int column ) { - Collection<Object> checks = getFilterState( column ); - return CollectionUtils.isNotEmpty(checks) && !ObjectUtils.equals(columnDistnctIntemNumbers.get(column), checks.size()); - } - - @Override - public boolean includeRow( TableFilter.Row row ) { - return filterState.include(row); - } - - public void setFilterState(int column, Collection<Object> values ) { - filterState.setValues(column, values); - } - - public void clear() { - filterState.clear(); - fireFilterChange(); - } + } + + @Override + public Collection<Object> getFilterState(int column) { + return filterState.getValues(column); + } + + @Override + public boolean isFiltered(int column) { + Collection<Object> checks = getFilterState(column); + return CollectionUtils.isNotEmpty(checks) && !Objects.equals(columnDistnctIntemNumbers.get(column), checks.size()); + } + + @Override + public boolean includeRow(TableFilter.Row row) { + return filterState.include(row); + } + + public void setFilterState(int column, Collection<Object> values) { + filterState.setValues(column, values); + } + + public void clear() { + filterState.clear(); + fireFilterChange(); + } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/FilterChangeListener.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/FilterChangeListener.java index a61e320..ee9fb91 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/FilterChangeListener.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/FilterChangeListener.java @@ -34,5 +34,5 @@ package org.nuiton.jaxx.runtime.swing.table.filter; public interface FilterChangeListener { - void filterChanged( TableFilter<?> filter ); + void filterChanged(TableFilter<?> filter); } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/JTableFilter.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/JTableFilter.java index 1ecaf9a..1b63cfa 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/JTableFilter.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/JTableFilter.java @@ -32,85 +32,88 @@ package org.nuiton.jaxx.runtime.swing.table.filter; -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - import javax.swing.DefaultRowSorter; import javax.swing.JTable; import javax.swing.RowFilter; import javax.swing.RowSorter; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.Set; public class JTableFilter extends AbstractTableFilter<JTable> { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private final TableRowFilter filter = new TableRowFilter(); + private final TableRowFilter filter = new TableRowFilter(); - public JTableFilter( JTable table) { - super(table); - } + public JTableFilter(JTable table) { + super(table); + } - @Override - protected boolean execute(int col, Collection<Object> items) { + @Override + protected boolean execute(int col, Collection<Object> items) { - RowSorter<?> rs = getTable().getRowSorter(); + RowSorter<?> rs = getTable().getRowSorter(); - if (!( rs instanceof DefaultRowSorter )) return false; + if (!(rs instanceof DefaultRowSorter)) return false; - DefaultRowSorter<?, ?> drs = (DefaultRowSorter<?, ?>) rs; + DefaultRowSorter<?, ?> drs = (DefaultRowSorter<?, ?>) rs; - @SuppressWarnings("unchecked") - RowFilter<Object,Object> prevFilter = (RowFilter<Object, Object>) drs.getRowFilter(); - if ( !(prevFilter instanceof TableRowFilter)) { - filter.setParentFilter(prevFilter); - } + @SuppressWarnings("unchecked") + RowFilter<Object, Object> prevFilter = (RowFilter<Object, Object>) drs.getRowFilter(); + if (!(prevFilter instanceof TableRowFilter)) { + filter.setParentFilter(prevFilter); + } - drs.setRowFilter(filter); - return true; + drs.setRowFilter(filter); + return true; - } + } - class TableRowFilter extends RowFilter<Object,Object> implements Serializable { + class TableRowFilter extends RowFilter<Object, Object> implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private RowFilter<Object, Object> parentFilter; + private RowFilter<Object, Object> parentFilter; - public RowFilter<Object, Object> getParentFilter() { - return parentFilter; - } + public RowFilter<Object, Object> getParentFilter() { + return parentFilter; + } - public void setParentFilter( RowFilter<Object, Object> parentFilter ) { - this.parentFilter = (parentFilter == null || parentFilter == this )? null: parentFilter; - } + public void setParentFilter(RowFilter<Object, Object> parentFilter) { + this.parentFilter = (parentFilter == null || parentFilter == this) ? null : parentFilter; + } - @Override - public boolean include( final RowFilter.Entry<?, ?> entry) { + @Override + public boolean include(final RowFilter.Entry<?, ?> entry) { - // use parent filter condition - if ( parentFilter != null && !parentFilter.include(entry)) return false; + // use parent filter condition + if (parentFilter != null && !parentFilter.include(entry)) return false; - return includeRow( new TableFilter.Row() { + return includeRow(new TableFilter.Row() { - @Override - public Object getValue(int column) { return entry.getValue(column); } + @Override + public Object getValue(int column) { + return entry.getValue(column); + } - @Override - public int getValueCount() { return entry.getValueCount(); } + @Override + public int getValueCount() { + return entry.getValueCount(); + } - }); + }); - } + } - } + } - public void modelChanged( TableModel model ) { - getTable().setRowSorter(new TableRowSorter<>(model)); - } + public void modelChanged(TableModel model) { + getTable().setRowSorter(new TableRowSorter<>(model)); + } @Override public Set<Object> distinctValuesForColumn(int i) { @@ -126,9 +129,9 @@ public class JTableFilter extends AbstractTableFilter<JTable> { public void clear() { super.clear(); - Collection<Object> items = Collections.emptyList(); - for( int column=0; column<getTable().getModel().getColumnCount(); column++) { - execute(column, items); - } + Collection<Object> items = Collections.emptyList(); + for (int column = 0; column < getTable().getModel().getColumnCount(); column++) { + execute(column, items); + } } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableAwareCheckListRenderer.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableAwareCheckListRenderer.java index bf52131..b4cf18a 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableAwareCheckListRenderer.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableAwareCheckListRenderer.java @@ -31,27 +31,26 @@ */ package org.nuiton.jaxx.runtime.swing.table.filter; +import org.nuiton.decorator.Decorator; import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.swing.list.CheckListRenderer; -import org.nuiton.decorator.Decorator; - -import java.awt.Component; import javax.swing.JList; +import java.awt.Component; @SuppressWarnings("serial") public class TableAwareCheckListRenderer extends CheckListRenderer { - - private final Decorator<Object> decorator; - public TableAwareCheckListRenderer(Decorator<Object> decorator ) { + private final Decorator<Object> decorator; + + public TableAwareCheckListRenderer(Decorator<Object> decorator) { this.decorator = decorator; - } + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String text; if (value != null && decorator != null) { text = decorator.toString(value); @@ -60,7 +59,7 @@ public class TableAwareCheckListRenderer extends CheckListRenderer { } setText(text); return this; - - } - + + } + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilter.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilter.java index 1476507..0d2fc8e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilter.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilter.java @@ -33,70 +33,73 @@ package org.nuiton.jaxx.runtime.swing.table.filter; +import javax.swing.JTable; +import javax.swing.table.TableModel; import java.io.Serializable; import java.util.Collection; import java.util.Set; -import javax.swing.JTable; -import javax.swing.table.TableModel; - public interface TableFilter<T extends JTable> extends Serializable { - /** - * The table under filter - * @return - */ - T getTable(); - - /** - * - * @param column model column index - * @return - */ - Collection<Object> getDistinctColumnItems( int column ); - - /** - * - * @param column model column index - * @return - */ - Collection<Object> getFilterState( int column ); - - /** - * Checks if column is filtered - * @param column model column index - * @return true if column is filtered - */ - boolean isFiltered( int column ); - - boolean includeRow( Row entry ); - - /** - * Apply filter for specified column based on collection of distinct items - * @param col - * @param items - * @return - */ - boolean apply( int col, Collection<Object> items ); - - interface Row { - int getValueCount(); - Object getValue( int column ); - } - - void addChangeListener( FilterChangeListener listener ); - void removeChangeListener( FilterChangeListener listener ); - - /** - * Clear the filter - */ - void clear(); - - /** - * Describes what filter has to do when table model changes - * @param model - */ - void modelChanged( TableModel model ); + /** + * The table under filter + * + * @return + */ + T getTable(); + + /** + * @param column model column index + * @return + */ + Collection<Object> getDistinctColumnItems(int column); + + /** + * @param column model column index + * @return + */ + Collection<Object> getFilterState(int column); + + /** + * Checks if column is filtered + * + * @param column model column index + * @return true if column is filtered + */ + boolean isFiltered(int column); + + boolean includeRow(Row entry); + + /** + * Apply filter for specified column based on collection of distinct items + * + * @param col + * @param items + * @return + */ + boolean apply(int col, Collection<Object> items); + + interface Row { + int getValueCount(); + + Object getValue(int column); + } + + void addChangeListener(FilterChangeListener listener); + + void removeChangeListener(FilterChangeListener listener); + + /** + * Clear the filter + */ + void clear(); + + /** + * Describes what filter has to do when table model changes + * + * @param model + */ + void modelChanged(TableModel model); Set<Object> distinctValuesForColumn(int i); diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterColumnPopup.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterColumnPopup.java index 35c208d..4e338ca 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterColumnPopup.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterColumnPopup.java @@ -367,11 +367,7 @@ class TableFilterColumnPopup extends MouseAdapter { } private ColumnAttrs getColumnAttrs(int column) { - ColumnAttrs attrs = colAttrs.get(column); - if (attrs == null) { - attrs = new ColumnAttrs(); - colAttrs.put(column, attrs); - } + ColumnAttrs attrs = colAttrs.computeIfAbsent(column, k -> new ColumnAttrs()); return attrs; } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterState.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterState.java index f7ab0e0..89f874e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterState.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableFilterState.java @@ -44,87 +44,87 @@ import java.util.Set; class TableFilterState implements Serializable { - private static final long serialVersionUID = 1L; - - // no set - filter cleared; set - some kind of filtering - private final Map<Integer,Set<Object>> data = new HashMap<>(); - - /** - * Clears filtering for specific column - */ - public void clear( int column ) { - data.remove(column); - } - - - /** - * Clears all filtering - */ - public void clear() { - data.clear(); - } - - private Set<Object> prepareValueSet( int column ) { - Set<Object> vals = data.get(column); - if ( vals == null ) { - vals = new HashSet<>(); - data.put(column, vals); - } - return vals; - } - - - /** - * Adds filter value for specified column - * @param column - * @param value - */ - public void addValue( int column, Object value ) { - prepareValueSet(column).add(value); - } - - - /** - * Adds a collection of filter values for specified column - * @param column - * @param values - */ - public void addValues( int column, Collection<Object> values ) { - prepareValueSet(column).addAll(values); - } - - /** - * Resets a collection of filter values for specified column - * @param column - * @param values - */ - public void setValues( int column, Collection<Object> values ) { - data.remove(column); - if (CollectionUtils.isNotEmpty(values)) { - prepareValueSet(column).addAll(values); - } - } - - public Collection<Object> getValues( int column ) { - Set<Object> vals = data.get(column); - return vals == null? Collections.emptySet(): vals; - } - - /** - * Standard test for row inclusion using current filter values - * @param entry - * @return true if row has to be included - */ - public boolean include( TableFilter.Row entry ) { - - for( int col=0; col< entry.getValueCount(); col++ ) { - Collection<Object> values = getValues(col); - if ( CollectionUtils.isEmpty(values) ) continue; // no filtering for this column - if ( !values.contains( entry.getValue(col) )) return false; - } - return true; - - } - - + private static final long serialVersionUID = 1L; + + // no set - filter cleared; set - some kind of filtering + private final Map<Integer, Set<Object>> data = new HashMap<>(); + + /** + * Clears filtering for specific column + */ + public void clear(int column) { + data.remove(column); + } + + + /** + * Clears all filtering + */ + public void clear() { + data.clear(); + } + + private Set<Object> prepareValueSet(int column) { + Set<Object> vals = data.computeIfAbsent(column, k -> new HashSet<>()); + return vals; + } + + + /** + * Adds filter value for specified column + * + * @param column + * @param value + */ + public void addValue(int column, Object value) { + prepareValueSet(column).add(value); + } + + + /** + * Adds a collection of filter values for specified column + * + * @param column + * @param values + */ + public void addValues(int column, Collection<Object> values) { + prepareValueSet(column).addAll(values); + } + + /** + * Resets a collection of filter values for specified column + * + * @param column + * @param values + */ + public void setValues(int column, Collection<Object> values) { + data.remove(column); + if (CollectionUtils.isNotEmpty(values)) { + prepareValueSet(column).addAll(values); + } + } + + public Collection<Object> getValues(int column) { + Set<Object> vals = data.get(column); + return vals == null ? Collections.emptySet() : vals; + } + + /** + * Standard test for row inclusion using current filter values + * + * @param entry + * @return true if row has to be included + */ + public boolean include(TableFilter.Row entry) { + + for (int col = 0; col < entry.getValueCount(); col++) { + Collection<Object> values = getValues(col); + if (CollectionUtils.isEmpty(values)) continue; // no filtering for this column + if (!values.contains(entry.getValue(col))) return false; + } + return true; + + } + + } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableRowFilterSupport.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableRowFilterSupport.java index 7c86667..b59b486 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableRowFilterSupport.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/table/filter/TableRowFilterSupport.java @@ -34,62 +34,63 @@ package org.nuiton.jaxx.runtime.swing.table.filter; import org.nuiton.decorator.Decorator; -import java.awt.*; -import java.beans.PropertyChangeListener; -import java.util.Collections; - import javax.swing.JTable; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; +import java.awt.Dimension; +import java.beans.PropertyChangeListener; +import java.util.Collections; public final class TableRowFilterSupport { - private boolean searchable = false; + private boolean searchable = false; private Decorator<Object> decorator; - private final TableFilter<?> filter; - private boolean actionsVisible = true; - private boolean useTableRenderers = false; - private Dimension popupDefaultSize = null; - - private TableRowFilterSupport( TableFilter<?> filter ) { - if ( filter == null ) throw new NullPointerException(); - //this.table = table; - this.filter = filter; - } - - public static TableRowFilterSupport forFilter( TableFilter<?> filter ) { - return new TableRowFilterSupport(filter); - } - - /** - * Additional actions visible in column filter list - * @param visible - * @return - */ - public TableRowFilterSupport actions( boolean visible ) { - this.actionsVisible = visible; - return this; - } - - /** - * Comlumn filter list is searchable - * @param searchable - * @return - */ - public TableRowFilterSupport searchable( boolean searchable) { - this.searchable = searchable; - return this; - } - - public TableRowFilterSupport searchDecorator( Decorator<Object> decorator ) { - this.decorator = decorator; - return this; - } - - public TableRowFilterSupport useTableRenderers( boolean value ) { - this.useTableRenderers = value; - return this; - } + private final TableFilter<?> filter; + private boolean actionsVisible = true; + private boolean useTableRenderers = false; + private Dimension popupDefaultSize = null; + + private TableRowFilterSupport(TableFilter<?> filter) { + if (filter == null) throw new NullPointerException(); + //this.table = table; + this.filter = filter; + } + + public static TableRowFilterSupport forFilter(TableFilter<?> filter) { + return new TableRowFilterSupport(filter); + } + + /** + * Additional actions visible in column filter list + * + * @param visible + * @return + */ + public TableRowFilterSupport actions(boolean visible) { + this.actionsVisible = visible; + return this; + } + + /** + * Comlumn filter list is searchable + * + * @param searchable + * @return + */ + public TableRowFilterSupport searchable(boolean searchable) { + this.searchable = searchable; + return this; + } + + public TableRowFilterSupport searchDecorator(Decorator<Object> decorator) { + this.decorator = decorator; + return this; + } + + public TableRowFilterSupport useTableRenderers(boolean value) { + this.useTableRenderers = value; + return this; + } public TableRowFilterSupport setPopupDefaultSize(Dimension popupDefaultSize) { this.popupDefaultSize = popupDefaultSize; @@ -98,27 +99,27 @@ public final class TableRowFilterSupport { public JTable apply() { - final TableFilterColumnPopup filterPopup = new TableFilterColumnPopup(filter); - filterPopup.setEnabled(true); - filterPopup.setActionsVisible(actionsVisible); - filterPopup.setSearchable(searchable); - filterPopup.searchDecorator(decorator); - filterPopup.setUseTableRenderers(useTableRenderers); + final TableFilterColumnPopup filterPopup = new TableFilterColumnPopup(filter); + filterPopup.setEnabled(true); + filterPopup.setActionsVisible(actionsVisible); + filterPopup.setSearchable(searchable); + filterPopup.searchDecorator(decorator); + filterPopup.setUseTableRenderers(useTableRenderers); filterPopup.setDefaultSize(popupDefaultSize); - setupTableHeader(); + setupTableHeader(); - return filter.getTable(); - } + return filter.getTable(); + } - private void setupTableHeader() { + private void setupTableHeader() { - final JTable table = filter.getTable(); + final JTable table = filter.getTable(); - filter.addChangeListener(filter -> table.getTableHeader().repaint()); + filter.addChangeListener(filter -> table.getTableHeader().repaint()); - // make sure that search component is reset after table model changes - setupHeaderRenderers(table.getModel(), true ); + // make sure that search component is reset after table model changes + setupHeaderRenderers(table.getModel(), true); // table.addPropertyChangeListener("model", new PropertyChangeListener() { // // public void propertyChange(PropertyChangeEvent evt) { @@ -132,25 +133,25 @@ public final class TableRowFilterSupport { // }} // // ); - } + } - private void setupHeaderRenderers( TableModel newModel, boolean fullSetup ) { + private void setupHeaderRenderers(TableModel newModel, boolean fullSetup) { - final JTable table = filter.getTable(); + final JTable table = filter.getTable(); - FilterTableHeaderRenderer headerRenderer = new FilterTableHeaderRenderer(filter); - filter.modelChanged( newModel ); + FilterTableHeaderRenderer headerRenderer = new FilterTableHeaderRenderer(filter); + filter.modelChanged(newModel); - for( TableColumn c: Collections.list( table.getColumnModel().getColumns()) ) { - c.setHeaderRenderer( headerRenderer ); - } + for (TableColumn c : Collections.list(table.getColumnModel().getColumns())) { + c.setHeaderRenderer(headerRenderer); + } - if ( !fullSetup ) return; + if (!fullSetup) return; - PropertyChangeListener listener = e -> setupHeaderRenderers(table.getModel(), false); - table.addPropertyChangeListener("model", listener); - table.addPropertyChangeListener("columnModel", listener); + PropertyChangeListener listener = e -> setupHeaderRenderers(table.getModel(), false); + table.addPropertyChangeListener("model", listener); + table.addPropertyChangeListener("columnModel", listener); - } + } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/BusyChangeListener.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/BusyChangeListener.java index fdc9c39..164de81 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/BusyChangeListener.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/BusyChangeListener.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.wizard; -import org.nuiton.jaxx.runtime.swing.BlockingLayerUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.BlockingLayerUI; import java.awt.Component; import java.awt.Cursor; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardModel.java index 2a5f770..9c807c0 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardModel.java @@ -87,7 +87,7 @@ public abstract class WizardModel<E extends WizardStep> { public WizardModel(Class<E> stepClass, E... steps) { if (!Enum.class.isAssignableFrom(stepClass)) { throw new IllegalArgumentException("stepClass must be an" + - " Enumeration but was " + stepClass.getName()); + " Enumeration but was " + stepClass.getName()); } this.stepClass = stepClass; pcs = new PropertyChangeSupport(this); @@ -133,7 +133,7 @@ public abstract class WizardModel<E extends WizardStep> { } if (!steps.contains(e)) { throw new IllegalStateException("step " + e.toString() + - " is not in universe of steps (" + steps + ')'); + " is not in universe of steps (" + steps + ')'); } setBusy(true); try { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardUILancher.java index 148a1f5..8b59b8c 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardUILancher.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/WizardUILancher.java @@ -83,7 +83,7 @@ public abstract class WizardUILancher<E extends WizardStep, M extends WizardMode } catch (Exception ex) { throw new RuntimeException( "could not instanciate launcher for reason " + - ex.getMessage(), ex); + ex.getMessage(), ex); } } @@ -102,7 +102,7 @@ public abstract class WizardUILancher<E extends WizardStep, M extends WizardMode } catch (Exception ex) { throw new RuntimeException( "could not instanciate launcher for reason " + - ex.getMessage(), ex); + ex.getMessage(), ex); } } diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtModel.java index 43eb297..78b5ff1 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtModel.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.wizard.ext; -import org.nuiton.jaxx.runtime.swing.wizard.WizardModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.swing.wizard.WizardModel; import java.util.ArrayList; import java.util.Arrays; @@ -142,9 +142,9 @@ public abstract class WizardExtModel<E extends WizardExtStep> extends WizardMode // uniquement si l'onglet precedent est accessible, valide et son etat est a SUCCESSED E previousStep = steps.get(i - 1); result[i] = modelState == WizardState.SUCCESSED || - result[i - 1] && - validate(previousStep) && - (!previousStep.isOperation() || getStepState(previousStep) == WizardState.SUCCESSED); + result[i - 1] && + validate(previousStep) && + (!previousStep.isOperation() || getStepState(previousStep) == WizardState.SUCCESSED); } } if (log.isDebugEnabled()) { diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtStepModel.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtStepModel.java index 65ce3bc..9b09388 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtStepModel.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtStepModel.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.runtime.swing.wizard.ext; -import org.nuiton.jaxx.runtime.JAXXUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXUtil; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; diff --git a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtUtil.java b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtUtil.java index b3e71d9..9ca7d9e 100644 --- a/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtUtil.java +++ b/jaxx-runtime/src/main/java/org/nuiton/jaxx/runtime/swing/wizard/ext/WizardExtUtil.java @@ -21,11 +21,11 @@ */ package org.nuiton.jaxx.runtime.swing.wizard.ext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.swing.wizard.WizardModel; import org.nuiton.jaxx.runtime.swing.wizard.WizardUI; import org.nuiton.jaxx.runtime.swing.wizard.WizardUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import java.beans.IndexedPropertyChangeEvent; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/UtilTest.java b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/UtilTest.java index 66e1db3..a172510 100644 --- a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/UtilTest.java +++ b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/UtilTest.java @@ -23,7 +23,6 @@ package org.nuiton.jaxx.runtime; import org.junit.Assert; import org.junit.Test; -import org.nuiton.jaxx.runtime.JAXXUtil; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; diff --git a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DataContextEntryIteratorTest.java b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DataContextEntryIteratorTest.java deleted file mode 100644 index a5511b7..0000000 --- a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DataContextEntryIteratorTest.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * #%L - * JAXX :: Runtime - * %% - * Copyright (C) 2008 - 2016 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.jaxx.runtime.context; - -import org.nuiton.jaxx.runtime.context.DataContext.DataContextEntry; -import org.nuiton.jaxx.runtime.context.DataContext.DataContextEntryIterator; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.regex.Pattern; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Tests {@link DataContext}. - * - * @author Tony Chemit - dev@tchemit.fr - * @since 2.0.1 - */ -public class DataContextEntryIteratorTest { - - static DataContextEntry<?>[] entries; - - static class DataContextEntry2 extends DataContextEntry<Object> { - - public DataContextEntry2() { - super(Object.class); - } - - public DataContextEntry2(DataContextEntry<?> previous) { - super(Object.class, previous); - } - - @Override - public Pattern getPattern() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getContextPath(Object... args) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean acceptType(Class<?> type) { - throw new UnsupportedOperationException("Not supported yet."); - } - } - - @BeforeClass - public static void setUpClass() throws Exception { - entries = new DataContextEntry<?>[3]; - entries[0] = new DataContextEntry2(); - entries[1] = new DataContextEntry2(entries[0]); - entries[2] = new DataContextEntry2(entries[1]); - } - - DataContextEntryIterator instance; - - @Test - public void testEmptyIterator() { - - instance = new DataContextEntryIterator( - DataContext.EMPTY_DATA_CONTEXT_ENTRY_ARRAY); - - boolean result = instance.hasNext(); - assertEquals(false, result); - } - - @Test - public void testEmptyReverseIterator() { - - instance = new DataContextEntryIterator( - DataContext.EMPTY_DATA_CONTEXT_ENTRY_ARRAY, true); - - boolean result = instance.hasNext(); - assertEquals(false, result); - } - - @Test - public void testEmptyLevelIterator() { - - instance = new DataContextEntryIterator( - DataContext.EMPTY_DATA_CONTEXT_ENTRY_ARRAY, 0); - - boolean result = instance.hasNext(); - assertEquals(false, result); - - instance = new DataContextEntryIterator( - new DataContextEntry<?>[]{entries[1]}, 0); - - result = instance.hasNext(); - assertEquals(false, result); - } - - @Test - public void testSingletonIterator() { - - instance = new DataContextEntryIterator( - new DataContextEntry<?>[]{entries[0]}); - - boolean result = instance.hasNext(); - assertEquals(true, result); - DataContextEntry<?> data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - } - - @Test - public void testSingletonReverseIterator() { - - instance = new DataContextEntryIterator( - new DataContextEntry<?>[]{entries[0]}, true); - - boolean result = instance.hasNext(); - assertEquals(true, result); - DataContextEntry<?> data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - } - - @Test - public void testSingletonLevelIterator() { - - instance = new DataContextEntryIterator( - new DataContextEntry<?>[]{entries[0]}, 0); - - boolean result = instance.hasNext(); - assertEquals(true, result); - DataContextEntry<?> data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - - instance = new DataContextEntryIterator( - new DataContextEntry<?>[]{entries[0]}, 1); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - - instance = new DataContextEntryIterator(entries, 0); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - - } - - @Test - public void testIterator() { - - instance = new DataContextEntryIterator(entries); - - boolean result = instance.hasNext(); - assertEquals(true, result); - DataContextEntry<?> data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[1], data); - assertEquals(1, data.getLevel()); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[2], data); - assertEquals(2, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - - - } - - @Test - public void testReverseIterator() { - - instance = new DataContextEntryIterator(entries, true); - - boolean result = instance.hasNext(); - assertEquals(true, result); - Object data = instance.next(); - assertNotNull(data); - assertEquals(entries[2], data); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[1], data); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - - result = instance.hasNext(); - assertEquals(false, result); - - - } - - @Test - public void testLevelIterator() { - - instance = new DataContextEntryIterator(entries, 2); - - boolean result = instance.hasNext(); - assertEquals(true, result); - DataContextEntry<?> data = instance.next(); - assertNotNull(data); - assertEquals(entries[0], data); - assertEquals(0, data.getLevel()); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[1], data); - assertEquals(1, data.getLevel()); - - result = instance.hasNext(); - assertEquals(true, result); - data = instance.next(); - assertNotNull(data); - assertEquals(entries[2], data); - assertEquals(2, data.getLevel()); - - result = instance.hasNext(); - assertEquals(false, result); - - - } -} diff --git a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContextTest.java b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContextTest.java index 55a82af..bd170fe 100644 --- a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContextTest.java +++ b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultApplicationContextTest.java @@ -21,9 +21,6 @@ */ package org.nuiton.jaxx.runtime.context; -import org.nuiton.jaxx.runtime.JAXXUtil; -import org.nuiton.jaxx.runtime.context.DefaultApplicationContext.AutoLoad; -import org.nuiton.jaxx.runtime.context.DefaultApplicationContext.MethodAccess; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.After; @@ -32,9 +29,13 @@ import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.nuiton.jaxx.runtime.JAXXUtil; +import org.nuiton.jaxx.runtime.context.DefaultApplicationContext.AutoLoad; +import org.nuiton.jaxx.runtime.context.DefaultApplicationContext.MethodAccess; import java.beans.PropertyChangeListener; import java.util.Arrays; +import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; @@ -189,7 +190,7 @@ public class DefaultApplicationContextTest { context.addPropertyChangeListener(LIST_STRING_ENTRY, "myKey2", listener); - LIST_STRING_ENTRY.setContextValue(context, Arrays.asList("myValue")); + LIST_STRING_ENTRY.setContextValue(context, Collections.singletonList("myValue")); Assert.assertEquals(3, yoCount); @@ -202,7 +203,7 @@ public class DefaultApplicationContextTest { context.removePropertyChangeListener(LIST_STRING_ENTRY, "myKey2", listener); - LIST_STRING_ENTRY.setContextValue(context, Arrays.asList("myValue2")); + LIST_STRING_ENTRY.setContextValue(context, Collections.singletonList("myValue2")); Assert.assertEquals(4, yoCount); diff --git a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContextTest.java index 54283c4..7328625 100644 --- a/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContextTest.java +++ b/jaxx-runtime/src/test/java/org/nuiton/jaxx/runtime/context/DefaultJAXXContextTest.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.runtime.context; -import org.nuiton.jaxx.runtime.JAXXContext; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.nuiton.jaxx.runtime.JAXXContext; /** @author Tony Chemit - dev@tchemit.fr */ public class DefaultJAXXContextTest { diff --git a/jaxx-runtime/src/test/resources/log4j.properties b/jaxx-runtime/src/test/resources/log4j.properties index 4eaba80..0ec28f6 100644 --- a/jaxx-runtime/src/test/resources/log4j.properties +++ b/jaxx-runtime/src/test/resources/log4j.properties @@ -25,5 +25,4 @@ log4j.rootLogger=ERROR, stdout 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.org.nuiton.jaxx=INFO diff --git a/jaxx-validator/pom.xml b/jaxx-validator/pom.xml index 28af70e..3db456c 100644 --- a/jaxx-validator/pom.xml +++ b/jaxx-validator/pom.xml @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8"?> - <!-- - #%L - JAXX :: Validator - - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> -<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"> +<!-- +#%L +JAXX :: Validator + +$Id$ +$HeadURL$ +%% +Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit +%% +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Lesser Public License for more details. + +You should have received a copy of the GNU General Lesser Public +License along with this program. If not, see +<http://www.gnu.org/licenses/lgpl-3.0.html>. +#L% +--> +<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> diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SimpleBeanValidatorMessageTableModel.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SimpleBeanValidatorMessageTableModel.java index 197324b..6f67573 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SimpleBeanValidatorMessageTableModel.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SimpleBeanValidatorMessageTableModel.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.validator.swing; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.simple.SimpleBeanValidator; import org.nuiton.validator.bean.simple.SimpleBeanValidatorEvent; @@ -81,7 +81,7 @@ public class SimpleBeanValidatorMessageTableModel extends AbstractTableModel if (validators.contains(validator)) { throw new IllegalArgumentException( "the validator " + validator + " is already registred in " - + this); + + this); } validators.add(validator); validator.addSimpleBeanValidatorListener(this); @@ -255,9 +255,9 @@ public class SimpleBeanValidatorMessageTableModel extends AbstractTableModel for (int i = getRowCount() - 1; i > -1; i--) { SimpleBeanValidatorMessage error = data.get(i); if (validator.equals(error.getValidator()) && - error.getScope() == scope && - error.getField().equals(fieldName) && - messagesToDel.contains(error.getMessage())) { + error.getScope() == scope && + error.getField().equals(fieldName) && + messagesToDel.contains(error.getMessage())) { // remove the message data.remove(i); if (notify) { diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidator.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidator.java index 1763042..274ba53 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidator.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidator.java @@ -32,6 +32,7 @@ import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.list.BeanListValidator; import javax.swing.JComponent; +import java.util.Objects; /** * Created on 9/17/14. @@ -93,7 +94,7 @@ public class SwingListValidator<B> extends BeanListValidator<B> { String context, NuitonValidatorScope... scopes) throws NullPointerException { - Preconditions.checkNotNull(type, "type parameter can not be null."); + Objects.requireNonNull(type, "type parameter can not be null."); // get delegate validator provider NuitonValidatorProvider provider = diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessage.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessage.java index 1b866a4..34c45f1 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessage.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessage.java @@ -57,8 +57,8 @@ public class SwingListValidatorMessage extends BeanListValidatorMessage<SwingLis @Override public String toString() { String s = scope + " - " + - (field == null ? message : field + "[" + getBean() + - "] - " + message); + (field == null ? message : field + "[" + getBean() + + "] - " + message); if (editor != null) { s = editor.getName() + " : " + s; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableModel.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableModel.java index 1b17920..7ea4559 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableModel.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableModel.java @@ -23,9 +23,9 @@ package org.nuiton.jaxx.validator.swing; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.list.BeanListValidator; import org.nuiton.validator.bean.list.BeanListValidatorEvent; @@ -58,7 +58,7 @@ public class SwingListValidatorMessageTableModel extends AbstractTableModel public static final String[] columnNames = {"validator.scope", "validator.bean", - "validator.field", "validator.message"}; + "validator.field", "validator.message"}; public static final Class<?>[] columnClasses = {NuitonValidatorScope.class, Object.class, String.class, String.class}; @@ -86,7 +86,7 @@ public class SwingListValidatorMessageTableModel extends AbstractTableModel Preconditions.checkState( !validators.contains(validator), "Validator " + validator + " is already registred in " - + this); + + this); validators.add(validator); validator.addBeanListValidatorListener(this); } @@ -259,10 +259,10 @@ public class SwingListValidatorMessageTableModel extends AbstractTableModel for (int i = getRowCount() - 1; i > -1; i--) { SwingListValidatorMessage error = data.get(i); if (validator.equals(error.getValidator()) && - error.getScope() == scope && - error.getBean() == bean && - error.getField().equals(fieldName) && - messagesToDel.contains(error.getMessage())) { + error.getScope() == scope && + error.getBean() == bean && + error.getField().equals(fieldName) && + messagesToDel.contains(error.getMessage())) { // remove the message data.remove(i); if (notify) { diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableMouseListener.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableMouseListener.java index 1d9a23b..5f9df46 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableMouseListener.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageTableMouseListener.java @@ -21,10 +21,10 @@ package org.nuiton.jaxx.validator.swing; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; import javax.swing.JTable; import java.awt.event.MouseAdapter; @@ -105,8 +105,8 @@ public class SwingListValidatorMessageTableMouseListener extends MouseAdapter { if (!(table.getModel() instanceof SwingListValidatorMessageTableModel)) { if (log.isWarnEnabled()) { log.warn("model must be a " + - SwingValidatorMessageTableModel.class + - ", but was " + table.getModel()); + SwingValidatorMessageTableModel.class + + ", but was " + table.getModel()); } return null; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageWidget.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageWidget.java index 92072f9..6ae9627 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageWidget.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorMessageWidget.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.validator.swing; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.ComponentMover; -import org.nuiton.jaxx.runtime.swing.ComponentResizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTitledPanel; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.ComponentMover; +import org.nuiton.jaxx.runtime.swing.ComponentResizer; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.list.BeanListValidator; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorTableEditorModelListener.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorTableEditorModelListener.java index 9f3f4ae..49b1f96 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorTableEditorModelListener.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingListValidatorTableEditorModelListener.java @@ -79,8 +79,8 @@ public class SwingListValidatorTableEditorModelListener<O> implements TableModel case TableModelEvent.UPDATE: if (e.getColumn() == TableModelEvent.ALL_COLUMNS - && firstRow == 0 - && lastRow == Integer.MAX_VALUE) { + && firstRow == 0 + && lastRow == Integer.MAX_VALUE) { // fireTableDataChanged diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidator.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidator.java index b2b5332..8743e7c 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidator.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidator.java @@ -24,11 +24,11 @@ package org.nuiton.jaxx.validator.swing; import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; -import org.nuiton.jaxx.validator.swing.ui.AbstractBeanValidatorUI; -import org.nuiton.jaxx.validator.swing.ui.IconValidationUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.jxlayer.JXLayer; +import org.nuiton.jaxx.validator.swing.ui.AbstractBeanValidatorUI; +import org.nuiton.jaxx.validator.swing.ui.IconValidationUI; import org.nuiton.validator.NuitonValidator; import org.nuiton.validator.NuitonValidatorFactory; import org.nuiton.validator.NuitonValidatorProvider; @@ -43,6 +43,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; /** * La surcharge de {@link SimpleBeanValidator} pour les ui swing @@ -181,8 +182,8 @@ public class SwingValidator<B> extends SimpleBeanValidator<B> { String context, NuitonValidatorScope... scopes) throws NullPointerException { - Preconditions.checkNotNull(type, - "type parameter can not be null."); + Objects.requireNonNull(type, + "type parameter can not be null."); // get delegate validator provider NuitonValidatorProvider provider = @@ -290,7 +291,7 @@ public class SwingValidator<B> extends SimpleBeanValidator<B> { super.setContext(context); if (context == null && oldContext == null || - context != null && context.equals(oldContext)) { + context != null && context.equals(oldContext)) { // same context do nothing return; @@ -316,12 +317,12 @@ public class SwingValidator<B> extends SimpleBeanValidator<B> { // no field registred in the validator if (log.isWarnEnabled()) { log.warn("the field '" + fieldname + - "' is not defined in validator (no rules on it)"); + "' is not defined in validator (no rules on it)"); } } else { if (log.isInfoEnabled()) { log.info("register field [" + fieldname + "] with component : " + - c.getName() + c.getName() ); } fieldRepresentation.put(fieldname, c); @@ -349,7 +350,7 @@ public class SwingValidator<B> extends SimpleBeanValidator<B> { if (fieldRepresentation == null) { throw new NullPointerException( "fieldRepresentation is null, must init before " + - "invoking installUIs method..."); + "invoking installUIs method..."); } if (uiClass == null) { @@ -403,7 +404,7 @@ public class SwingValidator<B> extends SimpleBeanValidator<B> { InstantiationException, NoSuchMethodException { - Preconditions.checkNotNull(c, "No editor"); + Objects.requireNonNull(c, "No editor"); // ajout du jxlayer sous ce composant Container container = c.getParent(); diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessage.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessage.java index 18093ee..49c285d 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessage.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessage.java @@ -56,7 +56,7 @@ public class SwingValidatorMessage extends SimpleBeanValidatorMessage<SwingValid @Override public String toString() { String s = scope + " - " + - (field == null ? message : field + " - " + message); + (field == null ? message : field + " - " + message); if (editor != null) { s = editor.getName() + " : " + s; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListModel.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListModel.java index 9c07f6f..285d935 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListModel.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListModel.java @@ -67,7 +67,7 @@ public class SwingValidatorMessageListModel if (validators.contains(validator)) { throw new IllegalArgumentException( "the validator " + validator + " is already registred in " - + this); + + this); } validators.add(validator); validator.addSimpleBeanValidatorListener(this); @@ -126,7 +126,7 @@ public class SwingValidatorMessageListModel if (index < -1 || index >= getSize()) { throw new ArrayIndexOutOfBoundsException( "the rowIndex was " + index + ", but should be int [0," + - (getSize() - 1) + "]"); + (getSize() - 1) + "]"); } } @@ -177,9 +177,9 @@ public class SwingValidatorMessageListModel for (int i = getSize() - 1; i > -1; i--) { SwingValidatorMessage error = data.get(i); if (error.getValidator().equals(validator) && - error.getScope() == scope && - error.getField().equals(field) && - messagesToDel.contains(error.getMessage())) { + error.getScope() == scope && + error.getField().equals(field) && + messagesToDel.contains(error.getMessage())) { // remove the message data.remove(i); if (notify) { diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListMouseListener.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListMouseListener.java index e053f43..d0ff76d 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListMouseListener.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageListMouseListener.java @@ -66,8 +66,8 @@ public class SwingValidatorMessageListMouseListener extends MouseAdapter { if (!(list.getModel() instanceof SwingValidatorMessageListModel)) { if (log.isWarnEnabled()) { log.warn("model must be a " + - SwingValidatorMessageListModel.class + ", but was " + - list.getModel()); + SwingValidatorMessageListModel.class + ", but was " + + list.getModel()); } return null; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableModel.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableModel.java index c7060f5..ae28936 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableModel.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableModel.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.validator.swing; -import org.nuiton.jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.simple.SimpleBeanValidatorEvent; import org.nuiton.validator.bean.simple.SimpleBeanValidatorListener; @@ -82,7 +82,7 @@ public class SwingValidatorMessageTableModel if (validators.contains(validator)) { throw new IllegalArgumentException( "the validator " + validator + " is already registred in " - + this); + + this); } validators.add(validator); validator.addSimpleBeanValidatorListener(this); @@ -114,7 +114,7 @@ public class SwingValidatorMessageTableModel for (int i = getRowCount() - 1; i > -1; i--) { SwingValidatorMessage error = data.get(i); if (editor.equals(error.getEditor()) && - (scope == null || error.getScope() == scope)) { + (scope == null || error.getScope() == scope)) { // remove the message data.remove(i); fireTableRowsDeleted(i, i); @@ -249,8 +249,8 @@ public class SwingValidatorMessageTableModel String... messages) { JComponent editor = validator == null ? - null : - validator.getFieldRepresentation(fieldName); + null : + validator.getFieldRepresentation(fieldName); // add new errors for (String error : messages) { SwingValidatorMessage row = @@ -324,9 +324,9 @@ public class SwingValidatorMessageTableModel for (int i = getRowCount() - 1; i > -1; i--) { SwingValidatorMessage error = data.get(i); if (validator.equals(error.getValidator()) && - error.getScope() == scope && - error.getField().equals(fieldName) && - messagesToDel.contains(error.getMessage())) { + error.getScope() == scope && + error.getField().equals(fieldName) && + messagesToDel.contains(error.getMessage())) { // remove the message data.remove(i); if (notify) { @@ -347,8 +347,8 @@ public class SwingValidatorMessageTableModel for (int i = getRowCount() - 1; i > -1; i--) { SwingValidatorMessage error = data.get(i); if (editor.equals(error.getEditor()) && - (scope == null || error.getScope() == scope) && - error.getField().equals(fieldName)) { + (scope == null || error.getScope() == scope) && + error.getField().equals(fieldName)) { // remove the message data.remove(i); if (notify) { diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableMouseListener.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableMouseListener.java index ee4b2f9..39f2a8e 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableMouseListener.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageTableMouseListener.java @@ -82,8 +82,8 @@ public class SwingValidatorMessageTableMouseListener extends MouseAdapter { if (!(table.getModel() instanceof SwingValidatorMessageTableModel)) { if (log.isWarnEnabled()) { log.warn("model must be a " + - SwingValidatorMessageTableModel.class + - ", but was " + table.getModel()); + SwingValidatorMessageTableModel.class + + ", but was " + table.getModel()); } return null; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageWidget.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageWidget.java index 460423b..46358ae 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageWidget.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorMessageWidget.java @@ -1,4 +1,3 @@ - package org.nuiton.jaxx.validator.swing; /* @@ -23,12 +22,12 @@ package org.nuiton.jaxx.validator.swing; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.ComponentMover; -import org.nuiton.jaxx.runtime.swing.ComponentResizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTitledPanel; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.ComponentMover; +import org.nuiton.jaxx.runtime.swing.ComponentResizer; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.AbstractAction; @@ -56,8 +55,8 @@ import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import static org.nuiton.i18n.I18n.t; import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; /** * Button which opens a popup containing a table with the errors found diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorUtil.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorUtil.java index 00481dc..bec3874 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorUtil.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/SwingValidatorUtil.java @@ -23,16 +23,16 @@ package org.nuiton.jaxx.validator.swing; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.decorator.ColorHighlighter; import org.nuiton.jaxx.runtime.JAXXObject; -import org.nuiton.jaxx.validator.JAXXValidator; import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.validator.JAXXValidator; import org.nuiton.jaxx.validator.swing.meta.Validator; import org.nuiton.jaxx.validator.swing.meta.ValidatorField; import org.nuiton.jaxx.validator.swing.unified.UnifiedValidatorMessage; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; -import org.jdesktop.swingx.decorator.ColorHighlighter; import org.nuiton.util.ReflectUtil; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.list.BeanListValidator; @@ -199,7 +199,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { validatorIds.add(validatorId); if (log.isInfoEnabled()) { log.info("Detect validator [" + annotation.validatorId() + - "] on field " + field.getName()); + "] on field " + field.getName()); } } return Collections.unmodifiableList(validatorIds); @@ -243,8 +243,8 @@ public class SwingValidatorUtil extends SimpleBeanValidators { for (String propertyName : propertyNames) { if (log.isInfoEnabled()) { log.info("Detects for validator [" + validatorId + - "] property " + propertyName + - " for editor " + fieldAnnotation.editorName()); + "] property " + propertyName + + " for editor " + fieldAnnotation.editorName()); } validator.setFieldRepresentation(propertyName, editor); } @@ -267,7 +267,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { SwingValidatorMessageTableRenderer render) { errorTable.setDefaultRenderer(Object.class, render); errorTable.getRowSorter().setSortKeys( - Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + Collections.singletonList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); SwingUtil.setI18nTableHeaderRenderer( errorTable, n("validator.scope.header"), @@ -292,7 +292,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { SimpleBeanValidatorMessageTableRenderer render) { errorTable.setDefaultRenderer(Object.class, render); errorTable.getRowSorter().setSortKeys( - Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + Collections.singletonList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); SwingUtil.setI18nTableHeaderRenderer( errorTable, n("validator.scope.header"), @@ -316,7 +316,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { errorTable.setDefaultRenderer(Object.class, render); errorTable.getRowSorter().setSortKeys( - Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + Collections.singletonList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); SwingUtil.setI18nTableHeaderRenderer( errorTable, n("validator.scope.header"), @@ -555,7 +555,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { } public static String getFieldName(UnifiedValidatorMessage model, String value) { - return getFieldName(model, value, null); + return getFieldName(model, value, null); } public static String getFieldName(UnifiedValidatorMessage model, String value, String valueFallBack) { @@ -611,7 +611,7 @@ public class SwingValidatorUtil extends SimpleBeanValidators { SwingValidator<?> validator1 = (SwingValidator<?>) evt.getSource(); if (log.isInfoEnabled()) { log.info("Context name changed to [" + evt.getNewValue() + - "] for validator " + validator1.getType()); + "] for validator " + validator1.getType()); } ui.registerValidatorFields(); }; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/IconValidationUI.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/IconValidationUI.java index 15b7da6..6fea9d1 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/IconValidationUI.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/IconValidationUI.java @@ -22,8 +22,8 @@ package org.nuiton.jaxx.validator.swing.ui; import com.google.common.collect.Sets; -import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.jdesktop.jxlayer.JXLayer; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.BorderFactory; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/ImageValidationUI.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/ImageValidationUI.java index 218aabd..66a16da 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/ImageValidationUI.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/ImageValidationUI.java @@ -22,8 +22,8 @@ package org.nuiton.jaxx.validator.swing.ui; import com.google.common.collect.Sets; -import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.jdesktop.jxlayer.JXLayer; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.BorderFactory; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/TranslucentValidationUI.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/TranslucentValidationUI.java index 48f07db..0cee35d 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/TranslucentValidationUI.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/ui/TranslucentValidationUI.java @@ -21,8 +21,8 @@ */ package org.nuiton.jaxx.validator.swing.ui; -import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.jdesktop.jxlayer.JXLayer; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.validator.NuitonValidatorScope; import javax.swing.JComponent; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessage.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessage.java index 1756895..266f42e 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessage.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessage.java @@ -22,8 +22,8 @@ package org.nuiton.jaxx.validator.swing.unified; * #L% */ -import org.nuiton.jaxx.validator.swing.SwingValidator; import org.apache.commons.lang3.ObjectUtils; +import org.nuiton.jaxx.validator.swing.SwingValidator; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.AbstractValidator; @@ -31,6 +31,7 @@ import javax.swing.JComponent; import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.StringTokenizer; import static org.nuiton.i18n.I18n.t; @@ -155,9 +156,9 @@ public class UnifiedValidatorMessage implements Comparable<UnifiedValidatorMessa UnifiedValidatorMessage that = (UnifiedValidatorMessage) o; return field.equals(that.field) && - ObjectUtils.equals(bean, that.bean) && - ObjectUtils.equals(message, that.message) && - scope == that.scope; + Objects.equals(bean, that.bean) && + Objects.equals(message, that.message) && + scope == that.scope; } @Override @@ -172,8 +173,8 @@ public class UnifiedValidatorMessage implements Comparable<UnifiedValidatorMessa @Override public String toString() { String s = scope + " - " + - (field == null ? message : field + "[" + getBean() + - "] - " + message); + (field == null ? message : field + "[" + getBean() + + "] - " + message); if (editor != null) { s = editor.getName() + " : " + s; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableModel.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableModel.java index 9ad109a..984d8d1 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableModel.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableModel.java @@ -24,11 +24,11 @@ package org.nuiton.jaxx.validator.swing.unified; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.validator.swing.SwingListValidator; import org.nuiton.jaxx.validator.swing.SwingValidator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.AbstractValidator; import org.nuiton.validator.bean.list.BeanListValidator; @@ -58,9 +58,9 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { public static final String[] columnNames = {"validator.scope", - "validator.bean", - "validator.field", - "validator.message"}; + "validator.bean", + "validator.field", + "validator.message"}; public static final Class<?>[] columnClasses = {NuitonValidatorScope.class, Object.class, String.class, String.class}; @@ -92,7 +92,7 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { if (validators.contains(validator)) { throw new IllegalArgumentException( "the validator " + validator + " is already registred in " - + this); + + this); } validators.add(validator); validator.addSimpleBeanValidatorListener(getSimpleValidatorListener()); @@ -110,7 +110,7 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { Preconditions.checkState( !validators.contains(validator), "Validator " + validator + " is already registred in " - + this); + + this); validators.add(validator); validator.addBeanListValidatorListener(getListValidatorListener()); } @@ -213,8 +213,8 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { String... messages) { JComponent editor = validator == null ? - null : - validator.getFieldRepresentation(fieldName); + null : + validator.getFieldRepresentation(fieldName); // add new errors for (String error : messages) { UnifiedValidatorMessage row = @@ -329,9 +329,9 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { UnifiedValidatorMessage message = data.get(i); if (validator.equals(message.getValidator()) - && message.getScope() == scope - && message.getField().equals(fieldName) - && messagesToDel.contains(message.getMessage())) { + && message.getScope() == scope + && message.getField().equals(fieldName) + && messagesToDel.contains(message.getMessage())) { // remove the message data.remove(i); if (notify) { @@ -353,8 +353,8 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { for (int i = getRowCount() - 1; i > -1; i--) { UnifiedValidatorMessage message = data.get(i); if (editor.equals(message.getEditor()) - && (scope == null || message.getScope() == scope) - && message.getField().equals(fieldName)) { + && (scope == null || message.getScope() == scope) + && message.getField().equals(fieldName)) { // remove the message data.remove(i); if (notify) { @@ -380,10 +380,10 @@ public class UnifiedValidatorMessageTableModel extends AbstractTableModel { for (int i = getRowCount() - 1; i > -1; i--) { UnifiedValidatorMessage message = data.get(i); if (validator.equals(message.getValidator()) - && message.getScope() == scope - && message.getBean() == bean - && message.getField().equals(fieldName) - && messagesToDel.contains(message.getMessage())) { + && message.getScope() == scope + && message.getBean() == bean + && message.getField().equals(fieldName) + && messagesToDel.contains(message.getMessage())) { // remove the message data.remove(i); if (notify) { diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableMouseListener.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableMouseListener.java index d2761c7..a340521 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableMouseListener.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableMouseListener.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.validator.swing.unified; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.validator.swing.SwingListValidatorDataLocator; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.validator.swing.SwingListValidatorDataLocator; import javax.swing.JComponent; import javax.swing.JTable; @@ -114,8 +114,8 @@ public class UnifiedValidatorMessageTableMouseListener extends MouseAdapter { if (!(table.getModel() instanceof UnifiedValidatorMessageTableModel)) { if (log.isWarnEnabled()) { log.warn("model must be a " + - UnifiedValidatorMessageTableModel.class + - ", but was " + table.getModel()); + UnifiedValidatorMessageTableModel.class + + ", but was " + table.getModel()); } return null; } diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableRenderer.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableRenderer.java index aeddb16..e6b3517 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableRenderer.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageTableRenderer.java @@ -23,8 +23,8 @@ package org.nuiton.jaxx.validator.swing.unified; */ import com.google.common.collect.Maps; -import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.apache.commons.lang3.StringUtils; +import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.simple.SimpleBeanValidator; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageUtil.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageUtil.java index 5c695b3..62070b8 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageUtil.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageUtil.java @@ -35,6 +35,7 @@ import javax.swing.SortOrder; import javax.swing.table.TableModel; import java.awt.event.MouseListener; import java.util.Arrays; +import java.util.Collections; import static org.nuiton.i18n.I18n.n; @@ -57,7 +58,7 @@ public class UnifiedValidatorMessageUtil { errorTable.setDefaultRenderer(Object.class, render); errorTable.getRowSorter().setSortKeys( - Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); + Collections.singletonList(new RowSorter.SortKey(0, SortOrder.ASCENDING))); SwingUtil.setI18nTableHeaderRenderer( errorTable, diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageWidget.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageWidget.java index 9f446f8..672a71a 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageWidget.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/UnifiedValidatorMessageWidget.java @@ -22,6 +22,9 @@ package org.nuiton.jaxx.validator.swing.unified; * #L% */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTitledPanel; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.runtime.swing.ComponentMover; import org.nuiton.jaxx.runtime.swing.ComponentResizer; @@ -29,9 +32,6 @@ import org.nuiton.jaxx.validator.swing.SwingListValidatorDataLocator; import org.nuiton.jaxx.validator.swing.SwingListValidatorMessageTableRenderer; import org.nuiton.jaxx.validator.swing.SwingValidator; import org.nuiton.jaxx.validator.swing.SwingValidatorUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTitledPanel; import org.nuiton.validator.NuitonValidatorScope; import org.nuiton.validator.bean.list.BeanListValidator; diff --git a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/package-info.java b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/package-info.java index b56241c..812480d 100644 --- a/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/package-info.java +++ b/jaxx-validator/src/main/java/org/nuiton/jaxx/validator/swing/unified/package-info.java @@ -2,6 +2,7 @@ * To unify Simple and List validators. * * Created on 8/15/14. + * * @author Tony Chemit - dev@tchemit.fr * @since 2.10 */ diff --git a/jaxx-validator/src/test/resources/log4j.properties b/jaxx-validator/src/test/resources/log4j.properties index 583c7cb..ffff0a3 100644 --- a/jaxx-validator/src/test/resources/log4j.properties +++ b/jaxx-validator/src/test/resources/log4j.properties @@ -25,5 +25,4 @@ log4j.rootLogger=ERROR, stdout 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=INFO diff --git a/jaxx-validator/src/test/resources/validators.xml b/jaxx-validator/src/test/resources/validators.xml index 98dfa31..b7a57df 100644 --- a/jaxx-validator/src/test/resources/validators.xml +++ b/jaxx-validator/src/test/resources/validators.xml @@ -26,34 +26,35 @@ "-//Apache Struts//XWork Validator Config 1.0//EN" "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd"> <validators> - <!-- default validators from XWork framework --> - <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> - <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> - <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> - <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> - <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> - <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> - <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> - <validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/> - <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> - <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/> - <validator name="url" class="com.opensymphony.xwork2.validator.validators.URLValidator"/> - <validator name="visitor" class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/> - <validator name="conversion" class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/> - <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> - <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> - <validator name="conditionalvisitor" - class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/> + <!-- default validators from XWork framework --> + <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/> + <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/> + <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/> + <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/> + <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/> + <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/> + <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/> + <validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/> + <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/> + <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/> + <validator name="url" class="com.opensymphony.xwork2.validator.validators.URLValidator"/> + <validator name="visitor" class="com.opensymphony.xwork2.validator.validators.VisitorFieldValidator"/> + <validator name="conversion" class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/> + <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/> + <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/> + <validator name="conditionalvisitor" + class="com.opensymphony.xwork2.validator.validators.ConditionalVisitorFieldValidator"/> - <!-- jaxx validators --> - <validator name="collectionFieldExpression" - class="org.nuiton.validator.xwork2.field.CollectionFieldExpressionValidator"/> - <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> - <validator name="requiredFile" class="org.nuiton.validator.xwork2.field.RequiredFileFieldValidator"/> - <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> - <validator name="notExistingFile" class="org.nuiton.validator.xwork2.field.NotExistingFileFieldValidator"/> - <validator name="existingDirectory" class="org.nuiton.validator.xwork2.field.ExistingDirectoryFieldValidator"/> - <validator name="notExistingDirectory" class="org.nuiton.validator.xwork2.field.NotExistingDirectoryFieldValidator"/> - <validator name="fieldexpressionwithparams" class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> + <!-- jaxx validators --> + <validator name="collectionFieldExpression" + class="org.nuiton.validator.xwork2.field.CollectionFieldExpressionValidator"/> + <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/> + <validator name="requiredFile" class="org.nuiton.validator.xwork2.field.RequiredFileFieldValidator"/> + <validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/> + <validator name="notExistingFile" class="org.nuiton.validator.xwork2.field.NotExistingFileFieldValidator"/> + <validator name="existingDirectory" class="org.nuiton.validator.xwork2.field.ExistingDirectoryFieldValidator"/> + <validator name="notExistingDirectory" class="org.nuiton.validator.xwork2.field.NotExistingDirectoryFieldValidator"/> + <validator name="fieldexpressionwithparams" + class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/> </validators> diff --git a/jaxx-widgets-about/pom.xml b/jaxx-widgets-about/pom.xml index 0d207a0..74d89b6 100644 --- a/jaxx-widgets-about/pom.xml +++ b/jaxx-widgets-about/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUI.jaxx b/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUI.jaxx index 5f36246..7a227d1 100644 --- a/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUI.jaxx +++ b/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUI.jaxx @@ -45,7 +45,8 @@ public void display() { <JLabel id="titleLabel" visible='{getTitle() != null}' font-size='12' constraints='BorderLayout.CENTER'/> <JToolBar constraints='BorderLayout.EAST' opaque="false" borderPainted="false" floatable="false"> - <JButton id='close' actionIcon="close" toolTipText="aboutframe.close" borderPainted="false" focusable="false"/> + <JButton id='close' actionIcon="close" toolTipText="aboutframe.close" borderPainted="false" + focusable="false"/> </JToolBar> </JPanel> </cell> diff --git a/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUIBuilder.java b/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUIBuilder.java index 784fa21..bfc168d 100644 --- a/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUIBuilder.java +++ b/jaxx-widgets-about/src/main/java/org/nuiton/jaxx/widgets/about/AboutUIBuilder.java @@ -23,7 +23,6 @@ package org.nuiton.jaxx.widgets.about; */ import com.google.common.base.Charsets; -import com.google.common.base.Preconditions; import com.google.common.io.Resources; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.util.Resource; @@ -42,6 +41,7 @@ import javax.swing.SwingUtilities; import java.awt.Frame; import java.awt.event.ActionEvent; import java.io.IOException; +import java.util.Objects; import static org.nuiton.i18n.I18n.t; @@ -57,7 +57,7 @@ public class AboutUIBuilder { protected final AboutUI ui; public AboutUIBuilder(Frame parent) { - Preconditions.checkNotNull(parent); + Objects.requireNonNull(parent); this.ui = new AboutUI(parent, true); Action closeAction = new AbstractAction(CLOSE_ACTION) { diff --git a/jaxx-widgets-common/pom.xml b/jaxx-widgets-common/pom.xml index cb45845..c75603a 100644 --- a/jaxx-widgets-common/pom.xml +++ b/jaxx-widgets-common/pom.xml @@ -21,7 +21,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/DecoratorPopupHandler.java b/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/DecoratorPopupHandler.java index e2aaad8..d01ee77 100644 --- a/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/DecoratorPopupHandler.java +++ b/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/DecoratorPopupHandler.java @@ -22,10 +22,10 @@ package org.nuiton.jaxx.widgets; * #L% */ -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import javax.swing.AbstractButton; import javax.swing.ButtonGroup; diff --git a/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/MutateOnConditionalPropertyChangeListener.java b/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/MutateOnConditionalPropertyChangeListener.java index ecdd92c..c63f87f 100644 --- a/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/MutateOnConditionalPropertyChangeListener.java +++ b/jaxx-widgets-common/src/main/java/org/nuiton/jaxx/widgets/MutateOnConditionalPropertyChangeListener.java @@ -22,14 +22,14 @@ package org.nuiton.jaxx.widgets; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; +import java.util.Objects; +import java.util.function.Predicate; /** * A property change listener to mutate to a bean after a predicate was applied. @@ -52,11 +52,11 @@ public class MutateOnConditionalPropertyChangeListener<M extends ModelToBean> im private final String propertyName; - public MutateOnConditionalPropertyChangeListener(M model, Method mutator, Predicate<M> canMutatePredicate) { + public MutateOnConditionalPropertyChangeListener(M model, Method mutator, Predicate canMutatePredicate) { - Preconditions.checkNotNull(model); - Preconditions.checkNotNull(mutator); - Preconditions.checkNotNull(canMutatePredicate); + Objects.requireNonNull(model); + Objects.requireNonNull(mutator); + Objects.requireNonNull(canMutatePredicate); this.model = model; this.mutator = mutator; @@ -68,7 +68,7 @@ public class MutateOnConditionalPropertyChangeListener<M extends ModelToBean> im @Override public void propertyChange(PropertyChangeEvent evt) { - if (canMutatePredicate.apply(model)) { + if (canMutatePredicate.test(model)) { Object newValue = evt.getNewValue(); diff --git a/jaxx-widgets-common/src/test/resources/log4j.properties b/jaxx-widgets-common/src/test/resources/log4j.properties index 3f5cb51..943c5c0 100644 --- a/jaxx-widgets-common/src/test/resources/log4j.properties +++ b/jaxx-widgets-common/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.runtime.swing=DEBUG #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-widgets-config/pom.xml b/jaxx-widgets-config/pom.xml index 3b1d733..61cbec5 100644 --- a/jaxx-widgets-config/pom.xml +++ b/jaxx-widgets-config/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> @@ -102,7 +103,7 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> - + <dependency> <groupId>commons-beanutils</groupId> diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUI.jaxx b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUI.jaxx index 2161cd1..28c495f 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUI.jaxx +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUI.jaxx @@ -32,8 +32,8 @@ </script> <ConfigCallBackUIHandler - id='handler' - initializer='getContextValue(ConfigCallBackUIHandler.class)'/> + id='handler' + initializer='getContextValue(ConfigCallBackUIHandler.class)'/> <JScrollPane constraints='BorderLayout.CENTER' columnHeaderView='{treeHeader}'> diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUIHandler.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUIHandler.java index 2789189..88836fc 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUIHandler.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCallBackUIHandler.java @@ -22,12 +22,13 @@ package org.nuiton.jaxx.widgets.config; * #L% */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.widgets.config.model.CallBackEntry; import org.nuiton.jaxx.widgets.config.model.CallBackMap; import org.nuiton.jaxx.widgets.config.model.OptionModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.JLabel; import javax.swing.JTree; @@ -172,10 +173,7 @@ public class ConfigCallBackUIHandler { SwingUtilities.invokeLater(() -> { - List<CallBackEntry> callBacks; - callBacks = ui.getContextValue( - List.class, - ConfigUIHandler.CALLBACKS); + List<CallBackEntry> callBacks = JAXXUtil.<CallBackEntry>newListContextEntryDef(ConfigUIHandler.CALLBACKS).getContextValue(ui); for (CallBackEntry e : callBacks) { if (log.isInfoEnabled()) { log.info("launch callBack " + t(e.getDescription())); diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUI.jaxx b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUI.jaxx index 39e64cf..ea071b2 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUI.jaxx +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUI.jaxx @@ -81,7 +81,7 @@ void $afterCompleteSetup() { </JPanel> <JPopupMenu id='tablePopup'> - <JMenuItem id='copyCellValue' onActionPerformed='handler.copyCellValue()'/> - <JMenuItem id='resetOptionValue' onActionPerformed='handler.resetOptionValue()'/> + <JMenuItem id='copyCellValue' onActionPerformed='handler.copyCellValue()'/> + <JMenuItem id='resetOptionValue' onActionPerformed='handler.resetOptionValue()'/> </JPopupMenu> </JPanel> diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUIHandler.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUIHandler.java index 9053154..586dd6e 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUIHandler.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigCategoryUIHandler.java @@ -22,16 +22,16 @@ package org.nuiton.jaxx.widgets.config; * #L% */ -import org.nuiton.jaxx.runtime.JAXXUtil; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.widgets.config.model.ConfigTableModel; -import org.nuiton.jaxx.widgets.config.model.OptionModel; -import org.nuiton.jaxx.runtime.swing.renderer.ClassTableCellRenderer; -import org.nuiton.jaxx.runtime.swing.renderer.ColorCellRenderer; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; +import org.nuiton.jaxx.runtime.JAXXUtil; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.renderer.ClassTableCellRenderer; +import org.nuiton.jaxx.runtime.swing.renderer.ColorCellRenderer; +import org.nuiton.jaxx.widgets.config.model.ConfigTableModel; +import org.nuiton.jaxx.widgets.config.model.OptionModel; import javax.swing.JLabel; import javax.swing.JPopupMenu; diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigTableEditor.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigTableEditor.java index c0f88f2..ff67102 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigTableEditor.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigTableEditor.java @@ -24,13 +24,13 @@ package org.nuiton.jaxx.widgets.config; import com.google.common.io.Files; import org.apache.commons.lang3.StringUtils; -import org.nuiton.jaxx.widgets.config.model.ConfigTableModel; -import org.nuiton.jaxx.widgets.config.model.OptionModel; import org.nuiton.jaxx.runtime.swing.editor.ClassCellEditor; import org.nuiton.jaxx.runtime.swing.editor.ColorCellEditor; import org.nuiton.jaxx.runtime.swing.editor.EnumEditor; -import org.nuiton.jaxx.runtime.swing.editor.LocaleEditor; import org.nuiton.jaxx.runtime.swing.editor.KeyStrokeCellEditor; +import org.nuiton.jaxx.runtime.swing.editor.LocaleEditor; +import org.nuiton.jaxx.widgets.config.model.ConfigTableModel; +import org.nuiton.jaxx.widgets.config.model.OptionModel; import org.nuiton.jaxx.widgets.file.FileCellEditor; import javax.swing.DefaultCellEditor; diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHandler.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHandler.java index 7775135..fedc74a 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHandler.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHandler.java @@ -22,6 +22,8 @@ package org.nuiton.jaxx.widgets.config; * #L% */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.runtime.JAXXUtil; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.runtime.context.JAXXInitialContext; @@ -29,8 +31,6 @@ import org.nuiton.jaxx.widgets.config.model.CallBackMap; import org.nuiton.jaxx.widgets.config.model.CategoryModel; import org.nuiton.jaxx.widgets.config.model.ConfigUIModel; import org.nuiton.jaxx.widgets.config.model.OptionModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import javax.swing.AbstractAction; import javax.swing.Action; @@ -157,7 +157,7 @@ public class ConfigUIHandler { int categoryIndex = model.getCategoryIndex(defaultCategory); if (log.isDebugEnabled()) { log.debug("index of default category (" + defaultCategory + ") : " - + categoryIndex); + + categoryIndex); } categories.setSelectedIndex(categoryIndex); } @@ -265,11 +265,11 @@ public class ConfigUIHandler { // init callBackUI JAXXInitialContext context = new JAXXInitialContext(). - add(ui). - add(CALLBACKS_WITH_OPTIONS, forSaved). - add(CALLBACKS, - new ArrayList<>(forSaved.keySet())). - add(new ConfigCallBackUIHandler()); + add(ui). + add(CALLBACKS_WITH_OPTIONS, forSaved). + add(CALLBACKS, + new ArrayList<>(forSaved.keySet())). + add(new ConfigCallBackUIHandler()); if (topContainer == null) { diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHelper.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHelper.java index 11d716d..fae297d 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHelper.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/ConfigUIHelper.java @@ -22,8 +22,11 @@ package org.nuiton.jaxx.widgets.config; * #L% */ -import com.google.common.base.Preconditions; import com.google.common.base.Supplier; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.config.ApplicationConfig; +import org.nuiton.config.ConfigOptionDef; import org.nuiton.jaxx.runtime.JAXXContext; import org.nuiton.jaxx.runtime.context.JAXXInitialContext; import org.nuiton.jaxx.widgets.config.model.CallBackFinalizer; @@ -31,16 +34,13 @@ import org.nuiton.jaxx.widgets.config.model.CategoryModel; import org.nuiton.jaxx.widgets.config.model.ConfigUIModel; import org.nuiton.jaxx.widgets.config.model.ConfigUIModelBuilder; import org.nuiton.jaxx.widgets.config.model.OptionModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.config.ApplicationConfig; -import org.nuiton.config.ConfigOptionDef; import javax.swing.Icon; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.Frame; import java.io.File; +import java.util.Objects; /** * A helper to build a config ui. @@ -122,13 +122,6 @@ public class ConfigUIHelper { return modelBuilder; } - @Deprecated - public ConfigUIModelBuilder addOption(ConfigOptionDef def, String propertyName) - throws IllegalStateException, NullPointerException { - modelBuilder.addOption(def, propertyName); - return modelBuilder; - } - public ConfigUIModelBuilder setOptionPropertyName(String propertyName) throws IllegalStateException, NullPointerException { modelBuilder.setOptionPropertyName(propertyName); @@ -215,7 +208,7 @@ public class ConfigUIHelper { } public void displayUI(Frame parentUI, boolean undecorated) { - Preconditions.checkNotNull(ui, "UI was not build, use before the *buildUI* method"); + Objects.requireNonNull(ui, "UI was not build, use before the *buildUI* method"); ui.getHandler().displayUI(parentUI, undecorated); } } diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBackEntry.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBackEntry.java index 50c6178..1bc5779 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBackEntry.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBackEntry.java @@ -22,7 +22,7 @@ package org.nuiton.jaxx.widgets.config.model; * #L% */ -import javax.swing.*; +import javax.swing.Icon; import java.util.ArrayList; import java.util.List; diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBacksManager.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBacksManager.java index 080cfa7..fd8ace3 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBacksManager.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CallBacksManager.java @@ -22,7 +22,7 @@ package org.nuiton.jaxx.widgets.config.model; * #L% */ -import javax.swing.*; +import javax.swing.Icon; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -155,8 +155,8 @@ public class CallBacksManager { * @return the dictionnary of options for each callback to launch */ public CallBackMap getCallBacks(ConfigUIModel model, - boolean saved, - boolean modified) { + boolean saved, + boolean modified) { CallBackMap result = new CallBackMap(); @@ -199,14 +199,10 @@ public class CallBacksManager { for (OptionModel optionModel : category) { if (modified && optionModel.isModified() || - saved && optionModel.isSaved()) { + saved && optionModel.isSaved()) { CallBackEntry callBackEntry = getCallBack(optionModel); if (callBackEntry != null) { - List<OptionModel> models = result.get(callBackEntry); - if (models == null) { - models = new ArrayList<>(); - result.put(callBackEntry, models); - } + List<OptionModel> models = result.computeIfAbsent(callBackEntry, k -> new ArrayList<>()); models.add(optionModel); } } @@ -219,7 +215,7 @@ public class CallBacksManager { * * @param option the option * @return the first callBack (so the most important) on which the given - * option is attacjed. (can be null) + * option is attacjed. (can be null) */ protected CallBackEntry getCallBack(OptionModel option) { for (CallBackEntry callback : callbacks) { diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CategoryModel.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CategoryModel.java index 0c78fe0..3998f00 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CategoryModel.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/CategoryModel.java @@ -126,6 +126,7 @@ public class CategoryModel implements Iterable<OptionModel>, Serializable { } return result; } + public void setValue(OptionModel key, Object val) { boolean wasModified = isModified(); boolean wasValid = isValid(); diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/ConfigUIModel.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/ConfigUIModel.java index 913ad21..1734a16 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/ConfigUIModel.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/ConfigUIModel.java @@ -25,11 +25,11 @@ package org.nuiton.jaxx.widgets.config.model; import com.google.common.base.Joiner; import com.google.common.base.Supplier; import com.google.common.collect.Lists; -import org.nuiton.jaxx.runtime.JAXXUtil; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.config.ApplicationConfig; +import org.nuiton.jaxx.runtime.JAXXUtil; import javax.swing.Icon; import java.beans.PropertyChangeListener; @@ -65,6 +65,7 @@ public class ConfigUIModel implements Iterable<CategoryModel> { /** * Le fichier où sauvegarder la configuration. + * * @since 2.5.21 */ protected final File configFile; @@ -276,8 +277,8 @@ public class ConfigUIModel implements Iterable<CategoryModel> { } catch (Exception e) { throw new RuntimeException( "could not set property [" + - option.getPropertyName() + - "] with value = " + value, e); + option.getPropertyName() + + "] with value = " + value, e); } } else { diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/OptionModel.java b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/OptionModel.java index 6855b62..f96acf5 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/OptionModel.java +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/model/OptionModel.java @@ -23,11 +23,11 @@ package org.nuiton.jaxx.widgets.config.model; */ import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.ObjectUtils; import org.nuiton.config.ConfigOptionDef; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import java.util.Objects; /** * le modele d'une option de la configuration a editer. @@ -147,9 +147,9 @@ public class OptionModel implements ConfigOptionDef { public boolean isModified() { boolean result; if (isArrayType()) { - result = !ArrayUtils.isEquals(originalValue, value); + result = !Objects.deepEquals(originalValue, value); } else { - result = ObjectUtils.notEqual(originalValue, value); + result = !Objects.equals(originalValue, value); } return result; } @@ -208,7 +208,7 @@ public class OptionModel implements ConfigOptionDef { * @return decorated value * @since 2.5.14 */ - public String toString( Object value) { + public String toString(Object value) { String result; if (value == null) { result = null; diff --git a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/package.html b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/package.html index 13ab952..186532a 100644 --- a/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/package.html +++ b/jaxx-widgets-config/src/main/java/org/nuiton/jaxx/widgets/config/package.html @@ -30,10 +30,10 @@ when configuration was saved. <hr/> <ul> - <li> - ConfigUIBuilder offers you a simple way to build the ConfigUI (and his - model). - </li> + <li> + ConfigUIBuilder offers you a simple way to build the ConfigUI (and his + model). + </li> </ul> </body> </html> diff --git a/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyDelegateConfigTest.java b/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyDelegateConfigTest.java index 04cc78d..7d050d1 100644 --- a/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyDelegateConfigTest.java +++ b/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyDelegateConfigTest.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.widgets.config.model; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.editor.MyDefaultCellEditor; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.nuiton.config.ApplicationConfig; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.editor.MyDefaultCellEditor; import javax.swing.ImageIcon; import javax.swing.table.TableCellEditor; @@ -83,19 +83,19 @@ public class MyDelegateConfigTest { @Test(expected = NullPointerException.class) public void testRegisterCallbackLimitCase0() throws Exception { builder.createModel(config) - .registerCallBack(null, null, null, null); + .registerCallBack(null, null, null, null); } @Test(expected = NullPointerException.class) public void testRegisterCallbackLimitCase1() throws Exception { builder.createModel(config) - .registerCallBack("yo", null, null, null); + .registerCallBack("yo", null, null, null); } @Test(expected = NullPointerException.class) public void testRegisterCallbackLimitCase2() throws Exception { builder.createModel(config) - .registerCallBack("yo", "yo description", null, null); + .registerCallBack("yo", "yo description", null, null); } @Test(expected = NullPointerException.class) @@ -103,7 +103,7 @@ public class MyDelegateConfigTest { Runnable callback = () -> { }; builder.createModel(config) - .registerCallBack("yo", "yo description", null, callback); + .registerCallBack("yo", "yo description", null, callback); } @Test @@ -131,13 +131,13 @@ public class MyDelegateConfigTest { @Test(expected = NullPointerException.class) public void testAddCategoryLimitCase1() throws Exception { builder.createModel(config) - .addCategory(null, null); + .addCategory(null, null); } @Test(expected = NullPointerException.class) public void testAddCategoryLimitCase2() throws Exception { builder.createModel(config) - .addCategory("", null); + .addCategory("", null); } @Test @@ -161,14 +161,14 @@ public class MyDelegateConfigTest { @Test(expected = IllegalStateException.class) public void testAddOptionLimitCase1() throws Exception { builder.createModel(config) - .addOption(null); + .addOption(null); } @Test(expected = NullPointerException.class) public void testAddOptionLimitCase2() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(null); + .addCategory("cat0", "cat0 label") + .addOption(null); } @Test @@ -196,22 +196,22 @@ public class MyDelegateConfigTest { @Test(expected = IllegalStateException.class) public void testSetOptionPropertyNameLimitCase1() throws Exception { builder.createModel(config) - .setOptionPropertyName(null); + .setOptionPropertyName(null); } @Test(expected = IllegalStateException.class) public void testSetOptionPropertyNameLimitCase2() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .setOptionPropertyName(null); + .addCategory("cat0", "cat0 label") + .setOptionPropertyName(null); } @Test(expected = NullPointerException.class) public void testSetOptionPropertyNameLimitCase3() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(MyDelegateConfig.Option.LOCALE) - .setOptionPropertyName(null); + .addCategory("cat0", "cat0 label") + .addOption(MyDelegateConfig.Option.LOCALE) + .setOptionPropertyName(null); } @Test @@ -236,23 +236,23 @@ public class MyDelegateConfigTest { @Test(expected = IllegalStateException.class) public void testSetOptionEditorLimitCase1() throws Exception { builder.createModel(config) - .setOptionEditor(null); + .setOptionEditor(null); } @Test(expected = IllegalStateException.class) public void testSetOptionEditorLimitCase2() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .setOptionEditor(null); + .addCategory("cat0", "cat0 label") + .setOptionEditor(null); } @Test(expected = NullPointerException.class) public void testSetOptionEditorLimitCase3() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(MyDelegateConfig.Option.LOCALE) - .setOptionEditor(null); + .addCategory("cat0", "cat0 label") + .addOption(MyDelegateConfig.Option.LOCALE) + .setOptionEditor(null); } @Test diff --git a/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyInheritedConfigTest.java b/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyInheritedConfigTest.java index c9be420..41db540 100644 --- a/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyInheritedConfigTest.java +++ b/jaxx-widgets-config/src/test/java/org/nuiton/jaxx/widgets/config/model/MyInheritedConfigTest.java @@ -22,12 +22,11 @@ package org.nuiton.jaxx.widgets.config.model; * #L% */ -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.editor.MyDefaultCellEditor; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.nuiton.config.ApplicationConfig; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.editor.MyDefaultCellEditor; import javax.swing.ImageIcon; import javax.swing.table.TableCellEditor; @@ -55,54 +54,22 @@ public class MyInheritedConfigTest { builder = new ConfigUIModelBuilder(); } - @Test(expected = NullPointerException.class) - public void testCreateModelLimitCase0() throws Exception { - builder.createModel((ApplicationConfig) null); - } - @Test(expected = IllegalStateException.class) public void testFlushModelLimitCase0() throws Exception { builder.flushModel(); } - @Test - public void testCreateModel() throws Exception { - ConfigUIModel configModel = builder - .createModel(config) - .flushModel(); - Assert.assertNotNull(configModel); - Assert.assertNotNull(configModel.getApplicationConfig()); - } - @Test(expected = IllegalStateException.class) public void testRegisterCallbackLimitCase() throws Exception { builder.registerCallBack(null, null, null, null); } @Test(expected = NullPointerException.class) - public void testRegisterCallbackLimitCase0() throws Exception { - builder.createModel(config) - .registerCallBack(null, null, null, null); - } - - @Test(expected = NullPointerException.class) - public void testRegisterCallbackLimitCase1() throws Exception { - builder.createModel(config) - .registerCallBack("yo", null, null, null); - } - - @Test(expected = NullPointerException.class) - public void testRegisterCallbackLimitCase2() throws Exception { - builder.createModel(config) - .registerCallBack("yo", "yo description", null, null); - } - - @Test(expected = NullPointerException.class) public void testRegisterCallbackLimitCase4() throws Exception { Runnable callback = () -> { }; builder.createModel(config) - .registerCallBack("yo", "yo description", null, callback); + .registerCallBack("yo", "yo description", null, callback); } @Test @@ -129,49 +96,11 @@ public class MyInheritedConfigTest { builder.addCategory(null, null); } - @Test(expected = NullPointerException.class) - public void testAddCategoryLimitCase1() throws Exception { - builder.createModel(config) - .addCategory(null, null); - } - - @Test(expected = NullPointerException.class) - public void testAddCategoryLimitCase2() throws Exception { - builder.createModel(config) - .addCategory("", null); - } - - @Test - public void testAddCategory() throws Exception { - CategoryModel categoryModel = builder - .createModel(config) - .addCategory("cat0", "cat0 label") - .flushCategory(); - Assert.assertNotNull(categoryModel); - Assert.assertEquals("cat0", categoryModel.category); - Assert.assertEquals("cat0 label", categoryModel.categoryLabel); - Assert.assertEquals(0, categoryModel.entries.size()); - - } - @Test(expected = IllegalStateException.class) public void testAddOptionLimitCase0() throws Exception { builder.addOption(null); } - @Test(expected = IllegalStateException.class) - public void testAddOptionLimitCase1() throws Exception { - builder.createModel(config) - .addOption(null); - } - - @Test(expected = NullPointerException.class) - public void testAddOptionLimitCase2() throws Exception { - builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(null); - } - @Test public void testAddOption() throws Exception { OptionModel optionModel = builder @@ -203,16 +132,16 @@ public class MyInheritedConfigTest { @Test(expected = IllegalStateException.class) public void testSetOptionPropertyNameLimitCase2() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .setOptionPropertyName(null); + .addCategory("cat0", "cat0 label") + .setOptionPropertyName(null); } @Test(expected = NullPointerException.class) public void testSetOptionPropertyNameLimitCase3() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(MyInheritedConfig.Option.LOCALE) - .setOptionPropertyName(null); + .addCategory("cat0", "cat0 label") + .addOption(MyInheritedConfig.Option.LOCALE) + .setOptionPropertyName(null); } @Test @@ -243,27 +172,27 @@ public class MyInheritedConfigTest { @Test(expected = IllegalStateException.class) public void testSetOptionEditorLimitCase2() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .setOptionEditor(null); + .addCategory("cat0", "cat0 label") + .setOptionEditor(null); } @Test(expected = NullPointerException.class) public void testSetOptionEditorLimitCase3() throws Exception { builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(MyInheritedConfig.Option.LOCALE) - .setOptionEditor(null); + .addCategory("cat0", "cat0 label") + .addOption(MyInheritedConfig.Option.LOCALE) + .setOptionEditor(null); } @Test public void testSetOptionEditor() throws Exception { TableCellEditor cellEditor = MyDefaultCellEditor.newBooleanEditor(); OptionModel optionModel = builder.createModel(config) - .addCategory("cat0", "cat0 label") - .addOption(MyInheritedConfig.Option.LOCALE) - .setOptionEditor(cellEditor) - .flushOption(); + .addCategory("cat0", "cat0 label") + .addOption(MyInheritedConfig.Option.LOCALE) + .setOptionEditor(cellEditor) + .flushOption(); Assert.assertNotNull(optionModel); Assert.assertEquals(MyInheritedConfig.Option.LOCALE, optionModel.def); Assert.assertNull(optionModel.propertyName); diff --git a/jaxx-widgets-config/src/test/resources/log4j.properties b/jaxx-widgets-config/src/test/resources/log4j.properties index 42e5a2f..2e5e625 100644 --- a/jaxx-widgets-config/src/test/resources/log4j.properties +++ b/jaxx-widgets-config/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.swing=INFO #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-widgets-datetime/pom.xml b/jaxx-widgets-datetime/pom.xml index e32babb..323af01 100644 --- a/jaxx-widgets-datetime/pom.xml +++ b/jaxx-widgets-datetime/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateCellRenderer.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateCellRenderer.java index 7a8c3ae..8add81d 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateCellRenderer.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateCellRenderer.java @@ -21,13 +21,14 @@ */ package org.nuiton.jaxx.widgets.datetime; -import java.awt.Component; -import java.text.SimpleDateFormat; -import java.util.Date; +import org.apache.commons.lang3.StringUtils; + import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; -import org.apache.commons.lang3.StringUtils; +import java.awt.Component; +import java.text.SimpleDateFormat; +import java.util.Date; /** * @author Sylvain Lletellier diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx index 5bf05ef..e8108b1 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx @@ -71,11 +71,13 @@ public void setLabel(String label) { dateTimeLabel.setText(label); } <JPanel id='dateEditor' constraints='BorderLayout.NORTH' layout='{new BorderLayout()}'> <JLabel id='dateTimeLabel' constraints='BorderLayout.WEST'/> <JPanel constraints='BorderLayout.EAST'> - <JXDatePicker id='dayDateEditor' onActionPerformed='model.setDayDate((Date)((JXDatePicker)event.getSource()).getDate())'/> + <JXDatePicker id='dayDateEditor' + onActionPerformed='model.setDayDate((Date)((JXDatePicker)event.getSource()).getDate())'/> <JPanel id='timeDateEditor'> <JSpinner id='hourEditor' onStateChanged='handler.setHours((Date)((JSpinner)event.getSource()).getValue())'/> <JLabel id='labelH'/> - <JSpinner id='minuteEditor' onStateChanged='handler.setMinutes((Date)((JSpinner)event.getSource()).getValue())'/> + <JSpinner id='minuteEditor' + onStateChanged='handler.setMinutes((Date)((JSpinner)event.getSource()).getValue())'/> </JPanel> <JToolBar id="sliderHidorToolBar"> <HidorButton id='sliderHidor'/> diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java index 9c9ab14..a75d2fb 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java @@ -22,11 +22,9 @@ package org.nuiton.jaxx.widgets.datetime; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.MutateOnConditionalPropertyChangeListener; import org.nuiton.util.beans.BeanUtil; @@ -36,6 +34,8 @@ import java.lang.reflect.Method; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.util.Objects; +import java.util.function.Predicate; /** * Created on 9/9/14. @@ -86,7 +86,7 @@ public class DateTimeEditorHandler implements UIHandler<DateTimeEditor> { if (model.getPropertyDayDate() != null) { Method mutator = BeanUtil.getMutator(bean, model.getPropertyDayDate()); - Preconditions.checkNotNull(mutator, "could not find mutator for " + model.getPropertyDayDate()); + Objects.requireNonNull(mutator, "could not find mutator for " + model.getPropertyDayDate()); // When model day date changed, let's push it back in bean model.addPropertyChangeListener( DateTimeEditorModel.PROPERTY_DAY_DATE, @@ -97,7 +97,7 @@ public class DateTimeEditorHandler implements UIHandler<DateTimeEditor> { if (model.getPropertyTimeDate() != null) { Method mutator = BeanUtil.getMutator(bean, model.getPropertyTimeDate()); - Preconditions.checkNotNull(mutator, "could not find mutator for " + model.getPropertyTimeDate()); + Objects.requireNonNull(mutator, "could not find mutator for " + model.getPropertyTimeDate()); // When model time date changed, let's push it back in bean model.addPropertyChangeListener( @@ -109,7 +109,7 @@ public class DateTimeEditorHandler implements UIHandler<DateTimeEditor> { if (model.getPropertyDate() != null) { Method mutator = BeanUtil.getMutator(bean, model.getPropertyDate()); - Preconditions.checkNotNull(mutator, "could not find mutator for " + model.getPropertyDate()); + Objects.requireNonNull(mutator, "could not find mutator for " + model.getPropertyDate()); // When model full date changed, let's push it back in bean model.addPropertyChangeListener( diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java index 469a467..b623ca3 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java @@ -23,7 +23,7 @@ package org.nuiton.jaxx.widgets.datetime; */ import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; +import java.util.function.Predicate; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.widgets.ModelToBean; import org.nuiton.util.DateUtil; diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/ExtendedBasicDatePickerUI.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/ExtendedBasicDatePickerUI.java index faccfb8..197361c 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/ExtendedBasicDatePickerUI.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/ExtendedBasicDatePickerUI.java @@ -23,10 +23,10 @@ package org.nuiton.jaxx.widgets.datetime; import org.jdesktop.swingx.plaf.basic.BasicDatePickerUI; +import javax.swing.JButton; import java.beans.PropertyChangeSupport; import java.beans.PropertyVetoException; import java.util.Date; -import javax.swing.JButton; /** * @author Sylvain Lletellier diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditor.jaxx b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditor.jaxx index f2c5329..86af51b 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditor.jaxx +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditor.jaxx @@ -63,7 +63,8 @@ public void setLabel(String label) { timeLabel.setText(label); } <JPanel id='timeEditor'> <JSpinner id='hourEditor' onStateChanged='handler.setHours((Date)((JSpinner)event.getSource()).getValue())'/> <JLabel id='labelH'/> - <JSpinner id='minuteEditor' onStateChanged='handler.setMinutes((Date)((JSpinner)event.getSource()).getValue())'/> + <JSpinner id='minuteEditor' + onStateChanged='handler.setMinutes((Date)((JSpinner)event.getSource()).getValue())'/> </JPanel> <JToolBar id="sliderHidorToolBar"> <HidorButton id='sliderHidor'/> diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorHandler.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorHandler.java index 5aa1220..d8ca3fd 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorHandler.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorHandler.java @@ -22,11 +22,11 @@ package org.nuiton.jaxx.widgets.datetime; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import org.nuiton.jaxx.runtime.spi.UIHandler; +import java.util.Objects; +import java.util.function.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.MutateOnConditionalPropertyChangeListener; import org.nuiton.util.beans.BeanUtil; @@ -86,7 +86,7 @@ public class TimeEditorHandler implements UIHandler<TimeEditor> { if (model.getPropertyTime() != null) { Method mutator = BeanUtil.getMutator(bean, model.getPropertyTime()); - Preconditions.checkNotNull(mutator, "could not find mutator for " + model.getPropertyTime()); + Objects.requireNonNull(mutator, "could not find mutator for " + model.getPropertyTime()); // When model time date changed, let's push it back in bean model.addPropertyChangeListener( diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorModel.java b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorModel.java index 7b5ca38..64c0313 100644 --- a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorModel.java +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/TimeEditorModel.java @@ -23,7 +23,7 @@ package org.nuiton.jaxx.widgets.datetime; */ import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; +import java.util.function.Predicate; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.widgets.ModelToBean; diff --git a/jaxx-widgets-datetime/src/test/resources/log4j.properties b/jaxx-widgets-datetime/src/test/resources/log4j.properties index 5fc70b5..f6b8846 100644 --- a/jaxx-widgets-datetime/src/test/resources/log4j.properties +++ b/jaxx-widgets-datetime/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.runtime.swing=DEBUG #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-widgets-error/pom.xml b/jaxx-widgets-error/pom.xml index 003b347..9fb9009 100644 --- a/jaxx-widgets-error/pom.xml +++ b/jaxx-widgets-error/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx b/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx index f8f58ed..5c0036a 100644 --- a/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx +++ b/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUI.jaxx @@ -21,7 +21,7 @@ --> <JDialog title='errorUI.title' modal='true'> - + <import> java.awt.Frame </import> diff --git a/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUIHandler.java b/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUIHandler.java index eed15be..2e80b6b 100644 --- a/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUIHandler.java +++ b/jaxx-widgets-error/src/main/java/org/nuiton/jaxx/widgets/error/ErrorDialogUIHandler.java @@ -62,12 +62,9 @@ public class ErrorDialogUIHandler { } instance.getErrorMessage().setText(e.getMessage()); StringWriter w = new StringWriter(); - PrintWriter writer = new PrintWriter(w); - try { + try (PrintWriter writer = new PrintWriter(w)) { e.printStackTrace(writer); instance.getErrorStack().setText(w.toString()); - } finally { - writer.close(); } instance.getErrorStack().setCaretPosition(0); instance.pack(); diff --git a/jaxx-widgets-extra/pom.xml b/jaxx-widgets-extra/pom.xml index f934944..5fca174 100644 --- a/jaxx-widgets-extra/pom.xml +++ b/jaxx-widgets-extra/pom.xml @@ -1,5 +1,6 @@ <?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"> +<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> @@ -18,10 +19,10 @@ <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> - + <dependency> - <groupId>org.nuiton.i18n</groupId> - <artifactId>nuiton-i18n</artifactId> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> </dependency> <!-- cl patch is same but without system.out --> @@ -65,11 +66,12 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> </dependency> - + </dependencies> <name>JAXX :: Extra Widgets</name> - <description>Widgets graphiques utiles pour tous les développements (pour le moment sans lien avec JAXX).</description> + <description>Widgets graphiques utiles pour tous les développements (pour le moment sans lien avec JAXX). + </description> <inceptionYear>2004</inceptionYear> <properties> diff --git a/jaxx-widgets-extra/src/main/assembly/deps.xml b/jaxx-widgets-extra/src/main/assembly/deps.xml index 1ebaa07..72476a8 100644 --- a/jaxx-widgets-extra/src/main/assembly/deps.xml +++ b/jaxx-widgets-extra/src/main/assembly/deps.xml @@ -20,47 +20,47 @@ #L% --> <assembly> - <id>deps</id> - <formats> - <format>zip</format> - </formats> - <!-- This don't support SNAPSHOT --> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - <excludes> - <exclude>junit:junit</exclude> - <exclude>${artifact.groupId}:${artifact.artifactId}</exclude> - </excludes> - <scope>runtime</scope> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>target</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>*.jar</include> - </includes> - <excludes> - <exclude>*-sources.jar</exclude> - <exclude>*-javadoc.jar</exclude> - </excludes> - </fileSet> - <fileSet> - <outputDirectory>/</outputDirectory> - <includes> - <include>README*</include> - <include>LICENSE*</include> - <include>pom.xml</include> - </includes> - </fileSet> - <fileSet> - <outputDirectory>/</outputDirectory> - <directory>target/classes</directory> - <includes> - <include>THIRD-PARTY.txt</include> - </includes> - </fileSet> - </fileSets> + <id>deps</id> + <formats> + <format>zip</format> + </formats> + <!-- This don't support SNAPSHOT --> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <excludes> + <exclude>junit:junit</exclude> + <exclude>${artifact.groupId}:${artifact.artifactId}</exclude> + </excludes> + <scope>runtime</scope> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>target</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + <excludes> + <exclude>*-sources.jar</exclude> + <exclude>*-javadoc.jar</exclude> + </excludes> + </fileSet> + <fileSet> + <outputDirectory>/</outputDirectory> + <includes> + <include>README*</include> + <include>LICENSE*</include> + <include>pom.xml</include> + </includes> + </fileSet> + <fileSet> + <outputDirectory>/</outputDirectory> + <directory>target/classes</directory> + <includes> + <include>THIRD-PARTY.txt</include> + </includes> + </fileSet> + </fileSets> </assembly> diff --git a/jaxx-widgets-extra/src/main/assembly/full.xml b/jaxx-widgets-extra/src/main/assembly/full.xml index 5e4af5c..9277daa 100644 --- a/jaxx-widgets-extra/src/main/assembly/full.xml +++ b/jaxx-widgets-extra/src/main/assembly/full.xml @@ -20,49 +20,49 @@ #L% --> <assembly> - <id>full</id> - <formats> - <format>zip</format> - </formats> - <!-- This don't support SNAPSHOT --> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - <excludes> - <exclude>${artifact.groupId}:${artifact.artifactId}</exclude> - </excludes> - <scope>runtime</scope> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>target</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>*.jar</include> - </includes> - <excludes> - <exclude>*-sources.jar</exclude> - </excludes> - </fileSet> - <fileSet> - <outputDirectory>/</outputDirectory> - <includes> - <include>README*</include> - <include>LICENSE*</include> - <include>pom.xml</include> - </includes> - </fileSet> - <fileSet> - <outputDirectory>/</outputDirectory> - <directory>target/classes</directory> - <includes> - <include>THIRD-PARTY.txt</include> - </includes> - </fileSet> - <fileSet> - <directory>src</directory> - <!--useDefaultExcludes>true</useDefaultExcludes--> - </fileSet> - </fileSets> + <id>full</id> + <formats> + <format>zip</format> + </formats> + <!-- This don't support SNAPSHOT --> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <excludes> + <exclude>${artifact.groupId}:${artifact.artifactId}</exclude> + </excludes> + <scope>runtime</scope> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>target</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + <excludes> + <exclude>*-sources.jar</exclude> + </excludes> + </fileSet> + <fileSet> + <outputDirectory>/</outputDirectory> + <includes> + <include>README*</include> + <include>LICENSE*</include> + <include>pom.xml</include> + </includes> + </fileSet> + <fileSet> + <outputDirectory>/</outputDirectory> + <directory>target/classes</directory> + <includes> + <include>THIRD-PARTY.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>src</directory> + <!--useDefaultExcludes>true</useDefaultExcludes--> + </fileSet> + </fileSets> </assembly> diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java index 497487c..bee3e34 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/AboutFrame.java @@ -22,8 +22,19 @@ package org.nuiton.jaxx.widgets.extra; -import static org.nuiton.i18n.I18n.t; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.Resource; +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; import java.awt.Color; import java.awt.Component; import java.awt.Desktop; @@ -36,32 +47,20 @@ import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.Resource; +import static org.nuiton.i18n.I18n.t; /** * About windows. - * + * * Can't set : - * - top image - * - about tab - * - license tab (optionnal) - * + * - top image + * - about tab + * - license tab (optionnal) + * * @author chatellier * @version $Revision$ - * - * Last update : $Date$ By : $Author$ + * + * Last update : $Date$ By : $Author$ */ public class AboutFrame extends JFrame implements ActionListener, HyperlinkListener { @@ -81,7 +80,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Constructor. - * + * * Build UI. */ public AboutFrame() { @@ -93,7 +92,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Set about text. - * + * * @param aboutHtmlText the aboutHtmlText to set */ public void setAboutHtmlText(String aboutHtmlText) { @@ -102,7 +101,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Set licence text. - * + * * @param licenseText the licenseText to set */ public void setLicenseText(String licenseText) { @@ -111,7 +110,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Set icon path. - * + * * @param iconPath the iconPath to set */ public void setIconPath(String iconPath) { @@ -120,7 +119,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Set background color. - * + * * @param backgroundColor the backgroundColor to set */ public void setBackgroundColor(Color backgroundColor) { @@ -138,7 +137,7 @@ public class AboutFrame extends JFrame implements ActionListener, // top panel Component top = getTopPanel(); c.setConstraints(0, 0, 1, 1, 1, 0, Contraintes.HORIZONTAL, - Contraintes.CENTER, new Insets(1, 1, 1, 1), 0, 0); + Contraintes.CENTER, new Insets(1, 1, 1, 1), 0, 0); add(top, c); JTabbedPane tabPanel = new JTabbedPane(); @@ -154,7 +153,7 @@ public class AboutFrame extends JFrame implements ActionListener, } c.setConstraints(0, 1, 1, 1, 1, 1, Contraintes.BOTH, - Contraintes.CENTER, new Insets(0, 5, 5, 5), 0, 0); + Contraintes.CENTER, new Insets(0, 5, 5, 5), 0, 0); add(tabPanel, c); // ok button @@ -162,7 +161,7 @@ public class AboutFrame extends JFrame implements ActionListener, okButton.setActionCommand("ok"); okButton.addActionListener(this); c.setConstraints(0, 2, 1, 1, 1, 0, Contraintes.NONE, Contraintes.EAST, - new Insets(0, 5, 5, 5), 20, 0); + new Insets(0, 5, 5, 5), 20, 0); add(okButton, c); // change back color @@ -190,7 +189,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Build license tab. - * + * * @return license tab component */ protected Component getLicenseTab() { @@ -205,7 +204,7 @@ public class AboutFrame extends JFrame implements ActionListener, /** * Build about tab. - * + * * @return about tab component */ protected Component getAboutTab() { @@ -270,22 +269,22 @@ class Contraintes extends GridBagConstraints { /** * Modifie les contraintes. - * - * @param x Numéro de cellule en abscisse - * @param y Numéro de cellule en ordonnée - * @param nbx Nombre de cellules occupées en abscisse - * @param nby Nombre de cellules occupées en ordonnée - * @param wx Proportion en abscisse - * @param wy Proportion en ordonnée - * @param fill Méthode de remplissage de la cellule - * @param anchor Position dans la cellule + * + * @param x Numéro de cellule en abscisse + * @param y Numéro de cellule en ordonnée + * @param nbx Nombre de cellules occupées en abscisse + * @param nby Nombre de cellules occupées en ordonnée + * @param wx Proportion en abscisse + * @param wy Proportion en ordonnée + * @param fill Méthode de remplissage de la cellule + * @param anchor Position dans la cellule * @param espacement <tt>Insets</tt> spécifiant les espaces - * latéraux ( <tt>new Insets(haut,gauche,bas,droite)</tt>) - * @param etirx Etrirement de la cellule en abscisse - * @param etiry Etrirement de la cellule en ordonnée + * latéraux ( <tt>new Insets(haut,gauche,bas,droite)</tt>) + * @param etirx Etrirement de la cellule en abscisse + * @param etiry Etrirement de la cellule en ordonnée */ public void setConstraints(int x, int y, int nbx, int nby, int wx, int wy, - int fill, int anchor, Insets espacement, int etirx, int etiry) { + int fill, int anchor, Insets espacement, int etirx, int etiry) { this.gridx = x; this.gridy = y; this.gridwidth = nbx; diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java index 59040c6..e34baa4 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/ApplicationAction.java @@ -34,12 +34,11 @@ package org.nuiton.jaxx.widgets.extra; -import java.util.List; - import javax.swing.AbstractAction; +import java.util.List; /** - * + * */ public abstract class ApplicationAction extends AbstractAction { @@ -48,7 +47,7 @@ public abstract class ApplicationAction extends AbstractAction { private String _shortText = null; public ApplicationAction(String shortText, String description, - String iconId, char mnemonic, String accelerator) { + String iconId, char mnemonic, String accelerator) { super(description, IconFactory.getIcon(iconId)); setShortText(shortText); } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java index 94ae0da..e1ebb8b 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/CustomFocusTraversalPolicy.java @@ -35,7 +35,7 @@ import java.util.List; /** * @author cedric - * + * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ @@ -65,7 +65,7 @@ public class CustomFocusTraversalPolicy extends FocusTraversalPolicy { @Override public Component getComponentAfter(Container focusCycleRoot, - Component aComponent) { + Component aComponent) { int index = order.indexOf(aComponent); if (index != -1) { Component nextC = (Component) order.get((index + 1) % order.size()); @@ -79,11 +79,11 @@ public class CustomFocusTraversalPolicy extends FocusTraversalPolicy { @Override public Component getComponentBefore(Container focusCycleRoot, - Component aComponent) { + Component aComponent) { int index = order.indexOf(aComponent); if (index != -1) { Component nextC = (Component) order.get((index - 1 + order.size()) - % order.size()); + % order.size()); if (nextC.isEnabled()) { return nextC; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java index bd7dae6..4cc8b99 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/GridFlowLayout.java @@ -35,6 +35,7 @@ package org.nuiton.jaxx.widgets.extra; +import javax.swing.JViewport; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; @@ -43,8 +44,6 @@ import java.awt.LayoutManager2; import java.util.HashMap; import java.util.HashSet; -import javax.swing.JViewport; - /** * Ce layout place les composants de gauche à droite ou de droite à gauche selon * la valeur de {@link java.awt.Component#getComponentOrientation}. Si un @@ -53,7 +52,7 @@ import javax.swing.JViewport; * le maximum de place disponible sur la ligne. Si le container est dans un * {@link javax.swing.JViewport} (ou {@link javax.swing.JScrollPane}), ce layout * essai de ne jamais faire apparaitre le ScrollBar horizontal. - * + * * <p> * Tous les composants ont la même taille. */ @@ -73,7 +72,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * GridFlowLayout constructor - * + * * @param hgap the horizontal gap between two components * @param vgap the vertical gap between two components */ @@ -86,7 +85,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Gets the horizontal gap between components. - * + * * @return the horizontal gap between components * @see #setHgap */ @@ -96,7 +95,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Sets the horizontal gap between components. - * + * * @param hgap the horizontal gap between components * @see #getHgap */ @@ -106,7 +105,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Gets the vertical gap between components. - * + * * @return the vertical gap between components * @see #setVgap */ @@ -116,7 +115,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Sets the vertical gap between components. - * + * * @param vgap the vertical gap between components * @see #getVgap */ @@ -128,8 +127,8 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method addLayoutComponent - * - * @param comp the component to add + * + * @param comp the component to add * @param constraints a constraint which is a Number (position) */ @Override @@ -141,8 +140,8 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method setConstraints - * - * @param comp the compoenent + * + * @param comp the compoenent * @param constraints */ public void setConstraints(Component comp, Number constraints) { @@ -151,7 +150,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getConstraints - * + * * @param comp * @return a number that corresponding to the constraint */ @@ -161,7 +160,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getLayoutAlignmentX - * + * * @param target * @return the X layout alignement */ @@ -172,7 +171,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getLayoutAlignmentY - * + * * @param target * @return the Y layout alignement */ @@ -183,7 +182,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method invalidateLayout - * + * * @param target */ @Override @@ -192,7 +191,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method addLayoutComponent - * + * * @param name * @param comp */ @@ -202,7 +201,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method minimumLayoutSize - * + * * @param parent * @return the minimum dimension of the layout */ @@ -215,7 +214,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method preferredLayoutSize - * + * * @param parent * @return the preferred dimension of the layout */ @@ -259,7 +258,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method maximumLayoutSize - * + * * @param target * @return the max dimension of the layout */ @@ -270,7 +269,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method removeLayoutComponent - * + * * @param comp */ @Override @@ -280,7 +279,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method layoutContainer - * + * * @param parent */ @Override @@ -328,12 +327,12 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout int row = count / nbColumn; component.setBounds( /* on calcul la position */Math.abs(ltrNb - column) * w - /* on ajoute la marge */+ horizontalMargin - /* on ajoute les intervales */+ (2 * column + 1) * hgap, + /* on ajoute la marge */ + horizontalMargin + /* on ajoute les intervales */ + (2 * column + 1) * hgap, /* on calcul la position */row * h - /* on ajoute la marge */+ verticalMargin - /* on ajoute les intervales */+ (2 * row + 1) * vgap, + /* on ajoute la marge */ + verticalMargin + /* on ajoute les intervales */ + (2 * row + 1) * vgap, w, h); count++; @@ -346,7 +345,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getComponentVisibleCount - * + * * @param parent * @return an integer that corresponding to the number of visible components */ @@ -363,7 +362,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getMaxWidthHeight - * + * * @param parent * @return the max size */ @@ -382,7 +381,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method getMinWidthHeight - * + * * @param parent * @return the dimension of this layout */ @@ -401,7 +400,7 @@ public class GridFlowLayout implements LayoutManager2 { // GridFlowLayout /** * Method [] - * + * * @param components * @return une tablean de composants contenus dans le layout */ diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java index 680722f..9262a61 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/JComboBoxAutoCompletionKit.java @@ -34,8 +34,6 @@ package org.nuiton.jaxx.widgets.extra; -import java.awt.Component; - import javax.swing.ComboBoxModel; import javax.swing.DefaultListCellRenderer; import javax.swing.JComboBox; @@ -45,17 +43,18 @@ import javax.swing.JList; import javax.swing.ListCellRenderer; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; +import java.awt.Component; /** - * + * */ public class JComboBoxAutoCompletionKit { public static void main(String[] args) { JFrame frame = new JFrame(); - String[] petStrings = { "Bird", "Cat", "Cot", "Dog", "Dog", "Dog1", + String[] petStrings = {"Bird", "Cat", "Cot", "Dog", "Dog", "Dog1", "Dog2", "Dog3", "Dog4", "Dog5", "Dog6", "Dog7", "Dog", "Dog8", - "Dog9", "Dog10", "Rabbit", "Pig" }; + "Dog9", "Dog10", "Rabbit", "Pig"}; JComboBox combo = new JComboBox(petStrings); combo.setRenderer(new TestCellRenderer()); JComboBoxAutoCompletionKit.setAutoCompleted(combo); @@ -178,10 +177,10 @@ public class JComboBoxAutoCompletionKit { @Override public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { + int index, boolean isSelected, boolean cellHasFocus) { // Ask to default renderer to do the job for us Component component = super.getListCellRendererComponent(list, - value, index, isSelected, cellHasFocus); + value, index, isSelected, cellHasFocus); if (value != null) { // Can we trick the rendered thing to reflect current prefix ? @@ -203,23 +202,23 @@ public class JComboBoxAutoCompletionKit { DefaultListCellRenderer { private static final long serialVersionUID = 1L; - + private ListCellRenderer _existingRenderer = null; private AutoCompletionManager _manager = null; public AutoCompletionCellRenderer(AutoCompletionManager manager, - ListCellRenderer existingRenderer) { + ListCellRenderer existingRenderer) { setManager(manager); setExistingRenderer(existingRenderer); } @Override public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { + int index, boolean isSelected, boolean cellHasFocus) { // Ask to default renderer to do the job for us Component component = getExistingRenderer() .getListCellRendererComponent(list, value, index, - isSelected, cellHasFocus); + isSelected, cellHasFocus); if (value != null) { // Can we trick the rendered thing to reflect current prefix ? diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java index 4ab0281..d2bebd9 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SimpleInternalFrame.java @@ -105,7 +105,7 @@ public class SimpleInternalFrame extends JPanel { /** * Constructs a SimpleInternalFrame with the specified title. - * + * * @param title the initial title */ public SimpleInternalFrame(String title) { @@ -114,8 +114,8 @@ public class SimpleInternalFrame extends JPanel { /** * Constructs a SimpleInternalFrame with the specified icon, and title. - * - * @param icon the initial icon + * + * @param icon the initial icon * @param title the initial title */ public SimpleInternalFrame(Icon icon, String title) { @@ -125,9 +125,9 @@ public class SimpleInternalFrame extends JPanel { /** * Constructs a SimpleInternalFrame with the specified title, tool bar, and * content panel. - * - * @param title the initial title - * @param bar the initial tool bar + * + * @param title the initial title + * @param bar the initial tool bar * @param content the initial content pane */ public SimpleInternalFrame(String title, JToolBar bar, JComponent content) { @@ -137,14 +137,14 @@ public class SimpleInternalFrame extends JPanel { /** * Constructs a SimpleInternalFrame with the specified icon, title, tool * bar, and content panel. - * - * @param icon the initial icon - * @param title the initial title - * @param bar the initial tool bar + * + * @param icon the initial icon + * @param title the initial title + * @param bar the initial tool bar * @param content the initial content pane */ public SimpleInternalFrame(Icon icon, String title, JToolBar bar, - JComponent content) { + JComponent content) { super(new BorderLayout()); this.isSelected = false; this.titleLabel = new JLabel(title, icon, SwingConstants.LEADING); @@ -166,7 +166,7 @@ public class SimpleInternalFrame extends JPanel { /** * Returns the frame's icon. - * + * * @return the frame's icon */ public Icon getFrameIcon() { @@ -175,7 +175,7 @@ public class SimpleInternalFrame extends JPanel { /** * Sets a new frame icon. - * + * * @param newIcon the icon to be set */ public void setFrameIcon(Icon newIcon) { @@ -186,7 +186,7 @@ public class SimpleInternalFrame extends JPanel { /** * Returns the frame's title text. - * + * * @return String the current title text */ public String getTitle() { @@ -195,7 +195,7 @@ public class SimpleInternalFrame extends JPanel { /** * Sets a new title text. - * + * * @param newText the title text tp be set */ public void setTitle(String newText) { @@ -206,7 +206,7 @@ public class SimpleInternalFrame extends JPanel { /** * Returns the current toolbar, null if none has been set before. - * + * * @return the current toolbar - if any */ public JToolBar getToolBar() { @@ -216,7 +216,7 @@ public class SimpleInternalFrame extends JPanel { /** * Sets a new tool bar in the header. - * + * * @param newToolBar the tool bar to be set in the header */ public void setToolBar(JToolBar newToolBar) { @@ -237,7 +237,7 @@ public class SimpleInternalFrame extends JPanel { /** * Returns the content - null, if none has been set. - * + * * @return the current content */ public Component getContent() { @@ -246,7 +246,7 @@ public class SimpleInternalFrame extends JPanel { /** * Sets a new panel content; replaces any existing content, if existing. - * + * * @param newContent the panel's new content */ public void setContent(Component newContent) { @@ -262,9 +262,9 @@ public class SimpleInternalFrame extends JPanel { * Answers if the panel is currently selected (or in other words active) or * not. In the selected state, the header background will be rendered * differently. - * + * * @return boolean a boolean, where true means the frame is selected - * (currently active) and false means it is not + * (currently active) and false means it is not */ public boolean isSelected() { return isSelected; @@ -274,9 +274,9 @@ public class SimpleInternalFrame extends JPanel { * This panel draws its title bar differently if it is selected, which may * be used to indicate to the user that this panel has the focus, or should * get more attention than other simple internal frames. - * + * * @param newValue a boolean, where true means the frame is selected - * (currently active) and false means it is not + * (currently active) and false means it is not */ public void setSelected(boolean newValue) { boolean oldValue = isSelected(); @@ -297,17 +297,18 @@ public class SimpleInternalFrame extends JPanel { * g2.setPaint(storedPaint); } */ // Building ************************************************************* + /** * Creates and answers the header panel, that consists of: an icon, a title * label, a tool bar, and a gradient background. - * + * * @param label the label to paint the icon and text - * @param bar the panel's tool bar + * @param bar the panel's tool bar * @return the panel's built header area */ private JPanel buildHeader(JLabel label, JToolBar bar) { gradientPanel = new GradientPanel(new BorderLayout(), - getHeaderBackground()); + getHeaderBackground()); label.setOpaque(false); gradientPanel.add(label, BorderLayout.WEST); @@ -350,7 +351,7 @@ public class SimpleInternalFrame extends JPanel { /** * Checks and answers if the panel has a content component set. - * + * * @return true if the panel has a content, false if it's empty */ private boolean hasContent() { @@ -361,7 +362,7 @@ public class SimpleInternalFrame extends JPanel { * Determines and answers the header's text foreground color. Tries to * lookup a special color from the L&F. In case it is absent, it uses the * standard internal frame forground. - * + * * @param selected true to lookup the active color, false for the inactive * @return the color of the foreground text */ @@ -369,13 +370,13 @@ public class SimpleInternalFrame extends JPanel { // if (selected) return Color.BLUE; Color c = UIManager .getColor(selected ? "SimpleInternalFrame.activeTitleForeground" - : "SimpleInternalFrame.inactiveTitleForeground"); + : "SimpleInternalFrame.inactiveTitleForeground"); if (c != null) { return c; } return UIManager .getColor(selected ? "InternalFrame.activeTitleForeground" - : "Label.foreground"); + : "Label.foreground"); } @@ -383,7 +384,7 @@ public class SimpleInternalFrame extends JPanel { * Determines and answers the header's background color. Tries to lookup a * special color from the L&F. In case it is absent, it uses the standard * internal frame background. - * + * * @return the color of the header's background */ protected Color getHeaderBackground() { @@ -414,7 +415,7 @@ public class SimpleInternalFrame extends JPanel { @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, - int h) { + int h) { g.translate(x, y); g.setColor(UIManager.getColor("controlLtHighlight")); @@ -440,16 +441,16 @@ public class SimpleInternalFrame extends JPanel { @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, - int h) { + int h) { Color shadow = UIManager.getColor("controlShadow"); if (shadow == null) { shadow = Color.GRAY; } Color lightShadow = new Color(shadow.getRed(), shadow.getGreen(), - shadow.getBlue(), 170); + shadow.getBlue(), 170); Color lighterShadow = new Color(shadow.getRed(), shadow.getGreen(), - shadow.getBlue(), 70); + shadow.getBlue(), 70); g.translate(x, y); g.setColor(shadow); @@ -497,7 +498,7 @@ public class SimpleInternalFrame extends JPanel { Graphics2D g2 = (Graphics2D) g; Paint storedPaint = g2.getPaint(); g2.setPaint(new GradientPaint(0, 0, getBackground(), width, 0, - control)); + control)); g2.fillRect(0, 0, width, height); g2.setPaint(storedPaint); } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java index dccb340..e22bd29 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SplashScreen.java @@ -34,21 +34,33 @@ package org.nuiton.jaxx.widgets.extra; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.border.EtchedBorder; +import java.awt.AlphaComposite; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridBagConstraints; +import java.awt.Image; +import java.awt.Point; import java.net.URL; import java.util.Timer; import java.util.TimerTask; -import javax.swing.*; -import javax.swing.border.EtchedBorder; - /** * @author kmorin - morin@codelutin.com */ public class SplashScreen extends JFrame { private static final long serialVersionUID = 1L; - + // public final static long DEFAULT_DURATION = 3000; public final static long DEFAULT_REMANENCE = 5000; @@ -256,7 +268,7 @@ public class SplashScreen extends JFrame { currentAlpha -= 0.1; } setCurrentComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, - currentAlpha)); + currentAlpha)); repaint(); } @@ -304,8 +316,8 @@ public class SplashScreen extends JFrame { Composite oldComposite = g2.getComposite(); g2.setComposite(getCompositeFor(i)); g2.drawImage(image, getSteppingLeftInset() - + (steppingInset * (i + 1)) - image.getWidth(null) / 2, - steppingY, null); + + (steppingInset * (i + 1)) - image.getWidth(null) / 2, + steppingY, null); g2.setComposite(oldComposite); } } @@ -374,7 +386,7 @@ public class SplashScreen extends JFrame { splashPane = new JPanel() { private static final long serialVersionUID = 1L; - + @Override public void paint(Graphics g) { paintSplash(g); @@ -417,11 +429,11 @@ public class SplashScreen extends JFrame { new Font(Font.SERIF, Font.PLAIN, 20), new Point(20, 20), Color.WHITE); - SplashScreen f = new SplashScreen("/redGecko.jpg", title, new String[] { - "/64x64/camera.png", "/64x64/joystick.png", - "/64x64/modem.png", "/64x64/mouse.png", - "/64x64/pda.png", "/64x64/printer.png", - "/64x64/scanner.png", "/64x64/tablet.png" + SplashScreen f = new SplashScreen("/redGecko.jpg", title, new String[]{ + "/64x64/camera.png", "/64x64/joystick.png", + "/64x64/modem.png", "/64x64/mouse.png", + "/64x64/pda.png", "/64x64/printer.png", + "/64x64/scanner.png", "/64x64/tablet.png" }); try { Thread.sleep(500); diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java index 4350baf..484a6fe 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwingUtil.java @@ -34,15 +34,14 @@ package org.nuiton.jaxx.widgets.extra; +import javax.swing.JFrame; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.Window; -import javax.swing.JFrame; - /** - * + * */ public class SwingUtil { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java index d8e164d..036aa49 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/SwitchPane.java @@ -28,22 +28,21 @@ */ package org.nuiton.jaxx.widgets.extra; +import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.LayoutManager; -import javax.swing.JPanel; - /** * @author cedric - * + * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class SwitchPane extends JPanel { private static final long serialVersionUID = 1L; - + /** * Constructeur unique pour le SwitchPane */ diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java index d10891d..4c7ffe4 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/UIFSplitPane.java @@ -66,10 +66,9 @@ import java.awt.Component; * feature is not supported by all look&feels. Some look&feel * implementation will always show a divider border, and conversely, others will * never show a divider border. - * + * * @author Karsten Lentzsch * @version $Revision$ - * * @see javax.swing.plaf.basic.BasicSplitPaneUI */ @@ -80,7 +79,7 @@ public final class UIFSplitPane extends JSplitPane { /** * Holds the name of the bound property that tries to show or hide the split * pane's divider border. - * + * * @see #isDividerBorderVisible() * @see #setDividerBorderVisible(boolean) */ @@ -95,7 +94,7 @@ public final class UIFSplitPane extends JSplitPane { /** * Determines whether the divider border shall be removed when the UI is * updated. - * + * * @see #isDividerBorderVisible() * @see #setDividerBorderVisible(boolean) */ @@ -110,18 +109,18 @@ public final class UIFSplitPane extends JSplitPane { */ public UIFSplitPane() { this(JSplitPane.HORIZONTAL_SPLIT, false, new JButton(UIManager - .getString("SplitPane.leftButtonText")), new JButton(UIManager - .getString("SplitPane.rightButtonText"))); + .getString("SplitPane.leftButtonText")), new JButton(UIManager + .getString("SplitPane.rightButtonText"))); } /** * Constructs a <code>UIFSplitPane</code> configured with the specified * orientation and no continuous layout. - * + * * @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or - * <code>JSplitPane.VERTICAL_SPLIT</code> + * <code>JSplitPane.VERTICAL_SPLIT</code> * @throws IllegalArgumentException if <code>orientation</code> is not one - * of HORIZONTAL_SPLIT or VERTICAL_SPLIT. + * of HORIZONTAL_SPLIT or VERTICAL_SPLIT. */ public UIFSplitPane(int newOrientation) { this(newOrientation, false); @@ -130,14 +129,14 @@ public final class UIFSplitPane extends JSplitPane { /** * Constructs a <code>UIFSplitPane</code> with the specified orientation and * redrawing style. - * - * @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or - * <code>JSplitPane.VERTICAL_SPLIT</code> + * + * @param newOrientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or + * <code>JSplitPane.VERTICAL_SPLIT</code> * @param newContinuousLayout a boolean, true for the components to redraw - * continuously as the divider changes position, false to wait - * until the divider position stops changing to redraw + * continuously as the divider changes position, false to wait + * until the divider position stops changing to redraw * @throws IllegalArgumentException if <code>orientation</code> is not one - * of HORIZONTAL_SPLIT or VERTICAL_SPLIT + * of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public UIFSplitPane(int newOrientation, boolean newContinuousLayout) { this(newOrientation, newContinuousLayout, null, null); @@ -146,43 +145,43 @@ public final class UIFSplitPane extends JSplitPane { /** * Constructs a <code>UIFSplitPane</code> with the specified orientation and * the given componenents. - * - * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or - * <code>JSplitPane.VERTICAL_SPLIT</code> - * @param leftComponent the <code>Component</code> that will appear on the - * left of a horizontally-split pane, or at the top of a - * vertically-split pane + * + * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or + * <code>JSplitPane.VERTICAL_SPLIT</code> + * @param leftComponent the <code>Component</code> that will appear on the + * left of a horizontally-split pane, or at the top of a + * vertically-split pane * @param rightComponent the <code>Component</code> that will appear on the - * right of a horizontally-split pane, or at the bottom of a - * vertically-split pane + * right of a horizontally-split pane, or at the bottom of a + * vertically-split pane * @throws IllegalArgumentException if <code>orientation</code> is not one - * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT + * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public UIFSplitPane(int orientation, Component leftComponent, - Component rightComponent) { + Component rightComponent) { this(orientation, false, leftComponent, rightComponent); } /** * Constructs a <code>UIFSplitPane</code> with the specified orientation, * redrawing style, and given components. - * - * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or - * <code>JSplitPane.VERTICAL_SPLIT</code> + * + * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or + * <code>JSplitPane.VERTICAL_SPLIT</code> * @param continuousLayout a boolean, true for the components to redraw - * continuously as the divider changes position, false to wait - * until the divider position stops changing to redraw - * @param leftComponent the <code>Component</code> that will appear on the - * left of a horizontally-split pane, or at the top of a - * vertically-split pane - * @param rightComponent the <code>Component</code> that will appear on the - * right of a horizontally-split pane, or at the bottom of a - * vertically-split pane + * continuously as the divider changes position, false to wait + * until the divider position stops changing to redraw + * @param leftComponent the <code>Component</code> that will appear on the + * left of a horizontally-split pane, or at the top of a + * vertically-split pane + * @param rightComponent the <code>Component</code> that will appear on the + * right of a horizontally-split pane, or at the bottom of a + * vertically-split pane * @throws IllegalArgumentException if <code>orientation</code> is not one - * of HORIZONTAL_SPLIT or VERTICAL_SPLIT + * of HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public UIFSplitPane(int orientation, boolean continuousLayout, - Component leftComponent, Component rightComponent) { + Component leftComponent, Component rightComponent) { super(orientation, continuousLayout, leftComponent, rightComponent); dividerBorderVisible = false; } @@ -190,23 +189,23 @@ public final class UIFSplitPane extends JSplitPane { /** * Constructs a <code>UIFSplitPane</code>, i.e. a <code>JSplitPane</code> * that has no borders. Also disabled the one touch exandable property. - * - * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or - * <code>JSplitPane.VERTICAL_SPLIT</code> - * @param leftComponent the <code>Component</code> that will appear on the - * left of a horizontally-split pane, or at the top of a - * vertically-split pane + * + * @param orientation <code>JSplitPane.HORIZONTAL_SPLIT</code> or + * <code>JSplitPane.VERTICAL_SPLIT</code> + * @param leftComponent the <code>Component</code> that will appear on the + * left of a horizontally-split pane, or at the top of a + * vertically-split pane * @param rightComponent the <code>Component</code> that will appear on the - * right of a horizontally-split pane, or at the bottom of a - * vertically-split pane + * right of a horizontally-split pane, or at the bottom of a + * vertically-split pane * @return the constructed splitepane * @throws IllegalArgumentException if <code>orientation</code> is not one - * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT + * of: HORIZONTAL_SPLIT or VERTICAL_SPLIT */ public static UIFSplitPane createStrippedSplitPane(int orientation, - Component leftComponent, Component rightComponent) { + Component leftComponent, Component rightComponent) { UIFSplitPane split = new UIFSplitPane(orientation, leftComponent, - rightComponent); + rightComponent); split.setBorder(EMPTY_BORDER); split.setOneTouchExpandable(false); return split; @@ -219,7 +218,7 @@ public final class UIFSplitPane extends JSplitPane { * invisible. Note that this feature is not supported by all look&feels. * Some look&feel implementation will always show a divider border, and * conversely, others will never show a divider border. - * + * * @return the desired (but potentially inaccurate) divider border visiblity */ public boolean isDividerBorderVisible() { @@ -231,7 +230,7 @@ public final class UIFSplitPane extends JSplitPane { * not supported by all look&feels. Some look&feel implementation * will always show a divider border, and conversely, others will never show * a divider border. - * + * * @param newVisibility true for visible, false for invisible */ public void setDividerBorderVisible(boolean newVisibility) { @@ -241,7 +240,7 @@ public final class UIFSplitPane extends JSplitPane { } dividerBorderVisible = newVisibility; firePropertyChange(PROPERTYNAME_DIVIDER_BORDER_VISIBLE, oldVisibility, - newVisibility); + newVisibility); } // Changing the Divider Border Visibility ********************************* diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java index 4b33d97..f18e9df 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/WidgetUtil.java @@ -54,7 +54,7 @@ public class WidgetUtil { // WidgetUtil e.flush(); ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut - .toByteArray()); + .toByteArray()); d = new XMLDecoder(byteIn); return (Component) d.readObject(); diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java index 00ef7df..63027e2 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridLayout.java @@ -22,6 +22,11 @@ package org.nuiton.jaxx.widgets.extra; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.Resource; +import org.xml.sax.SAXException; + import java.awt.Component; import java.awt.Container; import java.awt.Dimension; @@ -34,11 +39,6 @@ import java.io.InputStreamReader; import java.net.URL; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.Resource; -import org.xml.sax.SAXException; - /** * XMLGridLayout uses a XML input (a string, for the time being) to define the * layout of components inside the container. To do this a set of constraints in @@ -49,7 +49,7 @@ import org.xml.sax.SAXException; * layout. <br> * Implementation Note: Internally this class uses a GridBagLayout and delegates * to it all the calculations necesary to layout the components. - * + * * @author Rafael Alvarez */ // TODO: put a test in place... Just in case @@ -87,10 +87,10 @@ public class XMLGridLayout implements LayoutManager { } protected void init(URL url) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); try { BufferedReader in = new BufferedReader(new InputStreamReader(url - .openStream())); + .openStream())); int c = -1; while ((c = in.read()) != -1) { sb.append((char) c); @@ -128,7 +128,7 @@ public class XMLGridLayout implements LayoutManager { /** * Binds a name in the layout to the specified component. If the name is not * defined in the layout an error message will be send to System.err - * + * * @param name The name in the layout to bind the component to * @param comp The component to bind to the specified name. */ @@ -141,7 +141,7 @@ public class XMLGridLayout implements LayoutManager { } else { System.err .println("(XMLGridLayout) No constraint defined for name " - + name); + + name); } } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java index b351c83..1d23d0d 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/XMLGridParseConstraints.java @@ -22,6 +22,15 @@ package org.nuiton.jaxx.widgets.extra; +import org.xml.sax.Attributes; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.helpers.XMLReaderFactory; + import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Point; @@ -32,21 +41,12 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.xml.sax.Attributes; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.helpers.XMLReaderFactory; - /** * Parses a XML input (a string, for the time being) into a Map of pairs (name, * constraint) - * + * * This class uses Apache Crimsom as the SaxParser - * + * * @author Rafael Alvarez */ class XMLGridParseConstraints extends DefaultHandler { @@ -99,7 +99,7 @@ class XMLGridParseConstraints extends DefaultHandler { } public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { + Attributes attributes) throws SAXException { if (localName.equals("td")) { handleOpenTD(attributes); } else if (localName.equals("table")) { @@ -143,10 +143,10 @@ class XMLGridParseConstraints extends DefaultHandler { if (name.equals("cellpadding")) { cellpadding = Integer.parseInt(value); // CHECK for parse - // exception + // exception } else if (name.equals("cellspacing")) { cellspacing = Integer.parseInt(value); // CHECK for parse - // exception + // exception } } } @@ -187,7 +187,7 @@ class XMLGridParseConstraints extends DefaultHandler { constraint.ipadx = cellpadding; constraint.ipady = cellpadding; constraint.insets = new Insets(cellspacing, cellspacing, cellspacing, - cellspacing); + cellspacing); contents.reset(); @@ -230,10 +230,10 @@ class XMLGridParseConstraints extends DefaultHandler { } } else if (name.equals("width")) { constraint.weightx = Double.parseDouble(value.substring(0, - value.length() - 1)) / 100; + value.length() - 1)) / 100; } else if (name.equals("height")) { constraint.weighty = Double.parseDouble(value.substring(0, - value.length() - 1)) / 100; + value.length() - 1)) / 100; } else if (name.equals("id")) { this.id = value; } @@ -266,33 +266,33 @@ class XMLGridParseConstraints extends DefaultHandler { private void handleCloseTD() { switch (anchor) { - case LEFT: - constraint.anchor = GridBagConstraints.WEST; - break; - case RIGHT: - constraint.anchor = GridBagConstraints.EAST; - break; - case CENTER: - constraint.anchor = GridBagConstraints.CENTER; - break; - case TOP: - constraint.anchor = GridBagConstraints.NORTH; - break; - case BOTTOM: - constraint.anchor = GridBagConstraints.SOUTH; - break; - case TOP | LEFT: - constraint.anchor = GridBagConstraints.NORTHWEST; - break; - case TOP | RIGHT: - constraint.anchor = GridBagConstraints.NORTHEAST; - break; - case BOTTOM | LEFT: - constraint.anchor = GridBagConstraints.SOUTHWEST; - break; - case BOTTOM | RIGHT: - constraint.anchor = GridBagConstraints.SOUTHEAST; - break; + case LEFT: + constraint.anchor = GridBagConstraints.WEST; + break; + case RIGHT: + constraint.anchor = GridBagConstraints.EAST; + break; + case CENTER: + constraint.anchor = GridBagConstraints.CENTER; + break; + case TOP: + constraint.anchor = GridBagConstraints.NORTH; + break; + case BOTTOM: + constraint.anchor = GridBagConstraints.SOUTH; + break; + case TOP | LEFT: + constraint.anchor = GridBagConstraints.NORTHWEST; + break; + case TOP | RIGHT: + constraint.anchor = GridBagConstraints.NORTHEAST; + break; + case BOTTOM | LEFT: + constraint.anchor = GridBagConstraints.SOUTHWEST; + break; + case BOTTOM | RIGHT: + constraint.anchor = GridBagConstraints.SOUTHEAST; + break; } if (this.styleMode) { styles.put(this.id, constraint); diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java index f317603..637fd4b 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipCell.java @@ -28,7 +28,8 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import java.awt.*; +import java.awt.Component; +import java.awt.Rectangle; interface DataTipCell { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java index 2639b0b..7de3b21 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipComponent.java @@ -28,8 +28,14 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.CellRendererPane; +import javax.swing.JToolTip; +import java.awt.AWTEvent; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.Shape; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; @@ -40,11 +46,11 @@ import java.awt.event.MouseWheelEvent; * if the content is instance of JToolTip. */ class DataTipComponent extends JToolTip { - private final DataTipCell cell; - private final CellRendererPane rendererPane; - private final Rectangle withoutBorderRectangle; - private final Color backgroundColor; - private boolean isHeavyWeight; + private final DataTipCell cell; + private final CellRendererPane rendererPane; + private final Rectangle withoutBorderRectangle; + private final Color backgroundColor; + private boolean isHeavyWeight; DataTipComponent(DataTipCell cell, Rectangle withoutBorderRectangle, Color backgroundColor) { this.cell = cell; diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java index 930e25e..d42b522 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipListener.java @@ -28,9 +28,14 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; -import java.awt.*; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Window; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.MouseEvent; @@ -46,21 +51,20 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis // position changes) - yet to be able to compile with 1.4 the necessary JDK 1.5 methods are called by reflection. // On JDK 1.4 the popup is just always hidden qwhen the component changes (and reshown when the user first moves // the mouse again). - private static final Class[] NO_PARAMETERS = new Class[0]; - private static final Object[] NO_ARGUMENTS = new Object[0]; - private static Class mouseInfoClass; - private static Method getPointerInfoMethod; - private static Class pointerInfoClass; - private static Method getLocationMethod; + private static final Class[] NO_PARAMETERS = new Class[0]; + private static final Object[] NO_ARGUMENTS = new Object[0]; + private static Class mouseInfoClass; + private static Method getPointerInfoMethod; + private static Class pointerInfoClass; + private static Method getLocationMethod; static { try { - mouseInfoClass = Class.forName("java.awt.MouseInfo"); - getPointerInfoMethod = mouseInfoClass.getMethod("getPointerInfo", NO_PARAMETERS); - pointerInfoClass = Class.forName("java.awt.PointerInfo"); - getLocationMethod = pointerInfoClass.getMethod("getLocation", NO_PARAMETERS); - } - catch(NoSuchMethodException | ClassNotFoundException e) { + mouseInfoClass = Class.forName("java.awt.MouseInfo"); + getPointerInfoMethod = mouseInfoClass.getMethod("getPointerInfo", NO_PARAMETERS); + pointerInfoClass = Class.forName("java.awt.PointerInfo"); + getLocationMethod = pointerInfoClass.getMethod("getLocation", NO_PARAMETERS); + } catch (NoSuchMethodException | ClassNotFoundException e) { // fine probably running on pre-1.5-JDK } } @@ -77,10 +81,10 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis /** * If the user presses a mouse button on a popup, Swing's behaviour depends on the popup type: * - lightweight popup: - * This case is handled here. Because the TipComponent.contains(int x, int y) is overriden to always return false - * Swing will dispath the event directly to the parent component. + * This case is handled here. Because the TipComponent.contains(int x, int y) is overriden to always return false + * Swing will dispath the event directly to the parent component. * - heavyweight popup: - * Swing will dispatch the event to the popup's window, which is handled in DataTipPopup. + * Swing will dispatch the event to the popup's window, which is handled in DataTipPopup. */ public void mousePressed(MouseEvent e) { //hideTip(); Can't: Double click would not work. Click count of the second click would be '1', because it would @@ -104,8 +108,8 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis } private void checkShowOrHide(MouseEvent event) { - JComponent component = (JComponent) event.getSource(); - Point mousePosition = event.getPoint(); + JComponent component = (JComponent) event.getSource(); + Point mousePosition = event.getPoint(); checkShowOrHide(component, mousePosition); } @@ -116,20 +120,20 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis return; } - DataTipCell dataTipCell = getCell(component, mousePosition); - Rectangle visRect = component.getVisibleRect(); + DataTipCell dataTipCell = getCell(component, mousePosition); + Rectangle visRect = component.getVisibleRect(); - if(!visRect.contains(mousePosition)) { + if (!visRect.contains(mousePosition)) { dataTipCell = DataTipCell.NONE; } DataTipCell currentPopupCell = getCurrentPopupCell(); - if(dataTipCell.equals(currentPopupCell)) { + if (dataTipCell.equals(currentPopupCell)) { return; } hideTip(); - if(!dataTipCell.isSet()) { + if (!dataTipCell.isSet()) { return; } @@ -137,33 +141,33 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis } private DataTipCell getCurrentPopupCell() { - if(!isTipShown()) { + if (!isTipShown()) { return DataTipCell.NONE; } return dataTipPopup.getCell(); } private DataTipPopup createPopup(JComponent component, Point mousePosition, DataTipCell dataTipCell) { - Rectangle cellBounds = dataTipCell.getCellBounds(); + Rectangle cellBounds = dataTipCell.getCellBounds(); - Rectangle visRect = component.getVisibleRect(); - Rectangle visibleCellRectangle = cellBounds.intersection(visRect); + Rectangle visRect = component.getVisibleRect(); + Rectangle visibleCellRectangle = cellBounds.intersection(visRect); if (!visibleCellRectangle.contains(mousePosition)) { return null; } - Component rendererComponent = dataTipCell.getRendererComponent(); - Dimension rendCompDim = rendererComponent.getMinimumSize(); - Rectangle rendCompBounds = new Rectangle(cellBounds.getLocation(), rendCompDim); - if(cellBounds.contains(rendCompBounds) && visRect.contains(rendCompBounds)) { + Component rendererComponent = dataTipCell.getRendererComponent(); + Dimension rendCompDim = rendererComponent.getMinimumSize(); + Rectangle rendCompBounds = new Rectangle(cellBounds.getLocation(), rendCompDim); + if (cellBounds.contains(rendCompBounds) && visRect.contains(rendCompBounds)) { return null; } - Dimension preferredSize = rendererComponent.getPreferredSize(); - Point tipPosition = cellBounds.getLocation(); - int width = Math.max(cellBounds.width, preferredSize.width); - int height = Math.max(cellBounds.height, preferredSize.height); - Dimension tipDimension = new Dimension(width, height); + Dimension preferredSize = rendererComponent.getPreferredSize(); + Point tipPosition = cellBounds.getLocation(); + int width = Math.max(cellBounds.width, preferredSize.width); + int height = Math.max(cellBounds.height, preferredSize.height); + Dimension tipDimension = new Dimension(width, height); return new DataTipPopup(component, dataTipCell, tipPosition, tipDimension); } @@ -198,24 +202,22 @@ abstract class DataTipListener extends MouseInputAdapter implements ComponentLis private void checkShowOrHide(ComponentEvent e) { JComponent component = (JComponent) e.getSource(); Point mousePosition = getCurrentMousePosition(); - if(mousePosition == null) { + if (mousePosition == null) { hideTip(); - } - else { + } else { SwingUtilities.convertPointFromScreen(mousePosition, component); checkShowOrHide(component, mousePosition); } } private static Point getCurrentMousePosition() { - if(mouseInfoClass == null) { + if (mouseInfoClass == null) { return null; } try { Object pointerInfo = getPointerInfoMethod.invoke(null, NO_ARGUMENTS); return (Point) getLocationMethod.invoke(pointerInfo, NO_ARGUMENTS); - } - catch(IllegalAccessException | InvocationTargetException e) { + } catch (IllegalAccessException | InvocationTargetException e) { // strange, but nothing I can do here } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java index 128aa88..235b650 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipManager.java @@ -28,8 +28,15 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JList; +import javax.swing.JTable; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.Window; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; @@ -42,23 +49,22 @@ import java.security.AccessControlException; * the cell bounds (e.g. table row height is too small). */ public class DataTipManager { - private static DataTipManager instance; + private static DataTipManager instance; - private final ListDataTipListener listMouseListener = new ListDataTipListener(); - private final TableDataTipListener tableMouseListener = new TableDataTipListener(); - private final TreeDataTipListener treeMouseListener = new TreeDataTipListener(); - private Component parentComponent; - private Window tipComponentWindow; - private MouseEvent lastMouseEvent; - private static boolean allowUntrustedUsage; + private final ListDataTipListener listMouseListener = new ListDataTipListener(); + private final TableDataTipListener tableMouseListener = new TableDataTipListener(); + private final TreeDataTipListener treeMouseListener = new TreeDataTipListener(); + private Component parentComponent; + private Window tipComponentWindow; + private MouseEvent lastMouseEvent; + private static boolean allowUntrustedUsage; private DataTipManager() { try { long eventMask = AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK; Toolkit.getDefaultToolkit().addAWTEventListener(new MouseEventModifier(), eventMask); - } - catch(AccessControlException e) { - if(!allowUntrustedUsage) { + } catch (AccessControlException e) { + if (!allowUntrustedUsage) { throw new RuntimeException("DataTipManager needs to run in a trusted application", e); } } @@ -72,7 +78,7 @@ public class DataTipManager { * @return the single, shared instance of the DataTipmanager */ public static synchronized DataTipManager get() { - if(instance == null) { + if (instance == null) { instance = new DataTipManager(); } return instance; @@ -80,6 +86,7 @@ public class DataTipManager { /** * Enable data tips for a list component. + * * @param list the list which should be enhanced with data tips. */ public synchronized void register(JList list) { @@ -90,6 +97,7 @@ public class DataTipManager { /** * Enable data tips for a tree component. + * * @param tree the tree which should be enhanced with data tips. */ public synchronized void register(JTree tree) { @@ -100,6 +108,7 @@ public class DataTipManager { /** * Enable data tips for a list component. + * * @param table the table which should be enhanced with data tips. */ public synchronized void register(JTable table) { @@ -115,25 +124,25 @@ public class DataTipManager { public boolean handleEventFromParentComponent(MouseEvent mouseEvent) { // filter out events that come from client explicitly calling this method, but we have already handled in awt event listener - if(mouseEvent == lastMouseEvent) { + if (mouseEvent == lastMouseEvent) { return false; } - Object source = mouseEvent.getSource(); - if(source != parentComponent) { + Object source = mouseEvent.getSource(); + if (source != parentComponent) { return false; } - int id = mouseEvent.getID(); - int x = mouseEvent.getX(); - int y = mouseEvent.getY(); - long when = mouseEvent.getWhen(); - int modifiers = mouseEvent.getModifiers(); - int clickCount = mouseEvent.getClickCount(); - boolean isPopupTrigger = mouseEvent.isPopupTrigger(); - if(id == MouseEvent.MOUSE_EXITED) { + int id = mouseEvent.getID(); + int x = mouseEvent.getX(); + int y = mouseEvent.getY(); + long when = mouseEvent.getWhen(); + int modifiers = mouseEvent.getModifiers(); + int clickCount = mouseEvent.getClickCount(); + boolean isPopupTrigger = mouseEvent.isPopupTrigger(); + if (id == MouseEvent.MOUSE_EXITED) { Point point = SwingUtilities.convertPoint(parentComponent, x, y, tipComponentWindow); - if(tipComponentWindow.contains(point)) { + if (tipComponentWindow.contains(point)) { MouseEvent newEvent = new MouseEvent(parentComponent, MouseEvent.MOUSE_MOVED, when, modifiers, - x, y, clickCount, isPopupTrigger); + x, y, clickCount, isPopupTrigger); parentComponent.dispatchEvent(newEvent); // If the datatip has been hidden as a result, then process the exit event, too, so that // e.g. tooltips will hide. @@ -145,41 +154,40 @@ public class DataTipManager { public void handleEventFromDataTipComponent(MouseEvent mouseEvent) { mouseEvent.consume(); - int id = mouseEvent.getID(); - if(id != MouseEvent.MOUSE_ENTERED) { - int x = mouseEvent.getX(); - int y = mouseEvent.getY(); - Point point = SwingUtilities.convertPoint(mouseEvent.getComponent(), x, y, parentComponent); + int id = mouseEvent.getID(); + if (id != MouseEvent.MOUSE_ENTERED) { + int x = mouseEvent.getX(); + int y = mouseEvent.getY(); + Point point = SwingUtilities.convertPoint(mouseEvent.getComponent(), x, y, parentComponent); - if(id == MouseEvent.MOUSE_EXITED && parentComponent.contains(point)) { + if (id == MouseEvent.MOUSE_EXITED && parentComponent.contains(point)) { return; } - long when = mouseEvent.getWhen(); - int modifiers = mouseEvent.getModifiers(); - int clickCount = mouseEvent.getClickCount(); - boolean isPopupTrigger = mouseEvent.isPopupTrigger(); + long when = mouseEvent.getWhen(); + int modifiers = mouseEvent.getModifiers(); + int clickCount = mouseEvent.getClickCount(); + boolean isPopupTrigger = mouseEvent.isPopupTrigger(); MouseEvent newEvent; - if(id == MouseEvent.MOUSE_WHEEL) { + if (id == MouseEvent.MOUSE_WHEEL) { MouseWheelEvent mouseWheelEvent = (MouseWheelEvent) mouseEvent; - int scrollType = mouseWheelEvent.getScrollType(); - int scrollAmount = mouseWheelEvent.getScrollAmount(); - int wheelRotation = mouseWheelEvent.getWheelRotation(); + int scrollType = mouseWheelEvent.getScrollType(); + int scrollAmount = mouseWheelEvent.getScrollAmount(); + int wheelRotation = mouseWheelEvent.getWheelRotation(); newEvent = new MouseWheelEvent(parentComponent, id, when, modifiers, point.x, point.y, - clickCount, isPopupTrigger, scrollType, scrollAmount, - wheelRotation); - } - else { + clickCount, isPopupTrigger, scrollType, scrollAmount, + wheelRotation); + } else { newEvent = new MouseEvent(parentComponent, id, when, modifiers, point.x, point.y, - clickCount, isPopupTrigger); + clickCount, isPopupTrigger); } Component parentComponentBackup = parentComponent; parentComponent.dispatchEvent(newEvent); - if(parentComponent == null && id != MouseEvent.MOUSE_EXITED) { + if (parentComponent == null && id != MouseEvent.MOUSE_EXITED) { MouseEvent exitEvent = new MouseEvent(parentComponentBackup, MouseEvent.MOUSE_EXITED, when, - modifiers, point.x, point.y, clickCount, isPopupTrigger); + modifiers, point.x, point.y, clickCount, isPopupTrigger); parentComponentBackup.dispatchEvent(exitEvent); } - if(tipComponentWindow != null && id != MouseEvent.MOUSE_MOVED) { + if (tipComponentWindow != null && id != MouseEvent.MOUSE_MOVED) { // mouse click might have changed appearance (e.g. selection color) tipComponentWindow.repaint(); } @@ -191,18 +199,17 @@ public class DataTipManager { } public void eventDispatched(AWTEvent event) { - if(tipComponentWindow == null) { + if (tipComponentWindow == null) { return; } - Object source = event.getSource(); + Object source = event.getSource(); - if(source == parentComponent) { - MouseEvent mouseEvent = (MouseEvent) event; + if (source == parentComponent) { + MouseEvent mouseEvent = (MouseEvent) event; boolean filter = handleEventFromParentComponent(mouseEvent); - if(filter) { + if (filter) { mouseEvent.consume(); - } - else { + } else { lastMouseEvent = mouseEvent; } } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java index 7fd1631..3c8a58b 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/DataTipPopup.java @@ -28,8 +28,15 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.Popup; +import javax.swing.PopupFactory; +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.GraphicsConfiguration; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Window; class DataTipPopup { private Popup popup; diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java index 98f9be4..c0df6ab 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipCell.java @@ -28,8 +28,10 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JList; +import javax.swing.ListCellRenderer; +import java.awt.Component; +import java.awt.Rectangle; class ListDataTipCell implements DataTipCell { private final JList list; @@ -57,16 +59,16 @@ class ListDataTipCell implements DataTipCell { } public boolean equals(Object o) { - if(this == o) { + if (this == o) { return true; } - if(o == null || getClass() != o.getClass()) { + if (o == null || getClass() != o.getClass()) { return false; } ListDataTipCell listDataTipCell = (ListDataTipCell) o; - if(rowIndex != listDataTipCell.rowIndex) { + if (rowIndex != listDataTipCell.rowIndex) { return false; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java index 0f00020..53ed0b9 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/ListDataTipListener.java @@ -28,16 +28,17 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JList; +import java.awt.Point; class ListDataTipListener extends DataTipListener { ListDataTipListener() { } DataTipCell getCell(JComponent component, Point point) { - JList list = (JList) component; - int index = list.locationToIndex(point); + JList list = (JList) component; + int index = list.locationToIndex(point); if (index < 0) { return DataTipCell.NONE; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java index a2826b0..a269c0b 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipCell.java @@ -28,9 +28,10 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; +import javax.swing.JTable; import javax.swing.table.TableCellRenderer; -import java.awt.*; +import java.awt.Component; +import java.awt.Rectangle; class TableDataTipCell implements DataTipCell { private final JTable table; diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java index 645e07e..e9269f7 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TableDataTipListener.java @@ -28,17 +28,18 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JTable; +import java.awt.Point; class TableDataTipListener extends DataTipListener { TableDataTipListener() { } DataTipCell getCell(JComponent component, Point point) { - JTable table = (JTable) component; - int rowIndex = table.rowAtPoint(point); - int columnIndex = table.columnAtPoint(point); + JTable table = (JTable) component; + int rowIndex = table.rowAtPoint(point); + int columnIndex = table.columnAtPoint(point); if (rowIndex < 0 || columnIndex < 0) { return DataTipCell.NONE; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java index bc16216..8adc4b2 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipCell.java @@ -28,14 +28,13 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import java.awt.Component; -import java.awt.Rectangle; - import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; +import java.awt.Component; +import java.awt.Rectangle; class TreeDataTipCell implements DataTipCell { private final JTree tree; @@ -51,7 +50,7 @@ class TreeDataTipCell implements DataTipCell { } public Rectangle getCellBounds() { - TreePath treePath = tree.getPathForRow(rowIndex); + TreePath treePath = tree.getPathForRow(rowIndex); return tree.getPathBounds(treePath); } @@ -66,7 +65,7 @@ class TreeDataTipCell implements DataTipCell { boolean isLeaf = treeModel.isLeaf(item); Component component = renderer.getTreeCellRendererComponent(tree, item, isSelected, isExpanded, isLeaf, rowIndex, hasFocus); component.setFont(tree.getFont()); - + // FIX Nimbus white foreground on white background if (isSelected) { component.setForeground(UIManager.getColor("Tree.textForeground")); @@ -76,16 +75,16 @@ class TreeDataTipCell implements DataTipCell { } public boolean equals(Object o) { - if(this == o) { + if (this == o) { return true; } - if(o == null || getClass() != o.getClass()) { + if (o == null || getClass() != o.getClass()) { return false; } TreeDataTipCell treeDataTipCell = (TreeDataTipCell) o; - if(rowIndex != treeDataTipCell.rowIndex) { + if (rowIndex != treeDataTipCell.rowIndex) { return false; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java index aca899b..8eabc1f 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/TreeDataTipListener.java @@ -28,16 +28,17 @@ */ package org.nuiton.jaxx.widgets.extra.datatips; -import javax.swing.*; -import java.awt.*; +import javax.swing.JComponent; +import javax.swing.JTree; +import java.awt.Point; class TreeDataTipListener extends DataTipListener { TreeDataTipListener() { } DataTipCell getCell(JComponent component, Point point) { - JTree tree = (JTree) component; - int rowIndex = tree.getRowForLocation(point.x, point.y); + JTree tree = (JTree) component; + int rowIndex = tree.getRowForLocation(point.x, point.y); if (rowIndex < 0) { return DataTipCell.NONE; } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java index 0e8cf47..e9960ba 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/datatips/package-info.java @@ -21,7 +21,7 @@ */ /** * Add data tips to your Swing table, tree or list. - * + * * Those classes has been copied from original project : * https://datatips.dev.java.net/ and just contains some bugfixes * for nimbus look'n'feel. diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java index 7d7755c..69591bf 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/DefaultEditor.java @@ -57,9 +57,9 @@ import java.io.Writer; /** * Default editor, can open of kind of file - * + * * behaviour: <pre>undo/redo (Ctrl-z, Shift-Ctrl-z) </pre> Scrollbar - * + * * @author poussin */ public class DefaultEditor extends JPanel implements EditorInterface, diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java index 9322e34..af4363f 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/Editor.java @@ -34,8 +34,17 @@ package org.nuiton.jaxx.widgets.extra.editor; -import static org.nuiton.i18n.I18n.t; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.swing.Action; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import javax.swing.event.CaretListener; +import javax.swing.event.DocumentListener; +import javax.swing.text.TextAction; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Event; @@ -49,17 +58,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.swing.Action; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.KeyStroke; -import javax.swing.event.CaretListener; -import javax.swing.event.DocumentListener; -import javax.swing.text.TextAction; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import static org.nuiton.i18n.I18n.t; /** * L'idee de cette editor, est qu'il ne fait rien lui meme, mais delegue a un @@ -79,7 +78,7 @@ import org.apache.commons.logging.LogFactory; * <p> * Editeur permet d'utiliser Ctrl-s pour sauver le fichier courant quel que soit * l'editeur. - * + * * @author poussin */ public class Editor extends JPanel implements EditorInterface { @@ -115,7 +114,7 @@ public class Editor extends JPanel implements EditorInterface { return name; } - public boolean isSupported(EditorSyntaxConstant ... constantsSupported) { + public boolean isSupported(EditorSyntaxConstant... constantsSupported) { for (EditorSyntaxConstant supported : constantsSupported) { if (supported.equals(this)) { return true; @@ -139,10 +138,10 @@ public class Editor extends JPanel implements EditorInterface { /** * register new editor - * + * * @param editorClassName class name of new editor * @return the new registered Editor, or null, if new editor can't be - * instanciant. + * instanciant. */ static EditorInterface addEditor(String editorClassName) { try { @@ -154,7 +153,7 @@ public class Editor extends JPanel implements EditorInterface { } catch (NoClassDefFoundError | ClassNotFoundException eee) { if (log.isDebugEnabled()) { log.debug("Can't find your editor class: " + editorClassName, - eee); + eee); } if (log.isInfoEnabled()) { log.info("Can't find your editor class: " + editorClassName); @@ -162,25 +161,25 @@ public class Editor extends JPanel implements EditorInterface { } catch (ClassCastException eee) { if (log.isDebugEnabled()) { log.debug("Your editor class is not Editor Child: " - + editorClassName, eee); + + editorClassName, eee); } if (log.isInfoEnabled()) { log.info("Your editor class is not Editor Child: " - + editorClassName); + + editorClassName); } } catch (InstantiationException eee) { if (log.isDebugEnabled()) { log.debug("Can't instanciant your Editor class: " - + editorClassName, eee); + + editorClassName, eee); } if (log.isInfoEnabled()) { log.info("Can't instanciant your Editor class: " - + editorClassName); + + editorClassName); } } catch (IllegalAccessException eee) { if (log.isDebugEnabled()) { log.debug("Can't access your Editor class: " + editorClassName, - eee); + eee); } if (log.isInfoEnabled()) { log.info("Can't access your Editor class: " + editorClassName); @@ -188,11 +187,11 @@ public class Editor extends JPanel implements EditorInterface { } catch (Exception eee) { if (log.isDebugEnabled()) { log.debug("Error during instanciation of your Editor: " - + editorClassName, eee); + + editorClassName, eee); } if (log.isInfoEnabled()) { log.info("Error during instanciation of your Editor: " - + editorClassName, eee); + + editorClassName, eee); } } return null; @@ -210,7 +209,7 @@ public class Editor extends JPanel implements EditorInterface { protected final Set<DocumentListener> documentListeners = new HashSet<>(); /** All caret listener registered on this editor */ protected final Set<CaretListener> caretListeners = new HashSet<>(); - + /** * If the edited file is modifier, before switch to other or close it, ask * the user if he want save the modification @@ -242,7 +241,7 @@ public class Editor extends JPanel implements EditorInterface { */ @Override public void setSyntax(EditorSyntaxConstant editorSyntax) { - + // No file so dont save setAskIfNotSaved(false); @@ -284,7 +283,7 @@ public class Editor extends JPanel implements EditorInterface { /** * try to find better editor for this file - * + * * @param editorSyntaxConstant type of syntaxe * @return the better editor, or Default Editor */ @@ -309,20 +308,20 @@ public class Editor extends JPanel implements EditorInterface { } catch (InstantiationException eee) { if (log.isDebugEnabled()) { log.debug("Can't instanciant your Editor class: " - + editor.getClass().getName(), eee); + + editor.getClass().getName(), eee); } if (log.isInfoEnabled()) { log.info("Can't instanciant your Editor class: " - + editor.getClass().getName()); + + editor.getClass().getName()); } } catch (IllegalAccessException eee) { if (log.isDebugEnabled()) { log.debug("Can't access your Editor class: " - + editor.getClass().getName(), eee); + + editor.getClass().getName(), eee); } if (log.isInfoEnabled()) { log.info("Can't access your Editor class: " - + editor.getClass().getName()); + + editor.getClass().getName()); } } return newEditor; @@ -355,20 +354,20 @@ public class Editor extends JPanel implements EditorInterface { } catch (InstantiationException eee) { if (log.isDebugEnabled()) { log.debug("Can't instanciant your Editor class: " - + editor.getClass().getName(), eee); + + editor.getClass().getName(), eee); } if (log.isInfoEnabled()) { log.info("Can't instanciant your Editor class: " - + editor.getClass().getName()); + + editor.getClass().getName()); } } catch (IllegalAccessException eee) { if (log.isDebugEnabled()) { log.debug("Can't access your Editor class: " - + editor.getClass().getName(), eee); + + editor.getClass().getName(), eee); } if (log.isInfoEnabled()) { log.info("Can't access your Editor class: " - + editor.getClass().getName()); + + editor.getClass().getName()); } } return newEditor; @@ -425,7 +424,7 @@ public class Editor extends JPanel implements EditorInterface { /** * Closs current file - * + * * @return the current editor */ public boolean close() { @@ -440,25 +439,25 @@ public class Editor extends JPanel implements EditorInterface { /** * ask the user to save the current opened file if necessary (current file * is modified) - * + * * @return false if user awnser Cancel, true otherwize. */ protected boolean askAndSaveOrCancel() { boolean result = true; if (isAskIfNotSaved() && getCurrentEditor().isModified()) { int val = JOptionPane.showConfirmDialog(this, - t("nuitonwidgets.editor.saveorcancel")); + t("nuitonwidgets.editor.saveorcancel")); switch (val) { - case JOptionPane.YES_OPTION: - save(); - result = true; - break; - case JOptionPane.NO_OPTION: - result = true; - break; - case JOptionPane.CANCEL_OPTION: - result = false; - break; + case JOptionPane.YES_OPTION: + save(); + result = true; + break; + case JOptionPane.NO_OPTION: + result = true; + break; + case JOptionPane.CANCEL_OPTION: + result = false; + break; } } return result; @@ -466,7 +465,7 @@ public class Editor extends JPanel implements EditorInterface { /** * Save current opened file - * + * * @return true if all is ok */ public boolean save() { @@ -477,7 +476,7 @@ public class Editor extends JPanel implements EditorInterface { /** * if return true, this editor support this file type. Default implantation * return true - * + * * @param file to check * @return if return true, this editor support this file type. */ @@ -498,7 +497,7 @@ public class Editor extends JPanel implements EditorInterface { /** * indicate if current opened file has been modified - * + * * @return true if currend file is modified */ public boolean isModified() { @@ -508,7 +507,7 @@ public class Editor extends JPanel implements EditorInterface { /** * Replace the current edited file by file passed in argument. When you * overide this method, you must call {@link #setOpenedFile(File)} - * + * * @param file the file to open * @return true if file has been opened */ @@ -529,7 +528,7 @@ public class Editor extends JPanel implements EditorInterface { /** * Replace the current edited file by file passed in argument - * + * * @param file the file to open * @return true if file has been saved and reopen with new name */ @@ -582,7 +581,7 @@ public class Editor extends JPanel implements EditorInterface { public void paste() { currentEditor.paste(); } - + @Override public void setEnabled(boolean b) { super.setEnabled(b); @@ -628,10 +627,10 @@ public class Editor extends JPanel implements EditorInterface { static class SaveAction extends TextAction { /** serialVersionUID */ private static final long serialVersionUID = 4694356772539222176L; - + /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(SaveAction.class); - + protected final Editor editor; /* Create this object with the appropriate identifier. */ @@ -642,7 +641,7 @@ public class Editor extends JPanel implements EditorInterface { /** * The operation to perform when this action is triggered. - * + * * @param e the action event */ public void actionPerformed(ActionEvent e) { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java index a840136..297eb50 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorHelper.java @@ -22,9 +22,8 @@ package org.nuiton.jaxx.widgets.extra.editor; -import java.awt.Event; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.swing.Action; import javax.swing.JEditorPane; @@ -34,9 +33,9 @@ import javax.swing.text.TextAction; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import java.awt.Event; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; /** * EditorHelper. @@ -46,8 +45,8 @@ import org.apache.commons.logging.LogFactory; * @author poussin * @version $Revision$ * - * Last update: $Date$ - * by : $Author$ + * Last update: $Date$ + * by : $Author$ */ public class EditorHelper { @@ -62,7 +61,7 @@ public class EditorHelper { Action undoAction = new UndoAction(undo); KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_Z, - Event.CTRL_MASK); + Event.CTRL_MASK); editor.getInputMap().put(key, "undo"); editor.getActionMap().put("undo", undoAction); @@ -87,10 +86,10 @@ public class EditorHelper { static class UndoAction extends TextAction { /** serialVersionUID */ private static final long serialVersionUID = 14313252664900665L; - + /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(UndoAction.class); - + protected final UndoManager undo; /* Create this object with the appropriate identifier. */ @@ -101,7 +100,7 @@ public class EditorHelper { /** * The operation to perform when this action is triggered. - * + * * @param e the action event */ public void actionPerformed(ActionEvent e) { @@ -116,13 +115,13 @@ public class EditorHelper { } static class RedoAction extends TextAction { - + /** serialVersionUID */ private static final long serialVersionUID = 5508420642118093156L; /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(RedoAction.class); - + protected final UndoManager undo; /* Create this object with the appropriate identifier. */ @@ -133,7 +132,7 @@ public class EditorHelper { /** * The operation to perform when this action is triggered. - * + * * @param e the action event */ public void actionPerformed(ActionEvent e) { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java index 4dcd992..26b8d6e 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/EditorInterface.java @@ -22,58 +22,56 @@ package org.nuiton.jaxx.widgets.extra.editor; -import java.io.File; - import javax.swing.event.CaretListener; import javax.swing.event.DocumentListener; +import java.io.File; /** * EditorInterface. - * + * * @author poussin - * - * Created: 6 août 2006 12:54:19 * + * Created: 6 août 2006 12:54:19 * @author poussin * @version $Revision$ * - * Last update: $Date$ - * by : $Author$ + * Last update: $Date$ + * by : $Author$ */ public interface EditorInterface { /** * Add document listener. - * + * * @param listener listener */ void addDocumentListener(DocumentListener listener); /** * Remove document listener. - * + * * @param listener listener */ void removeDocumentListener(DocumentListener listener); /** * Add caret listener. - * + * * @param listener listener */ void addCaretListener(CaretListener listener); /** * Remove caret listener. - * + * * @param listener listener */ void removeCaretListener(CaretListener listener); - + /** * If return true, this editor support this file type. * Default implementation return {@code true}. - * + * * @param file file to test * @return if return {@code true}, this editor support this file type. */ diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java index 9dbf4b3..b80ca3f 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/JEditEditor.java @@ -22,19 +22,6 @@ package org.nuiton.jaxx.widgets.extra.editor; -import java.awt.BorderLayout; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; - -import javax.swing.JPanel; -import javax.swing.event.CaretListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -44,14 +31,26 @@ import org.syntax.jedit.tokenmarker.JavaTokenMarker; import org.syntax.jedit.tokenmarker.TokenMarker; import org.syntax.jedit.tokenmarker.XMLTokenMarker; +import javax.swing.JPanel; +import javax.swing.event.CaretListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.BorderLayout; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; + /** * RSyntaxTextArea editor implementation. * * @author chatellier * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ + * + * Last update : $Date$ + * By : $Author$ */ public class JEditEditor extends JPanel implements EditorInterface, DocumentListener { @@ -60,14 +59,14 @@ public class JEditEditor extends JPanel implements EditorInterface, DocumentList /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(JEditEditor.class); - + protected final JEditTextArea editor; - + protected boolean isModified = false; - + public JEditEditor() { editor = new JEditTextArea(); - + setLayout(new BorderLayout()); add(editor, BorderLayout.CENTER); } @@ -103,18 +102,18 @@ public class JEditEditor extends JPanel implements EditorInterface, DocumentList @Override public boolean open(File file) { - + try { editor.getDocument().removeDocumentListener(this); - + Reader in = new BufferedReader(new FileReader(file)); // editor.read(in, file); // String text = editor.getText(); - + String text = ""; char c; int last; - + while ((last = in.read()) != -1) { c = (char) last; // on peut avoir \r\n (windows) \r (macos) \n (unix) diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java index 290c2a7..ae16bb0 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/NullEditor.java @@ -22,25 +22,24 @@ package org.nuiton.jaxx.widgets.extra.editor; -import static org.nuiton.i18n.I18n.t; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.io.File; - import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.event.CaretListener; import javax.swing.event.DocumentListener; +import java.awt.BorderLayout; +import java.awt.Font; +import java.io.File; + +import static org.nuiton.i18n.I18n.t; /** * Editor used when the have no file to edit - * + * * @author poussin * @version $Revision$ * - * Last update: $Date$ - * by : $Author$ + * Last update: $Date$ + * by : $Author$ */ public class NullEditor extends JPanel implements EditorInterface { @@ -64,12 +63,12 @@ public class NullEditor extends JPanel implements EditorInterface { @Override public void addCaretListener(CaretListener listener) { - + } @Override public void removeCaretListener(CaretListener listener) { - + } @Override @@ -88,7 +87,7 @@ public class NullEditor extends JPanel implements EditorInterface { /** * when there is no file opened, the file is not modified. - * + * * @return return false */ @Override @@ -98,7 +97,7 @@ public class NullEditor extends JPanel implements EditorInterface { /** * Do nothing, can't open file, on Null editor. - * + * * @param file the file to open * @return this */ @@ -110,7 +109,7 @@ public class NullEditor extends JPanel implements EditorInterface { /** * Do nothing, can't save file, on Null editor - * + * * @param file the file to open * @return this */ @@ -131,16 +130,16 @@ public class NullEditor extends JPanel implements EditorInterface { @Override public void copy() { - + } @Override public void cut() { - + } @Override public void paste() { - + } } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java index a8dbb43..a73f426 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/RSyntaxEditor.java @@ -22,6 +22,17 @@ package org.nuiton.jaxx.widgets.extra.editor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; +import org.fife.ui.rtextarea.RTextScrollPane; +import org.nuiton.util.FileUtil; + +import javax.swing.JPanel; +import javax.swing.event.CaretListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.io.BufferedReader; import java.io.File; @@ -33,26 +44,14 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; -import javax.swing.JPanel; -import javax.swing.event.CaretListener; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rsyntaxtextarea.SyntaxConstants; -import org.fife.ui.rtextarea.RTextScrollPane; -import org.nuiton.util.FileUtil; - /** * RSyntaxTextArea editor implementation. * * @author chatellier * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ + * + * Last update : $Date$ + * By : $Author$ */ public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentListener { @@ -61,11 +60,11 @@ public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentLi /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(RSyntaxEditor.class); - + protected final RSyntaxTextArea editor; - + protected boolean isModified = false; - + public RSyntaxEditor() { editor = new RSyntaxTextArea(); @@ -114,18 +113,18 @@ public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentLi @Override public boolean open(File file) { - + try { editor.getDocument().removeDocumentListener(this); - + Reader in = new BufferedReader(new FileReader(file)); // editor.read(in, file); // String text = editor.getText(); - + String text = ""; char c; int last; - + while ((last = in.read()) != -1) { c = (char) last; // on peut avoir \r\n (windows) \r (macos) \n (unix) @@ -144,7 +143,7 @@ public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentLi } text += c; } - + String ext = FileUtil.extension(file); if ("java".equalsIgnoreCase(ext)) { editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); @@ -216,8 +215,7 @@ public class RSyntaxEditor extends JPanel implements EditorInterface, DocumentLi if (log.isWarnEnabled()) { log.warn("Can't save file", eee); } - } - finally { + } finally { if (out != null) { try { out.close(); diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java index 208e840..7c88cd6 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/editor/SDocEditor.java @@ -22,6 +22,14 @@ package org.nuiton.jaxx.widgets.extra.editor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.FileUtil; +import sdoc.Gutter; +import sdoc.SyntaxSupport; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; import java.awt.Color; import java.io.BufferedReader; import java.io.File; @@ -30,16 +38,6 @@ import java.io.FileReader; import java.io.IOException; import java.io.Reader; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.FileUtil; - -import sdoc.Gutter; -import sdoc.SyntaxSupport; - /** * SDocEditor. * @@ -48,8 +46,8 @@ import sdoc.SyntaxSupport; * @author poussin * @version $Revision$ * - * Last update: $Date$ - * by : $Author$ + * Last update: $Date$ + * by : $Author$ */ public class SDocEditor extends DefaultEditor { @@ -63,10 +61,10 @@ public class SDocEditor extends DefaultEditor { public SDocEditor() { syntaxSupport = SyntaxSupport.getInstance(); - + // fix background to white (fix bug in nimbus) editor.setBackground(Color.WHITE); - + // if you want line numbering scrollPane.setRowHeaderView(new Gutter(editor, scrollPane)); } @@ -105,7 +103,7 @@ public class SDocEditor extends DefaultEditor { Editor.EditorSyntaxConstant.SQL, Editor.EditorSyntaxConstant.R); } - + @Override public boolean open(File file) { try { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html index 048e790..b2c6b8a 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/package.html @@ -20,7 +20,7 @@ #L% --> <html> - <body> - <h1>Nuiton-Widgets</h1> - </body> +<body> +<h1>Nuiton-Widgets</h1> +</body> </html> diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java index ccf7b60..5e0029f 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/FocusableTip.java @@ -25,6 +25,14 @@ package org.nuiton.jaxx.widgets.extra.tooltip; import org.apache.commons.lang3.StringUtils; + +import javax.swing.JComponent; +import javax.swing.SwingUtilities; +import javax.swing.ToolTipManager; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.event.HyperlinkListener; +import javax.swing.event.MouseInputAdapter; import java.awt.Component; import java.awt.ComponentOrientation; import java.awt.Dimension; @@ -40,14 +48,6 @@ import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.net.URL; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; -import javax.swing.ToolTipManager; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; -import javax.swing.event.HyperlinkListener; -import javax.swing.event.MouseInputAdapter; - /** * A focusable tool tip, similar to those found in Eclipse. The user @@ -60,88 +60,88 @@ public class FocusableTip { public static final String DUMMY_TOOL_TIP = "DUMMY"; - protected JComponent attachedComponent; - protected TipWindow tipWindow; - protected URL imageBase; - protected final AttachedComponentListener attachedComponentListener; - protected final HyperlinkListener hyperlinkListener; - protected String lastText; - protected Component lastComponent; + protected JComponent attachedComponent; + protected TipWindow tipWindow; + protected URL imageBase; + protected final AttachedComponentListener attachedComponentListener; + protected final HyperlinkListener hyperlinkListener; + protected String lastText; + protected Component lastComponent; protected final boolean showCopyContextMenu; - /** Width with default value. */ - protected int width = 320; + /** Width with default value. */ + protected int width = 320; - /** Height with default value. */ - protected int height = 250; + /** Height with default value. */ + protected int height = 250; - /** - * The screen bounds in which the mouse has to stay for the currently - * displayed tip to stay visible. - */ - protected final Rectangle tipVisibleBounds; + /** + * The screen bounds in which the mouse has to stay for the currently + * displayed tip to stay visible. + */ + protected final Rectangle tipVisibleBounds; - /** - * Margin from mouse cursor at which to draw focusable tip. - */ - protected static final int MARGIN = 10; + /** + * Margin from mouse cursor at which to draw focusable tip. + */ + protected static final int MARGIN = 10; /** * FocusableTip constructor * * @param attachedComponent component to attach */ - public FocusableTip(JComponent attachedComponent) { - this(attachedComponent, null); - } + public FocusableTip(JComponent attachedComponent) { + this(attachedComponent, null); + } /** * FocusableTip constructor * * @param attachedComponent component to attach - * @param listener hyper link listener to add + * @param listener hyper link listener to add */ - public FocusableTip(JComponent attachedComponent, HyperlinkListener listener) { - this(attachedComponent, listener, false); - } + public FocusableTip(JComponent attachedComponent, HyperlinkListener listener) { + this(attachedComponent, listener, false); + } /** * FocusableTip constructor * - * @param attachedComponent component to attach + * @param attachedComponent component to attach * @param showCopyContextMenu to show copy context menu */ - public FocusableTip(JComponent attachedComponent, boolean showCopyContextMenu) { + public FocusableTip(JComponent attachedComponent, boolean showCopyContextMenu) { this(attachedComponent, null, showCopyContextMenu); - } + } /** * FocusableTip constructor * - * @param attachedComponent component to attach - * @param listener hyper link listener to add + * @param attachedComponent component to attach + * @param listener hyper link listener to add * @param showCopyContextMenu to show copy context menu */ - public FocusableTip(JComponent attachedComponent, HyperlinkListener listener, boolean showCopyContextMenu) { - setAttachedComponent(attachedComponent); - this.hyperlinkListener = listener; - attachedComponentListener = new AttachedComponentListener(); - tipVisibleBounds = new Rectangle(); + public FocusableTip(JComponent attachedComponent, HyperlinkListener listener, boolean showCopyContextMenu) { + setAttachedComponent(attachedComponent); + this.hyperlinkListener = listener; + attachedComponentListener = new AttachedComponentListener(); + tipVisibleBounds = new Rectangle(); this.showCopyContextMenu = showCopyContextMenu; attachedComponent.setToolTipText(" "); - } - - /** - * Change tip size. - * - * @param width width - * @param height height - */ - public void setSize(int width, int height) { - this.width = width; - this.height = height; - } + } + + /** + * Change tip size. + * + * @param width width + * @param height height + */ + public void setSize(int width, int height) { + this.width = width; + this.height = height; + } /** * Get {@link TipWindow} displayed @@ -152,25 +152,25 @@ public class FocusableTip { return tipWindow; } - /** - * Compute the bounds in which the user can move the mouse without the - * tip window disappearing. - */ - protected void computeTipVisibleBounds() { - // Compute area that the mouse can move in without hiding the - // tip window. Note that Java 1.4 can only detect mouse events - // in Java windows, not globally. - Rectangle r = tipWindow.getBounds(); - Point p = r.getLocation(); - SwingUtilities.convertPointFromScreen(p, attachedComponent); - r.setLocation(p); - tipVisibleBounds.setBounds(r.x,r.y-15, r.width,r.height+15*2); - } + /** + * Compute the bounds in which the user can move the mouse without the + * tip window disappearing. + */ + protected void computeTipVisibleBounds() { + // Compute area that the mouse can move in without hiding the + // tip window. Note that Java 1.4 can only detect mouse events + // in Java windows, not globally. + Rectangle r = tipWindow.getBounds(); + Point p = r.getLocation(); + SwingUtilities.convertPointFromScreen(p, attachedComponent); + r.setLocation(p); + tipVisibleBounds.setBounds(r.x, r.y - 15, r.width, r.height + 15 * 2); + } - protected void createAndShowTipWindow(final MouseEvent e, final Component component, final String text) { + protected void createAndShowTipWindow(final MouseEvent e, final Component component, final String text) { - Window owner = SwingUtilities.getWindowAncestor(attachedComponent); + Window owner = SwingUtilities.getWindowAncestor(attachedComponent); if (component == null) { tipWindow = new TipWindow(owner, this, text); @@ -179,43 +179,43 @@ public class FocusableTip { } tipWindow.setHyperlinkListener(hyperlinkListener); - // TODO: Position tip window better (handle RTL, edges of screen, etc.). - // Wrap in an invokeLater() to work around a JEditorPane issue where it - // doesn't return its proper preferred size until after it is displayed. - // See http://forums.sun.com/thread.jspa?forumID=57&threadID=574810 - // for a discussion. - SwingUtilities.invokeLater(() -> { + // TODO: Position tip window better (handle RTL, edges of screen, etc.). + // Wrap in an invokeLater() to work around a JEditorPane issue where it + // doesn't return its proper preferred size until after it is displayed. + // See http://forums.sun.com/thread.jspa?forumID=57&threadID=574810 + // for a discussion. + SwingUtilities.invokeLater(() -> { // If a new FocusableTip is requested while another one is // *focused* and visible, the focused tip (i.e. "tipWindow") // will be disposed of. If this Runnable is run after the // dispose(), tipWindow will be null. All of this is done on // the EDT so no synchronization should be necessary. - if (tipWindow==null) { + if (tipWindow == null) { return; } // Add copy context menu -if (showCopyContextMenu && component == null) { -TipUtil.addCopyContextMenu(tipWindow); -} + if (showCopyContextMenu && component == null) { + TipUtil.addCopyContextMenu(tipWindow); + } tipWindow.fixSize(width, height); ComponentOrientation o = attachedComponent.getComponentOrientation(); Point p = e.getPoint(); SwingUtilities.convertPointToScreen(p, attachedComponent); - int x = o.isLeftToRight() ? (p.x-10) : - (p.x - tipWindow.getWidth() + MARGIN); + int x = o.isLeftToRight() ? (p.x - 10) : + (p.x - tipWindow.getWidth() + MARGIN); int y = p.y + MARGIN; // Ensure tooltip is in the window bounds. Dimension ss = tipWindow.getToolkit().getScreenSize(); x = Math.max(x, 0); - if (x+tipWindow.getWidth()>=ss.width) { + if (x + tipWindow.getWidth() >= ss.width) { x = ss.width - tipWindow.getWidth(); } - if (y+tipWindow.getHeight()>=ss.height) { // Go above cursor + if (y + tipWindow.getHeight() >= ss.height) { // Go above cursor y = p.y - tipWindow.getHeight() - MARGIN; } @@ -225,25 +225,25 @@ TipUtil.addCopyContextMenu(tipWindow); computeTipVisibleBounds(); // Do after tip is visible attachedComponentListener.install(attachedComponent); lastText = text; -lastComponent = component; + lastComponent = component; }); - } + } - /** - * Returns the base URL to use when loading images in this focusable tip. - * - * @return The base URL to use. - * @see #setImageBase(URL) - */ - public URL getImageBase() { - return imageBase; - } + /** + * Returns the base URL to use when loading images in this focusable tip. + * + * @return The base URL to use. + * @see #setImageBase(URL) + */ + public URL getImageBase() { + return imageBase; + } /* - * Returns localized text for the given key. + * Returns localized text for the given key. * * @param key The key into the resource bundle. * @return The localized text. @@ -253,176 +253,175 @@ lastComponent = component; }*/ - /** - * Disposes of the focusable tip currently displayed, if any. - */ - public void possiblyDisposeOfTipWindow() { - if (tipWindow != null) { - tipWindow.dispose(); - tipWindow = null; - attachedComponentListener.uninstall(); - tipVisibleBounds.setBounds(-1, -1, 0, 0); - lastText = null; + /** + * Disposes of the focusable tip currently displayed, if any. + */ + public void possiblyDisposeOfTipWindow() { + if (tipWindow != null) { + tipWindow.dispose(); + tipWindow = null; + attachedComponentListener.uninstall(); + tipVisibleBounds.setBounds(-1, -1, 0, 0); + lastText = null; lastComponent = null; - attachedComponent.requestFocus(); - } - } + attachedComponent.requestFocus(); + } + } - void removeListeners() { - //System.out.println("DEBUG: Removing text area listeners"); - attachedComponentListener.uninstall(); - } + void removeListeners() { + //System.out.println("DEBUG: Removing text area listeners"); + attachedComponentListener.uninstall(); + } - /** - * Sets the base URL to use when loading images in this focusable tip. - * - * @param url The base URL to use. - * @see #getImageBase() - */ - public void setImageBase(URL url) { - imageBase = url; - } + /** + * Sets the base URL to use when loading images in this focusable tip. + * + * @param url The base URL to use. + * @see #getImageBase() + */ + public void setImageBase(URL url) { + imageBase = url; + } - protected void setAttachedComponent(JComponent attachedComponent) { - this.attachedComponent = attachedComponent; - // Is okay to do multiple times. - ToolTipManager.sharedInstance().registerComponent(attachedComponent); - } + protected void setAttachedComponent(JComponent attachedComponent) { + this.attachedComponent = attachedComponent; + // Is okay to do multiple times. + ToolTipManager.sharedInstance().registerComponent(attachedComponent); + } - public void toolTipRequested(MouseEvent e, String text) { + public void toolTipRequested(MouseEvent e, String text) { - if (StringUtils.isEmpty(text)) { - possiblyDisposeOfTipWindow(); - lastText = text; - return; - } + if (StringUtils.isEmpty(text)) { + possiblyDisposeOfTipWindow(); + lastText = text; + return; + } - if (lastText==null || text.length()!=lastText.length() - || !text.equals(lastText)) { - possiblyDisposeOfTipWindow(); - createAndShowTipWindow(e, null, text); - } + if (lastText == null || text.length() != lastText.length() + || !text.equals(lastText)) { + possiblyDisposeOfTipWindow(); + createAndShowTipWindow(e, null, text); + } - } + } /* * To display specific component in toolTip * * Note : Be carfull, set toolTipText of attachedComponent.setToolTipText(FocusableTip.DUMMY_TOOL_TIP); */ - public void toolTipRequested(MouseEvent e, Component component) { - - if (component == null) { - possiblyDisposeOfTipWindow(); - lastComponent = component; - return; - } - - if (lastComponent==null || !lastComponent.equals(component)) { - possiblyDisposeOfTipWindow(); - createAndShowTipWindow(e, component, null); - } - - } - - - protected class AttachedComponentListener extends MouseInputAdapter implements - CaretListener, ComponentListener, FocusListener, KeyListener { - - public void caretUpdate(CaretEvent e) { - Object source = e.getSource(); - if (source == attachedComponent) { - possiblyDisposeOfTipWindow(); - } - } - - public void componentHidden(ComponentEvent e) { - handleComponentEvent(e); - } - - public void componentMoved(ComponentEvent e) { - handleComponentEvent(e); - } - - public void componentResized(ComponentEvent e) { - handleComponentEvent(e); - } - - public void componentShown(ComponentEvent e) { - handleComponentEvent(e); - } - - public void focusGained(FocusEvent e) { - } - - public void focusLost(FocusEvent e) { - // Only dispose of tip if it wasn't the TipWindow that was clicked - // "c" can be null, at least on OS X, so we must check that before - // calling SwingUtilities.getWindowAncestor() to guard against an - // NPE. - Component c = e.getOppositeComponent(); - boolean tipClicked = (c instanceof TipWindow) || - (c!=null && - SwingUtilities.getWindowAncestor(c) instanceof TipWindow); - if (!tipClicked) { - possiblyDisposeOfTipWindow(); - } - } - - protected void handleComponentEvent(ComponentEvent e) { - possiblyDisposeOfTipWindow(); - } - - public void install(JComponent attachedComponent) { - //attachedComponent.addCaretListener(this); - attachedComponent.addComponentListener(this); - attachedComponent.addFocusListener(this); - attachedComponent.addKeyListener(this); - attachedComponent.addMouseListener(this); - attachedComponent.addMouseMotionListener(this); - } - - public void keyPressed(KeyEvent e) { - if (e.getKeyCode()==KeyEvent.VK_ESCAPE) { - possiblyDisposeOfTipWindow(); - } - else if (e.getKeyCode()==KeyEvent.VK_F2) { - if (tipWindow!=null && !tipWindow.getFocusableWindowState()) { - tipWindow.actionPerformed(null); - e.consume(); // Don't do bookmarking stuff - } - } - } - - public void keyReleased(KeyEvent e) { - } - - public void keyTyped(KeyEvent e) { - } - - public void mouseExited(MouseEvent e) { - // possiblyDisposeOfTipWindow(); - } - - public void mouseMoved(MouseEvent e) { - if (tipVisibleBounds==null || - !tipVisibleBounds.contains(e.getPoint())) { - possiblyDisposeOfTipWindow(); - } - } - - public void uninstall() { - //attachedComponent.removeCaretListener(this); - attachedComponent.removeComponentListener(this); - attachedComponent.removeFocusListener(this); - attachedComponent.removeKeyListener(this); - attachedComponent.removeMouseListener(this); - attachedComponent.removeMouseMotionListener(this); - } - - } + public void toolTipRequested(MouseEvent e, Component component) { + + if (component == null) { + possiblyDisposeOfTipWindow(); + lastComponent = component; + return; + } + + if (lastComponent == null || !lastComponent.equals(component)) { + possiblyDisposeOfTipWindow(); + createAndShowTipWindow(e, component, null); + } + + } + + + protected class AttachedComponentListener extends MouseInputAdapter implements + CaretListener, ComponentListener, FocusListener, KeyListener { + + public void caretUpdate(CaretEvent e) { + Object source = e.getSource(); + if (source == attachedComponent) { + possiblyDisposeOfTipWindow(); + } + } + + public void componentHidden(ComponentEvent e) { + handleComponentEvent(e); + } + + public void componentMoved(ComponentEvent e) { + handleComponentEvent(e); + } + + public void componentResized(ComponentEvent e) { + handleComponentEvent(e); + } + + public void componentShown(ComponentEvent e) { + handleComponentEvent(e); + } + + public void focusGained(FocusEvent e) { + } + + public void focusLost(FocusEvent e) { + // Only dispose of tip if it wasn't the TipWindow that was clicked + // "c" can be null, at least on OS X, so we must check that before + // calling SwingUtilities.getWindowAncestor() to guard against an + // NPE. + Component c = e.getOppositeComponent(); + boolean tipClicked = (c instanceof TipWindow) || + (c != null && + SwingUtilities.getWindowAncestor(c) instanceof TipWindow); + if (!tipClicked) { + possiblyDisposeOfTipWindow(); + } + } + + protected void handleComponentEvent(ComponentEvent e) { + possiblyDisposeOfTipWindow(); + } + + public void install(JComponent attachedComponent) { + //attachedComponent.addCaretListener(this); + attachedComponent.addComponentListener(this); + attachedComponent.addFocusListener(this); + attachedComponent.addKeyListener(this); + attachedComponent.addMouseListener(this); + attachedComponent.addMouseMotionListener(this); + } + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + possiblyDisposeOfTipWindow(); + } else if (e.getKeyCode() == KeyEvent.VK_F2) { + if (tipWindow != null && !tipWindow.getFocusableWindowState()) { + tipWindow.actionPerformed(null); + e.consume(); // Don't do bookmarking stuff + } + } + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } + + public void mouseExited(MouseEvent e) { + // possiblyDisposeOfTipWindow(); + } + + public void mouseMoved(MouseEvent e) { + if (tipVisibleBounds == null || + !tipVisibleBounds.contains(e.getPoint())) { + possiblyDisposeOfTipWindow(); + } + } + + public void uninstall() { + //attachedComponent.removeCaretListener(this); + attachedComponent.removeComponentListener(this); + attachedComponent.removeFocusListener(this); + attachedComponent.removeKeyListener(this); + attachedComponent.removeMouseListener(this); + attachedComponent.removeMouseMotionListener(this); + } + + } } \ No newline at end of file diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java index 0c7c970..fb50495 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/SizeGrip.java @@ -25,6 +25,11 @@ */ package org.nuiton.jaxx.widgets.extra.tooltip; +import javax.imageio.ImageIO; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.event.MouseInputAdapter; import java.awt.Color; import java.awt.ComponentOrientation; import java.awt.Cursor; @@ -38,11 +43,6 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import javax.imageio.ImageIO; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.event.MouseInputAdapter; /** @@ -57,214 +57,210 @@ public class SizeGrip extends JPanel { private static final long serialVersionUID = 1L; /** - * The size grip to use if we're on OS X. - */ - protected Image osxSizeGrip; + * The size grip to use if we're on OS X. + */ + protected Image osxSizeGrip; - public SizeGrip() { - MouseHandler adapter = new MouseHandler(); - addMouseListener(adapter); - addMouseMotionListener(adapter); - setPreferredSize(new Dimension(16, 16)); - } + public SizeGrip() { + MouseHandler adapter = new MouseHandler(); + addMouseListener(adapter); + addMouseMotionListener(adapter); + setPreferredSize(new Dimension(16, 16)); + } - /** - * Overridden to ensure that the cursor for this component is appropriate - * for the orientation. - * - * @param o The new orientation. - */ - public void applyComponentOrientation(ComponentOrientation o) { - possiblyFixCursor(o.isLeftToRight()); - super.applyComponentOrientation(o); - } + /** + * Overridden to ensure that the cursor for this component is appropriate + * for the orientation. + * + * @param o The new orientation. + */ + public void applyComponentOrientation(ComponentOrientation o) { + possiblyFixCursor(o.isLeftToRight()); + super.applyComponentOrientation(o); + } - /** - * Creates and returns the OS X size grip image. - * - * @return The OS X size grip. - */ - protected Image createOSXSizeGrip() { - ClassLoader cl = getClass().getClassLoader(); - URL url = cl.getResource("org/fife/ui/autocomplete/osx_sizegrip.png"); - if (url==null) { - // We're not running in a jar - we may be debugging in Eclipse, - // for example - File f = new File("../AutoComplete/src/org/fife/ui/autocomplete/osx_sizegrip.png"); - if (f.isFile()) { - try { - url = f.toURI().toURL(); - } catch (MalformedURLException mue) { // Never happens - mue.printStackTrace(); - return null; - } - } - else { - return null; // Can't find resource or image file - } - } - Image image = null; - try { - image = ImageIO.read(url); - } catch (IOException ioe) { // Never happens - ioe.printStackTrace(); - } - return image; - } - - - /** - * Paints this panel. - * - * @param g The graphics context. - */ - protected void paintComponent(Graphics g) { - - super.paintComponent(g); - - Dimension dim = getSize(); - Color c1 = UIManager.getColor("Label.disabledShadow"); - Color c2 = UIManager.getColor("Label.disabledForeground"); - - if (osxSizeGrip!=null) { - g.drawImage(osxSizeGrip, dim.width-16, dim.height-16, null); - return; - } - - ComponentOrientation orientation = getComponentOrientation(); - - if (orientation.isLeftToRight()) { - int width = dim.width -= 3; - int height = dim.height -= 3; - g.setColor(c1); - g.fillRect(width-9,height-1, 3,3); - g.fillRect(width-5,height-1, 3,3); - g.fillRect(width-1,height-1, 3,3); - g.fillRect(width-5,height-5, 3,3); - g.fillRect(width-1,height-5, 3,3); - g.fillRect(width-1,height-9, 3,3); - g.setColor(c2); - g.fillRect(width-9,height-1, 2,2); - g.fillRect(width-5,height-1, 2,2); - g.fillRect(width-1,height-1, 2,2); - g.fillRect(width-5,height-5, 2,2); - g.fillRect(width-1,height-5, 2,2); - g.fillRect(width-1,height-9, 2,2); - } - else { - int height = dim.height -= 3; - g.setColor(c1); - g.fillRect(10,height-1, 3,3); - g.fillRect(6,height-1, 3,3); - g.fillRect(2,height-1, 3,3); - g.fillRect(6,height-5, 3,3); - g.fillRect(2,height-5, 3,3); - g.fillRect(2,height-9, 3,3); - g.setColor(c2); - g.fillRect(10,height-1, 2,2); - g.fillRect(6,height-1, 2,2); - g.fillRect(2,height-1, 2,2); - g.fillRect(6,height-5, 2,2); - g.fillRect(2,height-5, 2,2); - g.fillRect(2,height-9, 2,2); - } - - } - - - /** - * Ensures that the cursor for this component is appropriate for the - * orientation. - * - * @param ltr Whether the current component orientation is LTR. - */ - protected void possiblyFixCursor(boolean ltr) { - int cursor = Cursor.NE_RESIZE_CURSOR; - if (ltr) { - cursor = Cursor.NW_RESIZE_CURSOR; - } - if (cursor!=getCursor().getType()) { - setCursor(Cursor.getPredefinedCursor(cursor)); - } - } - - - public void updateUI() { - super.updateUI(); - // TODO: Key off of Aqua LaF, not just OS X, as this size grip looks - // bad on other LaFs on Mac such as Nimbus. - if (System.getProperty("os.name").indexOf("OS X")>-1) { - if (osxSizeGrip==null) { - osxSizeGrip = createOSXSizeGrip(); - } - } - else { // Clear memory in case of runtime LaF change. - osxSizeGrip = null; - } - - } - - - /** - * Listens for mouse events on this panel and resizes the parent window - * appropriately. - * - * @author Robert Futrell - * @version 1.0 - */ - /* - * NOTE: We use SwingUtilities.convertPointToScreen() instead of just using + /** + * Creates and returns the OS X size grip image. + * + * @return The OS X size grip. + */ + protected Image createOSXSizeGrip() { + ClassLoader cl = getClass().getClassLoader(); + URL url = cl.getResource("org/fife/ui/autocomplete/osx_sizegrip.png"); + if (url == null) { + // We're not running in a jar - we may be debugging in Eclipse, + // for example + File f = new File("../AutoComplete/src/org/fife/ui/autocomplete/osx_sizegrip.png"); + if (f.isFile()) { + try { + url = f.toURI().toURL(); + } catch (MalformedURLException mue) { // Never happens + mue.printStackTrace(); + return null; + } + } else { + return null; // Can't find resource or image file + } + } + Image image = null; + try { + image = ImageIO.read(url); + } catch (IOException ioe) { // Never happens + ioe.printStackTrace(); + } + return image; + } + + + /** + * Paints this panel. + * + * @param g The graphics context. + */ + protected void paintComponent(Graphics g) { + + super.paintComponent(g); + + Dimension dim = getSize(); + Color c1 = UIManager.getColor("Label.disabledShadow"); + Color c2 = UIManager.getColor("Label.disabledForeground"); + + if (osxSizeGrip != null) { + g.drawImage(osxSizeGrip, dim.width - 16, dim.height - 16, null); + return; + } + + ComponentOrientation orientation = getComponentOrientation(); + + if (orientation.isLeftToRight()) { + int width = dim.width -= 3; + int height = dim.height -= 3; + g.setColor(c1); + g.fillRect(width - 9, height - 1, 3, 3); + g.fillRect(width - 5, height - 1, 3, 3); + g.fillRect(width - 1, height - 1, 3, 3); + g.fillRect(width - 5, height - 5, 3, 3); + g.fillRect(width - 1, height - 5, 3, 3); + g.fillRect(width - 1, height - 9, 3, 3); + g.setColor(c2); + g.fillRect(width - 9, height - 1, 2, 2); + g.fillRect(width - 5, height - 1, 2, 2); + g.fillRect(width - 1, height - 1, 2, 2); + g.fillRect(width - 5, height - 5, 2, 2); + g.fillRect(width - 1, height - 5, 2, 2); + g.fillRect(width - 1, height - 9, 2, 2); + } else { + int height = dim.height -= 3; + g.setColor(c1); + g.fillRect(10, height - 1, 3, 3); + g.fillRect(6, height - 1, 3, 3); + g.fillRect(2, height - 1, 3, 3); + g.fillRect(6, height - 5, 3, 3); + g.fillRect(2, height - 5, 3, 3); + g.fillRect(2, height - 9, 3, 3); + g.setColor(c2); + g.fillRect(10, height - 1, 2, 2); + g.fillRect(6, height - 1, 2, 2); + g.fillRect(2, height - 1, 2, 2); + g.fillRect(6, height - 5, 2, 2); + g.fillRect(2, height - 5, 2, 2); + g.fillRect(2, height - 9, 2, 2); + } + + } + + + /** + * Ensures that the cursor for this component is appropriate for the + * orientation. + * + * @param ltr Whether the current component orientation is LTR. + */ + protected void possiblyFixCursor(boolean ltr) { + int cursor = Cursor.NE_RESIZE_CURSOR; + if (ltr) { + cursor = Cursor.NW_RESIZE_CURSOR; + } + if (cursor != getCursor().getType()) { + setCursor(Cursor.getPredefinedCursor(cursor)); + } + } + + + public void updateUI() { + super.updateUI(); + // TODO: Key off of Aqua LaF, not just OS X, as this size grip looks + // bad on other LaFs on Mac such as Nimbus. + if (System.getProperty("os.name").contains("OS X")) { + if (osxSizeGrip == null) { + osxSizeGrip = createOSXSizeGrip(); + } + } else { // Clear memory in case of runtime LaF change. + osxSizeGrip = null; + } + + } + + + /** + * Listens for mouse events on this panel and resizes the parent window + * appropriately. + * + * @author Robert Futrell + * @version 1.0 + */ + /* + * NOTE: We use SwingUtilities.convertPointToScreen() instead of just using * the locations relative to the corner component because the latter proved * buggy - stretch the window too wide and some kind of arithmetic error * started happening somewhere - our window would grow way too large. */ - protected class MouseHandler extends MouseInputAdapter { - - protected Point origPos; - - public void mouseDragged(MouseEvent e) { - Point newPos = e.getPoint(); - SwingUtilities.convertPointToScreen(newPos, SizeGrip.this); - int xDelta = newPos.x - origPos.x; - int yDelta = newPos.y - origPos.y; - Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this); - if (wind!=null) { // Should always be true - if (getComponentOrientation().isLeftToRight()) { - int w = wind.getWidth(); - if (newPos.x>=wind.getX()) { - w += xDelta; - } - int h = wind.getHeight(); - if (newPos.y>=wind.getY()) { - h += yDelta; - } - wind.setSize(w,h); - } - else { // RTL - int newW = Math.max(1, wind.getWidth()-xDelta); - int newH = Math.max(1, wind.getHeight()+yDelta); - wind.setBounds(newPos.x, wind.getY(), newW, newH); - } - // invalidate()/validate() needed pre-1.6. - wind.invalidate(); - wind.validate(); - } - origPos.setLocation(newPos); - } - - public void mousePressed(MouseEvent e) { - origPos = e.getPoint(); - SwingUtilities.convertPointToScreen(origPos, SizeGrip.this); - } - - public void mouseReleased(MouseEvent e) { - origPos = null; - } - - } + protected class MouseHandler extends MouseInputAdapter { + + protected Point origPos; + + public void mouseDragged(MouseEvent e) { + Point newPos = e.getPoint(); + SwingUtilities.convertPointToScreen(newPos, SizeGrip.this); + int xDelta = newPos.x - origPos.x; + int yDelta = newPos.y - origPos.y; + Window wind = SwingUtilities.getWindowAncestor(SizeGrip.this); + if (wind != null) { // Should always be true + if (getComponentOrientation().isLeftToRight()) { + int w = wind.getWidth(); + if (newPos.x >= wind.getX()) { + w += xDelta; + } + int h = wind.getHeight(); + if (newPos.y >= wind.getY()) { + h += yDelta; + } + wind.setSize(w, h); + } else { // RTL + int newW = Math.max(1, wind.getWidth() - xDelta); + int newH = Math.max(1, wind.getHeight() + yDelta); + wind.setBounds(newPos.x, wind.getY(), newW, newH); + } + // invalidate()/validate() needed pre-1.6. + wind.invalidate(); + wind.validate(); + } + origPos.setLocation(newPos); + } + + public void mousePressed(MouseEvent e) { + origPos = e.getPoint(); + SwingUtilities.convertPointToScreen(origPos, SizeGrip.this); + } + + public void mouseReleased(MouseEvent e) { + origPos = null; + } + + } } \ No newline at end of file diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java index ac1079e..66fea47 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipUtil.java @@ -24,15 +24,8 @@ */ package org.nuiton.jaxx.widgets.extra.tooltip; -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.util.Resource; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -42,8 +35,15 @@ import javax.swing.JPopupMenu; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; import javax.swing.text.html.HTMLDocument; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.util.Resource; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import static org.nuiton.i18n.I18n.t; @@ -54,79 +54,79 @@ import static org.nuiton.i18n.I18n.t; * @version 1.0 */ public class TipUtil { - + protected static final String COPY_ICON_PATH = "copy.png"; - private TipUtil() { - } - - - /** - * Returns the default background color to use for tool tip windows. - * - * @return The default background color. - */ - public static Color getToolTipBackground() { - - Color c = UIManager.getColor("ToolTip.background"); - - // Tooltip.background is wrong color on Nimbus (!) - if (c==null || UIManager.getLookAndFeel().getName().equals("Nimbus")) { - c = UIManager.getColor("info"); // Used by Nimbus (and others) - if (c==null) { - c = SystemColor.info; // System default - } - } - - // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground() - // with a ColorUIResource does nothing, must be a normal Color - if (c instanceof ColorUIResource) { - c = new Color(c.getRGB()); - } - - return c; - - } - - - /** - * Tweaks a <code>JEditorPane</code> so it can be used to render the - * content in a focusable pseudo-tool tip. It is assumed that the editor - * pane is using an <code>HTMLDocument</code>. - * - * @param textArea The editor pane to tweak. - */ - public static void tweakTipEditorPane(JEditorPane textArea) { - - // Jump through a few hoops to get things looking nice in Nimbus - if (UIManager.getLookAndFeel().getName().equals("Nimbus")) { - Color selBG = textArea.getSelectionColor(); - Color selFG = textArea.getSelectedTextColor(); - textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI()); - textArea.setSelectedTextColor(selFG); - textArea.setSelectionColor(selBG); - } - - textArea.setEditable(false); // Required for links to work! - textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); - - // Make selection visible even though we are not (initially) focusable. - textArea.getCaret().setSelectionVisible(true); - - // Make it use the "tool tip" background color. - textArea.setBackground(TipUtil.getToolTipBackground()); - - // Force JEditorPane to use a certain font even in HTML. - // All standard LookAndFeels, even Nimbus (!), define Label.font. - Font font = UIManager.getFont("Label.font"); - if (font == null) { // Try to make a sensible default - font = new Font("SansSerif", Font.PLAIN, 12); - } - HTMLDocument doc = (HTMLDocument) textArea.getDocument(); - doc.getStyleSheet().addRule( - "body { font-family: " + font.getFamily() + "; font-size: " - + font.getSize() + "pt; }"); - } + private TipUtil() { + } + + + /** + * Returns the default background color to use for tool tip windows. + * + * @return The default background color. + */ + public static Color getToolTipBackground() { + + Color c = UIManager.getColor("ToolTip.background"); + + // Tooltip.background is wrong color on Nimbus (!) + if (c == null || UIManager.getLookAndFeel().getName().equals("Nimbus")) { + c = UIManager.getColor("info"); // Used by Nimbus (and others) + if (c == null) { + c = SystemColor.info; // System default + } + } + + // Workaround for a bug (?) with Nimbus - calling JLabel.setBackground() + // with a ColorUIResource does nothing, must be a normal Color + if (c instanceof ColorUIResource) { + c = new Color(c.getRGB()); + } + + return c; + + } + + + /** + * Tweaks a <code>JEditorPane</code> so it can be used to render the + * content in a focusable pseudo-tool tip. It is assumed that the editor + * pane is using an <code>HTMLDocument</code>. + * + * @param textArea The editor pane to tweak. + */ + public static void tweakTipEditorPane(JEditorPane textArea) { + + // Jump through a few hoops to get things looking nice in Nimbus + if (UIManager.getLookAndFeel().getName().equals("Nimbus")) { + Color selBG = textArea.getSelectionColor(); + Color selFG = textArea.getSelectedTextColor(); + textArea.setUI(new javax.swing.plaf.basic.BasicEditorPaneUI()); + textArea.setSelectedTextColor(selFG); + textArea.setSelectionColor(selBG); + } + + textArea.setEditable(false); // Required for links to work! + textArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + + // Make selection visible even though we are not (initially) focusable. + textArea.getCaret().setSelectionVisible(true); + + // Make it use the "tool tip" background color. + textArea.setBackground(TipUtil.getToolTipBackground()); + + // Force JEditorPane to use a certain font even in HTML. + // All standard LookAndFeels, even Nimbus (!), define Label.font. + Font font = UIManager.getFont("Label.font"); + if (font == null) { // Try to make a sensible default + font = new Font("SansSerif", Font.PLAIN, 12); + } + HTMLDocument doc = (HTMLDocument) textArea.getDocument(); + doc.getStyleSheet().addRule( + "body { font-family: " + font.getFamily() + "; font-size: " + + font.getSize() + "pt; }"); + } /** * Add context menu for paste selected content @@ -148,12 +148,12 @@ public class TipUtil { } Component component = tipWindows.getComponent(); - component.addMouseListener(new MouseAdapter(){ + component.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - JEditorPane textArea = (JEditorPane)e.getSource(); + JEditorPane textArea = (JEditorPane) e.getSource(); final String selectedText = textArea.getSelectedText(); if (e.getButton() == MouseEvent.BUTTON3 && !StringUtils.isBlank(selectedText)) { diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java index 5d49908..63d5ab9 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/TipWindow.java @@ -66,91 +66,91 @@ import static org.nuiton.i18n.I18n.t; */ public class TipWindow extends JWindow implements ActionListener { - protected FocusableTip ft; - protected Component component; - protected String text; - protected TipListener tipListener; - protected HyperlinkListener userHyperlinkListener; - - protected static TipWindow visibleInstance; - - /** - * Constructor, by default, is JEditorPane will be used for toolTip. - * - * @param owner The parent window. - * @param ft Focusable tip - * @param msg The text of the tool tip. This can be HTML. - */ - public TipWindow(Window owner, FocusableTip ft, String msg) { - super(owner); - this.ft = ft; - tipListener = new TipListener(); - - JEditorPane textArea = new JEditorPane("text/html", msg); - TipUtil.tweakTipEditorPane(textArea); - if (ft.getImageBase()!=null) { // Base URL for images - ((HTMLDocument)textArea.getDocument()).setBase(ft.getImageBase()); - } - textArea.addMouseListener(tipListener); - textArea.addHyperlinkListener(e -> { - if (e.getEventType()==HyperlinkEvent.EventType.ACTIVATED) { + protected FocusableTip ft; + protected Component component; + protected String text; + protected TipListener tipListener; + protected HyperlinkListener userHyperlinkListener; + + protected static TipWindow visibleInstance; + + /** + * Constructor, by default, is JEditorPane will be used for toolTip. + * + * @param owner The parent window. + * @param ft Focusable tip + * @param msg The text of the tool tip. This can be HTML. + */ + public TipWindow(Window owner, FocusableTip ft, String msg) { + super(owner); + this.ft = ft; + tipListener = new TipListener(); + + JEditorPane textArea = new JEditorPane("text/html", msg); + TipUtil.tweakTipEditorPane(textArea); + if (ft.getImageBase() != null) { // Base URL for images + ((HTMLDocument) textArea.getDocument()).setBase(ft.getImageBase()); + } + textArea.addMouseListener(tipListener); + textArea.addHyperlinkListener(e -> { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { TipWindow.this.ft.possiblyDisposeOfTipWindow(); } }); init(ft, textArea); - } + } - /** - * To specify component to display - * - * @param owner The parent window. - * @param ft Focusable tip + /** + * To specify component to display + * + * @param owner The parent window. + * @param ft Focusable tip * @param component custom component to display - */ - public TipWindow(Window owner, FocusableTip ft, Component component) { - super(owner); + */ + public TipWindow(Window owner, FocusableTip ft, Component component) { + super(owner); init(ft, component); - } + } protected void init(FocusableTip ft, Component component) { - this.ft = ft; - tipListener = new TipListener(); + this.ft = ft; + tipListener = new TipListener(); this.component = component; - JPanel cp = new JPanel(new BorderLayout()); - cp.setBorder(BorderFactory.createCompoundBorder(BorderFactory - .createLineBorder(Color.BLACK), BorderFactory - .createEmptyBorder())); - cp.setBackground(TipUtil.getToolTipBackground()); - component.addMouseListener(tipListener); - cp.add(component); - - setFocusableWindowState(false); - setContentPane(cp); - setBottomPanel(); // Must do after setContentPane() - pack(); - - // InputMap/ActionMap combo doesn't work for JWindows (even when - // using the JWindow's JRootPane), so we'll resort to KeyListener - KeyAdapter ka = new KeyAdapter() { - public void keyPressed(KeyEvent e) { - if (e.getKeyCode()==KeyEvent.VK_ESCAPE) { - TipWindow.this.ft.possiblyDisposeOfTipWindow(); - } - } - }; - addKeyListener(ka); - component.addKeyListener(ka); - - // Ensure only 1 TipWindow is ever visible. If the caller does what - // they're supposed to and only creates these on the EDT, the - // synchronization isn't necessary, but we'll be extra safe. - synchronized (TipWindow.class) { - if (visibleInstance!=null) { - visibleInstance.dispose(); - } - visibleInstance = this; - } + JPanel cp = new JPanel(new BorderLayout()); + cp.setBorder(BorderFactory.createCompoundBorder(BorderFactory + .createLineBorder(Color.BLACK), BorderFactory + .createEmptyBorder())); + cp.setBackground(TipUtil.getToolTipBackground()); + component.addMouseListener(tipListener); + cp.add(component); + + setFocusableWindowState(false); + setContentPane(cp); + setBottomPanel(); // Must do after setContentPane() + pack(); + + // InputMap/ActionMap combo doesn't work for JWindows (even when + // using the JWindow's JRootPane), so we'll resort to KeyListener + KeyAdapter ka = new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + TipWindow.this.ft.possiblyDisposeOfTipWindow(); + } + } + }; + addKeyListener(ka); + component.addKeyListener(ka); + + // Ensure only 1 TipWindow is ever visible. If the caller does what + // they're supposed to and only creates these on the EDT, the + // synchronization isn't necessary, but we'll be extra safe. + synchronized (TipWindow.class) { + if (visibleInstance != null) { + visibleInstance.dispose(); + } + visibleInstance = this; + } } /** @@ -162,52 +162,52 @@ public class TipWindow extends JWindow implements ActionListener { return component; } - public void actionPerformed(ActionEvent e) { - - if (!getFocusableWindowState()) { - setFocusableWindowState(true); - setBottomPanel(); - component.removeMouseListener(tipListener); - pack(); - addWindowFocusListener(new WindowAdapter() { - public void windowLostFocus(WindowEvent e) { - ft.possiblyDisposeOfTipWindow(); - } - }); - ft.removeListeners(); - if (e==null) { // Didn't get here via our mouseover timer - requestFocus(); - } - } - - } - - - /** - * Disposes of this window. - */ - public void dispose() { - //System.out.println("[DEBUG]: Disposing..."); - Container cp = getContentPane(); - for (int i=0; i<cp.getComponentCount(); i++) { - // Okay if listener is already removed - cp.getComponent(i).removeMouseListener(tipListener); - } - ft.removeListeners(); - super.dispose(); - } - - - /** - * Workaround for JEditorPane not returning its proper preferred size - * when rendering HTML until after layout already done. See - * http://forums.sun.com/thread.jspa?forumID=57&threadID=574810 for a - * discussion. - * - * @param width min width - * @param height min height - */ - public void fixSize(int width, int height) { + public void actionPerformed(ActionEvent e) { + + if (!getFocusableWindowState()) { + setFocusableWindowState(true); + setBottomPanel(); + component.removeMouseListener(tipListener); + pack(); + addWindowFocusListener(new WindowAdapter() { + public void windowLostFocus(WindowEvent e) { + ft.possiblyDisposeOfTipWindow(); + } + }); + ft.removeListeners(); + if (e == null) { // Didn't get here via our mouseover timer + requestFocus(); + } + } + + } + + + /** + * Disposes of this window. + */ + public void dispose() { + //System.out.println("[DEBUG]: Disposing..."); + Container cp = getContentPane(); + for (int i = 0; i < cp.getComponentCount(); i++) { + // Okay if listener is already removed + cp.getComponent(i).removeMouseListener(tipListener); + } + ft.removeListeners(); + super.dispose(); + } + + + /** + * Workaround for JEditorPane not returning its proper preferred size + * when rendering HTML until after layout already done. See + * http://forums.sun.com/thread.jspa?forumID=57&threadID=574810 for a + * discussion. + * + * @param width min width + * @param height min height + */ + public void fixSize(int width, int height) { // Dimension d = textArea.getPreferredSize(); // Rectangle r; @@ -230,139 +230,139 @@ public class TipWindow extends JWindow implements ActionListener { // pack(); // Must re-pack to calculate proper size. // Use specified size - Dimension d = component.getPreferredSize(); - d.width= width; + Dimension d = component.getPreferredSize(); + d.width = width; d.height = height; component.setPreferredSize(d); component.setSize(d); pack(); - } - - - public String getText() { - return text; - } - - - protected void setBottomPanel() { - - final JPanel panel = new JPanel(new BorderLayout()); - panel.add(new JSeparator(), BorderLayout.NORTH); - - boolean focusable = getFocusableWindowState(); - if (focusable) { - SizeGrip sg = new SizeGrip(); - sg.applyComponentOrientation(sg.getComponentOrientation()); // Workaround - panel.add(sg, BorderLayout.LINE_END); - MouseInputAdapter adapter = new MouseInputAdapter() { - protected Point lastPoint; - public void mouseDragged(MouseEvent e) { - Point p = e.getPoint(); - SwingUtilities.convertPointToScreen(p, panel); - if (lastPoint==null) { - lastPoint = p; - } - else { - int dx = p.x - lastPoint.x; - int dy = p.y - lastPoint.y; - setLocation(getX()+dx, getY()+dy); - lastPoint = p; - } - } - public void mousePressed(MouseEvent e) { - lastPoint = e.getPoint(); - SwingUtilities.convertPointToScreen(lastPoint, panel); - } - }; - panel.addMouseListener(adapter); - panel.addMouseMotionListener(adapter); - // Don't add tipListener to the panel or SizeGrip - } - else { - panel.setOpaque(false); - JLabel label = new JLabel(t("nuitonwidgets.tootilp.focushotkey")/*FocusableTip.getString("FocusHotkey")*/); - Color fg = UIManager.getColor("Label.disabledForeground"); - Font font = component.getFont(); - font = font.deriveFont(font.getSize2D() - 1.0f); - label.setFont(font); - if (fg==null) { // Non BasicLookAndFeel-derived Looks - fg = Color.GRAY; - } - label.setOpaque(true); - Color bg = TipUtil.getToolTipBackground(); - label.setBackground(bg); - label.setForeground(fg); - label.setHorizontalAlignment(SwingConstants.TRAILING); - label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - panel.add(label); - panel.addMouseListener(tipListener); - } - - // Replace the previous SOUTH Component with the new one. - Container cp = getContentPane(); - if (cp.getComponentCount()==2) { // Skip first time through - Component comp = cp.getComponent(0); - cp.remove(0); - JScrollPane sp = new JScrollPane(comp); - sp.setViewportBorder(BorderFactory.createEmptyBorder()); - sp.setBackground(component.getBackground()); - sp.getViewport().setBackground(component.getBackground()); - cp.add(sp); - // What was component 1 is now 0. - cp.getComponent(0).removeMouseListener(tipListener); - cp.remove(0); - } - - cp.add(panel, BorderLayout.SOUTH); - - } - - - /** - * Sets the listener for hyperlink events in this tip window. - * - * @param listener The new listener. The old listener (if any) is - * removed. A value of <code>null</code> means "no listener." - */ - public void setHyperlinkListener(HyperlinkListener listener) { + } + + + public String getText() { + return text; + } + + + protected void setBottomPanel() { + + final JPanel panel = new JPanel(new BorderLayout()); + panel.add(new JSeparator(), BorderLayout.NORTH); + + boolean focusable = getFocusableWindowState(); + if (focusable) { + SizeGrip sg = new SizeGrip(); + sg.applyComponentOrientation(sg.getComponentOrientation()); // Workaround + panel.add(sg, BorderLayout.LINE_END); + MouseInputAdapter adapter = new MouseInputAdapter() { + protected Point lastPoint; + + public void mouseDragged(MouseEvent e) { + Point p = e.getPoint(); + SwingUtilities.convertPointToScreen(p, panel); + if (lastPoint == null) { + lastPoint = p; + } else { + int dx = p.x - lastPoint.x; + int dy = p.y - lastPoint.y; + setLocation(getX() + dx, getY() + dy); + lastPoint = p; + } + } + + public void mousePressed(MouseEvent e) { + lastPoint = e.getPoint(); + SwingUtilities.convertPointToScreen(lastPoint, panel); + } + }; + panel.addMouseListener(adapter); + panel.addMouseMotionListener(adapter); + // Don't add tipListener to the panel or SizeGrip + } else { + panel.setOpaque(false); + JLabel label = new JLabel(t("nuitonwidgets.tootilp.focushotkey")/*FocusableTip.getString("FocusHotkey")*/); + Color fg = UIManager.getColor("Label.disabledForeground"); + Font font = component.getFont(); + font = font.deriveFont(font.getSize2D() - 1.0f); + label.setFont(font); + if (fg == null) { // Non BasicLookAndFeel-derived Looks + fg = Color.GRAY; + } + label.setOpaque(true); + Color bg = TipUtil.getToolTipBackground(); + label.setBackground(bg); + label.setForeground(fg); + label.setHorizontalAlignment(SwingConstants.TRAILING); + label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + panel.add(label); + panel.addMouseListener(tipListener); + } + + // Replace the previous SOUTH Component with the new one. + Container cp = getContentPane(); + if (cp.getComponentCount() == 2) { // Skip first time through + Component comp = cp.getComponent(0); + cp.remove(0); + JScrollPane sp = new JScrollPane(comp); + sp.setViewportBorder(BorderFactory.createEmptyBorder()); + sp.setBackground(component.getBackground()); + sp.getViewport().setBackground(component.getBackground()); + cp.add(sp); + // What was component 1 is now 0. + cp.getComponent(0).removeMouseListener(tipListener); + cp.remove(0); + } + + cp.add(panel, BorderLayout.SOUTH); + + } + + + /** + * Sets the listener for hyperlink events in this tip window. + * + * @param listener The new listener. The old listener (if any) is + * removed. A value of <code>null</code> means "no listener." + */ + public void setHyperlinkListener(HyperlinkListener listener) { if (component instanceof JEditorPane) { - JEditorPane textArea = (JEditorPane)component; + JEditorPane textArea = (JEditorPane) component; // We've added a separate listener, so remove only the user's. - if (userHyperlinkListener!=null) { + if (userHyperlinkListener != null) { textArea.removeHyperlinkListener(userHyperlinkListener); } userHyperlinkListener = listener; - if (userHyperlinkListener!=null) { + if (userHyperlinkListener != null) { textArea.addHyperlinkListener(userHyperlinkListener); } } - } + } - /** - * Listens for events in this window. - */ - protected class TipListener extends MouseAdapter { + /** + * Listens for events in this window. + */ + protected class TipListener extends MouseAdapter { - public TipListener() { - } + public TipListener() { + } - public void mousePressed(MouseEvent e) { - actionPerformed(null); // Manually create "real" window - } + public void mousePressed(MouseEvent e) { + actionPerformed(null); // Manually create "real" window + } - public void mouseExited(MouseEvent e) { - // Since we registered this listener on the child components of - // the JWindow, not the JWindow iteself, we have to be careful. - Component source = (Component)e.getSource(); - Point p = e.getPoint(); - SwingUtilities.convertPointToScreen(p, source); - if (!TipWindow.this.getBounds().contains(p)) { - ft.possiblyDisposeOfTipWindow(); - } - } + public void mouseExited(MouseEvent e) { + // Since we registered this listener on the child components of + // the JWindow, not the JWindow iteself, we have to be careful. + Component source = (Component) e.getSource(); + Point p = e.getPoint(); + SwingUtilities.convertPointToScreen(p, source); + if (!TipWindow.this.getBounds().contains(p)) { + ft.possiblyDisposeOfTipWindow(); + } + } - } + } } \ No newline at end of file diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java index 89b1692..108d7a4 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tooltip/package-info.java @@ -21,10 +21,10 @@ */ /** * Focusable tooltip. - * + * * Original code from RSyntaxTextArea project with following modifications: * <ul> - * <li>allow setting tooltip on all {@link javax.swing.JComponent}</li> + * <li>allow setting tooltip on all {@link javax.swing.JComponent}</li> * </ul> */ package org.nuiton.jaxx.widgets.extra.tooltip; diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java index 9b89806..36ad206 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/FilterTreeModel.java @@ -32,12 +32,12 @@ import java.util.Iterator; /** * Filter tree model. - * + * * Take a delegate {@link TreeModel} filter it with {@link TreeFilter}. - * + * * @author chatellier * - * Based on : http://forums.sun.com/thread.jspa?forumID=57&threadID=5378510 + * Based on : http://forums.sun.com/thread.jspa?forumID=57&threadID=5378510 */ public class FilterTreeModel implements TreeModel { @@ -52,16 +52,16 @@ public class FilterTreeModel implements TreeModel { /** * Constructor with delegate model. - * + * * @param delegateModel delegate data model */ public FilterTreeModel(TreeModel delegateModel) { this(delegateModel, null); } - + /** * Constructor with delegate model. - * + * * @param delegateModel * @param filter */ @@ -73,9 +73,9 @@ public class FilterTreeModel implements TreeModel { /** * Change filter. - * + * * Send a {@code treeStructureChanged} event on all registred listeners. - * + * * @param treeFilter new filter */ public void setFilter(TreeFilter treeFilter) { @@ -86,14 +86,12 @@ public class FilterTreeModel implements TreeModel { /** * Send a {@code treeStructureChanged} event on all registred listeners. - * + * * @param path new path to send in notification */ protected void fireTreeStructureChanged(TreePath path) { TreeModelEvent event = new TreeModelEvent(delegateModel, path); - Iterator<TreeModelListener> itTreeModelListener = treeModelListeners.iterator(); - while(itTreeModelListener.hasNext()) { - TreeModelListener current = itTreeModelListener.next(); + for (TreeModelListener current : treeModelListeners) { current.treeStructureChanged(event); } } diff --git a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java index 0535b1a..1132410 100644 --- a/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java +++ b/jaxx-widgets-extra/src/main/java/org/nuiton/jaxx/widgets/extra/tree/TreeFilter.java @@ -26,13 +26,13 @@ import javax.swing.tree.TreeModel; /** * TreeFilter - * + * * TODO ADD COMMENT HERE ! - * + * * @author ceric35 - * Date : 4 mars 2010 + * Date : 4 mars 2010 */ public interface TreeFilter { - + boolean include(TreeModel model, Object node); } diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java index 3534613..d8ea77f 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/AboutFrameTest.java @@ -33,9 +33,9 @@ import java.awt.GraphicsEnvironment; * * @author chatellier * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ + * + * Last update : $Date$ + * By : $Author$ */ public class AboutFrameTest { @@ -53,12 +53,12 @@ public class AboutFrameTest { @Test public void testOnlyAbout() { AboutFrame about = new AboutFrame(); - + about.setAboutHtmlText("test"); - + about.setVisible(true); } - + /** * Affiche une about frame avec * l'onglet about et licence. @@ -66,13 +66,13 @@ public class AboutFrameTest { @Test public void testAboutAndLicense() { AboutFrame about = new AboutFrame(); - + about.setAboutHtmlText("test"); about.setLicenseText("licence"); - + about.setVisible(true); } - + /** * Affiche une about frame avec * l'onglet about et licence. @@ -80,9 +80,9 @@ public class AboutFrameTest { @Test public void testIcon() { AboutFrame about = new AboutFrame(); - + about.setIconPath("undo.png"); - + about.setVisible(true); } } diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java index 9c0e7be..3876a3c 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/IconFactoryTest.java @@ -34,13 +34,12 @@ package org.nuiton.jaxx.widgets.extra; -import javax.swing.Icon; - import org.junit.Assert; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; +import javax.swing.Icon; import java.awt.GraphicsEnvironment; public class IconFactoryTest { // IconFactoryTest diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java index e116321..e342117 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/WidgetUtilTest.java @@ -35,17 +35,16 @@ package org.nuiton.jaxx.widgets.extra; -import java.awt.Component; -import java.awt.GraphicsEnvironment; - -import javax.swing.JLabel; - import org.junit.Assert; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; -public class WidgetUtilTest{ // WidgetUtilTest +import javax.swing.JLabel; +import java.awt.Component; +import java.awt.GraphicsEnvironment; + +public class WidgetUtilTest { // WidgetUtilTest @BeforeClass public static void setUpClass() throws Exception { diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java index 0386ed8..1c0aec8 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/XMLGridLayoutTest.java @@ -34,16 +34,15 @@ package org.nuiton.jaxx.widgets.extra; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; import java.awt.GraphicsEnvironment; public class XMLGridLayoutTest { // XMLGridLayoutTest diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java index a981c7c..8dcf205 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/editor/EditorMain.java @@ -34,17 +34,16 @@ package org.nuiton.jaxx.widgets.extra.editor; -import java.awt.BorderLayout; -import java.io.File; +import org.apache.commons.io.FileUtils; import javax.swing.JFrame; import javax.swing.WindowConstants; - -import org.apache.commons.io.FileUtils; +import java.awt.BorderLayout; +import java.io.File; +import java.nio.charset.StandardCharsets; /** * @author poussin - * */ public class EditorMain { @@ -58,7 +57,7 @@ public class EditorMain { frame.setBounds(10, 10, 300, 300); File file = File.createTempFile("NuitonEditorTest", ".java"); - FileUtils.writeStringToFile(file, "public class toto {\n public void test() {\n \n }\n}"); + FileUtils.writeStringToFile(file, "public class toto {\n public void test() {\n \n }\n}", StandardCharsets.UTF_8); file.deleteOnExit(); editor.open(file); diff --git a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java index b942a92..8a330b4 100644 --- a/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java +++ b/jaxx-widgets-extra/src/test/java/org/nuiton/jaxx/widgets/extra/toolTip/FocusableToolTipMain.java @@ -21,18 +21,16 @@ */ package org.nuiton.jaxx.widgets.extra.toolTip; -import java.util.Locale; +import org.nuiton.i18n.I18n; +import org.nuiton.jaxx.widgets.extra.tooltip.FocusableTip; + import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTree; import javax.swing.WindowConstants; - -import org.nuiton.jaxx.widgets.extra.tooltip.FocusableTip; - import java.awt.BorderLayout; import java.awt.event.MouseEvent; - -import org.nuiton.i18n.I18n; +import java.util.Locale; /** * @author sletellier diff --git a/jaxx-widgets-extra/src/test/resources/log4j.properties b/jaxx-widgets-extra/src/test/resources/log4j.properties index 45ec80e..6b14e66 100644 --- a/jaxx-widgets-extra/src/test/resources/log4j.properties +++ b/jaxx-widgets-extra/src/test/resources/log4j.properties @@ -25,5 +25,4 @@ log4j.rootLogger=ERROR, stdout 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.org.nuiton=INFO diff --git a/jaxx-widgets-file/pom.xml b/jaxx-widgets-file/pom.xml index 4e20062..5b41226 100644 --- a/jaxx-widgets-file/pom.xml +++ b/jaxx-widgets-file/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/BaseActionPanel.java b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/BaseActionPanel.java index 883e253..39c36d7 100644 --- a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/BaseActionPanel.java +++ b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/BaseActionPanel.java @@ -21,9 +21,9 @@ */ package org.nuiton.jaxx.widgets.file; +import javax.swing.JPanel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JPanel; /** * TODO sletellier 15/06/2012 : find a better way to add onActionPerform on custom components @@ -47,7 +47,7 @@ public abstract class BaseActionPanel extends JPanel { // those that are interested in this event for (Object listener : listeners) { if (ActionListener.class.isInstance(listener)) { - ((ActionListener)listener).actionPerformed(e); + ((ActionListener) listener).actionPerformed(e); } } } @@ -59,15 +59,16 @@ public abstract class BaseActionPanel extends JPanel { * when a selection has been made. If the combo box is editable, then * an <code>ActionEvent</code> will be fired when editing has stopped. * - * @param l the <code>ActionListener</code> that is to be notified + * @param l the <code>ActionListener</code> that is to be notified */ public void addActionListener(ActionListener l) { - listenerList.add(ActionListener.class,l); + listenerList.add(ActionListener.class, l); } - /** Removes an <code>ActionListener</code>. + /** + * Removes an <code>ActionListener</code>. * - * @param l the <code>ActionListener</code> to remove + * @param l the <code>ActionListener</code> to remove */ public void removeActionListener(ActionListener l) { listenerList.remove(ActionListener.class, l); diff --git a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileCellEditor.java b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileCellEditor.java index 9a4ffc5..c1de933 100644 --- a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileCellEditor.java +++ b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileCellEditor.java @@ -21,12 +21,11 @@ */ package org.nuiton.jaxx.widgets.file; -import java.awt.Component; -import java.io.File; import javax.swing.AbstractCellEditor; import javax.swing.JTable; import javax.swing.table.TableCellEditor; -import org.nuiton.jaxx.widgets.file.FileEditor; +import java.awt.Component; +import java.io.File; /** * @author Sylvain Lletellier diff --git a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java index 3b8d75d..4da7f9d 100644 --- a/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java +++ b/jaxx-widgets-file/src/main/java/org/nuiton/jaxx/widgets/file/FileEditorHandler.java @@ -103,7 +103,7 @@ public class FileEditorHandler { if (extsDescription != null) { descs = extsDescription.split(SEPARATOR_REGEX); } - for (int i = 0;i<exts.length;i++) { + for (int i = 0; i < exts.length; i++) { // use ext if no desc found String ext = exts[i]; diff --git a/jaxx-widgets-font/pom.xml b/jaxx-widgets-font/pom.xml index 8c43916..8ced9cf 100644 --- a/jaxx-widgets-font/pom.xml +++ b/jaxx-widgets-font/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-gis/pom.xml b/jaxx-widgets-gis/pom.xml index e016599..d7c766d 100644 --- a/jaxx-widgets-gis/pom.xml +++ b/jaxx-widgets-gis/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DdCoordinate.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DdCoordinate.java index e8daac7..99bf52c 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DdCoordinate.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DdCoordinate.java @@ -256,10 +256,10 @@ public class DdCoordinate extends AbstractSerializableBean { @Override public String toString() { return "DdCoordinateComponent{" + - "sign=" + sign + - ", degree=" + degree + - ", decimal=" + decimal + - '}'; + "sign=" + sign + + ", degree=" + degree + + ", decimal=" + decimal + + '}'; } public void reset() { diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmdCoordinate.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmdCoordinate.java index 57c0727..8345b34 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmdCoordinate.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmdCoordinate.java @@ -311,11 +311,11 @@ public class DmdCoordinate extends AbstractSerializableBean { @Override public String toString() { return "DmdCoordinateComponent{" + - "sign=" + sign + - ", degree=" + degree + - ", minute=" + minute + - ", decimal=" + decimal + - '}'; + "sign=" + sign + + ", degree=" + degree + + ", minute=" + minute + + ", decimal=" + decimal + + '}'; } public void reset() { diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinate.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinate.java index 2ccc923..ddf5173 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinate.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinate.java @@ -341,11 +341,11 @@ public class DmsCoordinate extends AbstractSerializableBean { @Override public String toString() { return "DmsCoordinateComponent{" + - "sign=" + sign + - ", degree=" + degree + - ", minute=" + minute + - ", second=" + second + - '}'; + "sign=" + sign + + ", degree=" + degree + + ", minute=" + minute + + ", second=" + second + + '}'; } protected boolean isDegreeValid(boolean longitude) { @@ -364,8 +364,8 @@ public class DmsCoordinate extends AbstractSerializableBean { } public void reset() { - degree=null; - minute=null; - second=null; + degree = null; + minute = null; + second = null; } } diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinateConverter.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinateConverter.java index 8e87cce..11c3561 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinateConverter.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/DmsCoordinateConverter.java @@ -134,8 +134,8 @@ public class DmsCoordinateConverter implements NuitonConverter<DmsCoordinate> { DmsCoordinate.COORDINATE_STRING_PATTERN, signStr, StringUtils.leftPad(degreeStr, forLongitude ? 3 : 2, nullValue.equals(degreeStr) ? ' ' : fillChar), - StringUtils.leftPad(minuteStr, 2, nullValue.equals(minuteStr) ? ' ' :fillChar), - StringUtils.leftPad(secondStr, 2, nullValue.equals(secondStr) ? ' ' :fillChar)); + StringUtils.leftPad(minuteStr, 2, nullValue.equals(minuteStr) ? ' ' : fillChar), + StringUtils.leftPad(secondStr, 2, nullValue.equals(secondStr) ? ' ' : fillChar)); } } return aClass.cast(result); diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/MaskFormatterFromConverter.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/MaskFormatterFromConverter.java index d189d08..a8273bf 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/MaskFormatterFromConverter.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/MaskFormatterFromConverter.java @@ -48,8 +48,8 @@ public class MaskFormatterFromConverter<O> extends MaskFormatter { } protected MaskFormatterFromConverter(Class<O> type, - String pattern, - Converter converter) throws ParseException { + String pattern, + Converter converter) throws ParseException { super(pattern); this.type = type; this.converter = converter; diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDdCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDdCoordinateEditorHandler.java index 929a182..147e7cc 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDdCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDdCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.absolute; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DdCoordinate; import org.nuiton.jaxx.widgets.gis.DdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 9/2/14. @@ -83,17 +83,17 @@ public class AbsoluteDdCoordinateEditorHandler implements UIHandler<AbsoluteDdCo final AbsoluteDdCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); - Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); + Objects.requireNonNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); coordinateConverter.setForLongitude(longitudeEditor); diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmdCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmdCoordinateEditorHandler.java index 05770ac..3423676 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmdCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmdCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.absolute; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DmdCoordinate; import org.nuiton.jaxx.widgets.gis.DmdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 9/2/14. @@ -87,21 +87,21 @@ public class AbsoluteDmdCoordinateEditorHandler implements UIHandler<AbsoluteDmd final AbsoluteDmdCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); - Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); + Objects.requireNonNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); - Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); + Objects.requireNonNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); - Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); + Objects.requireNonNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); coordinateConverter.setForLongitude(longitudeEditor); diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmsCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmsCoordinateEditorHandler.java index c921c03..b1f817c 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmsCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/AbsoluteDmsCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.absolute; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DmsCoordinate; import org.nuiton.jaxx.widgets.gis.DmsCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 9/2/14. @@ -85,21 +85,21 @@ public class AbsoluteDmsCoordinateEditorHandler implements UIHandler<AbsoluteDms final AbsoluteDmsCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); - Preconditions.checkNotNull(model.getPropertySecond(), "could not find propertySecond in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); + Objects.requireNonNull(model.getPropertySecond(), "could not find propertySecond in " + ui); Object bean = model.getBean(); degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); - Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); + Objects.requireNonNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); secondMutator = BeanUtil.getMutator(bean, model.getPropertySecond()); - Preconditions.checkNotNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); + Objects.requireNonNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); coordinateConverter.setForLongitude(longitudeEditor); diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditor.jaxx b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditor.jaxx index 5b77ebd..8898196 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditor.jaxx +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditor.jaxx @@ -77,9 +77,12 @@ public void resetQuadrant() { handler.resetQuadrant(); } </cell> <cell fill="both" weightx='1'> <JPanel id='latitudeEditor'> - <AbsoluteDdCoordinateEditor id='latitudeDd' constraints='CoordinateFormat.dd.name()' styleClass="enabled"/> - <AbsoluteDmsCoordinateEditor id='latitudeDms' constraints='CoordinateFormat.dms.name()' styleClass="enabled"/> - <AbsoluteDmdCoordinateEditor id='latitudeDmd' constraints='CoordinateFormat.dmd.name()' styleClass="enabled"/> + <AbsoluteDdCoordinateEditor id='latitudeDd' constraints='CoordinateFormat.dd.name()' + styleClass="enabled"/> + <AbsoluteDmsCoordinateEditor id='latitudeDms' constraints='CoordinateFormat.dms.name()' + styleClass="enabled"/> + <AbsoluteDmdCoordinateEditor id='latitudeDmd' constraints='CoordinateFormat.dmd.name()' + styleClass="enabled"/> </JPanel> </cell> </row> @@ -89,9 +92,12 @@ public void resetQuadrant() { handler.resetQuadrant(); } </cell> <cell fill="both" weightx='1'> <JPanel id='longitudeEditor'> - <AbsoluteDdCoordinateEditor id='longitudeDd' constraints='CoordinateFormat.dd.name()' styleClass="enabled"/> - <AbsoluteDmsCoordinateEditor id='longitudeDms' constraints='CoordinateFormat.dms.name()' styleClass="enabled"/> - <AbsoluteDmdCoordinateEditor id='longitudeDmd' constraints='CoordinateFormat.dmd.name()' styleClass="enabled"/> + <AbsoluteDdCoordinateEditor id='longitudeDd' constraints='CoordinateFormat.dd.name()' + styleClass="enabled"/> + <AbsoluteDmsCoordinateEditor id='longitudeDms' constraints='CoordinateFormat.dms.name()' + styleClass="enabled"/> + <AbsoluteDmdCoordinateEditor id='longitudeDmd' constraints='CoordinateFormat.dmd.name()' + styleClass="enabled"/> </JPanel> </cell> </row> diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorHandler.java index ad14896..5c985d1 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorHandler.java @@ -22,7 +22,6 @@ package org.nuiton.jaxx.widgets.gis.absolute; * #L% */ -import com.google.common.base.Preconditions; import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.widgets.gis.CoordinateFormat; @@ -31,6 +30,7 @@ import org.nuiton.util.beans.BeanUtil; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; +import java.util.Objects; /** * Created on 8/31/14. @@ -118,7 +118,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyLatitude() != null) { Method latitudeMutator = BeanUtil.getMutator(bean, model.getPropertyLatitude()); - Preconditions.checkNotNull(latitudeMutator, "could not find mutator for " + model.getPropertyLatitude()); + Objects.requireNonNull(latitudeMutator, "could not find mutator for " + model.getPropertyLatitude()); // When model latitude changed, let's push it back in bean model.addPropertyChangeListener( CoordinatesEditorModel.PROPERTY_LATITUDE, @@ -129,7 +129,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyLatitude() != null) { Method longitudeMutator = BeanUtil.getMutator(bean, model.getPropertyLongitude()); - Preconditions.checkNotNull(longitudeMutator, "could not find mutator for " + model.getPropertyLongitude()); + Objects.requireNonNull(longitudeMutator, "could not find mutator for " + model.getPropertyLongitude()); // When model longitude changed, let's push it back in bean model.addPropertyChangeListener( @@ -141,7 +141,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyQuadrant() != null) { Method quadrantMutator = BeanUtil.getMutator(bean, model.getPropertyQuadrant()); - Preconditions.checkNotNull(quadrantMutator, "could not find mutator for " + model.getPropertyQuadrant()); + Objects.requireNonNull(quadrantMutator, "could not find mutator for " + model.getPropertyQuadrant()); // When model quadrant changed, let's push it back in bean model.addPropertyChangeListener( diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/package-info.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/package-info.java index f8c3c0d..99d92fa 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/package-info.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/package-info.java @@ -2,6 +2,7 @@ * Define some absolute coordinate editors (using quadrant for sign). * * Created on 9/2/14. + * * @author Tony Chemit - dev@tchemit.fr * @since 2.12 */ diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDdCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDdCoordinateEditorHandler.java index bda9fb6..ed66080 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDdCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDdCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.signed; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DdCoordinate; import org.nuiton.jaxx.widgets.gis.DdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 10/16/13. @@ -89,20 +89,20 @@ public class SignedDdCoordinateEditorHandler implements UIHandler<SignedDdCoordi final SignedDdCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertySign(), "could not find propertySign in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertySign(), "could not find propertySign in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); - Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); + Objects.requireNonNull(signMutator, "could not find mutator for " + model.getPropertySign()); degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); - Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); + Objects.requireNonNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); signedConverter.setForLongitude(longitudeEditor); unsignedConverter.setForLongitude(longitudeEditor); @@ -142,8 +142,8 @@ public class SignedDdCoordinateEditorHandler implements UIHandler<SignedDdCoordi JFormattedTextField editor = ui.getEditor(); editor.setFormatterFactory(model.isSign() ? - signedFormatterFactory : - unsignedFormatterFactory); + signedFormatterFactory : + unsignedFormatterFactory); editor.setFocusLostBehavior(JFormattedTextField.COMMIT); // When editor changes his value, propagate it to model diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorHandler.java index 5d1b448..6b52810 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.signed; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DmdCoordinate; import org.nuiton.jaxx.widgets.gis.DmdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 10/16/13. @@ -91,24 +91,24 @@ public class SignedDmdCoordinateEditorHandler implements UIHandler<SignedDmdCoor final SignedDmdCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertySign(), "could not find propertySign in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); - Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertySign(), "could not find propertySign in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); + Objects.requireNonNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); - Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); + Objects.requireNonNull(signMutator, "could not find mutator for " + model.getPropertySign()); degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); - Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); + Objects.requireNonNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); - Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); + Objects.requireNonNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); signedConverter.setForLongitude(longitudeEditor); unsignedConverter.setForLongitude(longitudeEditor); @@ -148,8 +148,8 @@ public class SignedDmdCoordinateEditorHandler implements UIHandler<SignedDmdCoor JFormattedTextField editor = ui.getEditor(); editor.setFormatterFactory(model.isSign() ? - signedFormatterFactory : - unsignedFormatterFactory); + signedFormatterFactory : + unsignedFormatterFactory); editor.setFocusLostBehavior(JFormattedTextField.COMMIT); // When editor changes his value, propagate it to model diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorHandler.java index ca4586e..a2c4ebc 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorHandler.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorHandler.java @@ -22,10 +22,9 @@ package org.nuiton.jaxx.widgets.gis.signed; * #L% */ -import com.google.common.base.Preconditions; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.gis.DmsCoordinate; import org.nuiton.jaxx.widgets.gis.DmsCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; @@ -38,6 +37,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; +import java.util.Objects; /** * Created on 10/16/13. @@ -91,24 +91,24 @@ public class SignedDmsCoordinateEditorHandler implements UIHandler<SignedDmsCoor final SignedDmsCoordinateEditorModel model = ui.getModel(); - Preconditions.checkNotNull(model.getBean(), "could not find bean in " + ui); - Preconditions.checkNotNull(model.getPropertySign(), "could not find propertySign in " + ui); - Preconditions.checkNotNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); - Preconditions.checkNotNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); - Preconditions.checkNotNull(model.getPropertySecond(), "could not find propertySecond in " + ui); + Objects.requireNonNull(model.getBean(), "could not find bean in " + ui); + Objects.requireNonNull(model.getPropertySign(), "could not find propertySign in " + ui); + Objects.requireNonNull(model.getPropertyDegree(), "could not find propertyDegree in " + ui); + Objects.requireNonNull(model.getPropertyMinute(), "could not find propertyMinute in " + ui); + Objects.requireNonNull(model.getPropertySecond(), "could not find propertySecond in " + ui); Object bean = model.getBean(); signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); - Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); + Objects.requireNonNull(signMutator, "could not find mutator for " + model.getPropertySign()); degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); - Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); + Objects.requireNonNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); - Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); + Objects.requireNonNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); secondMutator = BeanUtil.getMutator(bean, model.getPropertySecond()); - Preconditions.checkNotNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); + Objects.requireNonNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); signedConverter.setForLongitude(longitudeEditor); unsignedConverter.setForLongitude(longitudeEditor); @@ -148,8 +148,8 @@ public class SignedDmsCoordinateEditorHandler implements UIHandler<SignedDmsCoor JFormattedTextField editor = ui.getEditor(); editor.setFormatterFactory(model.isSign() ? - signedFormatterFactory : - unsignedFormatterFactory); + signedFormatterFactory : + unsignedFormatterFactory); editor.setFocusLostBehavior(JFormattedTextField.COMMIT); // When editor changes his value, propagate it to model diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/package-info.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/package-info.java index 2ac0576..c496f87 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/package-info.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/signed/package-info.java @@ -2,6 +2,7 @@ * Define some signed coordinate editors. * * Created on 9/2/14. + * * @author Tony Chemit - dev@tchemit.fr * @since 2.12 */ diff --git a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/DdCoordinateTest.java b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/DdCoordinateTest.java index d2ce4e0..82b0f0f 100644 --- a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/DdCoordinateTest.java +++ b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/DdCoordinateTest.java @@ -119,9 +119,9 @@ public class DdCoordinateTest { } public static void assertDdCoordinate(DdCoordinate coordinate, - boolean expectedSign, - Integer expectedDegree, - Integer expectedDecimal) { + boolean expectedSign, + Integer expectedDegree, + Integer expectedDecimal) { Assert.assertNotNull(coordinate); Assert.assertEquals(expectedSign, coordinate.isSign()); Assert.assertEquals(expectedDegree, coordinate.getDegree()); diff --git a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorTest.java b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorTest.java index 8f18713..a2ebc07 100644 --- a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorTest.java +++ b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmdCoordinateEditorTest.java @@ -133,9 +133,9 @@ public class SignedDmdCoordinateEditorTest { @Override public String toString() { return "EditorBean{" + - "longitude=" + longitude + - ", latitude=" + latitude + - '}'; + "longitude=" + longitude + + ", latitude=" + latitude + + '}'; } } diff --git a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorTest.java b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorTest.java index e46658f..26d5866 100644 --- a/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorTest.java +++ b/jaxx-widgets-gis/src/test/java/org/nuiton/jaxx/widgets/gis/signed/SignedDmsCoordinateEditorTest.java @@ -135,9 +135,9 @@ public class SignedDmsCoordinateEditorTest { @Override public String toString() { return "EditorBean{" + - "longitude=" + longitude + - ", latitude=" + latitude + - '}'; + "longitude=" + longitude + + ", latitude=" + latitude + + '}'; } } diff --git a/jaxx-widgets-gis/src/test/resources/log4j.properties b/jaxx-widgets-gis/src/test/resources/log4j.properties index ede1b4f..1268c2f 100644 --- a/jaxx-widgets-gis/src/test/resources/log4j.properties +++ b/jaxx-widgets-gis/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.runtime.swing=DEBUG log4j.logger.org.nuiton.jaxx.widgets.jformattedtextfield=DEBUG #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG diff --git a/jaxx-widgets-hidor/pom.xml b/jaxx-widgets-hidor/pom.xml index 6402508..1e28683 100644 --- a/jaxx-widgets-hidor/pom.xml +++ b/jaxx-widgets-hidor/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx index e5c6c3a..fce05b6 100644 --- a/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx +++ b/jaxx-widgets-hidor/src/main/java/org/nuiton/jaxx/widgets/hidor/HidorButton.jaxx @@ -32,7 +32,7 @@ javax.swing.JComponent static org.nuiton.i18n.I18n.t </import> - + <HidorButtonHandler id='myHandler' constructorParams='this'/> <Boolean id='targetVisible' javaBean='null'/> diff --git a/jaxx-widgets-i18n/pom.xml b/jaxx-widgets-i18n/pom.xml index 86c2ad5..7c9ddef 100644 --- a/jaxx-widgets-i18n/pom.xml +++ b/jaxx-widgets-i18n/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx index 83b725f..184dc04 100644 --- a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx +++ b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditor.jaxx @@ -78,15 +78,15 @@ </JPopupMenu> <JToggleButton - id='button' - text='{SwingUtil.getStringValue(renderer.getText(getSelectedLocale()))}' - toolTipText='{getTip(getSelectedLocale())}' - icon='{renderer.getIcon(getSelectedLocale())}' - constraints='BorderLayout.CENTER' - selected='{popup.isVisible()}' - focusable='true' - focusPainted='false' - onItemStateChanged='if (event.getStateChange() == ItemEvent.SELECTED) { setPopupVisible(true); } else { popupVisible = false; }'/> + id='button' + text='{SwingUtil.getStringValue(renderer.getText(getSelectedLocale()))}' + toolTipText='{getTip(getSelectedLocale())}' + icon='{renderer.getIcon(getSelectedLocale())}' + constraints='BorderLayout.CENTER' + selected='{popup.isVisible()}' + focusable='true' + focusPainted='false' + onItemStateChanged='if (event.getStateChange() == ItemEvent.SELECTED) { setPopupVisible(true); } else { popupVisible = false; }'/> <ButtonGroup id='indexes' onStateChanged='log.info(indexes.getSelectedValue())'/> diff --git a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java index 28fbf71..c02e952 100644 --- a/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java +++ b/jaxx-widgets-i18n/src/main/java/org/nuiton/jaxx/widgets/i18n/I18nEditorHandler.java @@ -21,10 +21,10 @@ */ package org.nuiton.jaxx.widgets.i18n; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import javax.swing.Icon; import javax.swing.JComponent; @@ -42,9 +42,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Locale; -import static org.nuiton.i18n.I18n.t; -import static org.nuiton.i18n.I18n.n; - /** * Handler of ui {@link I18nEditor}. * diff --git a/jaxx-widgets-number/pom.xml b/jaxx-widgets-number/pom.xml index 6f950a7..121ffe8 100644 --- a/jaxx-widgets-number/pom.xml +++ b/jaxx-widgets-number/pom.xml @@ -21,7 +21,8 @@ #L% --> -<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"> +<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> @@ -46,7 +47,7 @@ <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> - + <dependency> <groupId>${project.groupId}</groupId> <artifactId>jaxx-widgets-common</artifactId> diff --git a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberCellEditor.java b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberCellEditor.java index 120b005..d3e4094 100644 --- a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberCellEditor.java +++ b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberCellEditor.java @@ -67,7 +67,7 @@ public class NumberCellEditor<E extends Number> extends AbstractCellEditor int row, int column) { - E number = (E) value; + Number number = (Number) value; numberEditor.setNumberValue(number); // numberEditor.setModelText(JAXXUtil.getStringValue(number)); return numberEditor; diff --git a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java index 45bcd7b..1782e3e 100644 --- a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java +++ b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorHandler.java @@ -25,10 +25,10 @@ package org.nuiton.jaxx.widgets.number; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; -import org.nuiton.jaxx.runtime.spi.UIHandler; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.widgets.MutateOnConditionalPropertyChangeListener; import org.nuiton.util.beans.BeanUtil; @@ -45,6 +45,7 @@ import java.math.BigInteger; import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -258,8 +259,8 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { SwingUtilities.invokeLater(() -> { JComponent invoker = ui.isShowPopupButton() ? - ui.getShowPopUpButton() : - ui; + ui.getShowPopUpButton() : + ui; Dimension dim = ui.getPopup().getPreferredSize(); int x = (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()); ui.getPopup().show(invoker, x, invoker.getHeight()); @@ -279,7 +280,7 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { // init numberType Preconditions.checkState(numberType != null, "Required a number type on " + ui); - numberParserFormatter = getNumberFactory(numberType); + numberParserFormatter = (NumberParserFormatter) getNumberFactory(numberType); if (log.isInfoEnabled()) { log.info("init numberType: " + numberType + " on " + ui); @@ -369,11 +370,11 @@ public class NumberEditorHandler implements UIHandler<NumberEditor> { Method mutator = BeanUtil.getMutator(bean, property); // check mutator exists - Preconditions.checkNotNull(mutator, "could not find mutator for " + property); + Objects.requireNonNull(mutator, "could not find mutator for " + property); // check type is ok Class<?>[] parameterTypes = mutator.getParameterTypes(); - Preconditions.checkNotNull(parameterTypes[0].equals(numberType), "Mismatch mutator type, required a " + numberType + " but was " + parameterTypes[0]); + Objects.requireNonNull(parameterTypes[0].equals(numberType), "Mismatch mutator type, required a " + numberType + " but was " + parameterTypes[0]); // When model number changed, let's push it back in bean model.addPropertyChangeListener( diff --git a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorModel.java b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorModel.java index e02efdc..0f89a8e 100644 --- a/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorModel.java +++ b/jaxx-widgets-number/src/main/java/org/nuiton/jaxx/widgets/number/NumberEditorModel.java @@ -22,12 +22,12 @@ package org.nuiton.jaxx.widgets.number; * #L% */ -import com.google.common.base.Predicate; import org.apache.commons.lang3.StringUtils; import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.widgets.ModelToBean; import java.io.Serializable; +import java.util.function.Predicate; /** * Created on 11/23/14. diff --git a/jaxx-widgets-number/src/test/resources/log4j.properties b/jaxx-widgets-number/src/test/resources/log4j.properties index 0a7b1dc..de5fa46 100644 --- a/jaxx-widgets-number/src/test/resources/log4j.properties +++ b/jaxx-widgets-number/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.runtime.swing=DEBUG #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-widgets-select/pom.xml b/jaxx-widgets-select/pom.xml index cb9d0f4..0b231d6 100644 --- a/jaxx-widgets-select/pom.xml +++ b/jaxx-widgets-select/pom.xml @@ -21,7 +21,8 @@ #L% --> -<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"> +<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> @@ -46,7 +47,7 @@ <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> - + <dependency> <groupId>${project.groupId}</groupId> <artifactId>jaxx-widgets-common</artifactId> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx index 81f9efe..3725b45 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBox.jaxx @@ -142,7 +142,7 @@ public JaxxDefaultComboBoxModel<O> getComboBoxModel() { return (JaxxDefaultCombo </cell> <cell weightx='1'> <!-- la liste déroulante --> - <JComboBox id='combobox' + <JComboBox id='combobox' genericType="O" onFocusGained='hidePopup()'/> </cell> <cell anchor='east' fill='both' insets='0'> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java index 2c7574f..9f8a3ac 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanComboBoxHandler.java @@ -22,9 +22,6 @@ package org.nuiton.jaxx.widgets.select; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; -import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,6 +29,9 @@ import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; +import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.nuiton.util.beans.BeanUtil; import javax.swing.JComboBox; @@ -132,7 +132,7 @@ public class BeanComboBoxHandler<O> implements PropertyChangeListener { this.decorator = BeanUIUtil.createDecorator(decorator); - final JComboBox combobox = ui.getCombobox(); + JComboBox<O> combobox = ui.getCombobox(); // init combobox renderer base on given decorator combobox.setRenderer(new DecoratorListCellRenderer(this.decorator)); @@ -152,8 +152,8 @@ public class BeanComboBoxHandler<O> implements PropertyChangeListener { ui.setSelectedItem(null); } else if ((newSelectedItem == null ^ selectedItem == null) - || (newSelectedItem != null - && !selectedItem.equals(newSelectedItem))) { + || (newSelectedItem != null + && !selectedItem.equals(newSelectedItem))) { ui.setSelectedItem(newSelectedItem); } selectedItem = null; diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx index 62ccbbc..fe0975b 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleList.jaxx @@ -24,16 +24,16 @@ <import> org.nuiton.decorator.JXPathDecorator </import> - - <!-- filterable list property --> + + <!-- filterable list property --> <Boolean id='filterable' javaBean='true'/> - + <!-- flag to reverse the sort --> <Boolean id='reverseSort' javaBean='false'/> - + <!-- show decorator property --> <Boolean id='showDecorator' javaBean='true'/> - + <!-- show reset property --> <Boolean id='showReset' javaBean='true'/> @@ -42,10 +42,10 @@ <!-- show showSelectPopupEnabled property --> <Boolean id='showSelectPopupEnabled' javaBean='true'/> - + <!-- show highlightFilterText property --> <Boolean id='highlightFilterText' javaBean='false'/> - + <!-- bean type --> <Class id='beanType' genericType='O' javaBean='null'/> @@ -63,16 +63,16 @@ <!-- handler --> <BeanDoubleListHandler id='handler' genericType='O' constructorParams='this'/> - <!-- sort index property --> + <!-- sort index property --> <Integer id='index' javaBean='0'/> - + <!-- model of sorted property --> <ButtonGroup id='indexes' onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/> <ButtonGroup id='sortGroup' onStateChanged='setReverseSort((Boolean)sortGroup.getSelectedValue())'/> - + <!-- popup to change sorted property--> <JPopupMenu id='popup' onPopupMenuWillBecomeInvisible='getChangeDecorator().setSelected(false)' @@ -97,7 +97,7 @@ <JMenuItem id='selectedListRemoveAction' onActionPerformed='model.removeFromSelected( (O) selectedList.getSelectedValue())'/> </JPopupMenu> - + <row> <cell columns='3' fill='both'> <JPanel layout='{new BorderLayout()}' id='beforeFilterPanel'/> @@ -124,7 +124,7 @@ <cell weightx='0.5' weighty='1' fill='both'> <JScrollPane onFocusGained='universeList.requestFocus()'> <!-- List of all the remaining available elements --> - <JList id='universeList' + <JList id='universeList' genericType='O' onFocusGained='handler.selectFirstRowIfNoSelection(event)' onMouseClicked='handler.onUniverseListClicked(event)' onKeyPressed='handler.onKeyPressedOnUniverseList(event)'/> @@ -141,7 +141,7 @@ <cell weightx='0.5' weighty='1' fill='both'> <JScrollPane onFocusGained='selectedList.requestFocus()'> <!-- List of the selected elements --> - <JList id='selectedList' + <JList id='selectedList' genericType='O' onFocusGained='handler.selectFirstRowIfNoSelection(event)' onMouseClicked='handler.onSelectedListClicked(event)' onKeyPressed='handler.onKeyPressedOnSelectedList(event)'/> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java index f05d347..9dae02b 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListHandler.java @@ -22,19 +22,16 @@ package org.nuiton.jaxx.widgets.select; * #L% */ -import com.google.common.base.Predicate; -import com.google.common.collect.Lists; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; -import org.nuiton.jaxx.runtime.swing.model.JaxxDefaultListModel; -import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; -import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; -import org.nuiton.jaxx.runtime.swing.renderer.FilteredDecoratorListCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; +import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; +import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; +import org.nuiton.jaxx.runtime.swing.renderer.FilteredDecoratorListCellRenderer; import org.nuiton.util.beans.BeanUtil; import javax.swing.AbstractButton; @@ -54,11 +51,11 @@ import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; +import java.util.function.Predicate; /** * The handler of a {@link BeanDoubleList}. * - * * @param <O> the type of the objects contained in the list. * @author Kevin Morin - kmorin@codelutin.com * @see BeanDoubleList @@ -114,15 +111,16 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { public void init(JXPathDecorator<O> decorator, List<O> universe, List<O> selected) { init(decorator, decorator, universe, selected); } + /** * Initializes the handler of the UI * - * @param decorator the decorator to use to display the data nicely + * @param decorator the decorator to use to display the data nicely * @param decorator2 the selected decorator to use to display the selected data nicely (if none, then reuse the first one) - * @param universe the list of all the available items - * @param selected the list of selected items + * @param universe the list of all the available items + * @param selected the list of selected items */ - public void init(JXPathDecorator<O> decorator,JXPathDecorator<O> decorator2, List<O> universe, List<O> selected) { + public void init(JXPathDecorator<O> decorator, JXPathDecorator<O> decorator2, List<O> universe, List<O> selected) { if (decorator == null) { throw new NullPointerException("decorator can not be null (for type " + ui.getBeanType() + ")"); @@ -138,12 +136,12 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { uiModel.setUniverse(universe); uiModel.setSelected(selected); - JList universeList = ui.getUniverseList(); - final JList selectedList = ui.getSelectedList(); + JList<O> universeList = ui.getUniverseList(); + JList<O> selectedList = ui.getSelectedList(); uiModel.addCanRemoveItemsPredicate(o -> !o.isEmpty()); - final FilteredDecoratorListCellRenderer universeListCellRenderer + FilteredDecoratorListCellRenderer universeListCellRenderer = new FilteredDecoratorListCellRenderer(this.decorator); universeList.setCellRenderer(universeListCellRenderer); @@ -169,7 +167,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { // When selected list model changed, push back selected list to bean selectedList.getModel().addListDataListener(new ListDataListener() { - + @Override public void intervalAdded(ListDataEvent e) { fireSelectionUpdate(); @@ -202,7 +200,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { ui.addPropertyChangeListener(this); - final JaxxFilterableListModel<O> filterModel = (JaxxFilterableListModel) uiModel.getUniverseModel(); + JaxxFilterableListModel<O> filterModel = uiModel.getUniverseModel(); filterModel.setDecorator(this.decorator); @@ -240,10 +238,10 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { } public void recomputeButtonStates() { - JList selectedList = ui.getSelectedList(); + JList<O> selectedList = ui.getSelectedList(); BeanDoubleListModel<O> uiModel = ui.getModel(); - List<O> selectedItems = (List<O>) Lists.newArrayList(selectedList.getSelectedValues()); + List<O> selectedItems = selectedList.getSelectedValuesList(); boolean removeEnabled = uiModel.computeRemoveEnabled(selectedItems); ListSelectionModel selectionModel = selectedList.getSelectionModel(); @@ -253,13 +251,13 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { boolean oneSelection = minSelectionIndex == maxSelectionIndex; boolean upEnabled = removeEnabled && - oneSelection && - minSelectionIndex > 0; + oneSelection && + minSelectionIndex > 0; uiModel.setSelectedUpEnabled(upEnabled); boolean downEnabled = removeEnabled && - oneSelection && - minSelectionIndex + 1 < uiModel.getSelectedListSize(); + oneSelection && + minSelectionIndex + 1 < uiModel.getSelectedListSize(); uiModel.setSelectedDownEnabled(downEnabled); } @@ -362,7 +360,8 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { // change decorator context decorator.setContextIndex(index); - List<O> data = (List<O>) Arrays.asList(((JaxxDefaultListModel<O>) ui.getModel().getUniverseModel()).toArray()); + JaxxFilterableListModel<O> universeModel = ui.getModel().getUniverseModel(); + List<O> data = Arrays.asList(universeModel.toArray()); try { // Sort data with the decorator jxpath tokens. DecoratorUtil.sort(decorator, @@ -387,7 +386,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { * @param event mouse event */ public void onUniverseListClicked(MouseEvent event) { - JList universeList = ui.getUniverseList(); + JList<O> universeList = ui.getUniverseList(); if (event.getClickCount() == 2) { int index = universeList.locationToIndex(event.getPoint()); if (index < 0) { @@ -396,7 +395,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { if (!ui.getModel().isAddEnabled()) { return; } - O item = (O) universeList.getModel().getElementAt(index); + O item = universeList.getModel().getElementAt(index); ui.getModel().addToSelected(item); sortData(); @@ -410,7 +409,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { */ public void onSelectedListClicked(MouseEvent event) { - JList selectedList = ui.getSelectedList(); + JList<O> selectedList = ui.getSelectedList(); if (event.getClickCount() == 2) { int index = selectedList.locationToIndex(event.getPoint()); @@ -420,7 +419,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { if (!ui.getModel().isRemoveEnabled()) { return; } - O item = (O) selectedList.getModel().getElementAt(index); + O item = selectedList.getModel().getElementAt(index); ui.getModel().removeFromSelected(item); sortData(); @@ -429,16 +428,16 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { /** When add button was hit, move selected items (from universe list) to selected list. */ public void select() { - List<O> selection = (List<O>) Arrays.asList(ui.getUniverseList().getSelectedValues()); + List<O> selection = ui.getUniverseList().getSelectedValuesList(); ui.getModel().addToSelected(selection); ui.getUniverseList().clearSelection(); - + sortData(); } /** When remove button was hit, move selected items (from selected list) to universe list. */ public void unselect() { - List<O> selection = (List<O>) Arrays.asList(ui.getSelectedList().getSelectedValues()); + List<O> selection = ui.getSelectedList().getSelectedValuesList(); ui.getModel().removeFromSelected(selection); ui.getSelectedList().clearSelection(); @@ -502,19 +501,19 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { } public void addFilter(Predicate<O> filter) { - ((JaxxFilterableListModel) ui.getModel().getUniverseModel()).addFilter(filter); + ui.getModel().getUniverseModel().addFilter(filter); } public void removeFilter(Predicate<O> filter) { - ((JaxxFilterableListModel) ui.getModel().getUniverseModel()).removeFilter(filter); + ui.getModel().getUniverseModel().removeFilter(filter); } public void clearFilters() { - ((JaxxFilterableListModel) ui.getModel().getUniverseModel()).clearFilters(); + ui.getModel().getUniverseModel().clearFilters(); } public void refreshFilteredElements() { - ((JaxxFilterableListModel) ui.getModel().getUniverseModel()).refreshFilteredElements(); + ui.getModel().getUniverseModel().refreshFilteredElements(); } public void onKeyPressedOnUniverseList(KeyEvent e) { diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListModel.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListModel.java index eb1dd01..4e2735e 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListModel.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanDoubleListModel.java @@ -22,19 +22,18 @@ package org.nuiton.jaxx.widgets.select; * #L% */ -import com.google.common.base.Predicate; import com.google.common.collect.Lists; +import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.runtime.swing.model.JaxxDefaultListModel; import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.beans.AbstractSerializableBean; import javax.swing.ListModel; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.function.Predicate; + /** * The model of the {@link BeanDoubleList} widget @@ -46,8 +45,6 @@ import java.util.List; */ public class BeanDoubleListModel<O> extends AbstractSerializableBean { - private static final Log log = LogFactory.getLog(BeanDoubleListModel.class); - public static final String PROPERTY_ADD_ENABLED = "addEnabled"; public static final String PROPERTY_REMOVE_ENABLED = "removeEnabled"; @@ -140,11 +137,11 @@ public class BeanDoubleListModel<O> extends AbstractSerializableBean { universeModel.setAllElements(universe); } - public ListModel getSelectedModel() { + public ListModel<O> getSelectedModel() { return selectedModel; } - public ListModel getUniverseModel() { + public JaxxFilterableListModel<O> getUniverseModel() { return universeModel; } @@ -306,7 +303,7 @@ public class BeanDoubleListModel<O> extends AbstractSerializableBean { // the maximum index where we should insert the item is its index // in the list of all the available items int index = universe.indexOf(item); - if (index!=-1) { + if (index != -1) { // if the index is upper than the size of the list of the remaining available items, // get the size of this list int insertionIndex = Math.min(index, universeModel.getSize()); @@ -330,7 +327,7 @@ public class BeanDoubleListModel<O> extends AbstractSerializableBean { return selected.size(); } - public void addCanRemoveItemsPredicate(Predicate<List<O>> canRemoveItemsPredicate) { + public void addCanRemoveItemsPredicate(java.util.function.Predicate<List<O>> canRemoveItemsPredicate) { canRemoveItemsPredicates.add(canRemoveItemsPredicate); } @@ -340,9 +337,9 @@ public class BeanDoubleListModel<O> extends AbstractSerializableBean { public boolean computeRemoveEnabled(List<O> toRemoveItems) { boolean result = true; - Iterator<Predicate<List<O>>> iterator = canRemoveItemsPredicates.iterator(); + Iterator<java.util.function.Predicate<List<O>>> iterator = canRemoveItemsPredicates.iterator(); while (result && iterator.hasNext()) { - result = iterator.next().apply(toRemoveItems); + result = iterator.next().test(toRemoveItems); } setRemoveEnabled(result); return result; diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx index ebb76b8..11a1d79 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBox.jaxx @@ -147,7 +147,7 @@ public JaxxFilterableComboBoxModel<O> getComboBoxModel() { return (JaxxFilterabl </cell> <cell weightx='1'> <!-- la liste déroulante --> - <JComboBox id='combobox'/> + <JComboBox id='combobox' genericType='O'/> </cell> <cell anchor='east' fill='both' insets='0'> <!-- le boutton pour changer le tri --> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java index d88cb92..a8d1feb 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanFilterableComboBoxHandler.java @@ -21,17 +21,17 @@ */ package org.nuiton.jaxx.widgets.select; -import org.nuiton.jaxx.runtime.JAXXUtil; -import org.nuiton.jaxx.runtime.SwingUtil; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; -import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableComboBoxModel; -import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.JAXXUtil; +import org.nuiton.jaxx.runtime.SwingUtil; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; +import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableComboBoxModel; +import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.nuiton.util.beans.BeanUtil; import javax.swing.AbstractButton; @@ -55,6 +55,7 @@ import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.util.Collections; import java.util.List; +import java.util.Objects; /** * Le handler d'un {@link BeanFilterableComboBox}. @@ -170,8 +171,8 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener this.decorator = BeanUIUtil.createDecorator(decorator); - final JComboBox combobox = ui.getCombobox(); - final JAXXFilterableComboBoxEditor editor = + JComboBox<O> combobox = ui.getCombobox(); + JAXXFilterableComboBoxEditor editor = new JAXXFilterableComboBoxEditor(ui.getCombobox().getEditor()); combobox.setEditor(editor); @@ -204,7 +205,6 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener } combobox.hidePopup(); e.consume(); - return; } } } @@ -262,7 +262,7 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener // init combobox renderer base on given decorator combobox.setRenderer(new DecoratorListCellRenderer(this.decorator)); - ((JaxxFilterableComboBoxModel) combobox.getModel()).setDecorator(this.decorator); + ((JaxxFilterableComboBoxModel<O>) combobox.getModel()).setDecorator(this.decorator); combobox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); combobox.addItemListener(e -> { Object item = e.getItem(); @@ -704,7 +704,7 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener if (oldItem != null && getBeanType().isInstance(oldItem)) { // The original value is not a string. Should return the value in it's // original type. - if (newValue.equals(decorator.toString(oldItem))) { + if (Objects.equals(newValue, decorator.toString(oldItem))) { newValue = oldItem; } } diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx index f0c7b34..39d6159 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeader.jaxx @@ -86,7 +86,7 @@ </JPopupMenu> - <JList id='list' javaBean="new JList()"/> + <JList id='list' genericType='O' javaBean="new JList<>()"/> <script><![CDATA[ diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java index 5552e2b..6675733 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/BeanListHeaderHandler.java @@ -22,8 +22,6 @@ package org.nuiton.jaxx.widgets.select; -import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; -import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.apache.commons.collections.primitives.ArrayIntList; import org.apache.commons.collections.primitives.IntList; import org.apache.commons.logging.Log; @@ -31,6 +29,8 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; +import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JComponent; @@ -40,6 +40,7 @@ import javax.swing.ListModel; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.List; +import java.util.Vector; /** * Le handler d'un {@link BeanListHeader}. @@ -181,11 +182,11 @@ public class BeanListHeaderHandler<O> implements PropertyChangeListener { String expression = decorator.getExpression(); if (log.isDebugEnabled()) { log.debug("will use expression (index = " + index + ") : " + - expression); + expression); } // get the current selection in list - Object[] selection = ui.getList().getSelectedValues(); + List<O> selection = ui.getList().getSelectedValuesList(); List<O> datas = ui.getData(); try { @@ -214,16 +215,16 @@ public class BeanListHeaderHandler<O> implements PropertyChangeListener { } else { - ui.getList().setListData(datas.toArray(new Object[datas.size()])); + ui.getList().setListData(new Vector<>(datas)); } // re-apply selection - if (selection.length > 0) { + if (selection.size() > 0) { // re compute selection (the new data could not contains some // previously selected items) IntList newSelection = new ArrayIntList(); - for (Object o : selection) { + for (O o : selection) { if (datas.contains(o)) { newSelection.add(datas.indexOf(o)); @@ -285,7 +286,7 @@ public class BeanListHeaderHandler<O> implements PropertyChangeListener { } public O getSelectedValue() { - JList list = ui.getList(); - return list == null ? null : (O) list.getSelectedValue(); + JList<O> list = ui.getList(); + return list == null ? null : list.getSelectedValue(); } } diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleList.jaxx b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleList.jaxx index 5ffc97e..f6aab33 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleList.jaxx +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleList.jaxx @@ -69,8 +69,10 @@ <!-- popup on the selected list --> <JPopupMenu id='selectedListPopup'> - <JMenuItem id='selectedListMoveUpAction' onActionPerformed='handler.moveUpSelected( (O) selectedList.getSelectedValue())'/> - <JMenuItem id='selectedListMoveDownAction' onActionPerformed='handler.moveDownSelected( (O) selectedList.getSelectedValue())'/> + <JMenuItem id='selectedListMoveUpAction' + onActionPerformed='handler.moveUpSelected( (O) selectedList.getSelectedValue())'/> + <JMenuItem id='selectedListMoveDownAction' + onActionPerformed='handler.moveDownSelected( (O) selectedList.getSelectedValue())'/> <JMenuItem id='selectedListRemoveAction' onActionPerformed='handler.unselect()'/> </JPopupMenu> @@ -99,7 +101,7 @@ <cell weightx='0.5' weighty='1' fill='both'> <JScrollPane id='universeListPane' onFocusGained='universeList.requestFocus()'> <!-- List of all the remaining available elements --> - <JList id='universeList' styleClass='enabled' + <JList id='universeList' styleClass='enabled' genericType="O" onFocusGained='handler.selectFirstRowIfNoSelection(event)' onMouseClicked='handler.onUniverseListClicked(event)' onKeyPressed='handler.onKeyPressedOnUniverseList(event)'/> @@ -116,7 +118,7 @@ <cell weightx='0.5' weighty='1' fill='both'> <JScrollPane id='selectedListPane' onFocusGained='selectedList.requestFocus()'> <!-- List of the selected elements --> - <JList id='selectedList' styleClass='enabled' + <JList id='selectedList' styleClass='enabled' genericType="O" onFocusGained='handler.selectFirstRowIfNoSelection(event)' onMouseClicked='handler.onSelectedListClicked(event)' onKeyPressed='handler.onKeyPressedOnSelectedList(event)'/> diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListHandler.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListHandler.java index 1b8165e..a787184 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListHandler.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListHandler.java @@ -22,21 +22,17 @@ package org.nuiton.jaxx.widgets.select; * #L% */ -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.Lists; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.decorator.DecoratorUtil; +import org.nuiton.decorator.JXPathDecorator; +import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.runtime.SwingUtil; import org.nuiton.jaxx.runtime.spi.UIHandler; import org.nuiton.jaxx.runtime.swing.JAXXButtonGroup; import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; import org.nuiton.jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import org.nuiton.jaxx.runtime.swing.renderer.FilteredDecoratorListCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.decorator.DecoratorUtil; -import org.nuiton.decorator.JXPathDecorator; -import org.nuiton.decorator.MultiJXPathDecorator; import org.nuiton.jaxx.widgets.DecoratorPopupHandler; import org.nuiton.jaxx.widgets.MutateOnConditionalPropertyChangeListener; import org.nuiton.util.beans.BeanUtil; @@ -54,8 +50,10 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.io.Serializable; import java.lang.reflect.Method; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.function.Predicate; /** * Created on 11/28/14. @@ -141,7 +139,8 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa } O item = ui.getModel().getUniverseModel().getElementAt(index); - List<O> items = Lists.newArrayList(item); + List<O> items = new ArrayList<>(); + items.add(item); ui.getModel().addToSelected(items); // sortData(); @@ -164,8 +163,8 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa return; } - O item = ui.getModel().getSelectedModel().getElementAt(index); - List<O> items = Lists.newArrayList(item); + List<O> items = new ArrayList<>(); + items.add(ui.getModel().getSelectedModel().getElementAt(index)); ui.getModel().removeFromSelected(items); sortData(); @@ -176,9 +175,8 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa /** When add button was hit, move selected items (from universe list) to selected list. */ public void select() { - Object[] selectedValues = ui.getUniverseList().getSelectedValues(); - List<O> selection = (List) Arrays.asList(selectedValues); - ui.getModel().addToSelected(selection); + List<O> selectedValues = ui.getUniverseList().getSelectedValuesList(); + ui.getModel().addToSelected(selectedValues); ui.getUniverseList().clearSelection(); // sortData(); @@ -188,9 +186,8 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa /** When remove button was hit, move selected items (from selected list) to universe list. */ public void unselect() { - Object[] selectedValues = ui.getSelectedList().getSelectedValues(); - List<O> selection = (List) Arrays.asList(selectedValues); - ui.getModel().removeFromSelected(selection); + List<O> selectedValues = ui.getSelectedList().getSelectedValuesList(); + ui.getModel().removeFromSelected(selectedValues); ui.getSelectedList().clearSelection(); sortData(); @@ -322,12 +319,12 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa Method mutator = BeanUtil.getMutator(bean, property); // check mutator exists - Preconditions.checkNotNull(mutator, "could not find mutator for " + property); + Objects.requireNonNull(mutator, "could not find mutator for " + property); // When selected list changed, let's push it back in bean model.addPropertyChangeListener( FilterableDoubleListModel.PROPERTY_SELECTED, - new MutateOnConditionalPropertyChangeListener<FilterableDoubleListModel>(model, mutator, Predicates.alwaysTrue())); + new MutateOnConditionalPropertyChangeListener<FilterableDoubleListModel>(model, mutator, filterableDoubleListModel -> true)); } } @@ -349,9 +346,8 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa { // Init universe list - JList universeList = ui.getUniverseList(); - final FilteredDecoratorListCellRenderer universeListCellRenderer - = new FilteredDecoratorListCellRenderer(this.decorator); + JList<O> universeList = ui.getUniverseList(); + FilteredDecoratorListCellRenderer universeListCellRenderer = new FilteredDecoratorListCellRenderer(this.decorator); universeList.setCellRenderer(universeListCellRenderer); // When universe list selection model changed, update the add button enabled property universeList.getSelectionModel().addListSelectionListener(e -> { @@ -390,7 +386,7 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa { // Init selected list - JList selectedList = ui.getSelectedList(); + JList<O> selectedList = ui.getSelectedList(); if (decorator2 != null) { decorator2 = DecoratorUtil.cloneDecorator(decorator2); } else { @@ -413,13 +409,13 @@ public class FilterableDoubleListHandler<O extends Serializable> implements UIHa boolean oneSelection = minSelectionIndex == maxSelectionIndex; boolean upEnabled = removeEnabled && - oneSelection && - minSelectionIndex > 0; + oneSelection && + minSelectionIndex > 0; model1.setSelectedUpEnabled(upEnabled); boolean downEnabled = removeEnabled && - oneSelection && - minSelectionIndex + 1 < model1.getSelectedListSize(); + oneSelection && + minSelectionIndex + 1 < model1.getSelectedListSize(); model1.setSelectedDownEnabled(downEnabled); } }); diff --git a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListModel.java b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListModel.java index 4ffbad5..99d07b2 100644 --- a/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListModel.java +++ b/jaxx-widgets-select/src/main/java/org/nuiton/jaxx/widgets/select/FilterableDoubleListModel.java @@ -22,9 +22,9 @@ package org.nuiton.jaxx.widgets.select; * #L% */ +import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.runtime.swing.model.JaxxDefaultListModel; import org.nuiton.jaxx.runtime.swing.model.JaxxFilterableListModel; -import org.jdesktop.beans.AbstractSerializableBean; import org.nuiton.jaxx.widgets.ModelToBean; import javax.swing.event.ListDataEvent; diff --git a/jaxx-widgets-select/src/test/resources/log4j.properties b/jaxx-widgets-select/src/test/resources/log4j.properties index 4f71558..85c6b30 100644 --- a/jaxx-widgets-select/src/test/resources/log4j.properties +++ b/jaxx-widgets-select/src/test/resources/log4j.properties @@ -25,7 +25,6 @@ log4j.rootLogger=ERROR, stdout 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.runtime.swing=DEBUG #log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-widgets-status/pom.xml b/jaxx-widgets-status/pom.xml index 0caf672..86a03be 100644 --- a/jaxx-widgets-status/pom.xml +++ b/jaxx-widgets-status/pom.xml @@ -24,7 +24,8 @@ #L% --> -<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"> +<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> diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx index 3175913..71d8809 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidget.jaxx @@ -33,7 +33,7 @@ </import> <MemoryStatusWidgetHandler id='handler' constructorParams='this'/> - + <javax.swing.Timer id='timer' javaBean='null'/> <Color id='progressBackground' javaBean='Color.decode("#666699a")'/> diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java index a01d1d2..a5fe2f8 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/MemoryStatusWidgetHandler.java @@ -72,16 +72,16 @@ public class MemoryStatusWidgetHandler { (int) ((float) width * fraction), height); g2.setColor(ui.progressForeground); g2.drawString(str, insets.left - + (int) ((double) width - bounds.getWidth()) / 2, + + (int) ((double) width - bounds.getWidth()) / 2, (int) ((float) insets.top + lm.getAscent())); g2.dispose(); g2 = g.create(); g2.setClip(insets.left + (int) ((float) width * fraction), insets.top, ui.getWidth() - insets.left - - (int) ((float) width * fraction), height); + - (int) ((float) width * fraction), height); g2.setColor(ui.getForeground()); g2.drawString(str, insets.left - + (int) ((double) width - bounds.getWidth()) / 2, + + (int) ((double) width - bounds.getWidth()) / 2, (int) ((float) insets.top + lm.getAscent())); g2.dispose(); } diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx index 10c40be..9e4d44f 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanel.jaxx @@ -22,8 +22,8 @@ <Table border='{BorderFactory.createBevelBorder(BevelBorder.LOWERED)}' - insets='0' - implements='java.awt.event.ActionListener'> + insets='0' + implements='java.awt.event.ActionListener'> <import> java.awt.Component @@ -31,7 +31,7 @@ javax.swing.BorderFactory javax.swing.border.BevelBorder </import> - + <script><![CDATA[ // To ensure status bar constant height, no matter what font are in use... diff --git a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java index 11b3b8c..1327589 100644 --- a/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java +++ b/jaxx-widgets-status/src/main/java/org/nuiton/jaxx/widgets/status/StatusMessagePanelHandler.java @@ -110,8 +110,8 @@ public class StatusMessagePanelHandler { timer = new Timer(millisecondsPerMinute, ui); timer.setRepeats(false); timer.setInitialDelay((int) ((long) millisecondsPerMinute - - System.currentTimeMillis() % - (long) millisecondsPerMinute) + 500); + System.currentTimeMillis() % + (long) millisecondsPerMinute) + 500); timer.start(); } diff --git a/src/site/rst/BeanValidator.rst b/src/site/rst/BeanValidator.rst index 3f8ab1b..39146d3 100644 --- a/src/site/rst/BeanValidator.rst +++ b/src/site/rst/BeanValidator.rst @@ -156,7 +156,7 @@ Les conversions =============== Pour l'édition de proriétés qui ne sont pas des chaines de caractères, des erreurs de conversions peuvent survenir (conversion de la valeur de l'édtieur graphique vers le bean), avant que l'on utilise -réellement la mécanique de la validation. +réellement la mécanique de la validation. Pour palier à ce problème on a intégré la gestion des erreurs de conversion dans le validateur. Pour ce faire, il suffit de faire appel à la méthode suivante pour injecter dans un bean une propriété : diff --git a/src/site/rst/demo.rst b/src/site/rst/demo.rst index 6a2f828..e4f57e5 100644 --- a/src/site/rst/demo.rst +++ b/src/site/rst/demo.rst @@ -47,9 +47,9 @@ ses composants : * Validation .. image::demo1.png - :width:800px +:width:800px .. image::demo2.png - :width:800px +:width:800px .. _Demonstration de JAXX: ./jaxx-demo/jnlp/jaxx-demo.jnlp diff --git a/src/site/rst/index.rst b/src/site/rst/index.rst index be72e91..a6e6b9a 100644 --- a/src/site/rst/index.rst +++ b/src/site/rst/index.rst @@ -384,7 +384,7 @@ Voici une liste de projets utilisant JAXX : * Nuiton-i18n-editor .. TODO Finish this list and add icons - + .. _Isis-fish: http://www.isis-fish.org/ .. _simExplorer-si: http://www.simexplorer.org diff --git a/src/site/rst/old-compiler-doc/BeanValidator.rst b/src/site/rst/old-compiler-doc/BeanValidator.rst index d49f971..c94e846 100644 --- a/src/site/rst/old-compiler-doc/BeanValidator.rst +++ b/src/site/rst/old-compiler-doc/BeanValidator.rst @@ -185,7 +185,7 @@ Les conversions =============== Pour l'édition de proriétés qui ne sont pas des chaines de caractères, des erreurs de conversions peuvent survenir (conversion de la valeur de l'édtieur graphique vers le bean), avant que l'on utilise -réellement la mécanique de la validation. +réellement la mécanique de la validation. Pour palier à ce problème on a intégré la gestion des erreurs de conversion dans le validateur. Pour ce faire, il suffit de faire appel à la méthode suivante pour injecter dans un bean une propriété : -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm