Explorar el Código

End lines with LF instead of CRLF

tags/release-1.3.2
Manuel Carrasco Moñino hace 11 años
padre
commit
1313f0c028
Se han modificado 100 ficheros con 9098 adiciones y 9098 borrados
  1. 197
    197
      archetype/src/main/resources/archetype-resources/pom.xml
  2. 1
    1
      archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml
  3. 28
    28
      archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java
  4. 3
    3
      archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java
  5. 1
    1
      devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml
  6. 2022
    2022
      devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
  7. 148
    148
      devtest/src/main/java/com/google/gwt/query/client/MyTestCase.java
  8. 9
    9
      devtest/src/main/java/com/google/gwt/query/public/test.html
  9. 27
    27
      gwtquery-core-2.0.1/src/main/java/com/google/gwt/core/client/JsArrayMixed.java
  10. 3
    3
      gwtquery-core-2.0.1/src/main/java/com/google/gwt/query/linker/IFrameWithDocTypeLinker.java
  11. 112
    112
      gwtquery-core-2.0.1/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorCssToXPath.java
  12. 141
    141
      gwtquery-core/src/main/java/com/google/gwt/query/Query.gwt.xml
  13. 72
    72
      gwtquery-core/src/main/java/com/google/gwt/query/QueryMin.gwt.xml
  14. 49
    49
      gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
  15. 4656
    4656
      gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
  16. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/Lazy.java
  17. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/LazyBase.java
  18. 224
    224
      gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
  19. 11
    11
      gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java
  20. 187
    187
      gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java
  21. 31
    31
      gwtquery-core/src/main/java/com/google/gwt/query/client/Selector.java
  22. 72
    72
      gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java
  23. 61
    61
      gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java
  24. 12
    12
      gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
  25. 31
    31
      gwtquery-core/src/main/java/com/google/gwt/query/client/builders/Name.java
  26. 81
    81
      gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java
  27. 21
    21
      gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java
  28. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java
  29. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java
  30. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java
  31. 6
    6
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java
  32. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java
  33. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java
  34. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java
  35. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java
  36. 6
    6
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java
  37. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java
  38. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java
  39. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java
  40. 135
    135
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java
  41. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java
  42. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java
  43. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java
  44. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java
  45. 5
    5
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssProperty.java
  46. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java
  47. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java
  48. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java
  49. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java
  50. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java
  51. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java
  52. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java
  53. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java
  54. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java
  55. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java
  56. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/HasCssValue.java
  57. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java
  58. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/Length.java
  59. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java
  60. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java
  61. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java
  62. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java
  63. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java
  64. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java
  65. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java
  66. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/MultipleValueCssSetter.java
  67. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java
  68. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineProperty.java
  69. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java
  70. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java
  71. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java
  72. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java
  73. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java
  74. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java
  75. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/SimpleCssSetter.java
  76. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesCssValue.java
  77. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesInteger.java
  78. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesLength.java
  79. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesNumber.java
  80. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java
  81. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java
  82. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java
  83. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java
  84. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java
  85. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/UriValue.java
  86. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java
  87. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java
  88. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java
  89. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java
  90. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java
  91. 6
    6
      gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java
  92. 7
    7
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/AttributeImpl.java
  93. 3
    3
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/AttributeTridentImpl.java
  94. 33
    33
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java
  95. 8
    8
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
  96. 4
    4
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/HasSelector.java
  97. 182
    182
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java
  98. 275
    275
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java
  99. 24
    24
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java
  100. 0
    0
      gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java

+ 197
- 197
archetype/src/main/resources/archetype-resources/pom.xml Ver fichero

