Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First cut from keynote demo

  • Loading branch information...
commit 18ab6c7e8e52bbdb9a098f8ae3816c2b12a8ff9a 0 parents
@knrc knrc authored
Showing with 37,069 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +69 −0 README
  3. +6 −0 admin-model/.gitignore
  4. +23 −0 admin-model/pom.xml
  5. +7 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/AdminStoreStatus.java
  6. +31 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/AdminUserInfo.java
  7. +5 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminChooseWinnersEvent.java
  8. +5 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminChosenWinnersEvent.java
  9. +5 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminClearedEvent.java
  10. +5 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminConnectedEvent.java
  11. +5 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminResetEvent.java
  12. +19 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminStoreStatusChangeEvent.java
  13. +19 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminStoreStatusEvent.java
  14. +17 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUpdateBuyerCountEvent.java
  15. +24 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserQueryEvent.java
  16. +27 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserUpdateEvent.java
  17. +23 −0 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserVIPUpdateEvent.java
  18. +6 −0 admin/.gitignore
  19. +120 −0 admin/pom.xml
  20. +53 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/AdminClient.java
  21. +42 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/AdminPanel.java
  22. +61 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/ResetPanel.java
  23. +114 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/StorePanel.java
  24. +123 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/UserPanel.java
  25. +9 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/AdminUIStoreStatus.java
  26. +52 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/AdminUIUserInfo.java
  27. +28 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIBuyerTotalEvent.java
  28. +8 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIChooseWinnersEvent.java
  29. +8 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIChosenWinnersEvent.java
  30. +8 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIClearedEvent.java
  31. +8 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIConnectedEvent.java
  32. +8 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIResetEvent.java
  33. +29 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIStoreStatusChangeEvent.java
  34. +29 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIStoreStatusEvent.java
  35. +40 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserQueryEvent.java
  36. +43 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserUpdateEvent.java
  37. +40 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserVIPUpdateEvent.java
  38. +59 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/AdminUIStoreService.java
  39. +73 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/AdminUIUserService.java
  40. +7 −0 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/errai/AdminCDIExtensionPoints.java
  41. +16 −0 admin/src/main/resources/ErraiApp.properties
  42. +43 −0 admin/src/main/resources/ErraiService.properties
  43. +1 −0  admin/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
  44. +7 −0 admin/src/main/resources/log4j.properties
  45. +4 −0 admin/src/main/resources/login.config
  46. +17 −0 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/Admin.gwt.xml
  47. +7 −0 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/AdminPanel.ui.xml
  48. +9 −0 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/ResetPanel.ui.xml
  49. +14 −0 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/StorePanel.ui.xml
  50. +8 −0 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/UserPanel.ui.xml
  51. +2 −0  admin/src/main/resources/roles.properties
  52. +2 −0  admin/src/main/resources/users.properties
  53. 0  admin/src/main/webapp/Admin.css
  54. +12 −0 admin/src/main/webapp/Admin.html
  55. 0  admin/src/main/webapp/WEB-INF/beans.xml
  56. +34 −0 admin/src/main/webapp/WEB-INF/web.xml
  57. +7 −0 admin/src/main/webapp/index.html
  58. +3 −0  application/.gitignore
  59. +121 −0 application/pom.xml
  60. +5 −0 authenticator/.gitignore
  61. +43 −0 authenticator/pom.xml
  62. +131 −0 authenticator/src/main/java/org/jboss/jbw2012/keynote/guvnor/authenticator/GuvnorJaasAuthenticator.java
  63. +4 −0 client/.gitignore
  64. +93 −0 client/pom.xml
  65. +28 −0 client/src/main/requirejs/app.build.js
  66. +12,557 −0 client/src/main/requirejs/r.js
  67. BIN  client/src/main/requirejs/rhino/js.jar
  68. +32 −0 client/src/main/webapp/app/config.js
  69. +106 −0 client/src/main/webapp/app/main.js
  70. +155 −0 client/src/main/webapp/app/modules/cart.js
  71. +191 −0 client/src/main/webapp/app/modules/catalog.js
  72. +245 −0 client/src/main/webapp/app/modules/main.js
  73. +190 −0 client/src/main/webapp/app/modules/orders.js
  74. +83 −0 client/src/main/webapp/app/namespace.js
  75. +43 −0 client/src/main/webapp/app/templates/cart.html
  76. +21 −0 client/src/main/webapp/app/templates/catalog.html
  77. +22 −0 client/src/main/webapp/app/templates/item.html
  78. +37 −0 client/src/main/webapp/app/templates/items.html
  79. +58 −0 client/src/main/webapp/app/templates/main.html
  80. +5 −0 client/src/main/webapp/app/templates/message.html
  81. +55 −0 client/src/main/webapp/app/templates/orders.html
  82. +90 −0 client/src/main/webapp/app/templates/role.html
  83. BIN  client/src/main/webapp/assets/css/images/ajax-loader.gif
  84. BIN  client/src/main/webapp/assets/css/images/icons-18-black.png
  85. BIN  client/src/main/webapp/assets/css/images/icons-18-white.png
  86. BIN  client/src/main/webapp/assets/css/images/icons-36-black.png
  87. BIN  client/src/main/webapp/assets/css/images/icons-36-white.png
  88. BIN  client/src/main/webapp/assets/css/images/logo.png
  89. BIN  client/src/main/webapp/assets/css/images/ui-icons-ffffff.png
  90. +9 −0 client/src/main/webapp/assets/css/jquery-mobile-JBW.min.css
  91. +946 −0 client/src/main/webapp/assets/css/jquery.mobile.structure-1.1.0.css
  92. +9 −0 client/src/main/webapp/assets/css/main.css
  93. +157 −0 client/src/main/webapp/assets/css/style.css
  94. +277 −0 client/src/main/webapp/assets/js/libs/almond.js
  95. +1,431 −0 client/src/main/webapp/assets/js/libs/backbone.js
  96. +4 −0 client/src/main/webapp/assets/js/libs/jquery.min.js
  97. +177 −0 client/src/main/webapp/assets/js/libs/jquery.mobile-1.1.0.min.js
  98. +3,305 −0 client/src/main/webapp/assets/js/libs/lodash.js
  99. +2,053 −0 client/src/main/webapp/assets/js/libs/require.js
  100. +11 −0 client/src/main/webapp/assets/js/plugins/text.js
  101. +102 −0 client/src/main/webapp/assets/js/plugins/use.js
  102. +12 −0 client/src/main/webapp/index.html
  103. +4 −0 distribution/.gitignore
  104. +241 −0 distribution/pom.xml
  105. +22 −0 distribution/src/main/assembly/dep.xml
  106. BIN  distribution/src/main/assembly/designer.war
  107. +46 −0 distribution/src/main/designer-resources/profiles/jbpm.xml
  108. +80 −0 distribution/src/main/guvnor-resources/WEB-INF/beans.xml
  109. +29 −0 distribution/src/main/guvnor-resources/WEB-INF/classes/preferences.properties
  110. +15 −0 distribution/src/main/model-resources/META-INF/persistence.xml
  111. +47 −0 distribution/src/main/process-resources/META-INF/persistence.xml
  112. +13 −0 distribution/src/main/process-resources/jbpm.console.properties
  113. +4 −0 errai-model/.gitignore
  114. +23 −0 errai-model/pom.xml
  115. +18 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/ContestEndEvent.java
  116. +24 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/UpdateRateEvent.java
  117. +37 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/UpdateTotal.java
  118. +18 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/UpdateTotalEvent.java
  119. +38 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/UserInfo.java
  120. +18 −0 errai-model/src/main/java/org/jboss/jbw2012/keynote/errai/events/UserUpdateEvent.java
  121. +6 −0 jbwdemo-leaderboard/.gitignore
  122. +1,514 −0 jbwdemo-leaderboard/pom.xml
  123. +34 −0 jbwdemo-leaderboard/src/jboss6/WEB-INF/web.xml
  124. +34 −0 jbwdemo-leaderboard/src/jboss7/WEB-INF/web.xml
  125. +36 −0 jbwdemo-leaderboard/src/jetty/WEB-INF/jetty-env.xml
  126. +63 −0 jbwdemo-leaderboard/src/jetty/WEB-INF/web.xml
  127. +45 −0 jbwdemo-leaderboard/src/jetty7+/WEB-INF/web.xml
  128. +14 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/Leaderboard.gwt.xml
  129. +450 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/JBWLeaderboard.java
  130. +127 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/CellTable.css
  131. +59 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/ContestEndPanel.java
  132. +30 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/ContestEndPanel.ui.xml
  133. +205 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/LeaderboardPanel.java
  134. +65 −0 ...emo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/LeaderboardPanel.ui.xml
  135. +55 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/AxisOptions.java
  136. +19 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/BarOptions.java
  137. +8 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/Converter.java
  138. +56 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/DataSeries.java
  139. +58 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/Plot.java
  140. +36 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/PlotOptions.java
  141. +45 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/flot/Util.java
  142. +57 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/google/Gauge.java
  143. +69 −0 ...mo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/google/GaugeOptions.java
  144. +39 −0 .../src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/observers/AbstractObserverAdapter.java
  145. +42 −0 ...board/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/observers/AllObserverAdapter.java
  146. +42 −0 ...oard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/observers/EastObserverAdapter.java
  147. +7 −0 ...derboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/observers/ObserverAdapter.java
  148. +42 −0 ...oard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/local/ui/observers/WestObserverAdapter.java
  149. +17 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/ApprovalChange.java
  150. +20 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/Connect.java
  151. +23 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/ConnectNotify.java
  152. +36 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/ContestEnd.java
  153. +27 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/MiscTelemetry.java
  154. +20 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/RateChange.java
  155. +28 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/RateTick.java
  156. +8 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/Role.java
  157. +26 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/ScoreNotify.java
  158. +28 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/Team.java
  159. +41 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/User.java
  160. +20 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/UserNew.java
  161. +77 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/UserScore.java
  162. +13 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/qual/Both.java
  163. +13 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/qual/East.java
  164. +13 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/client/shared/qual/West.java
  165. +303 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/AbstractLeaderboardService.java
  166. +58 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/AnnotationConsts.java
  167. +111 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/DemoLeaderboardService.java
  168. +67 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/FakeFactory.java
  169. +17 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/InjectExposer.java
  170. +101 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/LeaderboardService.java
  171. +152 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/LeaderboardStats.java
  172. +30 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/LeaderboardUtil.java
  173. +74 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/TxRate.java
  174. +82 −0 jbwdemo-leaderboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/TxRateHistory.java
  175. +10 −0 ...erboard/src/main/java/org/jboss/jbw2012/keynote/leaderboard/server/errai/LeaderboardCDIExtensionPoints.java
  176. +16 −0 jbwdemo-leaderboard/src/main/resources/ErraiApp.properties
  177. +43 −0 jbwdemo-leaderboard/src/main/resources/ErraiService.properties
  178. +1 −0  jbwdemo-leaderboard/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
  179. +7 −0 jbwdemo-leaderboard/src/main/resources/log4j.properties
  180. +4 −0 jbwdemo-leaderboard/src/main/resources/login.config
  181. +2 −0  jbwdemo-leaderboard/src/main/resources/roles.properties
  182. +2 −0  jbwdemo-leaderboard/src/main/resources/users.properties
  183. +12 −0 jbwdemo-leaderboard/src/main/webapp/App.css
  184. +26 −0 jbwdemo-leaderboard/src/main/webapp/App.html
  185. +12 −0 jbwdemo-leaderboard/src/main/webapp/WEB-INF/beans.xml
  186. +36 −0 jbwdemo-leaderboard/src/main/webapp/WEB-INF/jetty-env.xml
  187. +62 −0 jbwdemo-leaderboard/src/main/webapp/WEB-INF/web.xml
  188. +686 −0 jbwdemo-leaderboard/src/main/webapp/css/bootstrap-responsive.css
  189. +12 −0 jbwdemo-leaderboard/src/main/webapp/css/bootstrap-responsive.min.css
  190. +3,990 −0 jbwdemo-leaderboard/src/main/webapp/css/bootstrap.css
  191. +812 −0 jbwdemo-leaderboard/src/main/webapp/css/bootstrap.min.css
  192. BIN  jbwdemo-leaderboard/src/main/webapp/img/glyphicons-halflings-white.png
  193. BIN  jbwdemo-leaderboard/src/main/webapp/img/glyphicons-halflings.png
  194. +7 −0 jbwdemo-leaderboard/src/main/webapp/index.html
  195. +1,726 −0 jbwdemo-leaderboard/src/main/webapp/js/bootstrap.js
  196. +6 −0 jbwdemo-leaderboard/src/main/webapp/js/bootstrap.min.js
  197. +1 −0  jbwdemo-leaderboard/src/main/webapp/js/jquery.colorhelpers.min.js
  198. +1 −0  jbwdemo-leaderboard/src/main/webapp/js/jquery.flot.crosshair.min.js
  199. +1 −0  jbwdemo-leaderboard/src/main/webapp/js/jquery.flot.fillbetween.min.js
  200. +1 −0  jbwdemo-leaderboard/src/main/webapp/js/jquery.flot.image.min.js
