100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Update of basic GWT Manager app structure
Rich Turner3718d6a4b081
diff --git a/LICENSE.txt b/LICENSE.txtindex 1775c76e0..20adf5768 100644--- a/LICENSE.txt+++ b/LICENSE.txt@@ -99,6 +99,10 @@ org.springframework:spring-core: APACHE LICENSE, VERSION 2.0org.springframework:spring-expression: APACHE LICENSE, VERSION 2.0org.springframework:spring-tx: APACHE LICENSE, VERSION 2.0xml-apis:xml-apis: APACHE LICENSE, VERSION 2.0+javax.ws.rs:javax.ws.rs-api: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE 1.1+org.gwtbootstrap3:gwtbootstrap3: APACHE LICENSE, VERSION 2.0+org.gwtbootstrap3:gwtbootstrap3-extras: APACHE LICENSE, VERSION 2.0+https://github.com/workingflows/gwt-jscore: UNKNOWN---@@ -2158,3 +2162,212 @@ This Agreement is governed by the laws of the State of New York and the intellecEND OF TERMS AND CONDITIONS---++COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)Version 1.1++1. Definitions.++1.1. “Contributor” means each individual or entity that creates or contributes to the creation of Modifications.+1.2. “Contributor Version” means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.+1.3. “Covered Software” means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.+1.4. “Executable” means the Covered Software in any form other than Source Code.+1.5. “Initial Developer” means the individual or entity that first makes Original Software available under this License.+1.6. “Larger Work” means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.+1.7. “License” means this document.+1.8. “Licensable” means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.+1.9. “Modifications” means the Source Code and Executable form of any of the following:+A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;+B. Any new file that contains any part of the Original Software or previous Modification; or+C. Any new file that is contributed or otherwise made available under the terms of this License.+1.10. “Original Software” means the Source Code and Executable form of computer software code that is originally released under this License.+1.11. “Patent Claims” means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.+1.12. “Source Code” means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.+1.13. “You” (or “Your”) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, “You” includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.+2. License Grants.++2.1. The Initial Developer Grant.+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and+(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).+(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.+(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices.+2.2. Contributor Grant.+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).+(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.+(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.+3. Distribution Obligations.++3.1. Availability of Source Code.+Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.+3.2. Modifications.+The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.+3.3. Required Notices.+You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.+3.4. Application of Additional Terms.+You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients' rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.+3.5. Distribution of Executable Versions.+You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient's rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.+3.6. Larger Works.+You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.+4. Versions of the License.++4.1. New Versions.+Oracle is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.+4.2. Effect of New Versions.+You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.+4.3. Modified Versions.+When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License.+5. DISCLAIMER OF WARRANTY.++COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN “AS IS” BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.++6. TERMINATION.++6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.+6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as “Participant”) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.+6.3. If You assert a patent infringement claim against Participant alleging that the Participant Software directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.+6.4. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.+7. LIMITATION OF LIABILITY.++UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.++8. U.S. GOVERNMENT END USERS.++The Covered Software is a “commercial item,” as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of “commercial computer software” (as that term is defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer software documentation” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.++9. MISCELLANEOUS.++This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction's conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.++10. RESPONSIBILITY FOR CLAIMS.++As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.++NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)++The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California.++++The GNU General Public License (GPL) Version 2, June 1991++Copyright (C) 1989, 1991 Free Software Foundation, Inc.+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA++Everyone is permitted to copy and distribute verbatim copies+of this license document, but changing it is not allowed.++Preamble++The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.++For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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.++We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.++Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.++Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.++The precise terms and conditions for copying, distribution and modification follow.++TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION++0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".++Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.++1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.++You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.++2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:++a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.+b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.+c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.++Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.++In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.++3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:++a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,+b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,+c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.++If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.++4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.++5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.++6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.++7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.++If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.++It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.++This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.++8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.++9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.++10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.++NO WARRANTY++11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.++12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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.++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 convey 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+Also add information on how to contact you by electronic and paper mail.++If the program is interactive, make it output a short notice like this when it starts in an interactive mode:++Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.++You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:++Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.+signature of Ty Coon, 1 April 1989+Ty Coon, President of Vice+This 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 Library General Public License instead of this License.++"CLASSPATH" EXCEPTION TO THE GPL VERSION 2++Certain source files distributed by Oracle are subject to the following clarification and special exception to the GPL Version 2, but only where Oracle has expressly included in the particular source file's header the words "Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the License file that accompanied this code."++Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License Version 2 cover the whole combination.++As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.++---\ No newline at end of filediff --git a/manager/build.gradle b/manager/build.gradleindex ddb69da81..5b0a93d62 100644--- a/manager/build.gradle+++ b/manager/build.gradle@@ -4,6 +4,9 @@ buildscript {maven {url "https://plugins.gradle.org/m2/"}+ maven {+ url "https://ibaca.github.io/rxjava-gwt/"+ }}dependencies {classpath "de.richsource.gradle.plugins:gwt-gradle-plugin:$gwtGradlePluginVersion"@@ -42,13 +45,22 @@ dependencies {compile ("com.google.gwt.inject:gin:$ginVersion") {exclude group: "asm"}++ // REST SERVICEScompile "org.fusesource.restygwt:restygwt:$restygwtVersion"+ compile "javax.ws.rs:javax.ws.rs-api:2.0.1"apt "org.hibernate:hibernate-jpamodelgen:$hibernateVersion"testCompile "junit:junit:$junitVersion"testCompile "io.vertx:vertx-unit:$vertxVersion"-++ // GWT Bootstrap support+ compile "org.gwtbootstrap3:gwtbootstrap3:0.9.2"+ compile "org.gwtbootstrap3:gwtbootstrap3-extras:0.9.2"++ // GWT Material Design+ //compile 'com.github.gwtmaterialdesign:gwt-material:1.4.1'}gwt {@@ -63,6 +75,10 @@ gwt {hasGwtTests = false}+ dependencies {+ compile files('libs/jscore-1.0.jar')+ }+compiler {style = "PRETTY"}diff --git a/manager/libs/jscore-1.0.jar b/manager/libs/jscore-1.0.jarnew file mode 100644index 000000000..595fd71fbBinary files /dev/null and b/manager/libs/jscore-1.0.jar differdiff --git a/manager/src/main/java/org/openremote/manager/client/ActivityInitialiser.java b/manager/src/main/java/org/openremote/manager/client/ActivityInitialiser.javadeleted file mode 100644index ce549d296..000000000--- a/manager/src/main/java/org/openremote/manager/client/ActivityInitialiser.java+++ /dev/null@@ -1,18 +0,0 @@-package org.openremote.manager.client;--import com.google.gwt.activity.shared.ActivityManager;-import com.google.inject.Inject;-import com.google.inject.name.Named;-import org.openremote.manager.client.view.MainView;--/**- * This maps activity managers to parts of the main view- * Created by Richard on 12/02/2016.- */-public class ActivityInitialiser {- @Inject- public ActivityInitialiser(MainView mainView,- @Named("MainContentManager")ActivityManager mainContentActivityManager) {- mainContentActivityManager.setDisplay(mainView.getMainContentPanel());- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/AppController.java b/manager/src/main/java/org/openremote/manager/client/AppController.javanew file mode 100644index 000000000..aee1a56dc--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/AppController.java@@ -0,0 +1,12 @@+package org.openremote.manager.client;++import com.google.gwt.place.shared.Place;++/**+ * Created by Richard on 12/02/2016.+ */+public interface AppController {+ void goTo(Place place);++ void start();+}diff --git a/manager/src/main/java/org/openremote/manager/client/AppControllerImpl.java b/manager/src/main/java/org/openremote/manager/client/AppControllerImpl.javanew file mode 100644index 000000000..3e394bf26--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/AppControllerImpl.java@@ -0,0 +1,121 @@+package org.openremote.manager.client;++import com.google.gwt.place.shared.*;+import com.google.gwt.user.client.Window;+import com.google.gwt.user.client.ui.RootLayoutPanel;+import com.google.inject.Provider;+import com.google.web.bindery.event.shared.EventBus;+import org.openremote.manager.client.event.LoginRequestEvent;+import org.openremote.manager.client.event.UserChangeEvent;+import org.openremote.manager.client.i18n.ManagerConstants;+import org.openremote.manager.client.presenter.ActivityInitialiser;+import org.openremote.manager.client.presenter.HeaderPresenter;+import org.openremote.manager.client.presenter.LoginPresenter;+import org.openremote.manager.client.service.SecurityService;+import org.openremote.manager.client.view.AppLayout;++import javax.inject.Inject;++public class AppControllerImpl implements AppController, AppLayout.Presenter {++ private final AppLayout appLayout;+ private final EventBus eventBus;+ private final PlaceController placeController;+ private final PlaceHistoryHandler placeHistoryHandler;+ private ManagerConstants constants;+ private Provider<LoginPresenter> loginPresenterProvider;+ private Provider<HeaderPresenter> headerPresenterProvider;++ /**+ * This provides the ability to intercept the place change outside of an activity+ * mapper and to change the place before anything else happens+ */+ public static class AppPlaceController extends PlaceController {+ private SecurityService securityService;+ private PlaceHistoryMapper historyMapper;+ private Place redirectPlace;+ private EventBus eventBus;++ public AppPlaceController(SecurityService securityService, PlaceHistoryMapper historyMapper, EventBus eventBus) {+ super(eventBus);+ this.securityService = securityService;+ this.historyMapper = historyMapper;+ this.eventBus = eventBus;+ }++ @Override+ public void goTo(Place newPlace) {+ if (this.securityService.isTokenExpired()) {+ // Show the login view+ eventBus.fireEvent(new LoginRequestEvent(newPlace));+ return;+ }++ super.goTo(newPlace);+ }+ }++ @Inject+ public AppControllerImpl(PlaceController placeController,+ Provider<LoginPresenter> loginPresenterProvider,+ Provider<HeaderPresenter> headerPresenterProvider,+ PlaceHistoryHandler placeHistoryHandler,+ EventBus eventBus,+ AppLayout appLayout,+ ManagerConstants constants,+ ActivityInitialiser activityInitialiser) {++ // ActivityInitialiser is needed so that activities are mapped to views+ this.appLayout = appLayout;+ this.placeController = placeController;+ this.loginPresenterProvider = loginPresenterProvider;+ this.headerPresenterProvider = headerPresenterProvider;+ this.placeHistoryHandler = placeHistoryHandler;+ this.eventBus = eventBus;+ this.constants = constants;++ // Configure the header as not using activity mapper for header (it's static)+ HeaderPresenter headerPresenter = headerPresenterProvider.get();+ appLayout.getHeaderPanel().setWidget(headerPresenter.getView());++ // Monitor place changes to reconfigure the UI+ eventBus.addHandler(PlaceChangeEvent.TYPE, event -> {+ Place newPlace = event.getNewPlace();+ appLayout.updateLayout(newPlace);+ headerPresenter.onPlaceChange(newPlace);+ });++ // Monitor login/logout requests+ eventBus.addHandler(LoginRequestEvent.TYPE, event -> {+ Place place = event.getRedirectPlace();+ LoginPresenter loginPresenter = loginPresenterProvider.get();+ loginPresenter.redirectTo(place);+ appLayout.showLogin();+ });++ eventBus.addHandler(UserChangeEvent.TYPE, event -> {+ if (event.getUsername() != null) {+ appLayout.hideLogin();+ }+ headerPresenter.setUsername(event.getUsername());+ });+ }++ @Override+ public AppLayout getView() {+ return appLayout;+ }++ @Override+ public void goTo(Place place) {+ placeController.goTo(place);+ }++ @Override+ public void start() {+ Window.setTitle(constants.appTitle());+ RootLayoutPanel.get().add(appLayout);+ appLayout.setPresenter(this);+ placeHistoryHandler.handleCurrentHistory();+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/AssetsActivityMapper.java b/manager/src/main/java/org/openremote/manager/client/AssetsActivityMapper.javadeleted file mode 100644index 33758a993..000000000--- a/manager/src/main/java/org/openremote/manager/client/AssetsActivityMapper.java+++ /dev/null@@ -1,33 +0,0 @@-package org.openremote.manager.client;--import com.google.gwt.activity.shared.Activity;-import com.google.gwt.activity.shared.ActivityMapper;-import com.google.gwt.place.shared.Place;-import com.google.inject.Inject;-import com.google.inject.Provider;-import org.openremote.manager.client.presenter.AssetsActivity;-import org.openremote.manager.client.presenter.AssetsPlace;--/**- * Created by Richard on 12/02/2016.- */-public class AssetsActivityMapper implements ActivityMapper {- private final Provider<AssetsActivity> assetsActivityProvider;-- @Inject- public AssetsActivityMapper(Provider<AssetsActivity> assetsActivityProvider) {- this.assetsActivityProvider = assetsActivityProvider;- }-- public Activity getActivity(Place place) {- Activity activity = null;-- if (place instanceof AssetsPlace) {- AssetsPlace assetsPlace = (AssetsPlace)place;- activity = assetsActivityProvider.get().doInit(assetsPlace);- return activity;- }-- return null;- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/HistoryMapper.java b/manager/src/main/java/org/openremote/manager/client/HistoryMapper.javadeleted file mode 100644index 842fdb74b..000000000--- a/manager/src/main/java/org/openremote/manager/client/HistoryMapper.java+++ /dev/null@@ -1,20 +0,0 @@-package org.openremote.manager.client;--import com.google.gwt.place.shared.PlaceHistoryMapper;-import com.google.gwt.place.shared.WithTokenizers;-import org.openremote.manager.client.presenter.AssetsPlace;-import org.openremote.manager.client.presenter.LoginPlace;-import org.openremote.manager.client.presenter.MapPlace;--/**- * Created by Richard on 12/02/2016.- */-@WithTokenizers(- {- AssetsPlace.Tokenizer.class,- MapPlace.Tokenizer.class,- LoginPlace.Tokenizer.class- }-)-public interface HistoryMapper extends PlaceHistoryMapper {-}diff --git a/manager/src/main/java/org/openremote/manager/client/MainContentActivityMapper.java b/manager/src/main/java/org/openremote/manager/client/MainContentActivityMapper.javadeleted file mode 100644index ed562b219..000000000--- a/manager/src/main/java/org/openremote/manager/client/MainContentActivityMapper.java+++ /dev/null@@ -1,35 +0,0 @@-package org.openremote.manager.client;--import com.google.gwt.activity.shared.Activity;-import com.google.gwt.activity.shared.ActivityMapper;-import com.google.gwt.place.shared.Place;-import com.google.inject.Inject;-import com.google.inject.Provider;-import org.openremote.manager.client.presenter.AssetsPlace;-import org.openremote.manager.client.presenter.MapActivity;-import org.openremote.manager.client.presenter.MapPlace;--/**- * Created by Richard on 12/02/2016.- */-public class MainContentActivityMapper implements ActivityMapper {- private final AssetsActivityMapper assetsActivityMapper;- private final Provider<MapActivity> mapActivityProvider;-- @Inject- public MainContentActivityMapper(AssetsActivityMapper assetsActivityMapper, Provider<MapActivity> mapActivityProvider) {- this.assetsActivityMapper = assetsActivityMapper;- this.mapActivityProvider = mapActivityProvider;- }-- public Activity getActivity(Place place) {- if (place instanceof AssetsPlace) {- return assetsActivityMapper.getActivity(place);- }- if (place instanceof MapPlace) {- return mapActivityProvider.get().doInit((MapPlace)place);- }-- return null;- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/MainController.java b/manager/src/main/java/org/openremote/manager/client/MainController.javadeleted file mode 100644index 648111cbc..000000000--- a/manager/src/main/java/org/openremote/manager/client/MainController.java+++ /dev/null@@ -1,10 +0,0 @@-package org.openremote.manager.client;--import org.openremote.manager.client.view.MainMenuView;--/**- * Created by Richard on 12/02/2016.- */-public interface MainController extends MainMenuView.Presenter {- void start();-}diff --git a/manager/src/main/java/org/openremote/manager/client/MainControllerImpl.java b/manager/src/main/java/org/openremote/manager/client/MainControllerImpl.javadeleted file mode 100644index b0fb017d1..000000000--- a/manager/src/main/java/org/openremote/manager/client/MainControllerImpl.java+++ /dev/null@@ -1,53 +0,0 @@-package org.openremote.manager.client;--import com.google.gwt.place.shared.Place;-import com.google.gwt.place.shared.PlaceController;-import com.google.gwt.place.shared.PlaceHistoryHandler;-import com.google.gwt.user.client.ui.RootLayoutPanel;-import com.google.web.bindery.event.shared.EventBus;-import org.openremote.manager.client.view.MainMenuView;-import org.openremote.manager.client.view.MainView;--import javax.inject.Inject;--public class MainControllerImpl implements MainController {-- private final MainView view;- private final MainMenuView menuView;- private final EventBus bus;- private final PlaceController placeController;- private final PlaceHistoryHandler placeHistoryHandler;-- @Inject- public MainControllerImpl(PlaceController placeController,- PlaceHistoryHandler placeHistoryHandler,- EventBus bus,- MainView view,- MainMenuView menuView,- ActivityInitialiser activityInitialiser) {- // ActivityInitialiser is needed so that activities are mapped to views- this.view = view;- this.menuView = menuView;- this.placeController = placeController;- this.placeHistoryHandler = placeHistoryHandler;- this.bus = bus;- menuView.setPresenter(this);- view.setMenu(menuView);- }-- @Override- public MainMenuView getView() {- return menuView;- }-- @Override- public void goTo(Place place) {- placeController.goTo(place);- }-- @Override- public void start() {- RootLayoutPanel.get().add(view);- placeHistoryHandler.handleCurrentHistory();- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/MainModule.java b/manager/src/main/java/org/openremote/manager/client/MainModule.javaindex 6003eca0c..7bb1930fe 100644--- a/manager/src/main/java/org/openremote/manager/client/MainModule.java+++ b/manager/src/main/java/org/openremote/manager/client/MainModule.java@@ -1,6 +1,7 @@package org.openremote.manager.client;import com.google.gwt.activity.shared.ActivityManager;+import com.google.gwt.core.client.GWT;import com.google.gwt.inject.client.AbstractGinModule;import com.google.gwt.place.shared.PlaceController;import com.google.gwt.place.shared.PlaceHistoryHandler;@@ -10,9 +11,13 @@ import com.google.inject.Singleton;import com.google.inject.name.Named;import com.google.web.bindery.event.shared.EventBus;import com.google.web.bindery.event.shared.SimpleEventBus;-import org.openremote.manager.client.presenter.AssetsActivity;-import org.openremote.manager.client.presenter.MapActivity;-import org.openremote.manager.client.presenter.MapPlace;+import org.fusesource.restygwt.client.Resource;+import org.fusesource.restygwt.client.RestServiceProxy;+import org.openremote.manager.client.i18n.ManagerConstants;+import org.openremote.manager.client.i18n.ManagerMessages;+import org.openremote.manager.client.presenter.*;+import org.openremote.manager.client.rest.LoginRestService;+import org.openremote.manager.client.service.*;import org.openremote.manager.client.view.*;public class MainModule extends AbstractGinModule {@@ -22,17 +27,25 @@ public class MainModule extends AbstractGinModule {// App Wiringbind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);bind(PlaceHistoryMapper.class).to(HistoryMapper.class).in(Singleton.class);- bind(MainController.class).to(MainControllerImpl.class).in(Singleton.class);+ bind(AppController.class).to(AppControllerImpl.class).in(Singleton.class);// Views- bind(MainView.class).to(MainViewImpl.class).in(Singleton.class);- bind(MainMenuView.class).to(MainMenuViewImpl.class).in(Singleton.class);+ bind(HeaderView.class).to(HeaderViewImpl.class).in(Singleton.class);+ bind(LoginView.class).to(LoginViewImpl.class).in(Singleton.class);+ bind(AppLayout.class).to(AppLayoutImpl.class).in(Singleton.class);bind(MapView.class).to(MapViewImpl.class).in(Singleton.class);- bind(AssetsView.class).to(AssetsViewImpl.class).in(Singleton.class);+ bind(AssetListView.class).to(AssetListViewImpl.class).in(Singleton.class);+ bind(AssetDetailView.class).to(AssetDetailViewImpl.class).in(Singleton.class);+ bind(LeftSideView.class).to(LeftSideViewImpl.class).in(Singleton.class);// Activities- bind(AssetsActivity.class);+ bind(AssetDetailActivity.class);bind(MapActivity.class);++ // Services+ bind(SecurityService.class).to(SecurityServiceImpl.class).in(Singleton.class);+ bind(CookieService.class).to(CookieServiceImpl.class).in(Singleton.class);+ bind(ValidatorService.class).to(ValidatorServiceImpl.class).in(Singleton.class);}@Provides@@ -45,8 +58,37 @@ public class MainModule extends AbstractGinModule {@Provides@Singleton- public PlaceController getPlaceController(EventBus eventBus) {- return new PlaceController(eventBus);+ @Named("LeftSideManager")+ public ActivityManager getLeftSideActivityMapper(+ LeftSideActivityMapper activityMapper, EventBus eventBus) {+ return new ActivityManager(activityMapper, eventBus);+ }++ @Provides+ @Singleton+ public ManagerConstants getConstants() {+ return GWT.create(ManagerConstants.class);+ }++ @Provides+ @Singleton+ public ManagerMessages getMessages() {+ return GWT.create(ManagerMessages.class);+ }++ @Provides+ @Singleton+ public LoginRestService getLoginRestService() {+ String baseUrl = GWT.getHostPageBaseURL();+ LoginRestService loginService = GWT.create(LoginRestService.class);+ ((RestServiceProxy) loginService).setResource(new Resource(baseUrl));+ return loginService;+ }++ @Provides+ @Singleton+ public PlaceController getPlaceController(SecurityService securityService, PlaceHistoryMapper historyMapper, EventBus eventBus) {+ return new AppControllerImpl.AppPlaceController(securityService, historyMapper, eventBus);}@Provides@@ -55,7 +97,7 @@ public class MainModule extends AbstractGinModule {PlaceHistoryMapper historyMapper,EventBus eventBus) {PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);- historyHandler.register(placeController, eventBus, new MapPlace());+ historyHandler.register(placeController, eventBus, new OverviewPlace());return historyHandler;}}diff --git a/manager/src/main/java/org/openremote/manager/client/ManagerEntryPoint.java b/manager/src/main/java/org/openremote/manager/client/ManagerEntryPoint.javaindex f4191ad8f..157f54c35 100644--- a/manager/src/main/java/org/openremote/manager/client/ManagerEntryPoint.java+++ b/manager/src/main/java/org/openremote/manager/client/ManagerEntryPoint.java@@ -1,7 +1,6 @@package org.openremote.manager.client;import com.google.gwt.core.client.GWT;-import com.google.gwt.user.client.ui.RootLayoutPanel;public class ManagerEntryPoint implements com.google.gwt.core.client.EntryPoint {diff --git a/manager/src/main/java/org/openremote/manager/client/ManagerGinjector.java b/manager/src/main/java/org/openremote/manager/client/ManagerGinjector.javaindex df4a99180..7ed638bd0 100644--- a/manager/src/main/java/org/openremote/manager/client/ManagerGinjector.java+++ b/manager/src/main/java/org/openremote/manager/client/ManagerGinjector.java@@ -4,10 +4,10 @@ import com.google.gwt.inject.client.GinModules;import com.google.gwt.inject.client.Ginjector;@GinModules(- {- MainModule.class,- }+ {+ MainModule.class,+ })public interface ManagerGinjector extends Ginjector {- MainController getMainController();+ AppController getMainController();}diff --git a/manager/src/main/java/org/openremote/manager/client/event/LoginRequestEvent.java b/manager/src/main/java/org/openremote/manager/client/event/LoginRequestEvent.javanew file mode 100644index 000000000..c2e21e92b--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/event/LoginRequestEvent.java@@ -0,0 +1,36 @@+package org.openremote.manager.client.event;++import com.google.gwt.event.shared.EventHandler;+import com.google.gwt.event.shared.GwtEvent;+import com.google.gwt.place.shared.Place;++/**+ * Event used to indicate that a login is required+ * Created by Richard on 24/02/2016.+ */+public class LoginRequestEvent extends GwtEvent<LoginRequestEvent.Handler> {+ public static final Type<Handler> TYPE = new Type<Handler>();+ private Place redirectPlace;++ public LoginRequestEvent(Place redirectPlace) {+ this.redirectPlace = redirectPlace;+ }++ public Place getRedirectPlace() {+ return redirectPlace;+ }++ @Override+ public Type<Handler> getAssociatedType() {+ return TYPE;+ }++ @Override+ public void dispatch(Handler handler) {+ handler.onRequestLogin(this);+ }++ public interface Handler extends EventHandler {+ void onRequestLogin(LoginRequestEvent event);+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/event/UserChangeEvent.java b/manager/src/main/java/org/openremote/manager/client/event/UserChangeEvent.javanew file mode 100644index 000000000..25788a9e1--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/event/UserChangeEvent.java@@ -0,0 +1,35 @@+package org.openremote.manager.client.event;++import com.google.gwt.event.shared.EventHandler;+import com.google.gwt.event.shared.GwtEvent;++/**+ * Event to indicate that the logged in user has changed+ * Created by Richard on 24/02/2016.+ */+public class UserChangeEvent extends GwtEvent<UserChangeEvent.Handler> {+ public static final Type<Handler> TYPE = new Type<Handler>();+ private String username;++ public UserChangeEvent(String username) {+ this.username = username;+ }++ public String getUsername() {+ return username;+ }++ @Override+ public Type<Handler> getAssociatedType() {+ return TYPE;+ }++ @Override+ public void dispatch(Handler handler) {+ handler.onUserChange(this);+ }++ public interface Handler extends EventHandler {+ void onUserChange(UserChangeEvent event);+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.java b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.javanew file mode 100644index 000000000..378c03b34--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.java@@ -0,0 +1,25 @@+package org.openremote.manager.client.i18n;++import com.google.gwt.i18n.client.Constants;+import com.google.gwt.i18n.client.LocalizableResource;++/**+ * Created by Richard on 18/02/2016.+ */[email protected]("en")+public interface ManagerConstants extends Constants {++ String appTitle();++ String loginTitle();++ String username();++ String password();++ String overviewMap();++ String assetManager();++ String logout();+}diff --git a/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.properties b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.propertiesnew file mode 100644index 000000000..4c3974c94--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerConstants.properties@@ -0,0 +1,7 @@+appTitle = OpenRemote Manager+loginTitle = Login+username = Username (admin)+password = Password (password)+overviewMap = Overview Map+assetManager = Asset Manager+logout = logout\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.javanew file mode 100644index 000000000..2c13bbc2e--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.java@@ -0,0 +1,21 @@+package org.openremote.manager.client.i18n;++import com.google.gwt.i18n.client.LocalizableResource;+import com.google.gwt.i18n.client.Messages;++/**+ * Created by Richard on 18/02/2016.+ */[email protected]("en")+public interface ManagerMessages extends Messages {++ String fieldBlank();++ String serverUnavailable();++ String serverError(int code);++ String loginFailed();++ String signedInAs(String username);+}diff --git a/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.properties b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.propertiesnew file mode 100644index 000000000..1eda4f7ce--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/i18n/ManagerMessages.properties@@ -0,0 +1,5 @@+fieldBlank = Field cannot be blank+serverUnavailable = Server is unavailable+serverError = An error occurred ({0})+loginFailed = Login failed+signedInAs = Signed in as {0}\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/presenter/AbstractActivity.java b/manager/src/main/java/org/openremote/manager/client/presenter/AbstractActivity.javaindex 0ccff47fe..7246760ae 100644--- a/manager/src/main/java/org/openremote/manager/client/presenter/AbstractActivity.java+++ b/manager/src/main/java/org/openremote/manager/client/presenter/AbstractActivity.java@@ -4,6 +4,7 @@ import com.google.gwt.activity.shared.Activity;import com.google.gwt.place.shared.Place;/**+ * Abstract activity that provides initialisation with Place passed in* Created by Richard on 11/02/2016.*/public abstract class AbstractActivity<T extends Place> extends com.google.gwt.activity.shared.AbstractActivity {diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/ActivityInitialiser.java b/manager/src/main/java/org/openremote/manager/client/presenter/ActivityInitialiser.javanew file mode 100644index 000000000..75a0b445d--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/ActivityInitialiser.java@@ -0,0 +1,21 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.activity.shared.ActivityManager;+import com.google.inject.Inject;+import com.google.inject.name.Named;+import org.openremote.manager.client.view.AppLayout;++/**+ * This maps activity managers to parts of the main view+ * Created by Richard on 12/02/2016.+ */+public class ActivityInitialiser {+ @Inject+ public ActivityInitialiser(AppLayout appLayout,+ @Named("MainContentManager") ActivityManager mainContentActivityManager,+ @Named("LeftSideManager") ActivityManager leftSideActivityManager+ ) {+ mainContentActivityManager.setDisplay(appLayout.getMainContentPanel());+ leftSideActivityManager.setDisplay(appLayout.getLeftSidePanel());+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/AssetsActivity.java b/manager/src/main/java/org/openremote/manager/client/presenter/AssetDetailActivity.javasimilarity index 81%rename from manager/src/main/java/org/openremote/manager/client/presenter/AssetsActivity.javarename to manager/src/main/java/org/openremote/manager/client/presenter/AssetDetailActivity.javaindex 3e05a4809..39a7030e5 100644--- a/manager/src/main/java/org/openremote/manager/client/presenter/AssetsActivity.java+++ b/manager/src/main/java/org/openremote/manager/client/presenter/AssetDetailActivity.java@@ -5,25 +5,26 @@ import com.google.gwt.place.shared.PlaceController;import com.google.gwt.user.client.Window;import com.google.gwt.user.client.ui.AcceptsOneWidget;import com.google.web.bindery.event.shared.EventBus;-import org.fusesource.restygwt.client.Method;import org.fusesource.restygwt.client.Resource;-import org.fusesource.restygwt.client.TextCallback;-import org.openremote.manager.client.view.AssetsView;+import org.openremote.manager.client.view.AssetDetailView;import javax.inject.Inject;-public class AssetsActivity- extends AbstractActivity<AssetsPlace>- implements AssetsView.Presenter {+/**+ * Activity for Asset Manager+ */+public class AssetDetailActivity+ extends AbstractActivity<AssetsPlace>+ implements AssetDetailView.Presenter {- final AssetsView view;+ final AssetDetailView view;final PlaceController placeController;final EventBus bus;@Inject- public AssetsActivity(AssetsView view,- PlaceController placeController,- EventBus bus) {+ public AssetDetailActivity(AssetDetailView view,+ PlaceController placeController,+ EventBus bus) {this.view = view;this.placeController = placeController;this.bus = bus;diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/AssetListActivity.java b/manager/src/main/java/org/openremote/manager/client/presenter/AssetListActivity.javanew file mode 100644index 000000000..73c25a936--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/AssetListActivity.java@@ -0,0 +1,83 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.place.shared.Place;+import com.google.gwt.place.shared.PlaceController;+import com.google.gwt.user.client.Window;+import com.google.gwt.user.client.ui.AcceptsOneWidget;+import com.google.web.bindery.event.shared.EventBus;+import org.fusesource.restygwt.client.Resource;+import org.openremote.manager.client.view.AssetDetailView;+import org.openremote.manager.client.view.AssetListView;++import javax.inject.Inject;++/**+ * Activity for Asset Manager+ */+public class AssetListActivity+ extends AbstractActivity<AssetsPlace>+ implements AssetListView.Presenter {++ final AssetListView view;+ final PlaceController placeController;+ final EventBus bus;++ @Inject+ public AssetListActivity(AssetListView view,+ PlaceController placeController,+ EventBus bus) {+ this.view = view;+ this.placeController = placeController;+ this.bus = bus;+ }++ @Override+ protected void init(AssetsPlace place) {++ }++ @Override+ public void start(AcceptsOneWidget container, com.google.gwt.event.shared.EventBus activityBus) {+ view.setPresenter(this);+ container.setWidget(view.asWidget());+ }++ @Override+ public void goTo(Place place) {+ placeController.goTo(place);+ }++ @Override+ public void getHelloText() {+// resource("hello").get().send(new TextCallback() {+// @Override+// public void onSuccess(Method method, String response) {+// view.setHelloText(response);+// }+//+// @Override+// public void onFailure(Method method, Throwable exception) {+// view.setHelloText("Request failed!");+// }+// });+ }++ protected static String hostname() {+ return Window.Location.getHostName();+ }++ protected static String port() {+ return Window.Location.getPort();+ }++ protected Resource resource(String... pathElement) {+ StringBuilder sb = new StringBuilder();+ sb.append("http://").append(hostname()).append(":").append(port());+ if (pathElement != null) {+ for (String pe : pathElement) {+ sb.append("/").append(pe);+ }+ }+ return new Resource(sb.toString());+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/HeaderPresenter.java b/manager/src/main/java/org/openremote/manager/client/presenter/HeaderPresenter.javanew file mode 100644index 000000000..780dc7305--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/HeaderPresenter.java@@ -0,0 +1,55 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.place.shared.Place;+import com.google.gwt.place.shared.PlaceController;+import com.google.inject.Inject;+import org.openremote.manager.client.service.SecurityService;+import org.openremote.manager.client.view.HeaderView;++/**+ * Created by Richard on 24/02/2016.+ */+public class HeaderPresenter implements HeaderView.Presenter {+ private HeaderView view;+ private PlaceController placeController;+ private SecurityService securityService;++ @Inject+ public HeaderPresenter(HeaderView view,+ SecurityService securityService,+ PlaceController placeController) {+ this.view = view;+ this.placeController = placeController;+ this.securityService = securityService;+ view.setPresenter(this);+ view.setUsername(securityService.getUsername());+ }++ @Override+ public HeaderView getView() {+ return view;+ }++ @Override+ public void goTo(Place place) {+ placeController.goTo(place);+ }++ @Override+ public void onPlaceChange(Place place) {+ view.onPlaceChange(place);+ }++ @Override+ public void doLogout() {+ securityService.logout();++ //Reload current place to cause login dialog to reappear+ goTo(placeController.getWhere());+ }++ @Override+ public void setUsername(String username) {+ view.setUsername(username);+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/HistoryMapper.java b/manager/src/main/java/org/openremote/manager/client/presenter/HistoryMapper.javanew file mode 100644index 000000000..022d7026b--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/HistoryMapper.java@@ -0,0 +1,16 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.place.shared.PlaceHistoryMapper;+import com.google.gwt.place.shared.WithTokenizers;++/**+ * Created by Richard on 12/02/2016.+ */+@WithTokenizers(+ {+ AssetsPlace.Tokenizer.class,+ OverviewPlace.Tokenizer.class+ }+)+public interface HistoryMapper extends PlaceHistoryMapper {+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/LeftSideActivityMapper.java b/manager/src/main/java/org/openremote/manager/client/presenter/LeftSideActivityMapper.javanew file mode 100644index 000000000..4973f0104--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/LeftSideActivityMapper.java@@ -0,0 +1,29 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.activity.shared.Activity;+import com.google.gwt.activity.shared.ActivityMapper;+import com.google.gwt.place.shared.Place;+import com.google.inject.Inject;+import com.google.inject.Provider;++/**+ * Created by Richard on 12/02/2016.+ */+public class LeftSideActivityMapper implements ActivityMapper {+ private final Provider<AssetListActivity> assetsActivityProvider;++ @Inject+ public LeftSideActivityMapper(Provider<AssetListActivity> assetsActivityProvider) {+ this.assetsActivityProvider = assetsActivityProvider;+ }++ public Activity getActivity(Place place) {+ if (place instanceof AssetsPlace) {+ AssetsPlace assetsPlace = (AssetsPlace) place;+ Activity activity = assetsActivityProvider.get().doInit(assetsPlace);+ return activity;+ }++ return null;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/LoginActivity.java b/manager/src/main/java/org/openremote/manager/client/presenter/LoginActivity.javadeleted file mode 100644index f78c778ce..000000000--- a/manager/src/main/java/org/openremote/manager/client/presenter/LoginActivity.java+++ /dev/null@@ -1,47 +0,0 @@-package org.openremote.manager.client.presenter;--import com.google.web.bindery.event.shared.EventBus;-import com.google.gwt.place.shared.Place;-import com.google.gwt.place.shared.PlaceController;-import com.google.gwt.user.client.ui.AcceptsOneWidget;-import com.google.inject.Inject;-import org.openremote.manager.client.view.LoginView;--/**- * Created by Richard on 11/02/2016.- */-public class LoginActivity extends AbstractActivity<LoginPlace> implements LoginView.Presenter {- private LoginView view;- private PlaceController placeController;- private EventBus eventBus;-- @Inject- public LoginActivity(LoginView view,- PlaceController placeController,- EventBus eventBus) {- this.view = view;- this.placeController = placeController;- this.eventBus = eventBus;- }-- @Override- protected void init(LoginPlace place) {-- }-- @Override- public void start(AcceptsOneWidget container, com.google.gwt.event.shared.EventBus eventBus) {- view.setPresenter(this);- container.setWidget(view.asWidget());- }-- @Override- public LoginView getView() {- return null;- }-- @Override- public void goTo(Place place) {-- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/LoginPlace.java b/manager/src/main/java/org/openremote/manager/client/presenter/LoginPlace.javadeleted file mode 100644index 69f1b087f..000000000--- a/manager/src/main/java/org/openremote/manager/client/presenter/LoginPlace.java+++ /dev/null@@ -1,30 +0,0 @@-package org.openremote.manager.client.presenter;--import com.google.gwt.place.shared.Place;-import com.google.gwt.place.shared.PlaceTokenizer;-import com.google.gwt.place.shared.Prefix;--/**- * Created by Richard on 10/02/2016.- */-public class LoginPlace extends Place {- private Place redirectTo;-- public LoginPlace(Place redirectTo) {- this.redirectTo = redirectTo;- }-- @Prefix("login")- public static class Tokenizer implements PlaceTokenizer<LoginPlace> {-- @Override- public LoginPlace getPlace(String token) {- return new LoginPlace(null);- }-- @Override- public String getToken(LoginPlace place) {- return "";- }- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/LoginPresenter.java b/manager/src/main/java/org/openremote/manager/client/presenter/LoginPresenter.javanew file mode 100644index 000000000..ded34ce11--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/LoginPresenter.java@@ -0,0 +1,119 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.place.shared.Place;+import com.google.gwt.place.shared.PlaceController;+import com.google.gwt.user.client.ui.AcceptsOneWidget;+import com.google.inject.Inject;+import com.google.web.bindery.event.shared.EventBus;+import com.workingflows.js.jscore.client.api.promise.Promise;+import org.fusesource.restygwt.client.Method;+import org.fusesource.restygwt.client.MethodCallback;+import org.gwtbootstrap3.client.ui.constants.AlertType;+import org.openremote.manager.client.event.UserChangeEvent;+import org.openremote.manager.client.i18n.ManagerMessages;+import org.openremote.manager.client.rest.LoginRestService;+import org.openremote.manager.client.service.SecurityService;+import org.openremote.manager.client.view.LoginView;+import org.openremote.manager.shared.model.Credentials;+import org.openremote.manager.shared.model.LoginResult;++/**+ * Created by Richard on 11/02/2016.+ */+public class LoginPresenter extends com.google.gwt.activity.shared.AbstractActivity implements LoginView.Presenter {+ private LoginView view;+ private PlaceController placeController;+ private EventBus eventBus;+ private LoginRestService loginRestService;+ private SecurityService securityService;+ private ManagerMessages messages;+ private Place redirectTo;++ @Inject+ public LoginPresenter(LoginView view,+ LoginRestService loginRestService,+ SecurityService securityService,+ PlaceController placeController,+ ManagerMessages messages,+ EventBus eventBus) {+ this.view = view;+ this.placeController = placeController;+ this.messages = messages;+ this.eventBus = eventBus;+ this.loginRestService = loginRestService;+ this.securityService = securityService;+ view.setPresenter(this);+ }++ @Override+ public void start(AcceptsOneWidget container, com.google.gwt.event.shared.EventBus eventBus) {+ view.setPresenter(this);+ container.setWidget(view.asWidget());+ }++ @Override+ public LoginView getView() {+ return view;+ }++ @Override+ public void goTo(Place place) {+ placeController.goTo(place);+ }++ @Override+ public void doLogin() {+ view.setLoginInProgress(true);++ Promise p = new Promise((resolve, reject) -> {+ Credentials credentials = new Credentials();+ credentials.setUsername(view.getUsername());+ credentials.setPassword(view.getPassword());++ // Make call to server+ loginRestService.login(credentials, new MethodCallback<LoginResult>() {+ @Override+ public void onFailure(Method method, Throwable exception) {+ reject.rejected(new LoginResult(method.getResponse().getStatusCode(), null));+ }++ @Override+ public void onSuccess(Method method, LoginResult response) {+ resolve.resolve(response);+ }+ });+ });++ p.then(obj -> {+ LoginResult result = (LoginResult) obj;+ if (result.getHttpResponse() == 200) {+ // Token and XSRF are set as cookies so no need to store manually+ eventBus.fireEvent(new UserChangeEvent(securityService.getUsername()));+ goTo(redirectTo);+ } else {+ view.showAlert(AlertType.DANGER, messages.loginFailed());+ }++ view.setLoginInProgress(false);+ return null;+ }).catchException(obj -> {+ try {+ LoginResult result = (LoginResult) obj;+ if (result.getHttpResponse() == 404) {+ view.showAlert(AlertType.DANGER, messages.serverUnavailable());+ } else {+ view.showAlert(AlertType.DANGER, messages.serverError(result.getHttpResponse()));+ }+ } catch (Exception e) {++ }++ view.setLoginInProgress(false);+ return null;+ });+ }++ public void redirectTo(Place redirectTo) {+ this.redirectTo = redirectTo;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/MainContentActivityMapper.java b/manager/src/main/java/org/openremote/manager/client/presenter/MainContentActivityMapper.javanew file mode 100644index 000000000..99ae2653e--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/MainContentActivityMapper.java@@ -0,0 +1,39 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.activity.shared.Activity;+import com.google.gwt.activity.shared.ActivityMapper;+import com.google.gwt.place.shared.Place;+import com.google.inject.Inject;+import com.google.inject.Provider;+import org.openremote.manager.client.service.SecurityService;++/**+ * Created by Richard on 12/02/2016.+ */+public class MainContentActivityMapper implements ActivityMapper {+ private final Provider<AssetDetailActivity> assetsActivityProvider;+ private final Provider<MapActivity> mapActivityProvider;+ private final Provider<LoginPresenter> loginActivityProvider;+ private final SecurityService securityService;++ @Inject+ public MainContentActivityMapper(Provider<AssetDetailActivity> assetsActivityProvider,+ Provider<MapActivity> mapActivityProvider,+ Provider<LoginPresenter> loginActivityProvider,+ SecurityService securityService) {+ this.assetsActivityProvider = assetsActivityProvider;+ this.mapActivityProvider = mapActivityProvider;+ this.loginActivityProvider = loginActivityProvider;+ this.securityService = securityService;+ }++ public Activity getActivity(Place place) {+ if (place instanceof AssetsPlace) {+ return assetsActivityProvider.get().doInit((AssetsPlace) place);+ }+ if (place instanceof OverviewPlace) {+ return mapActivityProvider.get().doInit((OverviewPlace) place);+ }+ return null;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/MapActivity.java b/manager/src/main/java/org/openremote/manager/client/presenter/MapActivity.javaindex c3afbf65a..0d6d522cd 100644--- a/manager/src/main/java/org/openremote/manager/client/presenter/MapActivity.java+++ b/manager/src/main/java/org/openremote/manager/client/presenter/MapActivity.java@@ -2,18 +2,15 @@ package org.openremote.manager.client.presenter;import com.google.gwt.place.shared.Place;import com.google.gwt.place.shared.PlaceController;-import com.google.gwt.user.client.Window;import com.google.gwt.user.client.ui.AcceptsOneWidget;import com.google.web.bindery.event.shared.EventBus;-import org.fusesource.restygwt.client.Resource;-import org.openremote.manager.client.view.AssetsView;import org.openremote.manager.client.view.MapView;import javax.inject.Inject;public class MapActivity- extends AbstractActivity<MapPlace>- implements MapView.Presenter {+ extends AbstractActivity<OverviewPlace>+ implements MapView.Presenter {final MapView view;final PlaceController placeController;@@ -29,7 +26,7 @@ public class MapActivity}@Override- protected void init(MapPlace place) {+ protected void init(OverviewPlace place) {}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/MapPlace.java b/manager/src/main/java/org/openremote/manager/client/presenter/MapPlace.javadeleted file mode 100644index b9a5e2294..000000000--- a/manager/src/main/java/org/openremote/manager/client/presenter/MapPlace.java+++ /dev/null@@ -1,22 +0,0 @@-package org.openremote.manager.client.presenter;--import com.google.gwt.place.shared.Place;-import com.google.gwt.place.shared.PlaceTokenizer;-import com.google.gwt.place.shared.Prefix;--public class MapPlace extends Place {-- @Prefix("map")- public static class Tokenizer implements PlaceTokenizer<MapPlace> {-- @Override- public MapPlace getPlace(String token) {- return new MapPlace();- }-- @Override- public String getToken(MapPlace place) {- return "";- }- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/presenter/OverviewPlace.java b/manager/src/main/java/org/openremote/manager/client/presenter/OverviewPlace.javanew file mode 100644index 000000000..f89abe987--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/presenter/OverviewPlace.java@@ -0,0 +1,22 @@+package org.openremote.manager.client.presenter;++import com.google.gwt.place.shared.Place;+import com.google.gwt.place.shared.PlaceTokenizer;+import com.google.gwt.place.shared.Prefix;++public class OverviewPlace extends Place {++ @Prefix("overview")+ public static class Tokenizer implements PlaceTokenizer<OverviewPlace> {++ @Override+ public OverviewPlace getPlace(String token) {+ return new OverviewPlace();+ }++ @Override+ public String getToken(OverviewPlace place) {+ return "";+ }+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/rest/AssetRestService.java b/manager/src/main/java/org/openremote/manager/client/rest/AssetRestService.javanew file mode 100644index 000000000..b1eeb1e8c--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/rest/AssetRestService.java@@ -0,0 +1,13 @@+package org.openremote.manager.client.rest;++import javax.ws.rs.GET;+import javax.ws.rs.Path;++/**+ * Created by Richard on 24/02/2016.+ */+public interface AssetRestService {+ @GET+ @Path("/")+ void getAssets();+}diff --git a/manager/src/main/java/org/openremote/manager/client/rest/LoginRestService.java b/manager/src/main/java/org/openremote/manager/client/rest/LoginRestService.javanew file mode 100644index 000000000..51f0e40e0--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/rest/LoginRestService.java@@ -0,0 +1,20 @@+package org.openremote.manager.client.rest;++import org.fusesource.restygwt.client.MethodCallback;+import org.fusesource.restygwt.client.RestService;+import org.openremote.manager.shared.model.Credentials;+import org.openremote.manager.shared.model.LoginResult;++import javax.ws.rs.POST;+import javax.ws.rs.Path;++/**+ * Created by Richard on 19/02/2016.+ */+public interface LoginRestService extends RestService {++ @POST+ @Path("/login")+ void login(Credentials credentials, MethodCallback<LoginResult> loginCallback);++}diff --git a/manager/src/main/java/org/openremote/manager/client/service/CookieService.java b/manager/src/main/java/org/openremote/manager/client/service/CookieService.javaindex c3761d23b..d206e39d9 100644--- a/manager/src/main/java/org/openremote/manager/client/service/CookieService.java+++ b/manager/src/main/java/org/openremote/manager/client/service/CookieService.java@@ -7,4 +7,6 @@ public interface CookieService {String getCookie(String name);void setCookie(String name, String value);++ void removeCookie(String name);}diff --git a/manager/src/main/java/org/openremote/manager/client/service/CookieServiceImpl.java b/manager/src/main/java/org/openremote/manager/client/service/CookieServiceImpl.javaindex 0bd8c6bab..65169f0c7 100644--- a/manager/src/main/java/org/openremote/manager/client/service/CookieServiceImpl.java+++ b/manager/src/main/java/org/openremote/manager/client/service/CookieServiceImpl.java@@ -15,4 +15,9 @@ public class CookieServiceImpl implements CookieService {public void setCookie(String name, String value) {Cookies.setCookie(name, value);}++ @Override+ public void removeCookie(String name) {+ Cookies.removeCookie(name);+ }}diff --git a/manager/src/main/java/org/openremote/manager/client/service/SecurityService.java b/manager/src/main/java/org/openremote/manager/client/service/SecurityService.javaindex 389aeb1b0..40ea35741 100644--- a/manager/src/main/java/org/openremote/manager/client/service/SecurityService.java+++ b/manager/src/main/java/org/openremote/manager/client/service/SecurityService.java@@ -13,4 +13,8 @@ public interface SecurityService {boolean hasToken();Date getTokenExpirationDate();++ String getXsrfToken();++ void logout();}diff --git a/manager/src/main/java/org/openremote/manager/client/service/SecurityServiceImpl.java b/manager/src/main/java/org/openremote/manager/client/service/SecurityServiceImpl.javaindex ff2b66cc4..11582add8 100644--- a/manager/src/main/java/org/openremote/manager/client/service/SecurityServiceImpl.java+++ b/manager/src/main/java/org/openremote/manager/client/service/SecurityServiceImpl.java@@ -1,8 +1,10 @@package org.openremote.manager.client.service;import com.google.inject.Inject;+import com.google.web.bindery.event.shared.EventBus;import elemental.json.Json;import elemental.json.JsonObject;+import org.openremote.manager.client.event.UserChangeEvent;import org.openremote.manager.client.util.Base64Utils;import java.util.Date;@@ -15,11 +17,14 @@ import java.util.logging.Logger;public class SecurityServiceImpl implements SecurityService {private static Logger logger = Logger.getLogger("");- protected CookieService cookieService;+ private CookieService cookieService;+ private EventBus eventBus;@Inject- protected SecurityServiceImpl(CookieService cookieService) {+ public SecurityServiceImpl(CookieService cookieService,+ EventBus eventBus) {this.cookieService = cookieService;+ this.eventBus = eventBus;}private String getToken() {@@ -31,7 +36,7 @@ public class SecurityServiceImpl implements SecurityService {String token = getToken();if (token != null) {- String[] parts = token.split(".");+ String[] parts = token.split("\\.");if (parts.length == 3) {try {@@ -50,7 +55,8 @@ public class SecurityServiceImpl implements SecurityService {@Overridepublic String getUsername() {JsonObject decoded = decodeToken();- String name = "";+ String name = null;+if (decoded.hasKey("name")) {name = decoded.getString("name");}@@ -81,11 +87,24 @@ public class SecurityServiceImpl implements SecurityService {if (decoded.hasKey("exp")) {// This is seconds since the EPOCHString expiryDateStr = decoded.getString("exp");- expiryDate = new Date(0);+ expiryDate = new Date();// Can't use calendar on client sideexpiryDate.setSeconds(Integer.parseInt(expiryDateStr));}return expiryDate;}++ @Override+ public String getXsrfToken() {+ return cookieService.getCookie("XSRF-TOKEN");+ }++ @Override+ public void logout() {+ // Destroy the token and XSRF cookies+ cookieService.removeCookie("access_token");+ cookieService.removeCookie("XSRF-TOKEN");+ eventBus.fireEvent(new UserChangeEvent(null));+ }}diff --git a/manager/src/main/java/org/openremote/manager/client/service/ValidatorService.java b/manager/src/main/java/org/openremote/manager/client/service/ValidatorService.javanew file mode 100644index 000000000..aa6dfbe46--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/service/ValidatorService.java@@ -0,0 +1,10 @@+package org.openremote.manager.client.service;++import org.gwtbootstrap3.client.ui.form.validator.Validator;++/**+ * Created by Richard on 18/02/2016.+ */+public interface ValidatorService {+ Validator getBlankFieldValidator();+}diff --git a/manager/src/main/java/org/openremote/manager/client/service/ValidatorServiceImpl.java b/manager/src/main/java/org/openremote/manager/client/service/ValidatorServiceImpl.javanew file mode 100644index 000000000..6ebd1a2af--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/service/ValidatorServiceImpl.java@@ -0,0 +1,46 @@+package org.openremote.manager.client.service;++import com.google.gwt.editor.client.Editor;+import com.google.gwt.editor.client.EditorError;+import com.google.inject.Inject;+import org.gwtbootstrap3.client.ui.form.error.BasicEditorError;+import org.gwtbootstrap3.client.ui.form.validator.Validator;+import org.openremote.manager.client.i18n.ManagerMessages;++import java.util.ArrayList;+import java.util.List;++/**+ * Created by Richard on 18/02/2016.+ */+public class ValidatorServiceImpl implements ValidatorService {++ ManagerMessages messages;++ Validator blankValidator = new Validator() {+ @Override+ public int getPriority() {+ return 0;+ }++ @Override+ public List<EditorError> validate(Editor editor, Object value) {+ List<EditorError> result = new ArrayList<EditorError>();+ String valueStr = value == null ? "" : value.toString();+ if (valueStr == null || "".equals(valueStr)) {+ result.add(new BasicEditorError(editor, value, messages.fieldBlank()));+ }+ return result;+ }+ };++ @Inject+ public ValidatorServiceImpl(ManagerMessages messages) {+ this.messages = messages;+ }++ @Override+ public Validator getBlankFieldValidator() {+ return blankValidator;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/util/Base64Utils.java b/manager/src/main/java/org/openremote/manager/client/util/Base64Utils.javaindex 6fa18beef..4d52f88c2 100644--- a/manager/src/main/java/org/openremote/manager/client/util/Base64Utils.java+++ b/manager/src/main/java/org/openremote/manager/client/util/Base64Utils.java@@ -18,7 +18,7 @@ package org.openremote.manager.client.util;/*** A utility to decode and encode byte arrays as Strings, using only "safe"* characters.- *+ * <p>* RT: This is a quick alternative to using JSNI code; copied from gwt-user.jar*/public class Base64Utils {@@ -28,7 +28,7 @@ public class Base64Utils {* represent them. Note that this is not identical to the set of characters* used by MIME-Base64.*/- private static final char[] base64Chars = new char[] {+ private static final char[] base64Chars = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N','O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b','c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',diff --git a/manager/src/main/java/org/openremote/manager/client/view/MainView.java b/manager/src/main/java/org/openremote/manager/client/view/AppLayout.javasimilarity index 56%rename from manager/src/main/java/org/openremote/manager/client/view/MainView.javarename to manager/src/main/java/org/openremote/manager/client/view/AppLayout.javaindex cceae302a..8ee0123a7 100644--- a/manager/src/main/java/org/openremote/manager/client/view/MainView.java+++ b/manager/src/main/java/org/openremote/manager/client/view/AppLayout.java@@ -4,17 +4,27 @@ import com.google.gwt.place.shared.Place;import com.google.gwt.user.client.ui.AcceptsOneWidget;import com.google.gwt.user.client.ui.IsWidget;-public interface MainView extends IsWidget {+public interface AppLayout extends IsWidget {interface Presenter {- MainView getView();+ AppLayout getView();void goTo(Place place);}void setPresenter(Presenter presenter);- void setMenu(MainMenuView mainMenu);-AcceptsOneWidget getMainContentPanel();++ AcceptsOneWidget getLeftSidePanel();++ AcceptsOneWidget getHeaderPanel();++ LoginView getLoginView();++ void showLogin();++ void hideLogin();++ void updateLayout(Place place);}diff --git a/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.java b/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.javanew file mode 100644index 000000000..40550b925--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.java@@ -0,0 +1,97 @@+package org.openremote.manager.client.view;++import com.google.gwt.core.client.GWT;+import com.google.gwt.place.shared.Place;+import com.google.gwt.uibinder.client.UiBinder;+import com.google.gwt.uibinder.client.UiField;+import com.google.gwt.user.client.ui.*;+import com.google.web.bindery.event.shared.EventBus;+import org.openremote.manager.client.i18n.ManagerConstants;+import org.openremote.manager.client.presenter.AssetsPlace;++import javax.inject.Inject;++public class AppLayoutImpl extends Composite implements AppLayout {++ interface UI extends UiBinder<HeaderPanel, AppLayoutImpl> {+ }++ private UI ui = GWT.create(UI.class);+ private HeaderPanel appLayout;+ private LoginView loginView;++ @UiField+ SimpleLayoutPanel headerPanel;++ @UiField+ SimpleLayoutPanel contentPanel;++ @UiField+ SimpleLayoutPanel leftSidePanel;++ @UiField+ SplitLayoutPanel bodyPanel;++ @UiField(provided = true)+ ManagerConstants constants;++ Presenter presenter;++ EventBus eventBus;++ @Inject+ public AppLayoutImpl(EventBus eventBus, LoginView loginView, ManagerConstants constants) {+ this.eventBus = eventBus;+ this.constants = constants;+ appLayout = ui.createAndBindUi(this);+ this.loginView = loginView;+ initWidget(appLayout);+ }++ @Override+ public void setPresenter(Presenter presenter) {+ this.presenter = presenter;+ }++ @Override+ public AcceptsOneWidget getMainContentPanel() {+ return contentPanel;+ }++ @Override+ public AcceptsOneWidget getLeftSidePanel() {+ return leftSidePanel;+ }++ @Override+ public AcceptsOneWidget getHeaderPanel() {+ return headerPanel;+ }++ @Override+ public LoginView getLoginView() {+ return loginView;+ }++ @Override+ public void showLogin() {+ loginView.show();+ appLayout.setVisible(false);+ }++ @Override+ public void hideLogin() {+ loginView.hide();+ appLayout.setVisible(true);+ }++ @Override+ public void updateLayout(Place place) {+ bodyPanel.setWidgetHidden(leftSidePanel, true);+ bodyPanel.setWidgetHidden(contentPanel, false);++ if (place instanceof AssetsPlace) {+ bodyPanel.setWidgetHidden(leftSidePanel, false);+ }+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.ui.xmlnew file mode 100644index 000000000..323f11ba6--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/AppLayoutImpl.ui.xml@@ -0,0 +1,94 @@+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"+ xmlns:g="urn:import:com.google.gwt.user.client.ui"+>++ <ui:style>+ .headerPanel {+ background-color: red;+ color: black;+ }++ .contentPanel {+ background-color: lightgreen;+ color: black;+ }++ .footerPanel {+ background-color: lightslategray;+ color: black;+ }++ .sidePanel {+ background-color: lightgoldenrodyellow;+ color: black;+ }++ .no-padding {+ padding: 0;+ }+ </ui:style>++ <ui:with field="constants" type="org.openremote.manager.client.i18n.ManagerConstants"/>++ <g:HeaderPanel>+ <g:SimpleLayoutPanel height="50px" ui:field="headerPanel" addStyleNames="{style.headerPanel}"/>+ <g:ResizeLayoutPanel width="100%" height="100%">+ <g:SplitLayoutPanel ui:field="bodyPanel">+ <g:west size="200">+ <g:SimpleLayoutPanel ui:field="leftSidePanel" addStyleNames="{style.sidePanel}"/>+ </g:west>+ <g:center>+ <g:SimpleLayoutPanel ui:field="contentPanel" addStyleNames="{style.contentPanel}"/>+ </g:center>+ </g:SplitLayoutPanel>+ </g:ResizeLayoutPanel>+ </g:HeaderPanel>++ <!--<g:DockLayoutPanel unit="EM">-->+ <!--<g:north size="5">-->+ <!--<g:SimpleLayoutPanel ui:field="headerPanel" addStyleNames="{style.headerPanel}"/>-->+ <!--</g:north>-->+ <!--<g:center>-->+ <!--<g:SplitLayoutPanel ui:field="bodyPanel">-->+ <!--<g:west size="200">-->+ <!--<g:SimpleLayoutPanel ui:field="leftSidePanel" addStyleNames="{style.sidePanel}"/>-->+ <!--</g:west>-->+ <!--<g:center>-->+ <!--<g:SimpleLayoutPanel ui:field="contentPanel" addStyleNames="{style.contentPanel}"/>-->+ <!--</g:center>-->+ <!--</g:SplitLayoutPanel>-->+ <!--</g:center>-->+ <!--</g:DockLayoutPanel>-->++ <!--<b:Container>-->+ <!--<b:Navbar position="FIXED_TOP">-->+ <!--<b:Container>-->+ <!--<b:NavbarHeader>-->+ <!--<b:NavbarBrand>OpenRemote</b:NavbarBrand>-->+ <!--<b:NavbarCollapseButton dataTarget="#navbar-collapse"/>-->+ <!--</b:NavbarHeader>-->++ <!--<b:NavbarCollapse b:id="navbar-collapse">-->+ <!--<b:NavbarNav>-->+ <!--<b:AnchorListItem ui:field="btnMap" text="{constants.overviewMap}"></b:AnchorListItem>-->+ <!--<b:AnchorListItem ui:field="btnAssets" text="{constants.assetManager}"></b:AnchorListItem>-->+ <!--</b:NavbarNav>-->++ <!--<b:NavbarText pull="RIGHT">-->+ <!--<b:html.Span>Signed in as <b:NavbarLink>John Snow</b:NavbarLink>-->+ <!--</b:html.Span>-->+ <!--</b:NavbarText>-->+ <!--</b:NavbarCollapse>-->+ <!--</b:Container>-->+ <!--</b:Navbar>-->++ <!--<g:DockLayoutPanel unit="EM">-->+ <!--<g:west size="10">-->+ <!--<g:SimpleLayoutPanel ui:field="leftSidePanel" addStyleNames="{style.sidePanel}"/>-->+ <!--</g:west>-->+ <!--<g:center>-->+ <!--<g:SimpleLayoutPanel ui:field="contentPanel" addStyleNames="{style.contentPanel}"/>-->+ <!--</g:center>-->+ <!--</g:DockLayoutPanel>-->+ <!--</b:Container>-->+</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/MainMenuView.java b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailView.javasimilarity index 66%rename from manager/src/main/java/org/openremote/manager/client/view/MainMenuView.javarename to manager/src/main/java/org/openremote/manager/client/view/AssetDetailView.javaindex 80517ec20..9b1882cb6 100644--- a/manager/src/main/java/org/openremote/manager/client/view/MainMenuView.java+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailView.java@@ -3,15 +3,12 @@ package org.openremote.manager.client.view;import com.google.gwt.place.shared.Place;import com.google.gwt.user.client.ui.IsWidget;-/**- * Created by Richard on 12/02/2016.- */-public interface MainMenuView extends IsWidget {+public interface AssetDetailView extends IsWidget {interface Presenter {- MainMenuView getView();-void goTo(Place place);++ void getHelloText();}void setPresenter(Presenter presenter);diff --git a/manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.javasimilarity index 56%rename from manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.javarename to manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.javaindex a43f98774..bb3a359a1 100644--- a/manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.java+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.java@@ -1,20 +1,15 @@package org.openremote.manager.client.view;import com.google.gwt.core.client.GWT;-import com.google.gwt.event.dom.client.ClickEvent;import com.google.gwt.uibinder.client.UiBinder;-import com.google.gwt.uibinder.client.UiField;-import com.google.gwt.uibinder.client.UiHandler;-import com.google.gwt.user.client.ui.Button;import com.google.gwt.user.client.ui.Composite;-import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.ScrollPanel;import javax.inject.Inject;-public class AssetsViewImpl extends Composite implements AssetsView {+public class AssetDetailViewImpl extends Composite implements AssetDetailView {- interface UI extends UiBinder<ScrollPanel, AssetsViewImpl> {+ interface UI extends UiBinder<ScrollPanel, AssetDetailViewImpl> {}private UI ui = GWT.create(UI.class);@@ -22,7 +17,7 @@ public class AssetsViewImpl extends Composite implements AssetsView {Presenter presenter;@Inject- public AssetsViewImpl() {+ public AssetDetailViewImpl() {initWidget(ui.createAndBindUi(this));}diff --git a/manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.ui.xmlsimilarity index 74%rename from manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.ui.xmlrename to manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.ui.xmlindex 7bc4df74e..576a844f6 100644--- a/manager/src/main/java/org/openremote/manager/client/view/AssetsViewImpl.ui.xml+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetDetailViewImpl.ui.xml@@ -2,7 +2,7 @@xmlns:g="urn:import:com.google.gwt.user.client.ui"><g:ScrollPanel>- <g:Label>ASSET MANAGER</g:Label>+ <g:Label>ASSET DETAILS</g:Label></g:ScrollPanel></ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/AssetsView.java b/manager/src/main/java/org/openremote/manager/client/view/AssetListView.javasimilarity index 84%rename from manager/src/main/java/org/openremote/manager/client/view/AssetsView.javarename to manager/src/main/java/org/openremote/manager/client/view/AssetListView.javaindex c5a0b0c67..9b61f4c2d 100644--- a/manager/src/main/java/org/openremote/manager/client/view/AssetsView.java+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetListView.java@@ -3,7 +3,7 @@ package org.openremote.manager.client.view;import com.google.gwt.place.shared.Place;import com.google.gwt.user.client.ui.IsWidget;-public interface AssetsView extends IsWidget {+public interface AssetListView extends IsWidget {interface Presenter {void goTo(Place place);diff --git a/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.javanew file mode 100644index 000000000..77178e6d0--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.java@@ -0,0 +1,28 @@+package org.openremote.manager.client.view;++import com.google.gwt.core.client.GWT;+import com.google.gwt.uibinder.client.UiBinder;+import com.google.gwt.user.client.ui.Composite;+import com.google.gwt.user.client.ui.ScrollPanel;++import javax.inject.Inject;++public class AssetListViewImpl extends Composite implements AssetListView {++ interface UI extends UiBinder<ScrollPanel, AssetListViewImpl> {+ }++ private UI ui = GWT.create(UI.class);++ Presenter presenter;++ @Inject+ public AssetListViewImpl() {+ initWidget(ui.createAndBindUi(this));+ }++ @Override+ public void setPresenter(Presenter presenter) {+ this.presenter = presenter;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.ui.xmlnew file mode 100644index 000000000..2b3182228--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/AssetListViewImpl.ui.xml@@ -0,0 +1,51 @@+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"+ xmlns:g="urn:import:com.google.gwt.user.client.ui">++ <g:ScrollPanel>+ <g:VerticalPanel>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ <g:Label>ASSET</g:Label>+ </g:VerticalPanel>+ </g:ScrollPanel>++</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/DummyViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/DummyViewImpl.ui.xmldeleted file mode 100644index e0b29ef0c..000000000--- a/manager/src/main/java/org/openremote/manager/client/view/DummyViewImpl.ui.xml+++ /dev/null@@ -1,98 +0,0 @@-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"- xmlns:g="urn:import:com.google.gwt.user.client.ui">-- <g:ScrollPanel>- <g:HTMLPanel>-- <hr/>- <g:Button ui:field="helloButton" text="Get Hello from Server"/>- <g:Label ui:field="helloLabel"/>- <hr/>-- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- <h1>Hello Dashboard!</h1>- </g:HTMLPanel>- </g:ScrollPanel>--</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/HeaderView.java b/manager/src/main/java/org/openremote/manager/client/view/HeaderView.javanew file mode 100644index 000000000..35ae88fc6--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/HeaderView.java@@ -0,0 +1,27 @@+package org.openremote.manager.client.view;++import com.google.gwt.place.shared.Place;+import com.google.gwt.user.client.ui.IsWidget;++/**+ * Created by Richard on 24/02/2016.+ */+public interface HeaderView extends IsWidget {+ interface Presenter {+ HeaderView getView();++ void goTo(Place place);++ void onPlaceChange(Place place);++ void doLogout();++ void setUsername(String username);+ }++ void setPresenter(Presenter presenter);++ void onPlaceChange(Place place);++ void setUsername(String username);+}diff --git a/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.javanew file mode 100644index 000000000..21d6efd2a--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.java@@ -0,0 +1,87 @@+package org.openremote.manager.client.view;++import com.google.gwt.core.client.GWT;+import com.google.gwt.event.dom.client.ClickEvent;+import com.google.gwt.place.shared.Place;+import com.google.gwt.uibinder.client.UiBinder;+import com.google.gwt.uibinder.client.UiField;+import com.google.gwt.uibinder.client.UiHandler;+import com.google.gwt.user.client.ui.Composite;+import com.google.inject.Inject;+import org.gwtbootstrap3.client.ui.AnchorListItem;+import org.gwtbootstrap3.client.ui.Navbar;+import org.gwtbootstrap3.client.ui.NavbarLink;+import org.gwtbootstrap3.client.ui.NavbarText;+import org.gwtbootstrap3.client.ui.html.Span;+import org.openremote.manager.client.i18n.ManagerMessages;+import org.openremote.manager.client.presenter.AssetsPlace;+import org.openremote.manager.client.presenter.OverviewPlace;++/**+ * Created by Richard on 24/02/2016.+ */+public class HeaderViewImpl extends Composite implements HeaderView {+ interface UI extends UiBinder<Navbar, HeaderViewImpl> {+ }++ private static UI ui = GWT.create(UI.class);+ private Presenter presenter;+ private ManagerMessages messages;++ @UiField+ AnchorListItem btnMap;++ @UiField+ AnchorListItem btnAssets;++ @UiField+ Span lblSignedIn;++ @UiField+ NavbarText signinText;++ @UiField+ NavbarLink btnLogout;++ @UiHandler("btnLogout")+ void logoutClicked(ClickEvent e) {+ presenter.doLogout();+ }++ @UiHandler("btnMap")+ void defaultLayoutClicked(ClickEvent e) {+ presenter.goTo(new OverviewPlace());+ }++ @UiHandler("btnAssets")+ void vmdLayoutClicked(ClickEvent e) {+ presenter.goTo(new AssetsPlace());+ }++ @Inject+ public HeaderViewImpl(ManagerMessages messages) {+ this.messages = messages;+ initWidget(ui.createAndBindUi(this));+ }++ @Override+ public void setPresenter(Presenter presenter) {+ this.presenter = presenter;+ }++ @Override+ public void onPlaceChange(Place place) {+ btnMap.setActive(place instanceof OverviewPlace);+ btnAssets.setActive(place instanceof AssetsPlace);+ }++ @Override+ public void setUsername(String username) {+ if (username != null && username.length() > 0) {+ lblSignedIn.setText(messages.signedInAs(username));+ signinText.setVisible(true);+ } else {+ signinText.setVisible(false);+ }+ }+}\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.ui.xmlnew file mode 100644index 000000000..f27c81a7a--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/HeaderViewImpl.ui.xml@@ -0,0 +1,32 @@+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'+ xmlns:b="urn:import:org.gwtbootstrap3.client.ui">++ <ui:style>+ .pad-right {+ padding-right: 5px;+ }+ </ui:style>++ <ui:with field="constants" type="org.openremote.manager.client.i18n.ManagerConstants"/>++ <b:Navbar position="STATIC_TOP">+ <b:Container width="100%">+ <b:NavbarHeader>+ <b:NavbarBrand>OpenRemote</b:NavbarBrand>+ <b:NavbarCollapseButton dataTarget="#navbar-collapse"/>+ </b:NavbarHeader>++ <b:NavbarCollapse b:id="navbar-collapse">+ <b:NavbarNav height="100%">+ <b:AnchorListItem ui:field="btnMap" text="{constants.overviewMap}"></b:AnchorListItem>+ <b:AnchorListItem ui:field="btnAssets" text="{constants.assetManager}"></b:AnchorListItem>+ </b:NavbarNav>++ <b:NavbarText pull="RIGHT" ui:field="signinText" visible="false" addStyleNames="{style.pad-right}">+ <b:html.Span ui:field="lblSignedIn" addStyleNames="{style.pad-right}"/>+ <b:NavbarLink ui:field="btnLogout" text="({constants.logout})"/>+ </b:NavbarText>+ </b:NavbarCollapse>+ </b:Container>+ </b:Navbar>+</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/LeftSideView.java b/manager/src/main/java/org/openremote/manager/client/view/LeftSideView.javanew file mode 100644index 000000000..7c3388df1--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/LeftSideView.java@@ -0,0 +1,13 @@+package org.openremote.manager.client.view;++import com.google.gwt.place.shared.Place;+import com.google.gwt.user.client.ui.IsWidget;++public interface LeftSideView extends IsWidget {++ interface Presenter {+ void goTo(Place place);+ }++ void setPresenter(Presenter presenter);+}diff --git a/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.javanew file mode 100644index 000000000..83a4a6044--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.java@@ -0,0 +1,28 @@+package org.openremote.manager.client.view;++import com.google.gwt.core.client.GWT;+import com.google.gwt.uibinder.client.UiBinder;+import com.google.gwt.user.client.ui.Composite;+import com.google.gwt.user.client.ui.ScrollPanel;++import javax.inject.Inject;++public class LeftSideViewImpl extends Composite implements LeftSideView {++ interface UI extends UiBinder<ScrollPanel, LeftSideViewImpl> {+ }++ private UI ui = GWT.create(UI.class);++ Presenter presenter;++ @Inject+ public LeftSideViewImpl() {+ initWidget(ui.createAndBindUi(this));+ }++ @Override+ public void setPresenter(Presenter presenter) {+ this.presenter = presenter;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.ui.xmlnew file mode 100644index 000000000..e64033a27--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/LeftSideViewImpl.ui.xml@@ -0,0 +1,8 @@+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"+ xmlns:g="urn:import:com.google.gwt.user.client.ui">++ <g:ScrollPanel>+ <g:Label>LEFT PANE</g:Label>+ </g:ScrollPanel>++</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/LoginView.java b/manager/src/main/java/org/openremote/manager/client/view/LoginView.javaindex bc696e179..93c76d80d 100644--- a/manager/src/main/java/org/openremote/manager/client/view/LoginView.java+++ b/manager/src/main/java/org/openremote/manager/client/view/LoginView.java@@ -1,8 +1,8 @@package org.openremote.manager.client.view;import com.google.gwt.place.shared.Place;-import com.google.gwt.user.client.ui.AcceptsOneWidget;import com.google.gwt.user.client.ui.IsWidget;+import org.gwtbootstrap3.client.ui.constants.AlertType;public interface LoginView extends IsWidget {@@ -10,9 +10,21 @@ public interface LoginView extends IsWidget {LoginView getView();void goTo(Place place);++ void doLogin();}void setPresenter(Presenter presenter);- AcceptsOneWidget getContentPanel();+ void setLoginInProgress(boolean loginInProgress);++ String getUsername();++ String getPassword();++ void show();++ void hide();++ void showAlert(AlertType alertType, String alert);}diff --git a/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.javaindex b1a7efb14..a738bf36e 100644--- a/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.java+++ b/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.java@@ -1,32 +1,65 @@package org.openremote.manager.client.view;import com.google.gwt.core.client.GWT;+import com.google.gwt.event.dom.client.ClickEvent;import com.google.gwt.uibinder.client.UiBinder;import com.google.gwt.uibinder.client.UiField;-import com.google.gwt.user.client.ui.*;+import com.google.gwt.uibinder.client.UiHandler;+import com.google.gwt.user.client.ui.Widget;+import org.gwtbootstrap3.client.ui.*;+import org.gwtbootstrap3.client.ui.constants.AlertType;+import org.gwtbootstrap3.client.ui.constants.IconType;+import org.openremote.manager.client.i18n.ManagerConstants;+import org.openremote.manager.client.service.ValidatorService;import javax.inject.Inject;-public class LoginViewImpl extends Composite implements LoginView {-- interface UI extends UiBinder<DockLayoutPanel, LoginViewImpl> {+public class LoginViewImpl implements LoginView {+ interface UI extends UiBinder<Modal, LoginViewImpl> {}private UI ui = GWT.create(UI.class);+ private Presenter presenter;+ private ValidatorService validators;++ @UiField+ Modal modal;++ @UiField+ Button btnSubmit;++ @UiField+ TextBox inputUsername;++ @UiField+ Input inputPassword;@UiField- SimpleLayoutPanel headerPanel;+ Form formLogin;@UiField- SimpleLayoutPanel contentPanel;+ Alert alertLogin;++ @UiField(provided = true)+ ManagerConstants constants;- Presenter presenter;+ @UiHandler("btnSubmit")+ void onClickSubmit(ClickEvent e) {+ if (!formLogin.validate(true)) {+ return;+ }++ presenter.doLogin();+ }@Inject- public LoginViewImpl() {- initWidget(ui.createAndBindUi(this));+ public LoginViewImpl(ManagerConstants constants, ValidatorService validators) {+ this.constants = constants;+ this.validators = validators;+ modal = ui.createAndBindUi(this);- headerPanel.add(new Label("THIS IS THE HEADER PANEL IN THE MAIN VIEW"));+ inputUsername.setValidators(validators.getBlankFieldValidator());+ inputPassword.setValidators(validators.getBlankFieldValidator());}@Override@@ -35,8 +68,53 @@ public class LoginViewImpl extends Composite implements LoginView {}@Override- public AcceptsOneWidget getContentPanel() {- return contentPanel;+ public String getUsername() {+ return inputUsername.getValue();}+ @Override+ public String getPassword() {+ return inputPassword.getValue();+ }++ @Override+ public void showAlert(AlertType alertType, String alert) {+ alertLogin.setType(alertType);+ alertLogin.setText(alert);+ alertLogin.setVisible(true);+ }++ public void hideAlert() {+ alertLogin.setVisible(false);+ }++ @Override+ public void setLoginInProgress(boolean isBusy) {+ if (isBusy) {+ btnSubmit.setIcon(IconType.SPINNER);+ btnSubmit.setIconSpin(true);+ btnSubmit.setEnabled(false);+ } else {+ btnSubmit.setIcon(null);+ btnSubmit.setIconSpin(false);+ btnSubmit.setEnabled(true);+ }+ }++ @Override+ public void hide() {+ inputUsername.setValue("");+ inputPassword.setValue("");+ modal.hide();+ }++ @Override+ public void show() {+ modal.show();+ }++ @Override+ public Widget asWidget() {+ return modal;+ }}diff --git a/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.ui.xmlnew file mode 100644index 000000000..dc1299024--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/client/view/LoginViewImpl.ui.xml@@ -0,0 +1,40 @@+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"+ xmlns:g="urn:import:com.google.gwt.user.client.ui"+ xmlns:b="urn:import:org.gwtbootstrap3.client.ui"+>++ <ui:with field="constants" type="org.openremote.manager.client.i18n.ManagerConstants"/>++ <ui:style>+ </ui:style>++ <b:Modal ui:field="modal" size="SMALL" title="{constants.loginTitle}" closable="false" dataBackdrop="STATIC"+ dataKeyboard="true" fade="true">+ <b:ModalBody>+ <b:Alert type="DANGER" ui:field="alertLogin" visible="false"></b:Alert>+ <b:Alert type="DANGER" ui:field="alertError" visible="false">+ <g:Label>An error has occurred while contacting the server</g:Label>+ </b:Alert>+ <b:Form ui:field="formLogin">+ <b:FieldSet>+ <b:FormGroup>+ <b:FormLabel showRequiredIndicator="true" for="username"+ text="{constants.username}"></b:FormLabel>+ <b:InlineHelpBlock iconType="EXCLAMATION_TRIANGLE"/>+ <b:TextBox validateOnBlur="true" allowBlank="false" ui:field="inputUsername" b:id="username"/>+ </b:FormGroup>+ <b:FormGroup>+ <b:FormLabel showRequiredIndicator="true" for="password"+ text="{constants.password}"></b:FormLabel>+ <b:InlineHelpBlock iconType="EXCLAMATION_TRIANGLE"/>+ <b:Input validateOnBlur="true" allowBlank="false" type="PASSWORD" ui:field="inputPassword"+ name="password"/>+ </b:FormGroup>+ </b:FieldSet>+ </b:Form>+ </b:ModalBody>+ <b:ModalFooter>+ <b:Button ui:field="btnSubmit" type="PRIMARY">LOGIN</b:Button>+ </b:ModalFooter>+ </b:Modal>+</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.javadeleted file mode 100644index f4bc49dba..000000000--- a/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.java+++ /dev/null@@ -1,50 +0,0 @@-package org.openremote.manager.client.view;--import com.google.gwt.core.client.GWT;-import com.google.gwt.event.dom.client.ClickEvent;-import com.google.gwt.uibinder.client.UiBinder;-import com.google.gwt.uibinder.client.UiField;-import com.google.gwt.uibinder.client.UiHandler;-import com.google.gwt.user.client.ui.Button;-import com.google.gwt.user.client.ui.Composite;-import com.google.gwt.user.client.ui.FlowPanel;-import com.google.inject.Inject;-import org.openremote.manager.client.presenter.AssetsPlace;-import org.openremote.manager.client.presenter.MapPlace;--/**- * Created by Richard on 12/02/2016.- */-public class MainMenuViewImpl extends Composite implements MainMenuView {- interface UI extends UiBinder<FlowPanel, MainMenuViewImpl> {- }-- private UI ui = GWT.create(UI.class);- private Presenter presenter;-- @UiField- Button mapButton;-- @UiField- Button assetsButton;-- @UiHandler("mapButton")- void defaultLayoutClicked(ClickEvent e) {- presenter.goTo(new MapPlace());- }-- @UiHandler("assetsButton")- void vmdLayoutClicked(ClickEvent e) {- presenter.goTo(new AssetsPlace());- }-- @Inject- public MainMenuViewImpl() {- initWidget(ui.createAndBindUi(this));- }-- @Override- public void setPresenter(Presenter presenter) {- this.presenter = presenter;- }-}diff --git a/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.ui.xmldeleted file mode 100644index 31f102b5a..000000000--- a/manager/src/main/java/org/openremote/manager/client/view/MainMenuViewImpl.ui.xml+++ /dev/null@@ -1,9 +0,0 @@-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"- xmlns:g="urn:import:com.google.gwt.user.client.ui"- xmlns:w="urn:import:org.seamless.gwt.component.client.widget">-- <g:FlowPanel>- <g:Button ui:field="mapButton" text="Map"/>- <g:Button ui:field="assetsButton" text="Assets"/>- </g:FlowPanel>-</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.java b/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.javadeleted file mode 100644index 524af3aa1..000000000--- a/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.java+++ /dev/null@@ -1,48 +0,0 @@-package org.openremote.manager.client.view;--import com.google.gwt.core.client.GWT;-import com.google.gwt.uibinder.client.UiBinder;-import com.google.gwt.uibinder.client.UiField;-import com.google.gwt.user.client.ui.*;--import javax.inject.Inject;--public class MainViewImpl extends Composite implements MainView {-- interface UI extends UiBinder<DockLayoutPanel, MainViewImpl> {- }-- private UI ui = GWT.create(UI.class);- private MainMenuView mainMenuView;-- @UiField- SimpleLayoutPanel headerPanel;-- @UiField- SimpleLayoutPanel contentPanel;-- Presenter presenter;-- @Inject- public MainViewImpl() {- initWidget(ui.createAndBindUi(this));- }-- @Override- public void setPresenter(Presenter presenter) {- this.presenter = presenter;- }-- @Override- public void setMenu(MainMenuView mainMenuView) {- this.mainMenuView = mainMenuView;- headerPanel.add(mainMenuView);- }--- @Override- public AcceptsOneWidget getMainContentPanel() {- return contentPanel;- }--}diff --git a/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.ui.xml b/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.ui.xmldeleted file mode 100644index 483d64e13..000000000--- a/manager/src/main/java/org/openremote/manager/client/view/MainViewImpl.ui.xml+++ /dev/null@@ -1,27 +0,0 @@-<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"- xmlns:g="urn:import:com.google.gwt.user.client.ui"- xmlns:w="urn:import:org.seamless.gwt.component.client.widget">-- <ui:style>- .headerPanel {- background-color: lightcyan;- color: black;- }-- .contentPanel {- background-color: lightgreen;- color: black;- }-- </ui:style>-- <g:DockLayoutPanel unit="EM">- <g:north size="5">- <g:SimpleLayoutPanel ui:field="headerPanel" addStyleNames="{style.headerPanel}"/>- </g:north>- <g:center>- <g:SimpleLayoutPanel ui:field="contentPanel" addStyleNames="{style.contentPanel}"/>- </g:center>- </g:DockLayoutPanel>--</ui:UiBinder>\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/server/service/WebService.java b/manager/src/main/java/org/openremote/manager/server/service/WebService.javaindex e803bf007..0f9f0736e 100644--- a/manager/src/main/java/org/openremote/manager/server/service/WebService.java+++ b/manager/src/main/java/org/openremote/manager/server/service/WebService.java@@ -5,14 +5,23 @@ import io.vertx.core.Handler;import io.vertx.core.Vertx;import io.vertx.core.http.HttpServer;import io.vertx.core.http.HttpServerOptions;+import io.vertx.core.http.HttpServerRequest;import io.vertx.core.http.HttpServerResponse;import io.vertx.core.json.JsonObject;+import io.vertx.ext.web.Cookie;import io.vertx.ext.web.Router;+import io.vertx.ext.web.handler.CookieHandler;import io.vertx.ext.web.handler.StaticHandler;+import io.vertx.ext.web.impl.CookieImpl;+import org.openremote.manager.server.util.JsonUtil;+import org.openremote.manager.shared.model.Credentials;+import org.openremote.manager.shared.model.LoginResult;+import java.io.IOException;import java.nio.file.Files;import java.nio.file.Path;import java.nio.file.Paths;+import java.util.logging.Level;import java.util.logging.Logger;public class WebService {@@ -78,5 +87,68 @@ public class WebService {response.end("Hello from Server, the time is: " + System.currentTimeMillis());});+ // Add cookie support+ router.route().handler(CookieHandler.create()::handle);++ // Dummy login endpoint+ router.route("/login").handler(routingContext -> {+ HttpServerRequest request = routingContext.request();+ HttpServerResponse response = routingContext.response();++ request.bodyHandler(bodyEvent -> {+ Cookie tokenCookie = routingContext.getCookie("access_token");+ Cookie xsrfCookie = routingContext.getCookie("XSRF-TOKEN");+ if (tokenCookie != null) {+ // Invalidate existing cookie+ tokenCookie.setMaxAge(0);+ }+ if (xsrfCookie != null) {+ xsrfCookie.setMaxAge(0);+ }++ LoginResult loginResult;+ try {+ Credentials credentials = JsonUtil.JSON.readValue(bodyEvent.getBytes(), Credentials.class);+ if ("admin".equals(credentials.getUsername()) && "password".equals(credentials.getPassword())) {+ if (tokenCookie == null) {+ tokenCookie = Cookie.cookie("access_token", "");+ routingContext.addCookie(tokenCookie);+ }+ if (xsrfCookie == null) {+ xsrfCookie = Cookie.cookie("XSRF-TOKEN","");+ routingContext.addCookie(xsrfCookie);+ }+ String xsrfValue = "d9b9714c-7ac0-42e0-8696-2dae95dbc33e";+ String tokenValue = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gU25vdyIsInhzcmZUb2tlbiI6ImQ5Yjk3MTRjLTdhYzAtNDJlMC04Njk2LTJkYWU5NWRiYzMzZSIsImFkbWluIjp0cnVlLCJleHAiOjI1NTYyOTd9.b1vrR5nCcd5BpPanyElsTJdgsSR4m4odX7UNpFlALHY";+ tokenCookie.setValue(tokenValue);+ tokenCookie.setMaxAge(Long.MIN_VALUE);+ xsrfCookie.setValue(xsrfValue);+ xsrfCookie.setMaxAge(Long.MIN_VALUE);+ loginResult = new LoginResult(200, tokenValue);+ } else {+ loginResult = new LoginResult(401, null);+ }+ } catch (IOException e) {+ // Invalid credentials object supplied+ loginResult = new LoginResult(400, null);+ }++ String loginResultStr = "";++ try {+ loginResultStr = JsonUtil.JSON.writeValueAsString(loginResult);+ } catch (IOException e) {+ response.setStatusCode(500);+ LOG.log(Level.SEVERE, e.getMessage());+ } finally {+ response.putHeader("content-type", "application/json");+ response.putHeader("Cache-Control", "no-cache, no-store, must-revalidate");+ response.putHeader("Expires", "0");+ response.putHeader("Pragma", "no-cache");+ response.end(loginResultStr);+ }+ });+ });+}}\ No newline at end of filediff --git a/manager/src/main/java/org/openremote/manager/shared/model/Credentials.java b/manager/src/main/java/org/openremote/manager/shared/model/Credentials.javanew file mode 100644index 000000000..57224bac7--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/shared/model/Credentials.java@@ -0,0 +1,32 @@+package org.openremote.manager.shared.model;++import javax.validation.constraints.NotNull;+import javax.validation.constraints.Size;++/**+ * Created by Richard on 18/02/2016.+ */+public class Credentials {+ private String password = null;++ private String username = null;++ @NotNull+ @Size(min = 4, max = 12)+ public String getPassword() {+ return password;+ }++ @NotNull+ public String getUsername() {+ return username;+ }++ public void setPassword(final String password) {+ this.password = password;+ }++ public void setUsername(final String username) {+ this.username = username;+ }+}diff --git a/manager/src/main/java/org/openremote/manager/shared/model/LoginResult.java b/manager/src/main/java/org/openremote/manager/shared/model/LoginResult.javanew file mode 100644index 000000000..d999267a4--- /dev/null+++ b/manager/src/main/java/org/openremote/manager/shared/model/LoginResult.java@@ -0,0 +1,33 @@+package org.openremote.manager.shared.model;++/**+ * Created by Richard on 22/02/2016.+ */+public class LoginResult {+ private int httpResponse;+ private String token;++ public LoginResult() {+ }++ public LoginResult(int httpResponse, String token) {+ this.httpResponse = httpResponse;+ this.token = token;+ }++ public int getHttpResponse() {+ return httpResponse;+ }++ public void setHttpResponse(int httpResponse) {+ this.httpResponse = httpResponse;+ }++ public String getToken() {+ return token;+ }++ public void setToken(String token) {+ this.token = token;+ }+}diff --git a/manager/src/main/resources/org/openremote/manager/Manager.gwt.xml b/manager/src/main/resources/org/openremote/manager/Manager.gwt.xmlindex 5052ba659..2095b5a3a 100644--- a/manager/src/main/resources/org/openremote/manager/Manager.gwt.xml+++ b/manager/src/main/resources/org/openremote/manager/Manager.gwt.xml@@ -13,6 +13,9 @@<inherits name="com.google.gwt.place.Place"/><inherits name="com.google.gwt.inject.Inject"/><inherits name="org.fusesource.restygwt.RestyGWT"/>+ <inherits name="org.gwtbootstrap3.GwtBootstrap3" />+ <inherits name="com.google.gwt.i18n.I18N"/>+ <inherits name="com.workingflows.js.jscore.JSCore" /><!-- ##################################################################### -->@@ -24,6 +27,8 @@<set-property name="gwt.logging.logLevel" value="FINEST"/><set-property name="gwt.logging.enabled" value="TRUE"/>+ <extend-property name="locale" values="en"/>+<!-- ##################################################################### --><source path="shared"/>diff --git a/manager/src/test/java/org/openremote/manager/test/ContextBrokerTest.java b/manager/src/test/java/org/openremote/manager/test/ContextBrokerTest.javaindex f06f50047..9d409842d 100644--- a/manager/src/test/java/org/openremote/manager/test/ContextBrokerTest.java+++ b/manager/src/test/java/org/openremote/manager/test/ContextBrokerTest.java@@ -32,12 +32,12 @@ public class ContextBrokerTest extends ServerTest {int port = 1026;RestClientOptions clientOptions = new RestClientOptions()- .setConnectTimeout(2000)- .setGlobalRequestTimeout(2000)- .setDefaultHost(host)- .setDefaultPort(port)- .setKeepAlive(false)- .setMaxPoolSize(10);+ .setConnectTimeout(2000)+ .setGlobalRequestTimeout(2000)+ .setDefaultHost(host)+ .setDefaultPort(port)+ .setKeepAlive(false)+ .setMaxPoolSize(10);ngsiClient = new NgsiClient(vertx, clientOptions);deleteAllEntities(testContext);@@ -68,35 +68,35 @@ public class ContextBrokerTest extends ServerTest {room.setId("Room123");room.setType("Room");room.addAttribute(- new Attribute("temperature", Json.createObject())- .setType("float")- .setValue(Json.create(21.3))+ new Attribute("temperature", Json.createObject())+ .setType("float")+ .setValue(Json.create(21.3)));ngsiClient.postEntity(room)- .flatMap(location -> ngsiClient.getEntity(location))- .map(entity -> {- Attribute temperature = entity.getAttribute("temperature");- testContext.assertEquals(21.3, temperature.getValue().asNumber());- temperature.setValue(Json.create(22.5));- return entity;- })- .flatMap(entity -> ngsiClient.putEntity(entity))- .flatMap(updateLocation -> ngsiClient.getEntity(updateLocation))- .finallyDo(async::complete)- .doOnError(testContext::fail)- .subscribe(resultEntity -> {- Attribute temperature = resultEntity.getAttribute("temperature");- testContext.assertEquals(22.5, temperature.getValue().asNumber());- });+ .flatMap(location -> ngsiClient.getEntity(location))+ .map(entity -> {+ Attribute temperature = entity.getAttribute("temperature");+ testContext.assertEquals(21.3, temperature.getValue().asNumber());+ temperature.setValue(Json.create(22.5));+ return entity;+ })+ .flatMap(entity -> ngsiClient.putEntity(entity))+ .flatMap(updateLocation -> ngsiClient.getEntity(updateLocation))+ .finallyDo(async::complete)+ .doOnError(testContext::fail)+ .subscribe(resultEntity -> {+ Attribute temperature = resultEntity.getAttribute("temperature");+ testContext.assertEquals(22.5, temperature.getValue().asNumber());+ });}protected void deleteAllEntities(TestContext testContext) {List<Integer> statusCodes = ngsiClient.listEntities()- .flatMap(Observable::from)- .flatMap(entity -> ngsiClient.deleteEntity(entity))- .doOnError(testContext::fail)- .toList().toBlocking().single();+ .flatMap(Observable::from)+ .flatMap(entity -> ngsiClient.deleteEntity(entity))+ .doOnError(testContext::fail)+ .toList().toBlocking().single();for (Integer statusCode : statusCodes) {testContext.assertEquals(statusCode, 204);}