@@ -1,197 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>${projectName} gwtquery project</name>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>war</packaging>
<version>${version}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<gQueryVersion>1.1.0</gQueryVersion>
<gwtversion>2.5.0-rc1</gwtversion>
<gwtmaven>2.4.0</gwtmaven>
</properties>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>gwtquery-plugins</id>
<url>http://gwtquery-plugins.googlecode.com/svn/mavenrepo</url>
</repository>
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
<repository>
<id>m.g.o</id>
<url>http://maven.glassfish.org/content/groups/public/</url>
</repository>
</repositories>
<scm>
</scm>
<issueManagement>
</issueManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtversion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtversion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtversion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
<version>${gQueryVersion}</version>
<scope>provided</scope>
</dependency>
<!-- GWT 2.3.0 depends on these -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtmaven}</version>
<configuration>
<logLevel>${gwt.loglevel}</logLevel>
<style>${gwt.outputstyle}</style>
<gwtVersion>${gwtversion}</gwtVersion>
<compileReport>true</compileReport>
<runTarget>${projectName}/${projectName}.html</runTarget>
<hostedWebApp>${project.build.directory}/${project.build.finalName}</hostedWebApp>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>\${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>\${project.build.testSourceDirectory}</additionalClasspathElement>
</additionalClasspathElements>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out target/gwt-tests</value>
</property>
<property>
<!-- Setting this to true (default) causes a exception first time test are run Gwt issue_6443 -->
<name>gwt.persistentunitcache</name>
<value>false</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<additionalBuildcommands>
<buildcommand>com.google.gwt.eclipse.core.gwtProjectValidator</buildcommand>
<buildcommand>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</buildcommand>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
</additionalProjectnatures>
<classpathContainers>
<classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>org.eclipse.jdt.junit.JUNIT_CONTAINER/3</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<!-- GWT plugin does not copy the webapp folder in hosted mode -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>${projectName} gwtquery project</name>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>war</packaging>
<version>${version}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<gQueryVersion>1.1.0</gQueryVersion>
<gwtversion>2.5.0-rc1</gwtversion>
<gwtmaven>2.4.0</gwtmaven>
</properties>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>gwtquery-plugins</id>
<url>http://gwtquery-plugins.googlecode.com/svn/mavenrepo</url>
</repository>
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
<repository>
<id>m.g.o</id>
<url>http://maven.glassfish.org/content/groups/public/</url>
</repository>
</repositories>
<scm>
</scm>
<issueManagement>
</issueManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtversion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtversion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtversion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery</artifactId>
<version>${gQueryVersion}</version>
<scope>provided</scope>
</dependency>
<!-- GWT 2.3.0 depends on these -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtmaven}</version>
<configuration>
<logLevel>${gwt.loglevel}</logLevel>
<style>${gwt.outputstyle}</style>
<gwtVersion>${gwtversion}</gwtVersion>
<compileReport>true</compileReport>
<runTarget>${projectName}/${projectName}.html</runTarget>
<hostedWebApp>${project.build.directory}/${project.build.finalName}</hostedWebApp>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>\${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>\${project.build.testSourceDirectory}</additionalClasspathElement>
</additionalClasspathElements>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out target/gwt-tests</value>
</property>
<property>
<!-- Setting this to true (default) causes a exception first time test are run Gwt issue_6443 -->
<name>gwt.persistentunitcache</name>
<value>false</value>
</property>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<additionalBuildcommands>
<buildcommand>com.google.gwt.eclipse.core.gwtProjectValidator</buildcommand>
<buildcommand>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</buildcommand>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.wst.common.modulecore.ModuleCoreNature</projectnature>
</additionalProjectnatures>
<classpathContainers>
<classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>org.eclipse.jdt.junit.JUNIT_CONTAINER/3</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<!-- GWT plugin does not copy the webapp folder in hosted mode -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
</build>
</project>

+ 1
- 1
archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/__projectName__.gwt.xml Ver fichero

@@ -5,4 +5,4 @@
<inherits name='com.google.gwt.query.Query'/>
<entry-point class='${package}.${artifactId}.client.${projectName}'/>
</module>

+ 28
- 28
archetype/src/main/resources/archetype-resources/src/main/java/__artifactId__/client/__projectName__.java Ver fichero

@@ -1,31 +1,31 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.${artifactId}.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.query.client.Function;
import static com.google.gwt.query.client.GQuery.*;
import com.google.gwt.core.client.EntryPoint;
/**
* Example code for a GwtQuery application
*/
public class ${projectName} implements EntryPoint {
public void onModuleLoad() {
${symbol_dollar}("div")
.hover(new Function() {
public void f(Element e) {
${symbol_dollar}(e).css("color", "blue").stop(true, true).animate("fontSize: '+=10px'");
}
}, new Function() {
public void f(Element e) {
${symbol_dollar}(e).css("color", "").stop(true, true).animate("fontSize: '-=10px'");
}
});
}
}
package ${package}.${artifactId}.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.query.client.Function;
import static com.google.gwt.query.client.GQuery.*;
import com.google.gwt.core.client.EntryPoint;
/**
* Example code for a GwtQuery application
*/
public class ${projectName} implements EntryPoint {
public void onModuleLoad() {
${symbol_dollar}("div")
.hover(new Function() {
public void f(Element e) {
${symbol_dollar}(e).css("color", "blue").stop(true, true).animate("fontSize: '+=10px'");
}
}, new Function() {
public void f(Element e) {
${symbol_dollar}(e).css("color", "").stop(true, true).animate("fontSize: '-=10px'");
}
});
}
}

+ 3
- 3
archetype/src/main/resources/archetype-resources/src/test/java/__artifactId__/client/__projectName__Test.java Ver fichero

@@ -23,7 +23,7 @@ public class ${projectName}Test extends GWTTestCase {
}

public void testOnModuleLoad() {
// Create a container in the document
final GQuery g = $("<div></div>").appendTo(document);

@@ -41,7 +41,7 @@ public class ${projectName}Test extends GWTTestCase {
public void run() {
// assert that the font size increases
assertTrue(fontSize(g) > size1);
// trigger mouse out event
final double size2 = fontSize(g);
g.trigger(Event.ONMOUSEOUT);
@@ -50,7 +50,7 @@ public class ${projectName}Test extends GWTTestCase {
// assert that the font size decreases
assertTrue(fontSize(g) < size2);
g.remove();
// finish the test
finishTest();
}

+ 1
- 1
devtest/src/main/java/com/google/gwt/query/DevTestRunner.gwt.xml Ver fichero

@@ -2,4 +2,4 @@
<inherits name='com.google.gwt.query.Query'/>
<entry-point class='com.google.gwt.query.client.DevTestRunner'/>
</module>

+ 2022
- 2022
devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 148
- 148
devtest/src/main/java/com/google/gwt/query/client/MyTestCase.java Ver fichero

@@ -1,148 +1,148 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import static com.google.gwt.query.client.GQuery.*;
/**
* Just a simple class to emulate JUnit TestCase.
*/
public class MyTestCase {
static Element e = null;
static HTML testPanel = null;
public static void assertEquals(Object a, Object b) {
check(a.equals(b), "assertEquals: expected=" + a + " actual=" + b);
}
public static void assertFalse(boolean b) {
check(!b, "assertTrue: actual should be false but is true");
}
public static void assertFalse(String msg, boolean b) {
check(!b, msg);
}
public static void assertNotNull(Object a) {
check(a != null, "assertNotNull: actual object is null");
}
public static void assertNull(Object a) {
check(a == null, "assertNull: actual object is not null");
}
public static void assertTrue(boolean b) {
check(b, "assertTrue: actual should be true but is false");
}
public static void assertTrue(String msg, boolean b) {
check(b, msg);
}
public static void check(boolean condition, String message) {
if (!condition) {
RuntimeException ex = new RuntimeException(message);
ex.printStackTrace();
throw ex;
}
}
protected static void assertHtmlEquals(Object expected, Object actual) {
assertEquals(iExplorerFixHtml(expected), iExplorerFixHtml(actual));
}
protected static String iExplorerFixHtml(Object s) {
return s.toString().trim().toLowerCase().replaceAll(
"[\r\n]", "").replaceAll(
" ([\\w]+)=[\"']([^\"']+)[\"']", " $1=$2").replaceAll(
"\\s+\\$h=\"[^\"]+\"", "").replaceAll(
" added=[^ >]+", "");
}
public void gwtSetUp() {
if (e == null) {
testPanel = new HTML();
RootPanel.get().add(testPanel);
e = testPanel.getElement();
e.setId("core-tst");
} else {
e.setInnerHTML("");
}
}
protected static void assertArrayContains(Object result, Object... array) {
assertArrayContains("", result, array);
}
protected static void assertArrayContains(String message, Object result, Object... array) {
String values = "";
boolean done = false;
for (Object o : array) {
values += o.toString() + " ";
if (result.equals(o)) {
done = true;
}
}
message = message + ", value (" + result + ") not found in: " + values;
assertTrue(message, done);
}
private boolean testRunning = false;
protected void delayTestFinish(int millis) {
testRunning = true;
new Timer(){
public void run() {
assertFalse(testRunning);
}
}.schedule(millis);
}
protected void finishTest() {
testRunning = false;
}
protected void fail() {
check(false, "Test failure");
}
protected void fail(String msg) {
check(false, msg);
}
protected void assertPosition(GQuery g, Offset min, Offset max) {
int a = Math.min(min.top, max.top);
int b = Math.max(min.top, max.top);
int v = g.offset().top;
boolean c = a <= v && v <= b;
String msg = "Top has the value " + v + ", but should be in the range: "
+ a + " - " + b;
assertTrue(msg, c);
a = Math.min(min.left, max.left);
b = Math.max(min.left, max.left);
v = g.offset().left;
c = a <= v && v <= b;
msg = "Left has the value " + v + ", but should be in the range: " + a
+ " - " + b;
assertTrue(msg, c);
}
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import static com.google.gwt.query.client.GQuery.*;
/**
* Just a simple class to emulate JUnit TestCase.
*/
public class MyTestCase {
static Element e = null;
static HTML testPanel = null;
public static void assertEquals(Object a, Object b) {
check(a.equals(b), "assertEquals: expected=" + a + " actual=" + b);
}
public static void assertFalse(boolean b) {
check(!b, "assertTrue: actual should be false but is true");
}
public static void assertFalse(String msg, boolean b) {
check(!b, msg);
}
public static void assertNotNull(Object a) {
check(a != null, "assertNotNull: actual object is null");
}
public static void assertNull(Object a) {
check(a == null, "assertNull: actual object is not null");
}
public static void assertTrue(boolean b) {
check(b, "assertTrue: actual should be true but is false");
}
public static void assertTrue(String msg, boolean b) {
check(b, msg);
}
public static void check(boolean condition, String message) {
if (!condition) {
RuntimeException ex = new RuntimeException(message);
ex.printStackTrace();
throw ex;
}
}
protected static void assertHtmlEquals(Object expected, Object actual) {
assertEquals(iExplorerFixHtml(expected), iExplorerFixHtml(actual));
}
protected static String iExplorerFixHtml(Object s) {
return s.toString().trim().toLowerCase().replaceAll(
"[\r\n]", "").replaceAll(
" ([\\w]+)=[\"']([^\"']+)[\"']", " $1=$2").replaceAll(
"\\s+\\$h=\"[^\"]+\"", "").replaceAll(
" added=[^ >]+", "");
}
public void gwtSetUp() {
if (e == null) {
testPanel = new HTML();
RootPanel.get().add(testPanel);
e = testPanel.getElement();
e.setId("core-tst");
} else {
e.setInnerHTML("");
}
}
protected static void assertArrayContains(Object result, Object... array) {
assertArrayContains("", result, array);
}
protected static void assertArrayContains(String message, Object result, Object... array) {
String values = "";
boolean done = false;
for (Object o : array) {
values += o.toString() + " ";
if (result.equals(o)) {
done = true;
}
}
message = message + ", value (" + result + ") not found in: " + values;
assertTrue(message, done);
}
private boolean testRunning = false;
protected void delayTestFinish(int millis) {
testRunning = true;
new Timer(){
public void run() {
assertFalse(testRunning);
}
}.schedule(millis);
}
protected void finishTest() {
testRunning = false;
}
protected void fail() {
check(false, "Test failure");
}
protected void fail(String msg) {
check(false, msg);
}
protected void assertPosition(GQuery g, Offset min, Offset max) {
int a = Math.min(min.top, max.top);
int b = Math.max(min.top, max.top);
int v = g.offset().top;
boolean c = a <= v && v <= b;
String msg = "Top has the value " + v + ", but should be in the range: "
+ a + " - " + b;
assertTrue(msg, c);
a = Math.min(min.left, max.left);
b = Math.max(min.left, max.left);
v = g.offset().left;
c = a <= v && v <= b;
msg = "Left has the value " + v + ", but should be in the range: " + a
+ " - " + b;
assertTrue(msg, c);
}
}

+ 9
- 9
devtest/src/main/java/com/google/gwt/query/public/test.html Ver fichero

@@ -1,9 +1,9 @@
<!doctype html>
<html>
<head>
</head>
<body>
<script src="test.nocache.js"></script>
</body>
</html>
<!doctype html>
<html>
<head>
</head>
<body>
<script src="test.nocache.js"></script>
</body>
</html>

+ 27
- 27
gwtquery-core-2.0.1/src/main/java/com/google/gwt/core/client/JsArrayMixed.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google 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
@@ -17,10 +17,10 @@ package com.google.gwt.core.client;

/**
* A simple wrapper around an heterogeneous native array of values.
*
*
* This class may not be directly instantiated, and can only be returned from a
* native method. For example,
*
*
* <code>
* native JsArrayMixed getNativeArray() /*-{
* return [
@@ -38,7 +38,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Gets the boolean at a given index.
*
*
* @param index the index to be retrieved
* @return the object at the given index, or <code>null</code> if none exists
*/
@@ -48,7 +48,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Gets the double at a given index.
*
*
* @param index the index to be retrieved
* @return the object at the given index, or <code>null</code> if none exists
*/
@@ -58,7 +58,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Gets the {@link JavaScriptObject} at a given index.
*
*
* @param index the index to be retrieved
* @return the {@code JavaScriptObject} at the given index, or
* <code>null</code> if none exists
@@ -69,7 +69,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Gets the String at a given index.
*
*
* @param index the index to be retrieved
* @return the object at the given index, or <code>null</code> if none exists
*/
@@ -98,7 +98,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Gets the length of the array.
*
*
* @return the array length
*/
public final native int length() /*-{
@@ -135,10 +135,10 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Sets the boolean value at a given index.
*
*
* If the index is out of bounds, the value will still be set. The array's
* length will be updated to encompass the bounds implied by the added value.
*
*
* @param index the index to be set
* @param value the boolean to be stored
*/
@@ -148,10 +148,10 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Sets the double value at a given index.
*
*
* If the index is out of bounds, the value will still be set. The array's
* length will be updated to encompass the bounds implied by the added value.
*
*
* @param index the index to be set
* @param value the double to be stored
*/
@@ -161,10 +161,10 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Sets the object value at a given index.
*
*
* If the index is out of bounds, the value will still be set. The array's
* length will be updated to encompass the bounds implied by the added object.
*
*
* @param index the index to be set
* @param value the {@link JavaScriptObject} to be stored
*/
@@ -174,10 +174,10 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Sets the String value at a given index.
*
*
* If the index is out of bounds, the value will still be set. The array's
* length will be updated to encompass the bounds implied by the added String.
*
*
* @param index the index to be set
* @param value the String to be stored
*/
@@ -187,7 +187,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Reset the length of the array.
*
*
* @param newLength the new length of the array
*/
public final native void setLength(int newLength) /*-{
@@ -196,7 +196,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts the first value off the array.
*
*
* @return the shifted boolean
*/
public final native boolean shiftBoolean() /*-{
@@ -205,7 +205,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts the first value off the array.
*
*
* @return the shifted double
*/
public final native double shiftNumber() /*-{
@@ -214,7 +214,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts the first value off the array.
*
*
* @return the shifted {@link JavaScriptObject}
*/
public final native <T extends JavaScriptObject> T shiftObject() /*-{
@@ -223,7 +223,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts the first value off the array.
*
*
* @return the shifted String
*/
public final native String shiftString() /*-{
@@ -232,7 +232,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts a boolean onto the beginning of the array.
*
*
* @param value the value to the stored
*/
public final native void unshift(boolean value) /*-{
@@ -241,7 +241,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts a double onto the beginning of the array.
*
*
* @param value the value to store
*/
public final native void unshift(double value) /*-{
@@ -250,7 +250,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts a {@link JavaScriptObject} onto the beginning of the array.
*
*
* @param value the value to store
*/
public final native void unshift(JavaScriptObject value) /*-{
@@ -259,7 +259,7 @@ public class JsArrayMixed extends JavaScriptObject {

/**
* Shifts a String onto the beginning of the array.
*
*
* @param value the value to store
*/
public final native void unshift(String value) /*-{

+ 3
- 3
gwtquery-core-2.0.1/src/main/java/com/google/gwt/query/linker/IFrameWithDocTypeLinker.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2009 Google 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

+ 112
- 112
gwtquery-core-2.0.1/src/main/java/com/google/gwt/query/rebind/SelectorGeneratorCssToXPath.java Ver fichero

@@ -1,112 +1,112 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.rebind;
import java.util.ArrayList;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.query.client.Selector;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath.ReplaceCallback;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath.Replacer;
import com.google.gwt.user.rebind.SourceWriter;
/**
* Compile time selector generator which translates selector into XPath at
* compile time. It Uses the SelectorEngineCssToXpath to produce the xpath
* selectors
*/
public class SelectorGeneratorCssToXPath extends SelectorGeneratorBase {
/**
* The replacer implementation for the JVM.
*/
public static final Replacer replacerJvm = new Replacer() {
public String replaceAll(String s, String r, Object o) {
Pattern p = Pattern.compile(r);
if (o instanceof ReplaceCallback) {
final Matcher matcher = p.matcher(s);
ReplaceCallback callback = (ReplaceCallback) o;
while (matcher.find()) {
final MatchResult matchResult = matcher.toMatchResult();
ArrayList<String> argss = new ArrayList<String>();
for (int i = 0; i < matchResult.groupCount() + 1; i++) {
argss.add(matchResult.group(i));
}
final String replacement = callback.foundMatch(argss);
s = s.substring(0, matchResult.start()) + replacement
+ s.substring(matchResult.end());
matcher.reset(s);
}
return s;
} else {
return p.matcher(s).replaceAll(o.toString());
}
}
};
public static final Replacer replacer = replacerJvm;
private SelectorEngineCssToXPath engine = new SelectorEngineCssToXPath(
replacer);
protected String css2Xpath(String s) {
return engine.css2Xpath(s);
}
private XPathFactory factory = XPathFactory.newInstance();
private XPath xpath = factory.newXPath();
protected void generateMethodBody(SourceWriter sw, JMethod method,
TreeLogger treeLogger, boolean hasContext)
throws UnableToCompleteException {
String selector = method.getAnnotation(Selector.class).value();
String xselector = css2Xpath(selector);
// Validate the generated xpath selector.
try {
validateXpath(xselector);
} catch (XPathExpressionException e1) {
System.err.println("Invalid XPath generated selector, please revise it: " + xselector);
if (!selector.equals(xselector)) {
System.err.println("If your css2 selector syntax is correct, open an issue in the gwtquery project. cssselector:"
+ selector + " xpath:" + xselector);
}
throw new UnableToCompleteException();
}
sw.println("return "
+ wrap(method, "xpathEvaluate(\"" + xselector + "\", root)") + ";");
}
public void validateXpath(String xselector) throws XPathExpressionException {
xpath.compile(xselector);
}
protected String getImplSuffix() {
return "CssToXPath" + super.getImplSuffix();
}
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.rebind;
import java.util.ArrayList;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.query.client.Selector;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath.ReplaceCallback;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath.Replacer;
import com.google.gwt.user.rebind.SourceWriter;
/**
* Compile time selector generator which translates selector into XPath at
* compile time. It Uses the SelectorEngineCssToXpath to produce the xpath
* selectors
*/
public class SelectorGeneratorCssToXPath extends SelectorGeneratorBase {
/**
* The replacer implementation for the JVM.
*/
public static final Replacer replacerJvm = new Replacer() {
public String replaceAll(String s, String r, Object o) {
Pattern p = Pattern.compile(r);
if (o instanceof ReplaceCallback) {
final Matcher matcher = p.matcher(s);
ReplaceCallback callback = (ReplaceCallback) o;
while (matcher.find()) {
final MatchResult matchResult = matcher.toMatchResult();
ArrayList<String> argss = new ArrayList<String>();
for (int i = 0; i < matchResult.groupCount() + 1; i++) {
argss.add(matchResult.group(i));
}
final String replacement = callback.foundMatch(argss);
s = s.substring(0, matchResult.start()) + replacement
+ s.substring(matchResult.end());
matcher.reset(s);
}
return s;
} else {
return p.matcher(s).replaceAll(o.toString());
}
}
};
public static final Replacer replacer = replacerJvm;
private SelectorEngineCssToXPath engine = new SelectorEngineCssToXPath(
replacer);
protected String css2Xpath(String s) {
return engine.css2Xpath(s);
}
private XPathFactory factory = XPathFactory.newInstance();
private XPath xpath = factory.newXPath();
protected void generateMethodBody(SourceWriter sw, JMethod method,
TreeLogger treeLogger, boolean hasContext)
throws UnableToCompleteException {
String selector = method.getAnnotation(Selector.class).value();
String xselector = css2Xpath(selector);
// Validate the generated xpath selector.
try {
validateXpath(xselector);
} catch (XPathExpressionException e1) {
System.err.println("Invalid XPath generated selector, please revise it: " + xselector);
if (!selector.equals(xselector)) {
System.err.println("If your css2 selector syntax is correct, open an issue in the gwtquery project. cssselector:"
+ selector + " xpath:" + xselector);
}
throw new UnableToCompleteException();
}
sw.println("return "
+ wrap(method, "xpathEvaluate(\"" + xselector + "\", root)") + ";");
}
public void validateXpath(String xselector) throws XPathExpressionException {
xpath.compile(xselector);
}
protected String getImplSuffix() {
return "CssToXPath" + super.getImplSuffix();
}
}

+ 141
- 141
gwtquery-core/src/main/java/com/google/gwt/query/Query.gwt.xml Ver fichero

@@ -1,142 +1,142 @@
<!--
Copyright 2011, The gwtquery team.
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.
-->
<module>
<inherits name='com.google.gwt.user.User'/>
<!-- Json and Xml builders -->
<generate-with class="com.google.gwt.query.rebind.JsonBuilderGenerator">
<when-type-assignable class="com.google.gwt.query.client.builders.JsonBuilder"/>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.XmlBuilderGenerator">
<when-type-assignable class="com.google.gwt.query.client.builders.XmlBuilder"/>
</generate-with>
<!-- Lazy Generator -->
<generate-with class="com.google.gwt.query.rebind.LazyGenerator">
<when-type-assignable class="com.google.gwt.query.client.Lazy"/>
</generate-with>
<!-- Selector Generators -->
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorJS">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNative">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNativeIE8">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<when-property-is name="user.agent" value="ie8"/>
<!--
Copyright 2011, The gwtquery team.

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.
-->

<module>
<inherits name='com.google.gwt.user.User'/>

<!-- Json and Xml builders -->
<generate-with class="com.google.gwt.query.rebind.JsonBuilderGenerator">
<when-type-assignable class="com.google.gwt.query.client.builders.JsonBuilder"/>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNativeIE9">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<when-property-is name="user.agent" value="ie9"/>
</generate-with>
<!-- Document Style -->
<replace-with class="com.google.gwt.query.client.impl.DocumentStyleImpl">
<when-type-assignable class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.DocumentStyleImplIE">
<when-type-assignable class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>
<!-- Fall-back Engine for unsupported cases when using SelectorEngineImpl -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineCssToXPath">
<when-type-assignable class="com.google.gwt.query.client.impl.HasSelector"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzleIE">
<when-type-assignable class="com.google.gwt.query.client.impl.HasSelector"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>
<!-- Selector Engines -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzle">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzleIE">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
</any>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNative">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeIE8">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie8"/>
</any>
</replace-with>
<!-- UI implementations -->
<replace-with class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl">
<when-type-is class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImplTrident">
<when-type-is class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl" />
<any>
<when-property-is name="user.agent" value="ie6" />
<when-property-is name="user.agent" value="ie8" />
<when-property-is name="user.agent" value="ie9" />
</any>
</replace-with>
<!-- Attribute setter implementations -->
<replace-with class="com.google.gwt.query.client.impl.AttributeImpl">
<when-type-is class="com.google.gwt.query.client.impl.AttributeImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.AttributeTridentImpl">
<when-type-is class="com.google.gwt.query.client.impl.AttributeImpl" />
<when-property-is name="user.agent" value="ie6" />
</replace-with>
<!-- JsUtils implementations -->
<replace-with class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl">
<when-type-is class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.js.JsUtils.JsUtilsImplIE6">
<when-type-is class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl" />
<when-property-is name="user.agent" value="ie6" />
</replace-with>
<!-- IE8 needs the iframe where the js of app is loaded set to standard in order
to use the queryAll native selector -->
<define-linker name="stddoctype" class="com.google.gwt.query.linker.IFrameWithDocTypeLinker"/>
<add-linker name="stddoctype"/>
</module>
<generate-with class="com.google.gwt.query.rebind.XmlBuilderGenerator">
<when-type-assignable class="com.google.gwt.query.client.builders.XmlBuilder"/>
</generate-with>

<!-- Lazy Generator -->
<generate-with class="com.google.gwt.query.rebind.LazyGenerator">
<when-type-assignable class="com.google.gwt.query.client.Lazy"/>
</generate-with>

<!-- Selector Generators -->
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorJS">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNative">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNativeIE8">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<when-property-is name="user.agent" value="ie8"/>
</generate-with>
<generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNativeIE9">
<when-type-assignable class="com.google.gwt.query.client.Selectors"/>
<when-property-is name="user.agent" value="ie9"/>
</generate-with>

<!-- Document Style -->
<replace-with class="com.google.gwt.query.client.impl.DocumentStyleImpl">
<when-type-assignable class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.DocumentStyleImplIE">
<when-type-assignable class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>

<!-- Fall-back Engine for unsupported cases when using SelectorEngineImpl -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineCssToXPath">
<when-type-assignable class="com.google.gwt.query.client.impl.HasSelector"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzleIE">
<when-type-assignable class="com.google.gwt.query.client.impl.HasSelector"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>

<!-- Selector Engines -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzle">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzleIE">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie6"/>
</any>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNative">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeIE8">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie8"/>
</any>
</replace-with>

<!-- UI implementations -->
<replace-with class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl">
<when-type-is class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImplTrident">
<when-type-is class="com.google.gwt.query.client.plugins.UiPlugin.GQueryUiImpl" />
<any>
<when-property-is name="user.agent" value="ie6" />
<when-property-is name="user.agent" value="ie8" />
<when-property-is name="user.agent" value="ie9" />
</any>
</replace-with>

<!-- Attribute setter implementations -->
<replace-with class="com.google.gwt.query.client.impl.AttributeImpl">
<when-type-is class="com.google.gwt.query.client.impl.AttributeImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.AttributeTridentImpl">
<when-type-is class="com.google.gwt.query.client.impl.AttributeImpl" />
<when-property-is name="user.agent" value="ie6" />
</replace-with>

<!-- JsUtils implementations -->
<replace-with class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl">
<when-type-is class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl" />
</replace-with>
<replace-with class="com.google.gwt.query.client.js.JsUtils.JsUtilsImplIE6">
<when-type-is class="com.google.gwt.query.client.js.JsUtils.JsUtilsImpl" />
<when-property-is name="user.agent" value="ie6" />
</replace-with>

<!-- IE8 needs the iframe where the js of app is loaded set to standard in order
to use the queryAll native selector -->
<define-linker name="stddoctype" class="com.google.gwt.query.linker.IFrameWithDocTypeLinker"/>
<add-linker name="stddoctype"/>

</module>

+ 72
- 72
gwtquery-core/src/main/java/com/google/gwt/query/QueryMin.gwt.xml Ver fichero

@@ -1,72 +1,72 @@
<!--
Copyright 2011, The gwtquery team.
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.
-->
<!-- Include com.google.gwt.query.QueryMin instead of com.google.gwt.query.Query-->
<!-- if you want small javascript code and you are not using any of the selectors: -->
<!-- ".*(:contains|!=|:checked|:not|:nth-|:last-|:only-).*"-->
<!-- Note: that this will increase the number of total permutations. -->
<module>
<!-- Inherit GQuery module -->
<inherits name='com.google.gwt.query.Query'/>
<!-- Detect whether querySelectorAll is available -->
<define-property name="selectorCapability" values="native,js"/>
<property-provider name="selectorCapability">
<![CDATA[
return !/_force_no_native/.test(document.location.search) &&
document.querySelectorAll &&
/native/.test(String(document.querySelectorAll)) ? "native" : "js";
]]>
</property-provider>
<set-property name="selectorCapability" value="js" >
<when-property-is name="user.agent" value="ie6" />
</set-property>
<set-property name="selectorCapability" value="native" >
<any>
<when-property-is name="user.agent" value="safari" />
</any>
</set-property>
<!-- Selector Engines -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMin">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
<when-property-is name="selectorCapability" value="native"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineCssToXPath">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
<when-property-is name="selectorCapability" value="js"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMinIE8">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
<when-property-is name="selectorCapability" value="native"/>
</replace-with>
</module>
<!--
Copyright 2011, The gwtquery team.
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.
-->
<!-- Include com.google.gwt.query.QueryMin instead of com.google.gwt.query.Query-->
<!-- if you want small javascript code and you are not using any of the selectors: -->
<!-- ".*(:contains|!=|:checked|:not|:nth-|:last-|:only-).*"-->
<!-- Note: that this will increase the number of total permutations. -->
<module>
<!-- Inherit GQuery module -->
<inherits name='com.google.gwt.query.Query'/>
<!-- Detect whether querySelectorAll is available -->
<define-property name="selectorCapability" values="native,js"/>
<property-provider name="selectorCapability">
<![CDATA[
return !/_force_no_native/.test(document.location.search) &&
document.querySelectorAll &&
/native/.test(String(document.querySelectorAll)) ? "native" : "js";
]]>
</property-provider>
<set-property name="selectorCapability" value="js" >
<when-property-is name="user.agent" value="ie6" />
</set-property>
<set-property name="selectorCapability" value="native" >
<any>
<when-property-is name="user.agent" value="safari" />
</any>
</set-property>
<!-- Selector Engines -->
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMin">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
<when-property-is name="selectorCapability" value="native"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineCssToXPath">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="opera"/>
<when-property-is name="user.agent" value="safari"/>
</any>
<when-property-is name="selectorCapability" value="js"/>
</replace-with>
<replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMinIE8">
<when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
<any>
<when-property-is name="user.agent" value="ie8"/>
<when-property-is name="user.agent" value="ie9"/>
</any>
<when-property-is name="selectorCapability" value="native"/>
</replace-with>
</module>

+ 49
- 49
gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -25,33 +25,33 @@ import com.google.gwt.user.client.ui.Widget;
* Extend this class to implement functions callbacks.
*/
public abstract class Function {
private com.google.gwt.dom.client.Element element = null;
private Event event = null;
private int index = -1;
private Object[] data = new Object[0];
public <T extends com.google.gwt.dom.client.Element> T getElement() {
return element.<T>cast();
}
public <T extends com.google.gwt.dom.client.Element> void setElement(T e) {
element = e;
}
public void setEvent(Event e) {
event = e;
element = e != null ? e.getCurrentEventTarget().<com.google.gwt.dom.client.Element>cast() : null;
}
public Event getEvent() {
return event;
}
public void setIndex(int i) {
index = i;
}
public Object[] getData() {
return data;
}
@@ -59,7 +59,7 @@ public abstract class Function {
public void setData(Object...data) {
this.data = data;
}
public Object getDataObject() {
return getDataObject(0);
}
@@ -67,11 +67,11 @@ public abstract class Function {
public Object getDataObject(int idx) {
return data != null && data.length > idx ? data[idx] : null;
}
public Properties getDataProperties() {
return getDataProperties(0);
}
public Properties getDataProperties(int idx) {
Object o = getDataObject(idx);
if (o != null && o instanceof JavaScriptObject) {
@@ -87,20 +87,20 @@ public abstract class Function {
public void setData(double b) {
setData(Double.valueOf(b));
}
public void setDataObject(Object data) {
setData(data);
}
public int getIndex() {
return index;
}
/**
* Override this for methods which invoke a cancel action.
*
*
* @param e takes a com.google.gwt.dom.client.Element.
*
*
*/
public void cancel(com.google.gwt.dom.client.Element e) {
setElement(e);
@@ -110,9 +110,9 @@ public abstract class Function {

/**
* Override this for methods which invoke a cancel action.
*
*
* @param e takes a com.google.gwt.user.client.Element.
*
*
*/
public void cancel(com.google.gwt.user.client.Element e) {
setElement(e);
@@ -129,23 +129,23 @@ public abstract class Function {
/**
* Override this for GQuery methods which loop over matched elements and
* invoke a callback on each element.
*
*
* @param e takes a com.google.gwt.dom.client.Element.
*
*
*/
public Object f(com.google.gwt.dom.client.Element e, int i) {
setElement(e);
setIndex(i);
// This has to be the order of calls
return f(e.<com.google.gwt.user.client.Element>cast(), i);
return f(e.<com.google.gwt.user.client.Element>cast(), i);
}

/**
* Override this for GQuery methods which loop over matched elements and
* invoke a callback on each element.
*
*
* @param e takes a com.google.gwt.user.client.Element.
*
*
*/
public Object f(com.google.gwt.user.client.Element e, int i) {
setElement(e);
@@ -162,10 +162,10 @@ public abstract class Function {
/**
* Override this for GQuery methods which loop over matched widgets and
* invoke a callback on each widget.
*
* NOTE: If your query has non-widget elements you might need to override
*
* NOTE: If your query has non-widget elements you might need to override
* 'public void f()' or 'public void f(Element e)' to handle these elements and
* avoid a runtime exception.
* avoid a runtime exception.
*/
public Object f(Widget w, int i) {
setElement(w.getElement());
@@ -173,21 +173,21 @@ public abstract class Function {
f(w);
return null;
}
/**
* Override this method for bound callbacks
*/
public void f(Object... data) {
fe(data);
}
/**
* Override this method for bound callbacks
*/
public void f(int i, Object data) {
f(i, new Object[]{data});
}
/**
* Override this method for bound callbacks
*/
@@ -206,7 +206,7 @@ public abstract class Function {
}
}
}
/**
* Override this method for bound event handlers if you wish to deal with
* per-handler user data.
@@ -219,19 +219,19 @@ public abstract class Function {

/**
* Override this method for bound event handlers.
*
* @return boolean: false means stop propagation and prevent default
*
* @return boolean: false means stop propagation and prevent default
*/
public boolean f(Event e) {
setEvent(e);
f(element);
return true;
}
/**
* Override this for GQuery methods which take a callback and do not expect a
* return value.
*
*
* @param e takes a com.google.gwt.dom.client.Element
*/
public void f(com.google.gwt.dom.client.Element e) {
@@ -239,11 +239,11 @@ public abstract class Function {
// This has to be the order of calls
f(e.<com.google.gwt.user.client.Element>cast());
}
/**
* Override this for GQuery methods which take a callback and do not expect a
* return value.
*
*
* @param e takes a com.google.gwt.user.client.Element
*/
private boolean loop = false;
@@ -257,14 +257,14 @@ public abstract class Function {
f();
}
}
/**
* Override this for GQuery methods which take a callback, but do not expect a
* return value, apply to a single widget.
*
* NOTE: If your query has non-widget elements you might need to override
*
* NOTE: If your query has non-widget elements you might need to override
* 'public void f()' or 'public void f(Element e)' to handle these elements and
* avoid a runtime exception.
* avoid a runtime exception.
*/
public void f(Widget w){
setElement(w.getElement());
@@ -279,7 +279,7 @@ public abstract class Function {
/**
* Methods fe(...) should be used from asynchronous contexts so as we can
* catch the exception and send it to the GWT UncaughtExceptionHandler.
* They are intentionally final to avoid override them
* They are intentionally final to avoid override them
*/
public final void fe() {
fe(data);
@@ -288,16 +288,16 @@ public abstract class Function {
/**
* Methods fe(...) should be used from asynchronous contexts so as we can
* catch the exception and send it to the GWT UncaughtExceptionHandler
* They are intentionally final to avoid override them
* They are intentionally final to avoid override them
*/
public final void fe(Object data) {
fe(new Object[]{data});
}
/**
* Methods fe(...) should be used from asynchronous contexts so as we can
* catch the exception and send it to the GWT UncaughtExceptionHandler
* They are intentionally final to avoid override them
* They are intentionally final to avoid override them
*/
public final void fe(Object... data) {
setData(data);
@@ -315,7 +315,7 @@ public abstract class Function {
/**
* Methods fe(...) should be used from asynchronous contexts so as we can
* catch the exception and send it to the GWT UncaughtExceptionHandler
* They are intentionally final to avoid override them
* They are intentionally final to avoid override them
*/
public final boolean fe(Event ev, Object data) {
if (GWT.getUncaughtExceptionHandler() != null) {
@@ -328,11 +328,11 @@ public abstract class Function {
}
return f(ev, data);
}
/**
* Methods fe(...) should be used from asynchronous contexts so as we can
* catch the exception and send it to the GWT UncaughtExceptionHandler
* They are intentionally final to avoid override them
* They are intentionally final to avoid override them
*/
public final void fe(com.google.gwt.dom.client.Element elem) {
if (GWT.getUncaughtExceptionHandler() != null) {

+ 4656
- 4656
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/Lazy.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyBase.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 224
- 224
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 11
- 11
gwtquery-core/src/main/java/com/google/gwt/query/client/Predicate.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -25,19 +25,19 @@ public class Predicate {
/**
* Used by GQuery methods which loop over matched widgets and
* invoke a callback on each widget expecting a boolean value.
*
* @param e
* the element for this call
* @param index
* the element position in the gquery elements array.
*
* @param e
* the element for this call
* @param index
* the element position in the gquery elements array.
*/
public boolean f(Element e, int index) {
return f((Object)e, index);
}
public <T> boolean f(T e, int index) {
return false;
}
}

+ 187
- 187
gwtquery-core/src/main/java/com/google/gwt/query/client/Properties.java Ver fichero

@@ -1,187 +1,187 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArrayMixed;
import com.google.gwt.query.client.js.JsCache;
import com.google.gwt.query.client.js.JsUtils;
/**
* JSO for accessing Javascript objective literals used by GwtQuery functions.
*/
public class Properties extends JavaScriptObject {
public static Properties create() {
return JsCache.create().cast();
}
public static Properties create(String properties) {
if (properties != null && !properties.isEmpty()) {
String p = wrapPropertiesString(properties);
try {
return JsUtils.parseJSON(p);
} catch (Exception e) {
System.err.println("Error creating Properties: \n> " + properties + "\n< " + p + "\n" + e.getMessage());
}
}
return create();
}
public static String wrapPropertiesString(String s) {
String ret = s //
.replaceAll("\\s*/\\*[\\s\\S]*?\\*/\\s*", "") // Remove comments
.replaceAll("([:\\)\\(,;}{'\"])\\s+" , "$1") // Remove spaces
.replaceAll("\\s+([:\\)\\(,;}{'\"])" , "$1") // Remove spaces
.replaceFirst("^[\\(]+(.*)[\\)]+$", "$1") // Remove ()
.replaceAll("\\([\"']([^\\)]+)[\"']\\)" , "($1)") // Remove quotes
.replaceAll("[;,]+([\\w-\\$]+):", ";$1:") // Change comma by semicolon
.replaceAll("([^,;])([\\]}])", "$1;$2") // Put control semicolon used below
.replaceAll(":\\s*[\"']?([^;\\{\\}\\[\\]\"']*)[\"']?\\s*([;,]+|$)", ":\"$1\";") // put quotes to all values (even empty)
.replaceAll("[;,]+([\\w-]+):", ";$1:") // Change semicolon by comma
.replaceAll("(^|[^\\w-\\$'])([\\w-\\$]+):(['\"\\[{])", "$1\"$2\":$3") // quote keys
.replaceAll("(^|[^\\w-\\$'])([\\w-\\$]+):(['\"\\[{])", "$1\"$2\":$3") // quote keys second pass
.replaceAll("(|[\\[\\]\\{\\},\\(])'([^']*)'", "$1\"$2\"") // Replace single-quote by double-quote
.replaceAll(";([^:]+):", ",$1:") // change semicolon
.replaceAll(";([^:]+):", ",$1:") // change semicolon second pass
.replaceAll(":\"(-?\\d[\\d\\.]*|null|false|true)\"[;,]", ":$1,") // numbers do not need quote
.replaceAll("[;,]+([\\]\\}]|$)", "$1") // remove endings
;
ret = ret.matches("(^[\\[\\{].*[\\]\\}]$)") ? ret : "{" + ret + "}";
return ret;
}
protected Properties() {
}
public final Properties $$(String key, String value) {
set(key, value);
return this;
}
private JsCache c() {
return this.<JsCache>cast();
}
public final native Properties cloneProps() /*-{
var props = {};
for(p in this) {
props[p] = this[p];
}
return props;
}-*/;
public final boolean defined(Object name) {
return c().exists(String.valueOf(name));
}
@SuppressWarnings("unchecked")
public final <T> T get(Object name) {
// Casting because of issue_135
return (T)c().get(String.valueOf(name));
}
public final boolean getBoolean(Object name) {
return c().getBoolean(String.valueOf(name));
}
public final float getFloat(Object name) {
return c().getFloat(String.valueOf(name));
}
public final Function getFunction(Object name) {
final Object o = c().get(String.valueOf(name));
if (o != null) {
if (o instanceof Function) {
return (Function)o;
} else if (o instanceof JavaScriptObject) {
Object f = ((JavaScriptObject)o).<Properties>cast().getObject("__f");
if (f != null && f instanceof Function) {
return (Function) f;
}
return new JsUtils.JsFunction((JavaScriptObject)o);
}
}
return null;
}
public final int getInt(Object name) {
return c().getInt(String.valueOf(name));
}
public final String getStr(Object name) {
return c().getString(String.valueOf(name));
}
public final Object getObject(Object name) {
return c().get(String.valueOf(name));
}
@SuppressWarnings("unchecked")
public final <T extends JavaScriptObject> T getJavaScriptObject(Object name) {
// Casting because of issue_135
return (T)c().getJavaScriptObject(String.valueOf(name));
}
public final JsArrayMixed getArray(Object name) {
return c().getArray(String.valueOf(name));
}
public final String[] keys() {
return c().keys();
}
public final <T> void remove(T name) {
c().delete(String.valueOf(name));
}
public final <T> void setNumber(T name, double val) {
c().putNumber(name, val);
}
public final <T> void setBoolean(T name, boolean val) {
c().putBoolean(name, val);
}
public final native <T> void setFunction(T name, Function f) /*-{
this[name] = function() {
f.@com.google.gwt.query.client.Function::fe(Ljava/lang/Object;)(arguments);
}
// We store the original function reference
this[name].__f = f;
}-*/;
public final <T, O> void set(T name, O val) {
c().put(String.valueOf(name), val);
}
public final String tostring() {
return toJsonString();
}
public final String toJsonString() {
return JsUtils.JSON2String(JsCache.checkNull(this));
}
public final String toQueryString() {
return JsUtils.param(JsCache.checkNull(this));
}
public final boolean isEmpty(){
return c().length() == 0;
}
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArrayMixed;
import com.google.gwt.query.client.js.JsCache;
import com.google.gwt.query.client.js.JsUtils;
/**
* JSO for accessing Javascript objective literals used by GwtQuery functions.
*/
public class Properties extends JavaScriptObject {
public static Properties create() {
return JsCache.create().cast();
}
public static Properties create(String properties) {
if (properties != null && !properties.isEmpty()) {
String p = wrapPropertiesString(properties);
try {
return JsUtils.parseJSON(p);
} catch (Exception e) {
System.err.println("Error creating Properties: \n> " + properties + "\n< " + p + "\n" + e.getMessage());
}
}
return create();
}
public static String wrapPropertiesString(String s) {
String ret = s //
.replaceAll("\\s*/\\*[\\s\\S]*?\\*/\\s*", "") // Remove comments
.replaceAll("([:\\)\\(,;}{'\"])\\s+" , "$1") // Remove spaces
.replaceAll("\\s+([:\\)\\(,;}{'\"])" , "$1") // Remove spaces
.replaceFirst("^[\\(]+(.*)[\\)]+$", "$1") // Remove ()
.replaceAll("\\([\"']([^\\)]+)[\"']\\)" , "($1)") // Remove quotes
.replaceAll("[;,]+([\\w-\\$]+):", ";$1:") // Change comma by semicolon
.replaceAll("([^,;])([\\]}])", "$1;$2") // Put control semicolon used below
.replaceAll(":\\s*[\"']?([^;\\{\\}\\[\\]\"']*)[\"']?\\s*([;,]+|$)", ":\"$1\";") // put quotes to all values (even empty)
.replaceAll("[;,]+([\\w-]+):", ";$1:") // Change semicolon by comma
.replaceAll("(^|[^\\w-\\$'])([\\w-\\$]+):(['\"\\[{])", "$1\"$2\":$3") // quote keys
.replaceAll("(^|[^\\w-\\$'])([\\w-\\$]+):(['\"\\[{])", "$1\"$2\":$3") // quote keys second pass
.replaceAll("(|[\\[\\]\\{\\},\\(])'([^']*)'", "$1\"$2\"") // Replace single-quote by double-quote
.replaceAll(";([^:]+):", ",$1:") // change semicolon
.replaceAll(";([^:]+):", ",$1:") // change semicolon second pass
.replaceAll(":\"(-?\\d[\\d\\.]*|null|false|true)\"[;,]", ":$1,") // numbers do not need quote
.replaceAll("[;,]+([\\]\\}]|$)", "$1") // remove endings
;
ret = ret.matches("(^[\\[\\{].*[\\]\\}]$)") ? ret : "{" + ret + "}";
return ret;
}
protected Properties() {
}
public final Properties $$(String key, String value) {
set(key, value);
return this;
}
private JsCache c() {
return this.<JsCache>cast();
}
public final native Properties cloneProps() /*-{
var props = {};
for(p in this) {
props[p] = this[p];
}
return props;
}-*/;
public final boolean defined(Object name) {
return c().exists(String.valueOf(name));
}
@SuppressWarnings("unchecked")
public final <T> T get(Object name) {
// Casting because of issue_135
return (T)c().get(String.valueOf(name));
}
public final boolean getBoolean(Object name) {
return c().getBoolean(String.valueOf(name));
}
public final float getFloat(Object name) {
return c().getFloat(String.valueOf(name));
}
public final Function getFunction(Object name) {
final Object o = c().get(String.valueOf(name));
if (o != null) {
if (o instanceof Function) {
return (Function)o;
} else if (o instanceof JavaScriptObject) {
Object f = ((JavaScriptObject)o).<Properties>cast().getObject("__f");
if (f != null && f instanceof Function) {
return (Function) f;
}
return new JsUtils.JsFunction((JavaScriptObject)o);
}
}
return null;
}
public final int getInt(Object name) {
return c().getInt(String.valueOf(name));
}
public final String getStr(Object name) {
return c().getString(String.valueOf(name));
}
public final Object getObject(Object name) {
return c().get(String.valueOf(name));
}
@SuppressWarnings("unchecked")
public final <T extends JavaScriptObject> T getJavaScriptObject(Object name) {
// Casting because of issue_135
return (T)c().getJavaScriptObject(String.valueOf(name));
}
public final JsArrayMixed getArray(Object name) {
return c().getArray(String.valueOf(name));
}
public final String[] keys() {
return c().keys();
}
public final <T> void remove(T name) {
c().delete(String.valueOf(name));
}
public final <T> void setNumber(T name, double val) {
c().putNumber(name, val);
}
public final <T> void setBoolean(T name, boolean val) {
c().putBoolean(name, val);
}
public final native <T> void setFunction(T name, Function f) /*-{
this[name] = function() {
f.@com.google.gwt.query.client.Function::fe(Ljava/lang/Object;)(arguments);
}
// We store the original function reference
this[name].__f = f;
}-*/;
public final <T, O> void set(T name, O val) {
c().put(String.valueOf(name), val);
}
public final String tostring() {
return toJsonString();
}
public final String toJsonString() {
return JsUtils.JSON2String(JsCache.checkNull(this));
}
public final String toQueryString() {
return JsUtils.param(JsCache.checkNull(this));
}
public final boolean isEmpty(){
return c().length() == 0;
}
}

+ 31
- 31
gwtquery-core/src/main/java/com/google/gwt/query/client/Selector.java Ver fichero

@@ -1,31 +1,31 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to pass a CSS Selector to a generator at compile time
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Selector {
String value();
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used to pass a CSS Selector to a generator at compile time
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Selector {
String value();
}

+ 72
- 72
gwtquery-core/src/main/java/com/google/gwt/query/client/Selectors.java Ver fichero

@@ -1,72 +1,72 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
/**
* Tagging interface used to generate compile time selectors.
*/
public interface Selectors {
/**
* A compiled selector that can be lazily turned into a GQuery.
*/
public interface DeferredSelector {
/**
* Evaluate the compiled selector with the given DOM node as a context.
*
* Returns a NodeList as a result which you could transform into a GQuery
* object passing it as argument to the $() function.
*/
NodeList<Element> runSelector(Node ctx);
/**
* The selector which was compiled.
*/
String getSelector();
}
/**
* Return all the selectors defined for this interface, so as
* we can get the css representation of each one and lazily evaluate it
* in runtime.
*/
DeferredSelector[] getAllSelectors();
/**
* Set the context for all the selectors.
* By default they are evaluated in all the document.
*/
public void setRoot(Node node);
/**
* Get the configured root context.
*/
public Node getRoot();
/**
* Used for benchmarking purposes, it returns true if the selector engine
* for this browser is using a pure javascript implementation or a native
* one.
*
* It is useful to check if IE8 native selectors are being used.
*/
public boolean isDegradated();
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
/**
* Tagging interface used to generate compile time selectors.
*/
public interface Selectors {
/**
* A compiled selector that can be lazily turned into a GQuery.
*/
public interface DeferredSelector {
/**
* Evaluate the compiled selector with the given DOM node as a context.
*
* Returns a NodeList as a result which you could transform into a GQuery
* object passing it as argument to the $() function.
*/
NodeList<Element> runSelector(Node ctx);
/**
* The selector which was compiled.
*/
String getSelector();
}
/**
* Return all the selectors defined for this interface, so as
* we can get the css representation of each one and lazily evaluate it
* in runtime.
*/
DeferredSelector[] getAllSelectors();
/**
* Set the context for all the selectors.
* By default they are evaluated in all the document.
*/
public void setRoot(Node node);
/**
* Get the configured root context.
*/
public Node getRoot();
/**
* Used for benchmarking purposes, it returns true if the selector engine
* for this browser is using a pure javascript implementation or a native
* one.
*
* It is useful to check if IE8 native selectors are being used.
*/
public boolean isDegradated();
}

+ 61
- 61
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilder.java Ver fichero

@@ -1,61 +1,61 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import com.google.gwt.query.client.Properties;
/**
* Tagging interface used to generate JsonBuilder classes.
*/
public interface JsonBuilder {
/**
* load a properties object.
*/
<J> J load(Object prp);
/**
* parses a json string and loads the resulting properties object.
*/
<J> J parse(String json);
/**
* parses a json string and loads the resulting properties object,
* if the param 'fix' is true, the syntax of the json string will be
* checked previously and fixed when possible.
*/
<J> J parse(String json, boolean fix);
/**
* Returns the javascript properties object.
*/
Properties getProperties();
/**
* return a list of field names.
*/
String[] getFieldNames();
/**
* return a string which represents the object with an alias for the className
*/
String toJson();
/**
* return the Json name for this class
*/
String getJsonName();
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import com.google.gwt.query.client.Properties;
/**
* Tagging interface used to generate JsonBuilder classes.
*/
public interface JsonBuilder {
/**
* load a properties object.
*/
<J> J load(Object prp);
/**
* parses a json string and loads the resulting properties object.
*/
<J> J parse(String json);
/**
* parses a json string and loads the resulting properties object,
* if the param 'fix' is true, the syntax of the json string will be
* checked previously and fixed when possible.
*/
<J> J parse(String json, boolean fix);
/**
* Returns the javascript properties object.
*/
Properties getProperties();
/**
* return a list of field names.
*/
String[] getFieldNames();
/**
* return a string which represents the object with an alias for the className
*/
String toJson();
/**
* return the Json name for this class
*/
String getJsonName();
}

+ 12
- 12
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -22,19 +22,19 @@ import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsUtils;

public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements JsonBuilder {
protected Properties p = Properties.create();

@SuppressWarnings("unchecked")
public J parse(String json) {
return load(JsUtils.parseJSON(json));
}
@SuppressWarnings("unchecked")
public J parse(String json, boolean fix) {
return fix ? parse(Properties.wrapPropertiesString(json)) : parse(json);
}
@SuppressWarnings("unchecked")
public J load(Object prp) {
assert prp == null || prp instanceof JavaScriptObject || prp instanceof String;
@@ -58,7 +58,7 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
p.set(n, a);
}
}
@SuppressWarnings("unchecked")
protected <T> T[] getArrayBase(String n, T[] r, Class<T> clazz) {
JsObjectArray<?> a = p.getArray(n).cast();
@@ -72,22 +72,22 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
break;
}
c = c.getSuperclass();
} while (c != null);
} while (c != null);
}
return r;
}
protected Properties getPropertiesBase(String n) {
Properties r = p.getJavaScriptObject(n);
return r != null ? r : Properties.create();
}
public String toString() {
return p.tostring();
}
public Properties getProperties() {
return p;
}
}

+ 31
- 31
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/Name.java Ver fichero

@@ -1,31 +1,31 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to specify the attribute, tag or property name
* in Json or Xml builders.
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Name {
String value();
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import static java.lang.annotation.ElementType.METHOD;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation used to specify the attribute, tag or property name
* in Json or Xml builders.
*/
@Target({METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Name {
String value();
}

+ 81
- 81
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilder.java Ver fichero

@@ -1,81 +1,81 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import java.util.Date;
import com.google.gwt.dom.client.Element;
/**
* Tagging interface used to generate XmlBuilder classes.
*/
public interface XmlBuilder {
/**
* load a string or a documentElement.
*/
<J> J load(Object o);
/**
* parses a xml string and loads the resulting documentElement.
*/
<J> J parse(String xml);
/**
* Returns the documentElement.
*/
Element getRootElement();
/**
* Appends a node
*/
void append(XmlBuilder x);
/**
* Appends xml content
*/
void append(String x);
/**
* Returns the text content of the element
*/
String getText();
/**
* Sets the text content of the element
*/
<J> J setText(String t);
/**
* Returns the text content of the element as a number
*/
double getTextAsNumber();
/**
* Returns the text content of the element as a date
*/
Date getTextAsDate();
/**
* Returns whether the text content of the element is true or false.
* It is false when the string matches false, off, 0 or empty.
*/
boolean getTextAsBoolean();
/**
* Returns the Enum value of the text content of the element.
*/
<T extends Enum<T>> T getTextAsEnum(Class<T> clazz);
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.builders;
import java.util.Date;
import com.google.gwt.dom.client.Element;
/**
* Tagging interface used to generate XmlBuilder classes.
*/
public interface XmlBuilder {
/**
* load a string or a documentElement.
*/
<J> J load(Object o);
/**
* parses a xml string and loads the resulting documentElement.
*/
<J> J parse(String xml);
/**
* Returns the documentElement.
*/
Element getRootElement();
/**
* Appends a node
*/
void append(XmlBuilder x);
/**
* Appends xml content
*/
void append(String x);
/**
* Returns the text content of the element
*/
String getText();
/**
* Sets the text content of the element
*/
<J> J setText(String t);
/**
* Returns the text content of the element as a number
*/
double getTextAsNumber();
/**
* Returns the text content of the element as a date
*/
Date getTextAsDate();
/**
* Returns whether the text content of the element is true or false.
* It is false when the string matches false, off, 0 or empty.
*/
boolean getTextAsBoolean();
/**
* Returns the Enum value of the text content of the element.
*/
<T extends Enum<T>> T getTextAsEnum(Class<T> clazz);
}

+ 21
- 21
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/XmlBuilderBase.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -27,18 +27,18 @@ import com.google.gwt.query.client.Properties;
import com.google.gwt.query.client.js.JsUtils;

public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements XmlBuilder {
//TODO empty document
protected GQuery g = $((Element)JsUtils.parseXML("<root/>"));

public void append(String xml) {
g.append(JsUtils.parseXML(xml));
}
public void append(XmlBuilder x) {
g.append(x.getRootElement());
}
protected Boolean getBooleanBase(String n) {
return "true".equalsIgnoreCase(getStrBase(n));
}
@@ -46,38 +46,38 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
protected Element getElementBase(String n) {
return g.children(n).get(0);
}
protected Element[] getElementsBase(String n) {
return g.children(n).elements();
}
protected float getFloatBase(String s) {
String n = getStrBase(s).replaceAll("[^\\d\\-\\.]", "");
return n.isEmpty() ? 0 : Float.parseFloat(n);
}
protected Properties getPropertiesBase(String n) {
// TODO:
return null;
}
public Element getRootElement() {
return g.get(0);
}
protected String getStrBase(String n) {
return g.attr(n);
}
public String getText() {
return g.text();
}
public double getTextAsNumber() {
String t = g.text().replaceAll("[^\\d\\.\\-]", "");
return t.isEmpty() ? 0 : Double.parseDouble(t);
}
public Date getTextAsDate() {
String t = g.text().trim();
if (t.matches("\\d+")) {
@@ -86,17 +86,17 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
return new Date((long)JsDate.parse(t));
}
}
public boolean getTextAsBoolean() {
String t = g.text().trim().toLowerCase();
return !t.matches("^(|false|off|0)$");
}
public <T extends Enum<T>> T getTextAsEnum(Class<T> clazz) {
String t = g.text().trim();
return Enum.valueOf(clazz, t);
}
@SuppressWarnings("unchecked")
public J load(Object o) {
assert o == null || o instanceof JavaScriptObject && JsUtils.isElement((JavaScriptObject)o) || o instanceof String;
@@ -108,12 +108,12 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
}
return (J)this;
}
@SuppressWarnings("unchecked")
public J parse(String xml) {
return load(JsUtils.parseXML(xml));
}
protected <T> void setArrayBase(String n, T[] r) {
String v = "";
for (T t: r) {
@@ -121,7 +121,7 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
}
setBase(n, v);
}
protected void setBase(String n, Object v) {
g.attr(n, v);
}
@@ -131,7 +131,7 @@ public abstract class XmlBuilderBase<J extends XmlBuilderBase<?>> implements Xml
g.text(t);
return (T)this;
}
public String toString() {
return g.toString();
}

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 6
- 6
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -27,9 +27,9 @@ public class BackgroundPositionProperty extends

/**
* Value for <i>background-position</i> property.
*
*
* @author Julien Dramaix (julien.dramaix@gmail.com)
*
*
*/
public static class BackgroundPosition implements HasCssName {

@@ -136,7 +136,7 @@ public class BackgroundPositionProperty extends
BOTTOM = new BackgroundPosition(BOTTOM_VALUE);

}
/**
* Return a {@link BackgroundPosition} by specifying the horizontal and
* vertical position. Pixel will be used as Unit

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -27,7 +27,7 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
* <i>'background-image'</i>, <i>'background-repeat'</i>,
* <i>'background-attachment'</i> and <i>'background-position'</i>) at the same
* place in the style sheet.
*
*
*/
public class BackgroundProperty implements HasCssValue {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 6
- 6
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -26,8 +26,8 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
* <i>margin</i> and <i>padding</i> properties, the <i>border</i> property
* cannot set different values on the four borders. To do so, one or more of the
* other border properties must be used.
*
*
*
*
*/
public class BorderProperty implements HasCssValue {

@@ -67,7 +67,7 @@ public class BorderProperty implements HasCssValue {
RGBColor borderColor) {
return new MultipleValueCssSetter(getCssName(), borderWidth, borderStyle, borderColor);
}
public CssSetter with(Length borderWidth, BorderStyle borderStyle,
RGBColor borderColor) {
return new MultipleValueCssSetter(getCssName(), borderWidth, borderStyle, borderColor);

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -29,7 +29,7 @@ public class BorderSpacingProperty extends

/**
* value for <i>border-spacing</i> property.
*
*
*/
public static class BorderSpacing implements HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 135
- 135
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -26,7 +26,7 @@ public class CaptionSideProperty extends

/**
* Possible values for <i>caption-side</i> property.
*
*
*/
public enum CaptionSide implements HasCssName {
/**

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -25,7 +25,7 @@ public class ClearProperty extends CssProperty<ClearProperty.Clear> {

/**
* Possible values for <i>clear</i> property.
*
*
*/
public static enum Clear implements HasCssName {


+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -27,7 +27,7 @@ public class ClipProperty extends CssProperty<ClipProperty.Shape> {

/**
* Object defining a clipping region used as value for <i>clip</i> property.
*
*
*/
public static class Shape implements HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 5
- 5
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -21,7 +21,7 @@ import com.google.gwt.dom.client.Style.HasCssName;

/**
* Base class for Css property
*
*
* @param <T> Class of the value associated with the css property
*/
public class CssProperty<T extends HasCssName> implements
@@ -41,7 +41,7 @@ public class CssProperty<T extends HasCssName> implements
set(e.getStyle(), cssValue);
}
}
private String cssName;

protected CssProperty(String cssName) {

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -32,7 +32,7 @@ public class CursorProperty extends CssProperty<Cursor> {
private CursorProperty() {
super(CSS_PROPERTY);
}
public CssSetter with(UriValue url){
return new SimpleCssSetter(this, url);
}

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -29,7 +29,7 @@ public class DirectionProperty extends

/**
* Possible values for <i>direction</i> property.
*
*
*/
public static enum Direction implements HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -31,5 +31,5 @@ public class EdgePositionProperty extends CssProperty<Length> {
private EdgePositionProperty(String value) {
super(value);
}
}

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -29,7 +29,7 @@ public class EmptyCellsProperty extends

/**
* Possible values for <i>empty-cells</i> property.)
*
*
*/
public enum EmptyCells implements HasCssName {
/**

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/HasCssValue.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -20,7 +20,7 @@ import com.google.gwt.dom.client.Style.HasCssName;

/**
* Minimal contract for an object defining a css property
*
*
*/
public interface HasCssValue extends HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/Length.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -86,7 +86,7 @@ public class Length implements HasCssName {
public static Length mm(double amt) {
return new Length(amt + Unit.MM.getType());
}
/**
* Size in millimeters.
*/

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -21,7 +21,7 @@ package com.google.gwt.query.client.css;
* inline-level elements, it specifies the minimal height of each generated
* inline box.
* </p>
*
*
* <p>
* If the property is set on an inline-level element, it specifies the exact
* height of each box generated by the element. (Except for inline replaced

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -26,7 +26,7 @@ public class ListStylePositionProperty extends

/**
* Possible values for <i>list-style-position</i> property.
*
*
*/
public static enum ListStylePosition implements HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/MultipleValueCssSetter.java Ver fichero

@@ -4,14 +4,14 @@ import com.google.gwt.dom.client.Style.HasCssName;

public class MultipleValueCssSetter extends SimpleCssSetter {

public MultipleValueCssSetter(String cssPropertyName, HasCssName... values) {
super(cssPropertyName, computeValue(values));
}
protected static String computeValue(HasCssName... values){
StringBuilder valueBuilder = new StringBuilder();
for (HasCssName cssValue : values){
valueBuilder.append(notNull(cssValue));
}
@@ -23,5 +23,5 @@ public class MultipleValueCssSetter extends SimpleCssSetter {
private static String notNull(HasCssName value) {
return value != null ? value.getCssName() + " " : "";
}
}

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -23,7 +23,7 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
/**
* An outline is a line that is drawn around elements (outside the borders) to
* make the element "stand out".
*
*
* The outline shorthand property sets all the outline properties in one
* declaration.
*/

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -34,7 +34,7 @@ public class OutlineWidthProperty extends CssProperty<BorderWidth>
private OutlineWidthProperty() {
super(CSS_PROPERTY);
}
public CssSetter with(Length value) {
return new SimpleCssSetter(this, value);
}

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/SimpleCssSetter.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -28,7 +28,7 @@ public class SimpleCssSetter implements CssSetter {

private String property;
private String value;
public SimpleCssSetter(HasCssValue property, HasCssName value) {
this(property.getCssName(), value != null ? value.getCssName() : null);
}

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesCssValue.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesInteger.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -20,7 +20,7 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
/**
* Interface to be implemented by properties which take a integer as defined in
* css2 specification
*
*
* @see http://www.w3.org/TR/CSS21/syndata.html#value-def-number
*/
public interface TakesInteger extends HasCssValue {

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesLength.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesNumber.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -20,7 +20,7 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
/**
* Interface to be implemented by properties which take a number as defined in
* css2 specification
*
*
* @see http://www.w3.org/TR/CSS21/syndata.html#value-def-number
*/
public interface TakesNumber extends TakesInteger {

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -28,7 +28,7 @@ public class TextAlignProperty extends
* Possible value for <i>text-align</i> property.
*/
public static enum TextAlign implements HasCssName {
/**
* Align the line box with the left side of the containing box.
*/

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -25,7 +25,7 @@ public class UnicodeBidiProperty extends

/**
* Define possible values for <i>unicode-bidi</i> property
*
*
*/
public static enum UnicodeBidi implements HasCssName {


+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/UriValue.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 6
- 6
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -20,10 +20,10 @@ import com.google.gwt.query.client.css.TakesCssValue.CssSetter;

/**
* The z-index property specifies the stack order of an element.
*
*
* An element with greater stack order is always in front of an element with a
* lower stack order.
*
*
* The z-index property only works on positioned elements (position:absolute,
* position:relative, or position:fixed).
*/
@@ -38,7 +38,7 @@ public class ZIndexProperty implements TakesInteger {
private ZIndexProperty() {
}

public String getCssName() {
return CSS_PROPERTY;
}

+ 7
- 7
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/AttributeImpl.java Ver fichero

@@ -1,11 +1,11 @@
/* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -23,7 +23,7 @@ import com.google.gwt.query.client.js.JsUtils;
* Helper class for setting and getting attribute on an element.
*/
public class AttributeImpl {
/**
* Interface used for attribute setter implementations.
*/
@@ -54,7 +54,7 @@ public class AttributeImpl {
e.setAttribute(key, String.valueOf(value));
}
}
/**
* value must be set on element directly
*/
@@ -102,7 +102,7 @@ public class AttributeImpl {
super.setAttribute(e, key, key.toLowerCase());
}
}
/**
* Id attribute.
*/
@@ -121,7 +121,7 @@ public class AttributeImpl {
super.setAttribute(e, key, value);
}
}
/**
* For button and inputs, the type cannot be changed once the element is
* attached to the dom !

+ 3
- 3
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/AttributeTridentImpl.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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

+ 33
- 33
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -29,18 +29,18 @@ import com.google.gwt.user.client.DOM;
* A helper class to get computed CSS styles for elements.
*/
public class DocumentStyleImpl {
private static final JsRegexp cssNumberRegex = new JsRegexp("^(fillOpacity|fontWeight|lineHeight|opacity|orphans|widows|zIndex|zoom)$", "i");
private static final JsRegexp sizeRegex = new JsRegexp("^(client|offset|)(width|height)$", "i");


/**
* Returns the numeric value of a css property.
*
*
* The parameter force has a special meaning:
* - When force is false, returns the value of the css property defined
* in the set of style attributes.
* - Otherwise it returns the real computed value.
* in the set of style attributes.
* - Otherwise it returns the real computed value.
*/
public double cur(Element elem, String prop, boolean force) {
if (JsUtils.isWindow(elem)) {
@@ -51,8 +51,8 @@ public class DocumentStyleImpl {
return getContentDocument(elem).getClientHeight();
}
elem = GQuery.body;
}
}
if (force && sizeRegex.test(prop)) {
// make curCSS below resolve width and height (issue #145) when force is true
} else if (elem.getPropertyString(prop) != null
@@ -69,20 +69,20 @@ public class DocumentStyleImpl {
return (1);
}
if (!val.matches("^[\\d\\.]+.*$")) {
val = curCSS(elem, prop, false);
val = curCSS(elem, prop, false);
}
val = val.trim().replaceAll("[^\\d\\.\\-]+.*$", "");
return val.isEmpty() ? 0 : Double.parseDouble(val);
}
/**
* Return the string value of a css property of an element.
*
*
* The parameter force has a special meaning:
* - When force is false, returns the value of the css property defined
* in the set of style attributes.
* - Otherwise it returns the real computed value.
*
* in the set of style attributes.
* - Otherwise it returns the real computed value.
*
* For instance if you do not define 'display=none' in the element style but in
* the css stylesheet, it will return an empty string unless you pass the
* parameter force=true.
@@ -94,15 +94,15 @@ public class DocumentStyleImpl {
name = fixPropertyName(name);
//value defined in the element style
String ret = elem.getStyle().getProperty(name);
if (force) {
Element toDetach = null;
if (JsUtils.isDetached(elem)) {
// If the element is detached to the DOM we attach temporary to it
toDetach = attachTemporary(elem);
}
if (sizeRegex.test(name)) {
ret = getVisibleSize(elem, name) + "px";
} else if ("opacity".equalsIgnoreCase(name)) {
@@ -110,7 +110,7 @@ public class DocumentStyleImpl {
} else {
ret = getComputedStyle(elem, JsUtils.hyphenize(name), name, null);
}
// If the element was previously attached, detached it.
if (toDetach != null) {
toDetach.removeFromParent();
@@ -119,10 +119,10 @@ public class DocumentStyleImpl {

return ret == null ? "" : ret;
}
private Element attachTemporary(Element elem) {
Element lastParent = $(elem).parents().last().get(0);
if (lastParent == null){
//the element itself is detached
lastParent = elem;
@@ -144,7 +144,7 @@ public class DocumentStyleImpl {
}
return JsUtils.camelize(name);
}
public int getVisibleSize(Element e, String name) {
int ret;
if (!isVisible(e)) {
@@ -173,7 +173,7 @@ public class DocumentStyleImpl {
setStyleProperty(e, "height", "auto");
}
}
private int getSize(Element e, String name) {
int ret = 0;
if ("width".equals(name)) {
@@ -187,21 +187,21 @@ public class DocumentStyleImpl {
} else if ("offsetWidth".equals(name)) {
ret = e.getOffsetWidth();
} else if ("offsetHeight".equals(name)) {
ret = e.getOffsetHeight();
ret = e.getOffsetHeight();
}
return ret;
}
public int getHeight(Element e) {
fixInlineElement(e);
return (int) (e.getClientHeight() - num(curCSS(e, "paddingTop", true)) - num(curCSS(e, "paddingBottom", true)));
}
public double getOpacity(Element e) {
String o = e.getStyle().getOpacity();
return JsUtils.truth(o) ? num(o) : 1;
}
public int getWidth(Element e) {
fixInlineElement(e);
return (int) (e.getClientWidth() - num(curCSS(e, "paddingLeft", true)) - num(curCSS(e, "paddingRight", true)));
@@ -225,7 +225,7 @@ public class DocumentStyleImpl {
public void removeStyleProperty(Element elem, String prop) {
elem.getStyle().setProperty(prop, "");
}
/**
* Set the value of a style property of an element.
*/
@@ -257,11 +257,11 @@ public class DocumentStyleImpl {
return cStyle && cStyle.getPropertyValue ? cStyle.getPropertyValue(hyphenName) : null;
} catch(e) {return null;}
}-*/;
protected static final JsNamedArray<String> elemdisplay = JsNamedArray.create();
/**
* Returns the default display value for each html tag.
* Returns the default display value for each html tag.
*/
public String defaultDisplay(String tagName) {
String ret = elemdisplay.get(tagName);
@@ -277,14 +277,14 @@ public class DocumentStyleImpl {
}
return ret;
}
public native Document getContentDocument(Node n) /*-{
var d = n.contentDocument || n.document || n.contentWindow.document;
if (!d.body)
this.@com.google.gwt.query.client.impl.DocumentStyleImpl::emptyDocument(Lcom/google/gwt/dom/client/Document;)(d);
return d;
}-*/;
public native void emptyDocument(Document d) /*-{
d.open();
d.write("<head/><body/>");

+ 8
- 8
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -22,7 +22,7 @@ import com.google.gwt.dom.client.Style;
* A helper class to get computed CSS styles for elements on IE6.
*/
public class DocumentStyleImplIE extends DocumentStyleImpl {
/**
* Fix style property names.
*/
@@ -58,7 +58,7 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
return (int) (e.getOffsetWidth() - num(curCSS(e, "paddingLeft", true)) - num(curCSS(e, "paddingRight", true))
- num(curCSS(e, "borderRightWidth", true)) - num(curCSS(e, "borderRightWidth", true)));
}
/**
* Remove a style property from an element.
*/
@@ -66,10 +66,10 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
if (e && e.style && 'removeAttribute' in e)
e.style.removeAttribute(prop);
}-*/;

/**
* Set the value of a style property of an element.
* Set the value of a style property of an element.
* IE needs a special workaround to handle opacity
*/
@Override
@@ -80,7 +80,7 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
super.setStyleProperty(e, prop, val);
}
}
@Override
protected native String getComputedStyle(Element elem, String hyphenName,
String camelName, String pseudo) /*-{

+ 4
- 4
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/HasSelector.java Ver fichero

@@ -1,12 +1,12 @@
/*
* Copyright 2011, The gwtquery team.
*
*
* 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
@@ -20,7 +20,7 @@ import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;

public interface HasSelector {
/**
* Parse and execute a given selector expression given a context.
*

+ 182
- 182
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngine.java Ver fichero

@@ -1,182 +1,182 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsRegexp;
import com.google.gwt.query.client.js.JsUtils;
/**
* Core Selector engine functions, and native JS utility functions.
*/
public class SelectorEngine implements HasSelector {
private static DocumentStyleImpl styleImpl;
public static native NodeList<Element> getElementsByClassName(String clazz,
Node ctx) /*-{
return ctx.getElementsByClassName(clazz);
}-*/;
public static native Node getNextSibling(Node n) /*-{
return n.nextSibling || null;
}-*/;
public static native Node getPreviousSibling(Node n) /*-{
return n.previousSibling || null;
}-*/;
public NodeList<Element> querySelectorAll(String selector, Node ctx) {
if (!hasQuerySelector) {
return impl.select(selector, ctx);
}
try {
return querySelectorAllImpl(selector, ctx);
} catch (Exception e) {
return impl.select(selector, ctx);
}
}
public static native NodeList<Element> querySelectorAllImpl(String selector,
Node ctx) /*-{
return ctx.querySelectorAll(selector);
}-*/;
public static native NodeList<Element> elementsByTagName(String selector,
Node ctx) /*-{
return ctx.getElementsByTagName(selector);
}-*/;
public static native NodeList<Element> elementsByClassName(String selector,
Node ctx) /*-{
return ctx.getElementsByClassName(selector);
}-*/;
public static NodeList<Element> veryQuickId(String id, Node ctx) {
Document d = ctx.getNodeType() == Node.DOCUMENT_NODE
? ctx.<Document> cast() : ctx.getOwnerDocument();
return JsNodeArray.create(d.getElementById(id));
}
public static NodeList<Element> xpathEvaluate(String selector, Node ctx) {
return xpathEvaluate(selector, ctx, JsNodeArray.create());
}
public static native NodeList<Element> xpathEvaluate(String selector,
Node ctx, JsNodeArray r) /*-{
var node;
var ownerDoc = ctx && (ctx.ownerDocument || ctx );
var evalDoc = ownerDoc ? ownerDoc : $doc;
var result = evalDoc.evaluate(selector, ctx, null, 0, null);
while ((node = result.iterateNext())) {
r.push(node);
}
return r;
}-*/;
public final SelectorEngineImpl impl;
protected Node root = Document.get();
public static final boolean hasQuerySelector = hasQuerySelectorAll();
public SelectorEngine() {
impl = (SelectorEngineImpl) GWT.create(SelectorEngineImpl.class);
GWT.log("GQuery - Created SelectorEngineImpl: " + impl.getClass().getName());
styleImpl = GWT.create(DocumentStyleImpl.class);
GWT.log("GQuery - Created DocumentStyleImpl: " + styleImpl.getClass().getName());
}
public Node getRoot() {
return root;
}
public NodeList<Element> filterByVisibility (NodeList<Element> nodes, boolean visible) {
JsNodeArray res = JsNodeArray.create();
for (int i = 0, l = nodes.getLength(), j = 0; i < l; i++) {
Element e = nodes.getItem(i);
if (visible == ((e.getOffsetWidth() + e.getOffsetHeight()) > 0 && styleImpl.isVisible(e))) {
res.addNode(e, j++);
}
}
return res;
}
// pseudo selectors which are computed by gquery
JsRegexp p = new JsRegexp("(.*):((visible|hidden)|((button|checkbox|file|hidden|image|password|radio|reset|submit|text)\\s*(,|$)))(.*)", "i");
public NodeList<Element> select(String selector, Node ctx) {
if (p.test(selector)) {
JsNodeArray res = JsNodeArray.create();
for (String s : selector.trim().split("\\s*,\\s*")) {
NodeList<Element> nodes;
JsObjectArray<String> a = p.match(s);
if (a.get(0) != null) {
if (s.endsWith(":visible")) {
nodes = filterByVisibility(select(s.substring(0, s.length() - 8), ctx), true);
} else if (s.endsWith(":hidden")) {
nodes = filterByVisibility(select(s.substring(0, s.length() - 7), ctx), false);
} else {
nodes = select((a.get(1) != null ? a.get(1) : "") + "[type=" + a.get(2) + "]", ctx);
}
} else {
nodes = select(s, ctx);
}
JsUtils.copyNodeList(res, nodes, false);
}
return res.<NodeList<Element>> cast();
} else {
return impl.select(selector, ctx);
}
}
public native boolean contains(Element a, Element b) /*-{
return a.contains ? a != b && a.contains(b) : !!(a.compareDocumentPosition(b) & 16)
}-*/;
public void setRoot(Node root) {
assert root != null;
this.root = root;
}
public String getName() {
return getClass().getName().replaceAll("^.*\\.", "");
}
public boolean isDegradated() {
return !hasQuerySelector;
}
/**
* Check if the browser has native support for css selectors
*/
public static native boolean hasQuerySelectorAll() /*-{
return $doc.location.href.indexOf("_force_no_native") < 0 &&
$doc.querySelectorAll &&
/native/.test(String($doc.querySelectorAll)) ? true : false;
}-*/;
public static native boolean hasXpathEvaluate() /*-{
return $doc.evaluate ? true : false;
}-*/;
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsRegexp;
import com.google.gwt.query.client.js.JsUtils;
/**
* Core Selector engine functions, and native JS utility functions.
*/
public class SelectorEngine implements HasSelector {
private static DocumentStyleImpl styleImpl;
public static native NodeList<Element> getElementsByClassName(String clazz,
Node ctx) /*-{
return ctx.getElementsByClassName(clazz);
}-*/;
public static native Node getNextSibling(Node n) /*-{
return n.nextSibling || null;
}-*/;
public static native Node getPreviousSibling(Node n) /*-{
return n.previousSibling || null;
}-*/;
public NodeList<Element> querySelectorAll(String selector, Node ctx) {
if (!hasQuerySelector) {
return impl.select(selector, ctx);
}
try {
return querySelectorAllImpl(selector, ctx);
} catch (Exception e) {
return impl.select(selector, ctx);
}
}
public static native NodeList<Element> querySelectorAllImpl(String selector,
Node ctx) /*-{
return ctx.querySelectorAll(selector);
}-*/;
public static native NodeList<Element> elementsByTagName(String selector,
Node ctx) /*-{
return ctx.getElementsByTagName(selector);
}-*/;
public static native NodeList<Element> elementsByClassName(String selector,
Node ctx) /*-{
return ctx.getElementsByClassName(selector);
}-*/;
public static NodeList<Element> veryQuickId(String id, Node ctx) {
Document d = ctx.getNodeType() == Node.DOCUMENT_NODE
? ctx.<Document> cast() : ctx.getOwnerDocument();
return JsNodeArray.create(d.getElementById(id));
}
public static NodeList<Element> xpathEvaluate(String selector, Node ctx) {
return xpathEvaluate(selector, ctx, JsNodeArray.create());
}
public static native NodeList<Element> xpathEvaluate(String selector,
Node ctx, JsNodeArray r) /*-{
var node;
var ownerDoc = ctx && (ctx.ownerDocument || ctx );
var evalDoc = ownerDoc ? ownerDoc : $doc;
var result = evalDoc.evaluate(selector, ctx, null, 0, null);
while ((node = result.iterateNext())) {
r.push(node);
}
return r;
}-*/;
public final SelectorEngineImpl impl;
protected Node root = Document.get();
public static final boolean hasQuerySelector = hasQuerySelectorAll();
public SelectorEngine() {
impl = (SelectorEngineImpl) GWT.create(SelectorEngineImpl.class);
GWT.log("GQuery - Created SelectorEngineImpl: " + impl.getClass().getName());
styleImpl = GWT.create(DocumentStyleImpl.class);
GWT.log("GQuery - Created DocumentStyleImpl: " + styleImpl.getClass().getName());
}
public Node getRoot() {
return root;
}
public NodeList<Element> filterByVisibility (NodeList<Element> nodes, boolean visible) {
JsNodeArray res = JsNodeArray.create();
for (int i = 0, l = nodes.getLength(), j = 0; i < l; i++) {
Element e = nodes.getItem(i);
if (visible == ((e.getOffsetWidth() + e.getOffsetHeight()) > 0 && styleImpl.isVisible(e))) {
res.addNode(e, j++);
}
}
return res;
}
// pseudo selectors which are computed by gquery
JsRegexp p = new JsRegexp("(.*):((visible|hidden)|((button|checkbox|file|hidden|image|password|radio|reset|submit|text)\\s*(,|$)))(.*)", "i");
public NodeList<Element> select(String selector, Node ctx) {
if (p.test(selector)) {
JsNodeArray res = JsNodeArray.create();
for (String s : selector.trim().split("\\s*,\\s*")) {
NodeList<Element> nodes;
JsObjectArray<String> a = p.match(s);
if (a.get(0) != null) {
if (s.endsWith(":visible")) {
nodes = filterByVisibility(select(s.substring(0, s.length() - 8), ctx), true);
} else if (s.endsWith(":hidden")) {
nodes = filterByVisibility(select(s.substring(0, s.length() - 7), ctx), false);
} else {
nodes = select((a.get(1) != null ? a.get(1) : "") + "[type=" + a.get(2) + "]", ctx);
}
} else {
nodes = select(s, ctx);
}
JsUtils.copyNodeList(res, nodes, false);
}
return res.<NodeList<Element>> cast();
} else {
return impl.select(selector, ctx);
}
}
public native boolean contains(Element a, Element b) /*-{
return a.contains ? a != b && a.contains(b) : !!(a.compareDocumentPosition(b) & 16)
}-*/;
public void setRoot(Node root) {
assert root != null;
this.root = root;
}
public String getName() {
return getClass().getName().replaceAll("^.*\\.", "");
}
public boolean isDegradated() {
return !hasQuerySelector;
}
/**
* Check if the browser has native support for css selectors
*/
public static native boolean hasQuerySelectorAll() /*-{
return $doc.location.href.indexOf("_force_no_native") < 0 &&
$doc.querySelectorAll &&
/native/.test(String($doc.querySelectorAll)) ? true : false;
}-*/;
public static native boolean hasXpathEvaluate() /*-{
return $doc.evaluate ? true : false;
}-*/;
}

+ 275
- 275
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineCssToXPath.java Ver fichero

@@ -1,275 +1,275 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
import java.util.ArrayList;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.js.JsNamedArray;
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsRegexp;
import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.regexp.shared.RegExp;
/**
* Runtime selector engine implementation which translates selectors to XPath
* and delegates to document.evaluate().
* It is based on the regular expressions taken from Andrea Giammarchi's Css2Xpath
*/
public class SelectorEngineCssToXPath extends SelectorEngineImpl {
static JsNamedArray<String> cache;
/**
* Interface for callbacks in replaceAll operations.
*/
public static interface ReplaceCallback {
String foundMatch(ArrayList<String> s);
}
/**
* Interface for replacer implementations (GWT and JVM).
*/
public static interface Replacer {
String replaceAll(String s, String expr, Object replacement);
}
private static SelectorEngineCssToXPath instance;
private static ReplaceCallback rc_scp = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return s.get(1) + s.get(2) +
(s.get(3).startsWith(" ") ? "%S%" : s.get(3).startsWith("#") ? "%H%" : "%P%") +
s.get(4) + s.get(5);
}
};
private static ReplaceCallback rc_$Attr = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return "[substring(@" + s.get(1) + ",string-length(@" + s.get(1) + ")-" + (s.get(2).replaceAll("'", "").length() - 1) + ")=" + s.get(2) + "]";
}
};
private static ReplaceCallback rc_Not = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return s.get(1) + "[not(" + getInstance().css2Xpath(s.get(2)).replaceAll("^[^\\[]+\\[([^\\]]*)\\].*$", "$1" + ")]");
}
};
private static ReplaceCallback rc_nth_child = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
String s1 = s.get(1);
String s2 = s.get(2);
boolean noPrefix = s1 == null || s1.length() == 0;
if ("n".equals(s2)) {
return s1;
}
if ("even".equals(s2)) {
return "*[position() mod 2=0 and position()>=0]" + (noPrefix ? "" : "/self::" + s1);
}
if ("odd".equals(s2)) {
String prefix = noPrefix ? "" : s1;
return prefix + "[(count(preceding-sibling::*) + 1) mod 2=1]";
}
if (!s2.contains("n")){
return "*[position() = "+s2+"]" + (noPrefix ? "" : "/self::" + s1);
}
String[] t = s2.replaceAll("^([0-9]*)n.*?([0-9]*)?$", "$1+$2").split("\\+");
String t0 = t[0];
String t1 = t.length > 1 ? t[1] : "0";
return "*[(position()-" + t1 + ") mod " + t0 + "=0 and position()>=" + t1 + "]" + (noPrefix ? "" : "/self::" + s1);
}
};
public static Object[] regs = new Object[]{
// scape some dots and spaces
"(['\\[])([^'\\]]*)([\\s\\.#])([^'\\]]*)(['\\]])", rc_scp,
// add @ for attrib
"\\[([^@\\]~\\$\\*\\^\\|\\!]+)(=[^\\]]+)?\\]", "[@$1$2]",
// multiple queries
"\\s*,\\s*", "|.//",
// , + ~ >
"\\s*(\\+|~|>)\\s*", "$1",
//* ~ + >
"([\\w\\-\\*])~([\\w\\-\\*])", "$1/following-sibling::$2",
"([\\w\\-\\*])\\+([\\w\\-\\*])", "$1/following-sibling::*[1]/self::$2",
"([\\w\\-\\*])>([\\w\\-\\*])", "$1/$2",
// all unescaped stuff escaped
"\\[([^=]+)=([^'|\"][^\\]]*)\\]", "[$1='$2']",
// all descendant or self to
"(^|[^\\w\\-\\*])(#|\\.)([\\w\\-]+)", "$1*$2$3",
"([\\>\\+\\|\\~\\,\\s])([a-zA-Z\\*]+)", "$1//$2",
"\\s+//", "//",
// :first-child
"([\\w\\-\\*]+):first-child", "*[1]/self::$1",
// :last-child
"([\\w\\-\\*]+):last-child", "$1[not(following-sibling::*)]",
// :only-child
"([\\w\\-\\*]+):only-child", "*[last()=1]/self::$1",
// :empty
"([\\w\\-\\*]+):empty", "$1[not(*) and not(normalize-space())]",
// :odd :even, this is intentional since sizzle behaves so
":odd" , ":nth-child(even)",
":even" , ":nth-child(odd)",
// :not
"(.+):not\\(([^\\)]*)\\)", rc_Not,
// :nth-child
"([a-zA-Z0-9\\_\\-\\*]*):nth-child\\(([^\\)]*)\\)", rc_nth_child,
// :contains(selectors)
":contains\\(([^\\)]*)\\)", "[contains(string(.),'$1')]",
// |= attrib
"\\[([\\w\\-]+)\\|=([^\\]]+)\\]", "[@$1=$2 or starts-with(@$1,concat($2,'-'))]",
// *= attrib
"\\[([\\w\\-]+)\\*=([^\\]]+)\\]", "[contains(@$1,$2)]",
// ~= attrib
"\\[([\\w\\-]+)~=([^\\]]+)\\]", "[contains(concat(' ',normalize-space(@$1),' '),concat(' ',$2,' '))]",
// ^= attrib
"\\[([\\w\\-]+)\\^=([^\\]]+)\\]", "[starts-with(@$1,$2)]",
// $= attrib
"\\[([\\w\\-]+)\\$=([^\\]]+)\\]", rc_$Attr,
// != attrib
"\\[([\\w\\-]+)\\!=([^\\]]+)\\]", "[not(@$1) or @$1!=$2]",
// ids and classes
"#([\\w\\-]+)", "[@id='$1']",
"\\.([\\w\\-]+)", "[contains(concat(' ',normalize-space(@class),' '),' $1 ')]",
// normalize multiple filters
"\\]\\[([^\\]]+)", " and ($1)",
// tag:pseudo
":(enabled)", "[not(@disabled)]",
":(checked)", "[@$1='$1']",
":(disabled)", "[@$1]",
":(first)", "[1]",
":(last)", "[last()]",
// put '*' when tag is omitted
"(^|\\|[\\./]*)(\\[)", "$1*$2",
// Replace escaped dots and spaces
"%S%"," ",
"%P%",".",
"%H%","#",
// Duplicated quotes
"'+","'",
};
public static SelectorEngineCssToXPath getInstance() {
if (instance == null) {
instance = new SelectorEngineCssToXPath();
}
return instance;
}
// This replacer only works in browser, it must be replaced
// when using this engine in generators and tests for the JVM
private Replacer replacer = new Replacer() {
public String replaceAll(String s, String r, Object o) {
JsRegexp p = new JsRegexp(r);
if (o instanceof ReplaceCallback) {
ReplaceCallback callback = (ReplaceCallback) o;
while (p.test(s)) {
JsObjectArray<String> a = p.match(s);
ArrayList<String> args = new ArrayList<String>();
for (int i = 0; i < a.length(); i++) {
args.add(a.get(i));
}
String f = callback.foundMatch(args);
s = s.replaceFirst(r, f);
}
return s;
} else {
return s.replaceAll(r, o.toString());
}
}
};
/**
* A replacer which works in both sides. Right now gquery JsRegexp is faster
* than gwt shared RegExp and does not uses HashSet
*/
public static final Replacer replacerGwt = new Replacer() {
public String replaceAll(String s, String r, Object o) {
RegExp p = RegExp.compile(r, "g");
if (o instanceof ReplaceCallback) {
ReplaceCallback callback = (ReplaceCallback) o;
com.google.gwt.regexp.shared.MatchResult a = null;
while ((a = p.exec(s)) != null) {
ArrayList<String> args = new ArrayList<String>();
for (int i = 0; i < a.getGroupCount(); i++) {
args.add(a.getGroup(i));
}
String f = callback.foundMatch(args);
s = s.replace(a.getGroup(0), f);
p = RegExp.compile(r, "g");
}
return s;
} else {
return p.replace(s, o.toString());
}
}
};
public SelectorEngineCssToXPath() {
instance = this;
}
public SelectorEngineCssToXPath(Replacer r) {
replacer = r;
instance = this;
}
public String css2Xpath(String selector) {
String ret = selector;
for (int i = 0; i < regs.length;) {
ret = replacer.replaceAll(ret, regs[i++].toString(), regs[i++]);
}
return ".//" + ret;
}
public NodeList<Element> select(String sel, Node ctx) {
if (cache == null) {
cache = JsNamedArray.create();
}
String xsel = cache.get(sel);
if (xsel == null) {
xsel = sel.startsWith("./") || sel.startsWith("/") ? sel : css2Xpath(sel);
cache.put(sel, xsel);
}
JsNodeArray elm = JsNodeArray.create();
try {
SelectorEngine.xpathEvaluate(xsel, ctx, elm);
return JsUtils.unique(elm.<JsArray<Element>> cast()).cast();
} catch (Exception e) {
if (!GWT.isScript()) {
if (!SelectorEngine.hasXpathEvaluate()) {
throw new RuntimeException("This Browser does not support Xpath selectors.", e);
}
System.err.println("ERROR: xpathEvaluate invalid xpath expression:"
+ xsel + " css-selector:" + sel + "\n");
e.printStackTrace();
}
return elm;
}
}
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
import java.util.ArrayList;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.query.client.js.JsNamedArray;
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsRegexp;
import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.regexp.shared.RegExp;
/**
* Runtime selector engine implementation which translates selectors to XPath
* and delegates to document.evaluate().
* It is based on the regular expressions taken from Andrea Giammarchi's Css2Xpath
*/
public class SelectorEngineCssToXPath extends SelectorEngineImpl {
static JsNamedArray<String> cache;
/**
* Interface for callbacks in replaceAll operations.
*/
public static interface ReplaceCallback {
String foundMatch(ArrayList<String> s);
}
/**
* Interface for replacer implementations (GWT and JVM).
*/
public static interface Replacer {
String replaceAll(String s, String expr, Object replacement);
}
private static SelectorEngineCssToXPath instance;
private static ReplaceCallback rc_scp = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return s.get(1) + s.get(2) +
(s.get(3).startsWith(" ") ? "%S%" : s.get(3).startsWith("#") ? "%H%" : "%P%") +
s.get(4) + s.get(5);
}
};
private static ReplaceCallback rc_$Attr = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return "[substring(@" + s.get(1) + ",string-length(@" + s.get(1) + ")-" + (s.get(2).replaceAll("'", "").length() - 1) + ")=" + s.get(2) + "]";
}
};
private static ReplaceCallback rc_Not = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
return s.get(1) + "[not(" + getInstance().css2Xpath(s.get(2)).replaceAll("^[^\\[]+\\[([^\\]]*)\\].*$", "$1" + ")]");
}
};
private static ReplaceCallback rc_nth_child = new ReplaceCallback() {
public String foundMatch(ArrayList<String> s) {
String s1 = s.get(1);
String s2 = s.get(2);
boolean noPrefix = s1 == null || s1.length() == 0;
if ("n".equals(s2)) {
return s1;
}
if ("even".equals(s2)) {
return "*[position() mod 2=0 and position()>=0]" + (noPrefix ? "" : "/self::" + s1);
}
if ("odd".equals(s2)) {
String prefix = noPrefix ? "" : s1;
return prefix + "[(count(preceding-sibling::*) + 1) mod 2=1]";
}
if (!s2.contains("n")){
return "*[position() = "+s2+"]" + (noPrefix ? "" : "/self::" + s1);
}
String[] t = s2.replaceAll("^([0-9]*)n.*?([0-9]*)?$", "$1+$2").split("\\+");
String t0 = t[0];
String t1 = t.length > 1 ? t[1] : "0";
return "*[(position()-" + t1 + ") mod " + t0 + "=0 and position()>=" + t1 + "]" + (noPrefix ? "" : "/self::" + s1);
}
};
public static Object[] regs = new Object[]{
// scape some dots and spaces
"(['\\[])([^'\\]]*)([\\s\\.#])([^'\\]]*)(['\\]])", rc_scp,
// add @ for attrib
"\\[([^@\\]~\\$\\*\\^\\|\\!]+)(=[^\\]]+)?\\]", "[@$1$2]",
// multiple queries
"\\s*,\\s*", "|.//",
// , + ~ >
"\\s*(\\+|~|>)\\s*", "$1",
//* ~ + >
"([\\w\\-\\*])~([\\w\\-\\*])", "$1/following-sibling::$2",
"([\\w\\-\\*])\\+([\\w\\-\\*])", "$1/following-sibling::*[1]/self::$2",
"([\\w\\-\\*])>([\\w\\-\\*])", "$1/$2",
// all unescaped stuff escaped
"\\[([^=]+)=([^'|\"][^\\]]*)\\]", "[$1='$2']",
// all descendant or self to
"(^|[^\\w\\-\\*])(#|\\.)([\\w\\-]+)", "$1*$2$3",
"([\\>\\+\\|\\~\\,\\s])([a-zA-Z\\*]+)", "$1//$2",
"\\s+//", "//",
// :first-child
"([\\w\\-\\*]+):first-child", "*[1]/self::$1",
// :last-child
"([\\w\\-\\*]+):last-child", "$1[not(following-sibling::*)]",
// :only-child
"([\\w\\-\\*]+):only-child", "*[last()=1]/self::$1",
// :empty
"([\\w\\-\\*]+):empty", "$1[not(*) and not(normalize-space())]",
// :odd :even, this is intentional since sizzle behaves so
":odd" , ":nth-child(even)",
":even" , ":nth-child(odd)",
// :not
"(.+):not\\(([^\\)]*)\\)", rc_Not,
// :nth-child
"([a-zA-Z0-9\\_\\-\\*]*):nth-child\\(([^\\)]*)\\)", rc_nth_child,
// :contains(selectors)
":contains\\(([^\\)]*)\\)", "[contains(string(.),'$1')]",
// |= attrib
"\\[([\\w\\-]+)\\|=([^\\]]+)\\]", "[@$1=$2 or starts-with(@$1,concat($2,'-'))]",
// *= attrib
"\\[([\\w\\-]+)\\*=([^\\]]+)\\]", "[contains(@$1,$2)]",
// ~= attrib
"\\[([\\w\\-]+)~=([^\\]]+)\\]", "[contains(concat(' ',normalize-space(@$1),' '),concat(' ',$2,' '))]",
// ^= attrib
"\\[([\\w\\-]+)\\^=([^\\]]+)\\]", "[starts-with(@$1,$2)]",
// $= attrib
"\\[([\\w\\-]+)\\$=([^\\]]+)\\]", rc_$Attr,
// != attrib
"\\[([\\w\\-]+)\\!=([^\\]]+)\\]", "[not(@$1) or @$1!=$2]",
// ids and classes
"#([\\w\\-]+)", "[@id='$1']",
"\\.([\\w\\-]+)", "[contains(concat(' ',normalize-space(@class),' '),' $1 ')]",
// normalize multiple filters
"\\]\\[([^\\]]+)", " and ($1)",
// tag:pseudo
":(enabled)", "[not(@disabled)]",
":(checked)", "[@$1='$1']",
":(disabled)", "[@$1]",
":(first)", "[1]",
":(last)", "[last()]",
// put '*' when tag is omitted
"(^|\\|[\\./]*)(\\[)", "$1*$2",
// Replace escaped dots and spaces
"%S%"," ",
"%P%",".",
"%H%","#",
// Duplicated quotes
"'+","'",
};
public static SelectorEngineCssToXPath getInstance() {
if (instance == null) {
instance = new SelectorEngineCssToXPath();
}
return instance;
}
// This replacer only works in browser, it must be replaced
// when using this engine in generators and tests for the JVM
private Replacer replacer = new Replacer() {
public String replaceAll(String s, String r, Object o) {
JsRegexp p = new JsRegexp(r);
if (o instanceof ReplaceCallback) {
ReplaceCallback callback = (ReplaceCallback) o;
while (p.test(s)) {
JsObjectArray<String> a = p.match(s);
ArrayList<String> args = new ArrayList<String>();
for (int i = 0; i < a.length(); i++) {
args.add(a.get(i));
}
String f = callback.foundMatch(args);
s = s.replaceFirst(r, f);
}
return s;
} else {
return s.replaceAll(r, o.toString());
}
}
};
/**
* A replacer which works in both sides. Right now gquery JsRegexp is faster
* than gwt shared RegExp and does not uses HashSet
*/
public static final Replacer replacerGwt = new Replacer() {
public String replaceAll(String s, String r, Object o) {
RegExp p = RegExp.compile(r, "g");
if (o instanceof ReplaceCallback) {
ReplaceCallback callback = (ReplaceCallback) o;
com.google.gwt.regexp.shared.MatchResult a = null;
while ((a = p.exec(s)) != null) {
ArrayList<String> args = new ArrayList<String>();
for (int i = 0; i < a.getGroupCount(); i++) {
args.add(a.getGroup(i));
}
String f = callback.foundMatch(args);
s = s.replace(a.getGroup(0), f);
p = RegExp.compile(r, "g");
}
return s;
} else {
return p.replace(s, o.toString());
}
}
};
public SelectorEngineCssToXPath() {
instance = this;
}
public SelectorEngineCssToXPath(Replacer r) {
replacer = r;
instance = this;
}
public String css2Xpath(String selector) {
String ret = selector;
for (int i = 0; i < regs.length;) {
ret = replacer.replaceAll(ret, regs[i++].toString(), regs[i++]);
}
return ".//" + ret;
}
public NodeList<Element> select(String sel, Node ctx) {
if (cache == null) {
cache = JsNamedArray.create();
}
String xsel = cache.get(sel);
if (xsel == null) {
xsel = sel.startsWith("./") || sel.startsWith("/") ? sel : css2Xpath(sel);
cache.put(sel, xsel);
}
JsNodeArray elm = JsNodeArray.create();
try {
SelectorEngine.xpathEvaluate(xsel, ctx, elm);
return JsUtils.unique(elm.<JsArray<Element>> cast()).cast();
} catch (Exception e) {
if (!GWT.isScript()) {
if (!SelectorEngine.hasXpathEvaluate()) {
throw new RuntimeException("This Browser does not support Xpath selectors.", e);
}
System.err.println("ERROR: xpathEvaluate invalid xpath expression:"
+ xsel + " css-selector:" + sel + "\n");
e.printStackTrace();
}
return elm;
}
}
}

+ 24
- 24
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java Ver fichero

@@ -1,24 +1,24 @@
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
/**
* Base/Utility class for runtime selector engine implementations.
*/
public abstract class SelectorEngineImpl implements HasSelector {
}
/*
* Copyright 2011, The gwtquery team.
*
* 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.
*/
package com.google.gwt.query.client.impl;
/**
* Base/Utility class for runtime selector engine implementations.
*/
public abstract class SelectorEngineImpl implements HasSelector {
}

+ 0
- 0
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNative.java Ver fichero


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio

Cargando…
Cancelar
Guardar