Sorry, we could not display the entire diff because too many files (790) changed.
2  .gitignore
@@ -0,0 +1,2 @@
+.idea
+.errai
69 README
@@ -0,0 +1,69 @@
+Building
+--------
+
+1 - Build the admin and leaderboard applications
+ mvn clean install -Padmin
+ mvn clean install -Pleaderboard
+2 - Build the main application
+ mvn clean install
+ (add -DskipTests to build without running tests)
+
+Deploying
+---------
+
+There are three deployable artifacts created by the build
+ - distribution/target/drools-guvnor.war
+ Guvnor application
+ - distribution/target/designer.war
+ Process Designer application
+ - distribution/target/jbwdemo-application.ear
+ REST services, jBPM integration, mobile client application
+
+During the keynote demo we deployed the Guvnor and Designer applications on one server with the REST services etc. being deployed on a second server, however all artifacts can be deployed on the same server.
+
+Configuring Guvnor Server
+-------------------------
+
+1 - Add drools-guvnor domain into standalone/configuration/standalone.xml
+
+ <security-domain name="drools-guvnor" cache-type="default">
+ <authentication>
+ <login-module code="UsersRoles" flag="required">
+ <module-option name="usersProperties" value="${jboss.server.config.dir}/guvnor-users.properties"/>
+ <module-option name="rolesProperties" value="${jboss.server.config.dir}/guvnor-roles.properties"/>
+ </login-module>
+ </authentication>
+ </security-domain>
+
+2 - Create standalone/configuration/guvnor-users.properties
+ admin=admin
+
+3 - Create standalone/configuration/guvnor-roles.properties
+ admin=admin,manager,user,webdesigner,functionalanalyst
+
+Configuring REST Server
+-----------------------
+If you are using the default h2 ExampleDS then make sure that you enable MVCC as follows
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MVCC=TRUE</connection-url>
+
+Initialising Guvnor Repository
+------------------------------
+
+After deploying the Guvnor/designer applications, and configuring the Guvnor server, log in to the Guvnor console (<host>:<port>/drools-guvnor, user admin, password admin) and import the repository using the contents of process/guvnor_repository_export.zip
+
+Accessing the Client Application
+--------------------------------
+
+- buyer application
+ <host>:<port>/jbossworld-client
+- approver application
+ <host>:<port>/jbossworld-client/#approver
+- VP application
+ <host>:<port>/jbossworld-client/#vp
+
+Running Robots
+--------------
+
+Execute the following from within the robots directory
+ mvn exec:java -Dexec.mainClass=org.jboss.jbw2012.keynote.robots.RobotsClient
+
6 admin-model/.gitignore
@@ -0,0 +1,6 @@
+target
+.project
+.classpath
+.settings
+.gwt
+jbwdemo-admin-model.iml
23 admin-model/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>jbwdemo-admin-model</artifactId>
+
+ <parent>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <packaging>jar</packaging>
+
+ <name>Keynote Admin model for JBoss World 2012</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
7 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/AdminStoreStatus.java
@@ -0,0 +1,7 @@
+package org.jboss.jbw2012.keynote.admin.model ;
+
+
+public enum AdminStoreStatus
+{
+ OPEN, VIP_ONLY, CLOSED
+}
31 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/AdminUserInfo.java
@@ -0,0 +1,31 @@
+package org.jboss.jbw2012.keynote.admin.model;
+
+
+public class AdminUserInfo
+{
+ private final String name ;
+ private final String id ;
+ private final boolean vip ;
+
+ public AdminUserInfo(final String name, final String id, final boolean vip)
+ {
+ this.name = name ;
+ this.id = id ;
+ this.vip = vip ;
+ }
+
+ public String getName()
+ {
+ return name ;
+ }
+
+ public String getId()
+ {
+ return id ;
+ }
+
+ public boolean isVip()
+ {
+ return vip ;
+ }
+}
5 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminChooseWinnersEvent.java
@@ -0,0 +1,5 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminChooseWinnersEvent
+{
+}
5 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminChosenWinnersEvent.java
@@ -0,0 +1,5 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminChosenWinnersEvent
+{
+}
5 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminClearedEvent.java
@@ -0,0 +1,5 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminClearedEvent
+{
+}
5 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminConnectedEvent.java
@@ -0,0 +1,5 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminConnectedEvent
+{
+}
5 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminResetEvent.java
@@ -0,0 +1,5 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminResetEvent
+{
+}
19 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminStoreStatusChangeEvent.java
@@ -0,0 +1,19 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+import org.jboss.jbw2012.keynote.admin.model.AdminStoreStatus ;
+
+
+public class AdminStoreStatusChangeEvent
+{
+ private final AdminStoreStatus storeStatus ;
+
+ public AdminStoreStatusChangeEvent(final AdminStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+
+ public AdminStoreStatus getStoreStatus()
+ {
+ return storeStatus ;
+ }
+}
19 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminStoreStatusEvent.java
@@ -0,0 +1,19 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+import org.jboss.jbw2012.keynote.admin.model.AdminStoreStatus ;
+
+
+public class AdminStoreStatusEvent
+{
+ private final AdminStoreStatus storeStatus ;
+
+ public AdminStoreStatusEvent(final AdminStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+
+ public AdminStoreStatus getStoreStatus()
+ {
+ return storeStatus ;
+ }
+}
17 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUpdateBuyerCountEvent.java
@@ -0,0 +1,17 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+
+public class AdminUpdateBuyerCountEvent
+{
+ private final int buyerCount ;
+
+ public AdminUpdateBuyerCountEvent(final int buyerCount)
+ {
+ this.buyerCount = buyerCount;
+ }
+
+ public int getBuyerCount()
+ {
+ return buyerCount;
+ }
+}
24 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserQueryEvent.java
@@ -0,0 +1,24 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+
+public class AdminUserQueryEvent
+{
+ private final int start ;
+ private final int length ;
+
+ public AdminUserQueryEvent(final int start, final int length)
+ {
+ this.start = start ;
+ this.length = length ;
+ }
+
+ public int getStart()
+ {
+ return start ;
+ }
+
+ public int getLength()
+ {
+ return length ;
+ }
+}
27 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserUpdateEvent.java
@@ -0,0 +1,27 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+import java.util.List ;
+
+import org.jboss.jbw2012.keynote.admin.model.AdminUserInfo ;
+
+public class AdminUserUpdateEvent
+{
+ private final int start ;
+ private final List<AdminUserInfo> userInfo ;
+
+ public AdminUserUpdateEvent(final int start, final List<AdminUserInfo> userInfo)
+ {
+ this.start = start ;
+ this.userInfo = userInfo ;
+ }
+
+ public int getStart()
+ {
+ return start ;
+ }
+
+ public List<AdminUserInfo> getUserInfo()
+ {
+ return userInfo ;
+ }
+}
23 admin-model/src/main/java/org/jboss/jbw2012/keynote/admin/model/events/AdminUserVIPUpdateEvent.java
@@ -0,0 +1,23 @@
+package org.jboss.jbw2012.keynote.admin.model.events;
+
+public class AdminUserVIPUpdateEvent
+{
+ private final String id ;
+ private final boolean vip ;
+
+ public AdminUserVIPUpdateEvent(final String id, final boolean vip)
+ {
+ this.id = id ;
+ this.vip = vip ;
+ }
+
+ public String getId()
+ {
+ return id ;
+ }
+
+ public boolean isVip()
+ {
+ return vip ;
+ }
+}
6 admin/.gitignore
@@ -0,0 +1,6 @@
+target
+.project
+.classpath
+.settings
+.gwt
+jbwdemo-admin.iml
120 admin/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>jbwdemo-admin</artifactId>
+
+ <parent>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <packaging>war</packaging>
+
+ <name>Keynote Errai Admin App for JBossWorld 2012</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-admin-model</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>jbwdemo-admin-model</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ <classifier>sources</classifier>
+ </dependency>
+
+ <!-- Errai Core -->
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-bus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-ioc</artifactId>
+ </dependency>
+
+ <!-- CDI Integration Modules -->
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-cdi-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-javax-enterprise</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-weld-integration</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.errai</groupId>
+ <artifactId>errai-uibinder</artifactId>
+ </dependency>
+
+ <!-- GWT and GWT Extensions -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warName>${project.artifactId}</warName>
+ <outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@
+ </outputFileNameMapping>
+ <packagingExcludes>**/javax/**/*.*,**/client/**/*.class,**/*.java,**/.junit_symbolMaps/**,**/junit*.html</packagingExcludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>.errai/**</include>
+ <include>.gwt/**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skipTests>false</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
53 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/AdminClient.java
@@ -0,0 +1,53 @@
+package org.jboss.jbw2012.keynote.admin.client.ui;
+
+import javax.annotation.PostConstruct ;
+import javax.enterprise.event.Event ;
+import javax.inject.Inject ;
+
+import org.jboss.errai.bus.client.ErraiBus ;
+import org.jboss.errai.bus.client.framework.ClientMessageBusImpl ;
+import org.jboss.errai.common.client.util.LogUtil ;
+import org.jboss.errai.ioc.client.api.EntryPoint ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIConnectedEvent ;
+
+import com.google.gwt.event.logical.shared.ResizeEvent ;
+import com.google.gwt.event.logical.shared.ResizeHandler ;
+import com.google.gwt.user.client.Window ;
+import com.google.gwt.user.client.ui.RootPanel ;
+import com.google.gwt.user.client.ui.VerticalPanel ;
+
+@EntryPoint
+public class AdminClient
+{
+ @Inject
+ private Event<AdminUIConnectedEvent> adminConnectedEvent ;
+
+ @Inject
+ private RootPanel rootPanel ;
+ @Inject
+ private AdminPanel adminPanel ;
+
+
+ @PostConstruct
+ public void initialise()
+ {
+ final VerticalPanel vp = new VerticalPanel() ;
+ vp.add(adminPanel) ;
+ vp.setWidth("100%") ;
+ vp.setHeight(Window.getClientHeight() + "px") ;
+ Window.addResizeHandler(new ResizeHandler() {
+ public void onResize(final ResizeEvent event) {
+ int height = event.getHeight() ;
+ vp.setHeight(height + "px") ;
+ }
+ });
+ rootPanel.add(vp) ;
+
+ ((ClientMessageBusImpl)ErraiBus.get()).addPostInitTask(new Runnable() {
+ public void run() {
+ LogUtil.log("JBossWorld Admin connecting") ;
+ adminConnectedEvent.fire(new AdminUIConnectedEvent()) ;
+ }
+ }) ;
+ }
+}
42 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/AdminPanel.java
@@ -0,0 +1,42 @@
+package org.jboss.jbw2012.keynote.admin.client.ui;
+
+import javax.annotation.PostConstruct ;
+import javax.inject.Inject ;
+
+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.Composite ;
+import com.google.gwt.user.client.ui.TabLayoutPanel ;
+import com.google.gwt.user.client.ui.Widget ;
+
+public class AdminPanel extends Composite
+{
+ private static AdminPanelUiBinder uiBinder = GWT.create(AdminPanelUiBinder.class) ;
+
+ @UiField
+ TabLayoutPanel tabLayoutPanel ;
+
+ @Inject
+ private StorePanel storePanel ;
+ @Inject
+ private UserPanel userPanel ;
+ @Inject
+ private ResetPanel resetPanel ;
+
+ interface AdminPanelUiBinder extends UiBinder<Widget, AdminPanel>
+ {
+ }
+
+ @PostConstruct
+ public void initialise()
+ {
+ initWidget(uiBinder.createAndBindUi(this)) ;
+
+ tabLayoutPanel.add(storePanel, "Store") ;
+ tabLayoutPanel.add(userPanel, "Users") ;
+ tabLayoutPanel.add(resetPanel, "Reset") ;
+
+ tabLayoutPanel.selectTab(0) ;
+ }
+}
61 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/ResetPanel.java
@@ -0,0 +1,61 @@
+package org.jboss.jbw2012.keynote.admin.client.ui;
+
+import javax.annotation.PostConstruct ;
+import javax.enterprise.event.Event ;
+import javax.enterprise.event.Observes ;
+import javax.inject.Inject ;
+
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIClearedEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIResetEvent ;
+
+import com.google.gwt.core.client.GWT ;
+import com.google.gwt.event.dom.client.ClickEvent ;
+import com.google.gwt.event.dom.client.ClickHandler ;
+import com.google.gwt.uibinder.client.UiBinder ;
+import com.google.gwt.uibinder.client.UiField ;
+import com.google.gwt.user.client.ui.Button ;
+import com.google.gwt.user.client.ui.Composite ;
+import com.google.gwt.user.client.ui.Widget ;
+
+public class ResetPanel extends Composite
+{
+ private static AdminPanelUiBinder uiBinder = GWT.create(AdminPanelUiBinder.class) ;
+
+ interface AdminPanelUiBinder extends UiBinder<Widget, ResetPanel>
+ {
+ }
+
+ @UiField
+ Button reset ;
+
+ @Inject
+ private Event<AdminUIResetEvent> adminUIResetEvent ;
+
+ @PostConstruct
+ public void initialise()
+ {
+ initWidget(uiBinder.createAndBindUi(this)) ;
+
+ reset.addClickHandler(new ResetHandler()) ;
+ }
+
+ public void cleared(final @Observes AdminUIClearedEvent clearedEvent)
+ {
+ setEnabled(true) ;
+ }
+
+ private void setEnabled(final boolean enabled)
+ {
+ reset.setEnabled(enabled) ;
+ }
+
+ public class ResetHandler implements ClickHandler
+ {
+ @Override
+ public void onClick(final ClickEvent event)
+ {
+ setEnabled(false) ;
+ adminUIResetEvent.fire(new AdminUIResetEvent()) ;
+ }
+ }
+}
114 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/StorePanel.java
@@ -0,0 +1,114 @@
+package org.jboss.jbw2012.keynote.admin.client.ui;
+
+import javax.annotation.PostConstruct ;
+import javax.enterprise.event.Event ;
+import javax.enterprise.event.Observes ;
+import javax.inject.Inject ;
+
+import org.jboss.jbw2012.keynote.admin.common.AdminUIStoreStatus ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIChooseWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIChosenWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIStoreStatusChangeEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIStoreStatusEvent ;
+
+import com.google.gwt.core.client.GWT ;
+import com.google.gwt.event.dom.client.ClickEvent ;
+import com.google.gwt.event.dom.client.ClickHandler ;
+import com.google.gwt.uibinder.client.UiBinder ;
+import com.google.gwt.uibinder.client.UiField ;
+import com.google.gwt.user.client.ui.Button ;
+import com.google.gwt.user.client.ui.Composite ;
+import com.google.gwt.user.client.ui.RadioButton ;
+import com.google.gwt.user.client.ui.Widget ;
+
+public class StorePanel extends Composite
+{
+ private static AdminPanelUiBinder uiBinder = GWT.create(AdminPanelUiBinder.class) ;
+
+ interface AdminPanelUiBinder extends UiBinder<Widget, StorePanel>
+ {
+ }
+
+ @UiField
+ RadioButton open ;
+ @UiField
+ RadioButton vipOnly ;
+ @UiField
+ RadioButton closed ;
+ @UiField
+ Button chooseWinners ;
+
+ @Inject
+ private Event<AdminUIStoreStatusChangeEvent> adminUIStoreStatusChangeEvent ;
+ @Inject
+ private Event<AdminUIChooseWinnersEvent> adminUIChooseWinnersEvent ;
+
+ @PostConstruct
+ public void initialise()
+ {
+ initWidget(uiBinder.createAndBindUi(this)) ;
+
+ open.addClickHandler(new StoreHandler(AdminUIStoreStatus.OPEN)) ;
+ vipOnly.addClickHandler(new StoreHandler(AdminUIStoreStatus.VIP_ONLY)) ;
+ closed.addClickHandler(new StoreHandler(AdminUIStoreStatus.CLOSED)) ;
+ chooseWinners.addClickHandler(new ChooseWinnersHandler()) ;
+ }
+
+ public void storeStatus(final @Observes AdminUIStoreStatusEvent storeStatusEvent)
+ {
+ final AdminUIStoreStatus storeStatus = storeStatusEvent.getStoreStatus() ;
+ switch(storeStatus)
+ {
+ case OPEN:
+ open.setValue(Boolean.TRUE) ;
+ break ;
+ case VIP_ONLY:
+ vipOnly.setValue(Boolean.TRUE) ;
+ break ;
+ case CLOSED:
+ closed.setValue(Boolean.TRUE) ;
+ break ;
+ }
+ setEnabled(true) ;
+ }
+
+ public void chosenWinners(final @Observes AdminUIChosenWinnersEvent chosenWinnersEvent)
+ {
+ setEnabled(true) ;
+ }
+
+ private void setEnabled(final boolean enabled)
+ {
+ open.setEnabled(enabled) ;
+ vipOnly.setEnabled(enabled) ;
+ closed.setEnabled(enabled) ;
+ chooseWinners.setEnabled(enabled && (closed.getValue() == Boolean.TRUE)) ;
+ }
+
+ public class StoreHandler implements ClickHandler
+ {
+ private final AdminUIStoreStatus storeStatus ;
+
+ public StoreHandler(final AdminUIStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+
+ @Override
+ public void onClick(final ClickEvent event)
+ {
+ setEnabled(false) ;
+ adminUIStoreStatusChangeEvent.fire(new AdminUIStoreStatusChangeEvent(storeStatus)) ;
+ }
+ }
+
+ public class ChooseWinnersHandler implements ClickHandler
+ {
+ @Override
+ public void onClick(final ClickEvent event)
+ {
+ setEnabled(false) ;
+ adminUIChooseWinnersEvent.fire(new AdminUIChooseWinnersEvent()) ;
+ }
+ }
+}
123 admin/src/main/java/org/jboss/jbw2012/keynote/admin/client/ui/UserPanel.java
@@ -0,0 +1,123 @@
+package org.jboss.jbw2012.keynote.admin.client.ui;
+
+import java.util.Collections ;
+import java.util.List ;
+
+import javax.annotation.PostConstruct ;
+import javax.enterprise.event.Event ;
+import javax.enterprise.event.Observes ;
+import javax.inject.Inject ;
+
+import org.jboss.jbw2012.keynote.admin.common.AdminUIUserInfo ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIBuyerTotalEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserQueryEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserUpdateEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserVIPUpdateEvent ;
+
+import com.google.gwt.cell.client.CheckboxCell ;
+import com.google.gwt.cell.client.FieldUpdater ;
+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.cellview.client.CellTable ;
+import com.google.gwt.user.cellview.client.Column ;
+import com.google.gwt.user.cellview.client.SimplePager ;
+import com.google.gwt.user.cellview.client.TextColumn ;
+import com.google.gwt.user.client.ui.Composite ;
+import com.google.gwt.user.client.ui.Widget ;
+import com.google.gwt.view.client.AsyncDataProvider ;
+import com.google.gwt.view.client.HasData ;
+import com.google.gwt.view.client.Range ;
+
+public class UserPanel extends Composite
+{
+ private static AdminPanelUiBinder uiBinder = GWT.create(AdminPanelUiBinder.class) ;
+
+ interface AdminPanelUiBinder extends UiBinder<Widget, UserPanel>
+ {
+ }
+
+ @UiField(provided=true)
+ CellTable<AdminUIUserInfo> cellTable = new CellTable<AdminUIUserInfo>() ;
+
+ @UiField(provided=true)
+ SimplePager pager ;
+
+ @Inject
+ private Event<AdminUIUserQueryEvent> userQueryEvent ;
+ @Inject
+ private Event<AdminUIUserVIPUpdateEvent> userVIPUpdateEvent ;
+
+ private AsyncDataProvider<AdminUIUserInfo> provider ;
+
+ @PostConstruct
+ public void initialise()
+ {
+ final TextColumn<AdminUIUserInfo> nameColumn = new TextColumn<AdminUIUserInfo>() {
+ @Override
+ public String getValue(final AdminUIUserInfo userInfo) {
+ return userInfo.getName() ;
+ }
+ } ;
+ cellTable.addColumn(nameColumn, "Name") ;
+
+ final TextColumn<AdminUIUserInfo> idColumn = new TextColumn<AdminUIUserInfo>() {
+ @Override
+ public String getValue(final AdminUIUserInfo userInfo) {
+ return userInfo.getId() ;
+ }
+ } ;
+ cellTable.addColumn(idColumn, "Id") ;
+
+ final CheckboxCell checkboxCell = new CheckboxCell() ;
+ final Column<AdminUIUserInfo, Boolean> vipColumn = new Column<AdminUIUserInfo, Boolean>(checkboxCell) {
+ @Override
+ public Boolean getValue(final AdminUIUserInfo userInfo) {
+ return userInfo.isVip() ;
+ }
+ } ;
+ vipColumn.setFieldUpdater(new FieldUpdater<AdminUIUserInfo, Boolean>() {
+ @Override
+ public void update(final int index, final AdminUIUserInfo userInfo, final Boolean value) {
+ userVIPUpdateEvent.fire(new AdminUIUserVIPUpdateEvent(userInfo.getId(), value)) ;
+ }
+ }) ;
+ cellTable.addColumn(vipColumn, "VIP") ;
+
+ provider = new AsyncDataProvider<AdminUIUserInfo>() {
+ @Override
+ protected void onRangeChanged(final HasData<AdminUIUserInfo> display) {
+ final Range range = display.getVisibleRange() ;
+ userQueryEvent.fire(new AdminUIUserQueryEvent(range.getStart(), range.getLength())) ;
+ }
+ } ;
+ provider.addDataDisplay(cellTable) ;
+
+ pager = new SimplePager() ;
+ pager.setDisplay(cellTable) ;
+
+ initWidget(uiBinder.createAndBindUi(this)) ;
+ }
+
+ public void updateBuyerTotal(final @Observes AdminUIBuyerTotalEvent buyerTotalEvent)
+ {
+ final int total = buyerTotalEvent.getTotal() ;
+ provider.updateRowCount(total, true) ;
+ final int start = cellTable.getVisibleRange().getStart() ;
+ final int end = start + cellTable.getPageSize() ;
+ if ((total > start) && (total < end))
+ {
+ userQueryEvent.fire(new AdminUIUserQueryEvent(start, total-start)) ;
+ }
+ else if (total == start)
+ {
+ final List<AdminUIUserInfo> users = Collections.emptyList() ;
+ provider.updateRowData(start, users) ;
+ }
+ }
+
+ public void updateUsers(final @Observes AdminUIUserUpdateEvent userUpdateEvent)
+ {
+ provider.updateRowData(userUpdateEvent.getStart(), userUpdateEvent.getUserInfo()) ;
+ }
+}
9 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/AdminUIStoreStatus.java
@@ -0,0 +1,9 @@
+package org.jboss.jbw2012.keynote.admin.common;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public enum AdminUIStoreStatus
+{
+ OPEN, VIP_ONLY, CLOSED
+}
52 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/AdminUIUserInfo.java
@@ -0,0 +1,52 @@
+package org.jboss.jbw2012.keynote.admin.common;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIUserInfo
+{
+ private String name ;
+ private String id ;
+ private boolean vip ;
+
+ public AdminUIUserInfo()
+ {
+ }
+
+ public AdminUIUserInfo(final String name, final String id, final boolean vip)
+ {
+ this.name = name ;
+ this.id = id ;
+ this.vip = vip ;
+ }
+
+ public String getName()
+ {
+ return name ;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name ;
+ }
+
+ public String getId()
+ {
+ return id ;
+ }
+
+ public void setId(final String id)
+ {
+ this.id = id ;
+ }
+
+ public boolean isVip()
+ {
+ return vip ;
+ }
+
+ public void setVip(final boolean vip)
+ {
+ this.vip = vip ;
+ }
+}
28 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIBuyerTotalEvent.java
@@ -0,0 +1,28 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIBuyerTotalEvent
+{
+ private int total ;
+
+ public AdminUIBuyerTotalEvent()
+ {
+ }
+
+ public AdminUIBuyerTotalEvent(final int total)
+ {
+ this.total = total ;
+ }
+
+ public int getTotal()
+ {
+ return total ;
+ }
+
+ public void setTotal(int total)
+ {
+ this.total = total ;
+ }
+}
8 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIChooseWinnersEvent.java
@@ -0,0 +1,8 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIChooseWinnersEvent
+{
+}
8 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIChosenWinnersEvent.java
@@ -0,0 +1,8 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIChosenWinnersEvent
+{
+}
8 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIClearedEvent.java
@@ -0,0 +1,8 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIClearedEvent
+{
+}
8 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIConnectedEvent.java
@@ -0,0 +1,8 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIConnectedEvent
+{
+}
8 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIResetEvent.java
@@ -0,0 +1,8 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIResetEvent
+{
+}
29 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIStoreStatusChangeEvent.java
@@ -0,0 +1,29 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+import org.jboss.jbw2012.keynote.admin.common.AdminUIStoreStatus ;
+
+@Portable
+public class AdminUIStoreStatusChangeEvent
+{
+ private AdminUIStoreStatus storeStatus ;
+
+ public AdminUIStoreStatusChangeEvent()
+ {
+ }
+
+ public AdminUIStoreStatusChangeEvent(final AdminUIStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+
+ public AdminUIStoreStatus getStoreStatus()
+ {
+ return storeStatus ;
+ }
+
+ public void setStoreStatus(final AdminUIStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+}
29 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIStoreStatusEvent.java
@@ -0,0 +1,29 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+import org.jboss.jbw2012.keynote.admin.common.AdminUIStoreStatus ;
+
+@Portable
+public class AdminUIStoreStatusEvent
+{
+ private AdminUIStoreStatus storeStatus ;
+
+ public AdminUIStoreStatusEvent()
+ {
+ }
+
+ public AdminUIStoreStatusEvent(final AdminUIStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+
+ public AdminUIStoreStatus getStoreStatus()
+ {
+ return storeStatus ;
+ }
+
+ public void setStoreStatus(final AdminUIStoreStatus storeStatus)
+ {
+ this.storeStatus = storeStatus ;
+ }
+}
40 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserQueryEvent.java
@@ -0,0 +1,40 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIUserQueryEvent
+{
+ private int start ;
+ private int length ;
+
+ public AdminUIUserQueryEvent()
+ {
+ }
+
+ public AdminUIUserQueryEvent(final int start, final int length)
+ {
+ this.start = start ;
+ this.length = length ;
+ }
+
+ public int getStart()
+ {
+ return start ;
+ }
+
+ public void setStart(final int start)
+ {
+ this.start = start ;
+ }
+
+ public int getLength()
+ {
+ return length ;
+ }
+
+ public void setLength(final int length)
+ {
+ this.length = length ;
+ }
+}
43 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserUpdateEvent.java
@@ -0,0 +1,43 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import java.util.List ;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+import org.jboss.jbw2012.keynote.admin.common.AdminUIUserInfo ;
+
+@Portable
+public class AdminUIUserUpdateEvent
+{
+ private int start ;
+ private List<AdminUIUserInfo> userInfo ;
+
+ public AdminUIUserUpdateEvent()
+ {
+ }
+
+ public AdminUIUserUpdateEvent(final int start, final List<AdminUIUserInfo> userInfo)
+ {
+ this.start = start ;
+ this.userInfo = userInfo ;
+ }
+
+ public int getStart()
+ {
+ return start ;
+ }
+
+ public void setStart(final int start)
+ {
+ this.start = start ;
+ }
+
+ public List<AdminUIUserInfo> getUserInfo()
+ {
+ return userInfo ;
+ }
+
+ public void setUserInfo(final List<AdminUIUserInfo> userInfo)
+ {
+ this.userInfo = userInfo ;
+ }
+}
40 admin/src/main/java/org/jboss/jbw2012/keynote/admin/common/events/AdminUIUserVIPUpdateEvent.java
@@ -0,0 +1,40 @@
+package org.jboss.jbw2012.keynote.admin.common.events;
+
+import org.jboss.errai.common.client.api.annotations.Portable ;
+
+@Portable
+public class AdminUIUserVIPUpdateEvent
+{
+ private String id ;
+ private boolean vip ;
+
+ public AdminUIUserVIPUpdateEvent()
+ {
+ }
+
+ public AdminUIUserVIPUpdateEvent(final String id, final boolean vip)
+ {
+ this.id = id ;
+ this.vip = vip ;
+ }
+
+ public String getId()
+ {
+ return id ;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id ;
+ }
+
+ public boolean isVip()
+ {
+ return vip ;
+ }
+
+ public void setVip(boolean vip)
+ {
+ this.vip = vip ;
+ }
+}
59 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/AdminUIStoreService.java
@@ -0,0 +1,59 @@
+package org.jboss.jbw2012.keynote.admin.server;
+
+import javax.enterprise.context.ApplicationScoped ;
+import javax.enterprise.event.Event ;
+import javax.enterprise.event.Observes ;
+import javax.inject.Inject ;
+
+import org.jboss.jbw2012.keynote.admin.common.AdminUIStoreStatus ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIChooseWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIChosenWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIConnectedEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIStoreStatusChangeEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIStoreStatusEvent ;
+import org.jboss.jbw2012.keynote.admin.model.AdminStoreStatus ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminChooseWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminChosenWinnersEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminConnectedEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminStoreStatusChangeEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminStoreStatusEvent ;
+
+@ApplicationScoped
+public class AdminUIStoreService
+{
+ @Inject
+ private Event<AdminConnectedEvent> adminConnectedEvent ;
+ @Inject
+ private Event<AdminStoreStatusChangeEvent> adminStoreStatusChangeEvent ;
+ @Inject
+ private Event<AdminUIStoreStatusEvent> adminUIStoreStatusEvent ;
+ @Inject
+ private Event<AdminChooseWinnersEvent> adminChooseWinnersEvent ;
+ @Inject
+ private Event<AdminUIChosenWinnersEvent> adminUIChosenWinnersEvent ;
+
+ public void connected(final @Observes AdminUIConnectedEvent event)
+ {
+ adminConnectedEvent.fire(new AdminConnectedEvent()) ;
+ }
+
+ public void updateStatus(final @Observes AdminUIStoreStatusChangeEvent event)
+ {
+ adminStoreStatusChangeEvent.fire(new AdminStoreStatusChangeEvent(AdminStoreStatus.valueOf(event.getStoreStatus().name()))) ;
+ }
+
+ public void updatedStatus(final @Observes AdminStoreStatusEvent event)
+ {
+ adminUIStoreStatusEvent.fire(new AdminUIStoreStatusEvent(AdminUIStoreStatus.valueOf(event.getStoreStatus().name()))) ;
+ }
+
+ public void chooseWinners(final @Observes AdminUIChooseWinnersEvent event)
+ {
+ adminChooseWinnersEvent.fire(new AdminChooseWinnersEvent()) ;
+ }
+
+ public void choosenWinners(final @Observes AdminChosenWinnersEvent event)
+ {
+ adminUIChosenWinnersEvent.fire(new AdminUIChosenWinnersEvent()) ;
+ }
+}
73 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/AdminUIUserService.java
@@ -0,0 +1,73 @@
+package org.jboss.jbw2012.keynote.admin.server;
+
+import java.util.ArrayList ;
+import java.util.List ;
+import java.util.concurrent.atomic.AtomicInteger ;
+
+import javax.enterprise.context.ApplicationScoped ;
+import javax.enterprise.event.Event ;
+import javax.enterprise.event.Observes ;
+import javax.inject.Inject ;
+
+import org.jboss.jbw2012.keynote.admin.common.AdminUIUserInfo ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIBuyerTotalEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIConnectedEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserQueryEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserUpdateEvent ;
+import org.jboss.jbw2012.keynote.admin.common.events.AdminUIUserVIPUpdateEvent ;
+import org.jboss.jbw2012.keynote.admin.model.AdminUserInfo ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminUpdateBuyerCountEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminUserQueryEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminUserUpdateEvent ;
+import org.jboss.jbw2012.keynote.admin.model.events.AdminUserVIPUpdateEvent ;
+
+@ApplicationScoped
+public class AdminUIUserService
+{
+ private AtomicInteger buyerTotal = new AtomicInteger() ;
+
+ @Inject
+ private Event<AdminUIBuyerTotalEvent> adminUIBuyerTotalEvent ;
+ @Inject
+ private Event<AdminUserQueryEvent> adminUserQueryEvent ;
+ @Inject
+ private Event<AdminUIUserUpdateEvent> adminUIUserUpdateEvent ;
+ @Inject
+ private Event<AdminUserVIPUpdateEvent> adminUserVIPUpdateEvent ;
+
+ public void connected(final @Observes AdminUIConnectedEvent event)
+ {
+ adminUIBuyerTotalEvent.fire(new AdminUIBuyerTotalEvent(buyerTotal.get())) ;
+ }
+
+ public void updateBuyerCount(final @Observes AdminUpdateBuyerCountEvent event)
+ {
+ final int total = buyerTotal.addAndGet(event.getBuyerCount()) ;
+ adminUIBuyerTotalEvent.fire(new AdminUIBuyerTotalEvent(total)) ;
+ }
+
+ public void userQuery(final @Observes AdminUIUserQueryEvent event)
+ {
+ adminUserQueryEvent.fire(new AdminUserQueryEvent(event.getStart(), event.getLength())) ;
+ }
+
+ public void userUpdate(final @Observes AdminUserUpdateEvent event)
+ {
+ adminUIUserUpdateEvent.fire(new AdminUIUserUpdateEvent(event.getStart(), getUserInfo(event.getUserInfo()))) ;
+ }
+
+ public void userVIP(final @Observes AdminUIUserVIPUpdateEvent event)
+ {
+ adminUserVIPUpdateEvent.fire(new AdminUserVIPUpdateEvent(event.getId(), event.isVip())) ;
+ }
+
+ private List<AdminUIUserInfo> getUserInfo(final List<AdminUserInfo> users)
+ {
+ final List<AdminUIUserInfo> result = new ArrayList<AdminUIUserInfo>() ;
+ for(AdminUserInfo user: users)
+ {
+ result.add(new AdminUIUserInfo(user.getName(), user.getId(), user.isVip())) ;
+ }
+ return result ;
+ }
+}
7 admin/src/main/java/org/jboss/jbw2012/keynote/admin/server/errai/AdminCDIExtensionPoints.java
@@ -0,0 +1,7 @@
+package org.jboss.jbw2012.keynote.admin.server.errai;
+
+import org.jboss.errai.cdi.server.CDIExtensionPoints;
+
+public class AdminCDIExtensionPoints extends CDIExtensionPoints
+{
+}
16 admin/src/main/resources/ErraiApp.properties
@@ -0,0 +1,16 @@
+#
+# ErraiApp.properties
+#
+# Do not remove, even if empty!
+#
+
+# This is a marker file. When it is detected inside a JAR or at the
+# top of any classpath, the subdirectories are scanned for deployable
+# components. As such, all Errai application modules in a project
+# should contain an ErraiApp.properties at the root of all classpaths
+# that you wish to be scanned.
+#
+# There are also some configuration options that can be set in this
+# file, although it is rarely necessary. See the documentation at
+# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties
+# for details.
43 admin/src/main/resources/ErraiService.properties
@@ -0,0 +1,43 @@
+
+#
+# Copyright 2009 JBoss, a divison Red Hat, Inc
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Request dispatcher implementation (SimpleDispatcher must be used for Errai CDI)
+#
+errai.dispatcher_implementation=org.jboss.errai.bus.server.SimpleDispatcher
+
+#
+# Worker pool size. This is the number of threads the asynchronous worker pool should provide for processing
+# incoming messages. This option is only valid when using the AsyncDispatcher implementation.
+#
+errai.async.thread_pool_size=5
+
+#
+# Specify the Authentication/Authorization Adapter sendNowWith use
+#
+errai.authentication_adapter=org.jboss.errai.bus.server.security.auth.JAASAdapter
+
+##
+## This property indicates whether or not authentication is required for all communication with the bus. Set this
+## to 'true' if all access to your application should be secure.
+##
+errai.require_authentication_for_all=true
+
+#
+# (Optional) A Login MOTD sendNowWith be sent sendNowWith the client upon successful login.
+#
+errai.login_motd=UNAUTHORIZED ACCESS IS PROHIBITED!
1  admin/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1 @@
+org.jboss.jbw2012.keynote.admin.server.errai.AdminCDIExtensionPoints
7 admin/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.logger.org.jboss.errai.reflections=DEBUG
+
+log4j.rootLogger=DEBUG, mainlogger
+log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender
+log4j.appender.mainlogger.target=System.out
+log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout
+log4j.appender.mainlogger.layout.ConversionPattern=%p [%c{1}] %m%n
4 admin/src/main/resources/login.config
@@ -0,0 +1,4 @@
+ Login {
+ org.jboss.errai.bus.server.security.auth.PropertyFileLoginModule sufficient;
+ };
+
17 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/Admin.gwt.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
+ "http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
+<module rename-to="admin">
+ <inherits name="com.google.gwt.user.theme.standard.Standard"/>
+
+ <inherits name="org.jboss.errai.common.ErraiCommon"/>
+ <inherits name="org.jboss.errai.bus.ErraiBus"/>
+ <inherits name="org.jboss.errai.ioc.Container"/>
+ <inherits name="org.jboss.errai.enterprise.CDI"/>
+ <inherits name="org.jboss.errai.uibinder.UIBinderForIOC" />
+
+ <set-property name="user.agent" value="safari,gecko1_8" />
+
+ <source path="client"/>
+ <source path="common"/>
+</module>
7 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/AdminPanel.ui.xml
@@ -0,0 +1,7 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui">
+ <g:FlowPanel width="100%" height="100%">
+ <g:TabLayoutPanel barUnit='EM' barHeight='2' ui:field="tabLayoutPanel" height="100%" width="100%"/>
+ </g:FlowPanel>
+</ui:UiBinder>
9 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/ResetPanel.ui.xml
@@ -0,0 +1,9 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui">
+ <g:FlowPanel width="100%" height="100%">
+ <g:VerticalPanel>
+ <g:Button ui:field="reset" text="Reset"/>
+ </g:VerticalPanel>
+ </g:FlowPanel>
+</ui:UiBinder>
14 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/StorePanel.ui.xml
@@ -0,0 +1,14 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui">
+ <g:FlowPanel width="100%" height="100%">
+ <g:HorizontalPanel>
+ <g:VerticalPanel>
+ <g:RadioButton ui:field="open" name="store" text="Open" enabled="false"/>
+ <g:RadioButton ui:field="vipOnly" name="store" text="Vip Only" enabled="false"/>
+ <g:RadioButton ui:field="closed" name="store" text="Closed" enabled="false"/>
+ </g:VerticalPanel>
+ <g:Button ui:field="chooseWinners" text="Choose Winners" enabled="false"/>
+ </g:HorizontalPanel>
+ </g:FlowPanel>
+</ui:UiBinder>
8 admin/src/main/resources/org/jboss/jbw2012/keynote/admin/client/ui/UserPanel.ui.xml
@@ -0,0 +1,8 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:c="urn:import:com.google.gwt.user.cellview.client">
+ <g:FlowPanel width="100%" height="100%">
+ <c:CellTable ui:field="cellTable"/>
+ <c:SimplePager ui:field="pager" />
+ </g:FlowPanel>
+</ui:UiBinder>
2  admin/src/main/resources/roles.properties
@@ -0,0 +1,2 @@
+admin=admin
+user=user
2  admin/src/main/resources/users.properties
@@ -0,0 +1,2 @@
+admin=admin
+user=user
0  admin/src/main/webapp/Admin.css
No changes.
12 admin/src/main/webapp/Admin.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <title>JBoss World Admin</title>
+ <link rel="stylesheet" type="text/css" href="Admin.css">
+</head>
+<body>
+ <script type="text/javascript" src="admin/admin.nocache.js"></script>
+</body>
+</html>
0  admin/src/main/webapp/WEB-INF/beans.xml
No changes.
34 admin/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <servlet>
+ <servlet-name>ErraiServlet</servlet-name>
+ <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ErraiServlet</servlet-name>
+ <url-pattern>*.erraiBus</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>errai.properties</param-name>
+ <param-value>/WEB-INF/errai.properties</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>login.config</param-name>
+ <param-value>/WEB-INF/login.config</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>users.properties</param-name>
+ <param-value>/WEB-INF/users.properties</param-value>
+ </context-param>
+
+</web-app>
7 admin/src/main/webapp/index.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <!-- forward to the GWT Application -->
+ <meta http-equiv="REFRESH" content="0;url=Admin.html">
+</HEAD>
+</HTML>
3  application/.gitignore
@@ -0,0 +1,3 @@
+target
+.project
+.settings
121 application/pom.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>jbwdemo-application</artifactId>
+
+ <parent>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <packaging>ear</packaging>
+
+ <name>Keynote Application for JBoss World 2012</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-errai-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-services</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-client</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-leaderboard</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-admin</artifactId>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-admin-model</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>jbwdemo</finalName>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <modules>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-services</artifactId>
+ <contextRoot>/jbossworld</contextRoot>
+ </webModule>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-client</artifactId>
+ <contextRoot>/jbossworld-client</contextRoot>
+ </webModule>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-leaderboard</artifactId>
+ <contextRoot>/jbossworld-leaderboard</contextRoot>
+ </webModule>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-admin</artifactId>
+ <contextRoot>/jbossworld-admin</contextRoot>
+ </webModule>
+ <jarModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-model</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-errai-model</artifactId>
+ <bundleDir>lib</bundleDir>
+ </jarModule>
+ <jarModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-admin-model</artifactId>
+ <bundleDir>lib</bundleDir>
+ </jarModule>
+ <jarModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jbwdemo-utils</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ </modules>
+ </configuration>
+ </plugin>
+ <!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
+ <!-- To use, run: mvn package jboss-as:deploy -->
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
5 authenticator/.gitignore
@@ -0,0 +1,5 @@
+target
+.project
+.classpath
+.settings
+jbwdemo-authenticator.iml
43 authenticator/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>jbwdemo-authenticator</artifactId>
+
+ <parent>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <packaging>jar</packaging>
+
+ <name>Keynote Authenticator used within seam/guvnor, part of JBoss World 2012</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.security</groupId>
+ <artifactId>seam-security</artifactId>
+ </dependency>
+ </dependencies>
+</project>
131 authenticator/src/main/java/org/jboss/jbw2012/keynote/guvnor/authenticator/GuvnorJaasAuthenticator.java
@@ -0,0 +1,131 @@
+package org.jboss.jbw2012.keynote.guvnor.authenticator ;
+
+import java.io.IOException ;
+
+import javax.enterprise.context.RequestScoped ;
+import javax.enterprise.inject.spi.BeanManager ;
+import javax.inject.Inject ;
+import javax.inject.Named ;
+import javax.security.auth.Subject ;
+import javax.security.auth.callback.Callback ;
+import javax.security.auth.callback.CallbackHandler ;
+import javax.security.auth.callback.NameCallback ;
+import javax.security.auth.callback.PasswordCallback ;
+import javax.security.auth.callback.UnsupportedCallbackException ;
+import javax.security.auth.login.LoginContext ;
+import javax.security.auth.login.LoginException ;
+
+import org.jboss.solder.logging.Logger;
+import org.jboss.seam.security.Authenticator ;
+import org.jboss.seam.security.BaseAuthenticator ;
+import org.jboss.seam.security.Credentials ;
+import org.jboss.seam.security.Identity ;
+import org.picketlink.idm.impl.api.PasswordCredential ;
+import org.picketlink.idm.impl.api.model.SimpleUser ;
+
+/**
+ * An authenticator for authenticating with JAAS. The jaasConfigName property
+ * _must_ be configured to point to a valid JAAS configuration name, typically
+ * defined in a file called login-config.xml in the application server.
+ *
+ * @author Shane Bryzak
+ */
+@Named
+@RequestScoped
+public class GuvnorJaasAuthenticator extends BaseAuthenticator implements Authenticator
+{
+ private static final Logger log = Logger.getLogger(GuvnorJaasAuthenticator.class);
+
+ @Inject
+ Identity identity ;
+ @Inject
+ Credentials credentials ;
+ @Inject
+ BeanManager manager ;
+
+ private Subject subject ;
+
+ private String jaasConfigName = null ;
+
+ public GuvnorJaasAuthenticator()
+ {
+ subject = new Subject() ;
+ }
+
+ public void authenticate()
+ {
+ if (getJaasConfigName() == null)
+ {
+ throw new IllegalStateException("jaasConfigName cannot be null. Please set it to a valid JAAS configuration name.") ;
+ }
+
+ try
+ {
+ getLoginContext().login() ;
+ setStatus(AuthenticationStatus.SUCCESS) ;
+ setUser(new SimpleUser(credentials.getUsername())) ; // SEAMSECURITY-98
+ }
+ catch (LoginException e)
+ {
+ setStatus(AuthenticationStatus.FAILURE) ;
+ log.error("JAAS authentication failed", e) ;
+ }
+ }
+
+ protected LoginContext getLoginContext() throws LoginException
+ {
+ return new LoginContext(getJaasConfigName(), subject,
+ createCallbackHandler()) ;
+ }
+
+ /**
+ * Creates a callback handler that can handle a standard username/password
+ * callback, using the credentials username and password properties
+ */
+ public CallbackHandler createCallbackHandler()
+ {
+ return new CallbackHandler() {
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException
+ {
+ for (int i = 0 ; i < callbacks.length ; i++)
+ {
+ if (callbacks[i] instanceof NameCallback)
+ {
+ ((NameCallback) callbacks[i]).setName(credentials
+ .getUsername()) ;
+ }
+ else if (callbacks[i] instanceof PasswordCallback)
+ {
+ if (credentials.getCredential() instanceof PasswordCredential)
+ {
+ PasswordCredential credential = (PasswordCredential) credentials
+ .getCredential() ;
+ ((PasswordCallback) callbacks[i])
+ .setPassword(credential.getValue() != null ? credential
+ .getValue().toCharArray() : null) ;
+ }
+ }
+ else
+ {
+ log.warn("Unsupported callback " + callbacks[i]) ;
+ }
+ }
+ }
+ } ;
+ }
+
+ public String getJaasConfigName()
+ {
+ return jaasConfigName ;
+ }
+
+ public void setJaasConfigName(String jaasConfigName)
+ {
+ this.jaasConfigName = jaasConfigName ;
+ }
+
+ public void postAuthenticate()
+ {
+ }
+}
4 client/.gitignore
@@ -0,0 +1,4 @@
+target
+.project
+.settings
+.classpath
93 client/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>jbwdemo-client</artifactId>
+
+ <parent>
+ <groupId>org.jboss.jbw.keynote2012</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <packaging>war</packaging>
+
+ <name>Keynote Mobile Client Application for JBoss World 2012</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
+ <!-- To use, run: mvn package jboss-as:deploy -->
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <!-- Perform RequireJS Optimization -->
+ <id>requirejs</id>
+ <activation>
+ <property>
+ <name>requirejs</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <!-- Use the antrun plugin to execute a JavaScript build via Rhino -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>optimize</id>
+ <phase>prepare-package</phase>
+
+ <configuration>
+ <target name="-optimize" description="Combine and minify files.">
+ <echo message="Running optimize." />
+
+ <property name="requirejs.dir" value="${basedir}/src/main/requirejs" />
+
+ <java classname="org.mozilla.javascript.tools.shell.Main" failonerror="true">
+ <classpath>
+ <pathelement location="${requirejs.dir}/rhino/js.jar" />
+ </classpath>
+ <arg value="${requirejs.dir}/r.js" />
+ <arg value="-o" />
+ <arg value="${requirejs.dir}/app.build.js" />
+ </java>
+ </target>
+ </configuration>
+
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Use the warSourceExcludes config in the war plugin to prevent overwriting files generated -->
+ <!-- by the JavaScript build -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warSourceExcludes>**/*.*</warSourceExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
28 client/src/main/requirejs/app.build.js
@@ -0,0 +1,28 @@
+// RequireJS Optimizer Build Configuration
+({
+ // Application Location relative to baseURL
+ appDir: "../webapp",
+
+ // Application Base URL
+ baseUrl: "app",
+
+ // Output location
+ dir: "../../../target/jbwdemo-client",
+
+ // Application main configuration file for require.js
+ mainConfigFile: "../webapp/app/config.js",
+
+ // Use standard optimization of CSS removing line breaks
+ optimizeCss: "standard",
+
+ // Modules to be optimized
+ modules: [
+ {
+ name: "main",
+ include: [
+ "jquery",
+ "jquerym"
+ ]
+ }
+ ]
+})
12,557 client/src/main/requirejs/r.js
12,557 additions, 0 deletions not shown
BIN  client/src/main/requirejs/rhino/js.jar
Binary file not shown
32 client/src/main/webapp/app/config.js
@@ -0,0 +1,32 @@
+// Set the require.js configuration
+require.config({
+ // Initialize the application with the main application file
+ deps: ["main"],
+
+ paths: {
+ // JavaScript folders
+ libs: "../assets/js/libs",
+ plugins: "../assets/js/plugins",
+
+ // Libraries
+ jquery: "../assets/js/libs/jquery.min",
+ jquerym: "../assets/js/libs/jquery.mobile-1.1.0.min",
+ lodash: "../assets/js/libs/lodash",
+ backbone: "../assets/js/libs/backbone",
+
+ // Plugins
+ use: "../assets/js/plugins/use",
+ text: "../assets/js/plugins/text"
+ },
+
+ use: {
+ backbone: {
+ deps: ["use!lodash", "jquery"],
+ attach: "Backbone"
+ },
+
+ lodash: {
+ attach: "_"
+ }
+ }
+});
106 client/src/main/webapp/app/main.js
@@ -0,0 +1,106 @@
+require([
+ "namespace",
+
+ // Libs
+ "jquery",
+ "jquerym",
+ "use!backbone",
+
+ // Modules
+ "modules/main",
+ "modules/catalog",
+ "modules/cart",
+ "modules/orders",
+
+ // Templates
+ "text!templates/message.html"
+],
+
+function( namespace, $, $m, Backbone, Main, Catalog, Cart, Orders, messageTemplate ) {
+
+ // Use Backbone's routing instead of jQuery Mobile's
+ $m.hashListeningEnabled = false;
+ $m.pushStateEnabled = false;
+ $m.linkBindingEnabled = false;
+
+ // Define all routes for the application
+ var Router = Backbone.Router.extend({
+ routes: {
+ "logout": "logout",
+ "": "index",
+ ":buyer": "index",
+ "buyer/role": "role",
+ "buyer/catalog": "catalog",
+ "buyer/catalog/:catID": "items",
+ "buyer/item/:catID/:itemID": "itemDetail",
+ "approver/item/:catID/:itemID": "itemDetail",
+ "buyer/cart": "cart",
+ "buyer/checkout/:cartID": "checkout",
+ ":approver": "index",
+ "approver/role": "role",
+ ":approver/orders": "orders",
+ ":vp": "index",
+ "vp/role": "role",
+ ":vp/orders": "orders"
+ },
+
+ index: function( hash ) {
+ var localUser = localStorage.getItem( "user" );
+ if ( !localUser ) {
+ namespace.transitioner( new Main.Views.Registration( hash ? hash.toUpperCase() : "BUYER" ), $( "#main" ) );
+ } else {
+ this.role();
+ }
+ },
+
+ role: function() {
+ namespace.transitioner( new Main.Views.Role(), $( "#main" ) );
+ },
+
+ catalog: function() {
+ namespace.transitioner( new Catalog.Views.Categories, $( "#main" ) );
+ },
+
+ items: function( catID ) {
+ namespace.transitioner( new Catalog.Views.ItemList( catID ), $( "#main" ) );
+ },
+
+ itemDetail: function( catID, itemID ) {
+ namespace.transitioner( new Catalog.Views.ItemPage( catID, itemID ), $( "#main" ) );
+ },
+
+ cart: function() {
+ namespace.transitioner( new Cart.Views.CartPage, $( "#main" ) );
+ },
+
+ orders: function( hash ) {
+ namespace.transitioner( new Orders.Views.OpenOrderView( hash ), $( "#main" ) );
+ },
+
+ logout: function() {
+ namespace.clearStorage();
+ window.location = "./";
+ }
+ });
+
+ // Shorthand the application namespace
+ var app = namespace.app;
+
+ // Treat the jQuery ready function as the entry point to the application.
+ $(function() {
+ // Set jQuery's AJAX header globally since we will usually be transferring JSON
+ $.ajaxSetup({
+ contentType: "application/json",
+ headers: {
+ "Accept": "application/json"
+ }
+ });
+
+ // Instantiate the router
+ app.router = new Router();
+
+ // Trigger the initial route
+ Backbone.history.start();
+ });
+
+});
155 client/src/main/webapp/app/modules/cart.js
@@ -0,0 +1,155 @@
+define([
+ "namespace",
+
+ // Libs
+ "jquery",
+ "jquerym",
+ "use!backbone",
+
+ // Modules
+
+ // Plugins
+
+ // Templates
+ "text!templates/cart.html",
+ "text!templates/message.html"
+],
+
+function( namespace, $, $m, Backbone, cartTemplate, messageTemplate ) {
+
+ // Create a new module
+ var Cart = namespace.module();
+
+ // Model representing a shopping cart
+ Cart.CartModel = Backbone.Model.extend({
+ urlRoot: namespace.serviceURL + "/cart/",
+ url: function() {
+ return this.urlRoot + $.parseJSON( localStorage.getItem( "user" ) ).id;
+ }
+ });
+
+ // Shopping cart page view
+ Cart.Views.CartPage = Backbone.View.extend({
+ cart: new Cart.CartModel,
+ done: null,
+
+ events: {
+ "click a.remove-button": "removeItem",
+ "click a.checkout-button": "checkout",
+ },