Permalink
Browse files

initial commit

  • Loading branch information...
1 parent e6575c5 commit b9d1e635826dac4e78587134004fe3d5beef866a InterCommIT committed Jun 24, 2011
Showing with 6,397 additions and 0 deletions.
  1. +127 −0 pom.xml
  2. +49 −0 src/main/java/nl/intercommit/weaves/base/BasicClientElement.java
  3. +140 −0 src/main/java/nl/intercommit/weaves/components/DropDownMenu.java
  4. +261 −0 src/main/java/nl/intercommit/weaves/components/EditableSelectBox.java
  5. +63 −0 src/main/java/nl/intercommit/weaves/components/Grid.java
  6. +140 −0 src/main/java/nl/intercommit/weaves/components/HoverLink.java
  7. +149 −0 src/main/java/nl/intercommit/weaves/components/ModalBox.java
  8. +350 −0 src/main/java/nl/intercommit/weaves/components/PagedGrid.java
  9. +149 −0 src/main/java/nl/intercommit/weaves/components/PagedGridPager.java
  10. +121 −0 src/main/java/nl/intercommit/weaves/components/PopupWindow.java
  11. +69 −0 src/main/java/nl/intercommit/weaves/components/Switch.java
  12. +177 −0 src/main/java/nl/intercommit/weaves/components/TextMarker.java
  13. +40 −0 src/main/java/nl/intercommit/weaves/grid/CollectionFilter.java
  14. +212 −0 src/main/java/nl/intercommit/weaves/grid/CollectionPagedGridDataSource.java
  15. +95 −0 src/main/java/nl/intercommit/weaves/grid/HibernatePagedGridDataSource.java
  16. +72 −0 src/main/java/nl/intercommit/weaves/grid/PagedGridDataSource.java
  17. +12 −0 src/main/java/nl/intercommit/weaves/hibernate/HibernateMultiSessionManager.java
  18. +69 −0 src/main/java/nl/intercommit/weaves/hibernate/HibernateMultiSessionManagerImpl.java
  19. +40 −0 src/main/java/nl/intercommit/weaves/hibernate/SessionFactoryConfiguration.java
  20. +16 −0 src/main/java/nl/intercommit/weaves/hibernate/SessionFactorySource.java
  21. +120 −0 src/main/java/nl/intercommit/weaves/hibernate/SessionFactorySourceImpl.java
  22. +47 −0 src/main/java/nl/intercommit/weaves/menu/MenuItem.java
  23. +55 −0 src/main/java/nl/intercommit/weaves/mixins/Confirm.java
  24. +53 −0 src/main/java/nl/intercommit/weaves/services/WeavesModule.java
  25. +78 −0 src/main/java/nl/intercommit/weaves/util/HoverlinkStreamResponse.java
  26. +7 −0 src/main/resources/META-INF/MANIFEST.MF
  27. +96 −0 src/main/resources/nl/intercommit/weaves/components/DropDownMenu.css
  28. +227 −0 src/main/resources/nl/intercommit/weaves/components/DropDownMenu.js
  29. +38 −0 src/main/resources/nl/intercommit/weaves/components/DropDownMenu.tml
  30. +6 −0 src/main/resources/nl/intercommit/weaves/components/PagedGrid.css
  31. +1 −0 src/main/resources/nl/intercommit/weaves/components/PagedGrid.properties
  32. +25 −0 src/main/resources/nl/intercommit/weaves/components/PagedGrid.tml
  33. +5 −0 src/main/resources/nl/intercommit/weaves/components/PagedGridPager.properties
  34. +88 −0 src/main/resources/nl/intercommit/weaves/components/PagedGridScript.js
  35. +42 −0 src/main/resources/nl/intercommit/weaves/components/PopupWindow.js
  36. +8 −0 src/main/resources/nl/intercommit/weaves/components/PopupWindow.tml
  37. +12 −0 src/main/resources/nl/intercommit/weaves/components/Switch.tml
  38. +5 −0 src/main/resources/nl/intercommit/weaves/components/TextMarker.css
  39. +4 −0 src/main/resources/nl/intercommit/weaves/components/TextMarker.tml
  40. +11 −0 src/main/resources/nl/intercommit/weaves/components/editableselect/EditableSelect.css
  41. +116 −0 src/main/resources/nl/intercommit/weaves/components/editableselect/EditableSelect.js
  42. +4 −0 src/main/resources/nl/intercommit/weaves/components/hoverlink/HoverLink.css
  43. +1,147 −0 src/main/resources/nl/intercommit/weaves/components/hoverlink/Hoverlink.js
  44. BIN src/main/resources/nl/intercommit/weaves/components/hoverlink/hover_close.jpg
  45. +7 −0 src/main/resources/nl/intercommit/weaves/components/hoverlink/hoverlink_css.properties
  46. +136 −0 src/main/resources/nl/intercommit/weaves/components/modal/builder.js
  47. +82 −0 src/main/resources/nl/intercommit/weaves/components/modal/modalbox.css
  48. +515 −0 src/main/resources/nl/intercommit/weaves/components/modal/modalbox.js
  49. +23 −0 src/main/resources/nl/intercommit/weaves/components/modal/modalboxinit.js
  50. BIN src/main/resources/nl/intercommit/weaves/components/next_page.png
  51. BIN src/main/resources/nl/intercommit/weaves/components/next_page_disabled.png
  52. BIN src/main/resources/nl/intercommit/weaves/components/prev_page.png
  53. BIN src/main/resources/nl/intercommit/weaves/components/prev_page_disabled.png
  54. BIN src/main/resources/nl/intercommit/weaves/components/refresh.png
  55. +15 −0 src/main/resources/nl/intercommit/weaves/mixins/Confirm.js
  56. +39 −0 src/test/java/nl/intercommit/tapestry/TestConfirm.java
  57. +47 −0 src/test/java/nl/intercommit/tapestry/TestDropDownMenu.java
  58. +50 −0 src/test/java/nl/intercommit/tapestry/TestEditableSelect.java
  59. +39 −0 src/test/java/nl/intercommit/tapestry/TestHoverlink.java
  60. +41 −0 src/test/java/nl/intercommit/tapestry/TestModalBox.java
  61. +45 −0 src/test/java/nl/intercommit/tapestry/TestPagedGrid.java
  62. +44 −0 src/test/java/nl/intercommit/tapestry/TestPopupWindow.java
  63. +56 −0 src/test/java/nl/intercommit/tapestry/TestSwitch.java
  64. +42 −0 src/test/java/nl/intercommit/tapestry/TestTextMarker.java
  65. +16 −0 src/test/java/nl/intercommit/tapestry/grid/TestCollectionFilter.java
  66. +104 −0 src/test/java/nl/intercommit/tapestry/grid/TestGridSourceFilter.java
  67. +21 −0 src/test/java/nl/intercommit/tapestry/test/beans/Box.java
  68. +33 −0 src/test/java/nl/intercommit/tapestry/test/entities/Person.java
  69. +5 −0 src/test/java/nl/intercommit/tapestry/test/pages/ConfirmPage.java
  70. +56 −0 src/test/java/nl/intercommit/tapestry/test/pages/DropDownMenuPage.java
  71. +21 −0 src/test/java/nl/intercommit/tapestry/test/pages/EditableSelectPage.java
  72. +15 −0 src/test/java/nl/intercommit/tapestry/test/pages/HoverLinkPage.java
  73. +15 −0 src/test/java/nl/intercommit/tapestry/test/pages/ModalBoxPage.java
  74. +51 −0 src/test/java/nl/intercommit/tapestry/test/pages/PagedGridPage.java
  75. +12 −0 src/test/java/nl/intercommit/tapestry/test/pages/PopupWindowPage.java
  76. +18 −0 src/test/java/nl/intercommit/tapestry/test/pages/SwitchPage.java
  77. +21 −0 src/test/java/nl/intercommit/tapestry/test/pages/TextMarkerPage.java
  78. +30 −0 src/test/java/nl/intercommit/tapestry/test/services/InterCommitTestModule.java
  79. +27 −0 src/test/java/nl/intercommit/tapestry/util/TestHoverlinkStreamResponse.java
  80. +63 −0 src/test/java/util/HibernateUtil.java
  81. +18 −0 src/test/resources/factory1.cfg.xml
  82. +50 −0 src/test/resources/log4j.xml
  83. +10 −0 src/test/resources/nl/intercommit/tapestry/test/pages/ConfirmPage.tml
  84. +7 −0 src/test/resources/nl/intercommit/tapestry/test/pages/DropDownMenuPage.tml
  85. +16 −0 src/test/resources/nl/intercommit/tapestry/test/pages/EditableSelectPage.tml
  86. +5 −0 src/test/resources/nl/intercommit/tapestry/test/pages/HoverLinkPage.tml
  87. +13 −0 src/test/resources/nl/intercommit/tapestry/test/pages/ModalBoxPage.tml
  88. +11 −0 src/test/resources/nl/intercommit/tapestry/test/pages/PagedGridPage.tml
  89. +7 −0 src/test/resources/nl/intercommit/tapestry/test/pages/PopupWindowPage.tml
  90. +19 −0 src/test/resources/nl/intercommit/tapestry/test/pages/SwitchPage.tml
  91. +6 −0 src/test/resources/nl/intercommit/tapestry/test/pages/TextMarkerPage.tml
