[jaxx] branch develop updated (a7154ad -> 4f63135)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git from a7154ad fixes #3499 Block an action if it is alreay running new 4f63135 refs-70 #3501: Introduce a new jaxx-widgets-datetime module use nuiton-utils API 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 4f63135d83e58f6b35b508c9c90c628950ad7220 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 9 19:22:12 2014 +0200 refs-70 #3501: Introduce a new jaxx-widgets-datetime module use nuiton-utils API Summary of changes: jaxx-demo/pom.xml | 6 + .../jaxx/editor/datetime/DateTimeEditorDemo.css | 51 ++++ .../jaxx/editor/datetime/DateTimeEditorDemo.jaxx | 49 ++++ .../editor/datetime/DateTimeEditorDemoHandler.java | 69 +++++ .../main/java/jaxx/demo/tree/DemoDataProvider.java | 10 + .../main/resources/i18n/jaxx-demo_en_GB.properties | 13 + .../main/resources/i18n/jaxx-demo_es_ES.properties | 16 + .../main/resources/i18n/jaxx-demo_fr_FR.properties | 15 +- LICENSE.txt => jaxx-widgets-datetime/LICENSE.txt | 0 README.txt => jaxx-widgets-datetime/README.txt | 0 .../changelog.txt | 0 .../pom.xml | 18 +- .../src/license/THIRD-PARTY.properties | 0 .../jaxx/widgets/datetime/DateTimeEditor.css | 38 +++ .../jaxx/widgets/datetime/DateTimeEditor.jaxx | 50 ++++ .../widgets/datetime/DateTimeEditorHandler.java | 119 ++++++++ .../jaxx/widgets/datetime/DateTimeEditorModel.java | 325 +++++++++++++++++++++ .../i18n/jaxx-widgets-datetime_en_GB.properties | 1 + .../i18n/jaxx-widgets-datetime_es_ES.properties | 1 + .../i18n/jaxx-widgets-datetime_fr_FR.properties | 1 + .../resources/icons/action-coordinate-reset.png | Bin .../src/site/site.xml | 0 .../src/test/resources/log4j.properties | 0 .../AbsoluteDdCoordinateEditorHandler.java | 6 +- .../AbsoluteDmdCoordinateEditorHandler.java | 8 +- .../AbsoluteDmsCoordinateEditorHandler.java | 8 +- .../gis/absolute/CoordinatesEditorHandler.java | 8 +- .../gis/absolute/CoordinatesEditorModel.java | 4 - .../signed/SignedDdCoordinateEditorHandler.java | 8 +- .../signed/SignedDmdCoordinateEditorHandler.java | 10 +- .../signed/SignedDmsCoordinateEditorHandler.java | 10 +- .../runtime/swing/editor/NumberEditor2Handler.java | 6 +- .../runtime/swing/editor/NumberEditorHandler.java | 4 +- .../swing/editor/SimpleTimeEditorHandler.java | 4 +- .../runtime/swing/editor/TimeEditorHandler.java | 7 +- .../swing/editor/bean/BeanComboBoxHandler.java | 3 +- .../swing/editor/bean/BeanDoubleListHandler.java | 3 +- .../editor/bean/BeanFilterableComboBoxHandler.java | 3 +- .../jaxx/runtime/swing/editor/bean/BeanUIUtil.java | 21 -- .../editor/gis/DmdCoordinateEditorHandler.java | 10 +- .../editor/gis/DmsCoordinateEditorHandler.java | 10 +- pom.xml | 3 +- 42 files changed, 829 insertions(+), 89 deletions(-) create mode 100644 jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.css create mode 100644 jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.jaxx create mode 100644 jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemoHandler.java copy LICENSE.txt => jaxx-widgets-datetime/LICENSE.txt (100%) copy README.txt => jaxx-widgets-datetime/README.txt (100%) copy {jaxx-config => jaxx-widgets-datetime}/changelog.txt (100%) copy {jaxx-widgets-gis => jaxx-widgets-datetime}/pom.xml (92%) copy {jaxx-config => jaxx-widgets-datetime}/src/license/THIRD-PARTY.properties (100%) create mode 100644 jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.css create mode 100644 jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx create mode 100644 jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java create mode 100644 jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java create mode 100644 jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_en_GB.properties create mode 100644 jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_es_ES.properties create mode 100644 jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_fr_FR.properties copy {jaxx-widgets-gis => jaxx-widgets-datetime}/src/main/resources/icons/action-coordinate-reset.png (100%) copy {jaxx-widgets-gis => jaxx-widgets-datetime}/src/site/site.xml (100%) copy {jaxx-widgets-gis => jaxx-widgets-datetime}/src/test/resources/log4j.properties (100%) -- 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 http://git.nuiton.org/jaxx.git commit 4f63135d83e58f6b35b508c9c90c628950ad7220 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Sep 9 19:22:12 2014 +0200 refs-70 #3501: Introduce a new jaxx-widgets-datetime module use nuiton-utils API --- jaxx-demo/pom.xml | 6 + .../jaxx/editor/datetime/DateTimeEditorDemo.css | 51 ++++ .../jaxx/editor/datetime/DateTimeEditorDemo.jaxx | 49 ++++ .../editor/datetime/DateTimeEditorDemoHandler.java | 69 +++++ .../main/java/jaxx/demo/tree/DemoDataProvider.java | 10 + .../main/resources/i18n/jaxx-demo_en_GB.properties | 13 + .../main/resources/i18n/jaxx-demo_es_ES.properties | 16 + .../main/resources/i18n/jaxx-demo_fr_FR.properties | 15 +- jaxx-widgets-datetime/LICENSE.txt | 165 +++++++++++ jaxx-widgets-datetime/README.txt | 2 + jaxx-widgets-datetime/changelog.txt | 5 + jaxx-widgets-datetime/pom.xml | 172 +++++++++++ .../src/license/THIRD-PARTY.properties | 20 ++ .../jaxx/widgets/datetime/DateTimeEditor.css | 38 +++ .../jaxx/widgets/datetime/DateTimeEditor.jaxx | 50 ++++ .../widgets/datetime/DateTimeEditorHandler.java | 119 ++++++++ .../jaxx/widgets/datetime/DateTimeEditorModel.java | 325 +++++++++++++++++++++ .../i18n/jaxx-widgets-datetime_en_GB.properties | 1 + .../i18n/jaxx-widgets-datetime_es_ES.properties | 1 + .../i18n/jaxx-widgets-datetime_fr_FR.properties | 1 + .../resources/icons/action-coordinate-reset.png | Bin 0 -> 396 bytes jaxx-widgets-datetime/src/site/site.xml | 43 +++ .../src/test/resources/log4j.properties | 31 ++ .../AbsoluteDdCoordinateEditorHandler.java | 6 +- .../AbsoluteDmdCoordinateEditorHandler.java | 8 +- .../AbsoluteDmsCoordinateEditorHandler.java | 8 +- .../gis/absolute/CoordinatesEditorHandler.java | 8 +- .../gis/absolute/CoordinatesEditorModel.java | 4 - .../signed/SignedDdCoordinateEditorHandler.java | 8 +- .../signed/SignedDmdCoordinateEditorHandler.java | 10 +- .../signed/SignedDmsCoordinateEditorHandler.java | 10 +- .../runtime/swing/editor/NumberEditor2Handler.java | 6 +- .../runtime/swing/editor/NumberEditorHandler.java | 4 +- .../swing/editor/SimpleTimeEditorHandler.java | 4 +- .../runtime/swing/editor/TimeEditorHandler.java | 7 +- .../swing/editor/bean/BeanComboBoxHandler.java | 3 +- .../swing/editor/bean/BeanDoubleListHandler.java | 3 +- .../editor/bean/BeanFilterableComboBoxHandler.java | 3 +- .../jaxx/runtime/swing/editor/bean/BeanUIUtil.java | 21 -- .../editor/gis/DmdCoordinateEditorHandler.java | 10 +- .../editor/gis/DmsCoordinateEditorHandler.java | 10 +- pom.xml | 3 +- 42 files changed, 1257 insertions(+), 81 deletions(-) diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index dec9b00..78eadb0 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -96,6 +96,12 @@ <dependency> <groupId>${project.groupId}</groupId> + <artifactId>jaxx-widgets-datetime</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>jaxx-config</artifactId> <version>${project.version}</version> </dependency> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.css b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.css new file mode 100644 index 0000000..1e2dfa7 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.css @@ -0,0 +1,51 @@ + +#configPanel { + border:{new TitledBorder(t("jaxxdemo.datetimeeditor.configuration"))}; + layout:{new GridLayout(0,1)}; +} + +#labelConfigLabel { + text:"jaxxdemo.datetimeeditor.configuration.label"; +} + +#labelConfig { + text:{t("jaxxdemo.datetimeeditor.configuration.label.value")}; +} + +#editor { + bean:{model}; + propertyDate:date; + propertyDayDate:dayDate; + propertyTimeDate:timeDate; + border:{new TitledBorder(t("jaxxdemo.datetimeeditor.editor"))}; + date:{model.getDate()}; + label:{labelConfig.getText()}; +} + +#result { + border: {new TitledBorder(t("jaxxdemo.datetimeeditor.result"))}; +} + +#resultDate{ + text: {handler.getDate(model.getDate())}; +} + +#resultDayDate{ + text: {handler.getDayDate(model.getDayDate())}; +} + +#resultTimeDate{ + text: {handler.getTimeDate(model.getTimeDate())}; +} + +#resultTimeInMinutes{ + text: {handler.getTimeInMinutes(model.getTimeInMinutes())}; +} + +#resultHours{ + text: {handler.getHours(model.getTimeInMinutes() / 60)}; +} + +#resultMinutes{ + text: {handler.getMinutes(model.getTimeInMinutes() % 60)}; +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.jaxx new file mode 100644 index 0000000..01e23f8 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemo.jaxx @@ -0,0 +1,49 @@ +<!-- + #%L + JAXX :: Demo + %% + Copyright (C) 2008 - 2014 Code Lutin, 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% + --> +<jaxx.demo.DemoPanel layout='{new BorderLayout()}'> + + <import> + org.nuiton.jaxx.widgets.datetime.DateTimeEditorModel + org.nuiton.jaxx.widgets.datetime.DateTimeEditor + </import> + + <DateTimeEditorModel id='model' initializer='getContextValue(DateTimeEditorModel.class)'/> + + <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'> + + <JPanel id="configPanel" layout='{new BorderLayout()}' constraints='BorderLayout.NORTH'> + <JLabel id='labelConfigLabel' constraints='BorderLayout.WEST'/> + <JTextField id='labelConfig' constraints='BorderLayout.CENTER'/> + </JPanel> + <DateTimeEditor id='editor' constructorParams='this' constraints='BorderLayout.CENTER'/> + </JPanel> + + <JPanel id='result' layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> + <JLabel id='resultDate'/> + <JLabel id='resultDayDate'/> + <JLabel id='resultTimeDate'/> + <JLabel id='resultTimeInMinutes'/> + <JLabel id='resultHours'/> + <JLabel id='resultMinutes'/> + </JPanel> + +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemoHandler.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemoHandler.java new file mode 100644 index 0000000..024e8e6 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/datetime/DateTimeEditorDemoHandler.java @@ -0,0 +1,69 @@ +package jaxx.demo.component.jaxx.editor.datetime; + +import jaxx.runtime.spi.UIHandler; +import org.nuiton.jaxx.widgets.datetime.DateTimeEditorModel; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import static org.nuiton.i18n.I18n.t; + +/** + * Created on 9/9/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.12 + */ +public class DateTimeEditorDemoHandler implements UIHandler<DateTimeEditorDemo> { + + protected final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); + + protected final DateFormat dayDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + + protected final DateFormat timeDateFormat = new SimpleDateFormat("hh:mm"); + + @Override + public void beforeInit(DateTimeEditorDemo ui) { + + DateTimeEditorModel model = new DateTimeEditorModel(); + model.setDate(new Date()); + + ui.setContextValue(model); + + } + + @Override + public void afterInit(final DateTimeEditorDemo ui) { + + // init editor + ui.getEditor().init(); + + } + + public String getDate(Date date) { + return t("jaxxdemo.datetimeeditor.result.date", dateFormat.format(date)); + } + + public String getDayDate(Date date) { + return t("jaxxdemo.datetimeeditor.result.dayDate", dayDateFormat.format(date)); + } + + public String getTimeDate(Date date) { + return t("jaxxdemo.datetimeeditor.result.timeDate", timeDateFormat.format(date)); + } + + public String getTimeInMinutes(Integer timeInMinutes) { + return t("jaxxdemo.datetimeeditor.result.timeInMinutes", timeInMinutes); + } + + public String getHours(Integer hours) { + return t("jaxxdemo.datetimeeditor.result.hours", hours); + } + + public String getMinutes(Integer minutes) { + return t("jaxxdemo.datetimeeditor.result.minutes", minutes); + } + + +} \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java b/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java index 1235a23..08f7081 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java +++ b/jaxx-demo/src/main/java/jaxx/demo/tree/DemoDataProvider.java @@ -26,6 +26,7 @@ import jaxx.demo.component.jaxx.BoxedDecoratorDemo; import jaxx.demo.component.jaxx.StatusMessagePanelDemo; import jaxx.demo.component.jaxx.editor.BeanComboBoxDemo; import jaxx.demo.component.jaxx.editor.ComboEditorDemo; +import jaxx.demo.component.jaxx.editor.datetime.DateTimeEditorDemo; import jaxx.demo.component.jaxx.editor.gis.CoordinateDemo; import jaxx.demo.component.jaxx.editor.gis.CoordinatesEditorDemo; import jaxx.demo.component.jaxx.editor.DatePickerDemo; @@ -167,10 +168,19 @@ public class DemoDataProvider implements NavDataProvider { BeanComboBoxDemo.class, BeanFilterableComboBoxDemo.class, BeanDoubleListDemo.class, + n("jaxxdemo.component.jaxx.editor.gis"), + n("jaxxdemo.component.jaxx.editor.datetime") + ); + + addMapping(n("jaxxdemo.component.jaxx.editor.gis"), CoordinateDemo.class, CoordinatesEditorDemo.class ); + addMapping(n("jaxxdemo.component.jaxx.editor.datetime"), + DateTimeEditorDemo.class + ); + addMapping(n("jaxxdemo.feature"), n("jaxxdemo.feature.databinding"), n("jaxxdemo.feature.validation"), diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties index 0abfeba..61d8bbd 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo_en_GB.properties @@ -211,6 +211,8 @@ jaxxdemo.common.title=Title jaxxdemo.common.year=Year jaxxdemo.component.jaxx=JAXX Components jaxxdemo.component.jaxx.editor=Editors +jaxxdemo.component.jaxx.editor.datetime=Time editors +jaxxdemo.component.jaxx.editor.gis=Gis editors jaxxdemo.component.swing=Swing Components jaxxdemo.component.swing.buttons=Buttons jaxxdemo.component.swing.form=Form elements @@ -250,6 +252,17 @@ jaxxdemo.coordinatesEditor.configuration=Configuration jaxxdemo.datePickerEditor.dateResult=Result display jaxxdemo.datePickerEditor.patternLayout=Date pattern jaxxdemo.datePickerEditor.showPopupButton=Display popup button +jaxxdemo.datetimeeditor.configuration=Configuration +jaxxdemo.datetimeeditor.configuration.label=Label of editor +jaxxdemo.datetimeeditor.configuration.label.value=Date - Time +jaxxdemo.datetimeeditor.editor=Editor +jaxxdemo.datetimeeditor.result=Result +jaxxdemo.datetimeeditor.result.date=<html>Date\: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.dayDate=<html>Day\: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.hours=<html>Hours\: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.minutes=<html>Minutes\: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.timeDate=<html>Time\: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.timeInMinutes=<html>Time in minutes\: <strong>%s</strong> jaxxdemo.feature=Features jaxxdemo.feature.databinding=Data Binding jaxxdemo.feature.list.validation=Multiple Bean Validation diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties index 93fce91..dec069b 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo_es_ES.properties @@ -211,6 +211,8 @@ jaxxdemo.common.title=Titre jaxxdemo.common.year=Année jaxxdemo.component.jaxx=Composants JAXX jaxxdemo.component.jaxx.editor=Editeurs +jaxxdemo.component.jaxx.editor.datetime= +jaxxdemo.component.jaxx.editor.gis= jaxxdemo.component.swing=Composants Swing jaxxdemo.component.swing.buttons=Boutons jaxxdemo.component.swing.form=Elements de formulaire @@ -250,6 +252,20 @@ jaxxdemo.coordinatesEditor.configuration= jaxxdemo.datePickerEditor.dateResult=Affichage du résultat jaxxdemo.datePickerEditor.patternLayout=Pattern de date jaxxdemo.datePickerEditor.showPopupButton=Afficher le boutton pour ouvrir la popup +jaxxdemo.datetimeeditor.configuration= +jaxxdemo.datetimeeditor.configuration.label= +jaxxdemo.datetimeeditor.configuration.label.value= +jaxxdemo.datetimeeditor.editor= +jaxxdemo.datetimeeditor.label= +jaxxdemo.datetimeeditor.result= +jaxxdemo.datetimeeditor.result.date= +jaxxdemo.datetimeeditor.result.dayDate= +jaxxdemo.datetimeeditor.result.hour= +jaxxdemo.datetimeeditor.result.hours= +jaxxdemo.datetimeeditor.result.minutes= +jaxxdemo.datetimeeditor.result.timeDate= +jaxxdemo.datetimeeditor.result.timeInMinutes= +jaxxdemo.datetimeeditor.result.timmeInMinutes= jaxxdemo.feature=Fonctionnalités jaxxdemo.feature.databinding=Data binding jaxxdemo.feature.list.validation= diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties index 68218f2..4ccbf67 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo_fr_FR.properties @@ -210,7 +210,9 @@ jaxxdemo.common.people=Acteur jaxxdemo.common.title=Titre jaxxdemo.common.year=Année jaxxdemo.component.jaxx=Composants JAXX -jaxxdemo.component.jaxx.editor=Editeurs +jaxxdemo.component.jaxx.editor=Éditeurs +jaxxdemo.component.jaxx.editor.datetime=Éditeurs de temps +jaxxdemo.component.jaxx.editor.gis=Éditeurs de coordonnées jaxxdemo.component.swing=Composants Swing jaxxdemo.component.swing.buttons=Boutons jaxxdemo.component.swing.form=Elements de formulaire @@ -250,6 +252,17 @@ jaxxdemo.coordinatesEditor.configuration=Configuration jaxxdemo.datePickerEditor.dateResult=Affichage du résultat jaxxdemo.datePickerEditor.patternLayout=Pattern de date jaxxdemo.datePickerEditor.showPopupButton=Afficher le boutton pour ouvrir la popup +jaxxdemo.datetimeeditor.configuration=Configuration +jaxxdemo.datetimeeditor.configuration.label=Libellé de l'éditeur +jaxxdemo.datetimeeditor.configuration.label.value=Date - Heure +jaxxdemo.datetimeeditor.editor=Éditeur +jaxxdemo.datetimeeditor.result=Résultat +jaxxdemo.datetimeeditor.result.date=<html>Date \: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.dayDate=<html>Jour \: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.hours=<html>Heures \: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.minutes=<html>Minutes \: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.timeDate=<html>Heure \: <strong>%s</strong> +jaxxdemo.datetimeeditor.result.timeInMinutes=<html>Time in minutes \: <strong>%s</strong> jaxxdemo.feature=Fonctionnalités jaxxdemo.feature.databinding=Data binding jaxxdemo.feature.list.validation=Validation de liste diff --git a/jaxx-widgets-datetime/LICENSE.txt b/jaxx-widgets-datetime/LICENSE.txt new file mode 100644 index 0000000..cca7fc2 --- /dev/null +++ b/jaxx-widgets-datetime/LICENSE.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/jaxx-widgets-datetime/README.txt b/jaxx-widgets-datetime/README.txt new file mode 100644 index 0000000..d2e50d3 --- /dev/null +++ b/jaxx-widgets-datetime/README.txt @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install diff --git a/jaxx-widgets-datetime/changelog.txt b/jaxx-widgets-datetime/changelog.txt new file mode 100644 index 0000000..1e285bd --- /dev/null +++ b/jaxx-widgets-datetime/changelog.txt @@ -0,0 +1,5 @@ +1.6.0 + * introduce StatusMessageBar and AboutPanel (fork from nuiton-widgets but in JAXX :)) + +1.5 + * 20090404 [chemit] - initial version diff --git a/jaxx-widgets-datetime/pom.xml b/jaxx-widgets-datetime/pom.xml new file mode 100644 index 0000000..c9e533c --- /dev/null +++ b/jaxx-widgets-datetime/pom.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JAXX :: Widgets + + $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> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>jaxx</artifactId> + <version>2.12-SNAPSHOT</version> + </parent> + + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-widgets-datetime</artifactId> + + <name>JAXX :: Widgets DateTime</name> + <description>Date and time Widgets wrote with JAXX</description> + + <properties> + <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> + <jaxx.autoImportCss>true</jaxx.autoImportCss> + <jaxx.addAutoHandlerUI>true</jaxx.addAutoHandlerUI> + <jaxx.autoRecurseInCss>false</jaxx.autoRecurseInCss> + <!--jaxx.useUIManagerForIcon>true</jaxx.useUIManagerForIcon--> + </properties> + + <dependencies> + + <!-- sibiling dependencies --> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-validator</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-common</artifactId> + </dependency> + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-core</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + </dependency> + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + </dependency> + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-converter</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + + <build> + + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> + + <plugins> + + <plugin> + <groupId>${project.groupId}</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <version>${project.version}</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <configuration> + <entries> + <entry> + <basedir>${project.build.directory}/generated-sources/java</basedir> + </entry> + </entries> + </configuration> + <executions> + <execution> + <goals> + <goal>parserJava</goal> + <goal>gen</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </build> + +</project> diff --git a/jaxx-widgets-datetime/src/license/THIRD-PARTY.properties b/jaxx-widgets-datetime/src/license/THIRD-PARTY.properties new file mode 100644 index 0000000..81b2769 --- /dev/null +++ b/jaxx-widgets-datetime/src/license/THIRD-PARTY.properties @@ -0,0 +1,20 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - BSD License +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Public License Version 1.0 +# - GNU General Public License - Version 2 with the class path exception +# - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - Lesser General Public License (LGPL) +# - Lesser General Public License (LGPL) v 3.0 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - The Apache Software License, Version 2.0 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Thu Aug 18 07:10:57 CEST 2011 +commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 diff --git a/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.css b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.css new file mode 100644 index 0000000..84b5b3e --- /dev/null +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.css @@ -0,0 +1,38 @@ + +#title { + horizontalAlignment:center; +} + +#dayDateEditor { + formats:{"dd/MM/yyyy"}; + enabled:{isEnabled()}; + date: {model.getDayDate()}; +} + +#hourEditor { + value:{model.getTimeInMinutes() / 60}; + enabled:{isEnabled()}; + model:{new SpinnerNumberModel(0, 0, 23, 1)}; +} + +#labelH { + text:"timeeditor.H"; + horizontalAlignment:center; +} + +#minuteEditor { + enabled:{isEnabled()}; + value:{model.getTimeInMinutes() % 60}; + model:{new SpinnerNumberModel(0, 0, 59, 1)}; +} + +#slider { + font-size: 11; + paintTicks:true; + paintLabels:true; + majorTickSpacing:60; + minorTickSpacing:30; + value:{model.getTimeInMinutes()}; + enabled:{isEnabled()}; + model:{new DefaultBoundedRangeModel(0, 1, 0, 60 * 24)}; +} 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 new file mode 100644 index 0000000..7604981 --- /dev/null +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditor.jaxx @@ -0,0 +1,50 @@ + +<JPanel layout='{new BorderLayout()}'> + + <import> + java.util.Date + java.io.Serializable + java.awt.BorderLayout + javax.swing.SpinnerNumberModel + javax.swing.DefaultBoundedRangeModel + + org.jdesktop.swingx.JXDatePicker + </import> + + <!-- model --> + <DateTimeEditorModel id='model'/> + + <script><![CDATA[ +public void init() { handler.init(this); } +public void setBean(Serializable bean) { model.setBean(bean); } +public void setPropertyTimeDate(String property) { model.setPropertyTimeDate(property); } +public void setPropertyDayDate(String property) { model.setPropertyDayDate(property); } +public void setPropertyDate(String property) { model.setPropertyDate(property); } +public void setDate(Date date) { model.setDate(date); } +public void setLabel(String label) { dateTimeLabel.setText(label); } +]]> + </script> + + <!-- validator --> + <BeanValidator id='validator' autoField='true' bean='model'> + <field name='dayDate' component='dayDateEditor'/> + <field name='timeDate' component='timeDateEditor'/> + <field name='date' component='dateEditor'/> + </BeanValidator> + + <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())'/> + <JPanel id='timeDateEditor'> + <JSpinner id='hourEditor' onStateChanged='model.setHour((Integer)((JSpinner)event.getSource()).getValue())'/> + <JLabel id='labelH'/> + <JSpinner id='minuteEditor' onStateChanged='model.setMinute((Integer)((JSpinner)event.getSource()).getValue())'/> + </JPanel> + </JPanel> + </JPanel> + + <JSlider id='slider' constraints='BorderLayout.SOUTH' + onStateChanged='if (!slider.getValueIsAdjusting()) model.setTimeInMinutes((Integer)((JSlider)event.getSource()).getValue());'/> + +</JPanel> 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 new file mode 100644 index 0000000..90d4f9d --- /dev/null +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorHandler.java @@ -0,0 +1,119 @@ +package org.nuiton.jaxx.widgets.datetime; + +import com.google.common.base.Preconditions; +import jaxx.runtime.spi.UIHandler; +import org.nuiton.util.beans.BeanUtil; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.reflect.Method; + +/** + * Created on 9/9/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.12 + */ +public class DateTimeEditorHandler implements UIHandler<DateTimeEditor> { + + DateTimeEditor ui; + + @Override + public void beforeInit(DateTimeEditor ui) { + + DateTimeEditorModel model = new DateTimeEditorModel(); + ui.setContextValue(model); + + + this.ui = ui; + + } + + @Override + public void afterInit(DateTimeEditor ui) { + } + + public void init(DateTimeEditor ui) { + + DateTimeEditorModel model = ui.getModel(); + + Object bean = model.getBean(); + + if (bean != null) { + + if (model.getPropertyDayDate() != null) { + + Method dayDateMutator = BeanUtil.getMutator(bean, model.getPropertyDayDate()); + Preconditions.checkNotNull(dayDateMutator, "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, + new ModelPropertyChangeListener(model, dayDateMutator)); + + } + + if (model.getPropertyTimeDate() != null) { + + Method timeDateMutator = BeanUtil.getMutator(bean, model.getPropertyTimeDate()); + Preconditions.checkNotNull(timeDateMutator, "could not find mutator for " + model.getPropertyTimeDate()); + + // When model time date changed, let's push it back in bean + model.addPropertyChangeListener( + DateTimeEditorModel.PROPERTY_TIME_DATE, + new ModelPropertyChangeListener(model, timeDateMutator)); + + } + + if (model.getPropertyDate() != null) { + + Method fullDateMutator = BeanUtil.getMutator(bean, model.getPropertyDate()); + Preconditions.checkNotNull(fullDateMutator, "could not find mutator for " + model.getPropertyDate()); + + // When model full date changed, let's push it back in bean + model.addPropertyChangeListener( + DateTimeEditorModel.PROPERTY_DATE, + new ModelPropertyChangeListener(model, fullDateMutator)); + + } + + } + + } + + private class ModelPropertyChangeListener implements PropertyChangeListener { + + private final DateTimeEditorModel model; + + private final Method mutator; + + private ModelPropertyChangeListener(DateTimeEditorModel model, Method mutator) { + this.model = model; + this.mutator = mutator; + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + + if (!model.isValueIsAdjusting()) { + + Object newValue = evt.getNewValue(); + + try { + +// valueModelIsAdjusting = true; +// try { + mutator.invoke(model.getBean(), newValue); +// } finally { +// valueModelIsAdjusting = false; +// } + + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + } + } + +} 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 new file mode 100644 index 0000000..3f7c9b1 --- /dev/null +++ b/jaxx-widgets-datetime/src/main/java/org/nuiton/jaxx/widgets/datetime/DateTimeEditorModel.java @@ -0,0 +1,325 @@ +package org.nuiton.jaxx.widgets.datetime; + +import com.google.common.base.Preconditions; +import org.jdesktop.beans.AbstractSerializableBean; +import org.nuiton.util.DateUtil; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * Created on 9/9/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.12 + */ +public class DateTimeEditorModel extends AbstractSerializableBean { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_DAY_DATE = "dayDate"; + + public static final String PROPERTY_TIME_DATE = "timeDate"; + + public static final String PROPERTY_TIME_IN_MINUTES = "timeInMinutes"; + + public static final String PROPERTY_DATE = "date"; + + public static final String PROPERTY_VALUE_IS_ADJUSTING = "valueIsAdjusting"; + + /** + * Optional bean where to push back dates. + */ + protected Serializable bean; + + /** + * Optional bean property where to push back the day date. + */ + protected String propertyDayDate; + + /** + * Optional bean property where to push back the time date. + */ + protected String propertyTimeDate; + + /** + * Optional bean property where to push back the full date. + */ + protected String propertyDate; + + /** + * Full date (date + time) + */ + protected Date date; + + /** + * State to be able to custom the model. will be pass to {@code false} by the {@link DateTimeEditorHandler#init(DateTimeEditor)}. + */ + protected boolean fillState = true; + + /** + * To stop propagate events when we are doing some modifications on the model. + */ + protected boolean valueIsAdjusting; + + protected final Calendar calendar = new GregorianCalendar(); + + public String getPropertyDayDate() { + return propertyDayDate; + } + + public void setPropertyDayDate(String propertyDayDate) { + Preconditions.checkState(fillState, "cant change *propertyDayDate* property once the fillState is off."); + this.propertyDayDate = propertyDayDate; + } + + public String getPropertyTimeDate() { + return propertyTimeDate; + } + + public void setPropertyTimeDate(String propertyTimeDate) { + Preconditions.checkState(fillState, "cant change *propertyTimeDate* property once the fillState is off."); + this.propertyTimeDate = propertyTimeDate; + } + + public String getPropertyDate() { + return propertyDate; + } + + public void setPropertyDate(String propertyDate) { + Preconditions.checkState(fillState, "cant change *propertyDate* property once the fillState is off."); + this.propertyDate = propertyDate; + } + + public Serializable getBean() { + return bean; + } + + public void setBean(Serializable bean) { + Preconditions.checkState(fillState, "cant change *bean* property once the fillState is off."); + this.bean = bean; + } + + public boolean isValueIsAdjusting() { + return valueIsAdjusting; + } + + public void setValueIsAdjusting(boolean valueIsAdjusting) { + boolean oldValue = isValueIsAdjusting(); + this.valueIsAdjusting = valueIsAdjusting; + fireValueIsAdjusting(oldValue); + } + + public void setHour(Integer hour) { + + if (isValueIsAdjusting()) { + + // avoid reentrant code + return; + } + + Date oldTimeDate = getTimeDate(); + + if (oldTimeDate != null) { + + Integer minute = getMinute(oldTimeDate); + + setTime(oldTimeDate, hour, minute); + + } + + } + + public void setMinute(Integer minute) { + + if (isValueIsAdjusting()) { + + // avoid reentrant code + return; + } + + Date oldTimeDate = getTimeDate(); + + if (oldTimeDate != null) { + + Integer hour = getHour(oldTimeDate); + + setTime(oldTimeDate, hour, minute); + + } + + } + + public Integer getTimeInMinutes() { + + Integer result = 0; + + Date timeDate = getTimeDate(); + + if (timeDate != null) { + + int hour = getHour(timeDate); + int minute = getMinute(timeDate); + + result = hour * 60 + minute; + + } + + return result; + + } + + public void setTimeInMinutes(Integer time) { + + if (isValueIsAdjusting()) { + + // avoid reentrant code + return; + } + + Date oldTimeDate = getTimeDate(); + + if (oldTimeDate != null) { + + int hour = time / 60; + int minute = time % 60; + setTime(oldTimeDate, hour, minute); + + } + + } + + public Date getTimeDate() { + return date == null ? null : DateUtil.getTime(date, false, false); + } + + public void setTimeDate(Date timeDate) { + if (date != null) { + + Date oldDate = date; + Date oldTimeDate = getTimeDate(); + Integer oldTimeInMinutes = getTimeInMinutes(); + + Date newDate = DateUtil.getDateAndTime(date, timeDate, true, false); + this.date = newDate; + fireDate(oldDate); + fireTimeDate(oldTimeDate); + fireTimeInMinutes(oldTimeInMinutes); + + } + } + + public Date getDayDate() { + return date == null ? null : DateUtil.getDay(date); + } + + public void setDayDate(Date dayDate) { + if (date != null) { + + Date oldDate = date; + Date oldDayDate = getDayDate(); + Date newDate = DateUtil.getDateAndTime(dayDate, date, true, false); + this.date = newDate; + fireDate(oldDate); + fireDayDate(oldDayDate); + + } + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + + Date oldDayDate = getDayDate(); + Date oldTimeDate = getTimeDate(); + Date oldValue = getDate(); + Integer oldTimeInMinutes = getTimeInMinutes(); + + this.date = date; + + fireDate(oldValue); + fireDayDate(oldDayDate); + fireTimeDate(oldTimeDate); + fireTimeInMinutes(oldTimeInMinutes); + + } + + protected Integer getHour(Date date) { + + Integer hour = null; + if (date != null) { + calendar.setTime(date); + hour = calendar.get(Calendar.HOUR_OF_DAY); + } + return hour; + + } + + protected Integer getMinute(Date date) { + + Integer hour = null; + if (date != null) { + calendar.setTime(date); + hour = calendar.get(Calendar.MINUTE); + } + return hour; + + } + + protected void setTime(Date oldTimeDate, Integer hour, Integer minute) { + + if (oldTimeDate != null) { + + Date oldFullDate = getDate(); + Integer oldTimeInMinutes = getTimeInMinutes(); + + setValueIsAdjusting(true); + + try { + + calendar.setTime(oldTimeDate); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minute); + + Date newTimeDate = calendar.getTime(); + + setTimeDate(newTimeDate); + + } finally { + + setValueIsAdjusting(false); + + fireDate(oldFullDate); + fireTimeDate(oldTimeDate); + fireTimeInMinutes(oldTimeInMinutes); + + } + + } + + } + + protected void fireTimeDate(Date oldDate) { + firePropertyChange(PROPERTY_TIME_DATE, oldDate, getTimeDate()); + } + + protected void fireTimeInMinutes(Integer oldDate) { + firePropertyChange(PROPERTY_TIME_IN_MINUTES, oldDate, getTimeInMinutes()); + } + + protected void fireDayDate(Date oldDate) { + firePropertyChange(PROPERTY_DAY_DATE, oldDate, getDayDate()); + } + + protected void fireDate(Date oldDate) { + firePropertyChange(PROPERTY_DATE, oldDate, getDate()); + } + + protected void fireValueIsAdjusting(boolean oldValue) { + firePropertyChange(PROPERTY_VALUE_IS_ADJUSTING, oldValue, isValueIsAdjusting()); + } +} diff --git a/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_en_GB.properties b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_en_GB.properties new file mode 100644 index 0000000..43875f0 --- /dev/null +++ b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_en_GB.properties @@ -0,0 +1 @@ +timeeditor.H= diff --git a/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_es_ES.properties b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_es_ES.properties new file mode 100644 index 0000000..43875f0 --- /dev/null +++ b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_es_ES.properties @@ -0,0 +1 @@ +timeeditor.H= diff --git a/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_fr_FR.properties b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_fr_FR.properties new file mode 100644 index 0000000..43875f0 --- /dev/null +++ b/jaxx-widgets-datetime/src/main/resources/i18n/jaxx-widgets-datetime_fr_FR.properties @@ -0,0 +1 @@ +timeeditor.H= diff --git a/jaxx-widgets-datetime/src/main/resources/icons/action-coordinate-reset.png b/jaxx-widgets-datetime/src/main/resources/icons/action-coordinate-reset.png new file mode 100644 index 0000000..0fb00f9 Binary files /dev/null and b/jaxx-widgets-datetime/src/main/resources/icons/action-coordinate-reset.png differ diff --git a/jaxx-widgets-datetime/src/site/site.xml b/jaxx-widgets-datetime/src/site/site.xml new file mode 100644 index 0000000..ba56de7 --- /dev/null +++ b/jaxx-widgets-datetime/src/site/site.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JAXX :: Widgets + %% + Copyright (C) 2008 - 2014 Code Lutin, 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 name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <src>${siteCommonResourcesUrl}/images/logos/jaxx-logo.png</src> + <href>index.html</href> + </bannerLeft> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu ref="parent"/> + + <menu ref="reports"/> + + </body> +</project> diff --git a/jaxx-widgets-datetime/src/test/resources/log4j.properties b/jaxx-widgets-datetime/src/test/resources/log4j.properties new file mode 100644 index 0000000..a9515ea --- /dev/null +++ b/jaxx-widgets-datetime/src/test/resources/log4j.properties @@ -0,0 +1,31 @@ +### +# #%L +# JAXX :: Widgets +# %% +# Copyright (C) 2008 - 2014 Code Lutin, 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% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +log4j.logger.jaxx.runtime.swing=DEBUG +#log4j.logger.jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder=DEBUG +log4j.logger.org.nuiton=WARN 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 3f416e8..db97624 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 @@ -2,12 +2,12 @@ package org.nuiton.jaxx.widgets.gis.absolute; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.nuiton.jaxx.widgets.gis.DdCoordinate; import org.nuiton.jaxx.widgets.gis.DdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -64,10 +64,10 @@ public class AbsoluteDdCoordinateEditorHandler implements UIHandler<AbsoluteDdCo Object bean = model.getBean(); - degreeMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); - decimalMutator = BeanUIUtil.getMutator(bean, model.getPropertyDecimal()); + decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); unsignedConverter.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 39859e1..3a7c8b0 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 @@ -2,12 +2,12 @@ package org.nuiton.jaxx.widgets.gis.absolute; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.nuiton.jaxx.widgets.gis.DmdCoordinate; import org.nuiton.jaxx.widgets.gis.DmdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -69,13 +69,13 @@ public class AbsoluteDmdCoordinateEditorHandler implements UIHandler<AbsoluteDmd Object bean = model.getBean(); - degreeMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - decimalMutator = BeanUIUtil.getMutator(bean, model.getPropertyDecimal()); + decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); unsignedConverter.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 2d9335f..c792f72 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 @@ -2,12 +2,12 @@ package org.nuiton.jaxx.widgets.gis.absolute; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.widgets.gis.DmsCoordinate; import org.nuiton.jaxx.widgets.gis.DmsCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -67,13 +67,13 @@ public class AbsoluteDmsCoordinateEditorHandler implements UIHandler<AbsoluteDms Object bean = model.getBean(); - degreeMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreeMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreeMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - secondMutator = BeanUIUtil.getMutator(bean, model.getPropertySecond()); + secondMutator = BeanUtil.getMutator(bean, model.getPropertySecond()); Preconditions.checkNotNull(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/CoordinatesEditorHandler.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorHandler.java index 4d496a9..dbb7811 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 @@ -2,8 +2,8 @@ package org.nuiton.jaxx.widgets.gis.absolute; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.nuiton.jaxx.widgets.gis.CoordinateFormat; +import org.nuiton.util.beans.BeanUtil; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -51,7 +51,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyLatitude() != null) { - Method latitudeMutator = BeanUIUtil.getMutator(bean, model.getPropertyLatitude()); + Method latitudeMutator = BeanUtil.getMutator(bean, model.getPropertyLatitude()); Preconditions.checkNotNull(latitudeMutator, "could not find mutator for " + model.getPropertyLatitude()); // When model latitude changed, let's push it back in bean model.addPropertyChangeListener( @@ -62,7 +62,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyLatitude() != null) { - Method longitudeMutator = BeanUIUtil.getMutator(bean, model.getPropertyLongitude()); + Method longitudeMutator = BeanUtil.getMutator(bean, model.getPropertyLongitude()); Preconditions.checkNotNull(longitudeMutator, "could not find mutator for " + model.getPropertyLongitude()); // When model longitude changed, let's push it back in bean @@ -74,7 +74,7 @@ public class CoordinatesEditorHandler implements UIHandler<CoordinatesEditor> { if (model.getPropertyQuadrant() != null) { - Method quadrantMutator = BeanUIUtil.getMutator(bean, model.getPropertyQuadrant()); + Method quadrantMutator = BeanUtil.getMutator(bean, model.getPropertyQuadrant()); Preconditions.checkNotNull(quadrantMutator, "could not find mutator for " + model.getPropertyQuadrant()); // When model quadrant changed, let's push it back in bean diff --git a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorModel.java b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorModel.java index 7538825..b79a8d3 100644 --- a/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorModel.java +++ b/jaxx-widgets-gis/src/main/java/org/nuiton/jaxx/widgets/gis/absolute/CoordinatesEditorModel.java @@ -26,10 +26,6 @@ public class CoordinatesEditorModel extends AbstractSerializableBean { public static final String PROPERTY_FORMAT = "format"; - public static final String PROPERTY_AUTO_POPUP_NUMBER_EDITOR = "autoPopupNumberEditor"; - - public static final String PROPERTY_SHOW_NUMBER_EDITOR_BUTTON = "showNumberEditorButton"; - public static final String PROPERTY_SHOW_RESET_BUTTON = "showResetButton"; protected final AbsoluteCoordinateEditorModel latitudeModel = new AbsoluteCoordinateEditorModel(); 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 bf526cb..f111713 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 @@ -24,12 +24,12 @@ package org.nuiton.jaxx.widgets.gis.signed; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.widgets.gis.DdCoordinate; import org.nuiton.jaxx.widgets.gis.DdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -95,13 +95,13 @@ public class SignedDdCoordinateEditorHandler implements UIHandler<SignedDdCoordi Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); - signMutator = BeanUIUtil.getMutator(bean, model.getPropertySign()); + signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); - degreMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); - decimalMutator = BeanUIUtil.getMutator(bean, model.getPropertyDecimal()); + decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); signedConverter.setForLongitude(longitudeEditor); 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 53a5947..b2b511d 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 @@ -24,12 +24,12 @@ package org.nuiton.jaxx.widgets.gis.signed; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.widgets.gis.DmdCoordinate; import org.nuiton.jaxx.widgets.gis.DmdCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -98,16 +98,16 @@ public class SignedDmdCoordinateEditorHandler implements UIHandler<SignedDmdCoor Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); - signMutator = BeanUIUtil.getMutator(bean, model.getPropertySign()); + signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); - degreMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - decimalMutator = BeanUIUtil.getMutator(bean, model.getPropertyDecimal()); + decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); signedConverter.setForLongitude(longitudeEditor); 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 0e88034..7f420ef 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 @@ -24,12 +24,12 @@ package org.nuiton.jaxx.widgets.gis.signed; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jaxx.widgets.gis.DmsCoordinate; import org.nuiton.jaxx.widgets.gis.DmsCoordinateConverter; import org.nuiton.jaxx.widgets.gis.MaskFormatterFromConverter; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -98,16 +98,16 @@ public class SignedDmsCoordinateEditorHandler implements UIHandler<SignedDmsCoor Preconditions.checkNotNull(model.getPropertySecond(), "could not find propertySecond in " + ui); Object bean = model.getBean(); - signMutator = BeanUIUtil.getMutator(bean, model.getPropertySign()); + signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); - degreMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - secondMutator = BeanUIUtil.getMutator(bean, model.getPropertySecond()); + secondMutator = BeanUtil.getMutator(bean, model.getPropertySecond()); Preconditions.checkNotNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); signedConverter.setForLongitude(longitudeEditor); diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor2Handler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor2Handler.java index 90c2a6b..4e6c07b 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor2Handler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor2Handler.java @@ -24,12 +24,12 @@ package jaxx.runtime.swing.editor; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import jaxx.runtime.swing.editor.gis.DmdCoordinate; import jaxx.runtime.swing.editor.gis.DmdCoordinateConverter; import jaxx.runtime.swing.editor.gis.MaskFormatterFromConverter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JButton; import javax.swing.JComponent; @@ -42,8 +42,6 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.lang.reflect.Method; import java.text.ParseException; @@ -102,7 +100,7 @@ public class NumberEditor2Handler implements UIHandler<NumberEditor2> { Preconditions.checkNotNull(model.getNumberType(), "could not find numberType in " + model); Object bean = model.getBean(); - mutator = BeanUIUtil.getMutator(bean, model.getBeanProperty()); + mutator = BeanUtil.getMutator(bean, model.getBeanProperty()); Preconditions.checkNotNull(mutator, "could not find mutator for " + model.getBeanProperty()); { diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java index 6d2195e..0f9f00a 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java @@ -22,12 +22,12 @@ package jaxx.runtime.swing.editor; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JComponent; import javax.swing.JTextField; @@ -571,7 +571,7 @@ public class NumberEditorHandler { protected Method getMutator() { if (mutator == null) { - mutator = BeanUIUtil.getMutator(editor.getBean(), editor.getProperty()); + mutator = BeanUtil.getMutator(editor.getBean(), editor.getProperty()); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/SimpleTimeEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/SimpleTimeEditorHandler.java index 25a10da..65fe1d7 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/SimpleTimeEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/SimpleTimeEditorHandler.java @@ -22,9 +22,9 @@ package jaxx.runtime.swing.editor; * #L% */ -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JSpinner; import javax.swing.SpinnerDateModel; @@ -257,7 +257,7 @@ public class SimpleTimeEditorHandler { throw new NullPointerException("could not find property in " + editor); } - mutator = BeanUIUtil.getMutator(bean, property); + mutator = BeanUtil.getMutator(bean, property); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java index 97c1832..a80b3c2 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java @@ -22,7 +22,6 @@ package jaxx.runtime.swing.editor; -import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,14 +33,14 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.Calendar; import java.util.Date; import java.util.Dictionary; import java.util.Hashtable; import java.util.Map; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; + +import org.nuiton.util.beans.BeanUtil; /** @author Tony Chemit - chemit@codelutin.com */ public class TimeEditorHandler { @@ -324,7 +323,7 @@ public class TimeEditorHandler { protected Method getMutator() { if (mutator == null) { - mutator = BeanUIUtil.getMutator(editor.getBean(), editor.getProperty()); + mutator = BeanUtil.getMutator(editor.getBean(), editor.getProperty()); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java index fe058b2..81ef1bd 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanComboBoxHandler.java @@ -32,6 +32,7 @@ import org.jdesktop.swingx.autocomplete.ObjectToStringConverter; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JComboBox; import javax.swing.JComponent; @@ -500,7 +501,7 @@ public class BeanComboBoxHandler<O> implements PropertyChangeListener { /** @return le mutateur a utiliser pour modifier le bean associé. */ protected Method getMutator() { if (mutator == null && ui.getBean() != null && ui.getProperty() != null) { - mutator = BeanUIUtil.getMutator(ui.getBean(), ui.getProperty()); + mutator = BeanUtil.getMutator(ui.getBean(), ui.getProperty()); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java index 03c3c47..199f1f5 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanDoubleListHandler.java @@ -34,6 +34,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.util.beans.BeanUtil; import javax.swing.AbstractButton; import javax.swing.JComponent; @@ -441,7 +442,7 @@ public class BeanDoubleListHandler<O> implements PropertyChangeListener { public Method getMutator() { if (mutator == null && ui.getBackground() != null && ui.getProperty() != null) { - mutator = BeanUIUtil.getMutator(ui.getBean(), ui.getProperty()); + mutator = BeanUtil.getMutator(ui.getBean(), ui.getProperty()); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java index a635f77..8fb0831 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanFilterableComboBoxHandler.java @@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.decorator.DecoratorUtil; import org.nuiton.decorator.JXPathDecorator; import org.nuiton.decorator.MultiJXPathDecorator; +import org.nuiton.util.beans.BeanUtil; import javax.swing.AbstractButton; import javax.swing.ComboBoxEditor; @@ -608,7 +609,7 @@ public class BeanFilterableComboBoxHandler<O> implements PropertyChangeListener /** @return le mutateur a utiliser pour modifier le bean associé. */ protected Method getMutator() { if (mutator == null && ui.getBean() != null && ui.getProperty() != null) { - mutator = BeanUIUtil.getMutator(ui.getBean(), ui.getProperty()); + mutator = BeanUtil.getMutator(ui.getBean(), ui.getProperty()); } return mutator; } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java index 960f9c5..d81298e 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/bean/BeanUIUtil.java @@ -290,27 +290,6 @@ public class BeanUIUtil { ); } - public static Method getMutator(Object bean, String property) { - Method mutator = null; - if (bean == null) { - throw new NullPointerException("could not find bean"); - } - if (property == null) { - throw new NullPointerException("could not find property"); - } - - try { - PropertyDescriptor descriptor = PropertyUtils.getPropertyDescriptor(bean, property); - if (descriptor != null) { - mutator = descriptor.getWriteMethod(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - - return mutator; - } - public static abstract class PopupHandler implements Runnable { public static final Log log = LogFactory.getLog(PopupHandler.class); diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmdCoordinateEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmdCoordinateEditorHandler.java index 19c3214..2b6ead2 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmdCoordinateEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmdCoordinateEditorHandler.java @@ -24,9 +24,9 @@ package jaxx.runtime.swing.editor.gis; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -95,16 +95,16 @@ public class DmdCoordinateEditorHandler implements UIHandler<DmdCoordinateEditor Preconditions.checkNotNull(model.getPropertyDecimal(), "could not find propertyDecimal in " + ui); Object bean = model.getBean(); - signMutator = BeanUIUtil.getMutator(bean, model.getPropertySign()); + signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); - degreMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - decimalMutator = BeanUIUtil.getMutator(bean, model.getPropertyDecimal()); + decimalMutator = BeanUtil.getMutator(bean, model.getPropertyDecimal()); Preconditions.checkNotNull(decimalMutator, "could not find mutator for " + model.getPropertyDecimal()); signedConverter.setForLongitude(longitudeEditor); diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmsCoordinateEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmsCoordinateEditorHandler.java index cf7cefc..60a8714 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmsCoordinateEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/gis/DmsCoordinateEditorHandler.java @@ -24,9 +24,9 @@ package jaxx.runtime.swing.editor.gis; import com.google.common.base.Preconditions; import jaxx.runtime.spi.UIHandler; -import jaxx.runtime.swing.editor.bean.BeanUIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.beans.BeanUtil; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; @@ -104,16 +104,16 @@ public class DmsCoordinateEditorHandler implements UIHandler<DmsCoordinateEditor Preconditions.checkNotNull(model.getPropertySecond(), "could not find propertySecond in " + ui); Object bean = model.getBean(); - signMutator = BeanUIUtil.getMutator(bean, model.getPropertySign()); + signMutator = BeanUtil.getMutator(bean, model.getPropertySign()); Preconditions.checkNotNull(signMutator, "could not find mutator for " + model.getPropertySign()); - degreMutator = BeanUIUtil.getMutator(bean, model.getPropertyDegree()); + degreMutator = BeanUtil.getMutator(bean, model.getPropertyDegree()); Preconditions.checkNotNull(degreMutator, "could not find mutator for " + model.getPropertyDegree()); - minuteMutator = BeanUIUtil.getMutator(bean, model.getPropertyMinute()); + minuteMutator = BeanUtil.getMutator(bean, model.getPropertyMinute()); Preconditions.checkNotNull(minuteMutator, "could not find mutator for " + model.getPropertyMinute()); - secondMutator = BeanUIUtil.getMutator(bean, model.getPropertySecond()); + secondMutator = BeanUtil.getMutator(bean, model.getPropertySecond()); Preconditions.checkNotNull(secondMutator, "could not find mutator for " + model.getPropertySecond()); signedConverter.setForLongitude(longitudeEditor); diff --git a/pom.xml b/pom.xml index 1d8b3a5..76df1c7 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,7 @@ <module>jaxx-compiler</module> <module>jaxx-maven-plugin</module> <module>jaxx-widgets</module> + <module>jaxx-widgets-datetime</module> <module>jaxx-widgets-gis</module> <module>jaxx-config</module> <module>jaxx-application-api</module> @@ -230,7 +231,7 @@ <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> - <version>3.0-rc-7</version> + <version>3.0-SNAPSHOT</version> </dependency> <dependency> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm