Browse Source

Format Java files using Eclipse Neon and Vaadin settings

Using the same formatting in the 7.7 branch and the master branch
eases porting of fixes

Change-Id: I51b4693f2f120447702cf322ce4505608ad92987
tags/7.7.2
Artur Signell 7 years ago
parent
commit
c5c52684eb
100 changed files with 1695 additions and 1683 deletions
  1. 12
    13
      all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java
  2. 6
    6
      all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java
  3. 15
    15
      buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java
  4. 15
    14
      buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java
  5. 18
    18
      buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java
  6. 18
    19
      client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java
  7. 15
    14
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java
  8. 40
    42
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
  9. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java
  10. 8
    13
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java
  11. 26
    27
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
  12. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java
  13. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/CustomSerializer.java
  14. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java
  15. 8
    7
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java
  16. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/GeneratedSerializer.java
  17. 5
    5
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
  18. 17
    17
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java
  19. 4
    4
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/OnStateChangeVisitor.java
  20. 9
    9
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java
  21. 22
    25
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
  22. 5
    4
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
  23. 5
    5
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java
  24. 3
    3
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java
  25. 9
    14
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
  26. 16
    17
      client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java
  27. 12
    12
      client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java
  28. 13
    13
      client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java
  29. 2
    2
      client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java
  30. 8
    9
      client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java
  31. 44
    44
      client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java
  32. 10
    10
      client/src/main/java/com/vaadin/client/AnimationUtil.java
  33. 48
    46
      client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
  34. 105
    113
      client/src/main/java/com/vaadin/client/ApplicationConnection.java
  35. 26
    26
      client/src/main/java/com/vaadin/client/BrowserInfo.java
  36. 5
    5
      client/src/main/java/com/vaadin/client/CSSRule.java
  37. 15
    15
      client/src/main/java/com/vaadin/client/ComponentConnector.java
  38. 4
    4
      client/src/main/java/com/vaadin/client/ComponentDetail.java
  39. 3
    3
      client/src/main/java/com/vaadin/client/ComponentDetailMap.java
  40. 34
    34
      client/src/main/java/com/vaadin/client/ComputedStyle.java
  41. 13
    13
      client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java
  42. 17
    16
      client/src/main/java/com/vaadin/client/ConnectorMap.java
  43. 6
    6
      client/src/main/java/com/vaadin/client/ContainerResizedListener.java
  44. 28
    28
      client/src/main/java/com/vaadin/client/DateTimeService.java
  45. 2
    2
      client/src/main/java/com/vaadin/client/DeferredWorker.java
  46. 3
    3
      client/src/main/java/com/vaadin/client/DirectionalManagedLayout.java
  47. 18
    15
      client/src/main/java/com/vaadin/client/EventHelper.java
  48. 3
    3
      client/src/main/java/com/vaadin/client/FastStringMap.java
  49. 3
    3
      client/src/main/java/com/vaadin/client/FastStringSet.java
  50. 4
    4
      client/src/main/java/com/vaadin/client/Focusable.java
  51. 8
    8
      client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java
  52. 8
    8
      client/src/main/java/com/vaadin/client/HasComponentsConnector.java
  53. 35
    35
      client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
  54. 3
    3
      client/src/main/java/com/vaadin/client/JavaScriptExtension.java
  55. 3
    3
      client/src/main/java/com/vaadin/client/JsArrayObject.java
  56. 192
    171
      client/src/main/java/com/vaadin/client/LayoutManager.java
  57. 5
    5
      client/src/main/java/com/vaadin/client/LayoutManagerIE8.java
  58. 3
    3
      client/src/main/java/com/vaadin/client/LocaleNotLoadedException.java
  59. 5
    5
      client/src/main/java/com/vaadin/client/LocaleService.java
  60. 7
    7
      client/src/main/java/com/vaadin/client/MeasuredSize.java
  61. 7
    7
      client/src/main/java/com/vaadin/client/MouseEventDetailsBuilder.java
  62. 4
    4
      client/src/main/java/com/vaadin/client/Paintable.java
  63. 35
    38
      client/src/main/java/com/vaadin/client/Profiler.java
  64. 10
    10
      client/src/main/java/com/vaadin/client/RenderInformation.java
  65. 3
    3
      client/src/main/java/com/vaadin/client/RenderSpace.java
  66. 24
    24
      client/src/main/java/com/vaadin/client/ResourceLoader.java
  67. 23
    22
      client/src/main/java/com/vaadin/client/ServerConnector.java
  68. 16
    13
      client/src/main/java/com/vaadin/client/SimpleTree.java
  69. 3
    3
      client/src/main/java/com/vaadin/client/StyleConstants.java
  70. 21
    22
      client/src/main/java/com/vaadin/client/SuperDevMode.java
  71. 6
    5
      client/src/main/java/com/vaadin/client/TooltipInfo.java
  72. 41
    42
      client/src/main/java/com/vaadin/client/UIDL.java
  73. 112
    107
      client/src/main/java/com/vaadin/client/Util.java
  74. 30
    30
      client/src/main/java/com/vaadin/client/VCaption.java
  75. 4
    4
      client/src/main/java/com/vaadin/client/VCaptionWrapper.java
  76. 5
    5
      client/src/main/java/com/vaadin/client/VConsole.java
  77. 9
    11
      client/src/main/java/com/vaadin/client/VErrorMessage.java
  78. 15
    15
      client/src/main/java/com/vaadin/client/VLoadingIndicator.java
  79. 3
    3
      client/src/main/java/com/vaadin/client/VSchedulerImpl.java
  80. 62
    60
      client/src/main/java/com/vaadin/client/VTooltip.java
  81. 9
    10
      client/src/main/java/com/vaadin/client/VUIDLBrowser.java
  82. 4
    4
      client/src/main/java/com/vaadin/client/ValueMap.java
  83. 3
    3
      client/src/main/java/com/vaadin/client/WidgetInstantiator.java
  84. 6
    4
      client/src/main/java/com/vaadin/client/WidgetLoader.java
  85. 8
    8
      client/src/main/java/com/vaadin/client/WidgetMap.java
  86. 12
    14
      client/src/main/java/com/vaadin/client/WidgetSet.java
  87. 108
    104
      client/src/main/java/com/vaadin/client/WidgetUtil.java
  88. 5
    5
      client/src/main/java/com/vaadin/client/annotations/OnStateChange.java
  89. 4
    4
      client/src/main/java/com/vaadin/client/communication/AbstractServerConnectorEvent.java
  90. 19
    22
      client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java
  91. 20
    20
      client/src/main/java/com/vaadin/client/communication/ConnectionStateHandler.java
  92. 4
    4
      client/src/main/java/com/vaadin/client/communication/Date_Serializer.java
  93. 38
    36
      client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java
  94. 6
    5
      client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java
  95. 4
    4
      client/src/main/java/com/vaadin/client/communication/DiffJSONSerializer.java
  96. 3
    3
      client/src/main/java/com/vaadin/client/communication/HasJavaScriptConnectorHelper.java
  97. 12
    11
      client/src/main/java/com/vaadin/client/communication/Heartbeat.java
  98. 7
    7
      client/src/main/java/com/vaadin/client/communication/JSONSerializer.java
  99. 4
    4
      client/src/main/java/com/vaadin/client/communication/JavaScriptMethodInvocation.java
  100. 0
    0
      client/src/main/java/com/vaadin/client/communication/JsonDecoder.java

+ 12
- 13
all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,17 @@ import java.util.Properties;
public class FetchReleaseNotesAuthors {
private static final String template = "<li class=\"author\">@author@</li>";

public static void main(String[] args) throws IOException,
InterruptedException {
public static void main(String[] args)
throws IOException, InterruptedException {
Properties authorMap = new Properties();

String authorsFilename = FetchReleaseNotesAuthors.class.getPackage()
.getName().replace(".", "/")
+ "/authormap.properties";
.getName().replace(".", "/") + "/authormap.properties";
InputStream s = FetchReleaseNotesAuthors.class.getClassLoader()
.getResourceAsStream(authorsFilename);
if (s == null) {
System.err.println("Author mapping file " + authorsFilename
+ " not found!");
System.err.println(
"Author mapping file " + authorsFilename + " not found!");
}
authorMap.load(s);

@@ -53,8 +52,8 @@ public class FetchReleaseNotesAuthors {
if (p.exitValue() != 0) {
System.err.println("Exit code: " + p.exitValue());
}
BufferedReader b = new BufferedReader(new InputStreamReader(
p.getInputStream()));
BufferedReader b = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = "";

List<String> authors = new ArrayList<String>();
@@ -77,8 +76,8 @@ public class FetchReleaseNotesAuthors {
private static String getPreviousVersion(String version) {
String[] versionNumbers = version.split("\\.");
if (versionNumbers.length > 4 || versionNumbers.length < 3) {
throw new IllegalArgumentException("Cannot parse version: "
+ version);
throw new IllegalArgumentException(
"Cannot parse version: " + version);
}
int major = Integer.parseInt(versionNumbers[0]);
int minor = Integer.parseInt(versionNumbers[1]);

+ 6
- 6
all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java View File

@@ -27,8 +27,7 @@ import org.apache.commons.io.IOUtils;

public class FetchReleaseNotesTickets {
private static final String queryURL = "https://dev.vaadin.com/query?status=pending-release&amp;status=released&amp;@milestone@&amp;resolution=fixed&amp;col=id&amp;col=summary&amp;col=owner&amp;col=type&amp;col=priority&amp;col=component&amp;col=version&amp;col=bfptime&col=fv&amp;format=tab&amp;order=id";
private static final String ticketTemplate = "<tr>"
+ "@badge@" //
private static final String ticketTemplate = "<tr>" + "@badge@" //
+ "<td class=\"ticket\"><a href=\"https://dev.vaadin.com/ticket/@ticket@\">#@ticket@</a></td>" //
+ "<td>@description@</td>" //
+ "</tr>"; //
@@ -105,7 +104,8 @@ public class FetchReleaseNotesTickets {
String badge = "<td></td>";
if (fields.length >= 8 && !fields[7].equals("")) {
badge = "<td class=\"bfp\"><span class=\"bfp\">Priority</span></td>";
} else if (fields.length >= 9 && fields[8].equalsIgnoreCase("true")) {
} else if (fields.length >= 9
&& fields[8].equalsIgnoreCase("true")) {
badge = "<td class=\"fv\"><span class=\"fv\">Vote</span></td>";
}

@@ -163,9 +163,9 @@ public class FetchReleaseNotesTickets {
}

private static void usage() {
System.err.println("Usage: "
+ FetchReleaseNotesTickets.class.getSimpleName()
+ " -Dvaadin.version=<version>");
System.err.println(
"Usage: " + FetchReleaseNotesTickets.class.getSimpleName()
+ " -Dvaadin.version=<version>");
System.exit(1);
}
}

+ 15
- 15
buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -64,11 +64,11 @@ public class CompileTheme {
// Regular theme
try {
processSassTheme(themeFolder, themeName, "styles", version);
System.out.println("Compiling theme " + themeName
+ " styles successful");
System.out.println(
"Compiling theme " + themeName + " styles successful");
} catch (Exception e) {
System.err.println("Compiling theme " + themeName
+ " styles failed");
System.err
.println("Compiling theme " + themeName + " styles failed");
e.printStackTrace();
}
// Legacy theme w/o .themename{} wrapping
@@ -82,8 +82,8 @@ public class CompileTheme {
+ " legacy-styles successful");
}
} catch (Exception e) {
System.err.println("Compiling theme " + themeName
+ " legacy-styles failed");
System.err.println(
"Compiling theme " + themeName + " legacy-styles failed");
e.printStackTrace();
}
}
@@ -103,8 +103,8 @@ public class CompileTheme {

ScssStylesheet scss = ScssStylesheet.get(sassFile);
if (scss == null) {
throw new IllegalArgumentException("SASS file: " + sassFile
+ " not found");
throw new IllegalArgumentException(
"SASS file: " + sassFile + " not found");
}
scss.compile();
String filteredScss = scss.printState().replace("@version@", version);
@@ -128,8 +128,8 @@ public class CompileTheme {

boolean ok = newCss.renameTo(oldCss);
if (!ok) {
throw new RuntimeException("Rename " + newCss + " -> " + oldCss
+ " failed");
throw new RuntimeException(
"Rename " + newCss + " -> " + oldCss + " failed");
}
}

@@ -142,8 +142,8 @@ public class CompileTheme {
// hiding other classpath issues
Class<?> smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class;
} catch (NoClassDefFoundError e) {
System.err
.println("Could not find smartsprites. No sprites were generated. The theme should still work.");
System.err.println(
"Could not find smartsprites. No sprites were generated. The theme should still work.");
return;
}


+ 15
- 14
buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -35,7 +35,7 @@ import java.util.regex.Pattern;
* Export-Package attribute, and appends it to the jar's MANIFEST.MF.
* <p>
* See #3521 for details.
*
*
* @author magi
*/
public class GeneratePackageExports {
@@ -44,11 +44,10 @@ public class GeneratePackageExports {

public static void main(String[] args) {
if (args.length < 2) {
System.err
.println("Invalid number of parameters\n"
+ "Usage: java -cp .. GenerateManifest <package.jar> <accepted package prefixes>\n"
+ "Use -Dvaadin.version to specify the version to be used for the packages\n"
+ "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)");
System.err.println("Invalid number of parameters\n"
+ "Usage: java -cp .. GenerateManifest <package.jar> <accepted package prefixes>\n"
+ "Use -Dvaadin.version to specify the version to be used for the packages\n"
+ "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)");
System.exit(1);
}

@@ -149,7 +148,7 @@ public class GeneratePackageExports {
* version.<java package>. Searches for the packge and then its parents
* recursively. Falls back to the "vaadin.version" system property if no
* other properties are found.
*
*
* @param javaPackage
* The package to determine a version for
* @return A version or null if no version has been defined
@@ -178,7 +177,8 @@ public class GeneratePackageExports {
}

private static HashSet<String> getPackages(JarFile jar,
List<String> acceptedPackagePrefixes, boolean includeNumberPackages) {
List<String> acceptedPackagePrefixes,
boolean includeNumberPackages) {
HashSet<String> packages = new HashSet<String>();

Pattern startsWithNumber = Pattern.compile("\\.\\d");
@@ -198,10 +198,11 @@ public class GeneratePackageExports {
}

int lastSlash = entry.getName().lastIndexOf('/');
String pkg = entry.getName().substring(0, lastSlash)
.replace('/', '.');
String pkg = entry.getName().substring(0, lastSlash).replace('/',
'.');

if (!includeNumberPackages && startsWithNumber.matcher(pkg).find()) {
if (!includeNumberPackages
&& startsWithNumber.matcher(pkg).find()) {
continue;
}


+ 18
- 18
buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,7 +33,7 @@ public class ManifestWriter {

/**
* Writes a manifest attribute to a temporary buffer.
*
*
* @param name
* Attribute name
* @param value
@@ -56,10 +56,10 @@ public class ManifestWriter {

/**
* Writes the manifest to given JAR file.
*
*
* The manifest must be created with {@code #writeAttribute(String, String)}
* before calling this write.
*
*
* @param jarFilename
* File name of the JAR in which the manifest is written
* @return 0 on success, nonzero value on error
@@ -85,9 +85,9 @@ public class ManifestWriter {
fos.write(getBytes());
fos.close();
} catch (IOException e) {
System.err.println("Writing to file '"
+ newMfFile.getAbsolutePath() + "' failed because: "
+ e.getMessage());
System.err.println(
"Writing to file '" + newMfFile.getAbsolutePath()
+ "' failed because: " + e.getMessage());
status = 1;
}
}
@@ -100,9 +100,9 @@ public class ManifestWriter {
is = new FileInputStream(newMfFile);
checkMf.read(is);
} catch (IOException e) {
System.err.println("Reading from file '"
+ newMfFile.getAbsolutePath() + "' failed because: "
+ e.getMessage());
System.err.println(
"Reading from file '" + newMfFile.getAbsolutePath()
+ "' failed because: " + e.getMessage());
status = 1;
}
}
@@ -112,8 +112,8 @@ public class ManifestWriter {
System.out.println("Updating manifest in JAR " + jarFilename);
try {
// The "mf" order must correspond with manifest-jarfile order
Process process = Runtime.getRuntime().exec(
new String[] { "jar", "umf",
Process process = Runtime.getRuntime()
.exec(new String[] { "jar", "umf",
newMfFile.getAbsolutePath(), jarFilename });
int exitValue = process.waitFor();
if (exitValue != 0) {
@@ -123,14 +123,14 @@ public class ManifestWriter {
while (reader.ready()) {
System.err.println("jar: " + reader.readLine());
}
System.err
.println("The 'jar' command returned with exit value "
System.err.println(
"The 'jar' command returned with exit value "
+ exitValue);
status = 1;
}
} catch (IOException e) {
System.err.println("Failed to execute 'jar' command. "
+ e.getMessage());
System.err.println(
"Failed to execute 'jar' command. " + e.getMessage());
status = 1;
} catch (InterruptedException e) {
System.err

+ 18
- 19
client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -42,7 +42,7 @@ import com.vaadin.sass.internal.ScssStylesheet;
* Pre-linker that checks for the existence of SASS files in public folders,
* compiles them to CSS files with the SassCompiler from Vaadin and adds the CSS
* back into the artifact.
*
*
*/
@LinkerOrder(Order.PRE)
@Shardable
@@ -109,30 +109,31 @@ public class SassLinker extends AbstractLinker {
// Store the file info for the compilation
scssFiles.add(new FileInfo(tempfile, partialPath));
} else {
logger.log(TreeLogger.WARN, "Duplicate file "
+ tempfile.getPath());
logger.log(TreeLogger.WARN,
"Duplicate file " + tempfile.getPath());
}
} catch (IOException e) {
logger.log(TreeLogger.ERROR,
"Could not write temporary file " + fileName, e);
"Could not write temporary file " + fileName,
e);
}
}
}

// Compile the files and store them in the artifact
logger.log(TreeLogger.INFO, "Processing " + scssFiles.size()
+ " Sass file(s)");
logger.log(TreeLogger.INFO,
"Processing " + scssFiles.size() + " Sass file(s)");
for (FileInfo fileInfo : scssFiles) {
logger.log(TreeLogger.INFO, " " + fileInfo.originalScssPath
+ " -> " + fileInfo.getOriginalCssPath());

try {
ScssStylesheet scss = ScssStylesheet.get(fileInfo
.getAbsolutePath());
ScssStylesheet scss = ScssStylesheet
.get(fileInfo.getAbsolutePath());
if (!fileInfo.isMixin()) {
scss.compile();
InputStream is = new ByteArrayInputStream(scss
.printState().getBytes());
InputStream is = new ByteArrayInputStream(
scss.printState().getBytes());

toReturn.add(this.emitInputStream(logger, is,
fileInfo.getOriginalCssPath()));
@@ -143,10 +144,8 @@ public class SassLinker extends AbstractLinker {
logger.log(TreeLogger.ERROR, "SCSS compilation failed for "
+ fileInfo.getOriginalCssPath(), e);
} catch (IOException e) {
logger.log(
TreeLogger.ERROR,
"Could not write CSS file for "
+ fileInfo.getOriginalCssPath(), e);
logger.log(TreeLogger.ERROR, "Could not write CSS file for "
+ fileInfo.getOriginalCssPath(), e);
} catch (Exception e) {
logger.log(TreeLogger.ERROR, "SCSS compilation failed for "
+ fileInfo.getOriginalCssPath(), e);
@@ -161,7 +160,7 @@ public class SassLinker extends AbstractLinker {

/**
* Writes the contents of an InputStream out to a file.
*
*
* @param contents
* @param tempfile
* @throws IOException
@@ -185,7 +184,7 @@ public class SassLinker extends AbstractLinker {

/**
* Create folder in temporary space on disk.
*
*
* @param partialPath
* @return
*/

+ 15
- 14
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -37,7 +37,7 @@ import com.vaadin.shared.ui.dd.AcceptCriterion;
* GWT generator to build {@link VAcceptCriterionFactory} implementation
* dynamically based on {@link AcceptCriterion} annotations available in
* classpath.
*
*
*/
public class AcceptCriteriaFactoryGenerator extends Generator {

@@ -67,7 +67,7 @@ public class AcceptCriteriaFactoryGenerator extends Generator {

/**
* Generate source code for WidgetMapImpl
*
*
* @param logger
* Logger object
* @param context
@@ -89,7 +89,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
ClassSourceFileComposerFactory composer = null;
composer = new ClassSourceFileComposerFactory(packageName, className);
composer.addImport("com.google.gwt.core.client.GWT");
composer.setSuperclass("com.vaadin.client.ui.dd.VAcceptCriterionFactory");
composer.setSuperclass(
"com.vaadin.client.ui.dd.VAcceptCriterionFactory");
SourceWriter sourceWriter = composer.createSourceWriter(context,
printWriter);

@@ -100,9 +101,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
sourceWriter.println("}");
// commit generated class
context.commit(logger, printWriter);
logger.log(Type.INFO,
"Done. (" + (new Date().getTime() - date.getTime()) / 1000
+ "seconds)");
logger.log(Type.INFO, "Done. ("
+ (new Date().getTime() - date.getTime()) / 1000 + "seconds)");

}

@@ -114,8 +114,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator {

sourceWriter.println("name = name.intern();");

JClassType criteriaType = context.getTypeOracle().findType(
VAcceptCriterion.class.getName());
JClassType criteriaType = context.getTypeOracle()
.findType(VAcceptCriterion.class.getName());
JClassType[] subtypes = criteriaType.getSubtypes();
Arrays.sort(subtypes, ConnectorBundle.jClassComparator);
for (JClassType clientClass : subtypes) {
@@ -123,10 +123,11 @@ public class AcceptCriteriaFactoryGenerator extends Generator {
.getAnnotation(AcceptCriterion.class);
if (annotation != null) {
String clientClassName = clientClass.getQualifiedSourceName();
Class<?> serverClass = clientClass.getAnnotation(
AcceptCriterion.class).value();
Class<?> serverClass = clientClass
.getAnnotation(AcceptCriterion.class).value();
String serverClassName = serverClass.getCanonicalName();
logger.log(Type.INFO, "creating mapping for " + serverClassName);
logger.log(Type.INFO,
"creating mapping for " + serverClassName);
sourceWriter.print("if (\"");
sourceWriter.print(serverClassName);
sourceWriter.print("\" == name) return GWT.create(");

+ 40
- 42
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java View File

@@ -440,9 +440,10 @@ public class ConnectorBundleLoaderFactory extends Generator {
throw new UnableToCompleteException();
}
if (!property.hasAccessorMethods()) {
logger.log(Type.ERROR, beanType.getQualifiedSourceName()
+ " has the property '" + name
+ "' without getter defined.");
logger.log(Type.ERROR,
beanType.getQualifiedSourceName()
+ " has the property '" + name
+ "' without getter defined.");
throw new UnableToCompleteException();
}
}
@@ -480,8 +481,9 @@ public class ConnectorBundleLoaderFactory extends Generator {
writer.print(
"store.@%s::setPropertyData(Ljava/lang/Class;Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)",
TypeDataStore.class.getName());
writer.println("(@%s::class, '%s', data);", property.getBeanType()
.getQualifiedSourceName(), property.getName());
writer.println("(@%s::class, '%s', data);",
property.getBeanType().getQualifiedSourceName(),
property.getName());
writer.println();
writer.splitIfNeeded(true,
String.format("%s store", TypeDataStore.class.getName()));
@@ -525,8 +527,7 @@ public class ConnectorBundleLoaderFactory extends Generator {
.entrySet()) {
JClassType connector = entry.getKey();

TreeLogger typeLogger = logger.branch(
Type.DEBUG,
TreeLogger typeLogger = logger.branch(Type.DEBUG,
"Generating @OnStateChange support for "
+ connector.getName());

@@ -544,9 +545,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
"Processing method " + method.getName());

if (method.isPublic() || method.isProtected()) {
methodLogger
.log(Type.ERROR,
"@OnStateChange is only supported for methods with private or default visibility.");
methodLogger.log(Type.ERROR,
"@OnStateChange is only supported for methods with private or default visibility.");
throw new UnableToCompleteException();
}

@@ -654,9 +654,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
.entrySet()) {
JClassType beanType = entry.getKey();
for (Property property : entry.getValue()) {
w.println(
"store.setDelegateToWidget(%s, \"%s\", \"%s\");",
getClassLiteralString(beanType),// property.getBeanType()),
w.println("store.setDelegateToWidget(%s, \"%s\", \"%s\");",
getClassLiteralString(beanType), // property.getBeanType()),
property.getName(),
property.getAnnotation(DelegateToWidget.class).value());
}
@@ -820,10 +819,12 @@ public class ConnectorBundleLoaderFactory extends Generator {
}
}

private void writeParamTypes(SplittingSourceWriter w, ConnectorBundle bundle) {
private void writeParamTypes(SplittingSourceWriter w,
ConnectorBundle bundle) {
Map<JClassType, Set<JMethod>> needsParamTypes = bundle
.getNeedsParamTypes();
for (Entry<JClassType, Set<JMethod>> entry : needsParamTypes.entrySet()) {
for (Entry<JClassType, Set<JMethod>> entry : needsParamTypes
.entrySet()) {
JClassType type = entry.getKey();

Set<JMethod> methods = entry.getValue();
@@ -864,8 +865,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.print("\",");

if (method.isPublic()) {
typeLogger.log(Type.DEBUG, "Invoking " + method.getName()
+ " using java");
typeLogger.log(Type.DEBUG,
"Invoking " + method.getName() + " using java");

writeJavaInvoker(w, type, method);
} else {
@@ -893,8 +894,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.indent();

JType returnType = method.getReturnType();
boolean hasReturnType = !"void".equals(returnType
.getQualifiedSourceName());
boolean hasReturnType = !"void"
.equals(returnType.getQualifiedSourceName());

// Note that void is also a primitive type
boolean hasPrimitiveReturnType = hasReturnType
@@ -905,9 +906,9 @@ public class ConnectorBundleLoaderFactory extends Generator {

if (hasPrimitiveReturnType) {
// Integer.valueOf(expression);
w.print("@%s::valueOf(%s)(", returnType.isPrimitive()
.getQualifiedBoxedSourceName(), returnType
.getJNISignature());
w.print("@%s::valueOf(%s)(",
returnType.isPrimitive().getQualifiedBoxedSourceName(),
returnType.getJNISignature());

// Implementation tested briefly, but I don't dare leave it
// enabled since we are not using it in the framework and we
@@ -923,8 +924,8 @@ public class ConnectorBundleLoaderFactory extends Generator {

JType[] parameterTypes = method.getParameterTypes();

w.print("target.@%s::" + method.getName() + "(*)(", method
.getEnclosingType().getQualifiedSourceName());
w.print("target.@%s::" + method.getName() + "(*)(",
method.getEnclosingType().getQualifiedSourceName());
for (int i = 0; i < parameterTypes.length; i++) {
if (i != 0) {
w.print(", ");
@@ -968,8 +969,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.indent();

JType returnType = method.getReturnType();
boolean hasReturnType = !"void".equals(returnType
.getQualifiedSourceName());
boolean hasReturnType = !"void"
.equals(returnType.getQualifiedSourceName());
if (hasReturnType) {
w.print("return ");
}
@@ -989,8 +990,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
// Need to pass through native method to allow casting Object to
// JSO if the value is a string
w.print("%s.<%s>obj2jso(params[%d])",
JsonDecoder.class.getCanonicalName(),
parameterTypeName, i);
JsonDecoder.class.getCanonicalName(), parameterTypeName,
i);
} else {
w.print("(" + parameterTypeName + ") params[" + i + "]");
}
@@ -1088,8 +1089,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
}

private List<ConnectorBundle> buildBundles(TreeLogger logger,
TypeOracle typeOracle) throws NotFoundException,
UnableToCompleteException {
TypeOracle typeOracle)
throws NotFoundException, UnableToCompleteException {

Map<LoadStyle, Collection<JClassType>> connectorsByLoadStyle = new HashMap<LoadStyle, Collection<JClassType>>();
for (LoadStyle loadStyle : LoadStyle.values()) {
@@ -1097,8 +1098,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
}

// Find all types with a valid mapping
Collection<JClassType> selectedTypes = getConnectorsForWidgetset(
logger, typeOracle);
Collection<JClassType> selectedTypes = getConnectorsForWidgetset(logger,
typeOracle);

// Group by load style
for (JClassType connectorSubtype : selectedTypes) {
@@ -1142,8 +1143,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
for (JClassType type : lazy) {
ConnectorBundle bundle = new ConnectorBundle(type.getName(),
eagerBundle);
TreeLogger subLogger = logger.branch(Type.TRACE, "Populating "
+ type.getName() + " bundle");
TreeLogger subLogger = logger.branch(Type.TRACE,
"Populating " + type.getName() + " bundle");
bundle.processType(subLogger, type);

bundles.add(bundle);
@@ -1176,8 +1177,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
throws UnableToCompleteException {
JClassType serverConnectorType;
try {
serverConnectorType = typeOracle.getType(ServerConnector.class
.getName());
serverConnectorType = typeOracle
.getType(ServerConnector.class.getName());
} catch (NotFoundException e) {
logger.log(Type.ERROR,
"Can't find " + ServerConnector.class.getName());
@@ -1213,13 +1214,10 @@ public class ConnectorBundleLoaderFactory extends Generator {
superclass = type;
} else {
// Neither inherits from the other - this is a conflict
logger.log(
Type.ERROR,
logger.log(Type.ERROR,
"Conflicting @Connect mappings detected for "
+ identifier
+ ": "
+ type.getQualifiedSourceName()
+ " and "
+ identifier + ": "
+ type.getQualifiedSourceName() + " and "
+ previousMapping.getQualifiedSourceName()
+ ". There can only be multiple @Connect mappings for the same server-side type if one is the subclass of the other.");
throw new UnableToCompleteException();

+ 3
- 3
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ArraySerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 8
- 13
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -68,16 +68,11 @@ public class ClientRpcVisitor extends TypeVisitor {
public static void checkReturnType(TreeLogger logger, JMethod method)
throws UnableToCompleteException {
if (!method.getReturnType().getQualifiedSourceName().equals("void")) {
logger.log(
Type.ERROR,
"The method "
+ method.getEnclosingType()
.getQualifiedSourceName()
+ "."
+ method.getName()
+ " returns "
+ method.getReturnType().getQualifiedSourceName()
+ " but only void is supported for methods in RPC interfaces.");
logger.log(Type.ERROR, "The method "
+ method.getEnclosingType().getQualifiedSourceName() + "."
+ method.getName() + " returns "
+ method.getReturnType().getQualifiedSourceName()
+ " but only void is supported for methods in RPC interfaces.");
throw new UnableToCompleteException();
}
}

+ 26
- 27
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java View File

@@ -60,16 +60,16 @@ public class ConnectorBundle {
public static final Comparator<JClassType> jClassComparator = new Comparator<JClassType>() {
@Override
public int compare(JClassType o1, JClassType o2) {
return o1.getQualifiedSourceName().compareTo(
o2.getQualifiedSourceName());
return o1.getQualifiedSourceName()
.compareTo(o2.getQualifiedSourceName());
}
};

public static final Comparator<JMethod> jMethodComparator = new Comparator<JMethod>() {
@Override
public int compare(JMethod o1, JMethod o2) {
return o1.getReadableDeclaration().compareTo(
o2.getReadableDeclaration());
return o1.getReadableDeclaration()
.compareTo(o2.getReadableDeclaration());
}
};

@@ -140,10 +140,11 @@ public class ConnectorBundle {
TypeOracle oracle) throws NotFoundException {
Map<JType, JClassType> serializers = new HashMap<JType, JClassType>();

JClassType serializerInterface = oracle.findType(JSONSerializer.class
.getName());
JClassType serializerInterface = oracle
.findType(JSONSerializer.class.getName());
JType[] deserializeParamTypes = new JType[] {
oracle.findType(com.vaadin.client.metadata.Type.class.getName()),
oracle.findType(
com.vaadin.client.metadata.Type.class.getName()),
oracle.findType(JsonValue.class.getName()),
oracle.findType(ApplicationConnection.class.getName()) };
String deserializeMethodName = "deserialize";
@@ -152,8 +153,8 @@ public class ConnectorBundle {
deserializeParamTypes);

for (JClassType serializer : serializerInterface.getSubtypes()) {
JMethod deserializeMethod = serializer.findMethod(
deserializeMethodName, deserializeParamTypes);
JMethod deserializeMethod = serializer
.findMethod(deserializeMethodName, deserializeParamTypes);
if (deserializeMethod == null) {
continue;
}
@@ -309,21 +310,18 @@ public class ConnectorBundle {

private void checkSerializable(TreeLogger logger, JClassType type)
throws UnableToCompleteException {
JClassType javaSerializable = type.getOracle().findType(
Serializable.class.getName());
JClassType javaSerializable = type.getOracle()
.findType(Serializable.class.getName());
boolean serializable = type.isAssignableTo(javaSerializable);
if (!serializable) {
boolean abortCompile = "true".equals(System
.getProperty(FAIL_IF_NOT_SERIALIZABLE));
logger.log(
abortCompile ? Type.ERROR : Type.WARN,
type
+ " is used in RPC or shared state but does not implement "
+ Serializable.class.getName()
+ ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
+ "If the system property "
+ FAIL_IF_NOT_SERIALIZABLE
+ " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
boolean abortCompile = "true"
.equals(System.getProperty(FAIL_IF_NOT_SERIALIZABLE));
logger.log(abortCompile ? Type.ERROR : Type.WARN, type
+ " is used in RPC or shared state but does not implement "
+ Serializable.class.getName()
+ ". Communication will work but the Application on server side cannot be serialized if it refers to objects of this type. "
+ "If the system property " + FAIL_IF_NOT_SERIALIZABLE
+ " is set to \"true\", this causes the compilation to fail instead of just emitting a warning.");
if (abortCompile) {
throw new UnableToCompleteException();
}
@@ -509,7 +507,8 @@ public class ConnectorBundle {
set.add(value);
}

private <K> void addMapping(Map<K, Set<JMethod>> map, K key, JMethod value) {
private <K> void addMapping(Map<K, Set<JMethod>> map, K key,
JMethod value) {
Set<JMethod> set = map.get(key);
if (set == null) {
set = new TreeSet<JMethod>(jMethodComparator);
@@ -609,9 +608,8 @@ public class ConnectorBundle {
if (typeData != null && hasMapping(typeData, method, methodAttribute)) {
return true;
} else {
return previousBundle != null
&& previousBundle.hasMethodAttribute(type, method,
methodAttribute);
return previousBundle != null && previousBundle
.hasMethodAttribute(type, method, methodAttribute);
}
}

@@ -699,7 +697,8 @@ public class ConnectorBundle {
}
}

private boolean isNeedsOnStateChangeHandler(JClassType type, JMethod method) {
private boolean isNeedsOnStateChangeHandler(JClassType type,
JMethod method) {
if (hasMapping(needsOnStateChange, type, method)) {
return true;
} else {

+ 3
- 3
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorInitVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/CustomSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/EnumSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 8
- 7
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -45,15 +45,16 @@ public class FieldProperty extends Property {
@Override
public void writeSetterBody(TreeLogger logger, SourceWriter w,
String beanVariable, String valueVariable) {
w.println("%s.@%s::%s = %s;", beanVariable, getBeanType()
.getQualifiedSourceName(), getName(), unboxValue(valueVariable));
w.println("%s.@%s::%s = %s;", beanVariable,
getBeanType().getQualifiedSourceName(), getName(),
unboxValue(valueVariable));
}

@Override
public void writeGetterBody(TreeLogger logger, SourceWriter w,
String beanVariable) {
String value = String.format("%s.@%s::%s", beanVariable, getBeanType()
.getQualifiedSourceName(), getName());
String value = String.format("%s.@%s::%s", beanVariable,
getBeanType().getQualifiedSourceName(), getName());
w.print("return ");
w.print(boxValue(value));
w.println(";");

+ 3
- 3
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/GeneratedSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -56,8 +56,8 @@ public abstract class JsonSerializer implements GeneratedSerializer {
+ ApplicationConnection.class.getName() + " connection) {");
w.indent();
// MouseEventDetails castedValue = (MouseEventDetails) value;
w.println(qualifiedSourceName + " castedValue = ("
+ qualifiedSourceName + ") value;");
w.println(qualifiedSourceName + " castedValue = (" + qualifiedSourceName
+ ") value;");

printSerializerBody(logger, w, "castedValue", "connection");


+ 17
- 17
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -36,8 +36,8 @@ public class MethodProperty extends Property {
private final String getter;

private MethodProperty(JClassType beanType, JMethod setter, String getter) {
super(getTransportFieldName(setter), beanType, setter
.getParameterTypes()[0]);
super(getTransportFieldName(setter), beanType,
setter.getParameterTypes()[0]);
this.setter = setter;
this.getter = getter;
}
@@ -54,8 +54,8 @@ public class MethodProperty extends Property {
List<JMethod> setters = getSetters(type, getters);
for (JMethod setter : setters) {
String getter = findGetter(type, setter);
properties.add(new MethodProperty(setter.getEnclosingType(),
setter, getters.contains(getter) ? getter : null));
properties.add(new MethodProperty(setter.getEnclosingType(), setter,
getters.contains(getter) ? getter : null));
}

return properties;
@@ -63,7 +63,7 @@ public class MethodProperty extends Property {

/**
* Returns a list of all setters found in the beanType or its parent class
*
*
* @param beanType
* The type to check
* @param getters
@@ -74,9 +74,8 @@ public class MethodProperty extends Property {
Set<String> getters) {
List<JMethod> setterMethods = new ArrayList<JMethod>();

while (beanType != null
&& !beanType.getQualifiedSourceName().equals(
Object.class.getName())) {
while (beanType != null && !beanType.getQualifiedSourceName()
.equals(Object.class.getName())) {
for (JMethod method : beanType.getMethods()) {
// Process all setters that have corresponding fields
if (!method.isPublic() || method.isStatic()) {
@@ -112,18 +111,19 @@ public class MethodProperty extends Property {
@Override
public void writeSetterBody(TreeLogger logger, SourceWriter w,
String beanVariable, String valueVariable) {
w.println("%s.@%s::%s(%s)(%s);", beanVariable, getBeanType()
.getQualifiedSourceName(), setter.getName(), setter
.getParameterTypes()[0].getJNISignature(),
w.println("%s.@%s::%s(%s)(%s);", beanVariable,
getBeanType().getQualifiedSourceName(), setter.getName(),
setter.getParameterTypes()[0].getJNISignature(),
unboxValue(valueVariable));

}

private static String findGetter(JClassType beanType, JMethod setterMethod) {
private static String findGetter(JClassType beanType,
JMethod setterMethod) {
JType setterParameterType = setterMethod.getParameterTypes()[0];
String fieldName = setterMethod.getName().substring(3);
if (setterParameterType.getQualifiedSourceName().equals(
boolean.class.getName())) {
if (setterParameterType.getQualifiedSourceName()
.equals(boolean.class.getName())) {
return "is" + fieldName;
} else {
return "get" + fieldName;

+ 4
- 4
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/OnStateChangeVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import com.vaadin.shared.ui.Connect;
/**
* Visits Connector classes and check for methods with @OnStateChange
* annotations.
*
*
* @since 7.2
* @author Vaadin Ltd
*/

+ 9
- 9
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -103,20 +103,20 @@ public abstract class Property implements Comparable<Property> {

@Override
public int hashCode() {
return getClass().hashCode() * 31 ^ 2 + getBeanType().hashCode() * 31
+ getName().hashCode();
return getClass().hashCode() * 31
^ 2 + getBeanType().hashCode() * 31 + getName().hashCode();
}

@Override
public int compareTo(Property o) {
int comp = getName().compareTo(o.getName());
if (comp == 0) {
comp = getBeanType().getQualifiedSourceName().compareTo(
o.getBeanType().getQualifiedSourceName());
comp = getBeanType().getQualifiedSourceName()
.compareTo(o.getBeanType().getQualifiedSourceName());
}
if (comp == 0) {
comp = getClass().getCanonicalName().compareTo(
o.getClass().getCanonicalName());
comp = getClass().getCanonicalName()
.compareTo(o.getClass().getCanonicalName());
}
return comp;
}

+ 22
- 25
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -37,9 +37,9 @@ import elemental.json.JsonValue;
* {@link AbstractRendererConnector#decode(elemental.json.JsonValue) decode}
* method to work without having to implement a "getPresentationType" method.
* </ul>
*
*
* @see WidgetInitVisitor
*
*
* @since 7.4
* @author Vaadin Ltd
*/
@@ -57,17 +57,17 @@ public class RendererVisitor extends TypeVisitor {
private static void doRendererType(TreeLogger logger, JClassType type,
ConnectorBundle bundle) throws UnableToCompleteException {
// The class in which createRenderer is implemented
JClassType createRendererClass = ConnectorBundle.findInheritedMethod(
type, "createRenderer").getEnclosingType();
JClassType createRendererClass = ConnectorBundle
.findInheritedMethod(type, "createRenderer").getEnclosingType();

// Needs GWT constructor if createRenderer is not overridden
if (createRendererClass.getQualifiedSourceName().equals(
AbstractRendererConnector.class.getCanonicalName())) {
if (createRendererClass.getQualifiedSourceName()
.equals(AbstractRendererConnector.class.getCanonicalName())) {

JMethod getRenderer = ConnectorBundle.findInheritedMethod(type,
"getRenderer");
if (getRenderer.getEnclosingType().getQualifiedSourceName()
.equals(AbstractRendererConnector.class.getCanonicalName())) {
if (getRenderer.getEnclosingType().getQualifiedSourceName().equals(
AbstractRendererConnector.class.getCanonicalName())) {
logger.log(Type.ERROR, type.getQualifiedSourceName()
+ " must override either createRenderer or getRenderer");
throw new UnableToCompleteException();
@@ -79,8 +79,8 @@ public class RendererVisitor extends TypeVisitor {
// Also needs renderer type to find the right GWT constructor
bundle.setNeedsReturnType(type, getRenderer);

logger.log(Type.DEBUG, "Renderer type of " + type + " is "
+ rendererType);
logger.log(Type.DEBUG,
"Renderer type of " + type + " is " + rendererType);
}
}

@@ -93,8 +93,8 @@ public class RendererVisitor extends TypeVisitor {
bundle.setNeedsSerialize(presentationType);
}

logger.log(Type.DEBUG, "Presentation type of " + type + " is "
+ presentationType);
logger.log(Type.DEBUG,
"Presentation type of " + type + " is " + presentationType);
}

private static boolean hasCustomDecodeMethod(JClassType type,
@@ -110,8 +110,8 @@ public class RendererVisitor extends TypeVisitor {
return !decodeMethod.getEnclosingType().getQualifiedSourceName()
.equals(AbstractRendererConnector.class.getName());
} catch (NotFoundException e) {
logger.log(Type.ERROR, "Can't find decode method for renderer "
+ type, e);
logger.log(Type.ERROR,
"Can't find decode method for renderer " + type, e);
throw new UnableToCompleteException();
}
}
@@ -120,16 +120,13 @@ public class RendererVisitor extends TypeVisitor {
throws UnableToCompleteException {
JClassType originalType = type;
while (type != null) {
if (type.getQualifiedBinaryName().equals(
AbstractRendererConnector.class.getName())) {
if (type.getQualifiedBinaryName()
.equals(AbstractRendererConnector.class.getName())) {
JParameterizedType parameterized = type.isParameterized();
if (parameterized == null) {
logger.log(
Type.ERROR,
type.getQualifiedSourceName()
+ " must define the generic parameter of the inherited "
+ AbstractRendererConnector.class
.getSimpleName());
logger.log(Type.ERROR, type.getQualifiedSourceName()
+ " must define the generic parameter of the inherited "
+ AbstractRendererConnector.class.getSimpleName());
throw new UnableToCompleteException();
}
return parameterized.getTypeArgs()[0];

+ 5
- 4
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -52,7 +52,8 @@ public class ServerRpcVisitor extends TypeVisitor {
}
}

if (method.getAnnotation(NoLoadingIndicator.class) != null) {
if (method
.getAnnotation(NoLoadingIndicator.class) != null) {
bundle.setMethodAttribute(type, method,
MethodAttribute.NO_LOADING_INDICATOR);
}

+ 5
- 5
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -24,8 +24,8 @@ public class StateInitVisitor extends TypeVisitor {
@Override
public void visitConnector(TreeLogger logger, JClassType type,
ConnectorBundle bundle) {
JMethod getState = ConnectorBundle
.findInheritedMethod(type, "getState");
JMethod getState = ConnectorBundle.findInheritedMethod(type,
"getState");
bundle.setNeedsReturnType(type, getState);

bundle.setNeedsSerialize(getState.getReturnType());

+ 3
- 3
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/TypeVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 9
- 14
client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,8 +32,9 @@ public class WidgetInitVisitor extends TypeVisitor {
ConnectorBundle bundle) throws UnableToCompleteException {
if (ConnectorBundle.isConnectedComponentConnector(type)) {
// The class in which createWidget is implemented
JClassType createWidgetClass = ConnectorBundle.findInheritedMethod(
type, "createWidget").getEnclosingType();
JClassType createWidgetClass = ConnectorBundle
.findInheritedMethod(type, "createWidget")
.getEnclosingType();

JMethod getWidget = ConnectorBundle.findInheritedMethod(type,
"getWidget");
@@ -42,9 +43,7 @@ public class WidgetInitVisitor extends TypeVisitor {
// Needs GWT constructor if createWidget is not overridden
if (createWidgetClass.getQualifiedSourceName().equals(
AbstractComponentConnector.class.getCanonicalName())) {
if (getWidget
.getEnclosingType()
.getQualifiedSourceName()
if (getWidget.getEnclosingType().getQualifiedSourceName()
.equals(AbstractComponentConnector.class
.getCanonicalName())) {
logger.log(Type.ERROR, type.getQualifiedSourceName()
@@ -79,12 +78,8 @@ public class WidgetInitVisitor extends TypeVisitor {
.findInheritedMethod(widgetType, methodName,
property.getPropertyType());
if (delegatedSetter == null) {
logger.log(
Type.ERROR,
widgetType.getName()
+ "."
+ methodName
+ "("
logger.log(Type.ERROR,
widgetType.getName() + "." + methodName + "("
+ property.getPropertyType()
.getSimpleSourceName()
+ ") required by @DelegateToWidget for "

+ 16
- 17
client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java View File

@@ -79,7 +79,7 @@ public final class CvalAddonsChecker {

/**
* Visit all MANIFEST.MF files in the classpath validating licenses.
*
*
* Return a list of Cval licensed products in order to have enough info to
* generate nag messages in the UI.
*/
@@ -108,14 +108,14 @@ public final class CvalAddonsChecker {
Attributes attribs = manifest.getMainAttributes();
String license = attribs.getValue(VAADIN_ADDON_LICENSE);
String name = attribs.getValue(VAADIN_ADDON_NAME);
String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null ? ""
: attribs.getValue(VAADIN_ADDON_VERSION);
String title = attribs.getValue(VAADIN_ADDON_TITLE) == null ? name
: attribs.getValue(VAADIN_ADDON_TITLE);
String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null
? "" : attribs.getValue(VAADIN_ADDON_VERSION);
String title = attribs.getValue(VAADIN_ADDON_TITLE) == null
? name : attribs.getValue(VAADIN_ADDON_TITLE);

String widgetsets = attribs
.getValue(VAADIN_ADDON_WIDGETSET) == null ? name
: attribs.getValue(VAADIN_ADDON_WIDGETSET);
: attribs.getValue(VAADIN_ADDON_WIDGETSET);

if (name == null || license == null) {
continue;
@@ -131,14 +131,14 @@ public final class CvalAddonsChecker {
title);
printValidLicense(info, title, vers);
} catch (UnreachableCvalServerException e) {
info = CvalChecker.parseJson("{'product':{'name':'"
+ name + "'}}");
info = CvalChecker.parseJson(
"{'product':{'name':'" + name + "'}}");
printServerUnreachable(title, vers);
}
for (String w : widgetsets.split("[, ]+")) {
ret.add(new CValUiInfo(title, String
.valueOf(computeMajorVersion(vers)), w,
info.getType()));
ret.add(new CValUiInfo(title,
String.valueOf(computeMajorVersion(vers)),
w, info.getType()));
}
}
} catch (IOException ignored) {
@@ -151,7 +151,7 @@ public final class CvalAddonsChecker {

/**
* Set the filter regexp of .jar names which we have to consider.
*
*
* default is '.*touchkit.*'
*/
public CvalAddonsChecker setFilter(String regexp) {
@@ -174,13 +174,12 @@ public final class CvalAddonsChecker {
}

private void printServerUnreachable(String name, String version) {
System.out.println(LINE
+ "\n"
+ getErrorMessage("unreachable", name,
computeMajorVersion(version)) + "\n" + LINE);
System.out.println(LINE + "\n" + getErrorMessage("unreachable", name,
computeMajorVersion(version)) + "\n" + LINE);
}

private void printValidLicense(CvalInfo info, String title, String version) {
private void printValidLicense(CvalInfo info, String title,
String version) {
String msg = info.getMessage();
if (msg == null) {
String key = "evaluation".equals(info.getType()) ? "evaluation"

+ 12
- 12
client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java View File

@@ -52,10 +52,10 @@ public final class CvalChecker {

/*
* Class used for binding the JSON gotten from server.
*
*
* It is not in a separate f le, so as it is easier to copy into any product
* which does not depend on vaadin core.
*
*
* We are using elemental.json in order not to use additional dependency
* like auto-beans, gson, etc.
*/
@@ -153,8 +153,8 @@ public final class CvalChecker {

public boolean isLicenseExpired() {
return (getExpired() != null && getExpired())
|| (getExpiredEpoch() != null && getExpiredEpoch().before(
new Date()));
|| (getExpiredEpoch() != null
&& getExpiredEpoch().before(new Date()));
}

public boolean isValidVersion(int majorVersion) {
@@ -248,8 +248,8 @@ public final class CvalChecker {
} else if (info != null && info.getMessage() != null) {
msg = info.getMessage().replace("\\n", "\n");
} else if (info != null && info.isLicenseExpired()) {
String type = "evaluation".equals(info.getType()) ? "Evaluation license"
: "License";
String type = "evaluation".equals(info.getType())
? "Evaluation license" : "License";
msg = getErrorMessage("expired", title, majorVers, type);
} else if (key == null) {
msg = getErrorMessage("none", title, majorVers);
@@ -359,8 +359,8 @@ public final class CvalChecker {
* when we have license key but server is unreachable
*/
public CvalInfo validateProduct(String productName, String productVersion,
String productTitle) throws InvalidCvalException,
UnreachableCvalServerException {
String productTitle)
throws InvalidCvalException, UnreachableCvalServerException {
String key = getDeveloperLicenseKey(productName, productVersion,
productTitle);

@@ -416,8 +416,8 @@ public final class CvalChecker {
int timeout = validCache ? 2000 : 10000;

try {
CvalInfo srvinfo = parseJson(provider.askServer(productName + "-"
+ productVersion, productKey, timeout));
CvalInfo srvinfo = parseJson(provider.askServer(
productName + "-" + productVersion, productKey, timeout));
if (srvinfo != null && srvinfo.isValidInfo(productName, productKey)
&& srvinfo.isValidVersion(majorVersion)) {
// We always cache the info if it is valid although it is
@@ -502,8 +502,8 @@ public final class CvalChecker {

static String getErrorMessage(String key, Object... pars) {
Locale loc = Locale.getDefault();
ResourceBundle res = ResourceBundle.getBundle(
CvalChecker.class.getName(), loc);
ResourceBundle res = ResourceBundle
.getBundle(CvalChecker.class.getName(), loc);
String msg = res.getString(key);
return new MessageFormat(msg, loc).format(pars);
}

+ 13
- 13
client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,24 +23,24 @@ import com.vaadin.server.widgetsetutils.WidgetSetBuilder;
/**
* A wrapper for the GWT compiler that runs the compiler in a new thread after
* updating the widgetset file.
*
*
* This class originally existed to allow circumventing a J2SE 5.0 bug (6316197)
* that prevents setting the stack size for the main thread.
*
*
* This class takes the same command line arguments as the
* com.google.gwt.dev.Compiler class.
*
*
* A typical invocation would use e.g. the following arguments
*
*
* "-war WebContent/VAADIN/widgetsets com.vaadin.DefaultWidgetSet"
*
*
* In addition, larger memory usage settings for the VM should be used, e.g.
*
*
* "-Xms256M -Xmx512M -Xss8M"
*
*
* The source directory containing widgetset and related classes must be
* included in the classpath, as well as other relevant JARs.
*
*
* @deprecated with Java 6, can use com.google.gwt.dev.Compiler directly (also
* in Eclipse plug-in etc.)
*/
@@ -71,8 +71,8 @@ public class WidgetsetCompiler {

// TODO expecting this is launched via eclipse WTP
// project
System.out
.println("Updating GWT module description file...");
System.out.println(
"Updating GWT module description file...");
WidgetSetBuilder.updateWidgetSet(wsname);
System.out.println("Done.");


+ 2
- 2
client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java View File

@@ -54,8 +54,8 @@ public class CvalAddonsCheckerTest {

@Before
public void setup() {
addonChecker = new CvalAddonsChecker().setLicenseProvider(
validLicenseProvider).setFilter(".*test.*");
addonChecker = new CvalAddonsChecker()
.setLicenseProvider(validLicenseProvider).setFilter(".*test.*");
licenseName = computeLicenseName(productNameCval);

deleteCache(productNameCval);

+ 8
- 9
client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java View File

@@ -76,7 +76,7 @@ public class CvalAddonstCheckerUseCasesTest {
enum Message {
AGPL("AGPL"), VALID(">.* valid"), INVALID("not valid"), NO_LICENSE(
"not found"), NO_VALIDATED("has not been validated"), EXPIRED(
"has expired"), EVALUATION("evaluation");
"has expired"), EVALUATION("evaluation");

String msg;

@@ -93,7 +93,7 @@ public class CvalAddonstCheckerUseCasesTest {
}

/* TODO: Use more descriptive test names */
@Test
public void testUseCase1() throws Exception {
useCase(1, License.NONE, Version.AGPL, Validated.NO, Network.OFF,
@@ -219,8 +219,8 @@ public class CvalAddonstCheckerUseCasesTest {
if (val == Validated.NO) {
deleteCache(productNameCval);
} else {
String type = lic == License.EVAL || lic == License.EVAL_EXPIRED ? "evaluation"
: null;
String type = lic == License.EVAL || lic == License.EVAL_EXPIRED
? "evaluation" : null;
Boolean expired = lic == License.EVAL_EXPIRED
|| lic == License.REAL_EXPIRED ? true : null;
String key = val == Validated.OLD_KEY ? "oldkey" : null;
@@ -253,17 +253,16 @@ public class CvalAddonstCheckerUseCasesTest {
restoreSystemOut();
message = e.getMessage();
if (res == Compile.YES) {
Assert.fail(testNumber + "Unexpected Exception: "
+ e.getMessage());
Assert.fail(
testNumber + "Unexpected Exception: " + e.getMessage());
}
}

// System.err.println("\n> " + testNumber + " " + lic + " " + ver + " "
// + val + " " + net + " " + res + " " + cached + "\n" + message);

Assert.assertTrue(testNumber + "Fail:\n" + message
+ "\nDoes not match:" + msg.msg,
message.matches("(?s).*" + msg.msg + ".*"));
Assert.assertTrue(testNumber + "Fail:\n" + message + "\nDoes not match:"
+ msg.msg, message.matches("(?s).*" + msg.msg + ".*"));

String c = cachedPreferences(productNameCval);
Assert.assertTrue(testNumber + "Fail: cacheExists != "

+ 44
- 44
client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java View File

@@ -96,9 +96,8 @@ public class CvalCheckerTest {
static final CvalServer expiredLicenseProviderWithMessage = new CvalServer() {
@Override
String askServer(String productName, String productKey, int timeout) {
return responseJson
.replace("'expired",
"'message':'Custom\\\\nServer\\\\nMessage','expired':true,'expired");
return responseJson.replace("'expired",
"'message':'Custom\\\\nServer\\\\nMessage','expired':true,'expired");
}
};
// A provider returning an expired license with a server message
@@ -205,15 +204,15 @@ public class CvalCheckerTest {

// Success if license key and version are valid
System.setProperty(licenseName, VALID_KEY);
licenseChecker
.validateProduct(productNameCval, "2.1", productTitleCval);
licenseChecker.validateProduct(productNameCval, "2.1",
productTitleCval);
Assert.assertTrue(cacheExists(productNameCval));

// Success if license and cache file are valid, although the license
// server is offline
licenseChecker.setLicenseProvider(unreachableLicenseProvider);
licenseChecker
.validateProduct(productNameCval, "2.1", productTitleCval);
licenseChecker.validateProduct(productNameCval, "2.1",
productTitleCval);
Assert.assertTrue(cacheExists(productNameCval));

// Fail if license key changes although cache file were validated
@@ -262,8 +261,8 @@ public class CvalCheckerTest {
// Check an unlimited license
deleteCache(productNameCval);
licenseChecker.setLicenseProvider(unlimitedLicenseProvider);
licenseChecker
.validateProduct(productNameCval, "2.1", productTitleCval);
licenseChecker.validateProduct(productNameCval, "2.1",
productTitleCval);
Assert.assertTrue(cacheExists(productNameCval));

// Fail if expired flag does not come, but expired epoch is in the past
@@ -281,8 +280,8 @@ public class CvalCheckerTest {

deleteCache(productNameCval);
licenseChecker.setLicenseProvider(nullVersionLicenseProvider);
licenseChecker
.validateProduct(productNameCval, "2.1", productTitleCval);
licenseChecker.validateProduct(productNameCval, "2.1",
productTitleCval);
Assert.assertTrue(cacheExists(productNameCval));
}

@@ -290,8 +289,8 @@ public class CvalCheckerTest {
* Creates a new .jar file with a MANIFEST.MF with all vaadin license info
* attributes set, and add the .jar to the classpath
*/
static void addLicensedJarToClasspath(String productName, String licenseType)
throws Exception {
static void addLicensedJarToClasspath(String productName,
String licenseType) throws Exception {
// Create a manifest with Vaadin CVAL license
Manifest testManifest = new Manifest();
testManifest.getMainAttributes().putValue("Manifest-Version", "1.0");
@@ -306,8 +305,8 @@ public class CvalCheckerTest {
// Create a temporary Jar
File testJarFile = File.createTempFile("vaadin." + productName, ".jar");
testJarFile.deleteOnExit();
JarOutputStream target = new JarOutputStream(new FileOutputStream(
testJarFile), testManifest);
JarOutputStream target = new JarOutputStream(
new FileOutputStream(testJarFile), testManifest);
target.close();

// Add the new jar to our classpath (use reflection)
@@ -362,7 +361,8 @@ public class CvalCheckerTest {
}

static void restoreSystemOut() {
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
System.setOut(
new PrintStream(new FileOutputStream(FileDescriptor.out)));
}

@Test(expected = FileNotFoundException.class)
@@ -374,8 +374,8 @@ public class CvalCheckerTest {
public void testReadKeyFromFile_LicenseFileEmpty() throws Exception {
File tmpLicenseFile = File.createTempFile("license", "lic");

assertNull(licenseChecker.readKeyFromFile(tmpLicenseFile.toURI()
.toURL(), 4));
assertNull(licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));

tmpLicenseFile.delete();
}
@@ -388,8 +388,8 @@ public class CvalCheckerTest {
out.println("this-is-a-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));

tmpLicenseFile.delete();
}
@@ -402,8 +402,8 @@ public class CvalCheckerTest {
out.println("4=this-is-a-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));

tmpLicenseFile.delete();
}
@@ -417,10 +417,10 @@ public class CvalCheckerTest {
out.println("5=this-is-another-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 5));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5));

tmpLicenseFile.delete();
}
@@ -434,10 +434,10 @@ public class CvalCheckerTest {
out.println("5 = this-is-another-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 5));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5));

tmpLicenseFile.delete();
}
@@ -450,8 +450,8 @@ public class CvalCheckerTest {
out.println("5 = this-is-another-license");
out.close();

assertNull(licenseChecker.readKeyFromFile(tmpLicenseFile.toURI()
.toURL(), 3));
assertNull(licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3));

tmpLicenseFile.delete();
}
@@ -464,12 +464,12 @@ public class CvalCheckerTest {
out.println("5 = this-is-another-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 3));
assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 5));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5));

tmpLicenseFile.delete();
}
@@ -483,12 +483,12 @@ public class CvalCheckerTest {
out.println("this-is-a-license");
out.close();

assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 3));
assertEquals("this-is-a-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker.readKeyFromFile(
tmpLicenseFile.toURI().toURL(), 5));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 3));
assertEquals("this-is-a-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 4));
assertEquals("this-is-another-license", licenseChecker
.readKeyFromFile(tmpLicenseFile.toURI().toURL(), 5));

tmpLicenseFile.delete();
}

+ 10
- 10
client/src/main/java/com/vaadin/client/AnimationUtil.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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.vaadin.client.AnimationUtil.AnimationEndListener;

/**
* Utility methods for working with CSS transitions and animations.
*
*
* @author Vaadin Ltd
* @since 7.3
*/
@@ -31,9 +31,9 @@ public class AnimationUtil {

/**
* For internal use only. May be removed or replaced in the future.
*
*
* Set the animation-duration CSS property.
*
*
* @param elem
* the element whose animation-duration to set
* @param duration
@@ -46,9 +46,9 @@ public class AnimationUtil {

/**
* For internal use only. May be removed or replaced in the future.
*
*
* Set the animation-delay CSS property.
*
*
* @param elem
* the element whose animation-delay to set
* @param delay
@@ -69,13 +69,13 @@ public class AnimationUtil {
callbackFunc.listener = listener;

elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false);
// Store function reference for later removal
if(!elem._vaadin_animationend_callbacks) {
elem._vaadin_animationend_callbacks = [];
}
elem._vaadin_animationend_callbacks.push(callbackFunc);
return callbackFunc;
}-*/;


+ 48
- 46
client/src/main/java/com/vaadin/client/ApplicationConfiguration.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -62,7 +62,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Helper class for reading configuration options from the bootstap
* javascript
*
*
* @since 7.0
*/
private static class JsoConfiguration extends JavaScriptObject {
@@ -74,7 +74,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Reads a configuration parameter as a string. Please note that the
* javascript value of the parameter should also be a string, or else an
* undefined exception may be thrown.
*
*
* @param name
* name of the configuration parameter
* @return value of the configuration parameter, or <code>null</code> if
@@ -94,7 +94,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Reads a configuration parameter as a boolean object. Please note that
* the javascript value of the parameter should also be a boolean, or
* else an undefined exception may be thrown.
*
*
* @param name
* name of the configuration parameter
* @return boolean value of the configuration paramter, or
@@ -115,7 +115,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Reads a configuration parameter as an integer object. Please note
* that the javascript value of the parameter should also be an integer,
* or else an undefined exception may be thrown.
*
*
* @param name
* name of the configuration parameter
* @return integer value of the configuration paramter, or
@@ -138,7 +138,7 @@ public class ApplicationConfiguration implements EntryPoint {
* an object with appropriate fields, or else an undefined exception may
* be thrown when calling this method or when calling methods on the
* returned object.
*
*
* @param name
* name of the configuration parameter
* @return error message with the given name, or <code>null</code> if no
@@ -152,7 +152,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Returns a native javascript object containing version information
* from the server.
*
*
* @return a javascript object with the version information
*/
private native JavaScriptObject getVersionInfoJSObject()
@@ -162,9 +162,9 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Gets the version of the Vaadin framework used on the server.
*
*
* @return a string with the version
*
*
* @see com.vaadin.server.VaadinServlet#VERSION
*/
private native String getVaadinVersion()
@@ -174,9 +174,9 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Gets the version of the Atmosphere framework.
*
*
* @return a string with the version
*
*
* @see org.atmosphere.util#getRawVersion()
*/
private native String getAtmosphereVersion()
@@ -186,7 +186,7 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Gets the JS version used in the Atmosphere framework.
*
*
* @return a string with the version
*/
private native String getAtmosphereJSVersion()
@@ -206,7 +206,7 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Wraps a native javascript object containing fields for an error message
*
*
* @since 7.0
*/
public static final class ErrorMessage extends JavaScriptObject {
@@ -268,9 +268,9 @@ public class ApplicationConfiguration implements EntryPoint {
* Checks whether path info in requests to the server-side service should be
* in a request parameter (named <code>v-resourcePath</code>) or appended to
* the end of the service URL.
*
*
* @see #getServiceUrl()
*
*
* @return <code>true</code> if path info should be a request parameter;
* <code>false</code> if the path info goes after the service URL
*/
@@ -282,7 +282,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Return the name of the parameter used to to send data to the service url.
* This method should only be called if {@link #useServiceUrlPathParam()} is
* true.
*
*
* @since 7.1.6
* @return The parameter name, by default <code>v-resourcePath</code>
*/
@@ -300,9 +300,9 @@ public class ApplicationConfiguration implements EntryPoint {
* {@link #useServiceUrlPathParam()} return <code>true</code>, the requested
* path info should be in the <code>v-resourcePath</code> query parameter;
* else the path info should be appended to the end of the URL.
*
*
* @see #useServiceUrlPathParam()
*
*
* @return the URL to the server-side service as a string
*/
public String getServiceUrl() {
@@ -321,7 +321,7 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Gets the URL of the VAADIN directory on the server.
*
*
* @return the URL of the VAADIN directory
*/
public String getVaadinDirUrl() {
@@ -335,7 +335,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Gets the initial UIDL from the DOM, if it was provided during the init
* process.
*
*
* @return
*/
public String getUIDL() {
@@ -355,7 +355,7 @@ public class ApplicationConfiguration implements EntryPoint {
* instance. The UI id should be included in every request originating from
* this instance in order to associate the request with the right UI
* instance on the server.
*
*
* @return the UI id
*/
public int getUIId() {
@@ -418,7 +418,8 @@ public class ApplicationConfiguration implements EntryPoint {
.intValue();

// null -> false
standalone = jsoConfiguration.getConfigBoolean("standalone") == Boolean.TRUE;
standalone = jsoConfiguration
.getConfigBoolean("standalone") == Boolean.TRUE;

heartbeatInterval = jsoConfiguration
.getConfigInteger("heartbeatInterval");
@@ -431,7 +432,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Starts the application with a given id by reading the configuration
* options stored by the bootstrap javascript.
*
*
* @param applicationId
* id of the application to load, this is also the id of the html
* element into which the application should be rendered.
@@ -442,7 +443,8 @@ public class ApplicationConfiguration implements EntryPoint {
@Override
public void execute() {
Profiler.enter("ApplicationConfiguration.startApplication");
ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
ApplicationConfiguration appConf = getConfigFromDOM(
applicationId);
ApplicationConnection a = GWT
.create(ApplicationConnection.class);
a.init(widgetSet, appConf);
@@ -461,7 +463,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Gets the configuration object for a specific application from the
* bootstrap javascript.
*
*
* @param appId
* the id of the application to get configuration data for
* @return a native javascript object containing the configuration data
@@ -484,9 +486,9 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Return Atmosphere version.
*
*
* @since 7.4
*
*
* @return Atmosphere version.
*/
public String getAtmosphereVersion() {
@@ -495,9 +497,9 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Return Atmosphere JS version.
*
*
* @since 7.4
*
*
* @return Atmosphere JS version.
*/
public String getAtmosphereJSVersion() {
@@ -511,7 +513,8 @@ public class ApplicationConfiguration implements EntryPoint {
// Initialize if not already loaded
Integer currentTag = Integer.valueOf(tag);
while (type == null && currentTag != null) {
String serverSideClassNameForTag = getServerSideClassNameForTag(currentTag);
String serverSideClassNameForTag = getServerSideClassNameForTag(
currentTag);
if (TypeData.hasIdentifier(serverSideClassNameForTag)) {
try {
type = (Class<? extends ServerConnector>) TypeData
@@ -562,7 +565,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Returns all tags for given class. Tags are used in
* {@link ApplicationConfiguration} to keep track of different classes and
* their hierarchy
*
*
* @since 7.2
* @param classname
* name of class which tags we want
@@ -624,9 +627,8 @@ public class ApplicationConfiguration implements EntryPoint {
cmd.execute();
}
callbacks.clear();
} else if (dependenciesLoading == 0
&& !ConnectorBundleLoader.get().isBundleLoaded(
ConnectorBundleLoader.DEFERRED_BUNDLE_NAME)) {
} else if (dependenciesLoading == 0 && !ConnectorBundleLoader.get()
.isBundleLoaded(ConnectorBundleLoader.DEFERRED_BUNDLE_NAME)) {
ConnectorBundleLoader.get().loadBundle(
ConnectorBundleLoader.DEFERRED_BUNDLE_NAME,
new BundleLoadCallback() {
@@ -655,9 +657,8 @@ public class ApplicationConfiguration implements EntryPoint {
// Don't run twice if the module has been inherited several times,
// and don't continue if vaadinBootstrap was not executed.
if (moduleLoaded || !vaadinBootstrapLoaded()) {
getLogger()
.log(Level.WARNING,
"vaadinBootstrap.js was not loaded, skipping vaadin application configuration.");
getLogger().log(Level.WARNING,
"vaadinBootstrap.js was not loaded, skipping vaadin application configuration.");
return;
}
moduleLoaded = true;
@@ -714,7 +715,8 @@ public class ApplicationConfiguration implements EntryPoint {

@Override
public void onFailure(Throwable reason) {
Window.alert("Failed to load Vaadin debug window styles");
Window.alert(
"Failed to load Vaadin debug window styles");
}
});

@@ -794,7 +796,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Registers that callback that the bootstrap javascript uses to start
* applications once the widgetset is loaded and all required information is
* available
*
*
* @param widgetsetName
* the name of this widgetset
*/
@@ -809,9 +811,9 @@ public class ApplicationConfiguration implements EntryPoint {
* adding ?debug parameter to URI. Please note that debug mode is always
* disabled if production mode is enabled, but disabling production mode
* does not automatically enable debug mode.
*
*
* @see #isProductionMode()
*
*
* @return true if client side is currently been debugged
*/
public static boolean isDebugMode() {
@@ -823,7 +825,7 @@ public class ApplicationConfiguration implements EntryPoint {
* Checks if production mode is enabled. When production mode is enabled,
* client-side logging is disabled. There may also be other performance
* optimizations.
*
*
* @since 7.1.2
* @return <code>true</code> if production mode is enabled; otherwise
* <code>false</code>.
@@ -843,7 +845,7 @@ public class ApplicationConfiguration implements EntryPoint {

/**
* Checks whether debug logging should be quiet
*
*
* @return <code>true</code> if debug logging should be quiet
*/
public static boolean isQuietDebugMode() {
@@ -855,7 +857,7 @@ public class ApplicationConfiguration implements EntryPoint {
/**
* Checks whether the widget set version has been sent to the server. It is
* sent in the first UIDL request.
*
*
* @return <code>true</code> if browser information has already been sent
*/
public boolean isWidgetsetVersionSent() {

+ 105
- 113
client/src/main/java/com/vaadin/client/ApplicationConnection.java View File

@@ -69,14 +69,14 @@ import com.vaadin.shared.util.SharedUtil;
* This is the client side communication "engine", managing client-server
* communication with its server side counterpart
* com.vaadin.server.VaadinService.
*
*
* Client-side connectors receive updates from the corresponding server-side
* connector (typically component) as state updates or RPC calls. The connector
* has the possibility to communicate back with its server side counter part
* through RPC calls.
*
*
* TODO document better
*
*
* Entry point classes (widgetsets) define <code>onModuleLoad()</code>.
*/
public class ApplicationConnection implements HasHandlers {
@@ -100,18 +100,17 @@ public class ApplicationConnection implements HasHandlers {
* A string that, if found in a non-JSON response to a UIDL request, will
* cause the browser to refresh the page. If followed by a colon, optional
* whitespace, and a URI, causes the browser to synchronously load the URI.
*
*
* <p>
* This allows, for instance, a servlet filter to redirect the application
* to a custom login page when the session expires. For example:
* </p>
*
*
* <pre>
* if (sessionExpired) {
* response.setHeader(&quot;Content-Type&quot;, &quot;text/html&quot;);
* response.getWriter().write(
* myLoginPageHtml + &quot;&lt;!-- Vaadin-Refresh: &quot;
* + request.getContextPath() + &quot; --&gt;&quot;);
* response.getWriter().write(myLoginPageHtml + &quot;&lt;!-- Vaadin-Refresh: &quot;
* + request.getContextPath() + &quot; --&gt;&quot;);
* }
* </pre>
*/
@@ -156,7 +155,8 @@ public class ApplicationConnection implements HasHandlers {
void onResponseHandlingEnded(ResponseHandlingEndedEvent e);
}

public static class RequestStartingEvent extends ApplicationConnectionEvent {
public static class RequestStartingEvent
extends ApplicationConnectionEvent {

public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();

@@ -175,8 +175,8 @@ public class ApplicationConnection implements HasHandlers {
}
}

public static class ResponseHandlingEndedEvent extends
ApplicationConnectionEvent {
public static class ResponseHandlingEndedEvent
extends ApplicationConnectionEvent {

public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>();

@@ -195,8 +195,8 @@ public class ApplicationConnection implements HasHandlers {
}
}

public static abstract class ApplicationConnectionEvent extends
GwtEvent<CommunicationHandler> {
public static abstract class ApplicationConnectionEvent
extends GwtEvent<CommunicationHandler> {

private ApplicationConnection connection;

@@ -210,8 +210,8 @@ public class ApplicationConnection implements HasHandlers {

}

public static class ResponseHandlingStartedEvent extends
ApplicationConnectionEvent {
public static class ResponseHandlingStartedEvent
extends ApplicationConnectionEvent {

public ResponseHandlingStartedEvent(ApplicationConnection connection) {
super(connection);
@@ -233,17 +233,17 @@ public class ApplicationConnection implements HasHandlers {
/**
* Event triggered when a application is stopped by calling
* {@link ApplicationConnection#setApplicationRunning(false)}.
*
*
* To listen for the event add a {@link ApplicationStoppedHandler} by
* invoking
* {@link ApplicationConnection#addHandler(ApplicationConnection.ApplicationStoppedEvent.Type, ApplicationStoppedHandler)}
* to the {@link ApplicationConnection}
*
*
* @since 7.1.8
* @author Vaadin Ltd
*/
public static class ApplicationStoppedEvent extends
GwtEvent<ApplicationStoppedHandler> {
public static class ApplicationStoppedEvent
extends GwtEvent<ApplicationStoppedHandler> {

public static Type<ApplicationStoppedHandler> TYPE = new Type<ApplicationStoppedHandler>();

@@ -265,7 +265,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Called when a communication error has occurred. Returning
* <code>true</code> from this method suppresses error handling.
*
*
* @param details
* A string describing the error.
* @param statusCode
@@ -280,7 +280,7 @@ public class ApplicationConnection implements HasHandlers {
* A listener for listening to application stopped events. The listener can
* be added to a {@link ApplicationConnection} by invoking
* {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)}
*
*
* @since 7.1.8
* @author Vaadin Ltd
*/
@@ -290,7 +290,7 @@ public class ApplicationConnection implements HasHandlers {
* Triggered when the {@link ApplicationConnection} marks a previously
* running application as stopped by invoking
* {@link ApplicationConnection#setApplicationRunning(false)}
*
*
* @param event
* the event triggered by the {@link ApplicationConnection}
*/
@@ -351,8 +351,8 @@ public class ApplicationConnection implements HasHandlers {

public ApplicationConnection() {
// Assuming UI data is eagerly loaded
ConnectorBundleLoader.get().loadBundle(
ConnectorBundleLoader.EAGER_BUNDLE_NAME, null);
ConnectorBundleLoader.get()
.loadBundle(ConnectorBundleLoader.EAGER_BUNDLE_NAME, null);
uIConnector = GWT.create(UIConnector.class);
rpcManager = GWT.create(RpcManager.class);
layoutManager = GWT.create(LayoutManager.class);
@@ -368,9 +368,8 @@ public class ApplicationConnection implements HasHandlers {
getLogger().info("Starting application " + cnf.getRootPanelId());
getLogger().info("Using theme: " + cnf.getThemeName());

getLogger().info(
"Vaadin application servlet version: "
+ cnf.getServletVersion());
getLogger().info("Vaadin application servlet version: "
+ cnf.getServletVersion());

if (!cnf.getServletVersion().equals(Version.getFullVersion())) {
getLogger()
@@ -428,7 +427,7 @@ public class ApplicationConnection implements HasHandlers {
* called once this application has started (first response received) or
* failed to start. This ensures that the applications are started in order,
* to avoid session-id problems.
*
*
*/
public void start() {
String jsonText = configuration.getUIDL();
@@ -440,8 +439,8 @@ public class ApplicationConnection implements HasHandlers {

// Hack to avoid logging an error in endRequest()
getMessageSender().startRequest();
getMessageHandler().handleMessage(
MessageHandler.parseJson(jsonText));
getMessageHandler()
.handleMessage(MessageHandler.parseJson(jsonText));
}

// Tooltip can't be created earlier because the
@@ -460,7 +459,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Checks if there is some work to be done on the client side
*
*
* @return true if the client has some work to be done, false otherwise
*/
private boolean isActive() {
@@ -535,7 +534,7 @@ public class ApplicationConnection implements HasHandlers {
* <li><code>vaadin.postRequestHooks</code> is a map of functions which gets
* called after each XHR made by vaadin application. Note, that it is
* attaching js functions responsibility to create the variable like this:
*
*
* <code><pre>
* if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
* postRequestHooks.myHook = function(appId) {
@@ -546,7 +545,7 @@ public class ApplicationConnection implements HasHandlers {
* </pre></code> First parameter passed to these functions is the identifier
* of Vaadin application that made the request.
* </ul>
*
*
* TODO make this multi-app aware
*/
private native void initializeClientHooks()
@@ -577,7 +576,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Requests an analyze of layouts, to find inconsistencies. Exclusively used
* for debugging during development.
*
*
* @deprecated as of 7.1. Replaced by {@link UIConnector#analyzeLayouts()}
*/
@Deprecated
@@ -589,7 +588,7 @@ public class ApplicationConnection implements HasHandlers {
* Sends a request to the server to print details to console that will help
* the developer to locate the corresponding server-side connector in the
* source code.
*
*
* @param serverConnector
* @deprecated as of 7.1. Replaced by
* {@link UIConnector#showServerDebugInfo(ServerConnector)}
@@ -619,10 +618,9 @@ public class ApplicationConnection implements HasHandlers {

// Show this message just once
if (cssWaits++ == 0) {
getLogger().warning(
"Assuming CSS loading is not complete, "
+ "postponing render phase. "
+ "(.v-loading-indicator height == 0)");
getLogger().warning("Assuming CSS loading is not complete, "
+ "postponing render phase. "
+ "(.v-loading-indicator height == 0)");
}
} else {
cssLoaded = true;
@@ -637,7 +635,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Checks whether or not the CSS is loaded. By default checks the size of
* the loading indicator element.
*
*
* @return
*/
protected boolean isCSSLoaded() {
@@ -647,12 +645,12 @@ public class ApplicationConnection implements HasHandlers {

/**
* Shows the communication error notification.
*
*
* @param details
* Optional details.
* @param statusCode
* The status code returned for the request
*
*
*/
public void showCommunicationError(String details, int statusCode) {
getLogger().severe("Communication error: " + details);
@@ -661,7 +659,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Shows the authentication error notification.
*
*
* @param details
* Optional details.
*/
@@ -672,7 +670,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Shows the session expiration notification.
*
*
* @param details
* Optional details.
*/
@@ -683,7 +681,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Shows an error notification.
*
*
* @param details
* Optional details.
* @param message
@@ -731,7 +729,7 @@ public class ApplicationConnection implements HasHandlers {
* <p>
* Used by the native "client.isActive" function.
* </p>
*
*
* @return true if deferred commands are (potentially) being executed, false
* otherwise
*/
@@ -746,7 +744,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Returns the loading indicator used by this ApplicationConnection
*
*
* @return The loading indicator for this ApplicationConnection
*/
public VLoadingIndicator getLoadingIndicator() {
@@ -755,7 +753,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Determines whether or not the loading indicator is showing.
*
*
* @return true if the loading indicator is visible
* @deprecated As of 7.1. Use {@link #getLoadingIndicator()} and
* {@link VLoadingIndicator#isVisible()}.isVisible() instead.
@@ -775,9 +773,8 @@ public class ApplicationConnection implements HasHandlers {

@Override
public void onError(ResourceLoadEvent event) {
getLogger()
.severe(event.getResourceUrl()
+ " could not be loaded, or the load detection failed because the stylesheet is empty.");
getLogger().severe(event.getResourceUrl()
+ " could not be loaded, or the load detection failed because the stylesheet is empty.");
// The show must go on
onLoad(event);
}
@@ -865,7 +862,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -887,7 +884,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -910,7 +907,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -933,7 +930,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -956,7 +953,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -979,7 +976,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -1002,7 +999,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -1025,7 +1022,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
* </p>
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -1048,7 +1045,7 @@ public class ApplicationConnection implements HasHandlers {
* the update will be sent along with the next immediate update.
* <p>
* A null array is sent as an empty array.
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -1071,7 +1068,7 @@ public class ApplicationConnection implements HasHandlers {
* the update will be sent along with the next immediate update.
* <p>
* A null array is sent as an empty array.
*
*
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -1088,7 +1085,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Does absolutely nothing. Replaced by {@link LayoutManager}.
*
*
* @param container
* @deprecated As of 7.0, serves no purpose
*/
@@ -1110,7 +1107,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Returns false
*
*
* @param paintable
* @return false, always
* @deprecated As of 7.0, serves no purpose
@@ -1122,7 +1119,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Returns false
*
*
* @param paintable
* @return false, always
* @deprecated As of 7.0, serves no purpose
@@ -1143,16 +1140,16 @@ public class ApplicationConnection implements HasHandlers {
/**
* Get either an existing ComponentConnector or create a new
* ComponentConnector with the given type and id.
*
*
* If a ComponentConnector with the given id already exists, returns it.
* Otherwise creates and registers a new ComponentConnector of the given
* type.
*
*
* @param connectorId
* Id of the paintable
* @param connectorType
* Type of the connector, as passed from the server side
*
*
* @return Either an existing ComponentConnector or a new ComponentConnector
* of the given type
*/
@@ -1165,15 +1162,15 @@ public class ApplicationConnection implements HasHandlers {

/**
* Creates a new ServerConnector with the given type and id.
*
*
* Creates and registers a new ServerConnector of the given type. Should
* never be called with the connector id of an existing connector.
*
*
* @param connectorId
* Id of the new connector
* @param connectorType
* Type of the connector, as passed from the server side
*
*
* @return A new ServerConnector of the given type
*/
private ServerConnector createAndRegisterConnector(String connectorId,
@@ -1193,7 +1190,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets a resource that has been pre-loaded via UIDL, such as custom
* layouts.
*
*
* @param name
* identifier of the resource to get
* @return the resource
@@ -1205,7 +1202,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sets a resource that has been pre-loaded via UIDL, such as custom
* layouts.
*
*
* @since 7.6
* @param name
* identifier of the resource to Set
@@ -1218,7 +1215,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Singleton method to get instance of app's context menu.
*
*
* @return VContextMenu object
*/
public VContextMenu getContextMenu() {
@@ -1233,7 +1230,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets an {@link Icon} instance corresponding to a URI.
*
*
* @since 7.2
* @param uri
* @return Icon object
@@ -1255,7 +1252,7 @@ public class ApplicationConnection implements HasHandlers {
* Translates custom protocols in UIDL URI's to be recognizable by browser.
* All uri's from UIDL should be routed via this method before giving them
* to browser due URI's in UIDL may contain custom protocols like theme://.
*
*
* @param uidlUri
* Vaadin URI from uidl
* @return translated URI ready for browser
@@ -1267,7 +1264,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the URI for the current theme. Can be used to reference theme
* resources.
*
*
* @return URI to the current theme
*/
public String getThemeUri() {
@@ -1284,7 +1281,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Use to notify that the given component's caption has changed; layouts may
* have to be recalculated.
*
*
* @param component
* the Paintable whose caption has changed
* @deprecated As of 7.0.2, has not had any effect for a long time
@@ -1296,7 +1293,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the main view
*
*
* @return the main view
*/
public UIConnector getUIConnector() {
@@ -1305,7 +1302,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the {@link ApplicationConfiguration} for the current application.
*
*
* @see ApplicationConfiguration
* @return the configuration for this application
*/
@@ -1318,7 +1315,7 @@ public class ApplicationConnection implements HasHandlers {
* list of events which has server side listeners is updated automatically
* before the component is updated so the value is correct if called from
* updatedFromUIDL.
*
*
* @param connector
* The connector to register event listeners for
* @param eventIdentifier
@@ -1337,7 +1334,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Adds the get parameters to the uri and returns the new uri that contains
* the parameters.
*
*
* @param uri
* The uri to which the parameters should be added.
* @param extraParams
@@ -1361,14 +1358,13 @@ public class ApplicationConnection implements HasHandlers {
*/
@Deprecated
public void unregisterPaintable(ServerConnector p) {
getLogger().info(
"unregisterPaintable (unnecessarily) called for "
+ Util.getConnectorString(p));
getLogger().info("unregisterPaintable (unnecessarily) called for "
+ Util.getConnectorString(p));
}

/**
* Get VTooltip instance related to application connection
*
*
* @return VTooltip instance
*/
public VTooltip getVTooltip() {
@@ -1380,7 +1376,7 @@ public class ApplicationConnection implements HasHandlers {
* this method is now handled by the state change event handler in
* AbstractComponentConnector. The only function this method has is to
* return true if the UIDL is a "cached" update.
*
*
* @param component
* @param uidl
* @param manageCaption
@@ -1397,10 +1393,8 @@ public class ApplicationConnection implements HasHandlers {
}

if (!manageCaption) {
getLogger()
.warning(
Util.getConnectorString(connector)
+ " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
getLogger().warning(Util.getConnectorString(connector)
+ " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all.");
}
return false;
}
@@ -1433,7 +1427,7 @@ public class ApplicationConnection implements HasHandlers {
* Schedules a heartbeat request to occur after the configured heartbeat
* interval elapses if the interval is a positive number. Otherwise, does
* nothing.
*
*
* @deprecated as of 7.2, use {@link Heartbeat#schedule()} instead
*/
@Deprecated
@@ -1447,7 +1441,7 @@ public class ApplicationConnection implements HasHandlers {
* Heartbeat requests are used to inform the server that the client-side is
* still alive. If the client page is closed or the connection lost, the
* server will eventually close the inactive UI.
*
*
* @deprecated as of 7.2, use {@link Heartbeat#send()} instead
*/
@Deprecated
@@ -1470,41 +1464,39 @@ public class ApplicationConnection implements HasHandlers {

/**
* Sets the delegate that is called whenever a communication error occurrs.
*
*
* @param delegate
* the delegate.
*/
public void setCommunicationErrorDelegate(CommunicationErrorHandler delegate) {
public void setCommunicationErrorDelegate(
CommunicationErrorHandler delegate) {
communicationErrorDelegate = delegate;
}

public void setApplicationRunning(boolean applicationRunning) {
if (getApplicationState() == ApplicationState.TERMINATED) {
if (applicationRunning) {
getLogger()
.severe("Tried to restart a terminated application. This is not supported");
getLogger().severe(
"Tried to restart a terminated application. This is not supported");
} else {
getLogger()
.warning(
"Tried to stop a terminated application. This should not be done");
getLogger().warning(
"Tried to stop a terminated application. This should not be done");
}
return;
} else if (getApplicationState() == ApplicationState.INITIALIZING) {
if (applicationRunning) {
applicationState = ApplicationState.RUNNING;
} else {
getLogger()
.warning(
"Tried to stop the application before it has started. This should not be done");
getLogger().warning(
"Tried to stop the application before it has started. This should not be done");
}
} else if (getApplicationState() == ApplicationState.RUNNING) {
if (!applicationRunning) {
applicationState = ApplicationState.TERMINATED;
eventBus.fireEvent(new ApplicationStoppedEvent());
} else {
getLogger()
.warning(
"Tried to start an already running application. This should not be done");
getLogger().warning(
"Tried to start an already running application. This should not be done");
}
}
}
@@ -1512,7 +1504,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Checks if the application is in the {@link ApplicationState#RUNNING}
* state.
*
*
* @since 7.6
* @return true if the application is in the running state, false otherwise
*/
@@ -1544,7 +1536,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the active connector for focused element in browser.
*
*
* @return Connector for focused element or null.
*/
private ComponentConnector getActiveConnector() {
@@ -1572,7 +1564,7 @@ public class ApplicationConnection implements HasHandlers {
* "initializing" to "running" to "stopped". There is no way for an
* application to go back to a previous state, i.e. a stopped application
* can never be re-started
*
*
* @since 7.6
* @return the current state of this application
*/
@@ -1582,7 +1574,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the server RPC queue for this application
*
*
* @since 7.6
* @return the server RPC queue
*/
@@ -1592,7 +1584,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the communication error handler for this application
*
*
* @since 7.6
* @return the server RPC queue
*/
@@ -1602,7 +1594,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the (server to client) message handler for this application
*
*
* @since 7.6
* @return the message handler
*/
@@ -1612,7 +1604,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the server rpc manager for this application
*
*
* @since 7.6
* @return the server rpc manager
*/
@@ -1622,7 +1614,7 @@ public class ApplicationConnection implements HasHandlers {

/**
* Gets the (client to server) message sender for this application
*
*
* @since 7.6
* @return the message sender
*/

+ 26
- 26
client/src/main/java/com/vaadin/client/BrowserInfo.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,10 +21,10 @@ import com.vaadin.shared.VBrowserDetails;

/**
* Class used to query information about web browser.
*
*
* Browser details are detected only once and those are stored in this singleton
* class.
*
*
*/
public class BrowserInfo {

@@ -60,7 +60,7 @@ public class BrowserInfo {

/**
* Singleton method to get BrowserInfo object.
*
*
* @return instance of BrowserInfo object
*/
public static BrowserInfo get() {
@@ -122,19 +122,19 @@ public class BrowserInfo {
* Returns a string representing the browser in use, for use in CSS
* classnames. The classnames will be space separated abbreviations,
* optionally with a version appended.
*
*
* Abbreviations: Firefox: ff Internet Explorer: ie Safari: sa Opera: op
*
*
* Browsers that CSS-wise behave like each other will get the same
* abbreviation (this usually depends on the rendering engine).
*
*
* This is quite simple at the moment, more heuristics will be added when
* needed.
*
*
* Examples: Internet Explorer 6: ".v-ie .v-ie6 .v-ie60", Firefox 3.0.4:
* ".v-ff .v-ff3 .v-ff30", Opera 9.60: ".v-op .v-op9 .v-op960", Opera 10.10:
* ".v-op .v-op10 .v-op1010"
*
*
* @return
*/
public String getCSSClass() {
@@ -284,7 +284,7 @@ public class BrowserInfo {
/**
* Returns the Gecko version if the browser is Gecko based. The Gecko
* version for Firefox 2 is 1.8 and 1.9 for Firefox 3.
*
*
* @return The Gecko version or -1 if the browser is not Gecko based
*/
public float getGeckoVersion() {
@@ -298,7 +298,7 @@ public class BrowserInfo {
/**
* Returns the WebKit version if the browser is WebKit based. The WebKit
* version returned is the major version e.g., 523.
*
*
* @return The WebKit version or -1 if the browser is not WebKit based
*/
public float getWebkitVersion() {
@@ -362,7 +362,7 @@ public class BrowserInfo {
/**
* Indicates whether the browser might require juggling to properly update
* sizes inside elements with overflow: auto.
*
*
* @return <code>true</code> if the browser requires the workaround,
* otherwise <code>false</code>
*/
@@ -379,7 +379,7 @@ public class BrowserInfo {
* <p>
* See https://bugs.webkit.org/show_bug.cgi?id=123958 and
* http://code.google.com/p/chromium/issues/detail?id=316549
*
*
* @since 7.1.8
* @return <code>true</code> if the browser requires the workaround,
* otherwise <code>false</code>
@@ -391,7 +391,7 @@ public class BrowserInfo {

/**
* Checks if the browser is run on iOS
*
*
* @return true if the browser is run on iOS, false otherwise
*/
public boolean isIOS() {
@@ -400,7 +400,7 @@ public class BrowserInfo {

/**
* Checks if the browser is run on iOS 6.
*
*
* @since 7.1.1
* @return true if the browser is run on iOS 6, false otherwise
*/
@@ -410,7 +410,7 @@ public class BrowserInfo {

/**
* Checks if the browser is run on Android
*
*
* @return true if the browser is run on Android, false otherwise
*/
public boolean isAndroid() {
@@ -420,7 +420,7 @@ public class BrowserInfo {
/**
* Checks if the browser is capable of handling scrolling natively or if a
* touch scroll helper is needed for scrolling.
*
*
* @return true if browser needs a touch scroll helper, false if the browser
* can handle scrolling natively
*/
@@ -448,13 +448,13 @@ public class BrowserInfo {
/**
* Tests if this is an Android devices with a broken scrollTop
* implementation
*
*
* @return true if scrollTop cannot be trusted on this device, false
* otherwise
*/
public boolean isAndroidWithBrokenScrollTop() {
return isAndroid()
&& (getOperatingSystemMajorVersion() == 3 || getOperatingSystemMajorVersion() == 4);
return isAndroid() && (getOperatingSystemMajorVersion() == 3
|| getOperatingSystemMajorVersion() == 4);
}

public boolean isAndroid23() {
@@ -477,7 +477,7 @@ public class BrowserInfo {
* Note that Internet Explorer 8 and newer will return the document mode so
* IE8 rendering as IE7 will return 7.
* </p>
*
*
* @return The major version of the browser.
*/
public int getBrowserMajorVersion() {
@@ -486,9 +486,9 @@ public class BrowserInfo {

/**
* Returns the browser minor version e.g., 5 for Firefox 3.5.
*
*
* @see #getBrowserMajorVersion()
*
*
* @return The minor version of the browser, or -1 if not known/parsed.
*/
public int getBrowserMinorVersion() {
@@ -498,7 +498,7 @@ public class BrowserInfo {
/**
* Checks if the browser version is newer or equal to the given major+minor
* version.
*
*
* @param majorVersion
* The major version to check for
* @param minorVersion

+ 5
- 5
client/src/main/java/com/vaadin/client/CSSRule.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 CSSRule {
private JavaScriptObject rules = null;

/**
*
*
* @param selector
* the CSS selector to search for in the stylesheets
* @param deep
@@ -108,7 +108,7 @@ public class CSSRule {

/**
* Returns a specific property value from this CSS rule.
*
*
* @param propertyName
* camelCase CSS property name
* @return the value of the property as a String

+ 15
- 15
client/src/main/java/com/vaadin/client/ComponentConnector.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -24,7 +24,7 @@ import com.vaadin.shared.AbstractComponentState;
* An interface used by client-side widgets or paintable parts to receive
* updates from the corresponding server-side components in the form of
* {@link UIDL}.
*
*
* Updates can be sent back to the server using the
* {@link ApplicationConnection#updateVariable()} methods.
*/
@@ -32,7 +32,7 @@ public interface ComponentConnector extends ServerConnector {

/*
* (non-Javadoc)
*
*
* @see com.vaadin.client.VPaintable#getState()
*/
@Override
@@ -49,7 +49,7 @@ public interface ComponentConnector extends ServerConnector {
* Returns <code>true</code> if the width of this paintable is currently
* undefined. If the width is undefined, the actual width of the paintable
* is defined by its contents.
*
*
* @return <code>true</code> if the width is undefined, else
* <code>false</code>
*/
@@ -59,7 +59,7 @@ public interface ComponentConnector extends ServerConnector {
* Returns <code>true</code> if the height of this paintable is currently
* undefined. If the height is undefined, the actual height of the paintable
* is defined by its contents.
*
*
* @return <code>true</code> if the height is undefined, else
* <code>false</code>
*/
@@ -69,7 +69,7 @@ public interface ComponentConnector extends ServerConnector {
* Returns <code>true</code> if the width of this paintable is currently
* relative. If the width is relative, the actual width of the paintable is
* a percentage of the size allocated to it by its parent.
*
*
* @return <code>true</code> if the width is undefined, else
* <code>false</code>
*/
@@ -79,7 +79,7 @@ public interface ComponentConnector extends ServerConnector {
* Returns <code>true</code> if the height of this paintable is currently
* relative. If the height is relative, the actual height of the paintable
* is a percentage of the size allocated to it by its parent.
*
*
* @return <code>true</code> if the width is undefined, else
* <code>false</code>
*/
@@ -87,7 +87,7 @@ public interface ComponentConnector extends ServerConnector {

/**
* Checks if the connector is read only.
*
*
* @deprecated This belongs in AbstractFieldConnector, see #8514
* @return true
*/
@@ -97,13 +97,13 @@ public interface ComponentConnector extends ServerConnector {
/**
* Return true if parent handles caption, false if the paintable handles the
* caption itself.
*
*
* <p>
* This should always return true and all components should let the parent
* handle the caption and use other attributes for internal texts in the
* component
* </p>
*
*
* @return true if caption handling is delegated to the parent, false if
* parent should not be allowed to render caption
*/
@@ -111,7 +111,7 @@ public interface ComponentConnector extends ServerConnector {

/**
* Sets the enabled state of the widget associated to this connector.
*
*
* @param widgetEnabled
* true if the widget should be enabled, false otherwise
*/
@@ -124,7 +124,7 @@ public interface ComponentConnector extends ServerConnector {
* overridden to return <code>true</code> in all situations where this
* method might return a non-empty result.
* </p>
*
*
* @param element
* The element to lookup a tooltip for
* @return The tooltip for the element or null if no tooltip is defined for
@@ -140,7 +140,7 @@ public interface ComponentConnector extends ServerConnector {
* This is only done to optimize performance, so in cases where the status
* is not known, it's safer to return <code>true</code> so that there will
* be a tooltip handler even though it might not be needed in all cases.
*
*
* @return <code>true</code> if some part of the component might have a
* tooltip, otherwise <code>false</code>
*/

+ 4
- 4
client/src/main/java/com/vaadin/client/ComponentDetail.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -30,7 +30,7 @@ class ComponentDetail {
/**
* Returns a TooltipInfo assosiated with Component. If element is given,
* returns an additional TooltipInfo.
*
*
* @param key
* @return the tooltipInfo
*/

+ 3
- 3
client/src/main/java/com/vaadin/client/ComponentDetailMap.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
- 34
client/src/main/java/com/vaadin/client/ComputedStyle.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 ComputedStyle {
* <p>
* Note that this method is expensive. Wherever possible, reuse the returned
* object.
*
*
* @param elem
* the element
* @return the computed style
@@ -44,18 +44,18 @@ public class ComputedStyle {
if(elem.nodeType != 1) {
return {};
}
if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) {
return $wnd.document.defaultView.getComputedStyle(elem, null);
}
if(elem.currentStyle) {
return elem.currentStyle;
}
}-*/;

/**
*
*
* @param name
* name of the CSS property in camelCase
* @return the value of the property, normalized for across browsers (each
@@ -65,7 +65,7 @@ public class ComputedStyle {
/*-{
var cs = this.@com.vaadin.client.ComputedStyle::computedStyle;
var elem = this.@com.vaadin.client.ComputedStyle::elem;
// Border values need to be checked separately. The width might have a
// meaningful value even if the border style is "none". In that case the
// value should be 0.
@@ -80,13 +80,13 @@ public class ComputedStyle {
}

if(cs.getPropertyValue) {
// Convert name to dashed format
name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
var ret = cs.getPropertyValue(name);
} else {
var ret = cs[name];
var style = elem.style;

@@ -98,25 +98,25 @@ public class ComputedStyle {
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
// Remember the original values
var left = style.left, rsLeft = elem.runtimeStyle.left;
// Put in the new values to get a computed value out
elem.runtimeStyle.left = cs.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
// Normalize margin values. This is not totally valid, but in most cases
// it is what the user wants to know.
if(name.indexOf("margin") > -1 && ret == "auto") {
return "0px";
}
// Some browsers return undefined width and height values as "auto", so
// we need to retrieve those ourselves.
if (name == "width" && ret == "auto") {
@@ -126,14 +126,14 @@ public class ComputedStyle {
}

return ret;
}-*/;

/**
* Retrieves the given computed property as an integer
*
*
* Returns 0 if the property cannot be converted to an integer
*
*
* @param name
* the property to retrieve
* @return the integer value of the property or 0
@@ -148,9 +148,9 @@ public class ComputedStyle {

/**
* Retrieves the given computed property as a double
*
*
* Returns NaN if the property cannot be converted to a double
*
*
* @since 7.5.1
* @param name
* the property to retrieve
@@ -205,7 +205,7 @@ public class ComputedStyle {

/**
* Returns the current width from the DOM.
*
*
* @since 7.5.1
* @return the computed width
*/
@@ -215,7 +215,7 @@ public class ComputedStyle {

/**
* Returns the current height from the DOM.
*
*
* @since 7.5.1
* @return the computed height
*/
@@ -225,13 +225,13 @@ public class ComputedStyle {

/**
* Takes a String value e.g. "12px" and parses that to Integer 12.
*
*
* @param String
* a value starting with a number
* @return Integer the value from the string before any non-numeric
* characters. If the value cannot be parsed to a number, returns
* <code>null</code>.
*
*
* @deprecated Since 7.1.4, the method {@link #parseIntNative(String)} is
* used internally and this method does not belong in the public
* API of {@link ComputedStyle}. {@link #parseInt(String)} might
@@ -250,10 +250,10 @@ public class ComputedStyle {

/**
* Takes a String value e.g. "12px" and parses that to int 12.
*
*
* <p>
* This method returns 0 for <code>NaN</code>.
*
*
* @param String
* a value starting with a number
* @return int the value from the string before any non-numeric characters.
@@ -270,7 +270,7 @@ public class ComputedStyle {

/**
* Takes a String value e.g. "12.3px" and parses that to a double, 12.3.
*
*
* @param String
* a value starting with a number
* @return the value from the string before any non-numeric characters or
@@ -283,7 +283,7 @@ public class ComputedStyle {

/**
* Returns the sum of the top and bottom border width
*
*
* @since 7.5.3
* @return the sum of the top and bottom border
*/
@@ -296,7 +296,7 @@ public class ComputedStyle {

/**
* Returns the sum of the left and right border width
*
*
* @since 7.5.3
* @return the sum of the left and right border
*/
@@ -309,7 +309,7 @@ public class ComputedStyle {

/**
* Returns the sum of the top and bottom padding
*
*
* @since 7.5.3
* @return the sum of the top and bottom padding
*/
@@ -322,7 +322,7 @@ public class ComputedStyle {

/**
* Returns the sum of the top and bottom padding
*
*
* @since 7.5.3
* @return the sum of the left and right padding
*/
@@ -335,7 +335,7 @@ public class ComputedStyle {

/**
* Returns the sum of the top and bottom margin
*
*
* @since 7.5.6
* @return the sum of the top and bottom margin
*/
@@ -348,7 +348,7 @@ public class ComputedStyle {

/**
* Returns the sum of the top and bottom margin
*
*
* @since 7.5.6
* @return the sum of the left and right margin
*/

+ 13
- 13
client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,13 +29,13 @@ import com.vaadin.client.ui.AbstractHasComponentsConnector;
* hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update
* from the server has been fully processed and all hierarchy updates have been
* completed.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*
*
*/
public class ConnectorHierarchyChangeEvent extends
AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> {
public class ConnectorHierarchyChangeEvent
extends AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> {
/**
* Type of this event, used by the event bus.
*/
@@ -49,7 +49,7 @@ public class ConnectorHierarchyChangeEvent extends
/**
* Returns a collection of the old children for the connector. This was the
* state before the update was received from the server.
*
*
* @return A collection of old child connectors. Never returns null.
*/
public List<ComponentConnector> getOldChildren() {
@@ -58,7 +58,7 @@ public class ConnectorHierarchyChangeEvent extends

/**
* Sets the collection of the old children for the connector.
*
*
* @param oldChildren
* The old child connectors. Must not be null.
*/
@@ -68,7 +68,7 @@ public class ConnectorHierarchyChangeEvent extends

/**
* Returns the {@link HasComponentsConnector} for which this event occurred.
*
*
* @return The {@link HasComponentsConnector} whose child collection has
* changed. Never returns null.
*/
@@ -90,8 +90,8 @@ public class ConnectorHierarchyChangeEvent extends
* implement this interface, but instead make your connector class extend
* {@link AbstractHasComponentsConnector} or an appropriate subclass.
*/
public interface ConnectorHierarchyChangeHandler extends Serializable,
EventHandler {
public interface ConnectorHierarchyChangeHandler
extends Serializable, EventHandler {
/**
* Called by the framework when the list of child components of the
* connector implementing this interface has changed. The implementation
@@ -112,7 +112,7 @@ public class ConnectorHierarchyChangeEvent extends
* parent connector might not yet have detached a child widget and that
* the widget of a removed child might already have been attached by its
* new parent.
*
*
* @param connectorHierarchyChangeEvent
* the event with information about the hierarchy change
*/

+ 17
- 16
client/src/main/java/com/vaadin/client/ConnectorMap.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,8 @@ import com.google.gwt.user.client.ui.Widget;

public class ConnectorMap {

public static ConnectorMap get(ApplicationConnection applicationConnection) {
public static ConnectorMap get(
ApplicationConnection applicationConnection) {
return applicationConnection.getConnectorMap();
}

@@ -36,7 +37,7 @@ public class ConnectorMap {

/**
* Returns a {@link ServerConnector} by its id
*
*
* @param id
* The connector id
* @return A connector or null if a connector with the given id has not been
@@ -53,7 +54,7 @@ public class ConnectorMap {

/**
* Returns a {@link ComponentConnector} element by its root element.
*
*
* @param element
* Root element of the {@link ComponentConnector}
* @return A connector or null if a connector with the given id has not been
@@ -81,7 +82,7 @@ public class ConnectorMap {

/**
* FIXME: What does this even do and why?
*
*
* @param pid
* @return
*/
@@ -91,7 +92,7 @@ public class ConnectorMap {

/**
* Checks if a connector with the given id has been registered.
*
*
* @param connectorId
* The id to check for
* @return true if a connector has been registered with the given id, false
@@ -110,7 +111,7 @@ public class ConnectorMap {

/**
* Retrieves the connector whose widget matches the parameter.
*
*
* @param widget
* The widget
* @return A connector with {@literal widget} as its root widget or null if
@@ -144,7 +145,7 @@ public class ConnectorMap {
* Gets the connector id using a DOM element - the element should be the
* root element for a connector, otherwise no id will be found. Use
* {@link #getConnectorId(ServerConnector)} instead whenever possible.
*
*
* @see #getConnectorId(ServerConnector)
* @param el
* element of the connector whose id is desired
@@ -158,7 +159,7 @@ public class ConnectorMap {
/**
* Gets the main element for the connector with the given id. The reverse of
* {@link #getConnectorId(Element)}.
*
*
* @param connectorId
* the id of the widget whose element is desired
* @return the element for the connector corresponding to the id
@@ -177,7 +178,7 @@ public class ConnectorMap {
* This method does not remove the connector from the DOM, but marks the
* connector so that ApplicationConnection may clean up its references to
* it. Removing the widget from DOM is component containers responsibility.
*
*
* @param connector
* the connector to remove
*/
@@ -208,9 +209,9 @@ public class ConnectorMap {

/**
* Gets all registered {@link ComponentConnector} instances
*
*
* @return An array of all registered {@link ComponentConnector} instances
*
*
* @deprecated As of 7.0.1, use {@link #getComponentConnectorsAsJsArray()}
* for better performance.
*/
@@ -259,7 +260,7 @@ public class ConnectorMap {

/**
* @return
*
*
* @deprecated As of 7.0.1, use {@link #getConnectorsAsJsArray()} for
* improved performance.
*/
@@ -290,7 +291,7 @@ public class ConnectorMap {

/**
* Tests if the widget is the root widget of a {@link ComponentConnector}.
*
*
* @param widget
* The widget to test
* @return true if the widget is the root widget of a

+ 6
- 6
client/src/main/java/com/vaadin/client/ContainerResizedListener.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -19,7 +19,7 @@ package com.vaadin.client;
/**
* ContainerResizedListener interface is useful for Widgets that support
* relative sizes and who need some additional sizing logic.
*
*
* @deprecated As of 7.0, serves no purpose. Use {@link LayoutManager} and its
* methods instead.
*/
@@ -31,9 +31,9 @@ public interface ContainerResizedListener {
* function on its ancestors that implement NeedsLayout in case their
* container has resized. runAnchestorsLayout(HasWidgets parent) function
* from Util class may be a good helper for this.
*
*
* @deprecated As of 7.0, this method is never called by the framework.
*
*
*/
@Deprecated
public void iLayout();

+ 28
- 28
client/src/main/java/com/vaadin/client/DateTimeService.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import com.vaadin.shared.ui.datefield.Resolution;
/**
* This class provides date/time parsing services to all components on the
* client side.
*
*
* @author Vaadin Ltd.
*
*
*/
@SuppressWarnings("deprecation")
public class DateTimeService {
@@ -48,7 +48,7 @@ public class DateTimeService {

/**
* Creates a new date time service with a given locale.
*
*
* @param locale
* e.g. fi, en etc.
* @throws LocaleNotLoadedException
@@ -152,8 +152,8 @@ public class DateTimeService {
try {
firstDay = LocaleService.getFirstDayOfWeek(currentLocale);
} catch (final LocaleNotLoadedException e) {
getLogger().log(Level.SEVERE,
"Locale not loaded, using fallback 0", e);
getLogger().log(Level.SEVERE, "Locale not loaded, using fallback 0",
e);
firstDay = 0;
}
int start = dateForFirstOfThisMonth.getDay() - firstDay;
@@ -261,7 +261,7 @@ public class DateTimeService {

/**
* Returns the ISO-8601 week number of the given date.
*
*
* @param date
* The date for which the week number should be resolved
* @return The ISO-8601 week number for {@literal date}
@@ -278,16 +278,16 @@ public class DateTimeService {
// Find nearest thursday (defines the week in ISO 8601). The week number
// for the nearest thursday is the same as for the target date.
int nearestThursdayDiff = 4 - dayOfWeek; // 4 is thursday
Date nearestThursday = new Date(date.getTime() + nearestThursdayDiff
* MILLISECONDS_PER_DAY);
Date nearestThursday = new Date(
date.getTime() + nearestThursdayDiff * MILLISECONDS_PER_DAY);

Date firstOfJanuary = new Date(nearestThursday.getYear(), 0, 1);
long timeDiff = nearestThursday.getTime() - firstOfJanuary.getTime();

// Rounding the result, as the division doesn't result in an integer
// when the given date is inside daylight saving time period.
int daysSinceFirstOfJanuary = (int) Math.round((double) timeDiff
/ MILLISECONDS_PER_DAY);
int daysSinceFirstOfJanuary = (int) Math
.round((double) timeDiff / MILLISECONDS_PER_DAY);

int weekNumber = (daysSinceFirstOfJanuary) / 7 + 1;

@@ -299,11 +299,11 @@ public class DateTimeService {
* it to the month name since DateTimeFormat.format always uses the current
* locale and will replace the month name wrong if current locale is
* different from the locale set for the DateField.
*
*
* MMMM is converted into long month name, MMM is converted into short month
* name. '' are added around the name to avoid that DateTimeFormat parses
* the month name as a pattern.
*
*
* @param date
* The date to convert
* @param formatStr
@@ -343,8 +343,8 @@ public class DateTimeService {
formatStr = formatStr.replaceAll("'([E]{4,})'", dayName);
formatStr = formatStr.replaceAll("([E]{4,})'", "'" + dayName);
formatStr = formatStr.replaceAll("'([E]{4,})", dayName + "'");
formatStr = formatStr
.replaceAll("[E]{4,}", "'" + dayName + "'");
formatStr = formatStr.replaceAll("[E]{4,}",
"'" + dayName + "'");
}
}

@@ -363,8 +363,8 @@ public class DateTimeService {
formatStr = formatStr.replaceAll("'([E]{3,})'", dayName);
formatStr = formatStr.replaceAll("([E]{3,})'", "'" + dayName);
formatStr = formatStr.replaceAll("'([E]{3,})", dayName + "'");
formatStr = formatStr
.replaceAll("[E]{3,}", "'" + dayName + "'");
formatStr = formatStr.replaceAll("[E]{3,}",
"'" + dayName + "'");
}
}

@@ -386,8 +386,8 @@ public class DateTimeService {
formatStr = formatStr.replaceAll("'([M]{4,})'", monthName);
formatStr = formatStr.replaceAll("([M]{4,})'", "'" + monthName);
formatStr = formatStr.replaceAll("'([M]{4,})", monthName + "'");
formatStr = formatStr.replaceAll("[M]{4,}", "'" + monthName
+ "'");
formatStr = formatStr.replaceAll("[M]{4,}",
"'" + monthName + "'");
}
}

@@ -406,8 +406,8 @@ public class DateTimeService {
formatStr = formatStr.replaceAll("'([M]{3,})'", monthName);
formatStr = formatStr.replaceAll("([M]{3,})'", "'" + monthName);
formatStr = formatStr.replaceAll("'([M]{3,})", monthName + "'");
formatStr = formatStr.replaceAll("[M]{3,}", "'" + monthName
+ "'");
formatStr = formatStr.replaceAll("[M]{3,}",
"'" + monthName + "'");
}
}

@@ -417,7 +417,7 @@ public class DateTimeService {
/**
* Replaces month names in the entered date with the name in the current
* browser locale.
*
*
* @param enteredDate
* Date string e.g. "5 May 2010"
* @param formatString
@@ -457,7 +457,7 @@ public class DateTimeService {
/**
* Parses the given date string using the given format string and the locale
* set in this DateTimeService instance.
*
*
* @param dateString
* Date string e.g. "1 February 2010"
* @param formatString
@@ -467,7 +467,7 @@ public class DateTimeService {
* @return A Date object representing the dateString. Never returns null.
* @throws IllegalArgumentException
* if the parsing fails
*
*
*/
public Date parseDate(String dateString, String formatString,
boolean lenient) throws IllegalArgumentException {
@@ -490,8 +490,8 @@ public class DateTimeService {

// Some version of Firefox sets the timestamp to 0 if parsing fails.
if (date != null && date.getTime() == 0) {
throw new IllegalArgumentException("Parsing of '" + dateString
+ "' failed");
throw new IllegalArgumentException(
"Parsing of '" + dateString + "' failed");
}

return date;

+ 2
- 2
client/src/main/java/com/vaadin/client/DeferredWorker.java View File

@@ -20,7 +20,7 @@ package com.vaadin.client;
* there is work scheduled to be executed in the near future and that the
* framework should wait for this work to complete before assuming the UI has
* reached a steady state.
*
*
* @since 7.3
* @author Vaadin Ltd
*/
@@ -28,7 +28,7 @@ public interface DeferredWorker {
/**
* Checks whether there are operations pending for this widget or connector
* that must be executed before reaching a steady state.
*
*
* @returns <code>true</code> iff there are operations pending which must be
* executed before reaching a steady state
*/

+ 3
- 3
client/src/main/java/com/vaadin/client/DirectionalManagedLayout.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 18
- 15
client/src/main/java/com/vaadin/client/EventHelper.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -37,9 +37,9 @@ import com.google.gwt.user.client.ui.Widget;
* registration (possibly the same as given, should be store for next update.
* <p>
* Pseudocode what helpers do:
*
*
* <pre>
*
*
* if paintable has event listener in UIDL
* if registration is null
* register paintable as as handler for event
@@ -48,8 +48,8 @@ import com.google.gwt.user.client.ui.Widget;
* if registration is not null
* remove the handler from paintable
* return null
*
*
*
*
* </pre>
*/
public class EventHelper {
@@ -57,7 +57,7 @@ public class EventHelper {
/**
* Adds or removes a focus handler depending on if the connector has focus
* listeners on the server side or not.
*
*
* @param connector
* The connector to update. Must implement focusHandler.
* @param handlerRegistration
@@ -75,7 +75,7 @@ public class EventHelper {
/**
* Adds or removes a focus handler depending on if the connector has focus
* listeners on the server side or not.
*
*
* @param connector
* The connector to update. Must implement focusHandler.
* @param handlerRegistration
@@ -87,7 +87,8 @@ public class EventHelper {
* handler later
*/
public static <T extends ComponentConnector & FocusHandler> HandlerRegistration updateFocusHandler(
T connector, HandlerRegistration handlerRegistration, Widget widget) {
T connector, HandlerRegistration handlerRegistration,
Widget widget) {
return updateHandler(connector, connector, FOCUS, handlerRegistration,
FocusEvent.getType(), widget);
}
@@ -95,7 +96,7 @@ public class EventHelper {
/**
* Adds or removes a blur handler depending on if the connector has blur
* listeners on the server side or not.
*
*
* @param connector
* The connector to update. Must implement BlurHandler.
* @param handlerRegistration
@@ -113,7 +114,7 @@ public class EventHelper {
/**
* Adds or removes a blur handler depending on if the connector has blur
* listeners on the server side or not.
*
*
* @param connector
* The connector to update. Must implement BlurHandler.
* @param handlerRegistration
@@ -121,19 +122,21 @@ public class EventHelper {
* registered previously
* @param widget
* The widget which emits blur events
*
*
* @return a new registration handler that can be used to unregister the
* handler later
*/
public static <T extends ComponentConnector & BlurHandler> HandlerRegistration updateBlurHandler(
T connector, HandlerRegistration handlerRegistration, Widget widget) {
T connector, HandlerRegistration handlerRegistration,
Widget widget) {
return updateHandler(connector, connector, BLUR, handlerRegistration,
BlurEvent.getType(), widget);
}

public static <H extends EventHandler> HandlerRegistration updateHandler(
ComponentConnector connector, H handler, String eventIdentifier,
HandlerRegistration handlerRegistration, Type<H> type, Widget widget) {
HandlerRegistration handlerRegistration, Type<H> type,
Widget widget) {
if (connector.hasEventListener(eventIdentifier)) {
if (handlerRegistration == null) {
handlerRegistration = widget.addDomHandler(handler, type);

+ 3
- 3
client/src/main/java/com/vaadin/client/FastStringMap.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client/src/main/java/com/vaadin/client/FastStringSet.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client/src/main/java/com/vaadin/client/Focusable.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -19,7 +19,7 @@ package com.vaadin.client;
* GWT's HasFocus is way too overkill for just receiving focus in simple
* components. Vaadin uses this interface in addition to GWT's HasFocus to pass
* focus requests from server to actual ui widgets in browsers.
*
*
* So in to make your server side focusable component receive focus on client
* side it must either implement this or HasFocus interface.
*/

+ 8
- 8
client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,12 +21,12 @@ import com.vaadin.client.ui.layout.ElementResizeListener;
/**
* Connector with layout measuring hint. Used to improve granularity of control
* over child component measurements.
*
*
* @since 7.6
* @author Vaadin Ltd
*/
public interface HasChildMeasurementHintConnector extends
HasComponentsConnector {
public interface HasChildMeasurementHintConnector
extends HasComponentsConnector {

/**
* Specifies how you would like child components measurements to be handled.
@@ -56,7 +56,7 @@ public interface HasChildMeasurementHintConnector extends

/**
* Sets the child measurement hint for this component.
*
*
* @param hint
* the value to set
*/
@@ -64,7 +64,7 @@ public interface HasChildMeasurementHintConnector extends

/**
* Returns the current child measurement hint value.
*
*
* @return a ChildLayoutMeasureMode value
*/
ChildMeasurementHint getChildMeasurementHint();

+ 8
- 8
client/src/main/java/com/vaadin/client/HasComponentsConnector.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,14 +31,14 @@ public interface HasComponentsConnector extends ServerConnector {

/**
* Update child components caption, description and error message.
*
*
* <p>
* Each component is responsible for maintaining its caption, description
* and error message. In most cases components doesn't want to do that and
* those elements reside outside of the component. Because of this layouts
* must provide service for it's childen to show those elements for them.
* </p>
*
*
* @param connector
* Child component for which service is requested.
*/
@@ -53,7 +53,7 @@ public interface HasComponentsConnector extends ServerConnector {
* Note that the method {@link ServerConnector#getChildren()} can return a
* larger list of children including both the child components and any
* extensions registered for the connector.
*
*
* @return A collection of child components for this connector. An empty
* collection if there are no children. Never returns null.
*/
@@ -73,7 +73,7 @@ public interface HasComponentsConnector extends ServerConnector {
* {@link ServerConnector#setChildren(List)} and contains only child
* components. Both methods are called separately by the framework if the
* connector implements {@link HasComponentsConnector}.
*
*
* @param children
* The new child connectors (components only)
*/
@@ -82,7 +82,7 @@ public interface HasComponentsConnector extends ServerConnector {
/**
* Adds a handler that is called whenever the child hierarchy of this
* connector has been updated by the server.
*
*
* @param handler
* The handler that should be added.
* @return A handler registration reference that can be used to unregister

+ 35
- 35
client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -64,8 +64,8 @@ public class JavaScriptConnectorHelper {
/**
* The id of the previous response for which state changes have been
* processed. If this is the same as the
* {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that the
* state change has already been handled and should not be done again.
* {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that
* the state change has already been handled and should not be done again.
*/
private int processedResponseId = -1;

@@ -83,7 +83,7 @@ public class JavaScriptConnectorHelper {
* javascript is usually initalized the first time a state change event is
* received, but it might in some cases be necessary to make this happen
* earlier.
*
*
* @since 7.4.0
*/
public void ensureJavascriptInited() {
@@ -93,7 +93,8 @@ public class JavaScriptConnectorHelper {
}

private void processStateChanges() {
int lastResponseId = connector.getConnection().getLastSeenServerSyncId();
int lastResponseId = connector.getConnection()
.getLastSeenServerSyncId();
if (processedResponseId == lastResponseId) {
return;
}
@@ -140,7 +141,8 @@ public class JavaScriptConnectorHelper {
return rpcName.replace('$', '.');
}

protected JavaScriptObject createRpcObject(String iface, Set<String> methods) {
protected JavaScriptObject createRpcObject(String iface,
Set<String> methods) {
JavaScriptObject object = JavaScriptObject.createObject();

for (String method : methods) {
@@ -157,19 +159,16 @@ public class JavaScriptConnectorHelper {
Integer tag = Integer.valueOf(this.tag);
while (tag != null) {
String serverSideClassName = conf.getServerSideClassNameForTag(tag);
String initFunctionName = serverSideClassName
.replaceAll("\\.", "_");
String initFunctionName = serverSideClassName.replaceAll("\\.",
"_");
if (tryInitJs(initFunctionName, getConnectorWrapper())) {
getLogger().info(
"JavaScript connector initialized using "
+ initFunctionName);
getLogger().info("JavaScript connector initialized using "
+ initFunctionName);
this.initFunctionName = initFunctionName;
return true;
} else {
getLogger()
.warning(
"No JavaScript function " + initFunctionName
+ " found");
getLogger().warning("No JavaScript function " + initFunctionName
+ " found");
attemptedNames.add(initFunctionName);
tag = conf.getParentTag(tag.intValue());
}
@@ -267,8 +266,8 @@ public class JavaScriptConnectorHelper {

ElementResizeListener listener = elementListeners.get(callbackFunction);
if (listener == null) {
LayoutManager layoutManager = LayoutManager.get(connector
.getConnection());
LayoutManager layoutManager = LayoutManager
.get(connector.getConnection());
listener = new ElementResizeListener() {
@Override
public void onElementResize(ElementResizeEvent e) {
@@ -343,8 +342,8 @@ public class JavaScriptConnectorHelper {
return connector;
}

return ConnectorMap.get(connector.getConnection()).getConnector(
connectorId);
return ConnectorMap.get(connector.getConnection())
.getConnector(connectorId);
}

private void fireRpc(String iface, String method,
@@ -378,16 +377,15 @@ public class JavaScriptConnectorHelper {
interfaceList += getJsInterfaceName(iface);
}

throw new IllegalStateException(
"Can not call method "
+ method
+ " for wildcard rpc proxy because the function is defined for multiple rpc interfaces: "
+ interfaceList
+ ". Retrieve a rpc proxy for a specific interface using getRpcProxy(interfaceName) to use the function.");
throw new IllegalStateException("Can not call method " + method
+ " for wildcard rpc proxy because the function is defined for multiple rpc interfaces: "
+ interfaceList
+ ". Retrieve a rpc proxy for a specific interface using getRpcProxy(interfaceName) to use the function.");
}
}

private void fireCallback(String name, JsArray<JavaScriptObject> arguments) {
private void fireCallback(String name,
JsArray<JavaScriptObject> arguments) {
MethodInvocation invocation = new JavaScriptMethodInvocation(
connector.getConnectorId(),
"com.vaadin.ui.JavaScript$JavaScriptCallbackRpc", "call",
@@ -410,7 +408,7 @@ public class JavaScriptConnectorHelper {
delete state[key];
}
}
for(var key in input) {
if (input.hasOwnProperty(key)) {
state[key] = input[key];
@@ -450,7 +448,8 @@ public class JavaScriptConnectorHelper {
}-*/;

private static native void invokeJsRpc(JavaScriptObject rpcMap,
String interfaceName, String methodName, JavaScriptObject parameters)
String interfaceName, String methodName,
JavaScriptObject parameters)
/*-{
var targets = rpcMap[interfaceName];
if (!targets) {
@@ -479,14 +478,15 @@ public class JavaScriptConnectorHelper {
invokeIfPresent(connectorWrapper, "onUnregister");

if (!resizeListeners.isEmpty()) {
LayoutManager layoutManager = LayoutManager.get(connector
.getConnection());
LayoutManager layoutManager = LayoutManager
.get(connector.getConnection());
for (Entry<Element, Map<JavaScriptObject, ElementResizeListener>> entry : resizeListeners
.entrySet()) {
Element element = entry.getKey();
for (ElementResizeListener listener : entry.getValue().values()) {
layoutManager
.removeElementResizeListener(element, listener);
for (ElementResizeListener listener : entry.getValue()
.values()) {
layoutManager.removeElementResizeListener(element,
listener);
}
}
resizeListeners.clear();

+ 3
- 3
client/src/main/java/com/vaadin/client/JavaScriptExtension.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client/src/main/java/com/vaadin/client/JsArrayObject.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 192
- 171
client/src/main/java/com/vaadin/client/LayoutManager.java
File diff suppressed because it is too large
View File


+ 5
- 5
client/src/main/java/com/vaadin/client/LayoutManagerIE8.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,10 +29,10 @@ import com.google.gwt.user.client.ui.RootPanel;
* element in IE8 seems to make the browser think the element has changed in a
* way that requires a reflow. To work around that, the MeasureData is instead
* stored in Map for IE8.
*
*
* This implementation is injected for IE8 by a replace-with definition in the
* GWT module.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*/

+ 3
- 3
client/src/main/java/com/vaadin/client/LocaleNotLoadedException.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
client/src/main/java/com/vaadin/client/LocaleService.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import com.vaadin.shared.ui.ui.UIState.LocaleData;
/**
* Date / time etc. localisation service for all widgets. Caches all loaded
* locales as JSONObjects.
*
*
* @author Vaadin Ltd.
*
*
*/
public class LocaleService {


+ 7
- 7
client/src/main/java/com/vaadin/client/MeasuredSize.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -205,7 +205,8 @@ public class MeasuredSize {
heightChanged = true;
}
if (!widthChanged && hasWidthChanged(this.paddings, paddings)) {
debugSizeChange(element, "Width (padding)", this.paddings, paddings);
debugSizeChange(element, "Width (padding)", this.paddings,
paddings);
widthChanged = true;
}
this.paddings = paddings;
@@ -278,9 +279,8 @@ public class MeasuredSize {
private void debugSizeChange(Element element, String sizeChangeType,
String changedFrom, String changedTo) {
if (debugSizeChanges) {
getLogger()
.info(sizeChangeType + " has changed from " + changedFrom
+ " to " + changedTo + " for " + element.toString());
getLogger().info(sizeChangeType + " has changed from " + changedFrom
+ " to " + changedTo + " for " + element.toString());
}
}


+ 7
- 7
client/src/main/java/com/vaadin/client/MouseEventDetailsBuilder.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -24,16 +24,16 @@ import com.vaadin.shared.MouseEventDetails.MouseButton;
/**
* Helper class for constructing a MouseEventDetails object from a
* {@link NativeEvent}.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*
*
*/
public class MouseEventDetailsBuilder {

/**
* Construct a {@link MouseEventDetails} object from the given event
*
*
* @param evt
* The event to use as a source for the details
* @return a MouseEventDetails containing information from the event
@@ -44,7 +44,7 @@ public class MouseEventDetailsBuilder {

/**
* Construct a {@link MouseEventDetails} object from the given event
*
*
* @param evt
* The event to use as a source for the details
* @param relativeToElement

+ 4
- 4
client/src/main/java/com/vaadin/client/Paintable.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ package com.vaadin.client;
* An interface used by client-side widgets or paintable parts to receive
* updates from the corresponding server-side components in the form of
* {@link UIDL}.
*
*
* Updates can be sent back to the server using the
* {@link ApplicationConnection#updateVariable()} methods.
*/

+ 35
- 38
client/src/main/java/com/vaadin/client/Profiler.java View File

@@ -69,7 +69,7 @@ public class Profiler {
* Interface for getting data from the {@link Profiler}.
* <p>
* <b>Warning!</b> This interface is most likely to change in the future
*
*
* @since 7.1
* @author Vaadin Ltd
*/
@@ -98,7 +98,7 @@ public class Profiler {

/**
* Create a new node with the given name.
*
*
* @param name
*/
public Node(String name) {
@@ -107,7 +107,7 @@ public class Profiler {

/**
* Gets the name of the node
*
*
* @return the name of the node
*/
public String getName() {
@@ -117,7 +117,7 @@ public class Profiler {
/**
* Creates a new child node or retrieves and existing child and updates
* its total time and hit count.
*
*
* @param name
* the name of the child
* @param timestamp
@@ -138,7 +138,7 @@ public class Profiler {
/**
* Gets the total time spent in this node, including time spent in sub
* nodes
*
*
* @return the total time spent, in milliseconds
*/
public double getTimeSpent() {
@@ -148,7 +148,7 @@ public class Profiler {
/**
* Gets the minimum time spent for one invocation of this node,
* including time spent in sub nodes
*
*
* @return the time spent for the fastest invocation, in milliseconds
*/
public double getMinTimeSpent() {
@@ -158,7 +158,7 @@ public class Profiler {
/**
* Gets the maximum time spent for one invocation of this node,
* including time spent in sub nodes
*
*
* @return the time spent for the slowest invocation, in milliseconds
*/
public double getMaxTimeSpent() {
@@ -167,7 +167,7 @@ public class Profiler {

/**
* Gets the number of times this node has been entered
*
*
* @return the number of times the node has been entered
*/
public int getCount() {
@@ -177,7 +177,7 @@ public class Profiler {
/**
* Gets the total time spent in this node, excluding time spent in sub
* nodes
*
*
* @return the total time spent, in milliseconds
*/
public double getOwnTime() {
@@ -190,14 +190,15 @@ public class Profiler {

/**
* Gets the child nodes of this node
*
*
* @return a collection of child nodes
*/
public Collection<Node> getChildren() {
return Collections.unmodifiableCollection(children.values());
}

private void buildRecursiveString(StringBuilder builder, String prefix) {
private void buildRecursiveString(StringBuilder builder,
String prefix) {
if (getName() != null) {
String msg = getStringRepresentation(prefix);
builder.append(msg + '\n');
@@ -220,9 +221,7 @@ public class Profiler {
String msg = prefix + " " + getName() + " in "
+ roundToSignificantFigures(getTimeSpent()) + " ms.";
if (getCount() > 1) {
msg += " Invoked "
+ getCount()
+ " times ("
msg += " Invoked " + getCount() + " times ("
+ roundToSignificantFigures(getTimeSpent() / getCount())
+ " ms per time, min "
+ roundToSignificantFigures(getMinTimeSpent())
@@ -270,10 +269,10 @@ public class Profiler {

totalNode.time += getOwnTime();
totalNode.count += getCount();
totalNode.minTime = roundToSignificantFigures(Math.min(
totalNode.minTime, getMinTimeSpent()));
totalNode.maxTime = roundToSignificantFigures(Math.max(
totalNode.maxTime, getMaxTimeSpent()));
totalNode.minTime = roundToSignificantFigures(
Math.min(totalNode.minTime, getMinTimeSpent()));
totalNode.maxTime = roundToSignificantFigures(
Math.max(totalNode.maxTime, getMaxTimeSpent()));
}
for (Node node : children.values()) {
node.sumUpTotals(totals);
@@ -390,7 +389,7 @@ public class Profiler {
* Returns time relative to the particular page load time. The value should
* not be used directly but rather difference between two values returned by
* this method should be used to compare measurements.
*
*
* @since 7.6
*/
public static double getRelativeTimeMillis() {
@@ -468,9 +467,8 @@ public class Profiler {
stack.add(rootNode);
JsArray<GwtStatsEvent> gwtStatsEvents = getGwtStatsEvents();
if (gwtStatsEvents.length() == 0) {
getLogger()
.warning(
"No profiling events recorded, this might happen if another __gwtStatsEvent handler is installed.");
getLogger().warning(
"No profiling events recorded, this might happen if another __gwtStatsEvent handler is installed.");
return;
}

@@ -503,10 +501,8 @@ public class Profiler {

if (type.equals("end")) {
if (!inEvent) {
getLogger().severe(
"Got end event for " + eventName
+ " but is currently in "
+ stackTop.getName());
getLogger().severe("Got end event for " + eventName
+ " but is currently in " + stackTop.getName());
return;
}
Node previousStackTop = stack.removeLast();
@@ -516,8 +512,9 @@ public class Profiler {
previousStackTop.leave(gwtStatsEvent.getMillis());
}
} else {
double millis = isExtendedEvent ? gwtStatsEvent
.getRelativeMillis() : gwtStatsEvent.getMillis();
double millis = isExtendedEvent
? gwtStatsEvent.getRelativeMillis()
: gwtStatsEvent.getMillis();
if (!inEvent) {
stackTop = stackTop.enterChild(eventName, millis);
stack.add(stackTop);
@@ -538,9 +535,8 @@ public class Profiler {
}

if (stack.size() != 1) {
getLogger().warning(
"Not all nodes are left, the last node is "
+ stack.getLast().getName());
getLogger().warning("Not all nodes are left, the last node is "
+ stack.getLast().getName());
return;
}

@@ -600,8 +596,8 @@ public class Profiler {
}

if (timings.isEmpty()) {
getLogger()
.info("Bootstrap timings not supported, please ensure your browser supports performance.timing");
getLogger().info(
"Bootstrap timings not supported, please ensure your browser supports performance.timing");
return;
}

@@ -675,7 +671,8 @@ public class Profiler {
public static void setProfilerResultConsumer(
ProfilerResultConsumer profilerResultConsumer) {
if (consumer != null) {
throw new IllegalStateException("The consumer has already been set");
throw new IllegalStateException(
"The consumer has already been set");
}
consumer = profilerResultConsumer;
}
@@ -697,8 +694,8 @@ public class Profiler {
double getRelativeTime();
}

private static class DefaultRelativeTimeSupplier implements
RelativeTimeSupplier {
private static class DefaultRelativeTimeSupplier
implements RelativeTimeSupplier {

@Override
public native double getRelativeTime()
@@ -707,8 +704,8 @@ public class Profiler {
}-*/;
}

private static class HighResolutionTimeSupplier implements
RelativeTimeSupplier {
private static class HighResolutionTimeSupplier
implements RelativeTimeSupplier {

@Override
public native double getRelativeTime()

+ 10
- 10
client/src/main/java/com/vaadin/client/RenderInformation.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,9 +20,9 @@ import com.google.gwt.user.client.DOM;

/**
* Contains size information about a rendered container and its content area.
*
*
* @author Artur Signell
*
*
*/
public class RenderInformation {

@@ -48,9 +48,9 @@ public class RenderInformation {

/**
* Update the size of the widget.
*
*
* @param widget
*
*
* @return true if the size has changed since last update
* @deprecated As of 7.2, call and override {@link #updateSize(Element)}
* instead
@@ -69,11 +69,11 @@ public class RenderInformation {

/**
* Update the size of the widget.
*
*
* @param widget
*
*
* @return true if the size has changed since last update
*
*
* @since 7.2
*/
public boolean updateSize(Element element) {

+ 3
- 3
client/src/main/java/com/vaadin/client/RenderSpace.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 24
- 24
client/src/main/java/com/vaadin/client/ResourceLoader.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -37,11 +37,11 @@ import com.google.gwt.user.client.Timer;
/**
* ResourceLoader lets you dynamically include external scripts and styles on
* the page and lets you know when the resource has been loaded.
*
*
* You can also preload resources, allowing them to get cached by the browser
* without being evaluated. This enables downloading multiple resources at once
* while still controlling in which order e.g. scripts are executed.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*/
@@ -56,7 +56,7 @@ public class ResourceLoader {

/**
* Creates a new event.
*
*
* @param loader
* the resource loader that has loaded the resource
* @param resourceUrl
@@ -74,7 +74,7 @@ public class ResourceLoader {

/**
* Gets the resource loader that has fired this event
*
*
* @return the resource loader
*/
public ResourceLoader getResourceLoader() {
@@ -83,7 +83,7 @@ public class ResourceLoader {

/**
* Gets the absolute url of the loaded resource.
*
*
* @return the absolute url of the loaded resource
*/
public String getResourceUrl() {
@@ -93,9 +93,9 @@ public class ResourceLoader {
/**
* Returns true if the resource has been preloaded, false if it's fully
* loaded
*
*
* @see ResourceLoader#preloadResource(String, ResourceLoadListener)
*
*
* @return true if the resource has been preloaded, false if it's fully
* loaded
*/
@@ -112,9 +112,9 @@ public class ResourceLoader {
* Notifies this ResourceLoadListener that a resource has been loaded.
* Some browsers do not support any way of detecting load errors. In
* these cases, onLoad will be called regardless of the status.
*
*
* @see ResourceLoadEvent
*
*
* @param event
* a resource load event with information about the loaded
* resource
@@ -127,9 +127,9 @@ public class ResourceLoader {
* server did not respond. Some browsers do not support any way of
* detecting load errors. In these cases, onLoad will be called
* regardless of the status.
*
*
* @see ResourceLoadEvent
*
*
* @param event
* a resource load event with information about the resource
* that could not be loaded.
@@ -183,7 +183,7 @@ public class ResourceLoader {

/**
* Returns the default ResourceLoader
*
*
* @return the default ResourceLoader
*/
public static ResourceLoader get() {
@@ -195,8 +195,8 @@ public class ResourceLoader {
* this method when the script is currently loading or already loaded
* doesn't cause the script to be loaded again, but the listener will still
* be notified when appropriate.
*
*
*
*
* @param scriptUrl
* the url of the script to load
* @param resourceLoadListener
@@ -213,8 +213,8 @@ public class ResourceLoader {
* this method when the script is currently loading or already loaded
* doesn't cause the script to be loaded again, but the listener will still
* be notified when appropriate.
*
*
*
*
* @param scriptUrl
* url of script to load
* @param resourceLoadListener
@@ -278,7 +278,7 @@ public class ResourceLoader {
/**
* The current browser supports script.async='false' for maintaining
* execution order for dynamically-added scripts.
*
*
* @return Browser supports script.async='false'
* @since 7.2.4
*/
@@ -292,12 +292,12 @@ public class ResourceLoader {
* preloaded, it will be present in the browser's cache (provided the HTTP
* headers allow caching), making a subsequent load operation complete
* without having to wait for the resource to be downloaded again.
*
*
* Calling this method when the resource is currently loading, currently
* preloading, already preloaded or already loaded doesn't cause the
* resource to be preloaded again, but the listener will still be notified
* when appropriate.
*
*
* @param url
* the url of the resource to preload
* @param resourceLoadListener
@@ -378,7 +378,7 @@ public class ResourceLoader {
* Adds an onload listener to the given element, which should be a link or a
* script tag. The listener is called whenever loading is complete or an
* error occurred.
*
*
* @since 7.3
* @param element
* the element to attach a listener to
@@ -414,7 +414,7 @@ public class ResourceLoader {
* Calling this method when the stylesheet is currently loading or already
* loaded doesn't cause the stylesheet to be loaded again, but the listener
* will still be notified when appropriate.
*
*
* @param stylesheetUrl
* the url of the stylesheet to load
* @param resourceLoadListener

+ 23
- 22
client/src/main/java/com/vaadin/client/ServerConnector.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import com.vaadin.shared.communication.SharedState;
* Interface implemented by all client side classes that can be communicate with
* the server. Classes implementing this interface are initialized by the
* framework when needed and have the ability to communicate with the server.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*/
@@ -37,7 +37,7 @@ public interface ServerConnector extends Connector {

/**
* Gets ApplicationConnection instance that created this connector.
*
*
* @return The ApplicationConnection as set by
* {@link #doInit(String, ApplicationConnection)}
*/
@@ -47,13 +47,13 @@ public interface ServerConnector extends Connector {
* Tests whether the connector is enabled or not. This method checks that
* the connector is enabled in context, i.e. if the parent connector is
* disabled, this method must return false.
*
*
* @return true if the connector is enabled, false otherwise
*/
public boolean isEnabled();

/**
*
*
* Called once by the framework to initialize the connector.
* <p>
* Note that the shared state is not yet available at this point nor any
@@ -64,9 +64,9 @@ public interface ServerConnector extends Connector {
/**
* For internal use by the framework: returns the registered RPC
* implementations for an RPC interface identifier.
*
*
* TODO interface identifier type or format may change
*
*
* @param rpcInterfaceId
* RPC interface identifier: fully qualified interface type name
* @return RPC interface implementations registered for an RPC interface,
@@ -78,18 +78,19 @@ public interface ServerConnector extends Connector {
/**
* Adds a handler that is called whenever any part of the state has been
* updated by the server.
*
*
* @param handler
* The handler that should be added.
* @return A handler registration reference that can be used to unregister
* the handler
*/
public HandlerRegistration addStateChangeHandler(StateChangeHandler handler);
public HandlerRegistration addStateChangeHandler(
StateChangeHandler handler);

/**
* Removes a handler that is called whenever any part of the state has been
* updated by the server.
*
*
* @param handler
* The handler that should be removed.
*/
@@ -98,7 +99,7 @@ public interface ServerConnector extends Connector {
/**
* Adds a handler that is called whenever the given part of the state has
* been updated by the server.
*
*
* @param propertyName
* the name of the property for which the handler should be
* called
@@ -113,7 +114,7 @@ public interface ServerConnector extends Connector {
/**
* Removes a handler that is called whenever any part of the state has been
* updated by the server.
*
*
* @param propertyName
* the name of the property for which the handler should be
* called
@@ -125,7 +126,7 @@ public interface ServerConnector extends Connector {

/**
* Sends the given event to all registered handlers.
*
*
* @param event
* The event to send.
*/
@@ -139,7 +140,7 @@ public interface ServerConnector extends Connector {
/**
* Returns the parent of this connector. Can be null for only the root
* connector.
*
*
* @return The parent of this connector, as set by
* {@link #setParent(ServerConnector)}.
*/
@@ -154,7 +155,7 @@ public interface ServerConnector extends Connector {
* Note that calling this method does not fire a
* {@link ConnectorHierarchyChangeEvent}. The event is fired only when the
* whole hierarchy has been updated.
*
*
* @param parent
* The new parent of the connector
*/
@@ -171,7 +172,7 @@ public interface ServerConnector extends Connector {
* {@link HasComponentsConnector#setChildComponents(List)} and takes both
* extensions and child components. Both methods are called separately by
* the framework if the connector can have child components.
*
*
* @param children
* The new child connectors (extensions and/or components)
*/
@@ -184,7 +185,7 @@ public interface ServerConnector extends Connector {
* Note that the method {@link HasComponentsConnector#getChildComponents()}
* can be used to obtain the subset of child connectors that correspond to
* components and not extensions.
*
*
* @return A collection of child connectors (components or extensions) for
* this connector. An empty collection if there are no children.
* Never returns null.
@@ -193,12 +194,12 @@ public interface ServerConnector extends Connector {

/**
* Gets the current shared state of the connector.
*
*
* Note that state is considered an internal part of the connector. You
* should not rely on the state object outside of the connector who owns it.
* If you depend on the state of other connectors you should use their
* public API instead of their state object directly.
*
*
* @since 7.0.
* @return state The shared state object. Can be any sub type of
* {@link SharedState}. Never null.
@@ -208,7 +209,7 @@ public interface ServerConnector extends Connector {
/**
* Checks if an event listener has been registered on the server side for
* the given event identifier.
*
*
* @param eventIdentifier
* The identifier for the event
* @return true if a listener has been registered on the server side, false

+ 16
- 13
client/src/main/java/com/vaadin/client/SimpleTree.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -38,7 +38,7 @@ import com.google.gwt.user.client.ui.Widget;

/**
* @author Vaadin Ltd
*
*
* @deprecated as of 7.1. This class was mainly used by the old debug console
* but is retained for now for backwards compatibility.
*/
@@ -81,14 +81,15 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers {
@Override
public void onClick(ClickEvent event) {
if (event.getNativeEvent().getEventTarget().cast() == handle) {
if (children.getStyle().getDisplay().intern() == Display.NONE
.getCssName()) {
if (children.getStyle().getDisplay()
.intern() == Display.NONE.getCssName()) {
open(event.getNativeEvent().getAltKey());
} else {
close();
}

} else if (event.getNativeEvent().getEventTarget().cast() == text) {
} else if (event.getNativeEvent().getEventTarget()
.cast() == text) {
select(event);
}
}
@@ -146,7 +147,7 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers {

/**
* {@inheritDoc}
*
*
* @deprecated As of 7.2, call and override {@link #add(Widget, Element)}
* instead.
*/
@@ -161,7 +162,7 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers {

/**
* {@inheritDoc}
*
*
* @since 7.2
*/
@Override
@@ -173,20 +174,22 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers {
* {@inheritDoc} Events are not fired when double clicking child widgets.
*/
@Override
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
public HandlerRegistration addDoubleClickHandler(
DoubleClickHandler handler) {
if (textDoubleClickHandlerManager == null) {
textDoubleClickHandlerManager = new HandlerManager(this);
addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
if (event.getNativeEvent().getEventTarget().cast() == text) {
if (event.getNativeEvent().getEventTarget()
.cast() == text) {
textDoubleClickHandlerManager.fireEvent(event);
}
}
}, DoubleClickEvent.getType());
}
return textDoubleClickHandlerManager.addHandler(
DoubleClickEvent.getType(), handler);
return textDoubleClickHandlerManager
.addHandler(DoubleClickEvent.getType(), handler);
}

}

+ 3
- 3
client/src/main/java/com/vaadin/client/StyleConstants.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
- 22
client/src/main/java/com/vaadin/client/SuperDevMode.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -30,10 +30,10 @@ import com.vaadin.client.ui.VNotification.HideEvent;

/**
* Class that enables SuperDevMode using a ?superdevmode parameter in the url.
*
*
* @author Vaadin Ltd
* @since 7.0
*
*
*/
public class SuperDevMode {

@@ -53,9 +53,8 @@ public class SuperDevMode {

private static void recompileWidgetsetAndStartInDevMode(
final String serverUrl) {
getLogger().info(
"Recompiling widgetset using<br/>" + serverUrl
+ "<br/>and then reloading in super dev mode");
getLogger().info("Recompiling widgetset using<br/>" + serverUrl
+ "<br/>and then reloading in super dev mode");
VNotification n = new VNotification();
n.show("<b>Recompiling widgetset, please wait</b>",
VNotification.CENTERED, VNotification.STYLE_SYSTEM);
@@ -63,8 +62,9 @@ public class SuperDevMode {
JsonpRequestBuilder b = new JsonpRequestBuilder();
b.setCallbackParam("_callback");
b.setTimeout(COMPILE_TIMEOUT_IN_SECONDS * 1000);
b.requestObject(serverUrl + "recompile/" + GWT.getModuleName() + "?"
+ getRecompileParameters(GWT.getModuleName()),
b.requestObject(
serverUrl + "recompile/" + GWT.getModuleName() + "?"
+ getRecompileParameters(GWT.getModuleName()),
new AsyncCallback<RecompileResult>() {

@Override
@@ -77,8 +77,7 @@ public class SuperDevMode {
return;
}

setSession(
getSuperDevModeHookKey(),
setSession(getSuperDevModeHookKey(),
getSuperDevWidgetSetUrl(GWT.getModuleName(),
serverUrl));
setSession(SKIP_RECOMPILE, "1");
@@ -92,9 +91,8 @@ public class SuperDevMode {
getLogger().severe("JSONP compile call failed");
// Don't log exception as they are shown as
// notifications
getLogger().severe(
caught.getClass().getSimpleName() + ": "
+ caught.getMessage());
getLogger().severe(caught.getClass().getSimpleName()
+ ": " + caught.getMessage());
failed();

}
@@ -127,13 +125,13 @@ public class SuperDevMode {
private native static String getRecompileParameters(String moduleName)
/*-{
var prop_map = $wnd.__gwt_activeModules[moduleName].bindings();
// convert map to URL parameter string
var props = [];
for (var key in prop_map) {
props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key]))
}
return props.join('&') + '&';
}-*/;

@@ -179,7 +177,7 @@ public class SuperDevMode {
/**
* The URL of the code server. The default URL (http://localhost:9876/) will
* be used if this is empty or null.
*
*
* @param serverUrl
* The url of the code server or null to use the default
* @return true if recompile started, false if we are running in
@@ -243,7 +241,7 @@ public class SuperDevMode {
* method returns true. The application will be restarted once compilation
* is done and then this method will return false.
* </p>
*
*
* @return true if a recompile operation has started and the page will be
* reloaded once it is done, false if no recompilation will be done.
*/
@@ -254,9 +252,10 @@ public class SuperDevMode {
// in super dev mode, as a result of the recompile, the enabled
// check will fail...
if (!isSuperDevModeEnabledInModule()) {
showError("SuperDevMode is disabled for this module/widgetset.<br/>"
+ "Ensure that your module definition (.gwt.xml) does not contain <br/>"
+ "&lt;set-configuration-property name=&quot;devModeRedirectEnabled&quot; value=&quot;false&quot; /&gt;<br/>");
showError(
"SuperDevMode is disabled for this module/widgetset.<br/>"
+ "Ensure that your module definition (.gwt.xml) does not contain <br/>"
+ "&lt;set-configuration-property name=&quot;devModeRedirectEnabled&quot; value=&quot;false&quot; /&gt;<br/>");
return false;
}
return SuperDevMode.recompileIfNeeded(superDevModeParameter);

+ 6
- 5
client/src/main/java/com/vaadin/client/TooltipInfo.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -71,7 +71,7 @@ public class TooltipInfo {

/**
* Checks is a message has been defined for the tooltip.
*
*
* @return true if title or error message is present, false if both are
* empty
*/
@@ -82,6 +82,7 @@ public class TooltipInfo {

public boolean equals(TooltipInfo other) {
return (other != null && SharedUtil.equals(other.title, title)
&& SharedUtil.equals(other.errorMessageHtml, errorMessageHtml) && other.identifier == identifier);
&& SharedUtil.equals(other.errorMessageHtml, errorMessageHtml)
&& other.identifier == identifier);
}
}

+ 41
- 42
client/src/main/java/com/vaadin/client/UIDL.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -52,7 +52,7 @@ public final class UIDL extends JavaScriptObject {
* Shorthand for getting the attribute named "id", which for Paintables is
* the essential paintableId which binds the server side component to the
* client side widget.
*
*
* @return the value of the id attribute, if available
*/
public String getId() {
@@ -69,7 +69,7 @@ public final class UIDL extends JavaScriptObject {
* internally and is not needed within
* {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection)
* updateFromUIDL()}.
*
*
* @return the name for this section
*/
public native String getTag()
@@ -94,7 +94,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a String.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -105,7 +105,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the names of the attributes available.
*
*
* @return the names of available attributes
*/
public Set<String> getAttributeNames() {
@@ -116,7 +116,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the names of variables available.
*
*
* @return the names of available variables
*/
public Set<String> getVariableNames() {
@@ -130,7 +130,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as an int.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -141,7 +141,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a long.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -152,7 +152,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a float.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -163,7 +163,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a double.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -174,7 +174,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a boolean.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -185,7 +185,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as a Map of named values (key/value pairs).
*
*
* @param name
* the name of the attribute to get
* @return the attribute Map
@@ -196,7 +196,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as an array of Strings.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -207,7 +207,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the named attribute as an int array.
*
*
* @param name
* the name of the attribute to get
* @return the attribute value
@@ -218,7 +218,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Get attributes value as string whatever the type is
*
*
* @param name
* @return string presentation of attribute
*/
@@ -234,7 +234,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Indicates whether or not the named attribute is available.
*
*
* @param name
* the name of the attribute to check
* @return true if the attribute is available, false otherwise
@@ -245,7 +245,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the UIDL for the child at the given index.
*
*
* @param i
* the index of the child to get
* @return the UIDL of the child if it exists
@@ -257,7 +257,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the child at the given index as a String.
*
*
* @param i
* the index of the child to get
* @return the String representation of the child if it exists
@@ -286,7 +286,7 @@ public final class UIDL extends JavaScriptObject {
* if <code>getTag()</code> returns "color", one would update the widgets
* color to reflect the value of the "color" section.
* </p>
*
*
* @return an iterator for iterating over UIDL children
*/
public Iterator<Object> getChildIterator() {
@@ -314,9 +314,8 @@ public final class UIDL extends JavaScriptObject {
case CHILD_TYPE_XML:
return getChildXML(index);
default:
throw new IllegalStateException(
"Illegal child in tag " + getTag()
+ " at index " + index);
throw new IllegalStateException("Illegal child in tag "
+ getTag() + " at index " + index);
}
}
return null;
@@ -360,7 +359,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Checks if the named variable is available.
*
*
* @param name
* the name of the variable desired
* @return true if the variable exists, false otherwise
@@ -371,7 +370,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -382,7 +381,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -393,7 +392,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -404,7 +403,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -415,7 +414,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -426,7 +425,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -437,7 +436,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -448,7 +447,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named String[] variable as a Set of Strings.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -464,7 +463,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the value of the named variable.
*
*
* @param name
* the name of the variable
* @return the value of the variable
@@ -500,7 +499,7 @@ public final class UIDL extends JavaScriptObject {

/**
* Returns the number of children.
*
*
* @return the number of children
*/
public native int getChildCount()
@@ -515,34 +514,34 @@ public final class UIDL extends JavaScriptObject {

/**
* Gets the Paintable with the id found in the named attributes's value.
*
*
* @param name
* the name of the attribute
* @return the Paintable referenced by the attribute, if it exists
*/
public ServerConnector getPaintableAttribute(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringAttribute(name));
return ConnectorMap.get(connection)
.getConnector(getStringAttribute(name));
}

/**
* Gets the Paintable with the id found in the named variable's value.
*
*
* @param name
* the name of the variable
* @return the Paintable referenced by the variable, if it exists
*/
public ServerConnector getPaintableVariable(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringVariable(name));
return ConnectorMap.get(connection)
.getConnector(getStringVariable(name));
}

/**
* Returns the child UIDL by its name. If several child nodes exist with the
* given name, the first child UIDL will be returned.
*
*
* @param tagName
* @return the child UIDL or null if child wit given name was not found
*/

+ 112
- 107
client/src/main/java/com/vaadin/client/Util.java View File

@@ -52,9 +52,9 @@ public class Util {

/**
* Helper method for debugging purposes.
*
*
* Stops execution on firefox browsers on a breakpoint.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#browserDebugger()}
* instead.
*/
@@ -67,10 +67,10 @@ public class Util {
* Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for
* space bar (because space is considered as char). If return 0 use
* getCharCode.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#getKeyCode(KeyEvent)}
* instead.
*
*
* @param event
* @return return key code
* @since 7.2.4
@@ -81,15 +81,15 @@ public class Util {
}

/**
*
*
* Returns the topmost element of from given coordinates.
*
*
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical
* for vaadin as we scroll div istead of page.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getElementFromPoint(int, int)} instead.
*
*
* @param x
* @param y
* @return the element at given coordinates
@@ -104,18 +104,18 @@ public class Util {
* This helper method can be called if components size have been changed
* outside rendering phase. It notifies components parent about the size
* change so it can react.
*
*
* When using this method, developer should consider if size changes could
* be notified lazily. If lazy flag is true, method will save widget and
* wait for a moment until it notifies parents in chunks. This may vastly
* optimize layout in various situation. Example: if component have a lot of
* images their onload events may fire "layout phase" many times in a short
* period.
*
*
* @param widget
* @param lazy
* run componentSizeUpdated lazyly
*
*
* @deprecated As of 7.0, use
* {@link LayoutManager#setNeedsMeasure(ComponentConnector)}
* instead
@@ -159,10 +159,10 @@ public class Util {

/**
* Converts html entities to text.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeHTML(String)}
* instead.
*
*
* @param html
* @return escaped string presentation of given html
*/
@@ -173,10 +173,10 @@ public class Util {

/**
* Escapes the string so it is safe to write inside an HTML attribute.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeAttribute(String)}
* instead.
*
*
* @param attribute
* The string to escape
* @return An escaped version of <literal>attribute</literal>.
@@ -188,12 +188,12 @@ public class Util {

/**
* Clones given element as in JavaScript.
*
*
* Deprecate this if there appears similar method into GWT someday.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#cloneNode(Element, boolean)} instead.
*
*
* @param element
* @param deep
* clone child tree also
@@ -225,8 +225,8 @@ public class Util {
@Deprecated
public static int measureVerticalPaddingAndBorder(Element element,
int paddingGuess) {
return WidgetUtil
.measureVerticalPaddingAndBorder(element, paddingGuess);
return WidgetUtil.measureVerticalPaddingAndBorder(element,
paddingGuess);
}

/**
@@ -341,11 +341,11 @@ public class Util {

/**
* Defers the execution of {@link #runWebkitOverflowAutoFix(Element)}
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#runWebkitOverflowAutoFixDeferred(Element)}
* instead.
*
*
* @since 7.2.6
* @param elem
* with overflow auto
@@ -357,12 +357,12 @@ public class Util {

/**
* Run workaround for webkits overflow auto issue.
*
*
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#runWebkitOverflowAutoFix(Element)} instead.
*
*
* @param elem
* with overflow auto
*/
@@ -376,7 +376,7 @@ public class Util {
* dimension is not specified as relative it will return -1. If the shared
* state does not contain width or height specifications this will return
* null.
*
*
* @param state
* @return
*/
@@ -411,7 +411,7 @@ public class Util {
* Checks if a and b are equals using {@link #equals(Object)}. Handles null
* values as well. Does not ensure that objects are of the same type.
* Assumes that the first object's equals method handle equals properly.
*
*
* @param a
* The first value to compare
* @param b
@@ -432,26 +432,27 @@ public class Util {
/**
* Gets the border-box width for the given element, i.e. element width +
* border + padding. Always rounds up to nearest integer.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredWidth(Element)}
* instead.
*
*
* @param element
* The element to check
* @return The border-box width for the element
*/
@Deprecated
public static int getRequiredWidth(com.google.gwt.dom.client.Element element) {
public static int getRequiredWidth(
com.google.gwt.dom.client.Element element) {
return WidgetUtil.getRequiredWidth(element);
}

/**
* Gets the border-box height for the given element, i.e. element height +
* border + padding. Always rounds up to nearest integer.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getRequiredHeight(Element)} instead.
*
*
* @param element
* The element to check
* @return The border-box height for the element
@@ -526,16 +527,17 @@ public class Util {

/**
* Detects what is currently the overflow style attribute in given element.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#mayHaveScrollBars(Element)} instead.
*
*
* @param pe
* the element to detect
* @return true if auto or scroll
*/
@Deprecated
public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe) {
public static boolean mayHaveScrollBars(
com.google.gwt.dom.client.Element pe) {
return WidgetUtil.mayHaveScrollBars(pe);
}

@@ -545,9 +547,9 @@ public class Util {
* also returned if "element" is part of its caption. If
* <literal>element</literal> is not part of any child component, null is
* returned.
*
*
* This method returns the deepest nested VPaintableWidget.
*
*
* @param client
* A reference to ApplicationConnection
* @param parent
@@ -596,8 +598,9 @@ public class Util {
VOverlay overlay = findWidget(element, VOverlay.class);
if (overlay != null && overlay.getOwner() != null) {

return getConnectorForElement(client, client.getUIConnector()
.getWidget(), overlay.getOwner().getElement());
return getConnectorForElement(client,
client.getUIConnector().getWidget(),
overlay.getOwner().getElement());
} else {
return null;
}
@@ -605,9 +608,9 @@ public class Util {

/**
* Will (attempt) to focus the given DOM Element.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#focus(Element)} instead.
*
*
* @param el
* the element to focus
*/
@@ -619,12 +622,12 @@ public class Util {
/**
* Helper method to find the nearest parent paintable instance by traversing
* the DOM upwards from given element.
*
*
* @param element
* the element to start from
*/
public static ComponentConnector findPaintable(
ApplicationConnection client, Element element) {
public static ComponentConnector findPaintable(ApplicationConnection client,
Element element) {
Widget widget = Util.findWidget(element, null);
ConnectorMap vPaintableMap = ConnectorMap.get(client);
while (widget != null && !vPaintableMap.isConnector(widget)) {
@@ -637,10 +640,10 @@ public class Util {
/**
* Helper method to find first instance of given Widget type found by
* traversing DOM upwards from given element.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#findWidget(Element, Class)} instead.
*
*
* @param element
* the element where to start seeking of Widget
* @param class1
@@ -654,10 +657,10 @@ public class Util {

/**
* Force webkit to redraw an element
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#forceWebkitRedraw(Element)} instead.
*
*
* @param element
* The element that should be redrawn
*/
@@ -670,10 +673,10 @@ public class Util {
* Performs a hack to trigger a re-layout in the IE8. This is usually
* necessary in cases where IE8 "forgets" to update child elements when they
* resize.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIE8Redraw(Element)}
* instead.
*
*
* @param e
* The element to perform the hack on
*/
@@ -686,10 +689,10 @@ public class Util {
* Performs a hack to trigger a re-layout in the IE browser. This is usually
* necessary in cases where IE "forgets" to update child elements when they
* resize.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIERedraw(Element)}
* instead.
*
*
* @since 7.3
* @param e
* The element to perform the hack on
@@ -702,12 +705,12 @@ public class Util {
/**
* Detaches and re-attaches the element from its parent. The element is
* reattached at the same position in the DOM as it was before.
*
*
* Does nothing if the element is not attached to the DOM.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#detachAttach(Element)}
* instead.
*
*
* @param element
* The element to detach and re-attach
*/
@@ -727,10 +730,10 @@ public class Util {

/**
* Returns the index of the childElement within its parent.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getChildElementIndex(Element)} instead.
*
*
* @param subElement
* @return
*/
@@ -746,9 +749,8 @@ public class Util {
if (connector != null) {
getLogger().info("\t" + id + " (" + connector.getClass() + ") :");
} else {
getLogger().warning(
"\t" + id + ": Warning: no corresponding connector for id "
+ id);
getLogger().warning("\t" + id
+ ": Warning: no corresponding connector for id " + id);
}
for (MethodInvocation invocation : invocations) {
getLogger().info("\t\t" + getInvocationDebugString(invocation));
@@ -758,27 +760,29 @@ public class Util {
/**
* Produces a string representation of a method invocation, suitable for
* debug output
*
*
* @since 7.5
* @param invocation
* @return
*/
private static String getInvocationDebugString(MethodInvocation invocation) {
private static String getInvocationDebugString(
MethodInvocation invocation) {
Object[] parameters = invocation.getParameters();
String formattedParams = null;
if (ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation
.getMethodName()) && parameters.length == 2) {
if (ApplicationConstants.UPDATE_VARIABLE_METHOD
.equals(invocation.getMethodName()) && parameters.length == 2) {
// name, value
Object value = parameters[1];
// TODO paintables inside lists/maps get rendered as
// components in the debug console
String formattedValue = value instanceof ServerConnector ? ((ServerConnector) value)
.getConnectorId() : String.valueOf(value);
String formattedValue = value instanceof ServerConnector
? ((ServerConnector) value).getConnectorId()
: String.valueOf(value);
formattedParams = parameters[0] + " : " + formattedValue;
}
if (null == formattedParams) {
formattedParams = (null != parameters) ? Arrays
.toString(parameters) : null;
formattedParams = (null != parameters) ? Arrays.toString(parameters)
: null;
}
return invocation.getInterfaceName() + "." + invocation.getMethodName()
+ "(" + formattedParams + ")";
@@ -806,8 +810,8 @@ public class Util {
printConnectorInvocations(invocations, curId, c);
}
} catch (Exception e) {
getLogger()
.log(Level.SEVERE, "Error logging method invocations", e);
getLogger().log(Level.SEVERE, "Error logging method invocations",
e);
}
}

@@ -815,11 +819,11 @@ public class Util {
* Temporarily sets the {@code styleProperty} to {@code tempValue} and then
* resets it to its current value. Used mainly to work around rendering
* issues in IE (and possibly in other browsers)
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setStyleTemporarily(Element, String, String)}
* instead.
*
*
* @param element
* The target element
* @param styleProperty
@@ -837,10 +841,10 @@ public class Util {
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientX(Event)} instead.
*
*
* @param event
* @return
*/
@@ -853,10 +857,10 @@ public class Util {
* Find the element corresponding to the coordinates in the passed mouse
* event. Please note that this is not always the same as the target of the
* event e.g. if event capture is used.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getElementUnderMouse(NativeEvent)} instead.
*
*
* @param event
* the mouse event to get coordinates from
* @return the element at the coordinates of the event
@@ -871,10 +875,10 @@ public class Util {
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientY(Event)} instead.
*
*
* @param event
* @return
*/
@@ -887,7 +891,7 @@ public class Util {
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientY(NativeEvent)}
* instead.
*
*
* @see #getTouchOrMouseClientY(Event)
* @param currentGwtEvent
* @return
@@ -901,9 +905,9 @@ public class Util {
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#getTouchOrMouseClientX(NativeEvent)}
* instead.
*
*
* @see #getTouchOrMouseClientX(Event)
*
*
* @param event
* @return
*/
@@ -943,10 +947,10 @@ public class Util {

/**
* Gets the currently focused element.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#getFocusedElement()}
* instead.
*
*
* @return The active element or null if no active element could be found.
*/
@Deprecated
@@ -956,7 +960,7 @@ public class Util {

/**
* Gets the currently focused element for Internet Explorer.
*
*
* @return The currently focused element
* @deprecated Use #getFocusedElement instead
*/
@@ -967,12 +971,12 @@ public class Util {

/**
* Gets currently focused element and checks if it's editable
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isFocusedElementEditable()} instead.
*
*
* @since 7.4
*
*
* @return true if focused element is editable
*/
@Deprecated
@@ -985,10 +989,10 @@ public class Util {
* this method checks that this widget nor any of its parents is hidden. Can
* be e.g used to check whether component should react to some events or
* not.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isAttachedAndDisplayed(Widget)} instead.
*
*
* @param widget
* @return true if attached and displayed
*/
@@ -1000,10 +1004,10 @@ public class Util {
/**
* Scrolls an element into view vertically only. Modified version of
* Element.scrollIntoView.
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#scrollIntoViewVertically(Element)} instead.
*
*
* @param elem
* The element to scroll into view
*/
@@ -1015,11 +1019,11 @@ public class Util {
/**
* Checks if the given event is either a touch event or caused by the left
* mouse button
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#isTouchEventOrLeftMouseButton(Event)}
* instead.
*
*
* @param event
* @return true if the event is a touch event or caused by the left mouse
* button, false otherwise
@@ -1031,7 +1035,7 @@ public class Util {

/**
* Performs a shallow comparison of the collections.
*
*
* @param collection1
* The first collection
* @param collection2
@@ -1076,10 +1080,10 @@ public class Util {
/**
* Resolve a relative URL to an absolute URL based on the current document's
* location.
*
*
* @deprecated As of 7.4.0, use {@link WidgetUtil#getAbsoluteUrl(String)}
* instead.
*
*
* @param url
* a string with the relative URL to resolve
* @return the corresponding absolute URL as a string
@@ -1091,16 +1095,16 @@ public class Util {

/**
* Sets the selection range of an input element.
*
*
* We need this JSNI function to set selection range so that we can use the
* optional direction attribute to set the anchor to the end and the focus
* to the start. This makes Firefox work the same way as other browsers
* (#13477)
*
*
* @deprecated As of 7.4.0, use
* {@link WidgetUtil#setSelectionRange(Element, int, int, String)}
* instead.
*
*
* @param elem
* the html input element.
* @param pos
@@ -1111,7 +1115,7 @@ public class Util {
* a string indicating the direction in which the selection was
* performed. This may be "forward" or "backward", or "none" if
* the direction is unknown or irrelevant.
*
*
* @since 7.3
*/
@Deprecated
@@ -1124,7 +1128,7 @@ public class Util {
* Converts a native {@link JavaScriptObject} into a {@link JsonValue}. This
* is a no-op in GWT code compiled to javascript, but needs some special
* handling to work when run in JVM.
*
*
* @param jso
* the java script object to represent as json
* @return the json representation
@@ -1141,7 +1145,7 @@ public class Util {
* Converts a {@link JsonValue} into a native {@link JavaScriptObject}. This
* is a no-op in GWT code compiled to javascript, but needs some special
* handling to work when run in JVM.
*
*
* @param jsonValue
* the json value
* @return a native javascript object representation of the json value
@@ -1156,7 +1160,7 @@ public class Util {

/**
* Convert a {@link JavaScriptObject} into a string representation.
*
*
* @param json
* a JavaScript object to be converted to a string
* @return JSON in string representation
@@ -1168,7 +1172,7 @@ public class Util {

/**
* Parse a string containing JSON into a {@link JavaScriptObject}.
*
*
* @param <T>
* the overlay type to expect from the parse
* @param jsonAsString
@@ -1182,7 +1186,7 @@ public class Util {

/**
* Round {@code num} up to {@code exp} decimal positions.
*
*
* @since 7.6
*/
public static native double round(double num, int exp)
@@ -1222,7 +1226,7 @@ public class Util {
* appropriate mode set.
*
* This version of the method tries to recursively locate such a parent.
*
*
* For internal use only. May be removed or replaced in the future.
*/
public static boolean shouldSkipMeasurementOfConnector(
@@ -1230,7 +1234,8 @@ public class Util {
Profiler.enter("skipMeasureDueLayoutHint");
boolean skip = false;

HasChildMeasurementHintConnector parent = getPossibleChildMeasurementHintParentConnector(candidate);
HasChildMeasurementHintConnector parent = getPossibleChildMeasurementHintParentConnector(
candidate);

if (parent != null) {
ChildMeasurementHint measureMode = parent.getChildMeasurementHint();

+ 30
- 30
client/src/main/java/com/vaadin/client/VCaption.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -67,9 +67,9 @@ public class VCaption extends HTML {

/**
* Creates a caption that is not linked to a {@link ComponentConnector}.
*
*
* When using this constructor, {@link #getOwner()} returns null.
*
*
* @param client
* ApplicationConnection
* @deprecated all captions should be associated with a paintable widget and
@@ -88,13 +88,14 @@ public class VCaption extends HTML {

/**
* Creates a caption for a {@link ComponentConnector}.
*
*
* @param component
* owner of caption, not null
* @param client
* ApplicationConnection
*/
public VCaption(ComponentConnector component, ApplicationConnection client) {
public VCaption(ComponentConnector component,
ApplicationConnection client) {
super();
this.client = client;
owner = component;
@@ -129,10 +130,10 @@ public class VCaption extends HTML {

/**
* Updates the caption from UIDL.
*
*
* This method may only be called when the caption has an owner - otherwise,
* use {@link #updateCaptionWithoutOwner(UIDL, String, boolean, boolean)}.
*
*
* @return true if the position where the caption should be placed has
* changed
*/
@@ -172,8 +173,8 @@ public class VCaption extends HTML {
icon = null;
}
if (hasIcon) {
String uri = owner.getState().resources.get(
ComponentConstants.ICON_RESOURCE).getURL();
String uri = owner.getState().resources
.get(ComponentConstants.ICON_RESOURCE).getURL();

icon = client.getIcon(uri);

@@ -247,8 +248,8 @@ public class VCaption extends HTML {
getInsertPosition(InsertPosition.REQUIRED));

// Hide the required indicator from assistive device
Roles.getTextboxRole().setAriaHiddenState(
requiredFieldIndicator, true);
Roles.getTextboxRole()
.setAriaHiddenState(requiredFieldIndicator, true);
}
} else if (requiredFieldIndicator != null) {
// Remove existing
@@ -269,8 +270,8 @@ public class VCaption extends HTML {
getInsertPosition(InsertPosition.ERROR));

// Hide error indicator from assistive devices
Roles.getTextboxRole().setAriaHiddenState(
errorIndicatorElement, true);
Roles.getTextboxRole().setAriaHiddenState(errorIndicatorElement,
true);
}
} else if (errorIndicatorElement != null) {
// Remove existing
@@ -447,9 +448,8 @@ public class VCaption extends HTML {
if (owner != null) {
Util.notifyParentOfSizeChange(owner.getWidget(), true);
} else {
getLogger()
.warning(
"Warning: Icon load event was not propagated because VCaption owner is unknown.");
getLogger().warning(
"Warning: Icon load event was not propagated because VCaption owner is unknown.");
}
}
}
@@ -477,7 +477,7 @@ public class VCaption extends HTML {
/**
* Checks whether anything in a given state change might cause the caption
* to change.
*
*
* @param event
* the state change event to check
* @return <code>true</code> if the caption might have changed; otherwise
@@ -499,7 +499,7 @@ public class VCaption extends HTML {

/**
* Returns Paintable for which this Caption belongs to.
*
*
* @return owner Widget
*/
public ComponentConnector getOwner() {
@@ -637,13 +637,13 @@ public class VCaption extends HTML {
}

if (icon != null) {
int iconRequiredWidth = WidgetUtil.getRequiredWidth(icon
.getElement());
int iconRequiredWidth = WidgetUtil
.getRequiredWidth(icon.getElement());
if (availableWidth > iconRequiredWidth) {
availableWidth -= iconRequiredWidth;
} else {
icon.getElement().getStyle()
.setWidth(availableWidth, Unit.PX);
icon.getElement().getStyle().setWidth(availableWidth,
Unit.PX);
availableWidth = 0;
}
}
@@ -664,7 +664,7 @@ public class VCaption extends HTML {

/**
* Sets the tooltip that should be shown for the caption
*
*
* @param tooltipInfo
* The tooltip that should be shown or null if no tooltip should
* be shown
@@ -675,7 +675,7 @@ public class VCaption extends HTML {

/**
* Returns the tooltip that should be shown for the caption
*
*
* @return The tooltip to show or null if no tooltip should be shown
*/
public TooltipInfo getTooltipInfo() {
@@ -704,7 +704,7 @@ public class VCaption extends HTML {
* Sets whether the caption is rendered as HTML.
* <p>
* Default is false
*
*
* @param captionAsHtml
* true if the captions are rendered as HTML, false if rendered
* as plain text
@@ -717,7 +717,7 @@ public class VCaption extends HTML {
* Checks whether captions are rendered as HTML.
* <p>
* Default is false
*
*
* @return true if the captions are rendered as HTML, false if rendered as
* plain text
*/
@@ -731,7 +731,7 @@ public class VCaption extends HTML {
* <p>
* Uses {@link AbstractComponentState#captionAsHtml} to determine whether to
* set the caption as html or plain text
*
*
* @since 7.4
* @param captionElement
* the target element
@@ -753,7 +753,7 @@ public class VCaption extends HTML {
* <p>
* Uses {@link AbstractComponentState#captionAsHtml} to determine whether to
* set the caption as html or plain text
*
*
* @since 7.4
* @param widget
* the target widget

+ 4
- 4
client/src/main/java/com/vaadin/client/VCaptionWrapper.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 VCaptionWrapper extends FlowPanel {

/**
* Creates a new caption wrapper panel.
*
*
* @param toBeWrapped
* paintable that the caption is associated with, not null
* @param client

+ 5
- 5
client/src/main/java/com/vaadin/client/VConsole.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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.vaadin.client.debug.internal.VDebugWindow;

/**
* A helper class to do some client side logging.
*
*
* @deprecated as of 7.1, use {@link Logger} from java.util.logging instead.
*/
@Deprecated
@@ -32,7 +32,7 @@ public class VConsole {

/**
* Used by ApplicationConfiguration to initialize VConsole.
*
*
* @param console
*/
static void setImplementation(VDebugWindow console) {

+ 9
- 11
client/src/main/java/com/vaadin/client/VErrorMessage.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -38,7 +38,7 @@ public class VErrorMessage extends FlowPanel {
* The owner must be set if the {@link VErrorMessage} is created
* 'stand-alone' (not within a {@link VOverlay}), or theming might not work
* properly.
*
*
* @see VOverlay#setOwner(Widget)
* @param owner
* the owner (creator Widget)
@@ -59,7 +59,7 @@ public class VErrorMessage extends FlowPanel {

/**
* Shows this error message next to given element.
*
*
* @param indicatorElement
* @deprecated As of 7.2, call and override {@link #showAt(Element)} instead
*/
@@ -73,12 +73,10 @@ public class VErrorMessage extends FlowPanel {
}
errorContainer.setPopupPosition(
DOM.getAbsoluteLeft(indicatorElement)
+ 2
* DOM.getElementPropertyInt(indicatorElement,
+ 2 * DOM.getElementPropertyInt(indicatorElement,
"offsetHeight"),
DOM.getAbsoluteTop(indicatorElement)
+ 2
* DOM.getElementPropertyInt(indicatorElement,
+ 2 * DOM.getElementPropertyInt(indicatorElement,
"offsetHeight"));
errorContainer.show();

@@ -86,9 +84,9 @@ public class VErrorMessage extends FlowPanel {

/**
* Shows this error message next to given element.
*
*
* @param indicatorElement
*
*
* @since 7.2
*/
public void showAt(Element indicatorElement) {

+ 15
- 15
client/src/main/java/com/vaadin/client/VLoadingIndicator.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import com.google.gwt.user.client.Timer;
* {@link #trigger()} is called the indicator moves to its "triggered" state and
* then transitions from one state to the next when the timeouts specified using
* the set*StateDelay methods occur.
*
*
* @author Vaadin Ltd
* @since 7.1
*/
@@ -72,7 +72,7 @@ public class VLoadingIndicator {
/**
* Returns the delay (in ms) which must pass before the loading indicator
* moves into the "first" state and is shown to the user
*
*
* @return The delay (in ms) until moving into the "first" state. Counted
* from when {@link #trigger()} is called.
*/
@@ -83,7 +83,7 @@ public class VLoadingIndicator {
/**
* Sets the delay (in ms) which must pass before the loading indicator moves
* into the "first" state and is shown to the user
*
*
* @param firstDelay
* The delay (in ms) until moving into the "first" state. Counted
* from when {@link #trigger()} is called.
@@ -95,7 +95,7 @@ public class VLoadingIndicator {
/**
* Returns the delay (in ms) which must pass before the loading indicator
* moves to its "second" state.
*
*
* @return The delay (in ms) until the loading indicator moves into its
* "second" state. Counted from when {@link #trigger()} is called.
*/
@@ -106,7 +106,7 @@ public class VLoadingIndicator {
/**
* Sets the delay (in ms) which must pass before the loading indicator moves
* to its "second" state.
*
*
* @param secondDelay
* The delay (in ms) until the loading indicator moves into its
* "second" state. Counted from when {@link #trigger()} is
@@ -119,7 +119,7 @@ public class VLoadingIndicator {
/**
* Returns the delay (in ms) which must pass before the loading indicator
* moves to its "third" state.
*
*
* @return The delay (in ms) until the loading indicator moves into its
* "third" state. Counted from when {@link #trigger()} is called.
*/
@@ -130,7 +130,7 @@ public class VLoadingIndicator {
/**
* Sets the delay (in ms) which must pass before the loading indicator moves
* to its "third" state.
*
*
* @param thirdDelay
* The delay (in ms) from the event until changing the loading
* indicator into its "third" state. Counted from when
@@ -156,7 +156,7 @@ public class VLoadingIndicator {
/**
* Triggers displaying of this loading indicator unless it's already visible
* or scheduled to be shown after a delay.
*
*
* @since 7.4
*/
public void ensureTriggered() {
@@ -191,7 +191,7 @@ public class VLoadingIndicator {
/**
* Returns the {@link ApplicationConnection} which uses this loading
* indicator
*
*
* @return The ApplicationConnection for this loading indicator
*/
public ApplicationConnection getConnection() {
@@ -201,7 +201,7 @@ public class VLoadingIndicator {
/**
* Sets the {@link ApplicationConnection} which uses this loading indicator.
* Only used internally.
*
*
* @param connection
* The ApplicationConnection for this loading indicator
*/
@@ -223,7 +223,7 @@ public class VLoadingIndicator {

/**
* Returns whether or not the loading indicator is showing.
*
*
* @return true if the loading indicator is visible, false otherwise
*/
public boolean isVisible() {
@@ -237,7 +237,7 @@ public class VLoadingIndicator {

/**
* Returns the root element of the loading indicator
*
*
* @return The loading indicator DOM element
*/
public com.google.gwt.user.client.Element getElement() {

+ 3
- 3
client/src/main/java/com/vaadin/client/VSchedulerImpl.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 62
- 60
client/src/main/java/com/vaadin/client/VTooltip.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -48,9 +48,8 @@ import com.vaadin.client.ui.VOverlay;
public class VTooltip extends VOverlay {
private static final String CLASSNAME = "v-tooltip";
private static final int MARGIN = 4;
public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN
| Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE
| Event.ONCLICK;
public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN | Event.ONMOUSEOVER
| Event.ONMOUSEOUT | Event.ONMOUSEMOVE | Event.ONCLICK;
VErrorMessage em = new VErrorMessage();
Element description = DOM.createDiv();

@@ -80,7 +79,7 @@ public class VTooltip extends VOverlay {
* Used to show tooltips; usually used via the singleton in
* {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be
* called after instantiating.
*
*
* @see ApplicationConnection#getVTooltip()
*/
public VTooltip() {
@@ -108,7 +107,7 @@ public class VTooltip extends VOverlay {

/**
* Show the tooltip with the provided info for assistive devices.
*
*
* @param info
* with the content of the tooltip
*/
@@ -120,7 +119,7 @@ public class VTooltip extends VOverlay {

/**
* Initialize the tooltip overlay for assistive devices.
*
*
* @param info
* with the content of the tooltip
* @since 7.2.4
@@ -134,7 +133,8 @@ public class VTooltip extends VOverlay {
}

private void setTooltipText(TooltipInfo info) {
if (info.getErrorMessage() != null && !info.getErrorMessage().isEmpty()) {
if (info.getErrorMessage() != null
&& !info.getErrorMessage().isEmpty()) {
em.setVisible(true);
em.updateMessage(info.getErrorMessage());
} else {
@@ -147,12 +147,12 @@ public class VTooltip extends VOverlay {
* element we need to clear style width of its parent DIV from old
* value (in some strange cases this width=[tooltip MAX_WIDTH] after
* tooltip text has been already updated to new shortly value:
*
*
* <div class="popupContent"> <div style="width:500px;"> <div
* class="v-errormessage" aria-hidden="true" style="display: none;">
* <div class="gwt-HTML"> </div> </div> <div
* class="v-tooltip-text">This is a short tooltip</div> </div>
*
*
* and it leads to error during calculation offsetWidth (it is
* native GWT method getSubPixelOffsetWidth()) of description
* element")
@@ -168,7 +168,7 @@ public class VTooltip extends VOverlay {

/**
* Show a popup containing the currentTooltipInfo
*
*
*/
private void showTooltip() {
if (currentTooltipInfo.hasMessage()) {
@@ -212,7 +212,7 @@ public class VTooltip extends VOverlay {
* Return the final X-coordinate of the tooltip based on cursor
* position, size of the tooltip, size of the page and necessary
* margins.
*
*
* @param offsetWidth
* @return The final X-coordinate
*/
@@ -227,8 +227,9 @@ public class VTooltip extends VOverlay {
x = tooltipEventMouseX + Window.getScrollLeft() - 10
- offsetWidth;
}
if (x + offsetWidth + MARGIN - Window.getScrollLeft() > Window
.getClientWidth()) {
if (x + offsetWidth + MARGIN
- Window.getScrollLeft() > Window
.getClientWidth()) {
x = Window.getClientWidth() - offsetWidth - MARGIN
+ Window.getScrollLeft();
}
@@ -254,8 +255,9 @@ public class VTooltip extends VOverlay {
private int getFinalTouchX(int offsetWidth) {
int x = 0;
int widthNeeded = 10 + offsetWidth;
int roomLeft = currentElement != null ? currentElement
.getAbsoluteLeft() : EVENT_XY_POSITION_OUTSIDE;
int roomLeft = currentElement != null
? currentElement.getAbsoluteLeft()
: EVENT_XY_POSITION_OUTSIDE;
int viewPortWidth = Window.getClientWidth();
int roomRight = viewPortWidth - roomLeft;
if (roomRight > widthNeeded) {
@@ -263,7 +265,8 @@ public class VTooltip extends VOverlay {
} else {
x = roomLeft - offsetWidth;
}
if (x + offsetWidth - Window.getScrollLeft() > viewPortWidth) {
if (x + offsetWidth
- Window.getScrollLeft() > viewPortWidth) {
x = viewPortWidth - offsetWidth
+ Window.getScrollLeft();
}
@@ -282,10 +285,10 @@ public class VTooltip extends VOverlay {
* Return the final Y-coordinate of the tooltip based on cursor
* position, size of the tooltip, size of the page and necessary
* margins.
*
*
* @param offsetHeight
* @return The final y-coordinate
*
*
*/
private int getFinalY(int offsetHeight) {
int y = 0;
@@ -300,8 +303,9 @@ public class VTooltip extends VOverlay {
- offsetHeight;
}

if (y + offsetHeight + MARGIN - Window.getScrollTop() > Window
.getClientHeight()) {
if (y + offsetHeight + MARGIN
- Window.getScrollTop() > Window
.getClientHeight()) {
y = tooltipEventMouseY - 5 - offsetHeight
+ Window.getScrollTop();
if (y - Window.getScrollTop() < 0) {
@@ -333,19 +337,17 @@ public class VTooltip extends VOverlay {
private int getFinalTouchY(int offsetHeight) {
int y = 0;
int heightNeeded = 10 + offsetHeight;
int roomAbove = currentElement != null ? currentElement
.getAbsoluteTop()
+ currentElement.getOffsetHeight()
int roomAbove = currentElement != null
? currentElement.getAbsoluteTop()
+ currentElement.getOffsetHeight()
: EVENT_XY_POSITION_OUTSIDE;
int roomBelow = Window.getClientHeight() - roomAbove;

if (roomBelow > heightNeeded) {
y = roomAbove;
} else {
y = roomAbove
- offsetHeight
- (currentElement != null ? currentElement
.getOffsetHeight() : 0);
y = roomAbove - offsetHeight - (currentElement != null
? currentElement.getOffsetHeight() : 0);
}

if (y + offsetHeight - Window.getScrollTop() > Window
@@ -379,7 +381,7 @@ public class VTooltip extends VOverlay {
* and attached to the DOM well in advance. For this reason both isShowing
* and isVisible return false positives. We can't override either of them as
* external code may depend on this behavior.
*
*
* @return boolean
*/
public boolean isTooltipOpen() {
@@ -454,13 +456,13 @@ public class VTooltip extends VOverlay {
}

private int getEventX(Event event, boolean isFocused) {
return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
.eventGetClientX(event);
return isFocused ? EVENT_XY_POSITION_OUTSIDE
: DOM.eventGetClientX(event);
}

private int getEventY(Event event, boolean isFocused) {
return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM
.eventGetClientY(event);
return isFocused ? EVENT_XY_POSITION_OUTSIDE
: DOM.eventGetClientY(event);
}

@Override
@@ -494,9 +496,9 @@ public class VTooltip extends VOverlay {
opening = false;
}

private class TooltipEventHandler implements MouseMoveHandler,
KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler,
MouseOutHandler {
private class TooltipEventHandler
implements MouseMoveHandler, KeyDownHandler, FocusHandler,
BlurHandler, MouseDownHandler, MouseOutHandler {

/**
* Marker for handling of tooltip through focus
@@ -505,7 +507,7 @@ public class VTooltip extends VOverlay {

/**
* Locate the tooltip for given element
*
*
* @param element
* Element used in search
* @return TooltipInfo if connector and tooltip found, null if not
@@ -545,7 +547,7 @@ public class VTooltip extends VOverlay {

/**
* Handle hide event
*
*
*/
private void handleHideEvent() {
hideTooltip();
@@ -568,7 +570,7 @@ public class VTooltip extends VOverlay {

/**
* Displays Tooltip when page is navigated with the keyboard.
*
*
* Tooltip is not visible. This makes it possible for assistive devices
* to recognize the tooltip.
*/
@@ -579,7 +581,7 @@ public class VTooltip extends VOverlay {

/**
* Hides Tooltip when the page is navigated with the keyboard.
*
*
* Removes the Tooltip from page to make sure assistive devices don't
* recognize it by accident.
*/
@@ -647,8 +649,8 @@ public class VTooltip extends VOverlay {

@Override
public void onMouseOut(MouseOutEvent moe) {
Element element = WidgetUtil.getElementUnderMouse(moe
.getNativeEvent());
Element element = WidgetUtil
.getElementUnderMouse(moe.getNativeEvent());
handleOnMouseOut(element);
}

@@ -668,12 +670,12 @@ public class VTooltip extends VOverlay {
}

private boolean hasCommonOwner(Widget owner, Element element) {
ComponentConnector connector = Util.findPaintable(
getApplicationConnection(), element);
ComponentConnector connector = Util
.findPaintable(getApplicationConnection(), element);
if (connector != null && connector.getConnection() != null
&& connector.getConnection().getUIConnector() != null) {
return owner.equals(connector.getConnection().getUIConnector()
.getWidget());
return owner.equals(
connector.getConnection().getUIConnector().getWidget());
}
return false;
}
@@ -683,7 +685,7 @@ public class VTooltip extends VOverlay {

/**
* Connects DOM handlers to widget that are needed for tooltip presentation.
*
*
* @param widget
* Widget which DOM handlers are connected
*/
@@ -700,7 +702,7 @@ public class VTooltip extends VOverlay {

/**
* Returns the unique id of the tooltip element.
*
*
* @return String containing the unique id of the tooltip, which always has
* a value
*/
@@ -721,7 +723,7 @@ public class VTooltip extends VOverlay {
* Returns the time (in ms) the tooltip should be displayed after an event
* that will cause it to be closed (e.g. mouse click outside the component,
* key down).
*
*
* @return The close timeout (in ms)
*/
public int getCloseTimeout() {
@@ -732,7 +734,7 @@ public class VTooltip extends VOverlay {
* Sets the time (in ms) the tooltip should be displayed after an event that
* will cause it to be closed (e.g. mouse click outside the component, key
* down).
*
*
* @param closeTimeout
* The close timeout (in ms)
*/
@@ -745,7 +747,7 @@ public class VTooltip extends VOverlay {
* be used instead of {@link #getOpenDelay()}. The quick open delay is used
* when the tooltip has very recently been shown, is currently hidden but
* about to be shown again.
*
*
* @return The quick open timeout (in ms)
*/
public int getQuickOpenTimeout() {
@@ -757,7 +759,7 @@ public class VTooltip extends VOverlay {
* should be used instead of {@link #getOpenDelay()}. The quick open delay
* is used when the tooltip has very recently been shown, is currently
* hidden but about to be shown again.
*
*
* @param quickOpenTimeout
* The quick open timeout (in ms)
*/
@@ -769,7 +771,7 @@ public class VTooltip extends VOverlay {
* Returns the time (in ms) that should elapse before a tooltip will be
* shown, in the situation when a tooltip has very recently been shown
* (within {@link #getQuickOpenDelay()} ms).
*
*
* @return The quick open delay (in ms)
*/
public int getQuickOpenDelay() {
@@ -780,7 +782,7 @@ public class VTooltip extends VOverlay {
* Sets the time (in ms) that should elapse before a tooltip will be shown,
* in the situation when a tooltip has very recently been shown (within
* {@link #getQuickOpenDelay()} ms).
*
*
* @param quickOpenDelay
* The quick open delay (in ms)
*/
@@ -793,7 +795,7 @@ public class VTooltip extends VOverlay {
* tooltip showing has occurred (e.g. mouse over) before the tooltip is
* shown. If a tooltip has recently been shown, then
* {@link #getQuickOpenDelay()} is used instead of this.
*
*
* @return The open delay (in ms)
*/
public int getOpenDelay() {
@@ -805,7 +807,7 @@ public class VTooltip extends VOverlay {
* tooltip showing has occurred (e.g. mouse over) before the tooltip is
* shown. If a tooltip has recently been shown, then
* {@link #getQuickOpenDelay()} is used instead of this.
*
*
* @param openDelay
* The open delay (in ms)
*/
@@ -815,7 +817,7 @@ public class VTooltip extends VOverlay {

/**
* Sets the maximum width of the tooltip popup.
*
*
* @param maxWidth
* The maximum width the tooltip popup (in pixels)
*/
@@ -825,7 +827,7 @@ public class VTooltip extends VOverlay {

/**
* Returns the maximum width of the tooltip popup.
*
*
* @return The maximum width the tooltip popup (in pixels)
*/
public int getMaxWidth() {

+ 9
- 10
client/src/main/java/com/vaadin/client/VUIDLBrowser.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -14,7 +14,7 @@
* the License.
*/
/**
*
*
*/
package com.vaadin.client;

@@ -45,7 +45,7 @@ import elemental.json.JsonValue;

/**
* @author Vaadin Ltd
*
*
* @deprecated as of 7.1. This class was mainly used by the old debug console
* but is retained for now for backwards compatibility.
*/
@@ -74,8 +74,8 @@ public class VUIDLBrowser extends SimpleTree {
SimpleTree stateChanges = new SimpleTree("shared state");

for (String connectorId : stateJson.getKeySet()) {
stateChanges.add(new SharedStateItem(connectorId, stateJson
.getValueMap(connectorId)));
stateChanges.add(new SharedStateItem(connectorId,
stateJson.getValueMap(connectorId)));
}
add(stateChanges);

@@ -239,9 +239,8 @@ public class VUIDLBrowser extends SimpleTree {

@Override
public void open(boolean recursive) {
if (getWidgetCount() == 1
&& getWidget(0).getElement().getInnerText()
.equals("LOADING")) {
if (getWidgetCount() == 1 && getWidget(0).getElement()
.getInnerText().equals("LOADING")) {
dir();
}
super.open(recursive);

+ 4
- 4
client/src/main/java/com/vaadin/client/ValueMap.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -14,7 +14,7 @@
* the License.
*/
/**
*
*
*/
package com.vaadin.client;


+ 3
- 3
client/src/main/java/com/vaadin/client/WidgetInstantiator.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
- 4
client/src/main/java/com/vaadin/client/WidgetLoader.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,7 +17,9 @@ package com.vaadin.client;

import com.google.gwt.core.client.RunAsyncCallback;

/** A helper class used by WidgetMap implementation. Used by the generated code. */
/**
* A helper class used by WidgetMap implementation. Used by the generated code.
*/
abstract class WidgetLoader implements RunAsyncCallback {

@Override

+ 8
- 8
client/src/main/java/com/vaadin/client/WidgetMap.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 java.util.HashMap;
/**
* Abstract class mapping between {@link ComponentConnector} instances and their
* instances.
*
*
* A concrete implementation of this class is generated by WidgetMapGenerator or
* one of its subclasses during widgetset compilation.
*/
@@ -30,7 +30,7 @@ abstract class WidgetMap {

/**
* Create a new instance of a connector based on its type.
*
*
* @param classType
* {@link ComponentConnector} class to instantiate
* @return new instance of the connector
@@ -43,7 +43,7 @@ abstract class WidgetMap {
/**
* Return the connector class to use for a fully qualified server side
* component class name.
*
*
* @param fullyqualifiedName
* fully qualified name of the server side component class
* @return component connector class to use
@@ -54,7 +54,7 @@ abstract class WidgetMap {
/**
* Return the connector classes to load after the initial widgetset load and
* start.
*
*
* @return component connector class to load after the initial widgetset
* loading
*/
@@ -64,7 +64,7 @@ abstract class WidgetMap {
* Make sure the code for a (deferred or lazy) component connector type has
* been loaded, triggering the load and waiting for its completion if
* necessary.
*
*
* @param classType
* component connector class
*/

+ 12
- 14
client/src/main/java/com/vaadin/client/WidgetSet.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,13 +31,13 @@ public class WidgetSet {
/**
* Create an uninitialized connector that best matches given UIDL. The
* connector must implement {@link ServerConnector}.
*
*
* @param tag
* connector type tag for the connector to create
* @param conf
* the application configuration to use when creating the
* connector
*
*
* @return New uninitialized and unregistered connector that can paint given
* UIDL.
*/
@@ -67,8 +67,8 @@ public class WidgetSet {
* let the auto generated code instantiate this type
*/
try {
ServerConnector connector = (ServerConnector) TypeData.getType(
classType).createInstance();
ServerConnector connector = (ServerConnector) TypeData
.getType(classType).createInstance();
if (connector instanceof HasJavaScriptConnectorHelper) {
((HasJavaScriptConnectorHelper) connector)
.getJavascriptConnectorHelper().setTag(tag);
@@ -78,8 +78,7 @@ public class WidgetSet {
} catch (NoDataException e) {
Profiler.leave("WidgetSet.createConnector");
throw new IllegalStateException(
"There is no information about "
+ classType
"There is no information about " + classType
+ ". Did you remember to compile the right widgetset?",
e);
}
@@ -109,7 +108,7 @@ public class WidgetSet {
* Due its nature, GWT does not support dynamic classloading. To bypass this
* limitation, widgetset must have function that returns Class by its fully
* qualified name.
*
*
* @param tag
* @param applicationConfiguration
* @return
@@ -127,10 +126,9 @@ public class WidgetSet {
} while (bundleName == null && t != null);

if (bundleName != null && !loader.isBundleLoaded(bundleName)) {
getLogger().info(
"Loading bundle " + bundleName
+ " to be able to render server side class "
+ serverSideClassName);
getLogger().info("Loading bundle " + bundleName
+ " to be able to render server side class "
+ serverSideClassName);
ApplicationConfiguration.startDependencyLoading();
loader.loadBundle(bundleName, new BundleLoadCallback() {
@Override

+ 108
- 104
client/src/main/java/com/vaadin/client/WidgetUtil.java View File

@@ -54,9 +54,9 @@ public class WidgetUtil {

/**
* Helper method for debugging purposes.
*
*
* Stops execution on firefox browsers on a breakpoint.
*
*
*/
public static native void browserDebugger()
/*-{
@@ -67,7 +67,7 @@ public class WidgetUtil {
/**
* Redirects the browser to the given url or refreshes the page if url is
* null
*
*
* @since 7.6
* @param url
* The url to redirect to or null to refresh
@@ -85,7 +85,7 @@ public class WidgetUtil {
* Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for
* space bar (because space is considered as char). If return 0 use
* getCharCode.
*
*
* @param event
* @return return key code
* @since 7.2.4
@@ -99,12 +99,12 @@ public class WidgetUtil {
}

/**
*
*
* Returns the topmost element of from given coordinates.
*
*
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical
* for vaadin as we scroll div istead of page.
*
*
* @param x
* @param y
* @return the element at given coordinates
@@ -137,7 +137,7 @@ public class WidgetUtil {

/**
* Converts html entities to text.
*
*
* @param html
* @return escaped string presentation of given html
*/
@@ -155,7 +155,7 @@ public class WidgetUtil {

/**
* Escapes the string so it is safe to write inside an HTML attribute.
*
*
* @param attribute
* The string to escape
* @return An escaped version of <literal>attribute</literal>.
@@ -174,9 +174,9 @@ public class WidgetUtil {

/**
* Clones given element as in JavaScript.
*
*
* Deprecate this if there appears similar method into GWT someday.
*
*
* @param element
* @param deep
* clone child tree also
@@ -293,8 +293,8 @@ public class WidgetUtil {
setHeight(widget, "");
return paddingBorderGuess;
} else if (height.endsWith("px")) {
int pixelHeight = Integer.parseInt(height.substring(0,
height.length() - 2));
int pixelHeight = Integer
.parseInt(height.substring(0, height.length() - 2));
return setHeightExcludingPaddingAndBorder(widget.getElement(),
pixelHeight, paddingBorderGuess, false);
} else {
@@ -320,8 +320,8 @@ public class WidgetUtil {
setWidth(widget, "");
return paddingBorderGuess;
} else if (width.endsWith("px")) {
int pixelWidth = Integer.parseInt(width.substring(0,
width.length() - 2));
int pixelWidth = Integer
.parseInt(width.substring(0, width.length() - 2));
return setWidthExcludingPaddingAndBorder(widget.getElement(),
pixelWidth, paddingBorderGuess, false);
} else {
@@ -427,7 +427,7 @@ public class WidgetUtil {

/**
* Defers the execution of {@link #runWebkitOverflowAutoFix(Element)}
*
*
* @since 7.2.6
* @param elem
* with overflow auto
@@ -445,9 +445,9 @@ public class WidgetUtil {

/**
* Run workaround for webkits overflow auto issue.
*
*
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462
*
*
* @param elem
* with overflow auto
*/
@@ -455,12 +455,12 @@ public class WidgetUtil {
// Add max version if fix lands sometime to Webkit
// Starting from Opera 11.00, also a problem in Opera
if (BrowserInfo.get().requiresOverflowAutoFix()) {
final String originalOverflow = elem.getStyle().getProperty(
"overflow");
final String originalOverflowX = elem.getStyle().getProperty(
"overflowX");
final String originalOverflowY = elem.getStyle().getProperty(
"overflowY");
final String originalOverflow = elem.getStyle()
.getProperty("overflow");
final String originalOverflowX = elem.getStyle()
.getProperty("overflowX");
final String originalOverflowY = elem.getStyle()
.getProperty("overflowY");
if ("hidden".equals(originalOverflow)
|| "hidden".equals(originalOverflowX)
|| "hidden".equals(originalOverflowY)) {
@@ -505,7 +505,8 @@ public class WidgetUtil {
// updated when collapsing/expanding columns
// Also appeared in Safari 5.1 with webkit 534 (#7667)
if ((BrowserInfo.get().isChrome() || (BrowserInfo.get()
.isSafari() && BrowserInfo.get().getWebkitVersion() >= 534))
.isSafari()
&& BrowserInfo.get().getWebkitVersion() >= 534))
&& (scrollleft > 0 || elem.getScrollLeft() > 0)) {
int scrollvalue = scrollleft;

@@ -536,12 +537,13 @@ public class WidgetUtil {
/**
* Gets the border-box width for the given element, i.e. element width +
* border + padding. Always rounds up to nearest integer.
*
*
* @param element
* The element to check
* @return The border-box width for the element
*/
public static int getRequiredWidth(com.google.gwt.dom.client.Element element) {
public static int getRequiredWidth(
com.google.gwt.dom.client.Element element) {
int reqWidth = getRequiredWidthBoundingClientRect(element);
if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) {
int csSize = getRequiredWidthComputedStyle(element);
@@ -561,7 +563,7 @@ public class WidgetUtil {
/**
* Gets the border-box width for the given element, i.e. element width +
* border + padding.
*
*
* @since 7.5.1
* @param element
* The element to check
@@ -586,7 +588,7 @@ public class WidgetUtil {
/**
* Gets the border-box height for the given element, i.e. element height +
* border + padding. Always rounds up to nearest integer.
*
*
* @param element
* The element to check
* @return The border-box height for the element
@@ -612,7 +614,7 @@ public class WidgetUtil {
/**
* Gets the border-box height for the given element, i.e. element height +
* border + padding.
*
*
* @since 7.5.1
* @param element
* The element to check
@@ -642,7 +644,7 @@ public class WidgetUtil {
* <p>
* In case the browser doesn't support bounding rectangles, the returned
* value is the offset width.
*
*
* @param element
* the element of which to calculate the width
* @return the width of the element
@@ -659,7 +661,7 @@ public class WidgetUtil {
* <p>
* In case the browser doesn't support bounding rectangles, the returned
* value is the offset width.
*
*
* @param element
* the element of which to calculate the width
* @return the subpixel-accurate width of the element
@@ -721,7 +723,7 @@ public class WidgetUtil {
* <p>
* In case the browser doesn't support bounding rectangles, the returned
* value is the offset height.
*
*
* @param element
* the element of which to calculate the height
* @return the height of the element
@@ -738,7 +740,7 @@ public class WidgetUtil {
* <p>
* In case the browser doesn't support bounding rectangles, the returned
* value is the offset height.
*
*
* @param element
* the element of which to calculate the height
* @return the subpixel-accurate height of the element
@@ -767,12 +769,13 @@ public class WidgetUtil {

/**
* Detects what is currently the overflow style attribute in given element.
*
*
* @param pe
* the element to detect
* @return true if auto or scroll
*/
public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe) {
public static boolean mayHaveScrollBars(
com.google.gwt.dom.client.Element pe) {
String overflow = getComputedStyle(pe, "overflow");
if (overflow != null) {
if (overflow.equals("auto") || overflow.equals("scroll")) {
@@ -789,7 +792,7 @@ public class WidgetUtil {
* A simple helper method to detect "computed style" (aka style sheets +
* element styles). Values returned differ a lot depending on browsers.
* Always be very careful when using this.
*
*
* @param el
* the element from which the style property is detected
* @param p
@@ -820,7 +823,7 @@ public class WidgetUtil {

/**
* Will (attempt) to focus the given DOM Element.
*
*
* @param el
* the element to focus
*/
@@ -843,7 +846,7 @@ public class WidgetUtil {
* {@code C} or null, depending on whether the class parameter matches. This
* may also be the case with other Composite-like classes that hijack the
* event handling of their child widget(s).
*
*
* @param element
* the element where to start seeking of Widget
* @param class1
@@ -880,7 +883,7 @@ public class WidgetUtil {

/**
* Force webkit to redraw an element
*
*
* @param element
* The element that should be redrawn
*/
@@ -898,7 +901,7 @@ public class WidgetUtil {
* Performs a hack to trigger a re-layout in the IE8. This is usually
* necessary in cases where IE8 "forgets" to update child elements when they
* resize.
*
*
* @param e
* The element to perform the hack on
*/
@@ -912,7 +915,7 @@ public class WidgetUtil {
* Performs a hack to trigger a re-layout in the IE browser. This is usually
* necessary in cases where IE "forgets" to update child elements when they
* resize.
*
*
* @since 7.3
* @param e
* The element to perform the hack on
@@ -926,9 +929,9 @@ public class WidgetUtil {
/**
* Detaches and re-attaches the element from its parent. The element is
* reattached at the same position in the DOM as it was before.
*
*
* Does nothing if the element is not attached to the DOM.
*
*
* @param element
* The element to detach and re-attach
*/
@@ -963,7 +966,7 @@ public class WidgetUtil {

/**
* Returns the index of the childElement within its parent.
*
*
* @param subElement
* @return
*/
@@ -981,7 +984,7 @@ public class WidgetUtil {
* Temporarily sets the {@code styleProperty} to {@code tempValue} and then
* resets it to its current value. Used mainly to work around rendering
* issues in IE (and possibly in other browsers)
*
*
* @param element
* The target element
* @param styleProperty
@@ -1007,7 +1010,7 @@ public class WidgetUtil {
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
*
* @param event
* @return
*/
@@ -1023,7 +1026,7 @@ public class WidgetUtil {
* Find the element corresponding to the coordinates in the passed mouse
* event. Please note that this is not always the same as the target of the
* event e.g. if event capture is used.
*
*
* @param event
* the mouse event to get coordinates from
* @return the element at the coordinates of the event
@@ -1039,7 +1042,7 @@ public class WidgetUtil {
* A helper method to return the client position from an event. Returns
* position from either first changed touch (if touch event) or from the
* event itself.
*
*
* @param event
* @return
*/
@@ -1052,7 +1055,7 @@ public class WidgetUtil {
}

/**
*
*
* @see #getTouchOrMouseClientY(Event)
* @param currentGwtEvent
* @return
@@ -1063,7 +1066,7 @@ public class WidgetUtil {

/**
* @see #getTouchOrMouseClientX(Event)
*
*
* @param event
* @return
*/
@@ -1087,10 +1090,9 @@ public class WidgetUtil {
touch.getClientX(), touch.getClientY(), false, false,
false, false, NativeEvent.BUTTON_LEFT);
final NativeEvent createMouseDownEvent = Document.get()
.createMouseDownEvent(0, touch.getScreenX(),
touch.getScreenY(), touch.getClientX(),
touch.getClientY(), false, false, false, false,
NativeEvent.BUTTON_LEFT);
.createMouseDownEvent(0, touch.getScreenX(), touch.getScreenY(),
touch.getClientX(), touch.getClientY(), false, false,
false, false, NativeEvent.BUTTON_LEFT);
final NativeEvent createMouseClickEvent = Document.get()
.createClickEvent(0, touch.getScreenX(), touch.getScreenY(),
touch.getClientX(), touch.getClientY(), false, false,
@@ -1132,7 +1134,7 @@ public class WidgetUtil {

/**
* Gets the currently focused element.
*
*
* @return The active element or null if no active element could be found.
*/
public native static Element getFocusedElement()
@@ -1146,9 +1148,9 @@ public class WidgetUtil {

/**
* Gets currently focused element and checks if it's editable
*
*
* @since 7.4
*
*
* @return true if focused element is editable
*/
public static boolean isFocusedElementEditable() {
@@ -1170,7 +1172,7 @@ public class WidgetUtil {
* this method checks that this widget nor any of its parents is hidden. Can
* be e.g used to check whether component should react to some events or
* not.
*
*
* @param widget
* @return true if attached and displayed
*/
@@ -1203,7 +1205,7 @@ public class WidgetUtil {
/**
* Scrolls an element into view vertically only. Modified version of
* Element.scrollIntoView.
*
*
* @param elem
* The element to scroll into view
*/
@@ -1238,7 +1240,7 @@ public class WidgetUtil {
/**
* Checks if the given event is either a touch event or caused by the left
* mouse button
*
*
* @param event
* @return true if the event is a touch event or caused by the left mouse
* button, false otherwise
@@ -1251,7 +1253,7 @@ public class WidgetUtil {
/**
* Resolve a relative URL to an absolute URL based on the current document's
* location.
*
*
* @param url
* a string with the relative URL to resolve
* @return the corresponding absolute URL as a string
@@ -1263,8 +1265,8 @@ public class WidgetUtil {
divElement.getStyle().setDisplay(Display.NONE);

RootPanel.getBodyElement().appendChild(divElement);
divElement.setInnerHTML("<a href='" + escapeAttribute(url)
+ "' ></a>");
divElement.setInnerHTML(
"<a href='" + escapeAttribute(url) + "' ></a>");

AnchorElement a = divElement.getChild(0).cast();
String href = a.getHref();
@@ -1280,12 +1282,12 @@ public class WidgetUtil {

/**
* Sets the selection range of an input element.
*
*
* We need this JSNI function to set selection range so that we can use the
* optional direction attribute to set the anchor to the end and the focus
* to the start. This makes Firefox work the same way as other browsers
* (#13477)
*
*
* @param elem
* the html input element.
* @param pos
@@ -1296,7 +1298,7 @@ public class WidgetUtil {
* a string indicating the direction in which the selection was
* performed. This may be "forward" or "backward", or "none" if
* the direction is unknown or irrelevant.
*
*
* @since 7.3
*/
public native static void setSelectionRange(Element elem, int pos,
@@ -1311,7 +1313,7 @@ public class WidgetUtil {

/**
* JavaScript hack to prevent text selection in various browsers.
*
*
* @since 7.6
* @param e
* element for enabling or disabling text selection
@@ -1334,7 +1336,7 @@ public class WidgetUtil {

/**
* JavaScript hack to clear text selection in various browsers.
*
*
* @since 7.6
*/
public native static void clearTextSelection()
@@ -1356,16 +1358,17 @@ public class WidgetUtil {
/**
* Compares two double values with the error margin of
* {@link #PIXEL_EPSILON} (i.e. {@value #PIXEL_EPSILON})
*
*
* @param num1
* the first value for which to compare equality
* @param num2
* the second value for which to compare equality
* @since 7.4
*
*
* @return true if the values are considered equals; false otherwise
*/
public static boolean pixelValuesEqual(final double num1, final double num2) {
public static boolean pixelValuesEqual(final double num1,
final double num2) {
return Math.abs(num1 - num2) <= PIXEL_EPSILON;
}

@@ -1413,7 +1416,7 @@ public class WidgetUtil {
* Wrap a css size value and its unit and translate back and forth to the
* string representation.<br/>
* Eg. 50%, 123px, ...
*
*
* @since 7.2.6
* @author Vaadin Ltd
*/
@@ -1432,7 +1435,7 @@ public class WidgetUtil {

/**
* Gets the unit value by its type.
*
*
* @param type
* the type of the unit as found in the style.
* @return the unit value.
@@ -1449,7 +1452,7 @@ public class WidgetUtil {

/**
* Parse the size from string format to {@link CssSize}.
*
*
* @param s
* the size as string.
* @return a {@link CssSize} object.
@@ -1480,16 +1483,16 @@ public class WidgetUtil {
unit = unitByType(symbol);
}
} else {
throw new IllegalArgumentException("Invalid size argument: \""
+ s + "\" (should match " + sizePattern.getSource()
+ ")");
throw new IllegalArgumentException(
"Invalid size argument: \"" + s + "\" (should match "
+ sizePattern.getSource() + ")");
}
return new CssSize(size, unit);
}

/**
* Creates a {@link CssSize} using a value and its measurement unit.
*
*
* @param value
* the value.
* @param unit
@@ -1517,7 +1520,7 @@ public class WidgetUtil {

/**
* Gets the value for this css size.
*
*
* @return the value.
*/
public float getValue() {
@@ -1526,7 +1529,7 @@ public class WidgetUtil {

/**
* Gets the measurement unit for this css size.
*
*
* @return the unit.
*/
public Unit getUnit() {
@@ -1550,7 +1553,7 @@ public class WidgetUtil {

/**
* Check whether the two sizes are equals.
*
*
* @param cssSize1
* the first size to compare.
* @param cssSize2
@@ -1558,8 +1561,8 @@ public class WidgetUtil {
* @return true if the two sizes are equals, otherwise false.
*/
public static boolean equals(String cssSize1, String cssSize2) {
return CssSize.fromString(cssSize1).equals(
CssSize.fromString(cssSize2));
return CssSize.fromString(cssSize1)
.equals(CssSize.fromString(cssSize2));
}

}
@@ -1573,7 +1576,7 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
@@ -1588,14 +1591,15 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
* @return the bottom border thickness
*/
public static double getBorderBottomThickness(Element element) {
return getBorderThickness(element, new String[] { "borderBottomWidth" });
return getBorderThickness(element,
new String[] { "borderBottomWidth" });
}

/**
@@ -1604,15 +1608,15 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
* @return the top and bottom border thickness
*/
public static double getBorderTopAndBottomThickness(Element element) {
return getBorderThickness(element, new String[] { "borderTopWidth",
"borderBottomWidth" });
return getBorderThickness(element,
new String[] { "borderTopWidth", "borderBottomWidth" });
}

/**
@@ -1620,7 +1624,7 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
@@ -1635,7 +1639,7 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
@@ -1650,15 +1654,15 @@ public class WidgetUtil {
* <p>
* The value is determined using computed style when available and
* calculated otherwise.
*
*
* @since 7.5.0
* @param element
* the element to measure
* @return the top border thickness
*/
public static double getBorderLeftAndRightThickness(Element element) {
return getBorderThickness(element, new String[] { "borderLeftWidth",
"borderRightWidth" });
return getBorderThickness(element,
new String[] { "borderLeftWidth", "borderRightWidth" });
}

private static native double getBorderThickness(
@@ -1684,20 +1688,20 @@ public class WidgetUtil {
}
var heightWithoutBorder = cloneElement.offsetHeight;
parentElement.removeChild(cloneElement);
return heightWithBorder - heightWithoutBorder;
}
}-*/;

/**
* Rounds the given size up to a value which the browser will accept.
*
*
* Safari/WebKit uses 1/64th of a pixel to enable using integer math
* (http://trac.webkit.org/wiki/LayoutUnit).
*
*
* Firefox uses 1/60th of a pixel because it is divisible by three
* (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940)
*
*
* @since 7.5.1
* @param size
* the value to round
@@ -1709,15 +1713,15 @@ public class WidgetUtil {

/**
* Rounds the given size down to a value which the browser will accept.
*
*
* Safari/WebKit uses 1/64th of a pixel to enable using integer math
* (http://trac.webkit.org/wiki/LayoutUnit).
*
*
* Firefox uses 1/60th of a pixel because it is divisible by three
* (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940)
*
*
* IE9+ uses 1/100th of a pixel
*
*
* @since 7.5.1
* @param size
* the value to round
@@ -1750,7 +1754,7 @@ public class WidgetUtil {

/**
* Returns the factor used by browsers to round subpixel values
*
*
* @since 7.5.1
* @return the factor N used by the browser when storing subpixels as X+Y/N
*/

+ 5
- 5
client/src/main/java/com/vaadin/client/annotations/OnStateChange.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,7 +33,7 @@ import com.vaadin.client.communication.StateChangeEvent;
* <p>
* If there is no state variable with the provided name, the widgetset
* compilation will fail.
*
*
* @since 7.2
* @author Vaadin Ltd
*/
@@ -43,7 +43,7 @@ import com.vaadin.client.communication.StateChangeEvent;
public @interface OnStateChange {
/**
* Defines a list of property names to listen for.
*
*
* @return an array of property names, should contain at least one item
*/
public String[] value();

+ 4
- 4
client/src/main/java/com/vaadin/client/communication/AbstractServerConnectorEvent.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -36,7 +36,7 @@ public abstract class AbstractServerConnectorEvent<H extends EventHandler>

/**
* Sends this event to the given handler.
*
*
* @param handler
* The handler to dispatch.
*/

+ 19
- 22
client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java View File

@@ -42,7 +42,7 @@ import elemental.json.JsonObject;
/**
* The default {@link PushConnection} implementation that uses Atmosphere for
* handling the communication channel.
*
*
* @author Vaadin Ltd
* @since 7.1
*/
@@ -140,7 +140,7 @@ public class AtmospherePushConnection implements PushConnection {

/*
* (non-Javadoc)
*
*
* @see
* com.vaadin.client.communication.PushConnection#init(ApplicationConnection
* , Map<String, String>, CommunicationErrorHandler)
@@ -209,8 +209,8 @@ public class AtmospherePushConnection implements PushConnection {

String csrfToken = connection.getMessageHandler().getCsrfToken();
if (!csrfToken.equals(ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE)) {
extraParams += "&" + ApplicationConstants.CSRF_TOKEN_PARAMETER
+ "=" + csrfToken;
extraParams += "&" + ApplicationConstants.CSRF_TOKEN_PARAMETER + "="
+ csrfToken;
}

// uri is needed to identify the right connection when closing
@@ -266,9 +266,8 @@ public class AtmospherePushConnection implements PushConnection {
"This server to client push connection should not be used to send client to server messages");
}
if (state == State.CONNECTED) {
getLogger().info(
"Sending push (" + transport + ") message to server: "
+ message.toJson());
getLogger().info("Sending push (" + transport
+ ") message to server: " + message.toJson());

if (transport.equals("websocket")) {
FragmentedMessage fragmented = new FragmentedMessage(
@@ -295,9 +294,8 @@ public class AtmospherePushConnection implements PushConnection {
}

protected void onReopen(AtmosphereResponse response) {
getLogger().info(
"Push connection re-established using "
+ response.getTransport());
getLogger().info("Push connection re-established using "
+ response.getTransport());
onConnect(response);
}

@@ -310,9 +308,9 @@ public class AtmospherePushConnection implements PushConnection {
/**
* Called whenever a server push connection is established (or
* re-established).
*
*
* @param response
*
*
* @since 7.2
*/
protected void onConnect(AtmosphereResponse response) {
@@ -340,7 +338,7 @@ public class AtmospherePushConnection implements PushConnection {

/*
* (non-Javadoc)
*
*
* @see com.vaadin.client.communication.PushConenction#disconnect()
*/
@Override
@@ -362,7 +360,8 @@ public class AtmospherePushConnection implements PushConnection {
break;
case DISCONNECT_PENDING:
case DISCONNECTED:
throw new IllegalStateException("Can not disconnect more than once");
throw new IllegalStateException(
"Can not disconnect more than once");
}
}

@@ -374,9 +373,8 @@ public class AtmospherePushConnection implements PushConnection {
getConnectionStateHandler().pushInvalidContent(this, message);
return;
} else {
getLogger().info(
"Received push (" + getTransportType() + ") message: "
+ message);
getLogger().info("Received push (" + getTransportType()
+ ") message: " + message);
connection.getMessageHandler().handleMessage(json);
}
}
@@ -386,16 +384,15 @@ public class AtmospherePushConnection implements PushConnection {
* tried
*/
protected void onTransportFailure() {
getLogger().warning(
"Push connection using primary method ("
+ getConfig().getTransport() + ") failed. Trying with "
+ getConfig().getFallbackTransport());
getLogger().warning("Push connection using primary method ("
+ getConfig().getTransport() + ") failed. Trying with "
+ getConfig().getFallbackTransport());
}

/**
* Called if the push connection fails. Atmosphere will automatically retry
* the connection until successful.
*
*
*/
protected void onError(AtmosphereResponse response) {
state = State.DISCONNECTED;

+ 20
- 20
client/src/main/java/com/vaadin/client/communication/ConnectionStateHandler.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,11 +25,11 @@ import elemental.json.JsonObject;
/**
* Interface for handling problems and other events which occur during
* communication with the server.
*
*
* The handler is responsible for handling any problem in XHR, heartbeat and
* push connections in a way it sees fit. The default implementation is
* {@link DefaultConnectionStateHandler}.
*
*
* @since 7.6
* @author Vaadin Ltd
*/
@@ -46,7 +46,7 @@ public interface ConnectionStateHandler {

/**
* Called when an exception occurs during a {@link Heartbeat} request
*
*
* @param request
* The heartbeat request
* @param exception
@@ -56,7 +56,7 @@ public interface ConnectionStateHandler {

/**
* Called when a heartbeat request returns a status code other than OK (200)
*
*
* @param request
* The heartbeat request
* @param response
@@ -74,7 +74,7 @@ public interface ConnectionStateHandler {
* result in the push connection trying a fallback connection method, trying
* to reconnect to the server or might just be an indication that the
* connection was intentionally closed ("unsubscribe"),
*
*
* @param pushConnection
* The push connection which was closed
* @param response
@@ -86,10 +86,10 @@ public interface ConnectionStateHandler {
/**
* Called when a client side timeout occurs before a push connection to the
* server completes.
*
*
* The client side timeout causes a disconnection of the push connection and
* no reconnect will be attempted after this method is called,
*
*
* @param pushConnection
* The push connection which timed out
* @param response
@@ -100,13 +100,13 @@ public interface ConnectionStateHandler {

/**
* Called when a fatal error fatal error occurs in the push connection.
*
*
* The push connection will not try to recover from this situation itself
* and typically the problem handler should not try to do automatic recovery
* either. The cause can be e.g. maximum number of reconnection attempts
* have been reached, neither the selected transport nor the fallback
* transport can be used or similar.
*
*
* @param pushConnection
* The push connection where the error occurred
* @param response
@@ -117,7 +117,7 @@ public interface ConnectionStateHandler {
/**
* Called when the push connection has lost the connection to the server and
* will proceed to try to re-establish the connection
*
*
* @param pushConnection
* The push connection which will be reconnected
*/
@@ -125,7 +125,7 @@ public interface ConnectionStateHandler {

/**
* Called when the push connection to the server has been established.
*
*
* @param pushConnection
* The push connection which was established
*/
@@ -133,7 +133,7 @@ public interface ConnectionStateHandler {

/**
* Called when the required push script could not be loaded
*
*
* @param resourceUrl
* The URL which was used for loading the script
*/
@@ -142,7 +142,7 @@ public interface ConnectionStateHandler {
/**
* Called when an exception occurs during an XmlHttpRequest request to the
* server.
*
*
* @param xhrConnectionError
* An event containing what was being sent to the server and what
* exception occurred
@@ -152,7 +152,7 @@ public interface ConnectionStateHandler {
/**
* Called when invalid content (not JSON) was returned from the server as
* the result of an XmlHttpRequest request
*
*
* @param communicationProblemEvent
* An event containing what was being sent to the server and what
* was returned
@@ -162,7 +162,7 @@ public interface ConnectionStateHandler {
/**
* Called when invalid status code (not 200) was returned by the server as
* the result of an XmlHttpRequest.
*
*
* @param communicationProblemEvent
* An event containing what was being sent to the server and what
* was returned
@@ -177,7 +177,7 @@ public interface ConnectionStateHandler {
/**
* Called when a message is to be sent to the server through the push
* channel but the push channel is not connected
*
*
* @param payload
* The payload to send to the server
*/
@@ -186,7 +186,7 @@ public interface ConnectionStateHandler {
/**
* Called when invalid content (not JSON) was pushed from the server through
* the push connection
*
*
* @param communicationProblemEvent
* An event containing what was being sent to the server and what
* was returned

+ 4
- 4
client/src/main/java/com/vaadin/client/communication/Date_Serializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import elemental.json.JsonValue;

/**
* Client side serializer/deserializer for java.util.Date
*
*
* @since 7.2
* @author Vaadin Ltd
*/

+ 38
- 36
client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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
@@ -42,7 +42,7 @@ import elemental.json.JsonObject;
* <p>
* Handles permanent errors by showing a critical system notification to the
* user
*
*
* @since 7.6
* @author Vaadin Ltd
*/
@@ -78,7 +78,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Checks if this type is of higher priority than the given type
*
*
* @param type
* the type to compare to
* @return true if this type has higher priority than the given type,
@@ -116,7 +116,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Checks if we are currently trying to reconnect
*
*
* @return true if we have noted a problem and are trying to re-establish
* server connection, false otherwise
*/
@@ -130,7 +130,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Returns the connection this handler is connected to
*
*
* @return the connection for this handler
*/
protected ApplicationConnection getConnection() {
@@ -185,7 +185,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
* Called whenever an error occurs in communication which should be handled
* by showing the reconnect dialog and retrying communication until
* successful again
*
*
* @param type
* The type of failure detected
* @param payload
@@ -229,8 +229,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
}

reconnectAttempt++;
getLogger().info(
"Reconnect attempt " + reconnectAttempt + " for " + type);
getLogger()
.info("Reconnect attempt " + reconnectAttempt + " for " + type);

if (reconnectAttempt >= getConfiguration().reconnectAttempts) {
// Max attempts reached, stop trying
@@ -243,10 +243,10 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Called after a problem occurred.
*
*
* This method is responsible for re-sending the payload to the server (if
* not null) or re-send a heartbeat request at some point
*
*
* @param payload
* the payload that did not reach the server, null if the problem
* was detected by a heartbeat
@@ -274,7 +274,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
/**
* Re-sends the payload to the server (if not null) or re-sends a heartbeat
* request immediately
*
*
* @param payload
* the payload that did not reach the server, null if the problem
* was detected by a heartbeat
@@ -283,9 +283,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
if (!connection.isApplicationRunning()) {
// This should not happen as nobody should call this if the
// application has been stopped
getLogger()
.warning(
"Trying to reconnect after application has been stopped. Giving up");
getLogger().warning(
"Trying to reconnect after application has been stopped. Giving up");
return;
}
if (payload != null) {
@@ -309,7 +308,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
/**
* Called when we should give up trying to reconnect and let the user decide
* how to continue
*
*
*/
protected void giveUp() {
reconnectionCause = null;
@@ -340,7 +339,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Checks if the reconnect dialog is visible to the user
*
*
* @return true if the user can see the dialog, false otherwise
*/
protected boolean isDialogVisible() {
@@ -372,7 +371,7 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
/**
* Gets the text to show in the reconnect dialog after giving up (reconnect
* limit reached)
*
*
* @param reconnectAttempt
* The number of the current reconnection attempt
* @return The text to show in the reconnect dialog after giving up
@@ -384,14 +383,14 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

/**
* Gets the text to show in the reconnect dialog
*
*
* @param reconnectAttempt
* The number of the current reconnection attempt
* @return The text to show in the reconnect dialog
*/
protected String getDialogText(int reconnectAttempt) {
return getConfiguration().dialogText.replace("{0}", reconnectAttempt
+ "");
return getConfiguration().dialogText.replace("{0}",
reconnectAttempt + "");
}

@Override
@@ -401,7 +400,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
}

private ReconnectDialogConfigurationState getConfiguration() {
return connection.getUIConnector().getState().reconnectDialogConfiguration;
return connection.getUIConnector()
.getState().reconnectDialogConfiguration;
}

@Override
@@ -416,9 +416,10 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
* has expired.) If the response contains a magic substring, do a
* synchronous refresh. See #8241.
*/
MatchResult refreshToken = RegExp.compile(
ApplicationConnection.UIDL_REFRESH_TOKEN
+ "(:\\s*(.*?))?(\\s|$)").exec(responseText);
MatchResult refreshToken = RegExp
.compile(ApplicationConnection.UIDL_REFRESH_TOKEN
+ "(:\\s*(.*?))?(\\s|$)")
.exec(responseText);
if (refreshToken != null) {
WidgetUtil.redirect(refreshToken.getGroup(2));
} else {
@@ -430,7 +431,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
}

@Override
public void pushInvalidContent(PushConnection pushConnection, String message) {
public void pushInvalidContent(PushConnection pushConnection,
String message) {
debug("pushInvalidContent");
if (pushConnection.isBidirectional()) {
// We can't be sure that what was pushed was actually a response but
@@ -441,8 +443,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

// Do nothing special for now. Should likely do the same as
// xhrInvalidContent
handleUnrecoverableCommunicationError("Invalid JSON from server: "
+ message, null);
handleUnrecoverableCommunicationError(
"Invalid JSON from server: " + message, null);

}

@@ -538,8 +540,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

@Override
public void pushScriptLoadError(String resourceUrl) {
connection.handleCommunicationError(resourceUrl
+ " could not be loaded. Push will not work.", 0);
connection.handleCommunicationError(
resourceUrl + " could not be loaded. Push will not work.", 0);
}

@Override
@@ -550,7 +552,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {

@Override
public void pushReconnectPending(PushConnection pushConnection) {
debug("pushReconnectPending(" + pushConnection.getTransportType() + ")");
debug("pushReconnectPending(" + pushConnection.getTransportType()
+ ")");
getLogger().info("Reopening push connection");
if (pushConnection.isBidirectional()) {
// Lost connection for a connection which will tell us when the
@@ -579,10 +582,9 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
debug("pushClientTimeout()");
// TODO Reconnect, allowing client timeout to be set
// https://dev.vaadin.com/ticket/18429
connection
.handleCommunicationError(
"Client unexpectedly disconnected. Ensure client timeout is disabled.",
-1);
connection.handleCommunicationError(
"Client unexpectedly disconnected. Ensure client timeout is disabled.",
-1);
}

@Override

+ 6
- 5
client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,11 +33,12 @@ import com.vaadin.client.ui.VOverlay;

/**
* The default implementation of the reconnect dialog
*
*
* @since 7.6
* @author Vaadin Ltd
*/
public class DefaultReconnectDialog extends VOverlay implements ReconnectDialog {
public class DefaultReconnectDialog extends VOverlay
implements ReconnectDialog {

private static final String STYLE_RECONNECTING = "active";
private static final String STYLE_BODY_RECONNECTING = "v-reconnecting";

+ 4
- 4
client/src/main/java/com/vaadin/client/communication/DiffJSONSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 elemental.json.JsonValue;
public interface DiffJSONSerializer<T> extends JSONSerializer<T> {
/**
* Update the target object in place based on the passed JSON data.
*
*
* @param target
* @param jsonValue
* @param connection

+ 3
- 3
client/src/main/java/com/vaadin/client/communication/HasJavaScriptConnectorHelper.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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

+ 12
- 11
client/src/main/java/com/vaadin/client/communication/Heartbeat.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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,7 +31,7 @@ import com.vaadin.shared.util.SharedUtil;

/**
* Handles sending of heartbeats to the server and reacting to the response
*
*
* @since 7.2
* @author Vaadin Ltd
*/
@@ -54,7 +54,7 @@ public class Heartbeat {

/**
* Initializes the heartbeat for the given application connection
*
*
* @param connection
* the connection
*/
@@ -63,9 +63,10 @@ public class Heartbeat {

setInterval(connection.getConfiguration().getHeartbeatInterval());

uri = SharedUtil.addGetParameters(connection
.translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+ ApplicationConstants.HEARTBEAT_PATH + '/'),
uri = SharedUtil.addGetParameters(
connection.translateVaadinUri(
ApplicationConstants.APP_PROTOCOL_PREFIX
+ ApplicationConstants.HEARTBEAT_PATH + '/'),
UIConstants.UI_ID_PARAMETER + "="
+ connection.getConfiguration().getUIId());

@@ -111,8 +112,8 @@ public class Heartbeat {
public void onError(Request request, Throwable exception) {
// Handler should stop the application if heartbeat should no
// longer be sent
connection.getConnectionStateHandler().heartbeatException(
request, exception);
connection.getConnectionStateHandler()
.heartbeatException(request, exception);
schedule();
}
};
@@ -160,7 +161,7 @@ public class Heartbeat {

/**
* Changes the heartbeatInterval in runtime and applies it.
*
*
* @param heartbeatInterval
* new interval in seconds.
*/

+ 7
- 7
client/src/main/java/com/vaadin/client/communication/JSONSerializer.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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 @@ import elemental.json.JsonValue;
* <p>
* This is the client side interface, see
* com.vaadin.server.communication.JSONSerializer for the server side interface.
*
*
* @since 7.0
*/
public interface JSONSerializer<T> {
@@ -43,14 +43,14 @@ public interface JSONSerializer<T> {
* Creates and deserializes an object received from the server. Must be
* compatible with {@link #serialize(Object, ApplicationConnection)} and
* also with the server side JsonCodec.encode method.
*
*
* @param type
* the type to deserialize
* @param jsonValue
* JSON map from property name to property value
* @param connection
* the application connection providing the context
*
*
* @return A deserialized object
*/
T deserialize(Type type, JsonValue jsonValue,
@@ -60,7 +60,7 @@ public interface JSONSerializer<T> {
* Serialize the given object into JSON. Must be compatible with
* {@link #deserialize(Type, JsonValue, ApplicationConnection)} and also
* with the server side JsonCodec.decodeCustomType method.
*
*
* @param value
* The object to serialize
* @param connection

+ 4
- 4
client/src/main/java/com/vaadin/client/communication/JavaScriptMethodInvocation.java View File

@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
*
*
* 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.vaadin.shared.communication.MethodInvocation;
/**
* A {@link MethodInvocation} that originates from JavaScript. This means that
* there might not be any type information available on the client.
*
*
* @author Vaadin Ltd
* @since 7.0.0
*/

+ 0
- 0
client/src/main/java/com/vaadin/client/communication/JsonDecoder.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save