View
127 pom.xml
@@ -0,0 +1,127 @@
+<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>
+ <groupId>nl.intercommit</groupId>
+ <artifactId>weaves</artifactId>
+ <name>InterCommIT Tapestry 5.2 Component Library</name>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <description>A Tapestry 5.2 module featuring components and multiple database support</description>
+
+ <organization>
+ <name>InterCommIT b.v.</name>
+ <url>http://www.intercommit.nl</url>
+ </organization>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-core</artifactId>
+ <version>5.2.4</version>
+ <type>jar</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.5.6-Final</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>slf4j-api</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.5.6-Final</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tapestry</groupId>
+ <artifactId>tapestry-test</artifactId>
+ <version>5.2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <!--
+ http://tapestry.1045711.n5.nabble.com/ANNOUNCE-ChenilleKit-1-3-2-which-support-Tapestry-5-2-4-td3383473.html
+ -->
+ <dependency>
+ <groupId>org.chenillekit</groupId>
+ <artifactId>chenillekit-tapestry</artifactId>
+ <version>1.3.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>tapestry-core</artifactId>
+ <groupId>org.apache.tapestry</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>tapestry-upload</artifactId>
+ <groupId>org.apache.tapestry</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>tapestry-func</artifactId>
+ <groupId>org.apache.tapestry</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>tapestry-ioc</artifactId>
+ <groupId>org.apache.tapestry</groupId>
+ </exclusion>
+ </exclusions>
+
+ </dependency>
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Tapestry-Module-Classes>nl.intercommit.tapestry.services.InterCommitModule</Tapestry-Module-Classes>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,49 @@
+/* Copyright 2011 InterCommIT b.v.
+*
+* This file is part of the "Weaves" project hosted on https://github.com/intercommit/Weaves
+*
+* Weaves is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* any later version.
+*
+* Weaves 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 Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with Weaves. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+package nl.intercommit.weaves.base;
+
+import org.apache.tapestry5.BindingConstants;
+import org.apache.tapestry5.ClientElement;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
+
+public abstract class BasicClientElement implements ClientElement {
+
+ private String assignedClientId;
+
+ @Parameter(value = "prop:componentResources.id", defaultPrefix = BindingConstants.LITERAL)
+ private String clientId;
+
+ @Environmental
+ private JavaScriptSupport javascriptSupport;
+
+ @SuppressWarnings("unused")
+ private void setupRender() {
+ assignedClientId = javascriptSupport.allocateClientId(clientId);
+ }
+
+ @Override
+ public String getClientId() {
+ return assignedClientId;
+ }
+
+
+
+}
@@ -0,0 +1,140 @@
+/* Copyright 2011 InterCommIT b.v.
+*
+* This file is part of the "Weaves" project hosted on https://github.com/intercommit/Weaves
+*
+* Weaves is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* any later version.
+*
+* Weaves 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 Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with Weaves. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+package nl.intercommit.weaves.components;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import nl.intercommit.weaves.menu.MenuItem;
+
+import org.apache.tapestry5.annotations.Import;
+import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.annotations.SetupRender;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.javascript.JavaScriptSupport;
+
+@Import(library="DropDownMenu.js",stylesheet="DropDownMenu.css")
+public class DropDownMenu {
+
+ public final static String MENU_ITEM_SELECTED = "selectmenuitem";
+
+ // linkedhashmaps to preserve ordering!
+ @Parameter(required=true,allowNull=false)
+ private LinkedHashMap<MenuItem,LinkedHashMap<MenuItem, List<MenuItem>>> menu;
+
+ @Inject
+ private JavaScriptSupport js;
+
+ @Inject
+ private Request request;
+
+ @Property
+ private MenuItem level1;
+
+ @Property
+ private MenuItem level2;
+
+ @Property
+ private MenuItem level3;
+
+ @SetupRender
+ private void initJavaScript() {
+ js.addScript("initMenu();", "");
+ }
+
+ public List<MenuItem> getMenuBar() {
+ if (getHasLevel1()) {
+ return Arrays.asList((MenuItem[])menu.keySet().toArray(new MenuItem[0]));
+ } else {
+ return new ArrayList<MenuItem>();
+ }
+ }
+
+ public List<MenuItem> getMenuItems() {
+ if (getHasLevel2()) {
+ return Arrays.asList((MenuItem[])menu.get(level1).keySet().toArray(new MenuItem[0]));
+ } else {
+ return new ArrayList<MenuItem>();
+ }
+ }
+
+ public List<MenuItem> getSubMenus() {
+ if (getHasLevel3()) {
+ return Arrays.asList((MenuItem[])menu.get(level1).get(level2).toArray(new MenuItem[0]));
+ } else {
+ return new ArrayList<MenuItem>();
+ }
+ }
+
+ public boolean getHasLevel1() {
+ return menu.keySet() != null;
+ }
+
+ public boolean getHasLevel2() {
+ if (getHasLevel1()) {
+ return menu.get(level1).keySet() != null;
+ }
+ return false;
+ }
+
+ public boolean getHasLevel3() {
+ if (getHasLevel2()) {
+ return menu.get(level1).get(level2) != null ;
+ }
+ return false;
+ }
+
+ public String getSelectedClass() {
+ String className= "none";
+ for (MenuItem topLevel: menu.keySet()) {
+ if (matchesRequest(topLevel,topLevel)) {
+ return "toplevelselected";
+ }
+ for (MenuItem level2: menu.get(topLevel).keySet()) {
+ if (matchesRequest(level2,topLevel)) {
+ return "toplevelselected";
+ }
+ if (menu.get(topLevel).get(level2) !=null ) {
+
+ for (Object level3: menu.get(topLevel).get(level2).toArray()) {
+ if (matchesRequest((MenuItem)level3,topLevel)) {
+ return "toplevelselected";
+ }
+ }
+ }
+ }
+ }
+ return className;
+ }
+
+ private boolean matchesRequest(final MenuItem menu,final MenuItem currentLevel) {
+
+ String reqPath = request.getPath();
+ if (!request.getContextPath().equals("")) {
+ reqPath = request.getContextPath() + reqPath;
+ }
+ return (menu.getUrl().getBasePath().startsWith(reqPath) &&
+ currentLevel == level1) ;
+ }
+
+}
Oops, something went wrong.

0 comments on commit b9d1e63

Please sign in to comment.