Author: kmorin Date: 2014-01-15 17:23:40 +0100 (Wed, 15 Jan 2014) New Revision: 2 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/2 Log: maquette Added: trunk/LICENSE.txt trunk/README.txt trunk/faxtomail-persistence/ trunk/faxtomail-persistence/LICENSE.txt trunk/faxtomail-persistence/README.txt trunk/faxtomail-persistence/pom.xml trunk/faxtomail-persistence/src/ trunk/faxtomail-persistence/src/main/ trunk/faxtomail-persistence/src/main/java/ trunk/faxtomail-persistence/src/main/java/com/ trunk/faxtomail-persistence/src/main/java/com/franciaflex/ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailBusinessException.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailIOUtil.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailTechnicalException.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/PropagatePropertyChangeListener.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java trunk/faxtomail-persistence/src/main/resources/ trunk/faxtomail-persistence/src/test/ trunk/faxtomail-persistence/src/test/java/ trunk/faxtomail-service/ trunk/faxtomail-service/LICENSE.txt trunk/faxtomail-service/README.txt trunk/faxtomail-service/pom.xml trunk/faxtomail-service/src/ trunk/faxtomail-service/src/main/ trunk/faxtomail-service/src/main/java/ trunk/faxtomail-service/src/main/java/com/ trunk/faxtomail-service/src/main/java/com/franciaflex/ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/AbstractFaxToMailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/DecoratorService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailDecorator.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailServiceContext.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfig.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigOption.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigProvider.java trunk/faxtomail-service/src/main/resources/ trunk/faxtomail-service/src/main/resources/META-INF/ trunk/faxtomail-service/src/main/resources/META-INF/services/ trunk/faxtomail-service/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider trunk/faxtomail-service/src/main/resources/i18n/ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties trunk/faxtomail-service/src/test/ trunk/faxtomail-service/src/test/java/ trunk/faxtomail-ui-swing/ trunk/faxtomail-ui-swing/LICENSE.txt trunk/faxtomail-ui-swing/README.txt trunk/faxtomail-ui-swing/pom.xml trunk/faxtomail-ui-swing/src/ trunk/faxtomail-ui-swing/src/license/ trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties trunk/faxtomail-ui-swing/src/main/ trunk/faxtomail-ui-swing/src/main/filtered-resources/ trunk/faxtomail-ui-swing/src/main/filtered-resources/faxtomail.config trunk/faxtomail-ui-swing/src/main/filtered-resources/log4j.properties trunk/faxtomail-ui-swing/src/main/java/ trunk/faxtomail-ui-swing/src/main/java/com/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfig.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigOption.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigProvider.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractChangeScreenAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractMainUIFaxToMailAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/CloseApplicationAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/GoToPreviousScreenAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ReloadFaxToMailAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowConfigAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeListAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowRechercheAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/StartAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Cancelable.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CloseableUI.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailErrorHelper.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/AbstractFaxToMailAction.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionException.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionHelper.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionSwingWorker.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.css trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.jaxx trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIHandler.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIModel.java trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailUIAction.java trunk/faxtomail-ui-swing/src/main/resources/ trunk/faxtomail-ui-swing/src/main/resources/META-INF/ trunk/faxtomail-ui-swing/src/main/resources/META-INF/services/ trunk/faxtomail-ui-swing/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider trunk/faxtomail-ui-swing/src/main/resources/com/ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/ trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing/ trunk/faxtomail-ui-swing/src/main/resources/i18n/ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties trunk/faxtomail-ui-swing/src/main/resources/icons/ trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png trunk/pom.xml trunk/src/ Modified: trunk/ Property changes on: trunk ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/LICENSE.txt =================================================================== --- trunk/LICENSE.txt (rev 0) +++ trunk/LICENSE.txt 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,674 @@ + GNU 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. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/README.txt =================================================================== --- trunk/README.txt (rev 0) +++ trunk/README.txt 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,30 @@ +Faire une nouvelle version mineure +---------------------------------- + +Cette release va juste déployer sur le dépot nexus les artifacts + mettre à jour +le fichier de mises à jour sur http://appup.forge.codelutin.com/tutti. + +mvn release:prepare +mvn release:perform + +Faire une nouvelle version majeure +---------------------------------- + +Cette release va en plus générer et deployer sur forge.codelutin.com les zip +incluant la jre + l'application. + +mvn release:prepare -Darguments="-DperformFullRelease" +mvn release:perform -Darguments="-DperformFullRelease" + +Historique des versions de base +------------------------------- + ++---------------------+------------+---------------------------+ +| Application version | Db version | Allegro db schema version | ++=====================+============+===========================+ ++ 2.3 + 2013.06.04 + 3.2.1.01 + ++---------------------+------------+---------------------------+ ++ 2.4 + 2013.06.04 + 3.2.3 + ++---------------------+------------+---------------------------+ ++ 2.8.1 + 2013.08.22 + 3.2.3 + ++---------------------+------------+---------------------------+ Property changes on: trunk/faxtomail-persistence ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-persistence/LICENSE.txt =================================================================== --- trunk/faxtomail-persistence/LICENSE.txt (rev 0) +++ trunk/faxtomail-persistence/LICENSE.txt 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,674 @@ + GNU 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. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/faxtomail-persistence/README.txt =================================================================== Added: trunk/faxtomail-persistence/pom.xml =================================================================== --- trunk/faxtomail-persistence/pom.xml (rev 0) +++ trunk/faxtomail-persistence/pom.xml 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,172 @@ +<?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"> + <parent> + <artifactId>faxtomail</artifactId> + <groupId>com.franciaflex</groupId> + <version>0.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.franciaflex.faxtomail</groupId> + <artifactId>faxtomail-persistence</artifactId> + + <name>FaxToMail :: Persistence</name> + + <dependencies> + + <!-- commons --> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-config</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-updater</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-decorator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</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-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-vfs2</artifactId> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-common</artifactId> + </dependency> + + <!-- Logging --> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jcl</artifactId> + <scope>runtime</scope> + </dependency> + + <!-- Test --> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <pluginManagement> + <plugins> + <!--<plugin>--> + <!--<artifactId>maven-surefire-plugin</artifactId>--> + <!--<configuration>--> + <!--<properties>--> + <!--<property>--> + <!--<name>listener</name>--> + <!--<value>fr.ifremer.tutti.persistence.test.TuttiRunListener</value>--> + <!--</property>--> + <!--</properties>--> + <!--</configuration>--> + <!--</plugin>--> + </plugins> + </pluginManagement> + <plugins> + + <!--<plugin>--> + <!--<groupId>org.nuiton.eugene</groupId>--> + <!--<artifactId>eugene-maven-plugin</artifactId>--> + <!--<configuration>--> + <!--<resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>--> + <!--<templates>--> + <!--org.nuiton.eugene.java.JavaInterfaceTransformer,--> + <!--org.nuiton.eugene.java.SimpleJavaBeanTransformer,--> + <!--org.nuiton.eugene.java.JavaEnumerationTransformer--> + <!--</templates>--> + <!--</configuration>--> + <!--<executions>--> + <!--<execution>--> + <!--<phase>generate-sources</phase>--> + <!--<configuration>--> + <!--<defaultPackage>fr.ifremer.tutti.persistence.entities--> + <!--</defaultPackage>--> + <!--<fullPackagePath>fr.ifremer.tutti.persistence.entities--> + <!--</fullPackagePath>--> + <!--<inputs>zargo</inputs>--> + <!--</configuration>--> + <!--<goals>--> + <!--<goal>generate</goal>--> + <!--</goals>--> + <!--</execution>--> + <!--</executions>--> + <!--</plugin>--> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <executions> + <execution> + <id>scan-sources</id> + <goals> + <goal>parserJava</goal> + <goal>gen</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </build> + +</project> \ No newline at end of file Property changes on: trunk/faxtomail-persistence/src ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/main ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/main/java ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/main/java/com ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailBusinessException.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailBusinessException.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailBusinessException.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,24 @@ +package com.franciaflex.faxtomail; + +/** + * To box any business exception. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class FaxToMailBusinessException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public FaxToMailBusinessException(String message) { + super(message); + } + + public FaxToMailBusinessException(String message, Throwable cause) { + super(message, cause); + } + + public FaxToMailBusinessException(Throwable cause) { + super(cause); + } +} Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailIOUtil.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailIOUtil.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailIOUtil.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,231 @@ +package com.franciaflex.faxtomail; + +import com.google.common.base.Charsets; +import com.google.common.io.Files; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.vfs2.FileObject; +import org.apache.commons.vfs2.FileSelector; +import org.apache.commons.vfs2.FileSystemManager; +import org.apache.commons.vfs2.FileType; +import org.apache.commons.vfs2.VFS; +import org.nuiton.util.ZipUtil; + +import java.io.Closeable; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.util.List; +import java.util.UUID; + +import static org.nuiton.i18n.I18n._; + +/** + * Useful methods around IO, all method errors are boxes a + * {@link FaxToMailTechnicalException}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.2 + */ +public class FaxToMailIOUtil { + + protected FaxToMailIOUtil() { + // no instance + } + + public static void close(Closeable toClose, String errorMessage) { + + try { + toClose.close(); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void zip(File source, File archiveFile, String errorMessage) { + try { + ZipUtil.compress(archiveFile, source); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void zip(File source, File archiveFile, List<File> files, String errorMessage) { + try { + ZipUtil.compressFiles(archiveFile, source, files); + } catch (IOException e) { + throw new FaxToMailTechnicalException(_(errorMessage, archiveFile), e); + } + } + + public static FileObject resolveFile(String file, String errorMessage) { + try { + FileSystemManager manager = VFS.getManager(); + FileObject targetObject = manager.resolveFile(file); + return targetObject; + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static FileObject[] getChildren(FileObject objectFile, String errorMessage) { + try { + return objectFile.getChildren(); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static FileObject getChild(FileObject objectFile, String name, String errorMessage) { + try { + return objectFile.getChild(name); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + + public static FileType getType(FileObject objectFile, String errorMessage) { + try { + return objectFile.getType(); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void explode(FileObject archiveFile, + File target, + FileSelector fileSelector, String errorMessage) { + try { + FileSystemManager manager = VFS.getManager(); + FileObject targetObject = manager.toFileObject(target); + targetObject.copyFrom(archiveFile, fileSelector); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void forceMkdir(File dir, String errorMessage) { + try { + FileUtils.forceMkdir(dir); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void cleanDirectory(File dir, String errorMessage) { + try { + FileUtils.cleanDirectory(dir); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void deleteDirectory(File dir, String errorMessage) { + try { + FileUtils.deleteDirectory(dir); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void forceDeleteOnExit(File dir, String errorMessage) { + try { + FileUtils.forceDeleteOnExit(dir); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void copyDirectory(File source, File target, String errorMessage) { + try { + FileUtils.copyDirectory(source, target); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void copyFileToDirectory(File source, File target, String errorMessage) { + try { + FileUtils.copyFileToDirectory(source, target); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void copyFile(File source, File target, String errorMessage) { + try { + FileUtils.copyFile(source, target); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void deleteFile(File file, String errorMessage) { + try { + FileUtils.forceDelete(file); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static String getBaseName(String file) { + return FilenameUtils.getBaseName(file); + } + + public static String getExtension(String file) { + return FilenameUtils.getExtension(file); + } + + public static Reader newReader(File file, String errorMessage) { + try { + return Files.newReader(file, Charsets.UTF_8); + + } catch (FileNotFoundException e) { + throw new FaxToMailTechnicalException(_(errorMessage, file), e); + } + } + + public static Writer newWriter(File file, String errorMessage + ) { + try { + return Files.newWriter(file, Charsets.UTF_8); + + } catch (FileNotFoundException e) { + throw new FaxToMailTechnicalException(_(errorMessage, file), e); + } + } + + public static File explodeZip(File rootDirectory, + File file, + String errorMessage) { + File tempDir = new File(rootDirectory, UUID.randomUUID().toString()); + try { + ZipUtil.uncompress(file, tempDir); + } catch (IOException e) { + throw new FaxToMailTechnicalException(_(errorMessage, file), e); + } + return tempDir; + } + + public static String readContent(File file, String errorMessage) { + + try { + return Files.readFirstLine(file, Charsets.UTF_8); + + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + } + + public static void writeContent(File file, String content, String errorMessage) { + try { + FileUtils.write(file, content, Charsets.UTF_8); + } catch (IOException e) { + throw new FaxToMailTechnicalException(errorMessage, e); + } + + } +} Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailTechnicalException.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailTechnicalException.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/FaxToMailTechnicalException.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,27 @@ +package com.franciaflex.faxtomail; + +/** + * Any techincal exception should be boxed in a such exception. + * + * @author tchemit <chemit@codelutin.com/> + * @since 0.1 + */ +public class FaxToMailTechnicalException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public FaxToMailTechnicalException() { + } + + public FaxToMailTechnicalException(String message) { + super(message); + } + + public FaxToMailTechnicalException(String message, Throwable cause) { + super(message, cause); + } + + public FaxToMailTechnicalException(Throwable cause) { + super(cause); + } +} Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/LabelAware.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,14 @@ +package com.franciaflex.faxtomail; + +import java.io.Serializable; + +/** + * A contract to decorate some objects + * (not known at this level but with a label property to display them). + * + * @author tchemit <chemit@codelutin.com> + * @since 0.3 + */ +public interface LabelAware extends Serializable { + String getLabel(); +} Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/PropagatePropertyChangeListener.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/PropagatePropertyChangeListener.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/PropagatePropertyChangeListener.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,56 @@ +package com.franciaflex.faxtomail; + +import org.jdesktop.beans.AbstractBean; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +/** + * To listen a bean and propagate some of properties. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.3 + */ +public class PropagatePropertyChangeListener implements PropertyChangeListener { + + public static interface PropagatePropertyChange { + void firePropertyChanged(String propertyName, + Object oldValue, + Object newValue); + } + + public static void listenAndPropagate(AbstractBean producer, + PropagatePropertyChange consumer, + String propertyNameToListen, + String propertyNameToForward) { + PropagatePropertyChangeListener listener = + new PropagatePropertyChangeListener(propertyNameToForward, + consumer); + producer.addPropertyChangeListener(propertyNameToListen, listener); + } + + public static void listenAndPropagateAll(AbstractBean producer, + PropagatePropertyChange consumer) { + PropagatePropertyChangeListener listener = + new PropagatePropertyChangeListener(null, consumer); + producer.addPropertyChangeListener(listener); + } + + private String propertyName; + + private PropagatePropertyChange editor; + + public PropagatePropertyChangeListener(String propertyName, + PropagatePropertyChange editor) { + this.propertyName = propertyName; + this.editor = editor; + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + String name = propertyName == null ? evt.getPropertyName() : propertyName; + editor.firePropertyChanged(name, + evt.getOldValue(), + evt.getNewValue()); + } +} \ No newline at end of file Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/ProgressionModel.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,102 @@ +package com.franciaflex.faxtomail.persistence; + +import org.jdesktop.beans.AbstractSerializableBean; +import org.nuiton.updater.DownloadMonitor; + +/** + * Simple model for a progression long task. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class ProgressionModel extends AbstractSerializableBean implements DownloadMonitor { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_TOTAL = "total"; + + public static final String PROPERTY_CURRENT = "current"; + + public static final String PROPERTY_RATE = "rate"; + + public static final String PROPERTY_MESSAGE = "message"; + + protected int total; + + protected int current; + + protected float rate; + + protected String message; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + Object oldValue = getTotal(); + this.total = total; + firePropertyChange(PROPERTY_TOTAL, oldValue, total); + setCurrent(0); + } + + public void adaptTotal(int total) { + long current = getCurrent(); + setTotal(total); + increments((int) current); + Object oldValue = getTotal(); + this.total = total; + firePropertyChange(PROPERTY_TOTAL, oldValue, total); + setCurrent(current); + } + + public long getCurrent() { + return current; + } + + public void setCurrent(int current) { + Object oldValue = getCurrent(); + this.current = current; + firePropertyChange(PROPERTY_CURRENT, oldValue, current); + } + + public void increments(int nb) { + setCurrent(current + nb); + setRate(getCurrent() / getTotal()); + } + + public float getRate() { + return rate; + } + + public void setRate(float rate) { + Object oldValue = getRate(); + this.rate = rate; + firePropertyChange(PROPERTY_RATE, oldValue, rate); + } + + public String getMessage() { + return message; + } + + public void increments(String message) { + increments(1); + setMessage(message); + } + + public void setMessage(String message) { + Object oldValue = getMessage(); + this.message = message; + firePropertyChange(PROPERTY_MESSAGE, oldValue, message); + } + + @Override + public void setSize(long size) { + setTotal((int) size); + } + + @Override + public void setCurrent(long current) { + setCurrent((int) current); + } +} Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/RessourceClassLoader.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,166 @@ +package com.franciaflex.faxtomail.persistence; + +import com.franciaflex.faxtomail.FaxToMailIOUtil; +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +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.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Enumeration; +import java.util.List; + +import static org.nuiton.i18n.I18n._; + +/** + * A class loader that search first in a given directory before in parent + * class loader. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.3 + */ +public class RessourceClassLoader extends ClassLoader { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(RessourceClassLoader.class); + + public static final URL[] EMPTY_URL_ARRAY = new URL[0]; + + protected URLClassLoader loader; + + protected Predicate<String> searchInDirectoriesPredicate; + + protected final List<File> directories; + + public RessourceClassLoader(ClassLoader parent) { + super(parent); + + // by default try in directories if there is some + this.searchInDirectoriesPredicate = new Predicate<String>() { + @Override + public boolean apply(String input) { + return !directories.isEmpty(); + } + }; + directories = Lists.newArrayList(); + loader = URLClassLoader.newInstance(EMPTY_URL_ARRAY); + } + + public void addDirectory(File... directories) { + for (File directory : directories) { + if (!this.directories.contains(directory)) { + this.directories.add(directory); + + // force to create directory + FaxToMailIOUtil.forceMkdir(directory, _("faxtomail.persistence.mkDir.error", directory)); + } + } + loader = null; + } + + public void removeDirectory(File... directories) { + for (File directory : directories) { + this.directories.remove(directory); + } + loader = null; + } + + public Predicate<String> getSearchInDirectoriesPredicate() { + return searchInDirectoriesPredicate; + } + + public void addSearchInDirectoriesPredicate(Predicate<String> predicate) { + Preconditions.checkNotNull(predicate, + "search predicate can not be null"); + this.searchInDirectoriesPredicate = + Predicates.and(searchInDirectoriesPredicate, predicate); + } + + public void setSearchInDirectoriesPredicate(Predicate<String> searchInDirectoriesPredicate) { + Preconditions.checkNotNull(searchInDirectoriesPredicate, + "search predicate can not be null"); + this.searchInDirectoriesPredicate = searchInDirectoriesPredicate; + } + + @Override + public URL findResource(String name) { + URL result = null; + if (searchInDirectoriesPredicate.apply(name)) { + if (log.isDebugEnabled()) { + log.debug("findResource [" + name + "] in " + directories); + } + result = getLoader().findResource(name); + } + if (result == null) { + result = super.findResource(name); + } + return result; + } + + @Override + public Enumeration<URL> findResources(String name) throws IOException { + Enumeration<URL> result = null; + if (searchInDirectoriesPredicate.apply(name)) { + if (log.isDebugEnabled()) { + log.debug("findResources [" + name + "] in " + directories); + } + result = getLoader().findResources(name); + } + if (result == null || !result.hasMoreElements()) { + result = super.findResources(name); + } + return result; + } + + @Override + public URL getResource(String name) { + URL result = null; + if (searchInDirectoriesPredicate.apply(name)) { + if (log.isDebugEnabled()) { + log.debug("getResource [" + name + "] in " + + directories); + } + result = getLoader().getResource(name); + } + if (result == null) { + result = super.getResource(name); + } + return result; + } + + @Override + public Enumeration<URL> getResources(String name) throws IOException { + Enumeration<URL> result = null; + if (searchInDirectoriesPredicate.apply(name)) { + if (log.isDebugEnabled()) { + log.debug("getResources [" + name + "] in " + directories); + } + result = getLoader().getResources(name); + } + if (result == null || !result.hasMoreElements()) { + result = super.getResources(name); + } + return result; + } + + protected URLClassLoader getLoader() { + if (loader == null) { + try { + URL[] urls = FileUtils.toURLs( + directories.toArray(new File[directories.size()])); + loader = URLClassLoader.newInstance(urls, null); + } catch (IOException e) { + throw new FaxToMailTechnicalException(_("faxtomail.persistence.loader.error", directories), e); + } + } + return loader; + } +} Property changes on: trunk/faxtomail-persistence/src/main/resources ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/test ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-persistence/src/test/java ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-service/LICENSE.txt =================================================================== --- trunk/faxtomail-service/LICENSE.txt (rev 0) +++ trunk/faxtomail-service/LICENSE.txt 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,674 @@ + GNU 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. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/faxtomail-service/README.txt =================================================================== Added: trunk/faxtomail-service/pom.xml =================================================================== --- trunk/faxtomail-service/pom.xml (rev 0) +++ trunk/faxtomail-service/pom.xml 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,173 @@ +<?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"> + <parent> + <artifactId>faxtomail</artifactId> + <groupId>com.franciaflex</groupId> + <version>0.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.franciaflex.faxtomail</groupId> + <artifactId>faxtomail-service</artifactId> + + <name>FaxToMail :: Service</name> + + <properties> + + </properties> + + <dependencies> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>faxtomail-persistence</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-decorator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-config</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-updater</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-csv</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <scope>test</scope> + <classifier>tests</classifier> + </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-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-common</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.struts.xwork</groupId> + <artifactId>xwork-core</artifactId> + </dependency> + + <!-- Logging --> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jcl</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <properties> + <property> + <name>listener</name> + <value>fr.ifremer.tutti.persistence.test.TuttiRunListener</value> + </property> + </properties> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <executions> + <execution> + <id>scan-sources</id> + <configuration> + <entries> + <entry> + <specificGoal>parserValidation</specificGoal> + <basedir>${maven.src.dir}/main/java/</basedir> + <includes> + <param>**/**-validation.xml</param> + </includes> + </entry> + </entries> + </configuration> + <goals> + <goal>parserJava</goal> + <goal>parserValidation</goal> + <goal>gen</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </build> + +</project> \ No newline at end of file Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/AbstractFaxToMailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/AbstractFaxToMailService.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/AbstractFaxToMailService.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,57 @@ +package com.franciaflex.faxtomail.service; + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import org.apache.commons.io.FileUtils; +import org.nuiton.util.ZipUtil; + +import java.io.File; +import java.io.IOException; + +import static org.nuiton.i18n.I18n._; + +/** + * Sammoa service support. + * <p/> + * This simple implementation of {@link FaxToMailService}, offer to keep the + * {@link #context}. + * <p/> + * <strong>Note:</strong> should be used for any service! and never + * instanciated by hand but via {@link FaxToMailServiceContext#getService(Class)} method. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractFaxToMailService implements FaxToMailService { + + protected FaxToMailServiceContext context; + + @Override + public void setServiceContext(FaxToMailServiceContext context) { + this.context = context; + } + + public <S extends FaxToMailService> S getService(Class<S> serviceType) { + return context.getService(serviceType); + } + + @Override + public void close() throws IOException { + // by default nothing to close + } + + protected void compressZipFile(File zipFile, File directory) { + + try { + FileUtils.forceMkdir(zipFile.getParentFile()); + + try { + ZipUtil.compress(zipFile, directory); + } finally { + FileUtils.deleteDirectory(directory); + + } + } catch (IOException e) { + throw new FaxToMailTechnicalException(_("faxtomail.service.compressZipFile.error", directory, zipFile), e); + } + } +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/DecoratorService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/DecoratorService.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/DecoratorService.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,85 @@ +package com.franciaflex.faxtomail.service; + +import com.franciaflex.faxtomail.LabelAware; +import org.nuiton.decorator.Decorator; +import org.nuiton.decorator.DecoratorProvider; +import org.nuiton.decorator.JXPathDecorator; + +import java.io.File; + +/** + * Tutti decorator service. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class DecoratorService extends AbstractFaxToMailService { + + public static final String CARACTERISTIC_WITH_UNIT = "withUnit"; + + public static final String CARACTERISTIC_PARAMETER_ONLY_WITH_UNIT = "parameterOnlyWithUnit"; + + public static final String CARACTERISTIC_PARAMETER_ONLY = "parameterOnly"; + + public static final String FROM_PROTOCOL = "fromProtocol"; + + public static final String GEAR_WITH_RANK_ORDER = "gearWithrankOrder"; + + public static final String BY_NAME = "byName"; + + public static final String ONLY_NAME = "onlyName"; + + public static final String FILE_NAME_COMPATIBLE = "fileNameCompatible"; + + public static final String SEPARATOR = "#"; + + /** Delegate decorator provider. */ + protected DecoratorProvider decoratorProvider; + + public <O> Decorator<O> getDecorator(O object) { + return decoratorProvider.getDecorator(object); + } + + public <O> Decorator<O> getDecorator(O object, String name) { + return decoratorProvider.getDecorator(object, name); + } + + public <O> Decorator<O> getDecoratorByType(Class<O> type) { + return decoratorProvider.getDecoratorByType(type); + } + + public <O> Decorator<O> getDecoratorByType(Class<O> type, String name) { + return decoratorProvider.getDecoratorByType(type, name); + } + + @Override + public void setServiceContext(FaxToMailServiceContext context) { + super.setServiceContext(context); + + decoratorProvider = new DecoratorProvider() { + @Override + protected void loadDecorators() { + + registerFaxToMailDecorator(LabelAware.class, "${label}$s", SEPARATOR, " - "); + registerFaxToMailDecorator(File.class, "${absolutePath}$s", SEPARATOR, " - "); + registerDecorator(new Decorator<Float>(Float.class) { + private static final long serialVersionUID = 1L; + + @Override + public String toString(Object bean) { + return bean == null ? "" : String.valueOf(bean); + } + }); + } + + public void registerFaxToMailDecorator(Class<?> klass, String expression, String separator, String separatorReplacement) { + super.registerDecorator(FaxToMailDecorator.newDecorator(klass, expression, separator, separatorReplacement)); + } + + public void registerFaxToMailDecorator(Class<?> klass, String name, String expression, String separator, String separatorReplacement) { + super.registerDecorator(name, FaxToMailDecorator.newDecorator(klass, expression, separator, separatorReplacement)); + } + }; + } + +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailDecorator.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailDecorator.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailDecorator.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,265 @@ +package com.franciaflex.faxtomail.service; + +import com.google.common.base.Preconditions; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.Maps; +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.util.beans.BeanUtil; + +import java.beans.PropertyDescriptor; +import java.io.Serializable; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since TODO + */ +public class FaxToMailDecorator<O> extends MultiJXPathDecorator<O> implements Cloneable { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(FaxToMailDecorator.class); + + protected final Map<String, Method> tokenMethods; + + protected final LoadingCache<O, String> cache; + + protected boolean useCache; + + /** + * To sort always on the selected context. + * + * @since 2.8 + */ + protected boolean sortOnlyOnSelectedContext; + + /** + * List of tokens to sort using the {@link #sortOnlyOnSelectedContext} mode. + * <p/> + * If the mode is not set, then won't use this. + * + * @since 2.8 + */ + protected Set<String> sortOnlyOnSelectedContextTokens; + + public static <O> FaxToMailDecorator<O> newDecorator(Class<O> internalClass, + String expression, + String separator, + String separatorReplacement) { + return new FaxToMailDecorator<O>(internalClass, expression, separator, separatorReplacement); + } + + protected FaxToMailDecorator(Class<O> internalClass, + String expression, + String separator, + String separatorReplacement) throws IllegalArgumentException, NullPointerException { + super(internalClass, + expression, + separator, + separatorReplacement, + DecoratorUtil.<O>createMultiJXPathContextKeepingOrder(expression, + separator, + separatorReplacement)); + tokenMethods = Maps.newHashMap(); + Set<PropertyDescriptor> descriptors = + BeanUtil.getDescriptors(type, BeanUtil.IS_READ_DESCRIPTOR); + + for (String token : getTokens()) { + Method m = null; + for (PropertyDescriptor propertyDescriptor : descriptors) { + if (propertyDescriptor.getName().equals(token)) { + m = propertyDescriptor.getReadMethod(); + break; + } + } + if (m == null) { + throw new IllegalArgumentException( + "could not find the property " + token + " in " + type); + } + tokenMethods.put(token, m); + } + + int i = 0; + for (Context<O> OContext : contexts) { + OContext.setComparator(new TuttiDecoratorComparator<O>(getProperty(i++))); + } + + this.cache = CacheBuilder.newBuilder().build(new CacheLoader<O, String>() { + @Override + public String load(O key) throws Exception { + String result; + if (key == null) { + result = ""; + } else { + result = FaxToMailDecorator.this.toString(key); + } + return result; + } + }); + } + + public boolean isUseCache() { + return useCache; + } + + public void setUseCache(boolean useCache) { + this.useCache = useCache; + cache.invalidateAll(); + } + + public boolean isSortOnlyOnSelectedContext() { + return sortOnlyOnSelectedContext; + } + + public void setSortOnlyOnSelectedContext(boolean sortOnlyOnSelectedContext) { + this.sortOnlyOnSelectedContext = sortOnlyOnSelectedContext; + } + + public Set<String> getSortOnlyOnSelectedContextTokens() { + return sortOnlyOnSelectedContextTokens; + } + + public void setSortOnlyOnSelectedContextTokens(Set<String> sortOnlyOnSelectedContextTokens) { + this.sortOnlyOnSelectedContextTokens = sortOnlyOnSelectedContextTokens; + } + + public TuttiDecoratorComparator<O> getCurrentComparator() { + return (TuttiDecoratorComparator<O>) context.getComparator(0); + } + + @Override + public String toString(Object bean) { + O bean1 = (O) bean; + String result = null; + + if (useCache) { + + // try first in cache + try { + result = cache.get(bean1); + } catch (ExecutionException e) { + if (log.isErrorEnabled()) { + log.error("Could not obtain from cache", e); + } + } + } + if (result == null) { + + if (bean != null) { + Object[] args = new Object[nbToken]; + + String[] tokens = getTokens(); + for (int i = 0; i < nbToken; i++) { + String token = tokens[i]; + Object value = getValue(bean1, token); + if (value == null) { + value = onNullValue(bean1, token); + } + args[i] = value; + } + + try { + result = String.format(getExpression(), args); + } catch (Exception eee) { + if (log.isErrorEnabled()) { + log.error("Could not format " + getExpression() + "" + + " with args : " + Arrays.toString(args), eee); + } + result = ""; + } + + if (useCache) { + cache.put(bean1, result); + } + } + } + + return result; + } + + protected Object getValue(O bean, String token) { + Method method = tokenMethods.get(token); + Preconditions.checkNotNull(method, + "Could not find method for token " + token); + Object result; + try { + result = method.invoke(bean); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Could not obtain token [" + token + "] value", e); + } + result = ""; + } + return result; + } + + protected Object onNullValue(O bean, String token) { + return null; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public static class TuttiDecoratorComparator<O> extends JXPathComparator<O> implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + + protected String expression; + + public TuttiDecoratorComparator(String expression) { + super(expression); + this.expression = expression; + } + + @Override + public void init(JXPathDecorator<O> decorator, List<O> datas) { + clear(); + FaxToMailDecorator<O> tuttiDecorator = (FaxToMailDecorator<O>) decorator; + String token = decorator.getTokens()[0]; + boolean sortOnlyOnSelectedContext = + tuttiDecorator.isSortOnlyOnSelectedContext() && + tuttiDecorator.getSortOnlyOnSelectedContextTokens() != null && + tuttiDecorator.getSortOnlyOnSelectedContextTokens().contains(token); + + for (O data : datas) { + if (sortOnlyOnSelectedContext) { + Object tokenValue = tuttiDecorator.getValue(data, token); + + valueCache.put(data, (Comparable) tokenValue); + } else if (data instanceof Number) { + valueCache.put(data, (Comparable) data); + } else { + Comparable key = tuttiDecorator.toString(data); + valueCache.put(data, key); + } + } + } + + @Override + public TuttiDecoratorComparator<O> clone() { + TuttiDecoratorComparator<O> result = + new TuttiDecoratorComparator<O>(expression); + return result; + } + + public String getExpression() { + return expression; + } + } +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailService.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailService.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,22 @@ +package com.franciaflex.faxtomail.service; + +import java.io.Closeable; + +/** + * Contract for any faxtomail service. + * <p/> + * This contract just allow to inject the {@link FaxToMailServiceContext} in your service. + * <p/> + * A default support implement is given: {@link AbstractFaxToMailService}. + * <p/> + * To use a such service, you should not instanciate it by your self but prefer + * use the servie factory method: {@link FaxToMailServiceContext#getService(Class)}. + * + * @author tchemit <chemit@codelutin.com> + * @see AbstractFaxToMailService + * @since 0.1 + */ +public interface FaxToMailService extends Closeable { + + void setServiceContext(FaxToMailServiceContext context); +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailServiceContext.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailServiceContext.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/FaxToMailServiceContext.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,153 @@ +package com.franciaflex.faxtomail.service; + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import com.franciaflex.faxtomail.service.config.FaxToMailServiceConfig; +import com.franciaflex.faxtomail.persistence.RessourceClassLoader; +import com.google.common.base.Preconditions; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.opensymphony.xwork2.util.ValueStack; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.validator.xwork2.XWork2ValidatorUtil; + +import java.io.Closeable; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.Date; +import java.util.UUID; +import java.util.concurrent.ExecutionException; + +import static org.nuiton.i18n.I18n._; + +/** + * FaxToMail application context. + * <p/> + * This context is load at startup time and close when application dies. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailServiceContext implements Closeable { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FaxToMailServiceContext.class); + + protected final FaxToMailServiceConfig config; + +// protected final FaxToMailDataContext dataContext; + + protected final RessourceClassLoader resourceLoader; + + protected final LoadingCache<Class<? extends FaxToMailService>, FaxToMailService> services; + + public FaxToMailServiceContext(RessourceClassLoader resourceLoader, + FaxToMailServiceConfig config) { +// this(resourceLoader, config, new FaxToMailDataContext()); + this.resourceLoader = resourceLoader; + this.config = config; +// this.dataContext = dataContext; + // add datacontext in shared valueStack + ValueStack sharedValueStack = XWork2ValidatorUtil.getSharedValueStack(); +// sharedValueStack.push(dataContext.getValidationContext()); + this.services = CacheBuilder.newBuilder().build(new CacheLoader<Class<? extends FaxToMailService>, FaxToMailService>() { + @Override + public FaxToMailService load(Class<? extends FaxToMailService> key) throws Exception { + Preconditions.checkNotNull(key); + Constructor<? extends FaxToMailService> constructor = key.getConstructor(); + Preconditions.checkNotNull(constructor); + FaxToMailService service = constructor.newInstance(); + if (log.isDebugEnabled()) { + log.debug("New service " + service); + } + service.setServiceContext(FaxToMailServiceContext.this); + return service; + } + }); + } + +// public FaxToMailServiceContext(RessourceClassLoader resourceLoader, +// TuttiServiceConfig config, +// TuttiDataContext dataContext) { +// this.resourceLoader = resourceLoader; +// this.config = config; +//// this.dataContext = dataContext; +// // add datacontext in shared valueStack +// ValueStack sharedValueStack = XWork2ValidatorUtil.getSharedValueStack(); +// sharedValueStack.push(dataContext.getValidationContext()); +// this.services = CacheBuilder.newBuilder().build(new CacheLoader<Class<? extends FaxToMailService>, FaxToMailService>() { +// @Override +// public FaxToMailService load(Class<? extends FaxToMailService> key) throws Exception { +// Preconditions.checkNotNull(key); +// Constructor<? extends FaxToMailService> constructor = key.getConstructor(); +// Preconditions.checkNotNull(constructor); +// FaxToMailService service = constructor.newInstance(); +// if (log.isDebugEnabled()) { +// log.debug("New service " + service); +// } +// service.setServiceContext(FaxToMailServiceContext.this); +// return service; +// } +// }); +// } + + public FaxToMailServiceConfig getConfig() { + return config; + } + + public RessourceClassLoader getResourceLoader() { + return resourceLoader; + } + +// public FaxToMailDataContext getDataContext() { +// return dataContext; +// } + + public Date currentDate() { + return new Date(); + } + + public <S extends FaxToMailService> S getService(Class<S> serviceType) { + if (serviceType == null) { + return null; + } + try { + S s = (S) services.get(serviceType); + return s; + } catch (ExecutionException e) { + throw new FaxToMailTechnicalException(_("tutti.service.context.serviceInstanciation.error", serviceType), e); + } + } + + public <S extends FaxToMailService> S reloadService(Class<S> serviceType) { + S service = (S) services.getIfPresent(serviceType); + if (service != null) { + if (log.isDebugEnabled()) { + log.debug("Close service " + service); + } + IOUtils.closeQuietly(service); + } + services.invalidate(serviceType); + S result = getService(serviceType); + return result; + } + + @Override + public void close() throws IOException { + + for (FaxToMailService service : services.asMap().values()) { + if (log.isDebugEnabled()) { + log.debug("Close service " + service); + } + IOUtils.closeQuietly(service); + } + services.invalidateAll(); + } + + public String generateId(Class<?> type) { + return UUID.randomUUID().toString(); + } +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfig.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfig.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfig.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,116 @@ +package com.franciaflex.faxtomail.service.config; + +import com.franciaflex.faxtomail.FaxToMailIOUtil; +import org.nuiton.config.ApplicationConfig; +import org.nuiton.util.Version; + +import java.io.File; +import java.net.URL; + +import static org.nuiton.i18n.I18n._; + +/** + * Configuration for the service layer. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailServiceConfig { + + /** Delegate application config object containing configuration. */ + protected final ApplicationConfig applicationConfig; + +// protected final FaxToMailPersistenceConfig persistenceConfig; + + public FaxToMailServiceConfig(ApplicationConfig applicationConfig) { +// this(new FaxToMailPersistenceConfig(applicationConfig)); + this.applicationConfig = applicationConfig; + } + +// public FaxToMailServiceConfig(FaxToMailPersistenceConfig persistenceConfig) { +// +// this.applicationConfig = persistenceConfig.getConfig(); +// +// this.persistenceConfig = persistenceConfig; +// } + + public ApplicationConfig getApplicationConfig() { + return applicationConfig; + } + +// public FaxToMailPersistenceConfig getPersistenceConfig() { +// return persistenceConfig; +// } + + /** @return {@link FaxToMailServiceConfigOption#VERSION} value */ + public Version getVersion() { + return applicationConfig.getOptionAsVersion(FaxToMailServiceConfigOption.VERSION.getKey()); + } + + /** @return {@link FaxToMailServiceConfigOption#SITE_URL} value */ + public URL getSiteUrl() { + return applicationConfig.getOptionAsURL(FaxToMailServiceConfigOption.SITE_URL.getKey()); + } + + /** @return {@link FaxToMailServiceConfigOption#ORGANIZATION_NAME} value */ + public String getOrganizationName() { + return applicationConfig.getOption(FaxToMailServiceConfigOption.ORGANIZATION_NAME.getKey()); + } + + /** @return {@link FaxToMailServiceConfigOption#INCEPTION_YEAR} value */ + public int getInceptionYear() { + return applicationConfig.getOptionAsInt(FaxToMailServiceConfigOption.INCEPTION_YEAR.getKey()); + } + + /** @return {@link FaxToMailServiceConfigOption#BASEDIR} value */ + public File getBasedir() { + File result = applicationConfig.getOptionAsFile(FaxToMailServiceConfigOption.BASEDIR.getKey()); + return result; + } + + /** @return {@link FaxToMailServiceConfigOption#DATA_DIRECTORY} value */ + public File getDataDirectory() { + File result = applicationConfig.getOptionAsFile(FaxToMailServiceConfigOption.DATA_DIRECTORY.getKey()); + return result; + } + + public File getTmpDirectory() { + File result = applicationConfig.getOptionAsFile(FaxToMailServiceConfigOption.TMP_DIRECTORY.getKey()); + return result; + } + + public File newTempFile(String basename) { + return new File(getTmpDirectory(), basename + "_" + System.nanoTime()); + } + + public char getCsvSeparator() { + return applicationConfig.getOption( + FaxToMailServiceConfigOption.CSV_SEPARATOR.getKey()).charAt(0); + } + + public void prepareDirectories() { + + File dataDirectory = getDataDirectory(); + FaxToMailIOUtil.forceMkdir( + dataDirectory, + _("faxtomail.service.mkDir.error", dataDirectory)); + + File tmpDirectory = getTmpDirectory(); + if (tmpDirectory.exists()) { + + FaxToMailIOUtil.deleteDirectory( + tmpDirectory, + _("faxtomail.service.config.deleteTempDirectory.error", tmpDirectory)); + } + FaxToMailIOUtil.forceMkdir( + tmpDirectory, + _("faxtomail.service.mkDir.error", tmpDirectory)); + + } + + public void setCsvSeparator(char c) { + applicationConfig.setOption( + FaxToMailServiceConfigOption.CSV_SEPARATOR.getKey(), c + ""); + } + +} Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigOption.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigOption.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigOption.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,162 @@ +package com.franciaflex.faxtomail.service.config; + +import org.nuiton.config.ConfigOptionDef; +import org.nuiton.util.Version; + +import java.io.File; +import java.net.URL; + +import static org.nuiton.i18n.I18n.n_; + +/** + * Option for service configuration. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public enum FaxToMailServiceConfigOption implements ConfigOptionDef { + + // TRANSIENT CONFIG + VERSION( + "faxtomail.version", + n_("faxtomail.config.option.version.description"), + "", + Version.class, + true, + true), + SITE_URL( + "faxtomail.site.url", + n_("faxtomail.config.option.site.url.description"), + "http://maven-site.forge.codelutin.com/faxtomail", + URL.class, + true, + true), + ORGANIZATION_NAME( + "faxtomail.organizationName", + n_("faxtomail.config.option.organizationName.description"), + "", + String.class, + true, + true), + INCEPTION_YEAR( + "faxtomail.inceptionYear", + n_("faxtomail.config.option.inceptionYear.description"), + "2012", + Integer.class, + true, + true), + BASEDIR( + "faxtomail.basedir", + n_("faxtomail.config.option.basedir.description"), + "${user.home}/.faxtomail", + File.class, + true, + true + ), + DATA_DIRECTORY( + "faxtomail.data.directory", + n_("faxtomail.config.option.data.directory.description"), + "${faxtomail.basedir}/data", + File.class, + true, + true), + TMP_DIRECTORY( + "faxtomail.tmp.directory", + n_("faxtomail.config.option.tmp.directory.description"), + "${faxtomail.data.directory}/temp", + File.class, + true, + true), + + // NOT TRANSIENT CONFIG + + CSV_SEPARATOR( + "faxtomail.csv.separator", + n_("faxtomail.config.option.csv.separator.description"), + ";", + char.class); + + /** Configuration key. */ + private final String key; + + /** I18n key of option description */ + private final String description; + + /** Type of option */ + private final Class<?> type; + + /** Default value of option. */ + private String defaultValue; + + /** Flag to not keep option value on disk */ + private boolean isTransient; + + /** Flag to not allow option value modification */ + private boolean isFinal; + + FaxToMailServiceConfigOption(String key, + String description, + String defaultValue, + Class<?> type, + boolean isTransient, + boolean isFinal) { + this.key = key; + this.description = description; + this.defaultValue = defaultValue; + this.type = type; + this.isTransient = isTransient; + this.isFinal = isFinal; + } + + FaxToMailServiceConfigOption(String key, + String description, + String defaultValue, + Class<?> type) { + this(key, description, defaultValue, type, false, false); + } + + @Override + public String getKey() { + return key; + } + + @Override + public Class<?> getType() { + return type; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public boolean isTransient() { + return isTransient; + } + + @Override + public boolean isFinal() { + return isFinal; + } + + @Override + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public void setTransient(boolean newValue) { + // not used + } + + @Override + public void setFinal(boolean newValue) { + // not used + } +} \ No newline at end of file Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigProvider.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigProvider.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/service/config/FaxToMailServiceConfigProvider.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,38 @@ +package com.franciaflex.faxtomail.service.config; + +import org.nuiton.config.ApplicationConfigProvider; +import org.nuiton.config.ConfigActionDef; +import org.nuiton.config.ConfigOptionDef; + +import java.util.Locale; + +import static org.nuiton.i18n.I18n.l_; + +/** + * Service config provider (for site generation). + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailServiceConfigProvider implements ApplicationConfigProvider { + + @Override + public String getName() { + return "faxtomail-service"; + } + + @Override + public String getDescription(Locale locale) { + return l_(locale, "faxtomail.config.service"); + } + + @Override + public ConfigOptionDef[] getOptions() { + return FaxToMailServiceConfigOption.values(); + } + + @Override + public ConfigActionDef[] getActions() { + return new ConfigActionDef[0]; + } +} \ No newline at end of file Added: trunk/faxtomail-service/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider =================================================================== --- trunk/faxtomail-service/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider (rev 0) +++ trunk/faxtomail-service/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1 @@ +com.franciaflex.faxtomail.service.config.FaxToMailServiceConfigProvider \ No newline at end of file Added: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties =================================================================== --- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties (rev 0) +++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_en_GB.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,62 @@ +faxtomail.config.option.basedir.description= +faxtomail.config.option.csv.separator.description= +faxtomail.config.option.data.directory.description= +faxtomail.config.option.inceptionYear.description= +faxtomail.config.option.organizationName.description= +faxtomail.config.option.site.url.description= +faxtomail.config.option.tmp.directory.description= +faxtomail.config.option.version.description= +faxtomail.config.service= +faxtomail.service.compressZipFile.error= +faxtomail.service.config.deleteTempDirectory.error= +faxtomail.service.mkDir.error= +tutti.config.option.basedir.description= +tutti.config.option.csv.separator.description= +tutti.config.option.inceptionYear.description= +tutti.config.option.organizationName.description= +tutti.config.option.site.url.description= +tutti.config.option.tmp.directory.description= +tutti.config.option.version.description= +tutti.property.attachment= +tutti.property.caracteristic= +tutti.property.country= +tutti.property.cruise= +tutti.property.date= +tutti.property.department= +tutti.property.firstName= +tutti.property.fishingOperation= +tutti.property.fishingOperationLocation= +tutti.property.fishingOperationNumber= +tutti.property.fractionName= +tutti.property.gear= +tutti.property.gearShootingStartDate= +tutti.property.genusSpecies= +tutti.property.internationalRegistrationCode= +tutti.property.label= +tutti.property.lastName= +tutti.property.marineLitterCategory= +tutti.property.matrixName= +tutti.property.methodName= +tutti.property.multirigAggregation= +tutti.property.name= +tutti.property.parameterName= +tutti.property.person= +tutti.property.program= +tutti.property.protocol= +tutti.property.rankOrder= +tutti.property.refTaxCode= +tutti.property.sortedUnsortedCategory= +tutti.property.species= +tutti.property.stationNumber= +tutti.property.strata= +tutti.property.surveyCode= +tutti.property.tuttiLocation= +tutti.property.user= +tutti.property.vessel= +tutti.property.zone= +tutti.propety.no.species.speciesCode= +tutti.propety.no.vessel.name= +tutti.propety.no.zone= +tutti.propety.vessel.nation.registrationCode= +tutti.service.compressZipFile.error= +tutti.service.context.serviceInstanciation.error= Added: trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties =================================================================== --- trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties (rev 0) +++ trunk/faxtomail-service/src/main/resources/i18n/faxtomail-service_fr_FR.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,62 @@ +faxtomail.config.option.basedir.description= +faxtomail.config.option.csv.separator.description= +faxtomail.config.option.data.directory.description= +faxtomail.config.option.inceptionYear.description= +faxtomail.config.option.organizationName.description= +faxtomail.config.option.site.url.description= +faxtomail.config.option.tmp.directory.description= +faxtomail.config.option.version.description= +faxtomail.config.service= +faxtomail.service.compressZipFile.error= +faxtomail.service.config.deleteTempDirectory.error= +faxtomail.service.mkDir.error= +tutti.config.option.basedir.description= +tutti.config.option.csv.separator.description= +tutti.config.option.inceptionYear.description= +tutti.config.option.organizationName.description= +tutti.config.option.site.url.description= +tutti.config.option.tmp.directory.description= +tutti.config.option.version.description= +tutti.property.attachment= +tutti.property.caracteristic= +tutti.property.country= +tutti.property.cruise= +tutti.property.date= +tutti.property.department= +tutti.property.firstName= +tutti.property.fishingOperation= +tutti.property.fishingOperationLocation= +tutti.property.fishingOperationNumber= +tutti.property.fractionName= +tutti.property.gear= +tutti.property.gearShootingStartDate= +tutti.property.genusSpecies= +tutti.property.internationalRegistrationCode= +tutti.property.label= +tutti.property.lastName= +tutti.property.marineLitterCategory= +tutti.property.matrixName= +tutti.property.methodName= +tutti.property.multirigAggregation= +tutti.property.name= +tutti.property.parameterName= +tutti.property.person= +tutti.property.program= +tutti.property.protocol= +tutti.property.rankOrder= +tutti.property.refTaxCode= +tutti.property.sortedUnsortedCategory= +tutti.property.species= +tutti.property.stationNumber= +tutti.property.strata= +tutti.property.surveyCode= +tutti.property.tuttiLocation= +tutti.property.user= +tutti.property.vessel= +tutti.property.zone= +tutti.propety.no.species.speciesCode= +tutti.propety.no.vessel.name= +tutti.propety.no.zone= +tutti.propety.vessel.nation.registrationCode= +tutti.service.compressZipFile.error= +tutti.service.context.serviceInstanciation.error= Property changes on: trunk/faxtomail-ui-swing ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/LICENSE.txt =================================================================== --- trunk/faxtomail-ui-swing/LICENSE.txt (rev 0) +++ trunk/faxtomail-ui-swing/LICENSE.txt 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,674 @@ + GNU 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. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/faxtomail-ui-swing/README.txt =================================================================== Added: trunk/faxtomail-ui-swing/pom.xml =================================================================== --- trunk/faxtomail-ui-swing/pom.xml (rev 0) +++ trunk/faxtomail-ui-swing/pom.xml 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,428 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>com.franciaflex</groupId> + <artifactId>faxtomail</artifactId> + <version>0.1-SNAPSHOT</version> + </parent> + + <groupId>com.franciaflex.faxtomail</groupId> + <artifactId>faxtomail-ui-swing</artifactId> + <version>0.1-SNAPSHOT</version> + + <name>FaxToMail :: UI</name> + <properties> + + <!-- jaxx configuration --> + <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath> + <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> + <jaxx.defaultErrorUIFQN> + jaxx.runtime.validator.swing.ui.ImageValidationUI + </jaxx.defaultErrorUIFQN> + <!--<jaxx.useUIManagerForIcon>true</jaxx.useUIManagerForIcon>--> + <jaxx.generateHelp>true</jaxx.generateHelp> + <jaxx.generateSearch>false</jaxx.generateSearch> + <jaxx.autoImportCss>true</jaxx.autoImportCss> + <jaxx.autoRecurseInCss>false</jaxx.autoRecurseInCss> + + <i18n.bundleOutputName>faxtomail-i18n</i18n.bundleOutputName> + <i18n.generateCsvFile>true</i18n.generateCsvFile> + <i18n.bundleCsvFile> + ${maven.gen.dir}/resources/META-INF/${i18n.bundleOutputName}.csv + </i18n.bundleCsvFile> + + <!-- generate license bundled files --> + <license.generateBundle>true</license.generateBundle> + <license.bundleThirdPartyPath> + META-INF/faxtomail-THIRD-PARTY.txt + </license.bundleThirdPartyPath> + <license.bundleLicensePath> + META-INF/faxtomail-LICENSE.txt + </license.bundleLicensePath> + + <maven.jar.main.class> + com.franciaflex.faxtomail.ui.swing.RunFaxToMail + </maven.jar.main.class> + + <bundlePrefix>faxtomail-${project.version}</bundlePrefix> + + <faxtomail.log.file> + \$\{java.io.tmpdir\}/faxtomail-${project.version}.log + </faxtomail.log.file> + + <!-- Post Release configuration --> + <skipPostRelease>false</skipPostRelease> + + </properties> + + <dependencies> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>faxtomail-service</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-config</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-decorator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-csv</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <!-- used forApplicationUpdater --> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <scope>test</scope> + <classifier>tests</classifier> + </dependency> + + <!-- librairie Jaxx --> + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-runtime</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-config</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-validator</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-widgets</artifactId> + </dependency> + + <!-- swing widgets --> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-core</artifactId> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-common</artifactId> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-autocomplete</artifactId> + </dependency> + + <!-- Logging --> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jcl</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/filtered-resources</directory> + <filtering>true</filtering> + <includes> + <include>*.config</include> + <include>*.properties</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> + <plugins> + + <plugin> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <executions> + <execution> + <id>scan-sources</id> + <configuration> + <entries> + <entry> + <specificGoal>parserValidation</specificGoal> + <basedir>${maven.src.dir}/main/java/</basedir> + <includes> + <param>**/**-validation.xml</param> + </includes> + </entry> + <entry> + <basedir>${maven.gen.dir}/java/</basedir> + </entry> + </entries> + </configuration> + <goals> + <goal>parserJava</goal> + <goal>parserValidation</goal> + <goal>gen</goal> + </goals> + </execution> + <execution> + <id>make-bundle</id> + <goals> + <goal>bundle</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-licenses</id> + <goals> + <goal>update-project-license</goal> + <goal>add-third-party</goal> + </goals> + <configuration> + <licenseMerges> + <licenseMerge>The Apache Software License, Version 2.0| + Apache License, Version 2.0 + </licenseMerge> + <licenseMerge>General Public License (GPL)| + GNU LESSER GENERAL PUBLIC LICENSE + </licenseMerge> + <licenseMerge>General Public License (GPL)| + GNU Lesser General Public License + </licenseMerge> + <licenseMerge> + Common Development and Distribution License (CDDL) v1.0| + COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + </licenseMerge> + <licenseMerge>BSD License|BSD</licenseMerge> + </licenseMerges> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + <silent>true</silent> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <useUniqueVersions>false</useUniqueVersions> + <addClasspath>true</addClasspath> + <classpathPrefix>./lib/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + + </plugins> + </build> + + <profiles> + + <profile> + <id>default-bundle</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + <build> + <defaultGoal>package</defaultGoal> + <plugins> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>assembly-standalone</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <attach>true</attach> + <descriptors> + <descriptor> + src/main/assembly/standalone.xml + </descriptor> + <descriptor> + src/main/assembly/i18n.xml + </descriptor> + <descriptor> + src/main/assembly/help.xml + </descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>prepare-full-release</id> + <activation> + <property> + <name>performFullRelease</name> + <value>true</value> + </property> + </activation> + <properties> + + <redmine.releaseFiles> + target/${bundlePrefix}-full-windows-i586.zip, + target/${bundlePrefix}-full-linux-i586.zip + <!--target/${bundlePrefix}-full-windows-x64.zip,--> + <!--target/${bundlePrefix}-full-linux-x64.zip--> + </redmine.releaseFiles> + </properties> + <build> + + </build> + </profile> + + <profile> + <id>profiling</id> + + <build> + <resources> + <resource> + <directory>src/main/profiling</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> + </build> + + <dependencies> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-profiling</artifactId> + <scope>runtime</scope> + </dependency> + </dependencies> + </profile> + </profiles> +</project> \ No newline at end of file Property changes on: trunk/faxtomail-ui-swing/src ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/license ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties =================================================================== --- trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/faxtomail-ui-swing/src/license/THIRD-PARTY.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,22 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License +# - BSD License +# - Common Development and Distribution License (CDDL) v1.0 +# - Common Public License Version 1.0 +# - GNU General Public License - Version 2 with the class path exception +# - GNU Library or Lesser General Public License +# - General Public License (GPL) +# - Lesser General Public License (LGPL) +# - Lesser General Public License (LGPL) v 3.0 +# - MIT License +# - New BSD License +# - The Apache Software License, Version 2.0 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Sat Jan 11 21:21:40 CET 2014 +commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 +javassist--javassist--3.11.0.GA=The Apache Software License, Version 2.0 Property changes on: trunk/faxtomail-ui-swing/src/main ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/filtered-resources/faxtomail.config =================================================================== --- trunk/faxtomail-ui-swing/src/main/filtered-resources/faxtomail.config (rev 0) +++ trunk/faxtomail-ui-swing/src/main/filtered-resources/faxtomail.config 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,4 @@ +faxtomail.version=${project.version} +faxtomail.site.url=${project.url} +faxtomail.inceptionYear=${project.inceptionYear} +faxtomail.organizationName=${license.organizationName} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/filtered-resources/log4j.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/filtered-resources/log4j.properties (rev 0) +++ trunk/faxtomail-ui-swing/src/main/filtered-resources/log4j.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,20 @@ +# Global logging configuration +log4j.rootLogger=ERROR, stdout, file + +# Console output +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +#log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %5p [%20t] (%c:%L) - %m%n +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %5p (%c:%L) - %m%n + +# faxtomail levels +log4j.logger.com.franciaflex.faxtomail=INFO + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.file=${faxtomail.log.file} +log4j.appender.file.MaxFileSize=10MB +log4j.appender.file.MaxBackupIndex=4 + +log4j.appender.file.layout=org.apache.log4j.PatternLayout +#log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p [%20t] %c - %m%n +log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p %c - %m%n Property changes on: trunk/faxtomail-ui-swing/src/main/java ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/java/com ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailScreen.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,21 @@ +package com.franciaflex.faxtomail.ui.swing; + +/** + * Enumeration of any internal screen of application. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public enum FaxToMailScreen { + + /** + * To display config. + * + * @since 1.0 + */ + CONFIG, + + SEARCH, + + DEMANDE, LIST +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,491 @@ +package com.franciaflex.faxtomail.ui.swing; + +import com.franciaflex.faxtomail.service.DecoratorService; +import com.franciaflex.faxtomail.FaxToMailIOUtil; +import com.franciaflex.faxtomail.service.FaxToMailServiceContext; +import com.franciaflex.faxtomail.persistence.RessourceClassLoader; +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfig; +import com.franciaflex.faxtomail.ui.swing.content.MainUI; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailErrorHelper; +import com.franciaflex.faxtomail.ui.swing.util.UIMessageNotifier; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionUI; +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import jaxx.runtime.swing.editor.bean.BeanDoubleList; +import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; +import jaxx.runtime.swing.session.BeanDoubleListState; +import jaxx.runtime.swing.session.BeanFilterableComboBoxState; +import jaxx.runtime.swing.session.State; +import jaxx.runtime.swing.session.SwingSession; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.beans.AbstractBean; +import org.nuiton.i18n.I18n; +import org.nuiton.i18n.init.DefaultI18nInitializer; +import org.nuiton.i18n.init.UserI18nInitializer; +import org.nuiton.util.converter.ConverterUtil; + +import java.io.Closeable; +import java.io.File; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import static org.nuiton.i18n.I18n._; + +/** + * UI application context. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailUIContext extends AbstractBean implements Closeable, UIMessageNotifier { + + /** Logger. */ + private static final Log log = LogFactory.getLog(FaxToMailUIContext.class); + + public static final String PROPERTY_SCREEN = "screen"; + + public static final String PROPERTY_LOCALE = "locale"; + + public static final String PROPERTY_BUSY = "busy"; + + public static final String PROPERTY_HIDE_BODY = "hideBody"; + + /** + * Application context (only one for all the application). + * + * @since 0.1 + */ + private static FaxToMailUIContext applicationContext; + + /** + * Application global configuration. + * + * @since 0.1 + */ + protected final FaxToMailApplicationConfig config; + + /** + * ClassLoader ressource. + * + * @since 0.3 + */ + protected final RessourceClassLoader resourceLoader; + + /** + * Service context used by any service. + * + * @since 0.1 + */ + protected final FaxToMailServiceContext serviceContext; + + /** + * Swing session used to save ui states. + * + * @since 0.1 + */ + protected final SwingSession swingSession; + + /** + * Erro helper. + * + * @since 1.0 + */ + protected final FaxToMailErrorHelper errorHelper; + + /** + * Current screen displayed in ui. + * + * @since 0.1 + */ + protected FaxToMailScreen screen; + + /** + * Current locale used in application. + * + * @since 1.0.3 + */ + protected Locale locale; + + /** + * Busy state ({@code true} when a blocking action is running). + * + * @since 1.0.3 + */ + protected boolean busy; + + /** + * Flag to hide (or not) the body of application. + * + * @since 1.1 + */ + protected boolean hideBody; + + /** + * Message notifiers. + * + * @since 0.3 + */ + protected final Set<UIMessageNotifier> messageNotifiers; + + private MainUI mainUI; + + private FaxToMailActionUI actionUI; + + + public static FaxToMailUIContext newContext(FaxToMailApplicationConfig config) { + Preconditions.checkNotNull(config); + Preconditions.checkState(applicationContext == null, + "Application context was already opened!"); + applicationContext = new FaxToMailUIContext(config); + return applicationContext; + } + + public static FaxToMailUIContext getApplicationContext() { + return applicationContext; + } + + public static FaxToMailErrorHelper getErrorHelper() { + return applicationContext.errorHelper; + } + + protected FaxToMailUIContext(FaxToMailApplicationConfig config) { + this.config = config; + this.resourceLoader = new RessourceClassLoader(Thread.currentThread().getContextClassLoader()); + this.serviceContext = new FaxToMailServiceContext(resourceLoader, config.getServiceConfig()); + + Map<Class, State> additionalStates = Maps.newHashMap(); + additionalStates.put(BeanFilterableComboBox.class, new BeanFilterableComboBoxState()); + additionalStates.put(BeanDoubleList.class, new BeanDoubleListState()); + this.swingSession = new SwingSession(getConfig().getUIConfigFile(), false, additionalStates); + + UIMessageNotifier logMessageNotifier = new UIMessageNotifier() { + + @Override + public void showInformationMessage(String message) { + if (StringUtils.isNotBlank(message)) { + message = message.replaceAll("\\<strong\\>", ""); + message = message.replaceAll("\\<.strong\\>", ""); + message = message.replaceAll("\\<li\\>", ""); + message = message.replaceAll("\\<.li\\>", ""); + message = message.replaceAll("\\<ul\\>", ""); + message = message.replaceAll("\\<.ul\\>", ""); + if (log.isInfoEnabled()) { + log.info(message); + } + } + } + }; + + this.messageNotifiers = Sets.newHashSet(); + addMessageNotifier(logMessageNotifier); + + this.errorHelper = new FaxToMailErrorHelper(this); + + } + + //------------------------------------------------------------------------// + //-- Open / close methods --// + //------------------------------------------------------------------------// + + public void init() { + + config.getServiceConfig().prepareDirectories(); + + // use our special classLoader (which will read some files from resources from a configuration directory) + Thread.currentThread().setContextClassLoader(getResourceLoader()); + + // converters are stored in current classloader, we need then to rescan them + // each time we change current classloader + ConverterUtil.deregister(); + ConverterUtil.initConverters(); + + // Use shutdownHook to close context on System.exit + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { + + @Override + public void run() { + if (log.isInfoEnabled()) { + log.info("Close context on shutdown"); + } + close(); + } + })); + + //--------------------------------------------------------------------// + // init db configuration + //--------------------------------------------------------------------// + +// config.getServiceConfig().getPersistenceConfig().initConfig(getResourceLoader()); + +// // clean db cache (avoid a lots of headache :( +// File cacheDirectory = config.getServiceConfig().getPersistenceConfig().getCacheDirectory(); +// if (cacheDirectory.exists()) { +// // clean cache directory (fix soem headaches...) +// TuttiIOUtil.cleanDirectory( +// cacheDirectory, +// _("tutti.db.deleteCache.error", cacheDirectory)); +// } + + //--------------------------------------------------------------------// + // init i18n + //--------------------------------------------------------------------// + File i18nDirectory = config.getI18nDirectory(); + if (!config.isFullLaunchMode()) { + + i18nDirectory = new File(config.getDataDirectory(), "i18n"); + + if (i18nDirectory.exists()) { + // clean i18n cache + FaxToMailIOUtil.cleanDirectory( + i18nDirectory, + _("faxtomail.i18n.deleteCache.error", i18nDirectory)); + } + } + + FaxToMailIOUtil.forceMkdir(i18nDirectory, + _("faxtomail.i18n.mkDir.error", i18nDirectory)); + + if (log.isDebugEnabled()) { + log.debug("I18N directory: " + i18nDirectory); + } + + Locale i18nLocale = config.getI18nLocale(); + + if (log.isInfoEnabled()) { + log.info(String.format("Starts i18n with locale [%s] at [%s]", + i18nLocale, i18nDirectory)); + } + I18n.init(new UserI18nInitializer( + i18nDirectory, new DefaultI18nInitializer("faxtomail-i18n")), + i18nLocale); + +// //--------------------------------------------------------------------// +// // init help +// //--------------------------------------------------------------------// +// +// File helpDirectory = config.getHelpDirectory(); +// +// if (!config.isFullLaunchMode()) { +// +// if (!helpDirectory.exists()) { +// helpDirectory = new File(config.getDataDirectory(), "help"); +// } +// } +// +// if (log.isDebugEnabled()) { +// log.debug("Help directory: " + helpDirectory); +// } +// TuttiIOUtil.forceMkdir( +// helpDirectory, +// _("tutti.help.mkDir.error", helpDirectory)); +// +// // load help mapping +// String mappingProperties = +// "/tutti-help-" + i18nLocale.getLanguage() + ".properties"; +// try { +// +// InputStream resourceAsStream = +// getClass().getResourceAsStream(mappingProperties); +// helpMapping = new Properties(); +// helpMapping.load(resourceAsStream); +// +// } catch (Exception eee) { +// log.error("Failed to load help mapping file at '" + +// mappingProperties + "'", eee); +// } +// if (log.isInfoEnabled()) { +// log.info(String.format("Starts help with locale at [%s]", +// helpDirectory)); +// } +// +// //--------------------------------------------------------------------// +// // init action UI +// //--------------------------------------------------------------------// + setActionUI(new FaxToMailActionUI(null, this)); + } + + public void open() { + + setLocale(config.getI18nLocale()); + +// boolean dbExists = +// config.getServiceConfig().getPersistenceConfig().isDbExists(); +// +// setDbExist(dbExists); +// +// if (!dbExists) { +// +// } +// +// // save back to config +// saveContextToConfig(); +// +// // list when programId or campaingId change to save the configuration +// addPropertyChangeListener(new PropertyChangeListener() { +// +// @Override +// public void propertyChange(PropertyChangeEvent evt) { +// +// if (PROPERTIES_TO_SAVE.contains(evt.getPropertyName())) { +// saveContextToConfig(); +// } +// } +// }); + } + + @Override + public void close() { + +// // Clear data references + messageNotifiers.clear(); +// validationContext = null; +// IOUtils.closeQuietly(dataContext); + + setScreen(null); + + IOUtils.closeQuietly(serviceContext); + +// // remove listeners +// PropertyChangeListener[] listeners = getPropertyChangeListeners(); +// for (PropertyChangeListener listener : listeners) { +// if (log.isDebugEnabled()) { +// log.debug("Remove listener: " + listener); +// } +// removePropertyChangeListener(listener); +// } + setMainUI(null); + if (actionUI != null) { + + // close action ui + actionUI.getModel().clear(); + } + setActionUI(null); + } + + //------------------------------------------------------------------------// + //-- Service methods --// + //------------------------------------------------------------------------// + + public DecoratorService getDecoratorService() { + return serviceContext.getService(DecoratorService.class); + } + + //------------------------------------------------------------------------// + //-- DataContext methods --// + //------------------------------------------------------------------------// + + //------------------------------------------------------------------------// + //-- Config methods --// + //------------------------------------------------------------------------// + + public FaxToMailApplicationConfig getConfig() { + return config; + } + + protected void saveContextToConfig() { +// if (log.isInfoEnabled()) { +// log.info("Save config (programId: " + getProgramId() + ", cruiseId: " + +// getCruiseId() + ", protocolId: " + getProtocolId() + ", locale: " + +// getLocale() + ")"); +// } +// config.setProgramId(getProgramId()); +// config.setCruiseId(getCruiseId()); +// config.setProtocolId(getProtocolId()); +// config.setI18nLocale(getLocale()); + config.save(); + } + + //------------------------------------------------------------------------// + //-- UI methods --// + //------------------------------------------------------------------------// + + public MainUI getMainUI() { + return mainUI; + } + + public void setMainUI(MainUI mainUI) { + this.mainUI = mainUI; + } + + public FaxToMailActionUI getActionUI() { + return actionUI; + } + + public void setActionUI(FaxToMailActionUI actionUI) { + this.actionUI = actionUI; + } + + public SwingSession getSwingSession() { + return swingSession; + } + + public FaxToMailScreen getScreen() { + return screen; + } + + public void setScreen(FaxToMailScreen screen) { + Object oldValue = getScreen(); + this.screen = screen; + firePropertyChange(PROPERTY_SCREEN, oldValue, screen); + } + + public boolean isBusy() { + return busy; + } + + public void setBusy(boolean busy) { + this.busy = busy; + firePropertyChange(PROPERTY_BUSY, null, busy); + } + + public boolean isHideBody() { + return hideBody; + } + + public void setHideBody(boolean hideBody) { + this.hideBody = hideBody; + firePropertyChange(PROPERTY_HIDE_BODY, null, hideBody); + } + + //------------------------------------------------------------------------// + //-- UIMessageNotifier methods --// + //------------------------------------------------------------------------// + + public void addMessageNotifier(UIMessageNotifier messageNotifier) { + this.messageNotifiers.add(messageNotifier); + } + + public void removeMessageNotifier(UIMessageNotifier messageNotifier) { + this.messageNotifiers.remove(messageNotifier); + } + + @Override + public void showInformationMessage(String message) { + for (UIMessageNotifier messageNotifier : messageNotifiers) { + messageNotifier.showInformationMessage(message); + } + } + + public RessourceClassLoader getResourceLoader() { + return resourceLoader; + } + + //------------------------------------------------------------------------// + //-- Other methods --// + //------------------------------------------------------------------------// + + public Locale getLocale() { + return locale; + } + + public void setLocale(Locale locale) { + this.locale = locale; + firePropertyChange(PROPERTY_LOCALE, null, locale); + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/RunFaxToMail.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,147 @@ +package com.franciaflex.faxtomail.ui.swing; + +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfig; +import com.franciaflex.faxtomail.ui.swing.content.MainUI; +import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; +import com.franciaflex.faxtomail.ui.swing.content.StartAction; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailExceptionHandler; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionHelper; +import jaxx.runtime.SwingUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import javax.swing.plaf.BorderUIResource; +import java.awt.*; +import java.util.Arrays; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since 0.1 + */ +public class RunFaxToMail { + + /** Logger. */ + private static final Log log = LogFactory.getLog(RunFaxToMail.class); + + public static final int NORMAL_EXIT_CODE = 0; + + public static final int UPATE_EXIT_CODE = 88; + + public static void main(String... args) { + + if (log.isInfoEnabled()) { + log.info("Starting FaxToMail with arguments: " + Arrays.toString(args)); + } + + // override default exception management (after config init) + Thread.setDefaultUncaughtExceptionHandler(new FaxToMailExceptionHandler()); + // See http://forge.codelutin.com/issues/2055 + //System.setProperty("sun.awt.exception.handler", TuttiExceptionHandler.class.getName()); + + // Create configuration + FaxToMailApplicationConfig config = + new FaxToMailApplicationConfig("faxtomail.config", args); + + // Create application context + FaxToMailUIContext context = FaxToMailUIContext.newContext(config); + + // prepare context (mainly init configs, i18n) + context.init(); + + // Prepare ui look&feel and load ui properties + try { + SwingUtil.initNimbusLoookAndFeel(); + } catch (Exception e) { + // could not find nimbus look-and-feel + if (log.isWarnEnabled()) { + log.warn("Failed to init nimbus look and feel", e); + } + } + + boolean reload = false; + + if (config.isFullLaunchMode()) { + + if (log.isInfoEnabled()) { + log.info("Full launch mode, try to update."); + } + + // check application url is reachable +// boolean canUpdateApplication = context.checkUpdateApplicationReachable(); + +// if (canUpdateApplication) { +// // try to update jre - i18n - application - help and exit if so +// UpdateApplicationAction logicAction = TuttiActionHelper.createLogicAction(new MainUIHandler(context), +// UpdateApplicationAction.class); +// TuttiActionHelper.runActionAndWait(logicAction); +// +// reload = logicAction.isReload(); +// } + + // check data url is reachable +// boolean canUpdateData = context.checkUpdateDataReachable(); + +// if (canUpdateData) { +// // try to update report and exit if so +// UpdateReportAction logicAction = TuttiActionHelper.createLogicAction(new MainUIHandler(context), +// UpdateReportAction.class); +// TuttiActionHelper.runActionAndWait(logicAction); +// +// reload |= logicAction.isReload(); +// } + } + + if (!reload) { + if (log.isInfoEnabled()) { + log.info("Will start FaxToMail..."); + } + startFaxToMail(context, true); + } + + } + + public static void startFaxToMail(FaxToMailUIContext context, boolean openContext) { + + if (openContext) { + context.open(); + } + +// UIManager.put("Table.alternateRowColor", context.getConfig().getColorAlternateRow()); +// UIManager.put("Table[Disabled+Selected].textBackground", context.getConfig().getColorSelectedRow()); +// UIManager.put("Table[Enabled+Selected].textBackground", context.getConfig().getColorSelectedRow()); + UIManager.put("Table.focusCellHighlightBorder", new BorderUIResource.LineBorderUIResource(Color.BLACK)); + + final MainUI mainUI = new MainUI(context); + context.addMessageNotifier(mainUI.getHandler()); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + mainUI.setVisible(true); + } + }); + + // launch start action (use the tutti-start-action file) + StartAction uiAction = FaxToMailActionHelper.createLogicAction( + mainUI.getHandler(), StartAction.class); + FaxToMailActionHelper.runAction(uiAction); + } + + public static void closeFaxToMail(MainUIHandler handler, Integer exitCode) { + + FaxToMailUIContext context = handler.getContext(); + + // close ui + handler.onCloseUI(); + + //close context + context.getSwingSession().save(); + context.close(); + + if (exitCode != null) { + System.exit(exitCode); + } + } + +} \ No newline at end of file Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfig.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfig.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfig.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,251 @@ +package com.franciaflex.faxtomail.ui.swing.config; + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import com.franciaflex.faxtomail.service.config.FaxToMailServiceConfig; +import com.franciaflex.faxtomail.service.config.FaxToMailServiceConfigOption; +import com.google.common.base.Charsets; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.config.ApplicationConfig; +import org.nuiton.config.ApplicationConfigHelper; +import org.nuiton.config.ApplicationConfigProvider; +import org.nuiton.config.ArgumentsParserException; +import org.nuiton.util.Version; + +import javax.swing.KeyStroke; +import java.awt.*; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Locale; +import java.util.Set; + +import static org.nuiton.i18n.I18n._; + +/** + * FaxToMail application config. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailApplicationConfig { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FaxToMailApplicationConfig.class); + + /** + * Delegate application config object containing configuration. + * + * @since 0.1 + */ + protected final ApplicationConfig applicationConfig; + + /** + * Service configuration to pass to service context. + * + * @since 0.1 + */ + protected final FaxToMailServiceConfig serviceConfig; + + protected final String[] optionKeyToNotSave; + + public FaxToMailApplicationConfig(String file, String... args) { + + applicationConfig = new ApplicationConfig(); + applicationConfig.setEncoding(Charsets.UTF_8.name()); + + // get all config providers + Set<ApplicationConfigProvider> providers = + ApplicationConfigHelper.getProviders(null, + null, + null, + true); + + // load all default options + ApplicationConfigHelper.loadAllDefaultOption(applicationConfig, + providers); + + // get all transient and final option keys + Set<String> optionToSkip = + ApplicationConfigHelper.getTransientOptionKeys(providers); + + if (log.isDebugEnabled()) { + log.debug("Option that won't be saved: " + optionToSkip); + } + optionKeyToNotSave = optionToSkip.toArray(new String[optionToSkip.size()]); + + applicationConfig.setConfigFileName(file); + + try { + applicationConfig.parse(args); + + } catch (ArgumentsParserException e) { + throw new FaxToMailTechnicalException(_("faxtomail.config.parse.error"), e); + } + + //TODO Review this, this is very dirty to do this... + File faxToMailBasedir = applicationConfig.getOptionAsFile( + FaxToMailServiceConfigOption.BASEDIR.getKey()); + + if (faxToMailBasedir == null) { + faxToMailBasedir = new File(""); + } + if (!faxToMailBasedir.isAbsolute()) { + faxToMailBasedir = new File(faxToMailBasedir.getAbsolutePath()); + } + if (faxToMailBasedir.getName().equals("..")) { + faxToMailBasedir = faxToMailBasedir.getParentFile().getParentFile(); + } + if (faxToMailBasedir.getName().equals(".")) { + faxToMailBasedir = faxToMailBasedir.getParentFile(); + } + if (log.isInfoEnabled()) { + log.info("Application basedir: " + faxToMailBasedir); + } + applicationConfig.setOption( + FaxToMailServiceConfigOption.BASEDIR.getKey(), + faxToMailBasedir.getAbsolutePath()); + + serviceConfig = new FaxToMailServiceConfig(applicationConfig); + } + + public ApplicationConfig getApplicationConfig() { + return applicationConfig; + } + + public FaxToMailServiceConfig getServiceConfig() { + return serviceConfig; + } + + protected File configFile; + + public File getConfigFile() { + if (configFile == null) { + File dir = getFaxToMailBasedir(); + if (dir == null || !dir.exists() || !isFullLaunchMode()) { + dir = new File(applicationConfig.getUserConfigDirectory()); + } + configFile = new File(dir, applicationConfig.getConfigFileName()); + } + return configFile; + } + + public void save() { + + File file = getConfigFile(); + if (log.isInfoEnabled()) { + log.info("Save configuration at: " + file); + } + try { + applicationConfig.save(file, false, optionKeyToNotSave); + } catch (IOException e) { + throw new FaxToMailTechnicalException(_("faxtomail.config.save.error", file), e); + } + } + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this); + } + + public boolean isFullLaunchMode() { + return "full".equals(getFaxToMailLaunchMode()); + } + + public String getFaxToMailLaunchMode() { + return applicationConfig.getOption(FaxToMailApplicationConfigOption.FAXTOMAIL_LAUNCH_MODE.getKey()); + } + + /** @return {@link FaxToMailApplicationConfigOption#UI_CONFIG_FILE} value */ + public File getUIConfigFile() { + return applicationConfig.getOptionAsFile(FaxToMailApplicationConfigOption.UI_CONFIG_FILE.getKey()); + } + + /** @return {@link FaxToMailApplicationConfigOption#START_ACTION_FILE} value */ + public File getStartActionFile() { + return applicationConfig.getOptionAsFile(FaxToMailApplicationConfigOption.START_ACTION_FILE.getKey()); + } + + public KeyStroke getShortCut(String actionName) { + KeyStroke result = applicationConfig.getOptionAsKeyStroke( + "faxtomail.ui." + actionName); + return result; + } + + public boolean isAutoPopupNumberEditor() { + return applicationConfig.getOptionAsBoolean(FaxToMailApplicationConfigOption.AUTO_POPUP_NUMBER_EDITOR.getKey()); + } + + public boolean isShowNumberEditorButton() { + return applicationConfig.getOptionAsBoolean(FaxToMailApplicationConfigOption.SHOW_NUMBER_EDITOR_BUTTON.getKey()); + } + + public Color getColorBlockingLayer() { + return applicationConfig.getOptionAsColor(FaxToMailApplicationConfigOption.COLOR_BLOCKING_LAYER.getKey()); + } + + public Color getColorAlternateRow() { + return applicationConfig.getOptionAsColor(FaxToMailApplicationConfigOption.COLOR_ALTERNATE_ROW.getKey()); + } + + public Color getColorSelectedRow() { + return applicationConfig.getOptionAsColor(FaxToMailApplicationConfigOption.COLOR_SELECTED_ROW.getKey()); + } + + public KeyStroke getShortcutClosePopup() { + return applicationConfig.getOptionAsKeyStroke(FaxToMailApplicationConfigOption.SHORTCUT_CLOSE_POPUP.getKey()); + } + + public String getDateFormat() { + return applicationConfig.getOption(FaxToMailApplicationConfigOption.DATE_FORMAT.getKey()); + } + + public Version getVersion() { + return serviceConfig.getVersion(); + } + + public int getInceptionYear() { + return serviceConfig.getInceptionYear(); + } + + public URL getSiteUrl() { + return serviceConfig.getSiteUrl(); + } + + public String getOrganizationName() { + return serviceConfig.getOrganizationName(); + } + + public File getTmpDirectory() { + return serviceConfig.getTmpDirectory(); + } + + public File getNewTmpDirectory(String name) { + return new File(getTmpDirectory(), name + "_" + System.nanoTime()); + } + + public File getDataDirectory() { + return serviceConfig.getDataDirectory(); + } + + public File getI18nDirectory() { + return applicationConfig.getOptionAsFile( + FaxToMailApplicationConfigOption.FAXTOMAIL_I18N_DIRECTORY.getKey()); + } + + public Locale getI18nLocale() { + return applicationConfig.getOptionAsLocale( + FaxToMailApplicationConfigOption.FAXTOMAIL_I18N_LOCALE.getKey()); + } + + public void setI18nLocale(Locale locale) { + applicationConfig.setOption(FaxToMailApplicationConfigOption.FAXTOMAIL_I18N_LOCALE.getKey(), locale.toString()); + } + + public File getFaxToMailBasedir() { + return serviceConfig.getBasedir(); + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigOption.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigOption.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigOption.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,204 @@ +package com.franciaflex.faxtomail.ui.swing.config; + +import org.nuiton.config.ConfigOptionDef; + +import javax.swing.*; +import java.awt.*; +import java.io.File; +import java.util.Locale; + +import static org.nuiton.i18n.I18n.n_; + +/** + * All FaxToMail configuration options. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public enum FaxToMailApplicationConfigOption implements ConfigOptionDef { + + FAXTOMAIL_LAUNCH_MODE( + "faxtomail.launch.mode", + n_("faxtomail.config.option.launch.mode.description"), + null, + String.class, + true, + true + ), + + FAXTOMAIL_I18N_DIRECTORY( + "faxtomail.i18n.directory", + n_("faxtomail.config.option.i18n.directory.description"), + "${faxtomail.basedir}/i18n", + File.class, + false, + true + ), + +// FAXTOMAIL_HELP_DIRECTORY( +// "faxtomail.help.directory", +// n_("faxtomail.config.option.help.directory.description"), +// "${faxtomail.basedir}/help", +// File.class, +// false, +// true +// ), + + START_ACTION_FILE( + "faxtomail.startActionFile", + n_("faxtomail.config.option.startActionFile.description"), + "${faxtomail.basedir}/faxtomail-start-action", + File.class, + true, + true + ), + FAXTOMAIL_I18N_LOCALE( + "faxtomail.i18n.locale", + n_("faxtomail.config.option.i18n.locale.description"), + Locale.FRANCE.getCountry(), + Locale.class + ), + + UI_CONFIG_FILE( + "faxtomail.ui.config.file", + n_("faxtomail.config.option.ui.config.file.description"), + "${faxtomail.data.directory}/faxtomailUI.xml", + File.class + ), + + AUTO_POPUP_NUMBER_EDITOR( + "faxtomail.ui.autoPopupNumberEditor", + n_("faxtomail.config.option.ui.autoPopupNumberEditor.description"), + String.valueOf(false), + Boolean.class + ), + + SHOW_NUMBER_EDITOR_BUTTON( + "faxtomail.ui.showNumberEditorButton", + n_("faxtomail.config.option.ui.showNumberEditorButton.description"), + String.valueOf(true), + Boolean.class + ), + + COLOR_ALTERNATE_ROW( + "faxtomail.ui.color.alternateRow", + n_("faxtomail.config.option.ui.color.alternateRow.description"), + new Color(217, 217, 217).toString(), + Color.class + ), + COLOR_SELECTED_ROW( + "faxtomail.ui.color.selectedRow", + n_("faxtomail.config.option.ui.color.selectedRow.description"), + new Color(57,105,138).toString(), + Color.class + ), + + /* + UIDefaults defaults = UIManager.getLookAndFeelDefaults(); +defaults.put("Table.alternateRowColor", new Color(217, 217, 217)); + */ + COLOR_BLOCKING_LAYER( + "faxtomail.ui.color.blockingLayer", + n_("faxtomail.config.option.ui.color.blockingLayer.description"), + new Color(200, 200, 200).toString(), + Color.class + ), + + SHORTCUT_CLOSE_POPUP( + "faxtomail.ui.shortcut.closePopup", + n_("faxtomail.config.option.ui.shortcut.closePopup.description"), + "alt pressed F", + KeyStroke.class + ), + + DATE_FORMAT( + "faxtomail.ui.dateFormat", + n_("faxtomail.config.option.ui.dateFormat.description"), + "dd/MM/yyyy", + String.class + ); + + /** Configuration key. */ + private final String key; + + /** I18n key of option description */ + private final String description; + + /** Type of option */ + private final Class<?> type; + + /** Default value of option. */ + private String defaultValue; + + /** Flag to not keep option value on disk */ + private boolean isTransient; + + /** Flag to not allow option value modification */ + private boolean isFinal; + + FaxToMailApplicationConfigOption(String key, + String description, + String defaultValue, + Class<?> type, + boolean isTransient, + boolean isFinal) { + this.key = key; + this.description = description; + this.defaultValue = defaultValue; + this.type = type; + this.isTransient = isTransient; + this.isFinal = isFinal; + } + + FaxToMailApplicationConfigOption(String key, + String description, + String defaultValue, + Class<?> type) { + this(key, description, defaultValue, type, false, false); + } + + @Override + public String getKey() { + return key; + } + + @Override + public Class<?> getType() { + return type; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public boolean isTransient() { + return isTransient; + } + + @Override + public boolean isFinal() { + return isFinal; + } + + @Override + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public void setTransient(boolean newValue) { + // not used + } + + @Override + public void setFinal(boolean newValue) { + // not used + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigProvider.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigProvider.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/config/FaxToMailApplicationConfigProvider.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,38 @@ +package com.franciaflex.faxtomail.ui.swing.config; + +import org.nuiton.config.ApplicationConfigProvider; +import org.nuiton.config.ConfigActionDef; +import org.nuiton.config.ConfigOptionDef; + +import java.util.Locale; + +import static org.nuiton.i18n.I18n.l_; + +/** + * Application config provider (for site generation). + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class FaxToMailApplicationConfigProvider implements ApplicationConfigProvider { + + @Override + public String getName() { + return "faxtomail-application"; + } + + @Override + public String getDescription(Locale locale) { + return l_(locale, "faxtomail.config.application"); + } + + @Override + public ConfigOptionDef[] getOptions() { + return FaxToMailApplicationConfigOption.values(); + } + + @Override + public ConfigActionDef[] getActions() { + return new ConfigActionDef[0]; + } +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractChangeScreenAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractChangeScreenAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractChangeScreenAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,93 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.context.JAXXContextEntryDef; + +/** + * Action to change the screen. + * <p/> + * Will just check that the current screen can be quit via + * the {@link MainUIHandler#quitCurrentScreen()}. + * <p/> + * + * @author kmorin <kmorin@codelutin.com> + * @since 1.0 + */ +public abstract class AbstractChangeScreenAction extends AbstractMainUIFaxToMailAction { + + /** + * Context entry to keep previous screen. + * + * @since 1.1 + */ + protected static final JAXXContextEntryDef<FaxToMailScreen> PREVIOUS_SCREEN = + SwingUtil.newContextEntryDef("previousScreen", FaxToMailScreen.class); + + /** + * Screen where to go. + * + * @since 1.0 + */ + protected FaxToMailScreen screen; + + /** + * Flag to skip the check of current screen. + * + * @since 1.1 + */ + protected boolean skipCheckCurrentScreen; + + protected AbstractChangeScreenAction(MainUIHandler handler, + boolean hideBody, + FaxToMailScreen screen) { + super(handler, hideBody); + this.screen = screen; + } + + public void setSkipCheckCurrentScreen(boolean skipCheckCurrentScreen) { + this.skipCheckCurrentScreen = skipCheckCurrentScreen; + } + + protected void setScreen(FaxToMailScreen screen) { + this.screen = screen; + } + + @Override + public boolean prepareAction() throws Exception { + boolean result = super.prepareAction(); + result &= skipCheckCurrentScreen || getHandler().quitCurrentScreen(); + return result; + } + + @Override + public void doAction() throws Exception { + + FaxToMailUIContext context = getContext(); + + FaxToMailScreen previousScreen = context.getScreen(); + if (getUI() != null) { + if (previousScreen == null) { + PREVIOUS_SCREEN.removeContextValue(getUI()); + } else { + PREVIOUS_SCREEN.setContextValue(getUI(), previousScreen); + } + } + + // clean current screen + context.setScreen(null); + + // change screen + context.setScreen(screen); + } + + @Override + public void postFailedAction(Throwable error) { + if (error != null) { + +// getContext().setFallBackScreen(); + } + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractMainUIFaxToMailAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractMainUIFaxToMailAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/AbstractMainUIFaxToMailAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,16 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.util.action.AbstractFaxToMailAction; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public abstract class AbstractMainUIFaxToMailAction extends AbstractFaxToMailAction<FaxToMailUIContext, MainUI, MainUIHandler> { + + protected AbstractMainUIFaxToMailAction(MainUIHandler handler, + boolean hideBody) { + super(handler, hideBody); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/CloseApplicationAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/CloseApplicationAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/CloseApplicationAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,41 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; + +import static org.nuiton.i18n.I18n._; + +/** + * To close FaxToMail Application. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class CloseApplicationAction extends AbstractChangeScreenAction { + + protected int exitCode = RunFaxToMail.NORMAL_EXIT_CODE; + + public CloseApplicationAction(MainUIHandler handler) { + super(handler, false, null); + setSkipCheckCurrentScreen(true); + setActionDescription(_("faxtomail.main.action.exit.tip")); + } + + public void setExitCode(int exitCode) { + this.exitCode = exitCode; + } + + @Override + public void doAction() throws Exception { + + super.doAction(); + + RunFaxToMail.closeFaxToMail(getHandler(), exitCode); + } + + + @Override + public void releaseAction() { + exitCode = RunFaxToMail.NORMAL_EXIT_CODE; + super.releaseAction(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/GoToPreviousScreenAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/GoToPreviousScreenAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/GoToPreviousScreenAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,20 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import static org.nuiton.i18n.I18n._; + +/** + * To return on previous screen. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class GoToPreviousScreenAction extends AbstractChangeScreenAction { + + public GoToPreviousScreenAction(MainUIHandler handler) { + super(handler, + true, + PREVIOUS_SCREEN.getContextValue(handler.getUI()) + ); + setActionDescription(_("faxtomail.main.action.goto.previousScreen.tip")); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,108 @@ +/* +#busyBlockLayerUI { + useIcon:false; + blockingColor: {model.getConfig().getColorBlockingLayer()}; + block:{model.isBusy()}; +} +*/ + +#mainFrame { + title: "faxtomail.main.title.applicationName"; + defaultCloseOperation: {JFrame.EXIT_ON_CLOSE}; + //iconImage:{SwingUtil.createImageIcon("allegro_32.png").getImage()}; +} + +#menuFile { + text: "faxtomail.main.menu.file"; + toolTipText: "faxtomail.main.menu.file.tip"; + toolTipText: "faxtomail.main.menu.file.tip"; + i18nMnemonic: "faxtomail.main.menu.file.mnemonic"; +} + +#menuFileDemandeList { + text: "faxtomail.main.action.demandeList"; + toolTipText: "faxtomail.main.action.demandeList.tip"; + i18nMnemonic: "faxtomail.main.action.demandeList.mnemonic"; + enabled: true;//{model.getScreen() != TuttiScreen.LIST}; + _tuttiAction: {ShowDemandeListAction.class}; +} + +#menuFileRecherche { + text: "faxtomail.main.action.recherche"; + toolTipText: "faxtomail.main.action.recherche.tip"; + i18nMnemonic: "faxtomail.main.action.recherche.mnemonic"; + enabled: true; + _tuttiAction: {ShowRechercheAction.class}; +} + +#menuFileConfiguration { + actionIcon: config; + text: "faxtomail.main.action.configuration"; + toolTipText: "faxtomail.main.action.configuration.tip"; + i18nMnemonic: "faxtomail.main.action.configuration.mnemonic"; + enabled: true;//{model.getScreen() != TuttiScreen.CONFIG}; + _tuttiAction: {ShowConfigAction.class}; + _help: {"faxtomail.main.menu.action.configuration.help"}; +} + +#menuFileExit { + actionIcon: exit; + text: "faxtomail.main.action.exit"; + toolTipText: "faxtomail.main.action.exit.tip"; + i18nMnemonic: "faxtomail.main.action.exit.mnemonic"; + _tuttiAction: {CloseApplicationAction.class}; + _help: {"faxtomail.main.menu.action.exit.help"}; +} + +/* +#menuHelp { + text: "tutti.main.menu.help"; + toolTipText: "tutti.main.menu.help.tip"; + i18nMnemonic: "tutti.main.menu.help.mnemonic"; +} + +#menuShowHelp { + actionIcon: help; + text: "tutti.main.action.showHelp"; + toolTipText: "tutti.main.action.showHelp.tip"; + i18nMnemonic: "tutti.main.action.showHelp.mnemonic"; + _help: {"tutti.index.help"}; +} + +#menuHelpSite { + actionIcon: site; + text: "tutti.main.action.site"; + toolTipText: "tutti.main.action.site.tip"; + i18nMnemonic: "tutti.main.action.site.mnemonic"; + _help: {"tutti.main.menu.action.site.help"}; +} + +#menuHelpAbout { + text: "tutti.main.action.about"; + toolTipText: "tutti.main.action.about.tip"; + actionIcon: about; + i18nMnemonic: "tutti.main.action.about.mnemonic"; + _tuttiAction: {ShowAboutAction.class}; + _help: {"tutti.main.menu.action.about.help"}; +} + +#bottomBar { + floatable: false; + margin: {new java.awt.Insets(0, 0, 0, 5)}; + borderPainted: false; +} + +#validatorMessageWidget { + focusPainted: false; +} + +#showHelp { + actionIcon:"show-help"; + toolTipText:"tutti.main.action.showHelp.tip"; + _help: {"tutti.main.menu.action.showHelp.help"}; +} + +#body { + _help: {"tutti.main.help"}; +} +*/ Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,65 @@ +<JFrame id='mainFrame' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<FaxToMailUIContext, MainUIHandler>' + width='800' height='600'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + + org.jdesktop.swingx.JXTitledPanel + + javax.swing.JFrame + java.awt.BorderLayout + </import> + + <FaxToMailUIContext id='model' + initializer='getContextValue(FaxToMailUIContext.class)'/> + <MainUIHandler id='handler' + initializer='getContextValue(MainUIHandler.class)'/> + + <script><![CDATA[ + + public MainUI(FaxToMailUIContext context) { + setContextValue(context); + MainUIHandler handler = new MainUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <!-- menu --> + <JMenuBar id='menu'> + <JMenu id='menuFile'> + <JMenuItem id='menuFileDemandeList'/> + <JMenuItem id='menuFileRecherche'/> + <JMenuItem id='menuFileConfiguration'/> + <JSeparator/> + <JMenuItem id='menuFileExit'/> + </JMenu> + + <!--<JMenu id='menuHelp'>--> + <!--<JMenuItem id='menuShowHelp'--> + <!--onActionPerformed="handler.showHelp()"/>--> + <!--<JMenuItem id='menuHelpSite'--> + <!--onActionPerformed='handler.gotoSite()'/>--> + <!--<JMenuItem id='menuHelpAbout'/>--> + <!--<JMenu id='menuChangeLocale'>--> + <!--<JMenuItem id='menuChangeLocaleUK'/>--> + <!--<JMenuItem id='menuChangeLocaleFR'/>--> + <!--</JMenu>--> + <!--</JMenu>--> + </JMenuBar> + + <!--<JToolBar id='bottomBar'>--> + <!--<SwingValidatorMessageWidget id='validatorMessageWidget'/>--> + <!--</JToolBar>--> + + <JXTitledPanel id='body' constraints='BorderLayout.CENTER' decorator='boxed'/> + + <!-- status message bar --> + <StatusMessagePanel id='status' constraints="BorderLayout.SOUTH"/> + +</JFrame> Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/MainUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,484 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; +import com.franciaflex.faxtomail.ui.swing.content.MainUI; +import com.franciaflex.faxtomail.ui.swing.content.config.FaxToMailConfigUI; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; +import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI; +import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.franciaflex.faxtomail.ui.swing.util.RemoveablePropertyChangeListener; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionUI; +import com.google.common.base.Preconditions; +import jaxx.runtime.JAXXBinding; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.session.SwingSession; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.i18n.I18n; + +import javax.swing.Icon; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JToolBar; +import java.awt.Cursor; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeListenerProxy; +import java.net.URL; +import java.util.Locale; + +import static org.nuiton.i18n.I18n._; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class MainUIHandler extends AbstractFaxToMailUIHandler<FaxToMailUIContext, MainUI> { + + /** Logger. */ + private static final Log log = LogFactory.getLog(MainUIHandler.class); + + protected JComponent currentBody; + +// protected PersistenceService persistenceService; + + protected MainUIHandler(FaxToMailUIContext context, MainUI ui) { + super(context, ui); +// this.persistenceService = context.getPersistenceService(); + context.setMainUI(ui); + context.setActionUI(new FaxToMailActionUI(ui, context)); + } + + public MainUIHandler(FaxToMailUIContext context) { + super(context, null); +// this.persistenceService = null; + } + + //------------------------------------------------------------------------// + //-- AbstractTuttiUIHandler methods --// + //------------------------------------------------------------------------// + + @Override + public void beforeInitUI() { + context.addPropertyChangeListener(new RemoveablePropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + String propertyName = evt.getPropertyName(); + if (propertyName.equals(FaxToMailUIContext.PROPERTY_SCREEN)) { + setScreen((FaxToMailScreen) evt.getNewValue()); + } + } + }); + ui.setContextValue(ui, MainUI.class.getName()); + + // ecoute des changements de l'état busy + context.addPropertyChangeListener(FaxToMailUIContext.PROPERTY_BUSY, new RemoveablePropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + Boolean newvalue = (Boolean) evt.getNewValue(); + updateBusyState(newvalue != null && newvalue); + } + }); + + // ecoute des changements de l'état busy + context.addPropertyChangeListener(FaxToMailUIContext.PROPERTY_HIDE_BODY, new RemoveablePropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + Boolean newvalue = (Boolean) evt.getNewValue(); + if (getUI() != null && getUI().getBody() != null) { + getUI().getBody().setVisible(newvalue != null && newvalue); + } + } + }); + } + + protected void updateBusyState(boolean busy) { + if (busy) { + // ui bloquee + if (log.isDebugEnabled()) { + log.debug("block ui in busy mode"); + } + ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } else { + // ui debloquee + if (log.isDebugEnabled()) { + log.debug("unblock ui in none busy mode"); + } + ui.setCursor(Cursor.getDefaultCursor()); + } + } + + @Override + public void afterInitUI() { + + initUI(ui); + + // installation layer de blocage en mode busy +// SwingUtil.setLayerUI(ui.getBody(), ui.getBusyBlockLayerUI()); +// + //FIXME-TC See why this binding is not setted ? +// ui.applyDataBinding(MainUI.BINDING_MENU_CHANGE_LOCALE_FR_ENABLED); +// ui.applyDataBinding(MainUI.BINDING_MENU_CHANGE_LOCALE_UK_ENABLED); + + // Init SwingSession +// SwingSession swingSession = context.getSwingSession(); +// swingSession.add(ui); +// swingSession.save(); + +// SwingUtil.getLayer(ui.getBody()).setUI(new BetaLayerUI()); + + changeTitle(); + +// JToolBar bar = ui.getBottomBar(); +// ui.getStatus().addWidget(bar, 0); + +// if (context.isDbLoaded()) { +// +// // db already opened (happens when reloading ui) +// // just go to select cruise screen +// TuttiUIAction<SelectCruiseAction> uiAction = TuttiActionHelper.createUIAction(this, SelectCruiseAction.class); +// SelectCruiseAction logicAction = uiAction.getLogicAction(); +// logicAction.setSkipCheckCurrentScreen(true); +// logicAction.setActionDescription(ui.getMenuActionSelectCruise().getToolTipText()); +// uiAction.actionPerformed(null); +// +// } else { +// +// if (context.isDbExist()) { +// +// // open tutti db (using a fake button to have simple api) +// TuttiUIAction<OpenDbAction> uiAction = TuttiActionHelper.createUIAction(this, OpenDbAction.class); +// OpenDbAction logicAction = uiAction.getLogicAction(); +// logicAction.setSkipCheckCurrentScreen(true); +// logicAction.setUpdateReferentiel(true); +// uiAction.actionPerformed(null); +// +// } else { +// +// // clean db context +// context.clearDbContext(); +// +// // go to manage db screen (to install db) +// context.setScreen(TuttiScreen.MANAGE_DB); +// } +// } + context.setScreen(FaxToMailScreen.LIST); + } + + @Override + protected JComponent getComponentToFocus() { + return currentBody; + } + + @Override + public void onCloseUI() { + + // remove any screen + context.setScreen(null); + context.removeMessageNotifier(this); + + // clean context + + PropertyChangeListener[] propertyChangeListeners = + context.getPropertyChangeListeners(); + for (PropertyChangeListener listener : propertyChangeListeners) { + if (listener instanceof PropertyChangeListenerProxy) { + PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener; + listener = proxy.getListener(); + } + if (listener instanceof RemoveablePropertyChangeListener) { + if (log.isDebugEnabled()) { + log.debug("Remove listener: " + listener); + } + context.removePropertyChangeListener(listener); + } + } + + if (ui != null) { + + // clean ui + + JAXXBinding[] bindings = ui.getDataBindings(); + for (JAXXBinding binding : bindings) { + SwingUtil.removeDataBinding(ui, binding.getId()); + } + ui.setVisible(false); + ui.dispose(); + } + } + + @Override + public SwingValidator<FaxToMailUIContext> getValidator() { + return null; + } + + //------------------------------------------------------------------------// + //-- Public methods --// + //------------------------------------------------------------------------// + + public void reloadUI() { + + //close ui + onCloseUI(); + + // restart ui + RunFaxToMail.startFaxToMail(getContext(), false); + } + + public boolean acceptLocale(Locale l, String expected) { + return l != null && l.toString().equals(expected); + } + + public void changeLocale(Locale locale) { + +// // change locale (and save configuration) + getModel().setLocale(locale); +// +// // change i18n locale + I18n.setDefaultLocale(getConfig().getI18nLocale()); +// +// // reload decorator service (TODO Check if this is necessary) +// getContext().reloadDecoratorService(); +// +// // close reload + reloadUI(); + } + +// public void gotoSite() { +// FaxToMailApplicationConfig config = context.getConfig(); +// +// URL siteURL = config.getSiteUrl(); +// +// if (log.isDebugEnabled()) { +// log.debug("goto " + siteURL); +// } +// TuttiUIUtil.openLink(siteURL); +// } + +// public void showHelp() { +// getModel().showHelp(ui, ui.getBroker(), null); +// } + + public void registerValidator(SwingValidator validator) { +// ui.getValidatorMessageWidget().registerValidator(validator); + } + + @Override + public void clearValidators() { +// ui.getValidatorMessageWidget().clearValidators(); + } + + public boolean quitCurrentScreen() { + + boolean canClose; + if (context.getScreen() == null || currentBody == null) { + + // no screen, surely can quit + canClose = true; + if (log.isWarnEnabled()) { + log.warn("=================================================="); + log.warn("No screen, Should then skipCheckCurrent in action."); + log.warn("=================================================="); + } + } else { + FaxToMailUI<?, ?> body = (FaxToMailUI<?, ?>) currentBody; + Preconditions.checkNotNull(currentBody); + AbstractFaxToMailUIHandler<?, ?> handler = body.getHandler(); + if (handler instanceof CloseableUI) { + + // try to quit UI + canClose = ((CloseableUI) handler).quitUI(); + } else { + + // can always close ui + canClose = true; + } + } + return canClose; + } + + public AbstractFaxToMailUIHandler getCurrentHandler() { + FaxToMailUI<?, ?> body = (FaxToMailUI<?, ?>) currentBody; + return body.getHandler(); + } + + /** + * Reload the persistence service and set the new ne into the handler. + * + * @since 1.0 + */ + public void reloadPersistenceService() { +// this.persistenceService = context.reloadPersistenceService(); + } + + /** + * Get the persistence service instance used by the handler. + * + * @return the persistence service instance used by the handler + * @since 1.0 + */ +// public PersistenceService getPersistenceService() { +// return persistenceService; +// } + + //------------------------------------------------------------------------// + //-- Internal methods --// + //------------------------------------------------------------------------// + + protected void setScreen(FaxToMailScreen screen) { + + // close current body (if any) + if (currentBody != null) { + FaxToMailUI<?, ?> body = (FaxToMailUI<?, ?>) currentBody; + body.getHandler().onCloseUI(); + + context.getSwingSession().save(); + + ui.getBody().remove(currentBody); + + currentBody = null; + } + + if (screen != null) { + + // load new body + + JComponent screenUI; + JToolBar rightDecoration = null; + String screenTitle; + + Icon icon; + switch (screen) { + case CONFIG: + + screenUI = new FaxToMailConfigUI(ui); + screenTitle = _("faxtomail.config.title"); + icon = ui.getMenuFileConfiguration().getIcon(); + break; + + case SEARCH: + screenUI = new SearchUI(ui); + screenTitle = _("faxtomail.search.title"); + icon = ui.getMenuFileConfiguration().getIcon(); + break; + + case DEMANDE: + screenUI = new DemandeUI(ui); + screenTitle = _("faxtomail.demande.title"); + icon = ui.getMenuFileConfiguration().getIcon(); + break; + + default: + case LIST: + screenUI = new DemandeListUI(ui); + screenTitle = _("faxtomail.demandeList.title"); + icon = ui.getMenuFileConfiguration().getIcon(); + break; + } + +// JButton showHelp = ui.getShowHelp(); +// if (rightDecoration == null) { +// rightDecoration = new JToolBar(); +// rightDecoration.setFloatable(false); +// rightDecoration.setOpaque(false); +// rightDecoration.setBorderPainted(false); +// } else { +// rightDecoration.remove(showHelp); +// } +// rightDecoration.add(showHelp, 0); + this.currentBody = screenUI; + context.getSwingSession().add(currentBody, true); + ui.getBody().setTitle(screenTitle); + ui.getBody().add(currentBody); + ui.getBody().setLeftDecoration(new JLabel(icon)); +// ui.getBody().setRightDecoration(rightDecoration); + // Fix #2510: [AIDE] perte de l'aide contextuelle sur ecran campagne + //FIXME tchemit-2013-05-28 Find out why +// ui.getBody().getRightDecoration().setVisible(true); + + } + } + + public void changeTitle() { + + String title = getSelectedCruiseTitle(); + + ui.setTitle(_("faxtomail.main.title.application", + getConfig().getVersion(), + title)); + } + + protected String getSelectedCruiseTitle() { + + + String title; + +// if (context.isDbLoaded()) { +// +// if (context.isProgramFilled()) { +// +// // selected program +// +// Program program = getDataContext().getProgram(); +// +// title = _("tutti.main.title.selectedProgram", program.getName()) + " / "; +// +// if (context.isCruiseFilled()) { +// +// // selected cruise +// Cruise cruise = getDataContext().getCruise(); +// +// if (cruise != null) { +// title += _("tutti.main.title.selectedCruise", cruise.getName()); +// } +// } else { +// +// // no selected cruise +// +// title += _("tutti.main.title.noSelectedCruise"); +// } +// +// } else { +// +// // no program selected (so neither cruise) +// +// title = _("tutti.main.title.noSelectedProgram"); +// +// } +// +// title += " / "; +// +// if (context.isProtocolFilled()) { +// +// // selected protocol +// TuttiProtocol protocol = getDataContext().getProtocol(); +// +// title += _("tutti.main.title.selectedProtocol", protocol.getName()); +// } else { +// +// // no selected protocol +// +// title += _("tutti.main.title.noSelectedProtocol"); +// } +// } else { + + // no db loaded + + title = _("faxtomail.main.title.nodb"); +// } + return title; + } + + public void setBodyTitle(String title) { + ui.getBody().setTitle(title); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ReloadFaxToMailAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ReloadFaxToMailAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ReloadFaxToMailAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,27 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.RunFaxToMail; + +import static org.nuiton.i18n.I18n._; + +/** + * To reload FaxToMail application. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.3 + */ +public class ReloadFaxToMailAction extends AbstractChangeScreenAction { + + public ReloadFaxToMailAction(MainUIHandler handler) { + super(handler, true, null); + setActionDescription(_("faxtomail.main.action.reloadFaxToMail")); + } + + @Override + public void doAction() throws Exception { + + // Close the application, will exit and restart application + RunFaxToMail.closeFaxToMail(getHandler(), RunFaxToMail.UPATE_EXIT_CODE); + } + +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowConfigAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowConfigAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowConfigAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,16 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; + +/** + * To show config screen. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ShowConfigAction extends AbstractChangeScreenAction { + + public ShowConfigAction(MainUIHandler handler) { + super(handler, true, FaxToMailScreen.CONFIG); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,16 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; + +/** + * To show demande screen. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ShowDemandeAction extends AbstractChangeScreenAction { + + public ShowDemandeAction(MainUIHandler handler) { + super(handler, true, FaxToMailScreen.DEMANDE); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeListAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeListAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowDemandeListAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,16 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; + +/** + * To show demande screen. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ShowDemandeListAction extends AbstractChangeScreenAction { + + public ShowDemandeListAction(MainUIHandler handler) { + super(handler, true, FaxToMailScreen.LIST); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowRechercheAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowRechercheAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/ShowRechercheAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,18 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailScreen; +import com.franciaflex.faxtomail.ui.swing.content.AbstractChangeScreenAction; +import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; + +/** + * To show demande screen. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ShowRechercheAction extends AbstractChangeScreenAction { + + public ShowRechercheAction(MainUIHandler handler) { + super(handler, true, FaxToMailScreen.SEARCH); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/StartAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/StartAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/StartAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,93 @@ +package com.franciaflex.faxtomail.ui.swing.content; + +import com.franciaflex.faxtomail.FaxToMailIOUtil; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; + +import static org.nuiton.i18n.I18n._; + +/** + * Start action (when the start action file is present when + * starting application). + * + * @author tchemit <chemit@codelutin.com> + * @since 2.4 + */ +public class StartAction extends AbstractMainUIFaxToMailAction { + + /** Logger. */ + private static final Log log = LogFactory.getLog(StartAction.class); + + protected AbstractMainUIFaxToMailAction delegateAction; + + public StartAction(MainUIHandler handler) { + super(handler, true); + } + + @Override + public boolean prepareAction() throws Exception { + + File actionfile = getConfig().getStartActionFile(); + boolean doAction = actionfile.exists(); + + if (doAction) { + + try { + // get action to execute + String content = FaxToMailIOUtil.readContent(actionfile, _("faxtomail.error.read.startActionFile", actionfile)); + content = content.trim(); + +// if (InstallDbAction.class.getName().equals(content)) { +// +// // install db +// delegateAction = TuttiActionHelper.createLogicAction(getHandler(), InstallDbAction.class); +// +// if (log.isInfoEnabled()) { +// log.info("Found install db action"); +// } +// } else if (content.startsWith(ImportDbAction.class.getName())) { +// +// // import db +// ImportDbAction action = TuttiActionHelper.createLogicAction(getHandler(), ImportDbAction.class); +// File importFile = new File(content.substring(ImportDbAction.class.getName().length() + 1)); +// action.setImportFile(importFile); +// delegateAction = action; +// if (log.isInfoEnabled()) { +// log.info("Found import db action (with file " + importFile + ")"); +// } +// } else { + doAction = false; +// } + + } finally { + + // delete start action file + FaxToMailIOUtil.deleteFile( + actionfile, + _("faxtomail.error.delete.startActionFile", actionfile)); + } + } + + + if (doAction) { + setActionDescription(delegateAction.getActionDescription()); + doAction = delegateAction.prepareAction(); + } + return doAction; + } + + @Override + public void doAction() throws Exception { + + FaxToMailActionHelper.runInternalAction(delegateAction); + } + + @Override + protected void releaseAction() { + delegateAction = null; + super.releaseAction(); + } +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,3 @@ +#configTopPanel { + _help: {"faxtomail.config.help"}; +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,35 @@ +<JPanel id='configTopPanel' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<FaxToMailUIContext, FaxToMailConfigUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + </import> + + <script><![CDATA[ + + protected FaxToMailUIContext uiContext; + + public FaxToMailConfigUI(FaxToMailUI parentUI) { + JAXXUtil.initContext(this, parentUI); + uiContext = parentUI.getHandler().getContext(); + FaxToMailConfigUIHandler handler = + new FaxToMailConfigUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <FaxToMailConfigUIHandler id='handler' + initializer='getContextValue(FaxToMailConfigUIHandler.class)'/> + + <FaxToMailUIContext id='model' + initializer='getContextValue(FaxToMailUIContext.class)'/> + + <!--<FaxToMailHelpBroker id='broker' constructorParams='"faxtomail.config.help"'/>--> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/config/FaxToMailConfigUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,193 @@ +package com.franciaflex.faxtomail.ui.swing.content.config; + +import com.franciaflex.faxtomail.service.config.FaxToMailServiceConfigOption; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfig; +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfigOption; +import com.franciaflex.faxtomail.ui.swing.content.GoToPreviousScreenAction; +import com.franciaflex.faxtomail.ui.swing.content.ReloadFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionHelper; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.config.ConfigUI; +import jaxx.runtime.swing.config.ConfigUIHelper; +import jaxx.runtime.swing.config.model.MainCallBackFinalizer; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.awt.*; + +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class FaxToMailConfigUIHandler extends AbstractFaxToMailUIHandler<FaxToMailUIContext, FaxToMailConfigUI> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FaxToMailConfigUIHandler.class); + + + public static final String CALLBACK_APPLICATION = "application"; + + public static final String CALLBACK_UI = "ui"; + + public static final String CALLBACK_SHORTCUT = "shortcut"; + + public FaxToMailConfigUIHandler(FaxToMailUI<?, ?> parentUI, FaxToMailConfigUI ui) { + super(parentUI.getHandler().getContext(), ui); + } + + @Override + public SwingValidator<FaxToMailUIContext> getValidator() { + return null; + } + + @Override + public void beforeInitUI() { + + } + + @Override + public void afterInitUI() { + + initUI(ui); + + FaxToMailApplicationConfig config = getConfig(); + + ConfigUIHelper helper = new ConfigUIHelper(config.getApplicationConfig(), + config.getConfigFile()); + + helper.registerCallBack( + CALLBACK_UI, n_("faxtomail.config.action.reload.ui"), + SwingUtil.createActionIcon("reload-ui"), + new Runnable() { + + @Override + public void run() { + reloadUI(); + } + } + ).registerCallBack( + CALLBACK_APPLICATION, n_("faxtomail.config.action.reload.application"), + SwingUtil.createActionIcon("reload-application"), + new Runnable() { + + @Override + public void run() { + reloadApplication(); + } + } + ).registerCallBack( + CALLBACK_SHORTCUT, n_("faxtomail.config.action.reload.actions"), + SwingUtil.createActionIcon("reload-shortcut"), + new Runnable() { + + @Override + public void run() { + reloadShortcuts(); + } + } + ); + + // Application category + + helper.addCategory(n_("faxtomail.config.category.applications"), + n_("faxtomail.config.category.applications.description"), + CALLBACK_APPLICATION) + .addOption(FaxToMailServiceConfigOption.CSV_SEPARATOR) + .setOptionShortLabel(_("faxtomail.config.option.csv.separator.shortLabel")) + + .addOption(FaxToMailApplicationConfigOption.UI_CONFIG_FILE) + .setOptionShortLabel(_("faxtomail.config.option.ui.config.file.shortLabel")); + + // UI category + + helper.addCategory(n_("faxtomail.config.category.ui"), + n_("faxtomail.config.category.ui.description"), + CALLBACK_UI) + .addOption(FaxToMailApplicationConfigOption.COLOR_ALTERNATE_ROW) + .setOptionShortLabel(_("faxtomail.config.option.ui.color.alternateRow.shortLabel")) + + .addOption(FaxToMailApplicationConfigOption.COLOR_SELECTED_ROW) + .setOptionShortLabel(_("faxtomail.config.option.ui.color.selectedRow.shortLabel")) + + .addOption(FaxToMailApplicationConfigOption.COLOR_BLOCKING_LAYER) + .setOptionShortLabel(_("faxtomail.config.option.ui.color.blockingLayer.shortLabel")) + + .addOption(FaxToMailApplicationConfigOption.DATE_FORMAT) + .setOptionShortLabel(_("faxtomail.config.option.ui.dateFormat.shortLabel")); + + // Technical category + + helper.addCategory(n_("faxtomail.config.category.technical"), + n_("faxtomail.config.category.technical.description")) + .addOption(FaxToMailServiceConfigOption.BASEDIR) + .setOptionShortLabel(_("faxtomail.config.option.basedir.shortLabel")) + + .addOption(FaxToMailServiceConfigOption.TMP_DIRECTORY) + .setOptionShortLabel(_("faxtomail.config.option.tmp.directory.shortLabel")) + + .addOption(FaxToMailApplicationConfigOption.FAXTOMAIL_I18N_DIRECTORY) + .setOptionShortLabel(_("faxtomail.config.option.i18n.directory.shortLabel")) + +// .addOption(FaxToMailApplicationConfigOption.FAXTOMAIL_HELP_DIRECTORY) +// .setOptionShortLabel(_("faxtomail.config.option.help.directory.shortLabel")) + + .addOption(FaxToMailServiceConfigOption.SITE_URL) + .setOptionShortLabel(_("faxtomail.config.option.site.url.shortLabel")); + + + helper.setFinalizer(new MainCallBackFinalizer(CALLBACK_APPLICATION)); + + helper.setCloseAction(new Runnable() { + @Override + public void run() { + + FaxToMailActionHelper.runInternalAction( + FaxToMailConfigUIHandler.this, + GoToPreviousScreenAction.class); + + } + }); + ConfigUI configUI = helper.buildUI( + getUI(), + n_("faxtomail.config.category.applications")); + + configUI.getHandler().setTopContainer(getUI()); + getUI().add(configUI, BorderLayout.CENTER); + } + + @Override + protected JComponent getComponentToFocus() { + return getUI(); + } + + @Override + public void onCloseUI() { + if (log.isDebugEnabled()) { + log.debug("closing: " + ui); + } + } + + protected void reloadApplication() { + ReloadFaxToMailAction action = FaxToMailActionHelper.createLogicAction(this, ReloadFaxToMailAction.class); + FaxToMailActionHelper.runAction(action); +// TuttiActionHelper.runActionAndWait(this, ReloadTuttiAction.class); + } + + protected void reloadUI() { + getContext().getMainUI().getHandler().reloadUI(); + } + + protected void reloadShortcuts() { + getContext().getMainUI().getHandler().reloadUI(); + } + +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,68 @@ +BeanFilterableComboBox { + showReset: true; + bean: {model}; +} + +JXDatePicker { + _selectOnFocus: {true}; +} + +JTextField { + _selectOnFocus: {true}; +} + +.between2ndPartLabel { + text: "faxtomail.search.between2ndPart.label"; +} + +#modifiedByLabel { + text: "faxtomail.search.modifiedBy.label"; +} + +#modifiedBetweenLabel { + text: "faxtomail.search.modifiedBetween.label"; +} + +#receivedBetweenLabel { + text: "faxtomail.search.receivedBetween.label"; +} + +#printedBetweenLabel { + text: "faxtomail.search.printedBetween.label"; +} + +#objectLabel { + text: "faxtomail.search.object.label"; +} + +#statusLabel { + text: "faxtomail.search.status.label"; +} + +#senderLabel { + text: "faxtomail.search.sender.label"; +} + +#docTypeLabel { + text: "faxtomail.search.docType.label"; +} + +#clientAccountLabel { + text: "faxtomail.search.clientAccount.label"; +} + +#refLabel { + text: "faxtomail.search.ref.label"; +} + +#commentLabel { + text: "faxtomail.search.comment.label"; +} + +#chantierLabel { + text: "faxtomail.search.chantier.label"; +} + +#searchButton { + text: "faxtomail.search.button.label" +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,54 @@ +<JPanel id='demandeListPanel' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeListUIModel, DemandeListUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.Label + + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox + + org.jdesktop.swingx.JXTable + </import> + + <script><![CDATA[ + + protected FaxToMailUIContext uiContext; + + public DemandeListUI(FaxToMailUI parentUI) { + JAXXUtil.initContext(this, parentUI); + uiContext = parentUI.getHandler().getContext(); + DemandeListUIHandler handler = + new DemandeListUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <DemandeListUIHandler id='handler' + initializer='getContextValue(DemandeListUIHandler.class)'/> + + <DemandeListUIModel id='model' + initializer='getContextValue(DemandeListUIModel.class)'/> + + <JSplitPane constraints='BorderLayout.CENTER'> + <JScrollPane> + <JTree id="navigationTree" + font-size='11' + rootVisible='false' + showsRootHandles='false'/> + </JScrollPane> + + <JPanel layout='{new BorderLayout()}'> + <JLabel id="selectedFolder" text="1 - Volets roulants" constraints='BorderLayout.NORTH'/> + <JScrollPane constraints='BorderLayout.CENTER'> + <JXTable id='dataTable' autoCreateRowSorter='true'/> + </JScrollPane> + </JPanel> + </JSplitPane> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,177 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +/* + * #%L + * Tutti :: UI + * $Id: EditCruiseUIHandler.java 1282 2013-10-07 14:46:55Z tchemit $ + * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java/... $ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.franciaflex.faxtomail.ui.swing.content.ShowDemandeAction; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionHelper; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXList; +import org.jdesktop.swingx.JXTable; + +import javax.swing.*; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import static org.nuiton.i18n.I18n._; + +/** + * Handler of UI {@link com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class DemandeListUIHandler extends AbstractFaxToMailUIHandler<DemandeListUIModel, DemandeListUI> implements CloseableUI { + + /** Logger. */ + private static final Log log = LogFactory.getLog(DemandeListUIHandler.class); + + + public static String getTitle(boolean exist) { + + String result; + if (exist) { + result = _("tutti.editCruise.title.edit.cruise"); + } else { + result = _("tutti.editCruise.title.create.cruise"); + } + return result; + } + + /** + * Persistence service. + * + * @since 0.1 + */ +// private final PersistenceService persistenceService; + + + public DemandeListUIHandler(FaxToMailUI parentUi, DemandeListUI ui) { + super(parentUi.getHandler().getContext(), ui); +// persistenceService = context.getPersistenceService(); + } + + + @Override + public void beforeInitUI() { + +// getDataContext().resetValidationDataContext(); + + } + + @Override + public void afterInitUI() { + + initUI(ui); + + DefaultMutableTreeNode root = new DefaultMutableTreeNode("root"); + + DefaultMutableTreeNode commandes = new DefaultMutableTreeNode("Commandes"); + commandes.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + commandes.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + + DefaultMutableTreeNode devis = new DefaultMutableTreeNode("Devis"); + devis.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + devis.add(new DefaultMutableTreeNode("FME - 1 - Volets roulants")); + + root.add(commandes); + root.add(devis); + + TreeModel treeModel = new DefaultTreeModel(root); + ui.getNavigationTree().setModel(treeModel); + + + String[][] data = new String[][] { + { "Sté 1", "Utilisateur 1", "Objet 1", "10/01/14 12:12" }, + { "Sté 2", "Utilisateur 2", "Objet 2", "13/01/14 12:12" }, + { "Sté 3", "Utilisateur 3", "Objet 3", "14/01/14 12:12" } + }; + String[] columns = new String[] { + "De", + "Nom TCC", + "Objet", + "Reçu le" + }; + TableModel tableModel = new DefaultTableModel(data, columns); + ui.getDataTable().setModel(tableModel); + ui.getDataTable().setEditable(false); + + ui.getDataTable().addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent evt) { + JXTable table = (JXTable) evt.getSource(); + if (evt.getClickCount() == 2) { + FaxToMailActionHelper.runAction(new ShowDemandeAction(getContext().getMainUI().getHandler())); + } + } + }); +// initBeanFilterableComboBox(ui.getModifiedByComboBox(), createLabelList("Utilisateur A", "Utilisateur B", "Utilisateur C"), null); +// initBeanFilterableComboBox(ui.getStatusComboBox(), createLabelList("Nouveau", "En cours", "Archivé"), null); +// initBeanFilterableComboBox(ui.getDocTypeComboBox(), createLabelList("Commande", "SAV"), null); + + } + + @Override + protected JComponent getComponentToFocus() { + return getUI().getNavigationTree(); + } + + @Override + public void onCloseUI() { + if (log.isDebugEnabled()) { + log.debug("closing: " + ui); + } + clearValidators(); + + } + + @Override + public boolean quitUI() { +// boolean result = quitScreen( +// getModel().isValid(), +// getModel().isModify(), +// _("tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise"), +// _("tutti.editCruise.askSaveBeforeLeaving.saveCruise"), +// ui.getSaveButton().getAction() +// ); +// return result; + return true; + } + + @Override + public SwingValidator<DemandeListUIModel> getValidator() { + return null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIModel.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,9 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class DemandeListUIModel { + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,77 @@ +BeanFilterableComboBox { + showReset: true; + bean: {model}; +} + +JXDatePicker { + _selectOnFocus: {true}; +} + +JTextField { + _selectOnFocus: {true}; +} + +#objectLabel { + text: "faxtomail.demande.object.label"; +} + +#receivedLabel { + text: "faxtomail.demande.received.label"; +} + +#tccLabel { + text: "faxtomail.demande.tcc.label"; +} + +#docTypeLabel { + text: "faxtomail.demande.docType.label"; +} + +#statusLabel { + text: "faxtomail.demande.status.label"; +} + +#priorityLabel { + text: "faxtomail.demande.priority.label"; +} + +#clientLabel { + text: "faxtomail.demande.client.label"; +} + +#demandeNumberLabel { + text: "faxtomail.demande.demandeNumber.label"; +} + +#refLabel { + text: "faxtomail.demande.ref.label"; +} + +#gammeLabel { + text: "faxtomail.demande.gamme.label"; +} + +#messageLabel { + text: "faxtomail.demande.message.label"; +} + +#backButton { + text: "faxtomail.demande.back.button.label"; + _tuttiAction: {com.franciaflex.faxtomail.ui.swing.content.ShowDemandeListAction.class}; +} + +#saveButton { + text: "faxtomail.demande.save.button.label"; +} + +#transmitButton { + text: "faxtomail.demande.transmit.button.label"; +} + +#printButton { + text: "faxtomail.demande.print.button.label"; +} + +#archiveButton { + text: "faxtomail.demande.archive.button.label"; +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,193 @@ +<JPanel id='demandePanel' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<DemandeUIModel, DemandeUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.Label + + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox + + org.jdesktop.swingx.JXDatePicker + org.jdesktop.swingx.JXTitledPanel + + java.text.SimpleDateFormat + java.util.Date + </import> + + <script><![CDATA[ + + protected FaxToMailUIContext uiContext; + + public DemandeUI(FaxToMailUI parentUI) { + JAXXUtil.initContext(this, parentUI); + uiContext = parentUI.getHandler().getContext(); + DemandeUIHandler handler = + new DemandeUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <DemandeUIHandler id='handler' + initializer='getContextValue(DemandeUIHandler.class)'/> + + <DemandeUIModel id='model' + initializer='getContextValue(DemandeUIModel.class)'/> + + <String id='patternLayout' javaBean='"dd/MM/yyyy HH:mm:ss"'/> + + <SimpleDateFormat id='dateFormat' constructorParams='patternLayout'/> + + <Date id='date' javaBean='new Date()'/> + + <JScrollPane id='demandeScrollPane' constraints='BorderLayout.CENTER'> + <JPanel layout='{new GridLayout(0,1)}'> + + <Table fill='both'> + <row> + <cell anchor='west'> + <JLabel id='objectLabel'/> + </cell> + <cell weightx='1' columns="3"> + <JTextField id='objectField'/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='receivedLabel'/> + </cell> + <cell weightx='1'> + <JAXXDatePicker id='receivedDatePicker' + date='{date}' + patternLayout='{patternLayout}'/> + </cell> + <cell> + <JLabel id='tccLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='tccField'/> + </cell> + </row> + + <row> + <cell anchor='west' columns='4'> + <JLabel text="Dernière modification par Utilisateur 1 le 14/01/2014 à 08:42"/> + </cell> + </row> + </Table> + + <Table> + <row> + <cell anchor='west'> + <JLabel id='docTypeLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='docTypeComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell anchor='west'> + <JLabel id='statusLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='statusComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell anchor='west'> + <JLabel id='priorityLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='priorityComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='clientLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='clientField'/> + </cell> + <cell anchor='west'> + <JLabel id='demandeNumberLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='demandeNumberField'/> + </cell> + <cell anchor='west'> + <JLabel id='refLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='refField'/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='gammeLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='gammeComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell anchor='west'> + <JLabel id='messageLabel'/> + </cell> + <cell weightx='3' columns='3'> + <JScrollPane id='commentPane'> + <JTextArea id='messageField'/> + </JScrollPane> + </cell> + </row> + + </Table> + + <JPanel id="attachmentsPanel" + border='{BorderFactory.createTitledBorder("Pièces jointes")}' + layout='{new GridLayout(0,1)}'> + <JPanel layout="{new java.awt.FlowLayout(java.awt.FlowLayout.LEADING)}"> + <JLabel text="Fax - TIF (25ko)"/> + <JButton text="Voir"/> + <JButton text="Editer"/> + <JButton text="Supprimer"/> + </JPanel> + <JPanel layout="{new java.awt.FlowLayout(java.awt.FlowLayout.LEADING)}"> + <JLabel text="Plans - DXF (254ko)"/> + <JButton text="Voir"/> + <JButton text="Supprimer"/> + </JPanel> + + <JButton text="Ajouter"/> + </JPanel> + + <JPanel id="faxInfoPanel" + border='{BorderFactory.createTitledBorder("Informations fax")}' + layout='{new GridLayout(0,1)}'> + <JLabel text="Télécopie reçue le 10/01/2014 à 13:37"/> + <JLabel text="Origine : 02 34 56 78 90"/> + <JLabel text="Nombre de pages : 1, durée : 13 secondes, vitesse : 31200"/> + <JLabel text="Numéro SDA : 6374"/> + </JPanel> + + </JPanel> + </JScrollPane> + + <JPanel constraints='BorderLayout.SOUTH'> + <JButton id="backButton"/> + <JButton id="saveButton"/> + <JButton id="transmitButton"/> + <JButton id="printButton"/> + <JButton id="archiveButton"/> + </JPanel> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,126 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +/* + * #%L + * Tutti :: UI + * $Id: EditCruiseUIHandler.java 1282 2013-10-07 14:46:55Z tchemit $ + * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java/... $ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.franciaflex.faxtomail.ui.swing.content.search.SearchUI; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; + +import static org.nuiton.i18n.I18n._; + +/** + * Handler of UI {@link DemandeUIHandler}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandeUI> implements CloseableUI { + + /** Logger. */ + private static final Log log = LogFactory.getLog(DemandeUIHandler.class); + + + public static String getTitle(boolean exist) { + + String result; + if (exist) { + result = _("tutti.editCruise.title.edit.cruise"); + } else { + result = _("tutti.editCruise.title.create.cruise"); + } + return result; + } + + /** + * Persistence service. + * + * @since 0.1 + */ +// private final PersistenceService persistenceService; + + + public DemandeUIHandler(FaxToMailUI parentUi, DemandeUI ui) { + super(parentUi.getHandler().getContext(), ui); +// persistenceService = context.getPersistenceService(); + } + + + @Override + public void beforeInitUI() { + +// getDataContext().resetValidationDataContext(); + + } + + @Override + public void afterInitUI() { + + initUI(ui); + + initBeanFilterableComboBox(ui.getDocTypeComboBox(), createLabelList("Commande", "SAV"), null); + initBeanFilterableComboBox(ui.getStatusComboBox(), createLabelList("Non traité", "En cours", "Clos"), null); + initBeanFilterableComboBox(ui.getPriorityComboBox(), createLabelList("Basse", "Normale", "Haute", "Urgente"), null); + initBeanFilterableComboBox(ui.getGammeComboBox(), createLabelList("FFE"), null); + + } + + @Override + protected JComponent getComponentToFocus() { + return getUI().getObjectField(); + } + + @Override + public void onCloseUI() { + if (log.isDebugEnabled()) { + log.debug("closing: " + ui); + } + clearValidators(); + + } + + @Override + public boolean quitUI() { +// boolean result = quitScreen( +// getModel().isValid(), +// getModel().isModify(), +// _("tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise"), +// _("tutti.editCruise.askSaveBeforeLeaving.saveCruise"), +// ui.getSaveButton().getAction() +// ); +// return result; + return true; + } + + @Override + public SwingValidator<DemandeUIModel> getValidator() { + return null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,9 @@ +package com.franciaflex.faxtomail.ui.swing.content.demande; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class DemandeUIModel { + +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,68 @@ +BeanFilterableComboBox { + showReset: true; + bean: {model}; +} + +JXDatePicker { + _selectOnFocus: {true}; +} + +JTextField { + _selectOnFocus: {true}; +} + +.between2ndPartLabel { + text: "faxtomail.search.between2ndPart.label"; +} + +#modifiedByLabel { + text: "faxtomail.search.modifiedBy.label"; +} + +#modifiedBetweenLabel { + text: "faxtomail.search.modifiedBetween.label"; +} + +#receivedBetweenLabel { + text: "faxtomail.search.receivedBetween.label"; +} + +#printedBetweenLabel { + text: "faxtomail.search.printedBetween.label"; +} + +#objectLabel { + text: "faxtomail.search.object.label"; +} + +#statusLabel { + text: "faxtomail.search.status.label"; +} + +#senderLabel { + text: "faxtomail.search.sender.label"; +} + +#docTypeLabel { + text: "faxtomail.search.docType.label"; +} + +#clientAccountLabel { + text: "faxtomail.search.clientAccount.label"; +} + +#refLabel { + text: "faxtomail.search.ref.label"; +} + +#commentLabel { + text: "faxtomail.search.comment.label"; +} + +#chantierLabel { + text: "faxtomail.search.chantier.label"; +} + +#searchButton { + text: "faxtomail.search.button.label" +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,217 @@ +<JPanel id='searchPanel' layout='{new BorderLayout()}' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<SearchUIModel, SearchUIHandler>'> + + <import> + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.util.Label + + jaxx.runtime.swing.editor.bean.BeanFilterableComboBox + + org.jdesktop.swingx.JXDatePicker + org.jdesktop.swingx.JXTitledPanel + </import> + + <script><![CDATA[ + + protected FaxToMailUIContext uiContext; + + public SearchUI(FaxToMailUI parentUI) { + JAXXUtil.initContext(this, parentUI); + uiContext = parentUI.getHandler().getContext(); + SearchUIHandler handler = + new SearchUIHandler(parentUI, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + <SearchUIHandler id='handler' + initializer='getContextValue(SearchUIHandler.class)'/> + + <SearchUIModel id='model' + initializer='getContextValue(SearchUIModel.class)'/> + + <JScrollPane id='searchScrollPane' constraints='BorderLayout.CENTER'> + <Table fill='both'> + + <row> + <cell anchor='west'> + <JLabel id='modifiedByLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='modifiedByComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='modifiedBetweenLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='modifiedBetweenStartDatePicker'/> + </cell> + <cell> + <JLabel styleClass='between2ndPartLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='modifiedBetweenEndDatePicker'/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='receivedBetweenLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='receivedBetweenStartDatePicker'/> + </cell> + <cell> + <JLabel styleClass='between2ndPartLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='receivedBetweenEndDatePicker'/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='printedBetweenLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='printedBetweenStartDatePicker'/> + </cell> + <cell> + <JLabel styleClass='between2ndPartLabel'/> + </cell> + <cell weightx='1'> + <JXDatePicker id='printedBetweenEndDatePicker'/> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='objectLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='objectField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='statusLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='statusComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='senderLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='senderField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='docTypeLabel'/> + </cell> + <cell weightx='1'> + <BeanFilterableComboBox id='docTypeComboBox' + constructorParams='this' + genericType="Label"/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='clientAccountLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='clientAccountField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='refLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='refField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='commentLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='commentField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + <row> + <cell anchor='west'> + <JLabel id='chantierLabel'/> + </cell> + <cell weightx='1'> + <JTextField id='chantierField'/> + </cell> + <cell> + </cell> + <cell weightx='1'> + </cell> + </row> + + </Table> + </JScrollPane> + + <JPanel constraints='BorderLayout.SOUTH'> + <JButton id="searchButton"/> + </JPanel> + +</JPanel> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,138 @@ +package com.franciaflex.faxtomail.ui.swing.content.search; + +/* + * #%L + * Tutti :: UI + * $Id: EditCruiseUIHandler.java 1282 2013-10-07 14:46:55Z tchemit $ + * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java/... $ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.CloseableUI; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.google.common.base.Predicate; +import com.google.common.collect.Lists; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.context.JAXXContextEntryDef; +import jaxx.runtime.swing.editor.bean.BeanDoubleListModel; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyAdapter; +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.util.List; +import java.util.Set; + +import static org.nuiton.i18n.I18n._; + +/** + * Handler of UI {@link SearchUIHandler}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class SearchUIHandler extends AbstractFaxToMailUIHandler<SearchUIModel, SearchUI> implements CloseableUI { + + /** Logger. */ + private static final Log log = LogFactory.getLog(SearchUIHandler.class); + + + public static String getTitle(boolean exist) { + + String result; + if (exist) { + result = _("tutti.editCruise.title.edit.cruise"); + } else { + result = _("tutti.editCruise.title.create.cruise"); + } + return result; + } + + /** + * Persistence service. + * + * @since 0.1 + */ +// private final PersistenceService persistenceService; + + + public SearchUIHandler(FaxToMailUI parentUi, SearchUI ui) { + super(parentUi.getHandler().getContext(), ui); +// persistenceService = context.getPersistenceService(); + } + + + @Override + public void beforeInitUI() { + +// getDataContext().resetValidationDataContext(); + + } + + @Override + public void afterInitUI() { + + initUI(ui); + + initBeanFilterableComboBox(ui.getModifiedByComboBox(), createLabelList("Utilisateur A", "Utilisateur B", "Utilisateur C"), null); + initBeanFilterableComboBox(ui.getStatusComboBox(), createLabelList("Nouveau", "En cours", "Archivé"), null); + initBeanFilterableComboBox(ui.getDocTypeComboBox(), createLabelList("Commande", "SAV"), null); + + } + + @Override + protected JComponent getComponentToFocus() { + return getUI().getModifiedByComboBox(); + } + + @Override + public void onCloseUI() { + if (log.isDebugEnabled()) { + log.debug("closing: " + ui); + } + clearValidators(); + + } + + @Override + public boolean quitUI() { +// boolean result = quitScreen( +// getModel().isValid(), +// getModel().isModify(), +// _("tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise"), +// _("tutti.editCruise.askSaveBeforeLeaving.saveCruise"), +// ui.getSaveButton().getAction() +// ); +// return result; + return true; + } + + @Override + public SwingValidator<SearchUIModel> getValidator() { + return null; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIModel.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,10 @@ +package com.franciaflex.faxtomail.ui.swing.content.search; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class SearchUIModel { + + +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,1127 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import com.franciaflex.faxtomail.service.DecoratorService; +import com.franciaflex.faxtomail.LabelAware; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfig; +import com.franciaflex.faxtomail.ui.swing.content.MainUI; +import com.franciaflex.faxtomail.ui.swing.content.MainUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionHelper; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionUI; +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.editor.FileEditor; +import jaxx.runtime.swing.editor.NumberEditor; +import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; +import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXDatePicker; +import org.jdesktop.swingx.JXTable; +import org.nuiton.decorator.Decorator; +import org.nuiton.decorator.JXPathDecorator; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.text.JTextComponent; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; +import java.awt.event.ItemEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; +import java.io.Serializable; +import java.text.ParseException; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import static org.nuiton.i18n.I18n._; + +/** + * Contract of any UI handler. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractFaxToMailUIHandler<M, UI extends FaxToMailUI<M, ?>> implements UIMessageNotifier { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractFaxToMailUIHandler.class); + + public abstract void beforeInitUI(); + + public abstract void afterInitUI(); + + public abstract void onCloseUI(); + + public abstract SwingValidator<M> getValidator(); + + /** + * Global application context. + * + * @since 0.1 + */ + protected final FaxToMailUIContext context; + + /** + * UI handled. + * + * @since 0.1 + */ + protected final UI ui; + + protected AbstractFaxToMailUIHandler(FaxToMailUIContext context, UI ui) { + this.context = context; + this.ui = ui; + } + + //------------------------------------------------------------------------// + //-- Public methods --// + //------------------------------------------------------------------------// + + public DefaultComboBoxModel newComboModel(Object... items) { + return new DefaultComboBoxModel(items); + } + + public final M getModel() { + return ui.getModel(); + } + + public final UI getUI() { + return ui; + } + + @Override + public void showInformationMessage(String message) { + context.showInformationMessage(message); + } + + public FaxToMailUIContext getContext() { + return context; + } + +// public FaxToMailDataContext getDataContext() { +// return getContext().getDataContext(); +// } + + public FaxToMailApplicationConfig getConfig() { + return context.getConfig(); + } + + public void setText(KeyEvent event, String property) { + JTextComponent field = (JTextComponent) event.getSource(); + String value = field.getText(); + FaxToMailUIUtil.setProperty(getModel(), property, value); + } + + public void setFile(ActionEvent event, String property) { + FileEditor field = (FileEditor) event.getSource(); + File value = field.getSelectedFile(); + FaxToMailUIUtil.setProperty(getModel(), property, value); + } + + public void setBoolean(ItemEvent event, String property) { + boolean value = event.getStateChange() == ItemEvent.SELECTED; + FaxToMailUIUtil.setProperty(getModel(), property, value); + } + + public void setDate(ActionEvent event, String property) { + JXDatePicker field = (JXDatePicker) event.getSource(); + Date value = field.getDate(); + FaxToMailUIUtil.setProperty(getModel(), property, value); + } + +// public void selectListData(ListSelectionEvent event, String property) { +// if (!event.getValueIsAdjusting()) { +// JList list = (JList) event.getSource(); +// ListSelectionModel selectionModel = list.getSelectionModel(); +// +// selectionModel.setValueIsAdjusting(true); +// try { +// List selectedList = Lists.newLinkedList(); +// +// for (int index : list.getSelectedIndices()) { +// Object o = list.getModel().getElementAt(index); +// selectedList.add(o); +// } +// TuttiUIUtil.setProperty(getModel(), property, selectedList); +// } finally { +// selectionModel.setValueIsAdjusting(false); +// } +// } +// } + + public void openDialog(FaxToMailUI dialogContent, + String title, Dimension dim) { + Component topestUI = getTopestUI(); + + JDialog result; + if (topestUI instanceof Frame) { + result = new JDialog((Frame) topestUI, title, true); + } else { + result = new JDialog((Dialog) topestUI, title, true); + } + + result.add((Component) dialogContent); + result.setResizable(true); + + result.setSize(dim); + + final AbstractFaxToMailUIHandler handler = dialogContent.getHandler(); + + if (handler instanceof Cancelable) { + + // add a auto-close action + JRootPane rootPane = result.getRootPane(); + + KeyStroke shortcutClosePopup = getConfig().getShortcutClosePopup(); + + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( + shortcutClosePopup, "close"); + rootPane.getActionMap().put("close", new AbstractAction() { + private static final long serialVersionUID = 1L; + + @Override + public void actionPerformed(ActionEvent e) { + ((Cancelable) handler).cancel(); + } + }); + } + + result.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosed(WindowEvent e) { + Component ui = (Component) e.getSource(); + if (log.isDebugEnabled()) { + log.debug("Destroy ui " + ui); + } + JAXXUtil.destroy(ui); + } + }); + SwingUtil.center(getContext().getMainUI(), result); + result.setVisible(true); + } + + public void closeDialog(FaxToMailUI ui) { + SwingUtil.getParentContainer(ui, JDialog.class).setVisible(false); + } + + public static final String CONFIRMATION_FORMAT = "<html>%s<hr/><br/>%s</html>"; + + public int askSaveBeforeLeaving(String message) { + String htmlMessage = String.format( + CONFIRMATION_FORMAT, + message, + _("faxtomail.common.askSaveBeforeLeaving.help")); + int result = JOptionPane.showConfirmDialog( + getTopestUI(), + htmlMessage, + _("faxtomail.common.askSaveBeforeLeaving.title"), + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + return result; + } + + public boolean askCancelEditBeforeLeaving(String message) { + String htmlMessage = String.format( + CONFIRMATION_FORMAT, + message, + _("faxtomail.common.askCancelEditBeforeLeaving.help")); + int i = JOptionPane.showConfirmDialog( + getTopestUI(), + htmlMessage, + _("faxtomail.common.askCancelEditBeforeLeaving.title"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + + boolean result = i == JOptionPane.OK_OPTION; + return result; + } + + public void showSuccessMessage(String title, String message) { + + Component topestUI = getTopestUI(); + boolean alwaysOnTop = false; + + if (topestUI instanceof JDialog) { + alwaysOnTop = ((JDialog) topestUI).isAlwaysOnTop(); + } + + if (alwaysOnTop) { + ((JDialog) topestUI).setAlwaysOnTop(false); + } + try { + + JOptionPane.showMessageDialog( + topestUI, + message, + title, + JOptionPane.INFORMATION_MESSAGE, + UIManager.getIcon("info") + ); + } finally { + if (alwaysOnTop) { + ((JDialog) topestUI).setAlwaysOnTop(true); + } + } + } + + public Component getTopestUI() { + Component result; + FaxToMailActionUI actionUI = getContext().getActionUI(); + if (actionUI.isVisible()) { + result = actionUI; + } else { + result = getContext().getMainUI(); + } + return result; + } + + public void clearValidators() { + MainUI main = context.getMainUI(); + Preconditions.checkNotNull( + main, "No mainUI registred in application context"); + MainUIHandler handler = main.getHandler(); + handler.clearValidators(); + } + + public <O> Decorator<O> getDecorator(Class<O> type, String name) { + DecoratorService decoratorService = + context.getDecoratorService(); + + Preconditions.checkNotNull(type); + + Decorator decorator = decoratorService.getDecoratorByType(type, name); + if (decorator == null) { + + if (LabelAware.class.isAssignableFrom(type)) { + decorator = getDecorator(LabelAware.class, null); + } + } + Preconditions.checkNotNull(decorator); + return decorator; + } + + public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) { + + boolean rightClick = SwingUtilities.isRightMouseButton(e); + + if (rightClick || SwingUtilities.isLeftMouseButton(e)) { + + // get the coordinates of the mouse click + Point p = e.getPoint(); + + JXTable source = (JXTable) e.getSource(); + + int[] selectedRows = source.getSelectedRows(); + int[] selectedColumns = source.getSelectedColumns(); + + // get the row index at this point + int rowIndex = source.rowAtPoint(p); + + // get the column index at this point + int columnIndex = source.columnAtPoint(p); + + if (log.isDebugEnabled()) { + log.debug("At point [" + p + "] found Row " + rowIndex + ", Column " + columnIndex); + } + + boolean canContinue = true; + + if (source.isEditing()) { + + // stop editing + boolean stopEdit = source.getCellEditor().stopCellEditing(); + if (!stopEdit) { + if (log.isWarnEnabled()) { + log.warn("Could not stop edit cell..."); + } + canContinue = false; + } + } + + if (canContinue) { + + // select row (could empty selection) + if (rowIndex == -1) { + source.clearSelection(); + } else if (!ArrayUtils.contains(selectedRows, rowIndex)) { + if (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION == source.getSelectionMode()) { + // add to selection + source.addRowSelectionInterval(rowIndex, rowIndex); + } else { + // set selection + source.setRowSelectionInterval(rowIndex, rowIndex); + } + } + + // select column (could empty selection) + if (columnIndex == -1) { + source.clearSelection(); + } else if (!ArrayUtils.contains(selectedColumns, columnIndex)) { + source.setColumnSelectionInterval(columnIndex, columnIndex); + } + + if (rightClick) { + + // use now model coordinate + int modelRowIndex = source.convertRowIndexToModel(rowIndex); + int modelColumnIndex = source.convertColumnIndexToModel(columnIndex); + +// beforeOpenPopup(modelRowIndex, modelColumnIndex); + + // on right click show popup + popup.show(source, e.getX(), e.getY()); + } + } + } + } + + public void openRowMenu(KeyEvent e, JPopupMenu popup) { + + if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) { + + JXTable source = (JXTable) e.getSource(); + + // get the lowest selected row + int[] selectedRows = source.getSelectedRows(); + int lowestRow = -1; + for (int row : selectedRows) { + lowestRow = Math.max(lowestRow, row); + } + // get the selected column + int selectedColumn = source.getSelectedColumn(); + Rectangle r = source.getCellRect(lowestRow, selectedColumn, true); + + // get the point in the middle lower of the cell + Point p = new Point(r.x + r.width / 2, r.y + r.height); + + if (log.isDebugEnabled()) { + log.debug("Row " + lowestRow + " found t point [" + p + "]"); + } + + boolean canContinue = true; + + if (source.isEditing()) { + + // stop editing + boolean stopEdit = source.getCellEditor().stopCellEditing(); + if (!stopEdit) { + if (log.isWarnEnabled()) { + log.warn("Could not stop edit cell..."); + } + canContinue = false; + } + } + + if (canContinue) { + + // use now model coordinate + int rowIndex = source.convertRowIndexToModel(lowestRow); + int columnIndex = source.convertColumnIndexToModel(selectedColumn); +// beforeOpenPopup(rowIndex, columnIndex); + + popup.show(source, p.x, p.y); + } + } + } + + //------------------------------------------------------------------------// + //-- Init methods --// + //------------------------------------------------------------------------// + + protected void initUI(FaxToMailUI ui) { + + for (Map.Entry<String, Object> entry : ui.get$objectMap().entrySet()) { + Object component = entry.getValue(); + if (component instanceof NumberEditor) { + + initNumberEditor((NumberEditor) component); + } else if (component instanceof JXDatePicker) { + + initDatePicker((JXDatePicker) component); + } else if (component instanceof JLabel) { + + initLabel((JLabel) component); + } else if (component instanceof JTextField) { + + initTextField((JTextField) component); + } else if (component instanceof AbstractButton) { + + initButton((AbstractButton) component); + } else if (component instanceof JScrollPane) { + + initScrollPane((JScrollPane) component); + } + } + + ((Component) ui).addHierarchyListener(new HierarchyListener() { + @Override + public void hierarchyChanged(HierarchyEvent e) { + JComponent component = getComponentToFocus(); + if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0 + && e.getChanged().isShowing() + && component != null) { + component.requestFocus(); + } + } + }); + } + + protected abstract JComponent getComponentToFocus(); + + protected void initTextField(JTextField jTextField) { + Boolean computed = (Boolean) jTextField.getClientProperty("computed"); + if (computed != null && computed) { + Font font = jTextField.getFont().deriveFont(Font.ITALIC); + jTextField.setFont(font); + jTextField.setEditable(false); + jTextField.setEnabled(false); +// jTextField.setDisabledTextColor(getConfig().getColorComputedWeights()); + } + if (isAutoSelectOnFocus(jTextField)) { + addAutoSelectOnFocus(jTextField); + } + } + + protected void initLabel(JLabel jLabel) { + Boolean strongStyle = (Boolean) jLabel.getClientProperty("strongStyle"); + Boolean italicStyle = (Boolean) jLabel.getClientProperty("italicStyle"); + Font font = jLabel.getFont(); + int style = font.getStyle(); + if (strongStyle != null && strongStyle) { + style |= Font.BOLD; + } + if (italicStyle != null && italicStyle) { + style |= Font.ITALIC; + } + jLabel.setFont(font.deriveFont(style)); + + } + +// protected void initButtonAttachment(ButtonAttachment component) { +// +// component.init(); +// } + + protected void initButton(AbstractButton abstractButton) { + + Class actionName = (Class) abstractButton.getClientProperty("tuttiAction"); + if (actionName != null) { + Action action = FaxToMailActionHelper.createUIAction(this, abstractButton, actionName); + abstractButton.setAction(action); + } + } + + /** + * Prépare un component de choix d'entités pour un type d'entité donné et + * pour un service de persistance donné. + * + * @param comboBox le component graphique à initialiser + */ + protected <E extends Serializable> void initBeanFilterableComboBox( + BeanFilterableComboBox<E> comboBox, + List<E> data, + E selectedData) { + + initBeanFilterableComboBox(comboBox, data, selectedData, null); + } + + protected <E extends Serializable> void initBeanFilterableComboBox( + BeanFilterableComboBox<E> comboBox, + List<E> data, + E selectedData, + String decoratorContext) { + + Preconditions.checkNotNull(comboBox, "No comboBox!"); + + Class<E> beanType = comboBox.getBeanType(); + + Preconditions.checkNotNull(beanType, "No beanType on the combobox!"); + Decorator<E> decorator = getDecorator(beanType, decoratorContext);; + + if (data == null) { + data = Lists.newArrayList(); + } + + if (log.isDebugEnabled()) { + log.debug("entity comboBox list [" + beanType.getName() + "] : " + + (data == null ? 0 : data.size())); + } + + comboBox.setI18nPrefix("tutti.property."); + + // add data list to combo box + comboBox.init((JXPathDecorator<E>) decorator, data); + + comboBox.setSelectedItem(selectedData); + + if (log.isDebugEnabled()) { + log.debug("combo [" + beanType.getName() + "] : " + + comboBox.getData().size()); + } + } + + /** + * Prépare un component de choix d'entités pour un type d'entité donné et + * pour un service de persistance donné. + * + * @param list le component graphique à initialiser + * @param data la liste des données à mettre dans la liste de gauche + * @param selectedData la liste des données à mettre dans la liste de droite + */ +// protected <E extends TuttiEntity> void initBeanList( +// BeanDoubleList<E> list, +// List<E> data, +// List<E> selectedData, +// Decorator<E> selectedDecorator) { +// +// Preconditions.checkNotNull(list, "No list!"); +// +// Class<E> beanType = list.getBeanType(); +// Preconditions.checkNotNull(beanType, "No beanType on the double list!"); +// +// DecoratorService decoratorService = +// context.getDecoratorService(); +// Decorator<E> decorator = decoratorService.getDecoratorByType(beanType); +// +// if (log.isDebugEnabled()) { +// log.debug("entity list [" + beanType.getName() + "] : " + +// (data == null ? 0 : data.size())); +// } +// +// list.setI18nPrefix("tutti.property."); +// +// // add data list to combo box +// list.init((JXPathDecorator<E>) decorator, +// (JXPathDecorator<E>) selectedDecorator, +// data, +// selectedData); +// +// if (log.isDebugEnabled()) { +// log.debug("Jlist [" + beanType.getName() + "] : " + +// list.getUniverseList().getModel().getSize()); +// } +// } + + /** + * Prépare un component de choix d'entités pour un type d'entité donné et + * pour un service de persistance donné. + * + * @param list le component graphique à initialiser + * @param data la liste des données à mettre dans la liste de gauche + * @param selectedData la liste des données à mettre dans la liste de droite + */ +// protected <E extends TuttiEntity> void initBeanList( +// BeanDoubleList<E> list, +// List<E> data, +// List<E> selectedData) { +// +// initBeanList(list, data, selectedData, null); +// } + + protected void initNumberEditor(NumberEditor editor) { + if (log.isDebugEnabled()) { + log.debug("init number editor " + editor.getName()); + } + editor.init(); + + // Force binding if value is already in model + Number model = editor.getModel(); + if (model != null) { + editor.setModel(null); + editor.setModel(model); + } + + if (isAutoSelectOnFocus(editor)) { + + addAutoSelectOnFocus(editor.getTextField()); + } + } + +// protected void initTimeEditor(SimpleTimeEditor editor) { +// if (log.isDebugEnabled()) { +// log.debug("init time editor " + editor.getName() + +// " for property " + editor.getModel().getProperty()); +// } +// editor.init(); +// +// if (isAutoSelectOnFocus(editor)) { +// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getHour().getEditor()).getTextField()); +// addAutoSelectOnFocus(((JSpinner.DefaultEditor) editor.getMinute().getEditor()).getTextField()); +// } +// } + +// protected void initCoordinateDMSEditor(DmsCoordinateEditor editor) { +// editor.init(); +// } + +// protected void initCoordinateDMDEditor(DmdCoordinateEditor editor) { +// editor.init(); +// } + + protected void initDatePicker(final JXDatePicker picker) { + + if (log.isDebugEnabled()) { + log.debug("disable JXDatePicker editor" + picker.getName()); + } + String dateFormat = getConfig().getDateFormat(); + picker.setFormats(dateFormat); + picker.setToolTipText(_("faxtomail.common.datefield.tip", dateFormat)); + picker.getEditor().addFocusListener(new FocusAdapter() { + + @Override + public void focusLost(FocusEvent e) { + try { + picker.commitEdit(); + + } catch (ParseException ex) { + if (log.isDebugEnabled()) { + log.debug("format error", ex); + } + picker.requestFocus(); + } + } + }); + + if (isAutoSelectOnFocus(picker)) { + addAutoSelectOnFocus(picker.getEditor()); + } + } + + protected void initScrollPane(JScrollPane scrollPane) { + Boolean onlyVerticalScrollable = (Boolean) scrollPane.getClientProperty("onlyVerticalScrollable"); + if (onlyVerticalScrollable != null && onlyVerticalScrollable) { + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + + final JViewport viewport = scrollPane.getViewport(); + viewport.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + Dimension newDimension = new Dimension(viewport.getExtentSize().width, + viewport.getViewSize().height); + viewport.setViewSize(newDimension); + } + }); + } + } + + protected boolean isAutoSelectOnFocus(JComponent comp) { + Object selectOnFocus = comp.getClientProperty("selectOnFocus"); + return selectOnFocus != null && Boolean.valueOf(selectOnFocus.toString()); + } + + protected void addAutoSelectOnFocus(JTextField jTextField) { + jTextField.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(final FocusEvent e) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JTextField source = (JTextField) e.getSource(); + source.selectAll(); + } + }); + + } + }); + } + + //------------------------------------------------------------------------// + //-- Internal methods --// + //------------------------------------------------------------------------// + + protected boolean quitScreen(boolean modelIsValid, + boolean modelIsModify, + String askGiveUpMessage, + String askSaveMessage, + Action saveAction) { + boolean result; + + if (!modelIsValid) { + + // model is not valid + // ask user to qui or not + result = askCancelEditBeforeLeaving(askGiveUpMessage); + + } else if (modelIsModify) { + + // something is modify ask user what to do + int answer = askSaveBeforeLeaving(askSaveMessage); + switch (answer) { + case JOptionPane.YES_OPTION: + + // ok save + saveAction.actionPerformed(null); + result = true; + break; + case JOptionPane.NO_OPTION: + + // do not save but can still quit the screen (so nothing to do) + result = true; + break; + default: + // do not save and stay here (so nothing to do) + result = false; + + } + } else { + + // model is valid and not modify, can safely quit screen + result = true; + } + return result; + } + + protected void registerValidators(SwingValidator... validators) { + MainUI main = context.getMainUI(); + Preconditions.checkNotNull( + main, "No mainUI registred in application context"); + MainUIHandler handler = main.getHandler(); + handler.clearValidators(); + for (SwingValidator validator : validators) { + handler.registerValidator(validator); + } + } + + protected String decorate(Object object) { + return decorate(object, null); + } + + protected String decorate(Object object, String context) { + String result = ""; + if (object != null) { + result = getDecorator(object.getClass(), context).toString(object); + } + return result; + } + +// protected <O> ListCellRenderer newListCellRender(Class<O> type) { +// +// return newListCellRender(type, null); +// } + +// protected <O> ListCellRenderer newListCellRender(Class<O> type, String name) { + +// Decorator<O> decorator = getDecorator(type, name); +// return newListCellRender(decorator); +// } + + protected <O> ListCellRenderer newListCellRender(Decorator<O> decorator) { + + Preconditions.checkNotNull(decorator); + + ListCellRenderer result = new DecoratorListCellRenderer(decorator); + return result; + } + +// protected void listenValidatorValid(SimpleBeanValidator validator, +// final AbstractTuttiBeanUIModel model) { +// validator.addPropertyChangeListener(SimpleBeanValidator.VALID_PROPERTY, new PropertyChangeListener() { +// @Override +// public void propertyChange(PropertyChangeEvent evt) { +// if (log.isDebugEnabled()) { +// log.debug("Model [" + model + +// "] pass to valid state [" + +// evt.getNewValue() + "]"); +// } +// model.setValid((Boolean) evt.getNewValue()); +// } +// }); +// } + +// protected void listenValidationTableHasNoFatalError(final SimpleBeanValidator validator, +// final AbstractTuttiBeanUIModel model) { +// getContext().getMainUI().getValidatorMessageWidget().addTableModelListener(new TableModelListener() { +// @Override +// public void tableChanged(TableModelEvent e) { +// boolean valid = !validator.hasFatalErrors(); +// if (log.isDebugEnabled()) { +// log.debug("Model [" + model + +// "] pass to valid state [" + valid + "]"); +// } +// model.setValid(valid); +// } +// }); +// } +// +// protected void listModelIsModify(AbstractTuttiBeanUIModel model) { +// model.addPropertyChangeListener(new PropertyChangeListener() { +// +// final Set<String> excludeProperties = getPropertiesToIgnore(); +// +// @Override +// public void propertyChange(PropertyChangeEvent evt) { +// if (!excludeProperties.contains(evt.getPropertyName())) { +// ((AbstractTuttiBeanUIModel) evt.getSource()).setModify(true); +// } +// } +// }); +// } + +// protected Set<String> getPropertiesToIgnore() { +// return Sets.newHashSet( +// AbstractTuttiBeanUIModel.PROPERTY_MODIFY, +// AbstractTuttiBeanUIModel.PROPERTY_VALID); +// } + + protected void closeUI(FaxToMailUI ui) { + ui.getHandler().onCloseUI(); + } + + protected <B> void changeValidatorContext(String newContext, + SwingValidator<B> validator) { + B bean = validator.getBean(); + validator.setContext(newContext); + validator.setBean(bean); + } + +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model, +// TableCellEditor editor, +// TableCellRenderer renderer, +// ColumnIdentifier<R> identifier) { +// +// return addColumnToModel(model, editor, renderer, identifier, null); +// } +// +// +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model, +// TableCellEditor editor, +// TableCellRenderer renderer, +// ColumnIdentifier<R> identifier, +// WeightUnit weightUnit) { +// +// TableColumnExt col = new TableColumnExt(model.getColumnCount()); +// col.setCellEditor(editor); +// col.setCellRenderer(renderer); +// String label = _(identifier.getHeaderI18nKey()); +// if (weightUnit != null) { +// label = weightUnit.decorateLabel(label); +// } +// col.setHeaderValue(label); +// String tip = _(identifier.getHeaderTipI18nKey()); +// if (weightUnit != null) { +// tip = weightUnit.decorateTip(tip); +// } +// col.setToolTipText(tip); +// +// col.setIdentifier(identifier); +// model.addColumn(col); +// // by default no column is sortable, must specify it +// col.setSortable(false); +// return col; +// } + +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier) { +// +// return addColumnToModel(model, null, null, identifier, null); +// } +// +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addFloatColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier, +// String numberPattern, +// JTable table) { +// +// NumberCellEditor<Float> editor = +// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false); +// editor.getNumberEditor().setSelectAllTextOnError(true); +// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); +// editor.getNumberEditor().setNumberPattern(numberPattern); +// +// TableCellRenderer renderer = +// newNumberCellRenderer(table.getDefaultRenderer(Number.class)); +// +// return addColumnToModel(model, editor, renderer, identifier, null); +// } +// +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addFloatColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier, +// WeightUnit weightUnit, +// JTable table) { +// +// Preconditions.checkNotNull(weightUnit); +// NumberCellEditor<Float> editor = +// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false); +// editor.getNumberEditor().setSelectAllTextOnError(true); +// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); +// editor.getNumberEditor().setNumberPattern(weightUnit.getNumberEditorPattern()); +// +// TableCellRenderer renderer = +// newNumberCellRenderer(table.getDefaultRenderer(Number.class)); +// +// return addColumnToModel(model, editor, renderer, identifier, weightUnit); +// } +// +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addIntegerColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier, +// String numberPattern, +// JTable table) { +// +// NumberCellEditor<Integer> editor = +// JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false); +// editor.getNumberEditor().setSelectAllTextOnError(true); +// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2)); +// editor.getNumberEditor().setNumberPattern(numberPattern); +// +// TableCellRenderer renderer = newNumberCellRenderer(table.getDefaultRenderer(Number.class)); +// return addColumnToModel(model, editor, renderer, identifier, null); +// } +// +// +// TableCellRenderer newNumberCellRenderer(final TableCellRenderer defaultRenderer) { +// TableCellRenderer result = new TableCellRenderer() { +// @Override +// public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { +// Component result = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); +// if (result instanceof JLabel) { +// JLabel jLabel = (JLabel) result; +// jLabel.setHorizontalTextPosition(SwingConstants.RIGHT); +// +// } +// return result; +// } +// }; +// return result; +// } +// +// +// protected <R extends AbstractTuttiBeanUIModel> TableColumnExt addBooleanColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier, +// JTable table) { +// +// return addColumnToModel(model, +// table.getDefaultEditor(Boolean.class), +// table.getDefaultRenderer(Boolean.class), +// identifier, +// null); +// } +// +// protected <R extends AbstractTuttiBeanUIModel, B> TableColumnExt addComboDataColumnToModel(TableColumnModel model, +// ColumnIdentifier<R> identifier, +// Decorator<B> decorator, +// List<B> data) { +// JComboBox comboBox = new JComboBox(); +// comboBox.setRenderer(newListCellRender(decorator)); +// +// List<B> dataToList = Lists.newArrayList(data); +// +// // add a null value at first position +// if (!dataToList.isEmpty() && dataToList.get(0) != null) { +// dataToList.add(0, null); +// } +// SwingUtil.fillComboBox(comboBox, dataToList, null); +// +// ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator); +// BeanUIUtil.decorate(comboBox, converter); +// ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox); +// +// return addColumnToModel(model, +// editor, +// newTableCellRender(decorator), +// identifier, +// null); +// } +// +// protected <O> TableCellRenderer newTableCellRender(Class<O> type) { +// +// return newTableCellRender(type, null); +// } +// +// protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) { +// +// Decorator<O> decorator = getDecorator(type, name); +// +// TableCellRenderer result = newTableCellRender(decorator); +// return result; +// } +// +// protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) { +// +// Preconditions.checkNotNull(decorator); +// +// DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true); +// return result; +// } +// +// /** +// * Hook to prepare popup just before showing it. +// * <p/> +// * The right place to update actions accessibility; a quite better design +// * than trying to update each time something change in the table... +// * +// * @param rowIndex selected row index (or lowest selected one) +// * @param columnIndex selected column index +// * @since 2.6 +// */ +// protected void beforeOpenPopup(int rowIndex, int columnIndex) { +// +// } +// +// protected String buildReminderLabelTitle(Species species, +// Iterable<SampleCategory<?>> categories, +// String prefix, +// String suffix) { +// return buildReminderLabelTitle( +// decorate(species), +// categories, +// prefix, +// suffix); +// +// } +// +// protected String buildReminderLabelTitle(String species, +// Iterable<SampleCategory<?>> categories, +// String prefix, +// String suffix) { +// StringBuilder title = new StringBuilder(prefix); +// +// title.append(" - [").append(species).append("]"); +// +// if (categories != null) { +// for (SampleCategory<?> sampleCategory : categories) { +// if (sampleCategory.getCategoryValue() != null) { +// title.append(" - "); +// title.append(decorate(sampleCategory.getCategoryValue())); +// } +// } +// } +// +// title.append(" - ").append(suffix); +// return title.toString(); +// } +// +// protected void incrementsMessage(String message) { +// +// TuttiActionUI actionUI = context.getActionUI(); +// if (actionUI != null) { +// ProgressionModel progressionModel = actionUI.getModel().getProgressionModel(); +// if (progressionModel != null) +// +// progressionModel.increments(message); +// } +// } + + protected List<Label> createLabelList(String... labels) { + List<Label> labelList = Lists.newArrayList(); + for (String label : labels) { + labelList.add(new Label(label)); + } + return labelList; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Cancelable.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Cancelable.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Cancelable.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,12 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +/** + * To cancel contract. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.3 + */ +public interface Cancelable { + + void cancel(); +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CloseableUI.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CloseableUI.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/CloseableUI.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,18 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +/** + * Contract to close an ui. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.2 + */ +public interface CloseableUI { + + /** + * Try to quit UI. + * + * @return {@code true} if ui is safe to quit, {@code false} otherwise + * (means must stay on it). + */ + boolean quitUI(); +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailErrorHelper.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailErrorHelper.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailErrorHelper.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,88 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import org.jdesktop.swingx.JXErrorPane; +import org.jdesktop.swingx.error.ErrorInfo; +import org.jdesktop.swingx.error.ErrorReporter; +import org.nuiton.csv.ImportRuntimeException; + +import javax.swing.*; + +import static org.nuiton.i18n.I18n._; + +/** + * helper around errors in FaxToMail. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class FaxToMailErrorHelper implements ErrorReporter { + + protected FaxToMailUIContext context; + + public FaxToMailErrorHelper(FaxToMailUIContext context) { + this.context = context; + } + + /** + * Display a user friendly error frame. + * + * @param message message for user + * @param cause exception cause + */ + public void showErrorDialog(String message, Throwable cause) { + + if (cause == null) { + JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + message + "</body></html>", + _("faxtomail.error.ui.business.error"), + JOptionPane.ERROR_MESSAGE); +// } else if (cause instanceof FaxToMailBusinessException) { +// JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + cause.getMessage() + "</body></html>", +// _("tutti.error.ui.business.error"), +// JOptionPane.ERROR_MESSAGE); + } else if (cause instanceof ImportRuntimeException) { + JOptionPane.showMessageDialog(context.getMainUI(), cause.getMessage(), + _("faxtomail.error.ui.business.error"), + JOptionPane.ERROR_MESSAGE); + } else { + + JXErrorPane pane = new JXErrorPane(); + ErrorInfo info = new ErrorInfo(_("faxtomail.error.ui.other.error"), + _("faxtomail.error.errorpane.htmlmessage", message), null, null, + cause, null, null); + pane.setErrorInfo(info); + pane.setErrorReporter(this); + JXErrorPane.showDialog(context.getActionUI(), pane); + } + + } + + /** + * Display a user friendly error frame. + * + * @param message message for user + */ + public void showErrorDialog(String message) { + showErrorDialog(message, null); + } + + @Override + public void reportError(ErrorInfo errorInfo) throws NullPointerException { + + showErrorDialog(errorInfo.getBasicErrorMessage(), errorInfo.getErrorException()); + } + + /** + * Display a user friendly warning frame. + * + * @param message message for user + */ + public void showWarningDialog(String message) { + + JOptionPane.showMessageDialog(context.getMainUI(), "<html><body>" + message + "</body></html>", + _("faxtomail.error.ui.business.warning"), + JOptionPane.WARNING_MESSAGE); + + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailExceptionHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,81 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.content.AbstractChangeScreenAction; +import com.franciaflex.faxtomail.ui.swing.util.action.AbstractFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.util.action.FaxToMailActionException; +import jaxx.runtime.swing.JAXXRuntimeException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * FaxToMail global exception handler. + * <p/> + * Catch all application uncaught and display it in a custom JoptionPane + * or JXErrorPane. + * <p/> + * See http://stackoverflow.com/a/4448569/1165234 for details. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class FaxToMailExceptionHandler implements Thread.UncaughtExceptionHandler { + + private static final Log log = + LogFactory.getLog(FaxToMailExceptionHandler.class); + + @Override + public void uncaughtException(Thread t, Throwable ex) { + handleException(t.getName(), ex); + } + + public void handle(Throwable thrown) { + // for EDT exceptions + handleException(Thread.currentThread().getName(), thrown); + } + + protected void handleException(String tname, Throwable ex) { + if (log.isErrorEnabled()) { + log.error("Global application exception [" + tname + "]", ex); + } + + Throwable cause = ex; + + if (cause instanceof FaxToMailTechnicalException) { + cause = cause.getCause(); + } + + if (cause instanceof JAXXRuntimeException) { + cause = cause.getCause(); + } + + boolean backToScreen = false; + + AbstractFaxToMailAction action = null; + + if (cause instanceof FaxToMailActionException) { + + FaxToMailActionException actionException = (FaxToMailActionException) cause; + cause = cause.getCause(); + + if (log.isDebugEnabled()) { + log.debug("Action error cause:", cause); + } + + action = actionException.getAction(); + + if (action instanceof AbstractChangeScreenAction) { + backToScreen = true; + } + } + + FaxToMailUIContext.getErrorHelper().showErrorDialog(cause.getMessage(), cause); + + if (backToScreen) { + +// action.getContext().setFallBackScreen(); + } + } + +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUI.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,103 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import jaxx.runtime.JAXXObject; + +import javax.swing.UIManager; +import java.awt.Font; + +/** + * Contract to place on each generated jaxx ui. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public interface FaxToMailUI<M, H extends AbstractFaxToMailUIHandler<M, ?>> extends JAXXObject { + + M getModel(); + + H getHandler(); + + /** + * Pattern to use for short numeric values in editors with max 1 digits. + * + * @since 0.2 + */ + public static final String INT_1_DIGITS_PATTERN = "\\d{0,1}"; + + /** + * Pattern to use for short numeric values in editors with max 2 digits. + * + * @since 0.1 + */ + public static final String INT_2_DIGITS_PATTERN = "\\d{0,2}"; + + /** + * Pattern to use for signed numeric values in editors with max 2 digits. + * + * @since 1.0 + */ + public static final String SIGNED_INT_2_DIGITS_PATTERN = "-?\\d{0,2}"; + + /** + * Pattern to use for short numeric values in editors with max 3 digits. + * + * @since 0.1 + */ + public static final String INT_3_DIGITS_PATTERN = "\\d{0,3}"; + + /** + * Pattern to use for singed numeric values in editors with max 3 digits. + * + * @since 1.0 + */ + public static final String SIGNED_INT_3_DIGITS_PATTERN = "-?\\d{0,3}"; + + /** + * Pattern to use for short numeric values in editors with max 4 digits. + * + * @since 0.2 + */ + public static final String INT_4_DIGITS_PATTERN = "\\d{0,4}"; + + /** + * Pattern to use for integer numeric values in editors with max 6 digits. + * + * @since 0.1 + */ + public static final String INT_6_DIGITS_PATTERN = "\\d{0,6}"; + + /** + * Pattern to use for integer numeric values in editors with max 7 digits. + * + * @since 0.1 + */ + public static final String INT_7_DIGITS_PATTERN = "\\d{0,7}"; + + /** + * Pattern to use for decimal numeric values with 2 decimal digits in + * editors. + * + * @since 0.1 + */ + public static final String DECIMAL2_PATTERN = "\\d{0,6}(\\.\\d{0,2})?"; + + /** + * Pattern to use for decimal numeric values with 3 decimal digits in + * editors. + * + * @since 0.1 + */ + public static final String DECIMAL3_PATTERN = "\\d{0,6}(\\.\\d{0,3})?"; + + /** + * Pattern to use for decimal numeric values with 2 digits + 3 decimal digits in + * editors. + * + * @since 1.0 + */ + public static final String DECIMAL2_DIGITS_PATTERN = "\\d{0,2}(\\.\\d*)?"; + + public static final Font TEXTFIELD_NORMAL_FONT = UIManager.getDefaults().getFont("TextField.font"); + + public static final Font TEXTFIELD_COMPUTED_FONT = UIManager.getDefaults().getFont("TextField.font").deriveFont(Font.ITALIC); +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,273 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +/* + * #%L + * Tutti :: UI + * $Id: TuttiUIUtil.java 1298 2013-10-14 18:30:59Z tchemit $ + * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java/... $ + * %% + * Copyright (C) 2012 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import com.google.common.base.Preconditions; +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; + +import javax.swing.*; +import javax.swing.table.JTableHeader; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; + +import static org.nuiton.i18n.I18n._; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public final class FaxToMailUIUtil { + + /** Logger. */ + private static final Log log = LogFactory.getLog(FaxToMailUIUtil.class); + + private FaxToMailUIUtil() { + // never instanciate util class + } + + public static void setProperty(Object bean, String property, Object value) { + Preconditions.checkNotNull(bean); + Preconditions.checkNotNull(property); + try { + PropertyUtils.setSimpleProperty(bean, property, value); + } catch (Exception e) { + throw new FaxToMailTechnicalException(_("faxtomail.property.set.error", property, bean.getClass().getName()), e); + } + } + + public static Object getProperty(Object bean, String property) { + Preconditions.checkNotNull(bean); + Preconditions.checkNotNull(property); + try { + return PropertyUtils.getSimpleProperty(bean, property); + } catch (Exception e) { + throw new FaxToMailTechnicalException(_("faxtomail.property.get.error", property, bean.getClass().getName()), e); + } + } + + private static DecimalFormatSymbols symbols; + + public static DecimalFormatSymbols getDecimalFormatSymbols() { + if (symbols == null) { + symbols = new DecimalFormatSymbols(); + symbols.setDecimalSeparator('.'); + symbols.setGroupingSeparator(' '); + } + return symbols; + } + + private static DecimalFormat decimalFormat; + + public static DecimalFormat getDecimalFormat(int minDecimal, int maxDecimal) { + if (decimalFormat == null) { + decimalFormat = new DecimalFormat(); + decimalFormat.setDecimalFormatSymbols(getDecimalFormatSymbols()); + decimalFormat.setGroupingUsed(false); + } + decimalFormat.setMinimumFractionDigits(minDecimal); + decimalFormat.setMaximumFractionDigits(maxDecimal); + return decimalFormat; + } + + public static void openLink(URL url) { + try { + openLink(url.toURI()); + } catch (URISyntaxException e) { + throw new FaxToMailTechnicalException(_("swing.error.cannot.open.link", url), e); + } + } + + public static Desktop getDesktopForBrowse() { + + if (!Desktop.isDesktopSupported()) { + throw new FaxToMailTechnicalException( + _("swing.error.desktop.not.supported")); + } + + Desktop desktop = Desktop.getDesktop(); + + if (!desktop.isSupported(Desktop.Action.BROWSE)) { + + throw new FaxToMailTechnicalException( + _("swing.error.desktop.browse.not.supported")); + } + + return desktop; + } + + public static void openLink(URI uri) { + + Desktop desktop = getDesktopForBrowse(); + + try { + + desktop.browse(uri); + } catch (Exception e) { + + throw new FaxToMailTechnicalException( + _("swing.error.cannot.open.link", uri), e); + } + } + + public static Desktop getDesktopForMail() { + + if (!Desktop.isDesktopSupported()) { + throw new FaxToMailTechnicalException( + _("swing.error.desktop.not.supported")); + } + + Desktop desktop = Desktop.getDesktop(); + + if (!desktop.isSupported(Desktop.Action.MAIL)) { + + throw new FaxToMailTechnicalException( + _("swing.error.desktop.mail.not.supported")); + } + + return desktop; + } + + public static void mail(String subject, String body) { + + Desktop desktop = getDesktopForMail(); + + try { + URI mailtoURI = new URI("mailto", null, null, "subject=" + subject + "&body=" + body, null); + desktop.mail(mailtoURI); + + } catch (Exception e) { + + throw new FaxToMailTechnicalException( + _("swing.error.cannot.mail"), e); + } + } + + public static void selectFirstCellOnFirstRowAndStopEditing(JXTable table) { + + // select first cell + doSelectCell(table, 0, 0); + + if (table.isEditing()) { + + // but no edit it + table.getCellEditor().stopCellEditing(); + } + } + + public static void selectFirstCellOnLastRow(JXTable table) { + + // select first cell + doSelectCell(table, table.getRowCount() - 1, 0); + } + + public static void selectFirstCellOnRow(JXTable table, int row, boolean stopEdit) { + + // select first cell + doSelectCell(table, row, 0); + + if (stopEdit && table.isEditing()) { + + table.getCellEditor().stopCellEditing(); + } + } + + public static void doSelectCell(JTable table, + int rowIndex, + int columnIndex) { + + int rowCount = table.getRowCount(); + if (rowCount == 0) { + + // no row, can not selected any cell + if (log.isWarnEnabled()) { + log.warn("No row in table, can not select any cell"); + } + return; + } + int columnCount = table.getColumnCount(); + if (columnCount == 0) { + + // no column, can not selected any cell + if (log.isWarnEnabled()) { + log.warn("No column in table, can not select any cell"); + } + return; + } + if (columnIndex > columnCount) { + if (log.isWarnEnabled()) { + log.warn(String.format("ColumnIndex: %s is more than columnCount %s", columnIndex, columnCount)); + } + columnIndex = columnCount - 1; + } + if (columnIndex < 0) { + columnIndex = 0; + } + if (rowIndex >= rowCount) { + if (log.isWarnEnabled()) { + log.warn(String.format("RowIndex: %s is more than rowCount %s", rowIndex, rowCount)); + } + rowIndex = rowCount - 1; + } + if (rowIndex < 0) { + rowIndex = 0; + } + + table.setColumnSelectionInterval(columnIndex, columnIndex); + table.setRowSelectionInterval(rowIndex, rowIndex); + table.editCellAt(rowIndex, columnIndex); + } + + protected static class ShowSpeciesDecoratorPopupListener extends MouseAdapter { + + private final JPopupMenu popup; + + public ShowSpeciesDecoratorPopupListener(JPopupMenu popup) { + this.popup = popup; + } + + @Override + public void mouseClicked(MouseEvent e) { + JTableHeader source = (JTableHeader) e.getSource(); + Point point = e.getPoint(); + int columnIndex = source.columnAtPoint(point); + + boolean rightClick = SwingUtilities.isRightMouseButton(e); + if (columnIndex == 0 && rightClick) { + e.consume(); + popup.show(source, e.getX(), e.getY()); + } + } + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/Label.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,21 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import com.franciaflex.faxtomail.LabelAware; + +/** + * @author kmorin <kmorin@codelutin.com> + * @since x.x + */ +public class Label implements LabelAware { + + String label; + + public Label(String label) { + this.label = label; + } + + @Override + public String getLabel() { + return label; + } +} \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/RemoveablePropertyChangeListener.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,13 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +import java.beans.PropertyChangeListener; + +/** + * Use this contract when you want the listener to be removed when closing an ui. + * <p/> + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.3 + */ +public abstract class RemoveablePropertyChangeListener implements PropertyChangeListener { +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/UIMessageNotifier.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,12 @@ +package com.franciaflex.faxtomail.ui.swing.util; + +/** + * To notify somemessage in ui. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.3 + */ +public interface UIMessageNotifier { + + void showInformationMessage(String message); +} Property changes on: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/AbstractFaxToMailAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/AbstractFaxToMailAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/AbstractFaxToMailAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,334 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import com.franciaflex.faxtomail.persistence.ProgressionModel; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfig; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; +import com.google.common.base.Preconditions; +import jaxx.runtime.FileChooserUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.beans.AbstractBean; +import org.nuiton.decorator.Decorator; + +import javax.swing.*; +import java.io.File; + +import static org.nuiton.i18n.I18n._; + +/** + * FaxToMail base action. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public abstract class AbstractFaxToMailAction<M extends AbstractBean, UI extends FaxToMailUI<M, ?>, H extends AbstractFaxToMailUIHandler<M, UI>> + extends AbstractBean { + + /** Logger. */ + private static final Log log = LogFactory.getLog(AbstractFaxToMailAction.class); + + public static final String PROPERTY_DONE = "done"; + + protected final H handler; + + protected String actionDescription; + + protected final boolean hideBody; + + protected final Object lock = new Object(); + + public abstract void doAction() throws Exception; + + protected AbstractFaxToMailAction(H handler, boolean hideBody) { + this.handler = handler; + this.hideBody = hideBody; + } + + public boolean prepareAction() throws Exception { + // by default nothing to prepare + return true; + } + + protected void releaseAction() { + // by default nothing to clean + firePropertyChange(PROPERTY_DONE, null, true); + } + + public void postSuccessAction() { + // by default nothing to do after action + } + + public void postFailedAction(Throwable error) { + // by default nothing to do after action + } + + public H getHandler() { + return handler; + } + + public M getModel() { + return handler.getModel(); + } + + public final UI getUI() { + return handler.getUI(); + } + + public FaxToMailUIContext getContext() { + return handler.getContext(); + } + + public String getActionDescription() { + return actionDescription; + } + + public void setActionDescription(String actionDescription) { + this.actionDescription = actionDescription; + } + + public void setProgressionModel(ProgressionModel progressionModel) { + getContext().getActionUI().getModel().setProgressionModel(progressionModel); + } + + protected ProgressionModel getProgressionModel() { + return getContext().getActionUI().getModel().getProgressionModel(); + } + + public boolean isHideBody() { + return hideBody; + } + +// public TuttiDataContext getDataContext() { +// return getContext().getDataContext(); +// } + + protected FaxToMailApplicationConfig getConfig() { + return getContext().getConfig(); + } + + protected void sendMessage(String message) { + getContext().showInformationMessage(message); + } + + protected <O> Decorator<O> getDecorator(Class<O> type, String name) { + Decorator<O> decorator = handler.getDecorator(type, name); + Preconditions.checkNotNull(decorator); + return decorator; + } + + protected String decorate(Object object) { + return getDecorator(object.getClass(), null).toString(object); + } + + protected String decorate(Object object, String context) { + return getDecorator(object.getClass(), context).toString(object); + } + +// protected boolean askAdminPassword(String askMessage, +// String askMessageTitle, +// String errorMessage, +// String errorMessageTitle) { +// +// Component container = getContext().getActionUI(); +// +// String answer; +// boolean result; +// do { +// answer = JOptionPane.showInputDialog(container, +// askMessage, +// askMessageTitle, +// JOptionPane.WARNING_MESSAGE); +// if (answer != null) { +// String cryptedAnswer = StringUtil.encodeMD5(answer); +// String correctAnswer = getConfig().getAdminPassword(); +// result = StringUtils.equals(cryptedAnswer, correctAnswer); +// +// if (!result) { +// JOptionPane.showMessageDialog(container, +// errorMessage, +// errorMessageTitle, +// JOptionPane.ERROR_MESSAGE); +// } +// +// } else { +// result = false; +// } +// +// } while (!result && answer != null); +// return result; +// } + + /** + * Choisir un fichier via un sélecteur graphique de fichiers. + * + * @param title le titre du dialogue de sélection + * @param buttonLabel le label du boutton d'acceptation + * @param filters les filtres + descriptions sur le sélecteur de + * fichiers + * @return le fichier choisi ou le fichier incoming si l'opération a été + * annulée + */ + protected File chooseFile(String title, + String buttonLabel, + String... filters) { + + File file = FileChooserUtil.getFile(title, + buttonLabel, + getContext().getMainUI(), + filters); + if (log.isDebugEnabled()) { + log.debug(title + " : " + file); + } + if (file != null) { + File newDir = file.isDirectory() ? file : file.getParentFile(); + FileChooserUtil.setCurrentDirectory(newDir); + } + return file; + } + + /** + * Sauver un fichier via un sélecteur graphique de fichiers. + * + * @param title le titre du dialogue de sélection + * @param buttonLabel le label du boutton d'acceptation + * @param filters les filtres + descriptions sur le sélecteur de + * fichiers + * @return le fichier choisi ou {@code null} si pas de fichier choisi ou + * pas voulu écrasé un fichier existant. + */ + protected File saveFile(File defaultFile, + String filename, + String extension, + String title, + String buttonLabel, + String... filters) { + + if (defaultFile != null && FileChooserUtil.isCurrentDirectoryDefault()) { + + // set default directory to this one + FileChooserUtil.setCurrentDirectory(defaultFile); + } + File file = saveFile(filename, extension, title, buttonLabel, filters); + return file; + } + + /** + * Sauver un fichier via un sélecteur graphique de fichiers. + * + * @param title le titre du dialogue de sélection + * @param buttonLabel le label du boutton d'acceptation + * @param filters les filtres + descriptions sur le sélecteur de + * fichiers + * @return le fichier choisi ou {@code null} si pas de fichier choisi ou + * pas voulu écrasé un fichier existant. + */ + protected File saveFile(String filename, + String extension, + String title, + String buttonLabel, + String... filters) { + + boolean withExtension = StringUtils.isNotBlank(extension); + String filenameSuffix = withExtension ? "." + extension : ""; + File file = FileChooserUtil.saveFile(filename + filenameSuffix, title, buttonLabel, getContext().getMainUI(), filters); + if (log.isDebugEnabled()) { + log.debug(title + " : " + file); + } + if (file != null) { + Preconditions.checkState(!file.isDirectory()); + + // add extension if missing + if (withExtension && !file.getName().endsWith(filenameSuffix)) { + file = new File(file.getParentFile(), file.getName() + filenameSuffix); + } + + // ask user to confirm overwrite. + boolean confirm = askOverwriteFile(file); + + if (confirm) { + + // on conserve le répertoire (pour une prochaine utilisation) + FileChooserUtil.setCurrentDirectory(file.getParentFile()); + } else { + + // l'utilisateur n'a pas confirmé l'écrasement + // donc pas de fichier en retour + file = null; + } + } + + return file; + } + + protected boolean askOverwriteFile(File file) { + boolean result; + if (file.exists()) { + + // file exists ask user to overwrite + String htmlMessage = String.format( + AbstractFaxToMailUIHandler.CONFIRMATION_FORMAT, + _("faxtomail.common.askOverwriteFile.message", file), + _("faxtomail.common.askOverwriteFile.help")); + + result = JOptionPane.showConfirmDialog( + getHandler().getTopestUI(), + htmlMessage, + _("faxtomail.common.askOverwriteFile.title"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } else { + + // file does not exist + result = true; + } + return result; + } + + protected boolean askBeforeDelete(String title, String message) { + String htmlMessage = String.format( + AbstractFaxToMailUIHandler.CONFIRMATION_FORMAT, + message, + _("faxtomail.common.askBeforeDelete.help")); + int i = JOptionPane.showConfirmDialog( + getHandler().getTopestUI(), + htmlMessage, + title, + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + + boolean result = i == JOptionPane.OK_OPTION; + return result; + } + + protected void displayInfoMessage(String title, String message) { + JOptionPane.showMessageDialog( + getHandler().getTopestUI(), + message, + title, + JOptionPane.INFORMATION_MESSAGE); + } + + protected void displayWarningMessage(String title, String message) { + JOptionPane.showMessageDialog( + getHandler().getTopestUI(), + message, + title, + JOptionPane.WARNING_MESSAGE); + } + + protected void createProgressionModelIfRequired(int total) { + ProgressionModel progressionModel = getProgressionModel(); + if (progressionModel==null) { + progressionModel = new ProgressionModel(); + progressionModel.setTotal(total); + progressionModel.setMessage(""); + progressionModel.setCurrent(0); + setProgressionModel(progressionModel); + } else { + progressionModel.adaptTotal(total); + } + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionException.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionException.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionException.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,34 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +/** + * To box any error of a {@link AbstractFaxToMailAction}. + * + * @author kmorin + * @since 0.1 + */ +public class FaxToMailActionException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private final AbstractFaxToMailAction action; + + public FaxToMailActionException(AbstractFaxToMailAction action, Throwable cause) { + super(cause); + this.action = action; + } + + public static FaxToMailActionException propagateError(AbstractFaxToMailAction action, + Throwable cause) { + FaxToMailActionException result; + if (cause instanceof FaxToMailActionException) { + result = ((FaxToMailActionException) cause); + } else { + result = new FaxToMailActionException(action, cause); + } + return result; + } + + public AbstractFaxToMailAction getAction() { + return action; + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionHelper.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionHelper.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionHelper.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,123 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import com.franciaflex.faxtomail.FaxToMailTechnicalException; +import com.franciaflex.faxtomail.ui.swing.content.AbstractMainUIFaxToMailAction; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import com.google.common.base.Preconditions; +import org.apache.commons.lang3.reflect.ConstructorUtils; + +import javax.swing.*; + +import static org.nuiton.i18n.I18n._; + +/** + * Useful method around FaxToMailUIAction. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2 + */ +public class FaxToMailActionHelper { + + public static <A extends AbstractFaxToMailAction> void runInternalAction(A action) { + Throwable error = null; + + try { + action.doAction(); + action.postSuccessAction(); + } catch (Throwable e) { + error = e; + throw FaxToMailActionException.propagateError(action, e); + } finally { + try { + if (error != null) { + action.postFailedAction(error); + } + } finally { + + action.releaseAction(); + } + } + } + + public static <A extends AbstractFaxToMailAction> void runInternalAction(AbstractFaxToMailUIHandler handler, + Class<A> actionName) { + A action = createLogicAction(handler, actionName); + runInternalAction(action); + } + + public static <A extends AbstractFaxToMailAction> void runAction(A action) { + FaxToMailUIAction<A> uiAction = createUIAction(null, action); + uiAction.actionPerformed(null); + } + + public static void runAction(AbstractButton button) { + button.getAction().actionPerformed(null); + } + + public static <A extends AbstractFaxToMailAction> void runActionAndWait(A action) { + FaxToMailUIAction<A> uiAction = createUIAction(null, action); + uiAction.launchActionAndWait(); + } + + public static <A extends AbstractFaxToMailAction> void runActionAndWait(AbstractFaxToMailUIHandler handler, + Class<A> actionName) { + A logicAction = createLogicAction(handler, actionName); + runActionAndWait(logicAction); + } + + public static <A extends AbstractFaxToMailAction> FaxToMailUIAction<A> createUIAction(AbstractFaxToMailUIHandler handler, + Class<A> actionName) { + return createUIAction(handler, null, actionName); + } + + + public static <A extends AbstractFaxToMailAction> FaxToMailUIAction<A> createUIAction(AbstractFaxToMailUIHandler handler, + AbstractButton abstractButton, + Class<A> actionName) { + try { + + // create logic action + A logicAction = createLogicAction(handler, actionName); + + // create ui action + FaxToMailUIAction<A> result = createUIAction(abstractButton, logicAction); + return result; + } catch (Exception e) { +// throw new FaxToMailTechnicalException(_("tutti.action.create.error", actionName), e); + } + return null; + } + + public static <A extends AbstractFaxToMailAction> FaxToMailUIAction<A> createUIAction(AbstractButton abstractButton, + A logicAction) { + + // create ui action + FaxToMailUIAction<A> result = new FaxToMailUIAction<A>(abstractButton, + logicAction); + return result; + } + + public static <A extends AbstractFaxToMailAction> A createLogicAction(AbstractFaxToMailUIHandler handler, + Class<A> actionName) { + try { + + if (AbstractMainUIFaxToMailAction.class.isAssignableFrom(actionName) && + handler.getContext().getMainUI() != null) { + handler = handler.getContext().getMainUI().getHandler(); + } + + // create action + A result = ConstructorUtils.invokeConstructor(actionName, handler); + return result; + } catch (Exception e) { + throw new FaxToMailTechnicalException(_("faxtomail.action.create.error", actionName), e); + } + } + + public static <A extends AbstractFaxToMailAction> A getLogicAction(AbstractButton b) { + Action action = b.getAction(); + Preconditions.checkNotNull(action); + Preconditions.checkState(action instanceof FaxToMailUIAction); + return ((FaxToMailUIAction<A>) action).getLogicAction(); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionSwingWorker.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionSwingWorker.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionSwingWorker.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,161 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Timer; +import java.util.TimerTask; + +/** + * Worker to execute logic action. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.3 + */ +public class FaxToMailActionSwingWorker<A extends AbstractFaxToMailAction> extends SwingWorker<Void, String> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FaxToMailActionSwingWorker.class); + + /** + * Timer used to launch timerTask (to open load dialog). + * + * @since 1.0.2 + */ + private static final Timer t = new Timer(); + + protected final FaxToMailActionUI actionUI; + + protected final A action; + + protected Throwable error; + + protected TimerTask timer; + + protected FaxToMailActionSwingWorker(A action) { + + this.action = action; + this.actionUI = action.getContext().getActionUI(); + } + + public Throwable getError() { + return error; + } + + public boolean isFailed() { + return error != null; + } + + @Override + protected Void doInBackground() throws Exception { + + if (!isCancelled()) { + + timer = new FaxToMailActionTimerTask(); + + t.schedule(timer, 1000); + + try { + + action.doAction(); + + } catch (Throwable e) { + if (log.isErrorEnabled()) { + log.error("Task [" + this + "] Error while doAction: ", e); + } + error = e; + } finally { + if (log.isDebugEnabled()) { + log.debug("Task [" + this + "] done"); + } + } + } + return null; + } + + @Override + protected void done() { + super.done(); + + if (log.isDebugEnabled()) { + log.debug("Task [" + this + "] execute done method after all"); + } + + if (error == null) { + + // success hook + action.postSuccessAction(); + } else { + + // fail hook + action.postFailedAction(error); + } + + action.releaseAction(); + + if (timer != null) { + + timer.cancel(); + } + + actionUI.close(); + + updateBusyState(false); + } + + protected void updateBusyState(boolean busy) { + + boolean hideBody = action.isHideBody(); + + action.getContext().setBusy(busy); + + if (hideBody) { + action.getContext().setHideBody(!busy); + } + + } + + protected class FaxToMailActionTimerTask extends TimerTask { + + public FaxToMailActionTimerTask() { + action.addPropertyChangeListener(AbstractFaxToMailAction.PROPERTY_DONE, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + + if (actionUI.isVisible()) { + actionUI.close(); + } + + // we do NOT want the timer to wake up then the actionUI dialog + cancel(); + } + }); + } + + @Override + public void run() { + if (isCancelled() || isDone()) { + + if (log.isDebugEnabled()) { + log.debug("Task [" + action + "] was already canceled or done, do nothing"); + } + } else { + + if (log.isDebugEnabled()) { + log.debug("Task [" + action + "] is started, show waiting dialog"); + } + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + actionUI.open(action); + } + }); + } + } + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.css =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.css (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.css 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,45 @@ + +#busyBlockLayerUI { + useIcon:false; + blockingColor: {handler.getConfig().getColorBlockingLayer()}; + block:{true}; +} + +#globalPanel { + border: {new TitledBorder((String) null)}; +} + +#globalActionLabel { + border: {new EmptyBorder(5, 5, 5, 5)}; +} + +#globalProgressBar { + indeterminate: true; +} + +#taskPanel { + visible: false; + border: {new TitledBorder((String) null)}; +} + +#taskProgressBar { + indeterminate: false; +} + +#taskActionLabel { + border: {new EmptyBorder(5, 5, 5, 5)}; +} + +#informationPanel { + visible: false; + border: {new TitledBorder((String) null)}; +} + +#informationLabel { + border: {new EmptyBorder(5, 5, 5, 5)}; +} + +#okAction { + actionIcon: information; + text: "faxtomail.action.ok"; +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.jaxx =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.jaxx (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUI.jaxx 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,59 @@ +<JDialog width='300' height='200' modal='true' + undecorated='true' + implements='com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI<FaxToMailActionUIModel, FaxToMailActionUIHandler>'> + <import> + + com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI + com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext + + jaxx.runtime.swing.BlockingLayerUI + + javax.swing.border.EmptyBorder + </import> + + <script><![CDATA[ + + public FaxToMailActionUI(JFrame frame, FaxToMailUIContext context) { + super(frame, true); + FaxToMailActionUIHandler handler = new FaxToMailActionUIHandler(context, this); + setContextValue(handler); + handler.beforeInitUI(); + } + + public void open(AbstractFaxToMailAction action) { + getModel().setAction(action); + } + + public void close() { + getModel().clear(); + } + + protected void $afterCompleteSetup() { + handler.afterInitUI(); + } + ]]></script> + + + <BlockingLayerUI id='busyBlockLayerUI'/> + + <FaxToMailActionUIHandler id='handler' + initializer='getContextValue(FaxToMailActionUIHandler.class)'/> + + <FaxToMailActionUIModel id='model' + initializer='getContextValue(FaxToMailActionUIModel.class)'/> + + <JPanel id='rootPanel' layout='{new BorderLayout()}' + constraints='BorderLayout.CENTER' decorator='boxed'> + <JPanel id='globalPanel' constraints='BorderLayout.NORTH' + layout='{new BorderLayout()}'> + <JLabel id='globalActionLabel' constraints='BorderLayout.CENTER'/> + <JProgressBar id='globalProgressBar' constraints='BorderLayout.SOUTH'/> + </JPanel> + <JPanel id='taskPanel' constraints='BorderLayout.CENTER' + layout='{new BorderLayout()}'> + <JLabel id='taskActionLabel' constraints='BorderLayout.CENTER'/> + <JProgressBar id='taskProgressBar' constraints='BorderLayout.SOUTH'/> + </JPanel> + </JPanel> + +</JDialog> \ No newline at end of file Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIHandler.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIHandler.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIHandler.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,250 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import com.franciaflex.faxtomail.persistence.ProgressionModel; +import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; +import com.franciaflex.faxtomail.ui.swing.content.MainUI; +import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.StatusMessagePanel; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import static org.nuiton.i18n.I18n._; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class FaxToMailActionUIHandler extends AbstractFaxToMailUIHandler<FaxToMailActionUIModel, FaxToMailActionUI> { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(FaxToMailActionUIHandler.class); + + public FaxToMailActionUIHandler(FaxToMailUIContext context, FaxToMailActionUI ui) { + super(context, ui); + } + + protected PropertyChangeListener progressionListener = new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + + String propertyName = evt.getPropertyName(); + if (ProgressionModel.PROPERTY_MESSAGE.equals(propertyName)) { + + // change message + String newMessage = (String) evt.getNewValue(); + ui.getTaskActionLabel().setText("<html><body>" + newMessage + "</body></html>"); + ui.pack(); + } else if (ProgressionModel.PROPERTY_TOTAL.equals(propertyName)) { + + // change total progressbar max + ui.getTaskProgressBar().setMaximum((Integer) evt.getNewValue()); + + } else if (ProgressionModel.PROPERTY_CURRENT.equals(propertyName)) { + + // change value of progress bar + ui.getTaskProgressBar().setValue((Integer) evt.getNewValue()); + } + } + }; + + protected ComponentListener listener = new ComponentAdapter() { + boolean moving; + + boolean resizing; + + @Override + public void componentMoved(ComponentEvent e) { + + MainUI mainUI = (MainUI) e.getSource(); + + if (!moving && mainUI.isShowing()) { + + moving = true; + try { + setLocation(mainUI); + } finally { + moving = false; + } + } + } + + @Override + public void componentResized(ComponentEvent e) { + + MainUI mainUI = (MainUI) e.getSource(); + + if (!resizing && mainUI.isShowing()) { + + resizing = true; + try { + setSize(mainUI); + } finally { + resizing = false; + } + } + } + }; + + //------------------------------------------------------------------------// + //-- AbstractTuttiUIHandler methods --// + //------------------------------------------------------------------------// + + @Override + public void beforeInitUI() { + FaxToMailActionUIModel model = new FaxToMailActionUIModel(); + ui.setContextValue(model); + + model.addPropertyChangeListener(FaxToMailActionUIModel.PROPERTY_ACTION, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + + // udpate global label + AbstractFaxToMailAction action = (AbstractFaxToMailAction) evt.getNewValue(); + + if (log.isDebugEnabled()) { + log.debug("Action to use: " + action); + } + if (action == null) { + + // stoping action + hideAction(); + } else { + + // starting action + showAction(action); + } + } + }); + + model.addPropertyChangeListener(FaxToMailActionUIModel.PROPERTY_PROGRESSION_MODEL, new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + + // change progression model + + ProgressionModel oldValue = (ProgressionModel) evt.getOldValue(); + ProgressionModel newValue = (ProgressionModel) evt.getNewValue(); + + if (log.isDebugEnabled()) { + log.debug("progression model: " + newValue); + } + if (oldValue != null) { + oldValue.removePropertyChangeListener(progressionListener); + } + + if (newValue == null) { + + // remove progression model + ui.getTaskPanel().setVisible(false); + } else { + + // use progression model + ui.getTaskPanel().setVisible(true); + + newValue.addPropertyChangeListener(progressionListener); + } + } + }); + } + + @Override + public void afterInitUI() { + + initUI(ui); + + // installation layer de blocage en mode busy + SwingUtil.setLayerUI(ui.getRootPanel(), ui.getBusyBlockLayerUI()); + + ui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + } + + @Override + protected JComponent getComponentToFocus() { + return null; + } + + @Override + public void onCloseUI() { + + } + + @Override + public SwingValidator<FaxToMailActionUIModel> getValidator() { + return null; + } + + //------------------------------------------------------------------------// + //-- Internal methods --// + //------------------------------------------------------------------------// + + protected void hideAction() { + ui.setVisible(false); + } + + protected void showAction(AbstractFaxToMailAction action) { + ui.setTitle(_("faxtomail.main.title.action", + getConfig().getVersion(), + action.getActionDescription())); + ui.getGlobalActionLabel().setText( + _("faxtomail.message.action.running", + action.getActionDescription())); + ui.pack(); + + MainUI mainUI = getContext().getMainUI(); + if (mainUI != null) { + mainUI.addComponentListener(listener); + + setLocation(mainUI); + setSize(mainUI); + } + try { + ui.setVisible(true); + } finally { + if (mainUI != null) { + mainUI.removeComponentListener(listener); + } + } + } + + protected void setLocation(MainUI mainUI) { + Container component = mainUI.getBody(); + StatusMessagePanel status = mainUI.getStatus(); + int width = component == null ? 0 : component.getWidth(); + int height = component == null ? 0 : component.getHeight() + status.getHeight(); + + int x; + int y; + if (height == 0) { + x = mainUI.getX() + 5; + y = mainUI.getY() + 15; + } else { + x = mainUI.getX() + (mainUI.getWidth() - width); + y = mainUI.getY() + (mainUI.getHeight() - height); + } + ui.setLocation(x, y); + } + + protected void setSize(MainUI mainUI) { + // Better to let his own size to the action progress bar + // see http://forge.codelutin.com/issues/3263 +// Container component = mainUI.getBody(); +// int width = component == null ? 0 : component.getWidth(); + + ui.pack(); + +// if (width != 0 && ui.getWidth() < width) { +// ui.setSize(width, ui.getHeight()); +// } + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIModel.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIModel.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailActionUIModel.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,51 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import com.franciaflex.faxtomail.persistence.ProgressionModel; +import com.google.common.base.Preconditions; +import org.jdesktop.beans.AbstractSerializableBean; + +/** + * @author tchemit <chemit@codelutin.com> + * @since 1.0 + */ +public class FaxToMailActionUIModel extends AbstractSerializableBean { + + private static final long serialVersionUID = 1L; + + public static final String PROPERTY_ACTION = "action"; + + public static final String PROPERTY_PROGRESSION_MODEL = "progressionModel"; + + protected AbstractFaxToMailAction action; + + protected ProgressionModel progressionModel; + + public ProgressionModel getProgressionModel() { + return progressionModel; + } + + public void setProgressionModel(ProgressionModel progressionModel) { + Object oldValue = getProgressionModel(); + this.progressionModel = progressionModel; + firePropertyChange(PROPERTY_PROGRESSION_MODEL, oldValue, progressionModel); + } + + public AbstractFaxToMailAction getAction() { + return action; + } + + public void setAction(AbstractFaxToMailAction action) { + Preconditions.checkNotNull(action, "action can not be null"); + Object oldValue = getAction(); + this.action = action; + firePropertyChange(PROPERTY_ACTION, oldValue, action); + } + + public void clear() { +// setProgressionModel(null); + + Object oldValue = getAction(); + action = null; + firePropertyChange(PROPERTY_ACTION, oldValue, null); + } +} Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailUIAction.java =================================================================== --- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailUIAction.java (rev 0) +++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/action/FaxToMailUIAction.java 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,201 @@ +package com.franciaflex.faxtomail.ui.swing.util.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.TimeLog; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * Abstract FaxToMail ui action which launch a {@link AbstractFaxToMailAction}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.2 + */ +public class FaxToMailUIAction<A extends AbstractFaxToMailAction> extends AbstractAction { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(FaxToMailUIAction.class); + + private static final TimeLog TIME_LOG = new TimeLog(FaxToMailUIAction.class); + + public static final ExecutorService waitingThread = + Executors.newSingleThreadExecutor(); + + private static final String LOGIC_ACTION = "logicAction"; + + private final Object lock = new Object(); + + private boolean wait; + + private long t0; + + public FaxToMailUIAction(AbstractButton button, A action) { + + putValue(LOGIC_ACTION, action); + + // fill the ui action from the button + setActionKey(action.getClass().getName()); + if (button != null) { + setActionIcon(button.getIcon()); + setActionName(button.getText()); + setActionDescription(button.getToolTipText()); + setActionMnemonic(button.getMnemonic()); + } + } + + public void launchActionAndWait() { + wait = true; + actionPerformed(null); + lock(); + } + + + @Override + public final void actionPerformed(final ActionEvent event) { + + t0 = TimeLog.getTime(); + + if (log.isInfoEnabled()) { + log.info("Task [" + getLogicAction().getClass().getSimpleName() + "] starting"); + } + + // prepare action + boolean doAction; + + A action = getLogicAction(); + + // reset status message +// action.sendMessage(""); + + try { + doAction = action.prepareAction(); + } catch (Exception e) { + action.releaseAction(); + throw FaxToMailActionException.propagateError(action, e); + } + + if (doAction) { + + final FaxToMailActionSwingWorker<A> worker = + new FaxToMailActionSwingWorker<A>(action); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + // make ui busy + worker.updateBusyState(true); + + } + }); + + if (log.isDebugEnabled()) { + log.debug("Before execute of action " + action); + } + + // perform and release action + worker.execute(); + + // wait until action is done + waitingThread.execute( + new Runnable() { + @Override + public void run() { + + A action = getLogicAction(); + try { + try { + worker.get(); + } catch (ExecutionException e) { + // don't care . + } catch (CancellationException e) { + // dont care ? + } catch (InterruptedException e) { + // don't care ? + } + if (log.isDebugEnabled()) { + log.debug("After execute of action " + action + " (worker done? " + worker.isDone() + ")"); + } + + if (worker.isFailed()) { + + throw FaxToMailActionException.propagateError(action, worker.getError()); + } + } finally { + unlock(); + } + } + } + ); + + } else { + + try { + // release action + action.releaseAction(); + + } finally { + unlock(); + } + } + } + + public void setActionIcon(Icon actionIcon) { + putValue(SMALL_ICON, actionIcon); + putValue(LARGE_ICON_KEY, actionIcon); + } + + public void setActionKey(String actionKey) { + putValue(ACTION_COMMAND_KEY, actionKey); + } + + public void setActionName(String actionName) { + putValue(NAME, actionName); + } + + public void setActionDescription(String actionDescription) { + putValue(SHORT_DESCRIPTION, actionDescription); + getLogicAction().setActionDescription(actionDescription); + } + + public void setActionMnemonic(int key) { + putValue(MNEMONIC_KEY, key); + } + + public A getLogicAction() { + return (A) getValue(LOGIC_ACTION); + } + + protected void lock() { + if (wait) { + synchronized (lock) { + try { + + lock.wait(); + + } catch (InterruptedException e) { + throw FaxToMailActionException.propagateError(getLogicAction(), e); + } finally { + wait = false; + } + } + } + } + + protected void unlock() { + TIME_LOG.log(t0, "Task [" + getLogicAction().getClass().getSimpleName() + "] End"); + if (wait) { + synchronized (lock) { + lock.notifyAll(); + } + } + } +} Property changes on: trunk/faxtomail-ui-swing/src/main/resources ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider (rev 0) +++ trunk/faxtomail-ui-swing/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1 @@ +com.franciaflex.faxtomail.ui.swing.config.FaxToMailApplicationConfigProvider \ No newline at end of file Property changes on: trunk/faxtomail-ui-swing/src/main/resources/com ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/resources/com/franciaflex/faxtomail/ui/swing ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Property changes on: trunk/faxtomail-ui-swing/src/main/resources/i18n ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties (rev 0) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_en_GB.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,160 @@ +1\ -\ Volets\ roulants= +Ajouter= +Derni\\u00e8re\ modification\ par\ Utilisateur\ 1\ le\ 14/01/2014\ \\u00e0\ 08\:42= +Editer= +Fax\ -\ TIF\ (25ko)= +Nombre\ de\ pages\ \:\ 1,\ dur\\u00e9e\ \:\ 13\ secondes,\ vitesse\ \:\ 31200= +Num\\u00e9ro\ SDA\ \:\ 6374= +Origine\ \:\ 02\ 34\ 56\ 78\ 90= +Plans\ -\ DXF\ (254ko)= +Supprimer= +T\\u00e9l\\u00e9copie\ re\\u00e7ue\ le\ 10/01/2014\ \\u00e0\ 13\:37= +Voir= +faxtomail.action.create.error= +faxtomail.archive.button.label= +faxtomail.back.button.label= +faxtomail.common.askBeforeDelete.help= +faxtomail.common.askCancelEditBeforeLeaving.help= +faxtomail.common.askCancelEditBeforeLeaving.title= +faxtomail.common.askOverwriteFile.help= +faxtomail.common.askOverwriteFile.message= +faxtomail.common.askOverwriteFile.title= +faxtomail.common.askSaveBeforeLeaving.help= +faxtomail.common.askSaveBeforeLeaving.title= +faxtomail.common.datefield.tip= +faxtomail.config.action.reload.actions= +faxtomail.config.action.reload.application= +faxtomail.config.action.reload.ui= +faxtomail.config.application= +faxtomail.config.category.applications= +faxtomail.config.category.applications.description= +faxtomail.config.category.technical= +faxtomail.config.category.technical.description= +faxtomail.config.category.ui= +faxtomail.config.category.ui.description= +faxtomail.config.option.basedir.shortLabel= +faxtomail.config.option.csv.separator.shortLabel= +faxtomail.config.option.help.directory.description= +faxtomail.config.option.help.directory.shortLabel= +faxtomail.config.option.i18n.directory.description= +faxtomail.config.option.i18n.directory.shortLabel= +faxtomail.config.option.i18n.locale.description= +faxtomail.config.option.launch.mode.description= +faxtomail.config.option.site.url.shortLabel= +faxtomail.config.option.startActionFile.description= +faxtomail.config.option.tmp.directory.shortLabel= +faxtomail.config.option.ui.autoPopupNumberEditor.description= +faxtomail.config.option.ui.color.alternateRow.description= +faxtomail.config.option.ui.color.alternateRow.shortLabel= +faxtomail.config.option.ui.color.blockingLayer.description= +faxtomail.config.option.ui.color.blockingLayer.shortLabel= +faxtomail.config.option.ui.color.selectedRow.description= +faxtomail.config.option.ui.color.selectedRow.shortLabel= +faxtomail.config.option.ui.config.file.description= +faxtomail.config.option.ui.config.file.shortLabel= +faxtomail.config.option.ui.dateFormat.description= +faxtomail.config.option.ui.dateFormat.shortLabel= +faxtomail.config.option.ui.shortcut.closePopup.description= +faxtomail.config.option.ui.showNumberEditorButton.description= +faxtomail.config.parse.error= +faxtomail.config.save.error= +faxtomail.config.title= +faxtomail.demande.archive.button.label= +faxtomail.demande.back.button.label= +faxtomail.demande.client.label= +faxtomail.demande.demandeNumber.label= +faxtomail.demande.docType.label= +faxtomail.demande.gamme.label= +faxtomail.demande.message.label= +faxtomail.demande.object.label= +faxtomail.demande.print.button.label= +faxtomail.demande.priority.label= +faxtomail.demande.received.label= +faxtomail.demande.ref.label= +faxtomail.demande.save.button.label= +faxtomail.demande.status.label= +faxtomail.demande.tcc.label= +faxtomail.demande.title= +faxtomail.demande.transmit.button.label= +faxtomail.demandeList.title= +faxtomail.error.delete.startActionFile= +faxtomail.error.errorpane.htmlmessage= +faxtomail.error.read.startActionFile= +faxtomail.error.ui.business.error= +faxtomail.error.ui.business.warning= +faxtomail.error.ui.other.error= +faxtomail.i18n.deleteCache.error= +faxtomail.i18n.mkDir.error= +faxtomail.main.action.configuration= +faxtomail.main.action.configuration.mnemonic= +faxtomail.main.action.configuration.tip= +faxtomail.main.action.demandeList= +faxtomail.main.action.demandeList.mnemonic= +faxtomail.main.action.demandeList.tip= +faxtomail.main.action.exit= +faxtomail.main.action.exit.mnemonic= +faxtomail.main.action.exit.tip= +faxtomail.main.action.goto.previousScreen.tip= +faxtomail.main.action.recherche= +faxtomail.main.action.recherche.mnemonic= +faxtomail.main.action.recherche.tip= +faxtomail.main.action.reloadFaxToMail= +faxtomail.main.menu.file= +faxtomail.main.menu.file.mnemonic= +faxtomail.main.menu.file.tip= +faxtomail.main.title.action= +faxtomail.main.title.application= +faxtomail.main.title.applicationName= +faxtomail.main.title.nodb= +faxtomail.message.action.running= +faxtomail.print.button.label= +faxtomail.property.get.error= +faxtomail.property.set.error= +faxtomail.save.button.label= +faxtomail.search.between2ndPart.label= +faxtomail.search.button.label= +faxtomail.search.chantier.label= +faxtomail.search.clientAccount.label= +faxtomail.search.comment.label= +faxtomail.search.docType.label= +faxtomail.search.modifiedBetween.label= +faxtomail.search.modifiedBy.label= +faxtomail.search.object.label= +faxtomail.search.printedBetween.label= +faxtomail.search.receivedBetween.label= +faxtomail.search.ref.label= +faxtomail.search.sender.label= +faxtomail.search.status.label= +faxtomail.search.title= +faxtomail.transmit.button.label= +swing.error.cannot.mail= +swing.error.cannot.open.link= +swing.error.desktop.browse.not.supported= +swing.error.desktop.mail.not.supported= +swing.error.desktop.not.supported= +test= +tutti.action.create.error= +tutti.common.datefield.tip= +tutti.config.title= +tutti.db.deleteCache.error= +tutti.dbMabager.title= +tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise= +tutti.editCruise.askSaveBeforeLeaving.saveCruise= +tutti.editCruise.title.create.cruise= +tutti.editCruise.title.edit.cruise= +tutti.editSampleCategoryModel.title= +tutti.error.ui.business.error= +tutti.fishingOperations.title.edit.operations= +tutti.fishingOperations.title.validate.operations= +tutti.help.mkDir.error= +tutti.main.title.application= +tutti.main.title.noSelectedCruise= +tutti.main.title.noSelectedProgram= +tutti.main.title.noSelectedProtocol= +tutti.main.title.nodb= +tutti.main.title.selectedCruise= +tutti.main.title.selectedProgram= +tutti.main.title.selectedProtocol= +tutti.manageTemporaryReferential.title= +tutti.report.title= +tutti.selectCruise.title= Added: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties =================================================================== --- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties (rev 0) +++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,131 @@ +1\ -\ Volets\ roulants= +Ajouter= +Derni\\u00e8re\ modification\ par\ Utilisateur\ 1\ le\ 14/01/2014\ \\u00e0\ 08\:42= +Editer= +Fax\ -\ TIF\ (25ko)= +Nombre\ de\ pages\ \:\ 1,\ dur\\u00e9e\ \:\ 13\ secondes,\ vitesse\ \:\ 31200= +Num\\u00e9ro\ SDA\ \:\ 6374= +Origine\ \:\ 02\ 34\ 56\ 78\ 90= +Plans\ -\ DXF\ (254ko)= +Supprimer= +T\\u00e9l\\u00e9copie\ re\\u00e7ue\ le\ 10/01/2014\ \\u00e0\ 13\:37= +Voir= +faxtomail.action.create.error= +faxtomail.common.askBeforeDelete.help= +faxtomail.common.askCancelEditBeforeLeaving.help= +faxtomail.common.askCancelEditBeforeLeaving.title= +faxtomail.common.askOverwriteFile.help= +faxtomail.common.askOverwriteFile.message= +faxtomail.common.askOverwriteFile.title= +faxtomail.common.askSaveBeforeLeaving.help= +faxtomail.common.askSaveBeforeLeaving.title= +faxtomail.common.datefield.tip= +faxtomail.config.action.reload.actions= +faxtomail.config.action.reload.application= +faxtomail.config.action.reload.ui= +faxtomail.config.application= +faxtomail.config.category.applications= +faxtomail.config.category.applications.description= +faxtomail.config.category.technical= +faxtomail.config.category.technical.description= +faxtomail.config.category.ui= +faxtomail.config.category.ui.description= +faxtomail.config.option.basedir.shortLabel= +faxtomail.config.option.csv.separator.shortLabel= +faxtomail.config.option.i18n.directory.description= +faxtomail.config.option.i18n.directory.shortLabel= +faxtomail.config.option.i18n.locale.description= +faxtomail.config.option.launch.mode.description= +faxtomail.config.option.site.url.shortLabel= +faxtomail.config.option.startActionFile.description= +faxtomail.config.option.tmp.directory.shortLabel= +faxtomail.config.option.ui.autoPopupNumberEditor.description= +faxtomail.config.option.ui.color.alternateRow.description= +faxtomail.config.option.ui.color.alternateRow.shortLabel= +faxtomail.config.option.ui.color.blockingLayer.description= +faxtomail.config.option.ui.color.blockingLayer.shortLabel= +faxtomail.config.option.ui.color.selectedRow.description= +faxtomail.config.option.ui.color.selectedRow.shortLabel= +faxtomail.config.option.ui.config.file.description= +faxtomail.config.option.ui.config.file.shortLabel= +faxtomail.config.option.ui.dateFormat.description= +faxtomail.config.option.ui.dateFormat.shortLabel= +faxtomail.config.option.ui.shortcut.closePopup.description= +faxtomail.config.option.ui.showNumberEditorButton.description= +faxtomail.config.parse.error= +faxtomail.config.save.error= +faxtomail.config.title= +faxtomail.demande.archive.button.label=Archiver +faxtomail.demande.back.button.label=Retour +faxtomail.demande.client.label=Client +faxtomail.demande.demandeNumber.label=N° Devis/Commande +faxtomail.demande.docType.label=Type +faxtomail.demande.gamme.label=Gamme +faxtomail.demande.message.label=Message +faxtomail.demande.object.label=Objet +faxtomail.demande.print.button.label=Imprimer +faxtomail.demande.priority.label=Priorité +faxtomail.demande.received.label=Reçu le +faxtomail.demande.ref.label=Rèf +faxtomail.demande.save.button.label=Enregistrer +faxtomail.demande.status.label=Statut +faxtomail.demande.tcc.label=Tcc par +faxtomail.demande.title=Demande +faxtomail.demande.transmit.button.label=Transmettre +faxtomail.demandeList.title=Gestion des fax +faxtomail.error.delete.startActionFile= +faxtomail.error.errorpane.htmlmessage= +faxtomail.error.read.startActionFile= +faxtomail.error.ui.business.error= +faxtomail.error.ui.business.warning= +faxtomail.error.ui.other.error= +faxtomail.i18n.deleteCache.error= +faxtomail.i18n.mkDir.error= +faxtomail.main.action.configuration=Configuration +faxtomail.main.action.configuration.mnemonic= +faxtomail.main.action.configuration.tip=Menu configuration +faxtomail.main.action.demandeList=Gestion des fax +faxtomail.main.action.demandeList.mnemonic= +faxtomail.main.action.demandeList.tip=Gestion des fax +faxtomail.main.action.exit=Quitter +faxtomail.main.action.exit.mnemonic= +faxtomail.main.action.exit.tip=Quitter l'application +faxtomail.main.action.goto.previousScreen.tip= +faxtomail.main.action.recherche=Recherche +faxtomail.main.action.recherche.mnemonic= +faxtomail.main.action.recherche.tip=Recherche de demandes archivées +faxtomail.main.action.reloadFaxToMail= +faxtomail.main.menu.file=Fichier +faxtomail.main.menu.file.mnemonic= +faxtomail.main.menu.file.tip=Menu fichier +faxtomail.main.title.action= +faxtomail.main.title.application=FaxToMail +faxtomail.main.title.applicationName=FaxToMail +faxtomail.main.title.nodb= +faxtomail.message.action.running= +faxtomail.property.get.error= +faxtomail.property.set.error= +faxtomail.search.between2ndPart.label=et le +faxtomail.search.button.label=Rechercher +faxtomail.search.chantier.label=Chantier +faxtomail.search.clientAccount.label=Compte client +faxtomail.search.comment.label=Commentaire +faxtomail.search.docType.label=Type document +faxtomail.search.modifiedBetween.label=Modifié entre le +faxtomail.search.modifiedBy.label=Modifié par +faxtomail.search.object.label=Objet +faxtomail.search.printedBetween.label=Imprimé entre le +faxtomail.search.receivedBetween.label=Reçu entre le +faxtomail.search.ref.label=Référence +faxtomail.search.sender.label=Émetteur +faxtomail.search.status.label=Statut +faxtomail.search.title=Recherche +swing.error.cannot.mail= +swing.error.cannot.open.link= +swing.error.desktop.browse.not.supported= +swing.error.desktop.mail.not.supported= +swing.error.desktop.not.supported= +tutti.editCruise.askCancelEditBeforeLeaving.cancelSaveCruise= +tutti.editCruise.askSaveBeforeLeaving.saveCruise= +tutti.editCruise.title.create.cruise= +tutti.editCruise.title.edit.cruise= Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons ___________________________________________________________________ Added: svn:ignore + Slides target .idea *.idea *.ipr *.iws *.iml .project .classpath Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png =================================================================== (Binary files differ) Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-config.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png =================================================================== (Binary files differ) Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-exit.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png =================================================================== (Binary files differ) Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-application.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png =================================================================== (Binary files differ) Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-shortcut.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png =================================================================== (Binary files differ) Property changes on: trunk/faxtomail-ui-swing/src/main/resources/icons/action-reload-ui.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/pom.xml =================================================================== --- trunk/pom.xml (rev 0) +++ trunk/pom.xml 2014-01-15 16:23:40 UTC (rev 2) @@ -0,0 +1,548 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>mavenpom4redmine</artifactId> + <version>4.3</version> + </parent> + + <groupId>com.franciaflex</groupId> + <artifactId>faxtomail</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>FaxToMail</name> + <description> + Système de traîtement des fax et emails entrants + </description> + <url>http://forge.codelutin.com/projects/faxtomail</url> + <inceptionYear>2014</inceptionYear> + <licenses> + <license> + <name>General Public License (GPL)</name> + <url>http://www.gnu.org/licenses/gpl.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + + <developers> + <developer> + <id>morin</id> + <name>Kevin Morin</name> + <email>morin at codelutin dot com</email> + <organization>CodeLutin</organization> + <organizationUrl>http://www.codelutin.com</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>Europe/Paris</timezone> + </developer> + </developers> + + <modules> + <module>faxtomail-persistence</module> + <module>faxtomail-service</module> + <module>faxtomail-ui-swing</module> + </modules> + + <scm> + <url>http://svn.forge.codelutin.com/svn/faxtomail/trunk</url> + <connection> + scm:svn:http://svn.forge.codelutin.com/svn/faxtomail/trunk + </connection> + <developerConnection> + scm:svn:http://svn.forge.codelutin.com/svn/faxtomail/trunk + </developerConnection> + </scm> + <distributionManagement> + <site> + <id>${platform}</id> + <url>${our.site.repository}/${projectId}</url> + </site> + <snapshotRepository> + <id>nuiton-nexus-deploy</id> + <url> + http://nexus.nuiton.org/nexus/content/repositories/faxtomail-snapshot + </url> + </snapshotRepository> + </distributionManagement> + + <properties> + + <platform>forge.codelutin.com</platform> + <projectId>faxtomail</projectId> + + <!-- libraries version --> + + <nuitonI18nVersion>2.5.2</nuitonI18nVersion> + <nuitonConfigVersion>3.0-alpha-1</nuitonConfigVersion> + <nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion> + <nuitonDecoratorVersion>3.0-alpha-2</nuitonDecoratorVersion> + <nuitonUpdaterVersion>3.0-alpha-1</nuitonUpdaterVersion> + <nuitonUtilsVersion>2.7.1</nuitonUtilsVersion> + <nuitonValidatorVersion>3.0-alpha-1</nuitonValidatorVersion> + + <eugenePluginVersion>2.7.2</eugenePluginVersion> + <hibernateVersion>3.6.10.Final</hibernateVersion> + + <jaxxVersion>2.5.30</jaxxVersion> + <swingXVersion>1.6.4</swingXVersion> + <xworkVersion>2.3.15.1</xworkVersion> + + <slf4jVersion>1.7.5</slf4jVersion> + + <i18n.bundles>fr_FR,en_GB</i18n.bundles> + <i18n.silent>true</i18n.silent> + + <!-- license header configuration --> + <license.organizationName>Franciaflex</license.organizationName> + <license.licenseName>gpl_v3</license.licenseName> + + </properties> + + <repositories> + <repository> + <id>faxtomail-public-group</id> + <url>http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/</url> + <snapshots> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + <releases> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </releases> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>faxtomail-public-group</id> + <url>http://nexus.nuiton.org/nexus/content/groups/faxtomail-group/</url> + <snapshots> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </snapshots> + <releases> + <enabled>true</enabled> + <checksumPolicy>fail</checksumPolicy> + </releases> + </pluginRepository> + </pluginRepositories> + + <dependencyManagement> + <dependencies> + + <!-- librairies utils --> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-profiling</artifactId> + <version>2.7</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + <version>${nuitonUtilsVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-decorator</artifactId> + <version>${nuitonDecoratorVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-config</artifactId> + <version>${nuitonConfigVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-updater</artifactId> + <version>${nuitonUpdaterVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-csv</artifactId> + <version>${nuitonCsvVersion}</version> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guavaVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.i18n</groupId> + <artifactId>nuiton-i18n</artifactId> + <version>${nuitonI18nVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <version>${nuitonValidatorVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-validator</artifactId> + <version>${nuitonValidatorVersion}</version> + <scope>test</scope> + <classifier>tests</classifier> + </dependency> + + <dependency> + <groupId>org.apache.struts.xwork</groupId> + <artifactId>xwork-core</artifactId> + <version>${xworkVersion}</version> + </dependency> + + <!-- librairie Jaxx --> + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${jaxxVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-validator</artifactId> + <version>${jaxxVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-widgets</artifactId> + <version>${jaxxVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-config</artifactId> + <version>${jaxxVersion}</version> + </dependency> + + <dependency> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${jaxxVersion}</version> + <scope>test</scope> + <classifier>tests</classifier> + </dependency> + + <dependency> + <groupId>org.swinglabs</groupId> + <artifactId>jxlayer</artifactId> + <version>3.0.4</version> + <scope>compile</scope> + </dependency> + + <!-- swing widgets --> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-core</artifactId> + <version>${swingXVersion}</version> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-common</artifactId> + <version>${swingXVersion}</version> + </dependency> + + <dependency> + <groupId>org.swinglabs.swingx</groupId> + <artifactId>swingx-autocomplete</artifactId> + <version>${swingXVersion}</version> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-vfs2</artifactId> + <version>2.0</version> + <exclusions> + <exclusion> + <groupId>org.apache.maven.scm</groupId> + <artifactId>maven-scm-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.maven.scm</groupId> + <artifactId>maven-scm-provider-svnexe</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4jVersion}</version> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jcl</artifactId> + <version>${slf4jVersion}</version> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commonsIoVersion}</version> + </dependency> + + </dependencies> + + </dependencyManagement> + + <build> + <pluginManagement> + <plugins> + + <!-- plugin site --> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.nuiton.jrst</groupId> + <artifactId>doxia-module-jrst</artifactId> + <version>${jrstPluginVersion}</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>${hibernateVersion}</version> + </dependency> + </dependencies> + </plugin> + + <plugin> + <groupId>org.nuiton.i18n</groupId> + <artifactId>i18n-maven-plugin</artifactId> + <version>${nuitonI18nVersion}</version> + </plugin> + + <plugin> + <groupId>org.nuiton.eugene</groupId> + <artifactId>eugene-maven-plugin</artifactId> + <version>${eugenePluginVersion}</version> + </plugin> + + <plugin> + <groupId>org.nuiton.jaxx</groupId> + <artifactId>jaxx-maven-plugin</artifactId> + <version>${jaxxVersion}</version> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <version>${animalSnifferPluginVersion}</version> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java16-sun</artifactId> + <version>1.10</version> + </signature> + </configuration> + </plugin> + + </plugins> + </pluginManagement> + <extensions> + <!-- Enabling the use of scpexe with maven 3.0 --> + <extension> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-ssh-external</artifactId> + <version>1.0</version> + </extension> + </extensions> + </build> + + <reporting> + <excludeDefaults>true</excludeDefaults> + </reporting> + + <profiles> + + <profile> + <id>check-release-profile</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <build> + <plugins> + <plugin> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>check-release-properties</id> + <goals> + <goal>enforce</goal> + </goals> + <phase>initialize</phase> + <configuration> + <rules> + <requireProperty> + <property>jreVersion</property> + <message>You must set a jreVersion property!</message> + </requireProperty> + <requireProperty> + <property>dbVersion</property> + <message>You must set a dbVersion property!</message> + </requireProperty> + <requireProperty> + <property>reportVersion</property> + <message>You must set a reportVersion property!</message> + </requireProperty> + </rules> + <ignoreCache>true</ignoreCache> + <failFast>true</failFast> + <fail>true</fail> + + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + </profile> + <profile> + <id>license-profile</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <build> + <defaultGoal>generate-resources</defaultGoal> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <executions> + <execution> + <id>update-file-header-on-pom</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <roots> + <root>${project.basedir}</root> + </roots> + <includes> + <include>pom.xml</include> + </includes> + <addSvnKeyWords>false</addSvnKeyWords> + <verbose>false</verbose> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>reporting</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <reporting> + <plugins> + + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>${projectInfoReportsPluginVersion}</version> + <reportSets> + <reportSet> + <reports> + <report>project-team</report> + <report>mailing-list</report> + <report>cim</report> + <report>issue-tracking</report> + <report>license</report> + <report>scm</report> + <report>dependencies</report> + <report>dependency-convergence</report> + <report>dependency-info</report> + <report>plugin-management</report> + <report>plugins</report> + <report>dependency-management</report> + <report>summary</report> + </reports> + </reportSet> + </reportSets> + </plugin> + + </plugins> + </reporting> + + </profile> + + <profile> + <id>update-file-header</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <properties> + <license.descriptor>src/license/project.xml</license.descriptor> + </properties> + <build> + <defaultGoal>process-resources</defaultGoal> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <executions> + <execution> + <id>update-file-header</id> + <goals> + <goal>update-file-header</goal> + </goals> + <configuration> + <addSvnKeyWords>true</addSvnKeyWords> + <excludes> + <exclude>**/i18n/*.properties</exclude> + <exclude>**/help/*.properties</exclude> + <exclude>**/THIRD-PARTY.properties</exclude> + <!-- since sh scripts must begins by the line #!/bin/sh, + can not use the mojo for the mojo --> + <exclude>**/*.sh</exclude> + </excludes> + </configuration> + <phase>process-resources</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + </profiles> +</project>