Browse Source

Format using Eclipse Neon

Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
tags/8.0.0.alpha1
Artur Signell 7 years ago
parent
commit
6d54d78944
100 changed files with 1279 additions and 1231 deletions
  1. 9
    10
      all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java
  2. 6
    6
      all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java
  3. 12
    12
      buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java
  4. 10
    9
      buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java
  5. 12
    12
      buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java
  6. 12
    13
      client-compiler/src/main/java/com/vaadin/sass/linker/SassLinker.java
  7. 10
    9
      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. 5
    10
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ClientRpcVisitor.java
  10. 26
    27
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java
  11. 5
    4
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/FieldProperty.java
  12. 2
    2
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/JsonSerializer.java
  13. 13
    13
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java
  14. 6
    6
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/Property.java
  15. 17
    20
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java
  16. 2
    1
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/ServerRpcVisitor.java
  17. 2
    2
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/StateInitVisitor.java
  18. 6
    11
      client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/WidgetInitVisitor.java
  19. 14
    15
      client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java
  20. 10
    10
      client-compiler/src/main/java/com/vaadin/tools/CvalChecker.java
  21. 2
    2
      client-compiler/src/main/java/com/vaadin/tools/WidgetsetCompiler.java
  22. 2
    2
      client-compiler/src/test/java/com/vaadin/tools/CvalAddonsCheckerTest.java
  23. 8
    9
      client-compiler/src/test/java/com/vaadin/tools/CvalAddonstCheckerUseCasesTest.java
  24. 44
    44
      client-compiler/src/test/java/com/vaadin/tools/CvalCheckerTest.java
  25. 8
    8
      client/src/main/java/com/vaadin/client/AnimationUtil.java
  26. 12
    10
      client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
  27. 40
    48
      client/src/main/java/com/vaadin/client/ApplicationConnection.java
  28. 2
    2
      client/src/main/java/com/vaadin/client/BrowserInfo.java
  29. 6
    6
      client/src/main/java/com/vaadin/client/CSSRule.java
  30. 4
    4
      client/src/main/java/com/vaadin/client/ComputedStyle.java
  31. 4
    4
      client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java
  32. 2
    1
      client/src/main/java/com/vaadin/client/ConnectorMap.java
  33. 16
    16
      client/src/main/java/com/vaadin/client/DateTimeService.java
  34. 6
    3
      client/src/main/java/com/vaadin/client/EventHelper.java
  35. 2
    2
      client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java
  36. 30
    30
      client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
  37. 118
    97
      client/src/main/java/com/vaadin/client/LayoutManager.java
  38. 4
    4
      client/src/main/java/com/vaadin/client/MeasuredSize.java
  39. 24
    27
      client/src/main/java/com/vaadin/client/Profiler.java
  40. 2
    2
      client/src/main/java/com/vaadin/client/ResourceLoader.java
  41. 2
    1
      client/src/main/java/com/vaadin/client/ServerConnector.java
  42. 10
    7
      client/src/main/java/com/vaadin/client/SimpleTree.java
  43. 14
    15
      client/src/main/java/com/vaadin/client/SuperDevMode.java
  44. 2
    1
      client/src/main/java/com/vaadin/client/TooltipInfo.java
  45. 6
    7
      client/src/main/java/com/vaadin/client/UIDL.java
  46. 26
    21
      client/src/main/java/com/vaadin/client/Util.java
  47. 14
    14
      client/src/main/java/com/vaadin/client/VCaption.java
  48. 2
    4
      client/src/main/java/com/vaadin/client/VErrorMessage.java
  49. 33
    31
      client/src/main/java/com/vaadin/client/VTooltip.java
  50. 4
    5
      client/src/main/java/com/vaadin/client/VUIDLBrowser.java
  51. 3
    1
      client/src/main/java/com/vaadin/client/WidgetLoader.java
  52. 6
    8
      client/src/main/java/com/vaadin/client/WidgetSet.java
  53. 42
    38
      client/src/main/java/com/vaadin/client/WidgetUtil.java
  54. 15
    18
      client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java
  55. 23
    21
      client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java
  56. 2
    1
      client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java
  57. 6
    5
      client/src/main/java/com/vaadin/client/communication/Heartbeat.java
  58. 18
    14
      client/src/main/java/com/vaadin/client/communication/JsonDecoder.java
  59. 17
    16
      client/src/main/java/com/vaadin/client/communication/JsonEncoder.java
  60. 179
    174
      client/src/main/java/com/vaadin/client/communication/MessageHandler.java
  61. 10
    14
      client/src/main/java/com/vaadin/client/communication/MessageSender.java
  62. 2
    2
      client/src/main/java/com/vaadin/client/communication/PushConnection.java
  63. 12
    11
      client/src/main/java/com/vaadin/client/communication/RpcManager.java
  64. 7
    7
      client/src/main/java/com/vaadin/client/communication/RpcProxy.java
  65. 10
    11
      client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java
  66. 10
    6
      client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java
  67. 7
    8
      client/src/main/java/com/vaadin/client/communication/XhrConnection.java
  68. 5
    4
      client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java
  69. 23
    19
      client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
  70. 4
    4
      client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java
  71. 21
    16
      client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
  72. 13
    14
      client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java
  73. 2
    2
      client/src/main/java/com/vaadin/client/connectors/AbstractSelectionModelConnector.java
  74. 2
    1
      client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java
  75. 13
    12
      client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java
  76. 2
    1
      client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java
  77. 35
    31
      client/src/main/java/com/vaadin/client/connectors/GridConnector.java
  78. 10
    10
      client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
  79. 16
    12
      client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java
  80. 2
    2
      client/src/main/java/com/vaadin/client/connectors/NoSelectionModelConnector.java
  81. 2
    3
      client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java
  82. 2
    2
      client/src/main/java/com/vaadin/client/connectors/ProgressBarRendererConnector.java
  83. 2
    2
      client/src/main/java/com/vaadin/client/connectors/RpcDataSourceConnector.java
  84. 6
    6
      client/src/main/java/com/vaadin/client/connectors/SingleSelectionModelConnector.java
  85. 2
    2
      client/src/main/java/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java
  86. 14
    9
      client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java
  87. 6
    6
      client/src/main/java/com/vaadin/client/data/CacheStrategy.java
  88. 14
    15
      client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java
  89. 4
    4
      client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java
  90. 1
    1
      client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java
  91. 2
    2
      client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java
  92. 10
    10
      client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java
  93. 2
    2
      client/src/main/java/com/vaadin/client/debug/internal/Highlight.java
  94. 6
    6
      client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java
  95. 6
    5
      client/src/main/java/com/vaadin/client/debug/internal/LogSection.java
  96. 2
    2
      client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java
  97. 2
    2
      client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java
  98. 9
    7
      client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java
  99. 2
    1
      client/src/main/java/com/vaadin/client/debug/internal/Section.java
  100. 0
    0
      client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java

+ 9
- 10
all/src/main/java/com/vaadin/buildhelpers/FetchReleaseNotesAuthors.java View File

@@ -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);
}
}

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

@@ -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;
}


+ 10
- 9
buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java View File

@@ -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);
}

@@ -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;
}


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

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

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

@@ -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);

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

@@ -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();

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

@@ -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 {

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

@@ -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(";");

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

@@ -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");


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

@@ -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;
@@ -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;

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

@@ -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;
}

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

@@ -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];

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

@@ -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);
}

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

@@ -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());

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

@@ -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 "

+ 14
- 15
client-compiler/src/main/java/com/vaadin/tools/CvalAddonsChecker.java View File

@@ -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) {
@@ -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"

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

@@ -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);
}

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

@@ -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();
}

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

@@ -65,7 +65,7 @@ public class AnimationUtil {
var callbackFunc = $entry(function(e) {
listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e);
});
elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false);
// Store function reference for later removal
@@ -111,7 +111,7 @@ public class AnimationUtil {
return event.mozAnimationName;
else if(event.oAnimationName)
return event.oAnimationName;
return "";
}-*/;

@@ -119,22 +119,22 @@ public class AnimationUtil {
public static native String getAnimationName(ComputedStyle cstyle)
/*-{
var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle;
if(!cs.getPropertyValue)
return "";
if(cs.getPropertyValue("-webkit-animation-name"))
return cs.getPropertyValue("-webkit-animation-name");
else if(cs.getPropertyValue("animation-name"))
return cs.getPropertyValue("animation-name");
else if(cs.getPropertyValue("-moz-animation-name"))
return cs.getPropertyValue("-moz-animation-name");
else if(cs.getPropertyValue("-o-animation-name"))
return cs.getPropertyValue("-o-animation-name");
return "";
}-*/;


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

@@ -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");
@@ -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);
@@ -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
@@ -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");
}
});


+ 40
- 48
client/src/main/java/com/vaadin/client/ApplicationConnection.java View File

@@ -109,9 +109,8 @@ public class ApplicationConnection implements HasHandlers {
* <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);
@@ -242,8 +242,8 @@ public class ApplicationConnection implements HasHandlers {
* @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>();

@@ -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()
@@ -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
@@ -483,7 +482,7 @@ public class ApplicationConnection implements HasHandlers {
return vi;
}
}
client.getProfilingData = $entry(function() {
var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()();
var pd = [
@@ -498,7 +497,7 @@ public class ApplicationConnection implements HasHandlers {
pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime;
return pd;
});
client.getElementByPath = $entry(function(id) {
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id);
});
@@ -515,7 +514,7 @@ public class ApplicationConnection implements HasHandlers {
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element);
});
client.initializing = false;
$wnd.vaadin.clients[TTAppId] = client;
}-*/;

@@ -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;
@@ -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);
}
@@ -1361,9 +1358,8 @@ 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));
}

/**
@@ -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;
}
@@ -1474,37 +1468,35 @@ public class ApplicationConnection implements HasHandlers {
* @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");
}
}
}

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

@@ -453,8 +453,8 @@ public class BrowserInfo {
* otherwise
*/
public boolean isAndroidWithBrokenScrollTop() {
return isAndroid()
&& (getOperatingSystemMajorVersion() == 3 || getOperatingSystemMajorVersion() == 4);
return isAndroid() && (getOperatingSystemMajorVersion() == 3
|| getOperatingSystemMajorVersion() == 4);
}

public boolean isAndroid23() {

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

@@ -63,11 +63,11 @@ public class CSSRule {
/*-{
if(!$doc.styleSheets)
return null;
selector = selector.toLowerCase();
var allMatches = [];
// IE handles imported sheet differently
if(deep && sheet.imports && sheet.imports.length > 0) {
for(var i=0; i < sheet.imports.length; i++) {
@@ -76,13 +76,13 @@ public class CSSRule {
allMatches.concat(imports);
}
}
var theRules = new Array();
if (sheet.cssRules)
theRules = sheet.cssRules
else if (sheet.rules)
theRules = sheet.rules
var j = theRules.length;
for(var i=0; i<j; i++) {
var r = theRules[i];
@@ -102,7 +102,7 @@ public class CSSRule {
allMatches = allMatches.concat(imports);
}
}
return allMatches;
}-*/;


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

@@ -78,7 +78,7 @@ public class ComputedStyle {
if(borderStyle == "none")
return "0px";
}
if(cs.getPropertyValue) {
// Convert name to dashed format
@@ -89,10 +89,10 @@ public class ComputedStyle {
var ret = cs[name];
var style = elem.style;
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
@@ -124,7 +124,7 @@ public class ComputedStyle {
} else if (name == "height" && ret == "auto") {
ret = elem.clientHeight + "px";
}
return ret;
}-*/;

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

@@ -34,8 +34,8 @@ import com.vaadin.client.ui.AbstractHasComponentsConnector;
* @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.
*/
@@ -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

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

@@ -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();
}


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

@@ -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;
@@ -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;

@@ -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 + "'");
}
}

@@ -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;

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

@@ -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);
}
@@ -126,14 +127,16 @@ public class EventHelper {
* 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);

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

@@ -25,8 +25,8 @@ import com.vaadin.client.ui.layout.ElementResizeListener;
* @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.

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

@@ -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;

@@ -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",
@@ -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();

+ 118
- 97
client/src/main/java/com/vaadin/client/LayoutManager.java View File

@@ -240,9 +240,8 @@ public class LayoutManager {
}
layoutCounts.put(layout.getConnectorId(), count);
if (count.intValue() > 2) {
getLogger().severe(
Util.getConnectorString(layout) + " has been layouted "
+ count.intValue() + " times");
getLogger().severe(Util.getConnectorString(layout)
+ " has been layouted " + count.intValue() + " times");
}
}

@@ -321,8 +320,8 @@ public class LayoutManager {
for (int i = 0; i < dumpLength; i++) {
ServerConnector connector = connectorMap.getConnector(dump.get(i));
if (connector != null) {
currentDependencyTree.setNeedsMeasure(
(ComponentConnector) connector, true);
currentDependencyTree
.setNeedsMeasure((ComponentConnector) connector, true);
}
}
needsMeasure = FastStringSet.create();
@@ -357,23 +356,27 @@ public class LayoutManager {
Collection<ElementResizeListener> listeners = elementResizeListeners
.get(element);
if (listeners != null) {
Profiler.enter("Layout fire resize events - listeners not null");
Profiler.enter("ElementResizeListener.onElementResize copy list");
ElementResizeListener[] array = listeners
.toArray(new ElementResizeListener[listeners
.size()]);
Profiler.leave("ElementResizeListener.onElementResize copy list");
Profiler.enter(
"Layout fire resize events - listeners not null");
Profiler.enter(
"ElementResizeListener.onElementResize copy list");
ElementResizeListener[] array = listeners.toArray(
new ElementResizeListener[listeners.size()]);
Profiler.leave(
"ElementResizeListener.onElementResize copy list");
ElementResizeEvent event = new ElementResizeEvent(this,
element);
for (ElementResizeListener listener : array) {
try {
String key = null;
if (Profiler.isEnabled()) {
Profiler.enter("ElementResizeListener.onElementResize construct profiler key");
Profiler.enter(
"ElementResizeListener.onElementResize construct profiler key");
key = "ElementResizeListener.onElementResize for "
+ listener.getClass()
.getSimpleName();
Profiler.leave("ElementResizeListener.onElementResize construct profiler key");
Profiler.leave(
"ElementResizeListener.onElementResize construct profiler key");
Profiler.enter(key);
}

@@ -386,7 +389,8 @@ public class LayoutManager {
"Error in resize listener", e);
}
}
Profiler.leave("Layout fire resize events - listeners not null");
Profiler.leave(
"Layout fire resize events - listeners not null");
}
}
listenersToFire.clear();
@@ -451,10 +455,9 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
getLogger()
.log(Level.SEVERE,
"Error in SimpleManagedLayout (horizontal) handling",
e);
getLogger().log(Level.SEVERE,
"Error in SimpleManagedLayout (horizontal) handling",
e);

}
countLayout(layoutCounts, rr);
@@ -488,10 +491,9 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
getLogger()
.log(Level.SEVERE,
"Error in DirectionalManagedLayout handling",
e);
getLogger().log(Level.SEVERE,
"Error in DirectionalManagedLayout handling",
e);
}
countLayout(layoutCounts, cl);
} else {
@@ -514,10 +516,9 @@ public class LayoutManager {
Profiler.leave(key);
}
} catch (RuntimeException e) {
getLogger()
.log(Level.SEVERE,
"Error in SimpleManagedLayout (vertical) handling",
e);
getLogger().log(Level.SEVERE,
"Error in SimpleManagedLayout (vertical) handling",
e);
}
countLayout(layoutCounts, rr);
}
@@ -544,8 +545,9 @@ public class LayoutManager {
}
String connectorString = changedCids.get(i);
if (changedCids.length() < 10) {
ServerConnector connector = ConnectorMap.get(
connection).getConnector(connectorString);
ServerConnector connector = ConnectorMap
.get(connection)
.getConnector(connectorString);
connectorString = Util
.getConnectorString(connector);
}
@@ -557,18 +559,17 @@ public class LayoutManager {

Profiler.leave("Layout pass");

getLogger()
.info("Pass " + passes + " measured "
+ measuredConnectorCount + " elements, fired "
+ firedListeners + " listeners and did "
+ layoutCount + " layouts.");
getLogger().info("Pass " + passes + " measured "
+ measuredConnectorCount + " elements, fired "
+ firedListeners + " listeners and did " + layoutCount
+ " layouts.");

if (passes > 100) {
getLogger().severe(LOOP_ABORT_MESSAGE);
if (ApplicationConfiguration.isDebugMode()) {
VNotification.createNotification(
VNotification.DELAY_FOREVER,
connection.getUIConnector().getWidget())
VNotification
.createNotification(VNotification.DELAY_FOREVER,
connection.getUIConnector().getWidget())
.show(LOOP_ABORT_MESSAGE, VNotification.CENTERED,
"error");
}
@@ -601,15 +602,14 @@ public class LayoutManager {

cleanMeasuredSizes();

getLogger().info(
"Total layout phase time: " + totalDuration.elapsedMillis()
+ "ms");
getLogger().info("Total layout phase time: "
+ totalDuration.elapsedMillis() + "ms");
}

private void logConnectorStatus(int connectorId) {
currentDependencyTree
.logDependencyStatus((ComponentConnector) ConnectorMap.get(
connection).getConnector(Integer.toString(connectorId)));
currentDependencyTree.logDependencyStatus(
(ComponentConnector) ConnectorMap.get(connection)
.getConnector(Integer.toString(connectorId)));
}

private int measureConnectors(LayoutDependencyTree layoutDependencyTree,
@@ -637,12 +637,10 @@ public class LayoutManager {
}

if (debugLogging) {
getLogger()
.info("Doing overflow fix for "
+ Util.getConnectorString(componentConnector)
+ " in "
+ Util.getConnectorString(componentConnector
.getParent()));
getLogger().info("Doing overflow fix for "
+ Util.getConnectorString(componentConnector)
+ " in " + Util.getConnectorString(
componentConnector.getParent()));
}
Profiler.enter("Overflow fix apply");

@@ -760,9 +758,8 @@ public class LayoutManager {
return true;
}
ServerConnector parent = componentConnector.getParent();
if (parent instanceof ComponentConnector
&& !currentDependencyTree
.noMoreChangesExpected((ComponentConnector) parent)) {
if (parent instanceof ComponentConnector && !currentDependencyTree
.noMoreChangesExpected((ComponentConnector) parent)) {
return true;
}

@@ -819,9 +816,8 @@ public class LayoutManager {
measuredAndUpdate(element, getMeasuredSize(element, null));
}
Profiler.leave("LayoutManager.measureNonConenctors");
getLogger().info(
"Measured " + measuredNonConnectorElements.size()
+ " non connector elements");
getLogger().info("Measured " + measuredNonConnectorElements.size()
+ " non connector elements");
}

private MeasureResult measuredAndUpdate(Element element,
@@ -916,9 +912,8 @@ public class LayoutManager {
*/
public final void setNeedsHorizontalLayout(ManagedLayout layout) {
if (isLayoutRunning()) {
getLogger()
.warning(
"setNeedsHorizontalLayout should not be run while a layout phase is in progress.");
getLogger().warning(
"setNeedsHorizontalLayout should not be run while a layout phase is in progress.");
}
needsHorizontalLayout.add(layout.getConnectorId());
}
@@ -942,9 +937,8 @@ public class LayoutManager {
*/
public final void setNeedsVerticalLayout(ManagedLayout layout) {
if (isLayoutRunning()) {
getLogger()
.warning(
"setNeedsVerticalLayout should not be run while a layout phase is in progress.");
getLogger().warning(
"setNeedsVerticalLayout should not be run while a layout phase is in progress.");
}
needsVerticalLayout.add(layout.getConnectorId());
}
@@ -972,9 +966,10 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final int getOuterHeight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
return (int) Math.ceil(getMeasuredSize(element, nullSize)
.getOuterHeight());
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return (int) Math
.ceil(getMeasuredSize(element, nullSize).getOuterHeight());
}

/**
@@ -998,7 +993,8 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final double getOuterHeightDouble(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getOuterHeight();
}

@@ -1026,9 +1022,10 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final int getOuterWidth(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
return (int) Math.ceil(getMeasuredSize(element, nullSize)
.getOuterWidth());
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return (int) Math
.ceil(getMeasuredSize(element, nullSize).getOuterWidth());
}

/**
@@ -1051,7 +1048,8 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final double getOuterWidthDouble(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getOuterWidth();
}

@@ -1078,9 +1076,10 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final int getInnerHeight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
return (int) Math.ceil(getMeasuredSize(element, nullSize)
.getInnerHeight());
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return (int) Math
.ceil(getMeasuredSize(element, nullSize).getInnerHeight());
}

/**
@@ -1104,7 +1103,8 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final double getInnerHeightDouble(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getInnerHeight();
}

@@ -1131,9 +1131,10 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final int getInnerWidth(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
return (int) Math.ceil(getMeasuredSize(element, nullSize)
.getInnerWidth());
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return (int) Math
.ceil(getMeasuredSize(element, nullSize).getInnerWidth());
}

/**
@@ -1157,7 +1158,8 @@ public class LayoutManager {
* borders) of the element in pixels.
*/
public final double getInnerWidthDouble(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getInnerWidth();
}

@@ -1182,7 +1184,8 @@ public class LayoutManager {
* element in pixels.
*/
public final int getBorderHeight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderHeight();
}

@@ -1207,7 +1210,8 @@ public class LayoutManager {
* element in pixels.
*/
public int getPaddingHeight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingHeight();
}

@@ -1232,7 +1236,8 @@ public class LayoutManager {
* element in pixels.
*/
public int getBorderWidth(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderWidth();
}

@@ -1255,7 +1260,8 @@ public class LayoutManager {
* @return the measured top border of the element in pixels.
*/
public int getBorderTop(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderTop();
}

@@ -1278,7 +1284,8 @@ public class LayoutManager {
* @return the measured left border of the element in pixels.
*/
public int getBorderLeft(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderLeft();
}

@@ -1301,7 +1308,8 @@ public class LayoutManager {
* @return the measured bottom border of the element in pixels.
*/
public int getBorderBottom(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderBottom();
}

@@ -1324,7 +1332,8 @@ public class LayoutManager {
* @return the measured right border of the element in pixels.
*/
public int getBorderRight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getBorderRight();
}

@@ -1349,7 +1358,8 @@ public class LayoutManager {
* element in pixels.
*/
public int getPaddingWidth(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingWidth();
}

@@ -1372,7 +1382,8 @@ public class LayoutManager {
* @return the measured top padding of the element in pixels.
*/
public int getPaddingTop(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingTop();
}

@@ -1395,7 +1406,8 @@ public class LayoutManager {
* @return the measured left padding of the element in pixels.
*/
public int getPaddingLeft(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingLeft();
}

@@ -1418,7 +1430,8 @@ public class LayoutManager {
* @return the measured bottom padding of the element in pixels.
*/
public int getPaddingBottom(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingBottom();
}

@@ -1441,7 +1454,8 @@ public class LayoutManager {
* @return the measured right padding of the element in pixels.
*/
public int getPaddingRight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getPaddingRight();
}

@@ -1464,7 +1478,8 @@ public class LayoutManager {
* @return the measured top margin of the element in pixels.
*/
public int getMarginTop(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginTop();
}

@@ -1487,7 +1502,8 @@ public class LayoutManager {
* @return the measured right margin of the element in pixels.
*/
public int getMarginRight(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginRight();
}

@@ -1510,7 +1526,8 @@ public class LayoutManager {
* @return the measured bottom margin of the element in pixels.
*/
public int getMarginBottom(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginBottom();
}

@@ -1533,7 +1550,8 @@ public class LayoutManager {
* @return the measured left margin of the element in pixels.
*/
public int getMarginLeft(Element element) {
assert needsMeasure(element) : "Getting measurement for element that is not measured";
assert needsMeasure(
element) : "Getting measurement for element that is not measured";
return getMeasuredSize(element, nullSize).getMarginLeft();
}

@@ -1594,7 +1612,8 @@ public class LayoutManager {
* the new outer height (including margins, borders and paddings)
* of the component in pixels
*/
public void reportOuterHeight(ComponentConnector component, int outerHeight) {
public void reportOuterHeight(ComponentConnector component,
int outerHeight) {
Element element = component.getWidget().getElement();
MeasuredSize measuredSize = getMeasuredSize(element);
if (isLayoutRunning()) {
@@ -1627,8 +1646,8 @@ public class LayoutManager {
int assignedHeight) {
assert component.isRelativeHeight();

float percentSize = parsePercent(component.getState().height == null ? ""
: component.getState().height);
float percentSize = parsePercent(component.getState().height == null
? "" : component.getState().height);
int effectiveHeight = Math.round(assignedHeight * (percentSize / 100));

reportOuterHeight(component, effectiveHeight);
@@ -1792,7 +1811,8 @@ public class LayoutManager {

if (component instanceof HasComponentsConnector) {
HasComponentsConnector hasComponents = (HasComponentsConnector) component;
for (ComponentConnector child : hasComponents.getChildComponents()) {
for (ComponentConnector child : hasComponents
.getChildComponents()) {
setNeedsMeasureRecursively(child);
}
}
@@ -1820,7 +1840,8 @@ public class LayoutManager {
* false otherwise
*/
public boolean isLayoutNeeded() {
if (!needsHorizontalLayout.isEmpty() || !needsVerticalLayout.isEmpty()) {
if (!needsHorizontalLayout.isEmpty()
|| !needsVerticalLayout.isEmpty()) {
return true;
}
if (!needsMeasure.isEmpty()) {

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

@@ -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());
}
}


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

@@ -197,7 +197,8 @@ public class Profiler {
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);
@@ -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()

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

@@ -533,12 +533,12 @@ public class ResourceLoader {
if (rules === undefined) {
rules = sheet.rules;
}
if (rules === null) {
// Style sheet loaded, but can't access length because of XSS -> assume there's something there
return 1;
}
// Return length so we can distinguish 0 (probably 404 error) from normal case.
return rules.length;
} catch (err) {

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

@@ -84,7 +84,8 @@ public interface ServerConnector extends Connector {
* @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

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

@@ -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);
}
}
@@ -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);
}

}

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

@@ -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();

}
@@ -227,12 +225,12 @@ public class SuperDevMode {
var mod = $wnd.__gwt_activeModules[moduleName];
if (!mod)
return false;
if (mod.superdevmode) {
// Running in super dev mode already, it is supported
return true;
}
return !!mod.canRedirect;
}-*/;

@@ -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);

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

@@ -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);
}
}

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

@@ -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;
@@ -522,8 +521,8 @@ public final class UIDL extends JavaScriptObject {
*/
public ServerConnector getPaintableAttribute(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringAttribute(name));
return ConnectorMap.get(connection)
.getConnector(getStringAttribute(name));
}

/**
@@ -535,8 +534,8 @@ public final class UIDL extends JavaScriptObject {
*/
public ServerConnector getPaintableVariable(String name,
ApplicationConnection connection) {
return ConnectorMap.get(connection).getConnector(
getStringVariable(name));
return ConnectorMap.get(connection)
.getConnector(getStringVariable(name));
}

/**

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

@@ -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);
}

/**
@@ -441,7 +441,8 @@ public class Util {
* @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);
}

@@ -535,7 +536,8 @@ public class Util {
* @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);
}

@@ -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;
}
@@ -623,8 +626,8 @@ public class Util {
* @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)) {
@@ -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));
@@ -763,22 +765,24 @@ public class Util {
* @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);
}
}

@@ -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();

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

@@ -94,7 +94,8 @@ public class VCaption extends HTML {
* @param client
* ApplicationConnection
*/
public VCaption(ComponentConnector component, ApplicationConnection client) {
public VCaption(ComponentConnector component,
ApplicationConnection client) {
super();
this.client = client;
owner = component;
@@ -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.");
}
}
}
@@ -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;
}
}

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

@@ -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();


+ 33
- 31
client/src/main/java/com/vaadin/client/VTooltip.java View File

@@ -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();

@@ -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 {
@@ -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();
}
@@ -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
@@ -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
@@ -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;
}

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

@@ -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);

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

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

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

@@ -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);
}
@@ -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

+ 42
- 38
client/src/main/java/com/vaadin/client/WidgetUtil.java View File

@@ -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 {
@@ -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;

@@ -541,7 +542,8 @@ public class WidgetUtil {
* 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);
@@ -772,7 +774,8 @@ public class WidgetUtil {
* 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")) {
@@ -800,7 +803,7 @@ public class WidgetUtil {
com.google.gwt.dom.client.Element el, String p)
/*-{
try {
if (el.currentStyle) {
// IE
return el.currentStyle[p];
@@ -815,7 +818,7 @@ public class WidgetUtil {
} catch (e) {
return "";
}
}-*/;

/**
@@ -829,7 +832,7 @@ public class WidgetUtil {
try {
el.focus();
} catch (e) {
}
}-*/;

@@ -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,
@@ -1140,7 +1142,7 @@ public class WidgetUtil {
if ($wnd.document.activeElement) {
return $wnd.document.activeElement;
}
return null;
}-*/;

@@ -1211,11 +1213,11 @@ public class WidgetUtil {
/*-{
var top = elem.offsetTop;
var height = elem.offsetHeight;
if (elem.parentNode != elem.offsetParent) {
top -= elem.parentNode.offsetTop;
}
var cur = elem.parentNode;
while (cur && (cur.nodeType == 1)) {
if (top < cur.scrollTop) {
@@ -1224,12 +1226,12 @@ public class WidgetUtil {
if (top + height > cur.scrollTop + cur.clientHeight) {
cur.scrollTop = (top + height) - cur.clientHeight;
}
var offsetTop = cur.offsetTop;
if (cur.parentNode != cur.offsetParent) {
offsetTop -= cur.parentNode.offsetTop;
}
top += offsetTop - cur.scrollTop;
cur = cur.parentNode;
}
@@ -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();
@@ -1365,7 +1367,8 @@ public class WidgetUtil {
*
* @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;
}

@@ -1480,9 +1483,9 @@ 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);
}
@@ -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));
}

}
@@ -1595,7 +1598,8 @@ public class WidgetUtil {
* @return the bottom border thickness
*/
public static double getBorderBottomThickness(Element element) {
return getBorderThickness(element, new String[] { "borderBottomWidth" });
return getBorderThickness(element,
new String[] { "borderBottomWidth" });
}

/**
@@ -1611,8 +1615,8 @@ public class WidgetUtil {
* @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" });
}

/**
@@ -1657,8 +1661,8 @@ public class WidgetUtil {
* @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(

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

@@ -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);
}

@@ -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,10 +384,9 @@ 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());
}

/**
@@ -529,7 +526,7 @@ public class AtmospherePushConnection implements PushConnection {
JavaScriptObject config)
/*-{
var self = this;
config.url = uri;
config.onOpen = $entry(function(response) {
self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response);
@@ -555,7 +552,7 @@ public class AtmospherePushConnection implements PushConnection {
config.onClientTimeout = $entry(function(request) {
self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request);
});
return $wnd.vaadinPush.atmosphere.subscribe(config);
}-*/;


+ 23
- 21
client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java View File

@@ -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
@@ -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) {
@@ -390,8 +389,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler {
* @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

+ 2
- 1
client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java View File

@@ -37,7 +37,8 @@ import com.vaadin.client.ui.VOverlay;
* @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";

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

@@ -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();
}
};

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

@@ -119,8 +119,8 @@ public class JsonDecoder {
} else if (Character.class.getName().equals(baseTypeName)) {
return Character.valueOf(jsonValue.asString().charAt(0));
} else if (Connector.class.getName().equals(baseTypeName)) {
return ConnectorMap.get(connection).getConnector(
jsonValue.asString());
return ConnectorMap.get(connection)
.getConnector(jsonValue.asString());
} else {
return decodeObject(type, jsonValue, target, connection);
}
@@ -169,12 +169,15 @@ public class JsonDecoder {
propertyReference = null;
}

Profiler.leave("JsonDecoder.decodeObject meta data processing");
JsonValue encodedPropertyValue = jsonObject.get(property
.getName());
Profiler.leave(
"JsonDecoder.decodeObject meta data processing");
JsonValue encodedPropertyValue = jsonObject
.get(property.getName());
Object decodedValue = decodeValue(propertyType,
encodedPropertyValue, propertyReference, connection);
Profiler.enter("JsonDecoder.decodeObject meta data processing");
encodedPropertyValue, propertyReference,
connection);
Profiler.enter(
"JsonDecoder.decodeObject meta data processing");
property.setValue(target, decodedValue);
}
Profiler.leave("JsonDecoder.decodeObject meta data processing");
@@ -183,8 +186,8 @@ public class JsonDecoder {
} catch (NoDataException e) {
Profiler.leave("JsonDecoder.decodeObject meta data processing");
Profiler.leave("JsonDecoder.decodeObject");
throw new RuntimeException("Can not deserialize "
+ type.getSignature(), e);
throw new RuntimeException(
"Can not deserialize " + type.getSignature(), e);
}
}
}
@@ -210,7 +213,8 @@ public class JsonDecoder {
if (keyType.getBaseTypeName().equals(String.class.getName())) {
assert jsonMap.getType() == JsonType.OBJECT;
return decodeStringMap(valueType, (JsonObject) jsonMap, connection);
} else if (keyType.getBaseTypeName().equals(Connector.class.getName())) {
} else if (keyType.getBaseTypeName()
.equals(Connector.class.getName())) {
assert jsonMap.getType() == JsonType.OBJECT;
return decodeConnectorMap(valueType, (JsonObject) jsonMap,
connection);
@@ -274,16 +278,16 @@ public class JsonDecoder {
private static List<Object> decodeList(Type type, JsonArray jsonArray,
ApplicationConnection connection) {
List<Object> tokens = new ArrayList<Object>();
decodeIntoCollection(type.getParameterTypes()[0], jsonArray,
connection, tokens);
decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection,
tokens);
return tokens;
}

private static Set<Object> decodeSet(Type type, JsonArray jsonArray,
ApplicationConnection connection) {
Set<Object> tokens = new HashSet<Object>();
decodeIntoCollection(type.getParameterTypes()[0], jsonArray,
connection, tokens);
decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection,
tokens);
return tokens;
}


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

@@ -122,14 +122,14 @@ public class JsonEncoder {
Type propertyType = property.getType();
JsonValue encodedPropertyValue = encode(propertyValue,
propertyType, connection);
jsonObject
.put(property.getName(), encodedPropertyValue);
jsonObject.put(property.getName(),
encodedPropertyValue);
}
return jsonObject;

} catch (NoDataException e) {
throw new RuntimeException("Can not encode "
+ type.getSignature(), e);
throw new RuntimeException(
"Can not encode " + type.getSignature(), e);
}

} else {
@@ -154,8 +154,8 @@ public class JsonEncoder {
if (value != null) {
valueType = value.getClass().getName();
}
throw new IllegalArgumentException("Cannot encode object of type "
+ valueType);
throw new IllegalArgumentException(
"Cannot encode object of type " + valueType);
}
jsonArray.set(0, Json.create(transportType));
jsonArray.set(1, encode(value, null, connection));
@@ -188,22 +188,23 @@ public class JsonEncoder {
}
}

private static JsonValue encodeChildValue(Object value,
Type collectionType, int typeIndex, ApplicationConnection connection) {
private static JsonValue encodeChildValue(Object value, Type collectionType,
int typeIndex, ApplicationConnection connection) {
if (collectionType == null) {
return encode(new UidlValue(value), null, connection);
} else {
assert collectionType.getParameterTypes() != null
&& collectionType.getParameterTypes().length > typeIndex
&& collectionType.getParameterTypes()[typeIndex] != null : "Proper generics required for encoding child value, assertion failed for "
+ collectionType;
&& collectionType
.getParameterTypes()[typeIndex] != null : "Proper generics required for encoding child value, assertion failed for "
+ collectionType;
Type childType = collectionType.getParameterTypes()[typeIndex];
return encode(value, childType, connection);
}
}

private static JsonArray encodeObjectMap(Map<Object, Object> map,
Type type, ApplicationConnection connection) {
private static JsonArray encodeObjectMap(Map<Object, Object> map, Type type,
ApplicationConnection connection) {
JsonArray keys = Json.createArray();
JsonArray values = Json.createArray();

@@ -230,8 +231,8 @@ public class JsonEncoder {
for (Entry<?, ?> entry : map.entrySet()) {
Connector connector = (Connector) entry.getKey();

JsonValue encodedValue = encodeChildValue(entry.getValue(), type,
1, connection);
JsonValue encodedValue = encodeChildValue(entry.getValue(), type, 1,
connection);

jsonMap.put(connector.getConnectorId(), encodedValue);
}
@@ -239,8 +240,8 @@ public class JsonEncoder {
return jsonMap;
}

private static JsonValue encodeStringMap(Map<Object, Object> map,
Type type, ApplicationConnection connection) {
private static JsonValue encodeStringMap(Map<Object, Object> map, Type type,
ApplicationConnection connection) {
JsonObject jsonMap = Json.createObject();

for (Entry<?, ?> entry : map.entrySet()) {

+ 179
- 174
client/src/main/java/com/vaadin/client/communication/MessageHandler.java View File

@@ -125,7 +125,9 @@ public class MessageHandler {
*/
private Set<Object> responseHandlingLocks = new HashSet<Object>();

/** Contains all UIDL messages received while response handling is suspended */
/**
* Contains all UIDL messages received while response handling is suspended
*/
private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<PendingUIDLMessage>();

// will hold the CSRF token once received
@@ -232,14 +234,14 @@ public class MessageHandler {
"The json to handle cannot be null");
}
if (getServerId(json) == -1) {
getLogger()
.severe("Response didn't contain a server id. "
+ "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
getLogger().severe("Response didn't contain a server id. "
+ "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
}

if (connection.getApplicationState() == ApplicationState.RUNNING) {
handleJSON(json);
} else if (connection.getApplicationState() == ApplicationState.INITIALIZING) {
} else if (connection
.getApplicationState() == ApplicationState.INITIALIZING) {
// Application is starting up for the first time
connection.setApplicationRunning(true);
connection.executeWhenCSSLoaded(new Command() {
@@ -249,9 +251,8 @@ public class MessageHandler {
}
});
} else {
getLogger()
.warning(
"Ignored received message because application has already been stopped");
getLogger().warning(
"Ignored received message because application has already been stopped");
return;
}
}
@@ -264,9 +265,8 @@ public class MessageHandler {
// messages and ensure this is handled next. Otherwise we
// would keep waiting for an older message forever (if this
// is triggered by forceHandleMessage)
getLogger().info(
"Received resync message with id " + serverId
+ " while waiting for " + getExpectedServerId());
getLogger().info("Received resync message with id " + serverId
+ " while waiting for " + getExpectedServerId());
lastSeenServerSyncId = serverId - 1;
removeOldPendingMessages();
}
@@ -286,21 +286,17 @@ public class MessageHandler {
// Unexpected server id
if (serverId <= lastSeenServerSyncId) {
// Why is the server re-sending an old package? Ignore it
getLogger().warning(
"Received message with server id " + serverId
+ " but have already seen "
+ lastSeenServerSyncId + ". Ignoring it");
getLogger().warning("Received message with server id "
+ serverId + " but have already seen "
+ lastSeenServerSyncId + ". Ignoring it");
endRequestIfResponse(json);
return;
}

// We are waiting for an earlier message...
getLogger()
.info("Received message with server id "
+ serverId
+ " but expected "
+ getExpectedServerId()
+ ". Postponing handling until the missing message(s) have been received");
getLogger().info("Received message with server id " + serverId
+ " but expected " + getExpectedServerId()
+ ". Postponing handling until the missing message(s) have been received");
}
pendingUIDLMessages.add(new PendingUIDLMessage(json));
if (!forceHandleMessage.isRunning()) {
@@ -364,8 +360,8 @@ public class MessageHandler {
connection.setResource(key, resources.getAsString(key));
}
}
handleUIDLDuration.logDuration(
" * Handling resources from server completed", 10);
handleUIDLDuration
.logDuration(" * Handling resources from server completed", 10);

getLogger().info(" * Handling type inheritance map from server");

@@ -379,20 +375,20 @@ public class MessageHandler {
getLogger().info("Handling type mappings from server");

if (json.containsKey("typeMappings")) {
connection.getConfiguration()
.addComponentMappings(json.getValueMap("typeMappings"),
connection.getWidgetSet());
connection.getConfiguration().addComponentMappings(
json.getValueMap("typeMappings"),
connection.getWidgetSet());

}

getLogger().info("Handling resource dependencies");
if (json.containsKey("scriptDependencies")) {
connection.loadScriptDependencies(json
.getJSStringArray("scriptDependencies"));
connection.loadScriptDependencies(
json.getJSStringArray("scriptDependencies"));
}
if (json.containsKey("styleDependencies")) {
connection.loadStyleDependencies(json
.getJSStringArray("styleDependencies"));
connection.loadStyleDependencies(
json.getJSStringArray("styleDependencies"));
}

handleUIDLDuration.logDuration(
@@ -431,8 +427,8 @@ public class MessageHandler {
redirectTimer = new Timer() {
@Override
public void run() {
WidgetUtil.redirect(timedRedirect
.getString("url"));
WidgetUtil.redirect(
timedRedirect.getString("url"));
}
};
sessionExpirationInterval = timedRedirect
@@ -450,7 +446,8 @@ public class MessageHandler {
double processUidlStart = Duration.currentTimeMillis();

// Ensure that all connectors that we are about to update exist
JsArrayString createdConnectorIds = createConnectorsIfNeeded(json);
JsArrayString createdConnectorIds = createConnectorsIfNeeded(
json);

// Update states, do not fire events
JsArrayObject<StateChangeEvent> pendingStateChangeEvents = updateConnectorState(
@@ -463,15 +460,17 @@ public class MessageHandler {
Profiler.enter("Handling locales");
getLogger().info(" * Handling locales");
// Store locale data
LocaleService
.addLocales(getUIConnector().getState().localeServiceState.localeData);
LocaleService.addLocales(getUIConnector()
.getState().localeServiceState.localeData);
Profiler.leave("Handling locales");

// Update hierarchy, do not fire events
ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(json);
ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(
json);

// Fire hierarchy change events
sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events);
sendHierarchyChangeEvents(
connectorHierarchyUpdateResult.events);

updateCaptions(pendingStateChangeEvents,
connectorHierarchyUpdateResult.parentChangedIds);
@@ -489,20 +488,20 @@ public class MessageHandler {

if (json.containsKey("dd")) {
// response contains data for drag and drop service
VDragAndDropManager.get().handleServerResponse(
json.getValueMap("dd"));
VDragAndDropManager.get()
.handleServerResponse(json.getValueMap("dd"));
}

int removed = unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
int removed = unregisterRemovedConnectors(
connectorHierarchyUpdateResult.detachedConnectorIds);
if (removed > 0 && !isResponse(json)) {
// Must acknowledge the removal using an XHR or server
// memory usage will keep growing
getUIConnector().sendAck();
}
getLogger()
.info("handleUIDLMessage: "
+ (Duration.currentTimeMillis() - processUidlStart)
+ " ms");
getLogger().info("handleUIDLMessage: "
+ (Duration.currentTimeMillis() - processUidlStart)
+ " ms");

updatingState = false;

@@ -516,8 +515,8 @@ public class MessageHandler {
layoutManager.layoutNow();
}
} catch (final Throwable e) {
getLogger()
.log(Level.SEVERE, "Error processing layouts", e);
getLogger().log(Level.SEVERE, "Error processing layouts",
e);
}
Profiler.leave("Layout processing");

@@ -546,18 +545,17 @@ public class MessageHandler {

// TODO build profiling for widget impl loading time

lastProcessingTime = (int) ((new Date().getTime()) - start
.getTime());
lastProcessingTime = (int) ((new Date().getTime())
- start.getTime());
totalProcessingTime += lastProcessingTime;
if (bootstrapTime == 0) {

double fetchStart = getFetchStartTime();
if (fetchStart != 0) {
int time = (int) (Duration.currentTimeMillis() - fetchStart);
getLogger().log(
Level.INFO,
"First response processed " + time
+ " ms after fetchStart");
int time = (int) (Duration.currentTimeMillis()
- fetchStart);
getLogger().log(Level.INFO, "First response processed "
+ time + " ms after fetchStart");
}

bootstrapTime = calculateBootstrapTime();
@@ -566,9 +564,8 @@ public class MessageHandler {
}
}

getLogger().info(
" Processing time was "
+ String.valueOf(lastProcessingTime) + "ms");
getLogger().info(" Processing time was "
+ String.valueOf(lastProcessingTime) + "ms");
getLogger().info(
"Referenced paintables: " + getConnectorMap().size());

@@ -607,13 +604,16 @@ public class MessageHandler {
.cast();

// Update hierarchy based on the fake response
ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(fakeValueMap);
ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(
fakeValueMap);

// Send hierarchy events based on the fake update
sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events);
sendHierarchyChangeEvents(
connectorHierarchyUpdateResult.events);

// Unregister all the old connectors that have now been removed
unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds);
unregisterRemovedConnectors(
connectorHierarchyUpdateResult.detachedConnectorIds);

getLayoutManager().cleanMeasuredSizes();
}
@@ -654,10 +654,12 @@ public class MessageHandler {
.delegateCaptionHandling()) {
ServerConnector parent = child.getParent();
if (parent instanceof HasComponentsConnector) {
Profiler.enter("HasComponentsConnector.updateCaption");
Profiler.enter(
"HasComponentsConnector.updateCaption");
((HasComponentsConnector) parent)
.updateCaption((ComponentConnector) child);
Profiler.leave("HasComponentsConnector.updateCaption");
Profiler.leave(
"HasComponentsConnector.updateCaption");
}
}
}
@@ -725,15 +727,16 @@ public class MessageHandler {
.getReturnType();
Widget widget = component.getWidget();

Object propertyValue = property.getValue(component
.getState());
Object propertyValue = property
.getValue(component.getState());

widgetType.getMethod(methodName).invoke(widget,
propertyValue);
} catch (NoDataException e) {
throw new RuntimeException(
"Missing data needed to invoke @DelegateToWidget for "
+ component.getClass().getSimpleName(), e);
+ component.getClass().getSimpleName(),
e);
}
}

@@ -770,7 +773,8 @@ public class MessageHandler {
}

private void verifyConnectorHierarchy() {
Profiler.enter("verifyConnectorHierarchy - this is only performed in debug mode");
Profiler.enter(
"verifyConnectorHierarchy - this is only performed in debug mode");

JsArrayObject<ServerConnector> currentConnectors = getConnectorMap()
.getConnectorsAsJsArray();
@@ -779,31 +783,29 @@ public class MessageHandler {
ServerConnector c = currentConnectors.get(i);
if (c.getParent() != null) {
if (!c.getParent().getChildren().contains(c)) {
getLogger()
.severe("ERROR: Connector "
+ c.getConnectorId()
+ " is connected to a parent but the parent ("
+ c.getParent().getConnectorId()
+ ") does not contain the connector");
getLogger().severe("ERROR: Connector "
+ c.getConnectorId()
+ " is connected to a parent but the parent ("
+ c.getParent().getConnectorId()
+ ") does not contain the connector");
}
} else if (c == getUIConnector()) {
// UIConnector for this connection, ignore
} else if (c instanceof WindowConnector
&& getUIConnector().hasSubWindow(
(WindowConnector) c)) {
} else if (c instanceof WindowConnector && getUIConnector()
.hasSubWindow((WindowConnector) c)) {
// Sub window attached to this UIConnector, ignore
} else {
// The connector has been detached from the
// hierarchy but was not unregistered.
getLogger()
.severe("ERROR: Connector "
+ c.getConnectorId()
+ " is not attached to a parent but has not been unregistered");
getLogger().severe("ERROR: Connector "
+ c.getConnectorId()
+ " is not attached to a parent but has not been unregistered");
}

}

Profiler.leave("verifyConnectorHierarchy - this is only performed in debug mode");
Profiler.leave(
"verifyConnectorHierarchy - this is only performed in debug mode");
}

private int unregisterRemovedConnectors(
@@ -813,12 +815,14 @@ public class MessageHandler {
JsArrayString detachedArray = detachedConnectors.dump();
int nrDetached = detachedArray.length();
for (int i = 0; i < nrDetached; i++) {
ServerConnector connector = getConnectorMap().getConnector(
detachedArray.get(i));
ServerConnector connector = getConnectorMap()
.getConnector(detachedArray.get(i));

Profiler.enter("unregisterRemovedConnectors unregisterConnector");
Profiler.enter(
"unregisterRemovedConnectors unregisterConnector");
getConnectorMap().unregisterConnector(connector);
Profiler.leave("unregisterRemovedConnectors unregisterConnector");
Profiler.leave(
"unregisterRemovedConnectors unregisterConnector");
}

if (ApplicationConfiguration.isDebugMode()) {
@@ -836,8 +840,8 @@ public class MessageHandler {
private JsArrayString createConnectorsIfNeeded(ValueMap json) {
getLogger().info(" * Creating connectors (if needed)");

JsArrayString createdConnectors = JavaScriptObject
.createArray().cast();
JsArrayString createdConnectors = JavaScriptObject.createArray()
.cast();
if (!json.containsKey("types")) {
return createdConnectors;
}
@@ -859,8 +863,8 @@ public class MessageHandler {
// connector
onlyNoLayoutUpdates = false;

int connectorType = Integer.parseInt(types
.getString(connectorId));
int connectorType = Integer
.parseInt(types.getString(connectorId));

Class<? extends ServerConnector> connectorClass = connection
.getConfiguration()
@@ -869,10 +873,12 @@ public class MessageHandler {
// Connector does not exist so we must create it
if (connectorClass != getUIConnector().getClass()) {
// create, initialize and register the paintable
Profiler.enter("ApplicationConnection.getConnector");
Profiler.enter(
"ApplicationConnection.getConnector");
connector = connection.getConnector(connectorId,
connectorType);
Profiler.leave("ApplicationConnection.getConnector");
Profiler.leave(
"ApplicationConnection.getConnector");

createdConnectors.push(connectorId);
} else {
@@ -921,9 +927,8 @@ public class MessageHandler {
if (legacyConnector instanceof Paintable) {
String key = null;
if (Profiler.isEnabled()) {
key = "updateFromUIDL for "
+ legacyConnector.getClass()
.getSimpleName();
key = "updateFromUIDL for " + legacyConnector
.getClass().getSimpleName();
Profiler.enter(key);
}

@@ -934,15 +939,15 @@ public class MessageHandler {
Profiler.leave(key);
}
} else if (legacyConnector == null) {
getLogger()
.severe("Received update for "
+ uidl.getTag()
getLogger().severe(
"Received update for " + uidl.getTag()
+ ", but there is no such paintable ("
+ connectorId + ") rendered.");
} else {
getLogger()
.severe("Server sent Vaadin 6 style updates for "
+ Util.getConnectorString(legacyConnector)
+ Util.getConnectorString(
legacyConnector)
+ " but this is not a Vaadin 6 Paintable");
}

@@ -977,15 +982,15 @@ public class MessageHandler {
Profiler.leave("sendHierarchyChangeEvents");
}

private void logHierarchyChange(ConnectorHierarchyChangeEvent event) {
private void logHierarchyChange(
ConnectorHierarchyChangeEvent event) {
if (true) {
// Always disabled for now. Can be enabled manually
return;
}

getLogger()
.info("Hierarchy changed for "
+ Util.getConnectorString(event.getConnector()));
getLogger().info("Hierarchy changed for "
+ Util.getConnectorString(event.getConnector()));
String oldChildren = "* Old children: ";
for (ComponentConnector child : event.getOldChildren()) {
oldChildren += Util.getConnectorString(child) + " ";
@@ -1041,11 +1046,12 @@ public class MessageHandler {
}

SharedState state = connector.getState();
Type stateType = new Type(state.getClass()
.getName(), null);
Type stateType = new Type(
state.getClass().getName(), null);

if (onlyNoLayoutUpdates) {
Profiler.enter("updateConnectorState @NoLayout handling");
Profiler.enter(
"updateConnectorState @NoLayout handling");
for (String propertyName : stateJson.keys()) {
Property property = stateType
.getProperty(propertyName);
@@ -1054,12 +1060,13 @@ public class MessageHandler {
break;
}
}
Profiler.leave("updateConnectorState @NoLayout handling");
Profiler.leave(
"updateConnectorState @NoLayout handling");
}

Profiler.enter("updateConnectorState decodeValue");
JsonDecoder.decodeValue(stateType, stateJson,
state, connection);
JsonDecoder.decodeValue(stateType, stateJson, state,
connection);
Profiler.leave("updateConnectorState decodeValue");

if (Profiler.isEnabled()) {
@@ -1095,8 +1102,8 @@ public class MessageHandler {
int length = dump.length();
for (int i = 0; i < length; i++) {
String connectorId = dump.get(i);
ServerConnector connector = getConnectorMap().getConnector(
connectorId);
ServerConnector connector = getConnectorMap()
.getConnector(connectorId);

StateChangeEvent event = new StateChangeEvent(connector,
Json.createObject(), true);
@@ -1143,8 +1150,8 @@ public class MessageHandler {
.getJSStringArray(connectorId);
hasHierarchy.add(connectorId);

updateConnectorHierarchy(connectorId,
childConnectorIds, maybeDetached, result);
updateConnectorHierarchy(connectorId, childConnectorIds,
maybeDetached, result);
}
}

@@ -1166,7 +1173,8 @@ public class MessageHandler {
}
}

Profiler.enter("updateConnectorHierarchy detach removed connectors");
Profiler.enter(
"updateConnectorHierarchy detach removed connectors");

/*
* Connector is in maybeDetached at this point if it has been
@@ -1174,13 +1182,14 @@ public class MessageHandler {
*/
JsArrayString maybeDetachedArray = maybeDetached.dump();
for (int i = 0; i < maybeDetachedArray.length(); i++) {
ServerConnector removed = getConnectorMap().getConnector(
maybeDetachedArray.get(i));
ServerConnector removed = getConnectorMap()
.getConnector(maybeDetachedArray.get(i));
recursivelyDetach(removed, result.events,
result.detachedConnectorIds);
}

Profiler.leave("updateConnectorHierarchy detach removed connectors");
Profiler.leave(
"updateConnectorHierarchy detach removed connectors");

if (result.events.size() != 0) {
onlyNoLayoutUpdates = false;
@@ -1217,7 +1226,8 @@ public class MessageHandler {
.getConnector(connectorId);
int childConnectorSize = childConnectorIds.length();

Profiler.enter("updateConnectorHierarchy find new connectors");
Profiler.enter(
"updateConnectorHierarchy find new connectors");

List<ServerConnector> newChildren = new ArrayList<ServerConnector>();
List<ComponentConnector> newComponents = new ArrayList<ComponentConnector>();
@@ -1227,18 +1237,14 @@ public class MessageHandler {
ServerConnector childConnector = connectorMap
.getConnector(childConnectorId);
if (childConnector == null) {
getLogger()
.severe("Hierarchy claims that "
+ childConnectorId
+ " is a child for "
+ connectorId
+ " ("
+ parentConnector.getClass()
.getName()
+ ") but no connector with id "
+ childConnectorId
+ " has been registered. "
+ "More information might be available in the server-side log if assertions are enabled");
getLogger().severe("Hierarchy claims that "
+ childConnectorId + " is a child for "
+ connectorId + " ("
+ parentConnector.getClass().getName()
+ ") but no connector with id "
+ childConnectorId
+ " has been registered. "
+ "More information might be available in the server-side log if assertions are enabled");
continue;
}
newChildren.add(childConnector);
@@ -1246,9 +1252,9 @@ public class MessageHandler {
newComponents
.add((ComponentConnector) childConnector);
} else if (!(childConnector instanceof AbstractExtensionConnector)) {
throw new IllegalStateException(
Util.getConnectorString(childConnector)
+ " is not a ComponentConnector nor an AbstractExtensionConnector");
throw new IllegalStateException(Util
.getConnectorString(childConnector)
+ " is not a ComponentConnector nor an AbstractExtensionConnector");
}
if (childConnector.getParent() != parentConnector) {
childConnector.setParent(parentConnector);
@@ -1259,21 +1265,23 @@ public class MessageHandler {
}
}

Profiler.leave("updateConnectorHierarchy find new connectors");
Profiler.leave(
"updateConnectorHierarchy find new connectors");

// TODO This check should be done on the server side in
// the future so the hierarchy update is only sent when
// something actually has changed
List<ServerConnector> oldChildren = parentConnector
.getChildren();
boolean actuallyChanged = !Util.collectionsEquals(
oldChildren, newChildren);
boolean actuallyChanged = !Util
.collectionsEquals(oldChildren, newChildren);

if (!actuallyChanged) {
return;
}

Profiler.enter("updateConnectorHierarchy handle HasComponentsConnector");
Profiler.enter(
"updateConnectorHierarchy handle HasComponentsConnector");

if (parentConnector instanceof HasComponentsConnector) {
HasComponentsConnector ccc = (HasComponentsConnector) parentConnector;
@@ -1283,27 +1291,28 @@ public class MessageHandler {
newComponents)) {
// Fire change event if the hierarchy has
// changed
ConnectorHierarchyChangeEvent event = GWT
.create(ConnectorHierarchyChangeEvent.class);
ConnectorHierarchyChangeEvent event = GWT.create(
ConnectorHierarchyChangeEvent.class);
event.setOldChildren(oldComponents);
event.setConnector(parentConnector);
ccc.setChildComponents(newComponents);
result.events.add(event);
}
} else if (!newComponents.isEmpty()) {
getLogger()
.severe("Hierachy claims "
+ Util.getConnectorString(parentConnector)
+ " has component children even though it isn't a HasComponentsConnector");
getLogger().severe("Hierachy claims "
+ Util.getConnectorString(parentConnector)
+ " has component children even though it isn't a HasComponentsConnector");
}

Profiler.leave("updateConnectorHierarchy handle HasComponentsConnector");
Profiler.leave(
"updateConnectorHierarchy handle HasComponentsConnector");

Profiler.enter("updateConnectorHierarchy setChildren");
parentConnector.setChildren(newChildren);
Profiler.leave("updateConnectorHierarchy setChildren");

Profiler.enter("updateConnectorHierarchy find removed children");
Profiler.enter(
"updateConnectorHierarchy find removed children");

/*
* Find children removed from this parent and mark for
@@ -1325,7 +1334,8 @@ public class MessageHandler {
}
}

Profiler.leave("updateConnectorHierarchy find removed children");
Profiler.leave(
"updateConnectorHierarchy find removed children");
} catch (final Throwable e) {
getLogger().log(Level.SEVERE,
"Error updating connector hierarchy", e);
@@ -1412,20 +1422,20 @@ public class MessageHandler {
/*
* Clear child list and parent
*/
Profiler.enter(prefix
+ "recursivelyDetach clear children and parent");
Profiler.enter(
prefix + "recursivelyDetach clear children and parent");
connector
.setChildren(Collections.<ServerConnector> emptyList());
connector.setParent(null);
Profiler.leave(prefix
+ "recursivelyDetach clear children and parent");
Profiler.leave(
prefix + "recursivelyDetach clear children and parent");

/*
* Create an artificial hierarchy event for containers to give
* it a chance to clean up after its children if it has any
*/
Profiler.enter(prefix
+ "recursivelyDetach create hierarchy event");
Profiler.enter(
prefix + "recursivelyDetach create hierarchy event");
if (connector instanceof HasComponentsConnector) {
HasComponentsConnector ccc = (HasComponentsConnector) connector;
List<ComponentConnector> oldChildren = ccc
@@ -1435,8 +1445,8 @@ public class MessageHandler {
* HasComponentsConnector has a separate child component
* list that should also be cleared
*/
ccc.setChildComponents(Collections
.<ComponentConnector> emptyList());
ccc.setChildComponents(
Collections.<ComponentConnector> emptyList());

// Create event and add it to the list of pending events
ConnectorHierarchyChangeEvent event = GWT
@@ -1446,8 +1456,8 @@ public class MessageHandler {
events.add(event);
}
}
Profiler.leave(prefix
+ "recursivelyDetach create hierarchy event");
Profiler.leave(
prefix + "recursivelyDetach create hierarchy event");
}

private native void replaceState(AbstractConnector connector,
@@ -1463,8 +1473,8 @@ public class MessageHandler {
getLogger()
.info(" * Performing server to client RPC calls");

JsonArray rpcCalls = Util.jso2json(json
.getJavaScriptObject("rpc"));
JsonArray rpcCalls = Util
.jso2json(json.getJavaScriptObject("rpc"));

int rpcLength = rpcCalls.length();
for (int i = 0; i < rpcLength; i++) {
@@ -1474,17 +1484,15 @@ public class MessageHandler {
.parseAndApplyInvocation(rpcCall,
connection);

if (onlyNoLayoutUpdates
&& !RpcManager.getMethod(invocation)
.isNoLayout()) {
if (onlyNoLayoutUpdates && !RpcManager
.getMethod(invocation).isNoLayout()) {
onlyNoLayoutUpdates = false;
}

} catch (final Throwable e) {
getLogger()
.log(Level.SEVERE,
"Error performing server to client RPC calls",
e);
getLogger().log(Level.SEVERE,
"Error performing server to client RPC calls",
e);
}
}

@@ -1557,18 +1565,16 @@ public class MessageHandler {
if (!responseHandlingLocks.isEmpty()) {
// Lock which was never release -> bug in locker or things just
// too slow
getLogger()
.warning(
"WARNING: reponse handling was never resumed, forcibly removing locks...");
getLogger().warning(
"WARNING: reponse handling was never resumed, forcibly removing locks...");
responseHandlingLocks.clear();
} else {
// Waited for out-of-order message which never arrived
// Do one final check and resynchronize if the message is not
// there. The final check is only a precaution as this timer
// should have been cancelled if the message has arrived
getLogger().warning(
"Gave up waiting for message " + getExpectedServerId()
+ " from the server");
getLogger().warning("Gave up waiting for message "
+ getExpectedServerId() + " from the server");

}
if (!handlePendingMessages() && !pendingUIDLMessages.isEmpty()) {
@@ -1603,8 +1609,8 @@ public class MessageHandler {
forceHandleMessage.cancel();

if (!pendingUIDLMessages.isEmpty()) {
getLogger()
.info("No more response handling locks, handling pending requests.");
getLogger().info(
"No more response handling locks, handling pending requests.");
handlePendingMessages();
}
}
@@ -1776,10 +1782,9 @@ public class MessageHandler {
final double start = Profiler.getRelativeTimeMillis();
try {
ValueMap json = parseJSONResponse(jsonText);
getLogger().info(
"JSON parsing took "
+ Util.round(Profiler.getRelativeTimeMillis()
- start, 3) + "ms");
getLogger().info("JSON parsing took "
+ Util.round(Profiler.getRelativeTimeMillis() - start, 3)
+ "ms");
return json;
} catch (final Exception e) {
getLogger().severe("Unable to parse JSON: " + jsonText);

+ 10
- 14
client/src/main/java/com/vaadin/client/communication/MessageSender.java View File

@@ -78,9 +78,8 @@ public class MessageSender {

public void sendInvocationsToServer() {
if (!connection.isApplicationRunning()) {
getLogger()
.warning(
"Trying to send RPC from not yet started or stopped application");
getLogger().warning(
"Trying to send RPC from not yet started or stopped application");
return;
}

@@ -115,9 +114,8 @@ public class MessageSender {
if (reqJson.length() == 0) {
// Nothing to send, all invocations were filtered out (for
// non-existing connectors)
getLogger()
.warning(
"All RPCs filtered out, not sending anything to the server");
getLogger().warning(
"All RPCs filtered out, not sending anything to the server");
return;
}

@@ -155,8 +153,8 @@ public class MessageSender {
payload.put(ApplicationConstants.CSRF_TOKEN, csrfToken);
}
payload.put(ApplicationConstants.RPC_INVOCATIONS, reqInvocations);
payload.put(ApplicationConstants.SERVER_SYNC_ID, getMessageHandler()
.getLastSeenServerSyncId());
payload.put(ApplicationConstants.SERVER_SYNC_ID,
getMessageHandler().getLastSeenServerSyncId());
payload.put(ApplicationConstants.CLIENT_TO_SERVER_ID,
clientToServerMessageId++);

@@ -257,9 +255,8 @@ public class MessageSender {
Scheduler.get().scheduleDeferred(new Command() {
@Override
public void execute() {
if (!connection.isApplicationRunning()
|| !(hasActiveRequest() || getServerRpcQueue()
.isFlushPending())) {
if (!connection.isApplicationRunning() || !(hasActiveRequest()
|| getServerRpcQueue().isFlushPending())) {
getLoadingIndicator().hide();

// If on Liferay and session expiration management is in
@@ -392,9 +389,8 @@ public class MessageSender {
// We have never sent a message to the server, so likely the
// server knows better (typical case is that we refreshed a
// @PreserveOnRefresh UI)
getLogger().info(
"Updating client-to-server id to " + nextExpectedId
+ " based on server");
getLogger().info("Updating client-to-server id to "
+ nextExpectedId + " based on server");
} else {
getLogger().warning(
"Server expects next client-to-server id to be "

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

@@ -49,8 +49,8 @@ public interface PushConnection {
* <p>
* Implementation detail: If the push connection is not connected and the
* message can thus not be sent, the implementation must call
* {@link ConnectionStateHandler#pushNotConnected(JsonObject)}, which
* will retry the send later.
* {@link ConnectionStateHandler#pushNotConnected(JsonObject)}, which will
* retry the send later.
* <p>
* This method must not be called if the push connection is not
* bidirectional (if {@link #isBidirectional()} returns false)

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

@@ -58,9 +58,10 @@ public class RpcManager {
method.invoke(clientRpc, invocation.getParameters());
}
} catch (NoDataException e) {
throw new IllegalStateException("There is no information about "
+ method.getSignature()
+ ". Did you remember to compile the right widgetset?", e);
throw new IllegalStateException(
"There is no information about " + method.getSignature()
+ ". Did you remember to compile the right widgetset?",
e);
}
}

@@ -91,9 +92,10 @@ public class RpcManager {
Type[] parameterTypes = method.getParameterTypes();
return parameterTypes;
} catch (NoDataException e) {
throw new IllegalStateException("There is no information about "
+ method.getSignature()
+ ". Did you remember to compile the right widgetset?", e);
throw new IllegalStateException(
"There is no information about " + method.getSignature()
+ ". Did you remember to compile the right widgetset?",
e);
}
}

@@ -112,13 +114,12 @@ public class RpcManager {
interfaceName, methodName);
if (connector instanceof HasJavaScriptConnectorHelper) {
((HasJavaScriptConnectorHelper) connector)
.getJavascriptConnectorHelper().invokeJsRpc(invocation,
parametersJson);
.getJavascriptConnectorHelper()
.invokeJsRpc(invocation, parametersJson);
} else {
if (connector == null) {
throw new IllegalStateException("Target connector ("
+ connector + ") not found for RCC to "
+ getSignature(invocation));
throw new IllegalStateException("Target connector (" + connector
+ ") not found for RCC to " + getSignature(invocation));
}

parseMethodParameters(invocation, parametersJson, connection);

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

@@ -36,14 +36,14 @@ public class RpcProxy {
return (T) TypeData.getType(rpcInterface).createProxy(
new RpcInvokationHandler(rpcInterface, connector));
} catch (NoDataException e) {
throw new IllegalStateException("There is no information about "
+ rpcInterface
+ ". Did you forget to compile the widgetset?");
throw new IllegalStateException(
"There is no information about " + rpcInterface
+ ". Did you forget to compile the widgetset?");
}
}

private static final class RpcInvokationHandler implements
InvokationHandler {
private static final class RpcInvokationHandler
implements InvokationHandler {
private final Class<?> rpcInterface;
private final ServerConnector connector;

@@ -58,8 +58,8 @@ public class RpcProxy {
MethodInvocation invocation = new MethodInvocation(
connector.getConnectorId(), rpcInterface.getName(),
method.getName(), params);
ServerRpcQueue serverRpcQueue = ServerRpcQueue.get(connector
.getConnection());
ServerRpcQueue serverRpcQueue = ServerRpcQueue
.get(connector.getConnection());
serverRpcQueue.add(invocation, method.isLastOnly());
if (!method.isDelayed()) {
serverRpcQueue.flush();

+ 10
- 11
client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java View File

@@ -118,15 +118,15 @@ public class ServerRpcQueue {
*/
public void add(MethodInvocation invocation, boolean lastOnly) {
if (!connection.isApplicationRunning()) {
getLogger()
.warning(
"Trying to invoke method on not yet started or stopped application");
getLogger().warning(
"Trying to invoke method on not yet started or stopped application");
return;
}
String tag;
if (lastOnly) {
tag = invocation.getLastOnlyTag();
assert !tag.matches("\\d+") : "getLastOnlyTag value must have at least one non-digit character";
assert !tag.matches(
"\\d+") : "getLastOnlyTag value must have at least one non-digit character";
pendingInvocations.remove(tag);
} else {
tag = Integer.toString(lastInvocationTag++);
@@ -255,9 +255,8 @@ public class ServerRpcQueue {
for (MethodInvocation invocation : getAll()) {
String connectorId = invocation.getConnectorId();
if (!connectorExists(connectorId)) {
getLogger().info(
"Ignoring RPC for removed connector: " + connectorId
+ ": " + invocation.toString());
getLogger().info("Ignoring RPC for removed connector: "
+ connectorId + ": " + invocation.toString());
continue;
}

@@ -275,8 +274,8 @@ public class ServerRpcQueue {
Method method = type.getMethod(invocation.getMethodName());
parameterTypes = method.getParameterTypes();
} catch (NoDataException e) {
throw new RuntimeException("No type data for "
+ invocation.toString(), e);
throw new RuntimeException(
"No type data for " + invocation.toString(), e);
}
}

@@ -334,8 +333,8 @@ public class ServerRpcQueue {
* otherwise
*/
public static boolean isLegacyVariableChange(MethodInvocation invocation) {
return ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation
.getInterfaceName())
return ApplicationConstants.UPDATE_VARIABLE_METHOD
.equals(invocation.getInterfaceName())
&& ApplicationConstants.UPDATE_VARIABLE_METHOD
.equals(invocation.getMethodName());
}

+ 10
- 6
client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java View File

@@ -33,8 +33,8 @@ import com.vaadin.client.ui.AbstractConnector;

import elemental.json.JsonObject;

public class StateChangeEvent extends
AbstractServerConnectorEvent<StateChangeHandler> {
public class StateChangeEvent
extends AbstractServerConnectorEvent<StateChangeHandler> {
/**
* Type of this event, used by the event bus.
*/
@@ -176,7 +176,8 @@ public class StateChangeEvent extends
@Deprecated
public FastStringSet getChangedPropertiesFastSet() {
if (changedProperties == null) {
Profiler.enter("StateChangeEvent.getChangedPropertiesFastSet populate");
Profiler.enter(
"StateChangeEvent.getChangedPropertiesFastSet populate");
changedProperties = FastStringSet.create();

addJsonFields(stateJson, changedProperties, "");
@@ -186,7 +187,8 @@ public class StateChangeEvent extends
changedProperties, "");
}

Profiler.leave("StateChangeEvent.getChangedPropertiesFastSet populate");
Profiler.leave(
"StateChangeEvent.getChangedPropertiesFastSet populate");
}
return changedProperties;
}
@@ -282,8 +284,10 @@ public class StateChangeEvent extends
}
}
} catch (NoDataException e) {
throw new IllegalStateException("No property info for " + type
+ ". Did you remember to compile the right widgetset?", e);
throw new IllegalStateException(
"No property info for " + type
+ ". Did you remember to compile the right widgetset?",
e);
}
}


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

@@ -146,10 +146,9 @@ public class XhrConnection {
return;
}

getLogger().info(
"Server visit took "
+ Util.round(Profiler.getRelativeTimeMillis()
- requestStartTime, 3) + "ms");
getLogger().info("Server visit took " + Util.round(
Profiler.getRelativeTimeMillis() - requestStartTime, 3)
+ "ms");

// for(;;);["+ realJson +"]"
String responseText = response.getText();
@@ -221,8 +220,8 @@ public class XhrConnection {
}.schedule(retryTimeout);
}
} catch (RequestException e) {
getConnectionStateHandler().xhrException(
new XhrConnectionError(null, payload, e));
getConnectionStateHandler()
.xhrException(new XhrConnectionError(null, payload, e));
}
}

@@ -236,8 +235,8 @@ public class XhrConnection {
.translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+ ApplicationConstants.UIDL_PATH + '/');

uri = SharedUtil.addGetParameters(uri, UIConstants.UI_ID_PARAMETER
+ "=" + connection.getConfiguration().getUIId());
uri = SharedUtil.addGetParameters(uri, UIConstants.UI_ID_PARAMETER + "="
+ connection.getConfiguration().getUIId());

return uri;


+ 5
- 4
client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java View File

@@ -51,8 +51,9 @@ public class ComponentLocator {
*/
public ComponentLocator(ApplicationConnection client) {
this.client = client;
locatorStrategies = Arrays.asList(new VaadinFinderLocatorStrategy(
client), new LegacyLocatorStrategy(client));
locatorStrategies = Arrays.asList(
new VaadinFinderLocatorStrategy(client),
new LegacyLocatorStrategy(client));
}

/**
@@ -181,8 +182,8 @@ public class ComponentLocator {
JsArray<Element> jsElements = JavaScriptObject.createArray().cast();
for (LocatorStrategy strategy : locatorStrategies) {
if (strategy.validatePath(path)) {
List<Element> elements = strategy.getElementsByPathStartingAt(
path, root);
List<Element> elements = strategy
.getElementsByPathStartingAt(path, root);
if (elements.size() > 0) {
for (Element e : elements) {
jsElements.push(e);

+ 23
- 19
client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java View File

@@ -75,8 +75,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {

private final ApplicationConnection client;

private static final RegExp validSyntax = RegExp
.compile("^((\\w+::)?((PID_S)?\\w[-$_a-zA-Z0-9.' ]*)?)?(/[-$_a-zA-Z0-9]+\\[\\d+\\])*/?(#.*)?$");
private static final RegExp validSyntax = RegExp.compile(
"^((\\w+::)?((PID_S)?\\w[-$_a-zA-Z0-9.' ]*)?)?(/[-$_a-zA-Z0-9]+\\[\\d+\\])*/?(#.*)?$");

public LegacyLocatorStrategy(ApplicationConnection clientConnection) {
client = clientConnection;
@@ -89,8 +89,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {

@Override
public String getPathForElement(Element targetElement) {
ComponentConnector connector = Util
.findPaintable(client, targetElement);
ComponentConnector connector = Util.findPaintable(client,
targetElement);

Widget w = null;
if (connector != null) {
@@ -169,8 +169,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
* If the widget can provide an identifier for the targetElement we
* let it do that
*/
String elementLocator = ((SubPartAware) w).getSubPartName(DOM
.asOld(targetElement));
String elementLocator = ((SubPartAware) w)
.getSubPartName(DOM.asOld(targetElement));
if (elementLocator != null) {
return path + LegacyLocatorStrategy.SUBPART_SEPARATOR
+ elementLocator;
@@ -200,7 +200,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
* {@inheritDoc}
*/
@Override
public Element getElementByPathStartingAt(String path, Element baseElement) {
public Element getElementByPathStartingAt(String path,
Element baseElement) {
/*
* Path is of type "targetWidgetPath#componentPart" or
* "targetWidgetPath".
@@ -253,7 +254,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
* {@inheritDoc}
*/
@Override
public List<Element> getElementsByPathStartingAt(String path, Element root) {
public List<Element> getElementsByPathStartingAt(String path,
Element root) {
// This type of search is not supported in LegacyLocator
List<Element> array = new ArrayList<Element>();
Element e = getElementByPathStartingAt(path, root);
@@ -295,7 +297,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
* @return The widget whose root element is a parent of
* {@code targetElement}.
*/
private Widget findParentWidget(Element targetElement, Widget ancestorWidget) {
private Widget findParentWidget(Element targetElement,
Widget ancestorWidget) {
/*
* As we cannot resolve Widgets from the element we start from the
* widget and move downwards to the correct child widget, as long as we
@@ -334,13 +337,13 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
String childIndexString = part.substring("domChild[".length(),
part.length() - 1);

if (WidgetUtil.findWidget(baseElement, null) instanceof VAbstractOrderedLayout) {
if (WidgetUtil.findWidget(baseElement,
null) instanceof VAbstractOrderedLayout) {
if (element.hasChildNodes()) {
Element e = element.getFirstChildElement().cast();
String cn = e.getClassName();
if (cn != null
&& (cn.equals("v-expand") || cn
.contains("v-has-caption"))) {
if (cn != null && (cn.equals("v-expand")
|| cn.contains("v-has-caption"))) {
element = e;
}
}
@@ -472,8 +475,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
while (i.hasNext()) {
Object child = i.next();
if (child == w) {
return basePath + PARENTCHILD_SEPARATOR + simpleName + "["
+ pos + "]";
return basePath + PARENTCHILD_SEPARATOR + simpleName + "[" + pos
+ "]";
}
String simpleName2 = Util.getSimpleName(child);
if (simpleName.equals(simpleName2)) {
@@ -568,8 +571,9 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
// ChildComponentContainer and VOrderedLayout$Slot have been
// replaced with Slot
if (w instanceof VAbstractOrderedLayout
&& ("ChildComponentContainer".equals(widgetClassName) || "VOrderedLayout$Slot"
.equals(widgetClassName))) {
&& ("ChildComponentContainer".equals(widgetClassName)
|| "VOrderedLayout$Slot"
.equals(widgetClassName))) {
widgetClassName = "Slot";
}

@@ -606,8 +610,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
// the same type before it
int nextIndex = 0;
for (Widget child : layout) {
boolean matchingType = nextWidgetClassName.equals(Util
.getSimpleName(child));
boolean matchingType = nextWidgetClassName
.equals(Util.getSimpleName(child));
if (matchingType && widgetPosition == 0) {
// This is the n:th child that we looked for
break;

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

@@ -141,11 +141,11 @@ public class SelectorPredicate {
* found.
*/
private static String extractPredicateString(String pathFragment) {
int ixOpenBracket = LocatorUtil
.indexOfIgnoringQuoted(pathFragment, '[');
int ixOpenBracket = LocatorUtil.indexOfIgnoringQuoted(pathFragment,
'[');
if (ixOpenBracket >= 0) {
int ixCloseBracket = LocatorUtil.indexOfIgnoringQuoted(
pathFragment, ']', ixOpenBracket);
int ixCloseBracket = LocatorUtil.indexOfIgnoringQuoted(pathFragment,
']', ixOpenBracket);
return pathFragment.substring(ixOpenBracket + 1, ixCloseBracket);
}
return "";

+ 21
- 16
client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java View File

@@ -86,8 +86,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
boolean hasSubParts = targetWidget instanceof SubPartAware;
if (oldTarget != targetElement) {
if (hasSubParts) {
subPart = ((SubPartAware) targetWidget).getSubPartName(DOM
.asOld(oldTarget));
subPart = ((SubPartAware) targetWidget)
.getSubPartName(DOM.asOld(oldTarget));
}

if (!hasSubParts || subPart == null) {
@@ -96,7 +96,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
}
}

List<ConnectorPath> hierarchy = getConnectorHierarchyForElement(targetElement);
List<ConnectorPath> hierarchy = getConnectorHierarchyForElement(
targetElement);
List<String> path = new ArrayList<String>();

// Assemble longname path components back-to-forth with useful
@@ -151,12 +152,13 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
// See if we get minimum from second last. If not then we already
// have the best one.. Second last one contains almost full
// component hierarchy.
if (getElementsByPath(selectors.get(selectors.size() - 2)).indexOf(
target) == min) {
if (getElementsByPath(selectors.get(selectors.size() - 2))
.indexOf(target) == min) {
for (int i = 1; i < selectors.size() - 2; ++i) {
// Loop through the remaining selectors and look for one
// with the same index
if (getElementsByPath(selectors.get(i)).indexOf(target) == min) {
if (getElementsByPath(selectors.get(i))
.indexOf(target) == min) {
bestSelector = selectors.get(i);
break;
}
@@ -218,8 +220,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
* not exist on the object (or some other error is encountered).
*/
private String getPropertyValue(ComponentConnector c, String propertyName) {
Property prop = AbstractConnector.getStateType(c).getProperty(
propertyName);
Property prop = AbstractConnector.getStateType(c)
.getProperty(propertyName);
try {
return prop.getValue(c.getState()).toString();
} catch (Exception e) {
@@ -289,8 +291,9 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
} else {

final UIConnector uiConnector = client.getUIConnector();
elements.addAll(eliminateDuplicates(getElementsByPathStartingAtConnector(
path, uiConnector, Document.get().getBody())));
elements.addAll(
eliminateDuplicates(getElementsByPathStartingAtConnector(
path, uiConnector, Document.get().getBody())));
}

for (SelectorPredicate p : postFilters) {
@@ -340,7 +343,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
* {@inheritDoc}
*/
@Override
public List<Element> getElementsByPathStartingAt(String path, Element root) {
public List<Element> getElementsByPathStartingAt(String path,
Element root) {
List<SelectorPredicate> postFilters = SelectorPredicate
.extractPostFilterPredicates(path);
if (postFilters.size() > 0) {
@@ -474,8 +478,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
for (ComponentConnector parent : parents) {
connectors.addAll(filterMatches(
collectPotentialMatches(parent, fragments[0],
findRecursively), SelectorPredicate
.extractPredicates(fragments[0])));
findRecursively),
SelectorPredicate.extractPredicates(fragments[0])));
}

if (!connectors.isEmpty() && fragments.length > 1) {
@@ -518,8 +522,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
String propData = getPropertyValue(potentialMatches.get(i),
p.getName());

if ((p.isWildcard() && propData == null)
|| (!p.isWildcard() && !p.getValue().equals(propData))) {
if ((p.isWildcard() && propData == null) || (!p.isWildcard()
&& !p.getValue().equals(propData))) {
potentialMatches.remove(i);
--l;
--i;
@@ -637,7 +641,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
if (widgetName.equals(fullName + ".class")
|| widgetName.equals(fullName)
|| widgetName.equals(simpleName + ".class")
|| widgetName.equals(simpleName) || widgetName.equals(name)) {
|| widgetName.equals(simpleName)
|| widgetName.equals(name)) {
return true;
}
}

+ 13
- 14
client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java View File

@@ -34,9 +34,8 @@ import elemental.json.JsonValue;
* {@link com.vaadin.ui.components.grid.Renderer Renderer}. As a connector, it
* can use the regular Vaadin RPC and shared state mechanism to pass additional
* state and information between the client and the server. This base class
* itself only uses the basic
* {@link com.vaadin.shared.communication.SharedState SharedState} and no RPC
* interfaces.
* itself only uses the basic {@link com.vaadin.shared.communication.SharedState
* SharedState} and no RPC interfaces.
*
* @param <T>
* the presentation type of the renderer
@@ -44,8 +43,8 @@ import elemental.json.JsonValue;
* @since 7.4
* @author Vaadin Ltd
*/
public abstract class AbstractRendererConnector<T> extends
AbstractExtensionConnector {
public abstract class AbstractRendererConnector<T>
extends AbstractExtensionConnector {

private Renderer<T> renderer = null;

@@ -54,10 +53,9 @@ public abstract class AbstractRendererConnector<T> extends

protected AbstractRendererConnector() {
if (presentationType == null) {
throw new IllegalStateException(
"No presentation type found for "
+ getClass().getSimpleName()
+ ". This may be caused by some unspecified problem in widgetset compilation.");
throw new IllegalStateException("No presentation type found for "
+ getClass().getSimpleName()
+ ". This may be caused by some unspecified problem in widgetset compilation.");
}
}

@@ -112,7 +110,8 @@ public abstract class AbstractRendererConnector<T> extends
+ getClass().getSimpleName()
+ ". This might be caused by explicitely using "
+ "super.createRenderer() or some unspecified "
+ "problem with the widgetset compilation.", e);
+ "problem with the widgetset compilation.",
e);
}
}

@@ -153,8 +152,8 @@ public abstract class AbstractRendererConnector<T> extends
if (parent instanceof GridConnector) {
return ((GridConnector) parent).getRowKey(row);
} else {
throw new IllegalStateException("Renderers can only be used "
+ "with a Grid.");
throw new IllegalStateException(
"Renderers can only be used " + "with a Grid.");
}
}

@@ -174,8 +173,8 @@ public abstract class AbstractRendererConnector<T> extends
if (parent instanceof GridConnector) {
return ((GridConnector) parent).getColumnId(column);
} else {
throw new IllegalStateException("Renderers can only be used "
+ "with a Grid.");
throw new IllegalStateException(
"Renderers can only be used " + "with a Grid.");
}
}


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

@@ -53,8 +53,8 @@ public abstract class AbstractSelectionModelConnector<T extends SelectionModel<J

protected abstract T createSelectionModel();

public abstract static class AbstractSelectionModel implements
SelectionModel<JsonObject> {
public abstract static class AbstractSelectionModel
implements SelectionModel<JsonObject> {

@Override
public boolean isSelected(JsonObject row) {

+ 2
- 1
client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java View File

@@ -29,7 +29,8 @@ import elemental.json.JsonObject;
* @author Vaadin Ltd
*/
@Connect(com.vaadin.ui.renderers.ButtonRenderer.class)
public class ButtonRendererConnector extends ClickableRendererConnector<String> {
public class ButtonRendererConnector
extends ClickableRendererConnector<String> {

@Override
public ButtonRenderer getRenderer() {

+ 13
- 12
client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java View File

@@ -33,23 +33,24 @@ import elemental.json.JsonObject;
* @since 7.4
* @author Vaadin Ltd
*/
public abstract class ClickableRendererConnector<T> extends
AbstractRendererConnector<T> {
public abstract class ClickableRendererConnector<T>
extends AbstractRendererConnector<T> {

HandlerRegistration clickRegistration;

@Override
protected void init() {
clickRegistration = addClickHandler(new RendererClickHandler<JsonObject>() {
@Override
public void onClick(RendererClickEvent<JsonObject> event) {
getRpcProxy(RendererClickRpc.class).click(
getRowKey(event.getCell().getRow()),
getColumnId(event.getCell().getColumn()),
MouseEventDetailsBuilder.buildMouseEventDetails(event
.getNativeEvent()));
}
});
clickRegistration = addClickHandler(
new RendererClickHandler<JsonObject>() {
@Override
public void onClick(RendererClickEvent<JsonObject> event) {
getRpcProxy(RendererClickRpc.class).click(
getRowKey(event.getCell().getRow()),
getColumnId(event.getCell().getColumn()),
MouseEventDetailsBuilder.buildMouseEventDetails(
event.getNativeEvent()));
}
});
}

@Override

+ 2
- 1
client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java View File

@@ -26,7 +26,8 @@ import com.vaadin.ui.Grid.DetailComponentManager;
* @since 7.6.1
*/
@Connect(DetailComponentManager.class)
public class DetailComponentManagerConnector extends AbstractExtensionConnector {
public class DetailComponentManagerConnector
extends AbstractExtensionConnector {

@Override
protected void extend(ServerConnector target) {

+ 35
- 31
client/src/main/java/com/vaadin/client/connectors/GridConnector.java View File

@@ -111,8 +111,8 @@ import elemental.json.JsonValue;
* @author Vaadin Ltd
*/
@Connect(com.vaadin.ui.Grid.class)
public class GridConnector extends AbstractHasComponentsConnector implements
SimpleManagedLayout, DeferredWorker {
public class GridConnector extends AbstractHasComponentsConnector
implements SimpleManagedLayout, DeferredWorker {

private static final class CustomStyleGenerator implements
CellStyleGenerator<JsonObject>, RowStyleGenerator<JsonObject> {
@@ -223,7 +223,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
public void onStateChanged(
StateChangeEvent stateChangeEvent) {

String error = editorConnector.getState().errorMessage;
String error = editorConnector
.getState().errorMessage;

if (error == null) {
columnToErrorMessage
@@ -233,7 +234,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
// therefore, we use this hack to make the
// string human-readable.
Element e = DOM.createElement("div");
e.setInnerHTML(editorConnector.getState().errorMessage);
e.setInnerHTML(editorConnector
.getState().errorMessage);
error = getHeaderCaption() + ": "
+ e.getInnerText();

@@ -242,8 +244,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}

// Handle Editor RPC before updating error status
Scheduler.get().scheduleFinally(
new ScheduledCommand() {
Scheduler.get()
.scheduleFinally(new ScheduledCommand() {

@Override
public void execute() {
@@ -400,8 +402,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
}

private class ItemClickHandler implements BodyClickHandler,
BodyDoubleClickHandler {
private class ItemClickHandler
implements BodyClickHandler, BodyDoubleClickHandler {

@Override
public void onClick(GridClickEvent event) {
@@ -417,15 +419,13 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
}

private void fireItemClick(CellReference<?> cell, NativeEvent mouseEvent) {
private void fireItemClick(CellReference<?> cell,
NativeEvent mouseEvent) {
String rowKey = getRowKey((JsonObject) cell.getRow());
String columnId = getColumnId(cell.getColumn());
getRpcProxy(GridServerRpc.class)
.itemClick(
rowKey,
columnId,
MouseEventDetailsBuilder
.buildMouseEventDetails(mouseEvent));
getRpcProxy(GridServerRpc.class).itemClick(rowKey, columnId,
MouseEventDetailsBuilder
.buildMouseEventDetails(mouseEvent));
}
}

@@ -441,8 +441,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
newColumnOrder.add(((CustomGridColumn) column).id);
} // the other case would be the multi selection column
}
getRpcProxy(GridServerRpc.class).columnsReordered(
newColumnOrder, columnOrder);
getRpcProxy(GridServerRpc.class)
.columnsReordered(newColumnOrder, columnOrder);
columnOrder = newColumnOrder;
getState().columnOrder = newColumnOrder;
}
@@ -491,7 +491,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
};

private class CustomDetailsGenerator implements HeightAwareDetailsGenerator {
private class CustomDetailsGenerator
implements HeightAwareDetailsGenerator {

private final Map<String, ComponentConnector> idToDetailsMap = new HashMap<String, ComponentConnector>();
private final Map<String, Integer> idToRowIndex = new HashMap<String, Integer>();
@@ -534,9 +535,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
private String getId(int rowIndex) {
JsonObject row = getWidget().getDataSource().getRow(rowIndex);

if (!row.hasKey(GridState.JSONKEY_DETAILS_VISIBLE)
|| row.getString(GridState.JSONKEY_DETAILS_VISIBLE)
.isEmpty()) {
if (!row.hasKey(GridState.JSONKEY_DETAILS_VISIBLE) || row
.getString(GridState.JSONKEY_DETAILS_VISIBLE).isEmpty()) {
return null;
}

@@ -782,8 +782,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
if (!Arrays.equals(columnIds, getState().sortColumns)
|| !Arrays.equals(directions, getState().sortDirs)) {
// Report back to server if changed
getRpcProxy(GridServerRpc.class).sort(columnIds,
directions, event.isUserOriginated());
getRpcProxy(GridServerRpc.class).sort(columnIds, directions,
event.isUserOriginated());
}
}
});
@@ -939,7 +939,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
}

private void updateHeaderCellFromState(HeaderCell cell, CellState cellState) {
private void updateHeaderCellFromState(HeaderCell cell,
CellState cellState) {
switch (cellState.type) {
case TEXT:
cell.setText(cellState.text);
@@ -958,8 +959,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
break;
default:
throw new IllegalStateException("unexpected cell type: "
+ cellState.type);
throw new IllegalStateException(
"unexpected cell type: " + cellState.type);
}
cell.setStyleName(cellState.styleName);
}
@@ -999,7 +1000,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
}

private void updateFooterCellFromState(FooterCell cell, CellState cellState) {
private void updateFooterCellFromState(FooterCell cell,
CellState cellState) {
switch (cellState.type) {
case TEXT:
cell.setText(cellState.text);
@@ -1018,8 +1020,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
break;
default:
throw new IllegalStateException("unexpected cell type: "
+ cellState.type);
throw new IllegalStateException(
"unexpected cell type: " + cellState.type);
}
cell.setStyleName(cellState.styleName);
}
@@ -1074,7 +1076,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
column.setExpandRatio(state.expandRatio);

assert state.rendererConnector instanceof AbstractRendererConnector : "GridColumnState.rendererConnector is invalid (not subclass of AbstractRendererConnector)";
column.setRenderer((AbstractRendererConnector<Object>) state.rendererConnector);
column.setRenderer(
(AbstractRendererConnector<Object>) state.rendererConnector);

column.setSortable(state.sortable);

@@ -1087,7 +1090,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements
column.setHidingToggleCaption(state.hidingToggleCaption);

column.setEditable(state.editable);
column.setEditorConnector((AbstractComponentConnector) state.editorConnector);
column.setEditorConnector(
(AbstractComponentConnector) state.editorConnector);
}

/**

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

@@ -45,14 +45,14 @@ import elemental.json.JsonValue;
// This is really typed to <JsonValue>, but because of the way native strings
// are not always instanceof JsonValue, we need to accept Object
@Connect(AbstractJavaScriptRenderer.class)
public class JavaScriptRendererConnector extends
AbstractRendererConnector<Object> implements
HasJavaScriptConnectorHelper {
public class JavaScriptRendererConnector
extends AbstractRendererConnector<Object>
implements HasJavaScriptConnectorHelper {
private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper(
this);

private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper(BrowserInfo
.get().isIE8());
private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper(
BrowserInfo.get().isIE8());

@Override
protected void init() {
@@ -137,9 +137,9 @@ public class JavaScriptRendererConnector extends
helper.ensureJavascriptInited();

if (!hasFunction("render")) {
throw new RuntimeException("JavaScriptRenderer "
+ helper.getInitFunctionName()
+ " must have a function named 'render'");
throw new RuntimeException(
"JavaScriptRenderer " + helper.getInitFunctionName()
+ " must have a function named 'render'");
}

final boolean hasInit = hasFunction("init");
@@ -221,8 +221,8 @@ public class JavaScriptRendererConnector extends
@Override
public Collection<String> getConsumedEvents() {
if (hasGetConsumedEvents) {
JsArrayString events = getConsumedEvents(helper
.getConnectorWrapper());
JsArrayString events = getConsumedEvents(
helper.getConnectorWrapper());

ArrayList<String> list = new ArrayList<String>(
events.length());

+ 16
- 12
client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java View File

@@ -87,8 +87,8 @@ public class MultiSelectionModelConnector extends
@OnStateChange("allSelected")
void updateSelectAllCheckbox() {
if (selectionModel.getSelectionColumnRenderer() != null) {
HeaderCell cell = getGrid().getDefaultHeaderRow().getCell(
getGrid().getColumn(0));
HeaderCell cell = getGrid().getDefaultHeaderRow()
.getCell(getGrid().getColumn(0));
CheckBox widget = (CheckBox) cell.getWidget();
widget.setValue(getState().allSelected, false);
}
@@ -119,11 +119,12 @@ public class MultiSelectionModelConnector extends
selectAll();
}
});
dataAvailable = getGrid().addDataAvailableHandler(
new DataAvailableHandler() {
dataAvailable = getGrid()
.addDataAvailableHandler(new DataAvailableHandler() {

@Override
public void onDataAvailable(DataAvailableEvent event) {
public void onDataAvailable(
DataAvailableEvent event) {
availableRows = event.getAvailableRows();
}
});
@@ -156,7 +157,8 @@ public class MultiSelectionModelConnector extends
assert !isBeingBatchSelected() : "Can't select all in middle of a batch selection.";

DataSource<JsonObject> dataSource = getGrid().getDataSource();
for (int i = availableRows.getStart(); i < availableRows.getEnd(); ++i) {
for (int i = availableRows.getStart(); i < availableRows
.getEnd(); ++i) {
final JsonObject row = dataSource.getRow(i);
if (row != null) {
RowHandle<JsonObject> handle = dataSource.getHandle(row);
@@ -202,7 +204,8 @@ public class MultiSelectionModelConnector extends
assert !isBeingBatchSelected() : "Can't select all in middle of a batch selection.";

DataSource<JsonObject> dataSource = getGrid().getDataSource();
for (int i = availableRows.getStart(); i < availableRows.getEnd(); ++i) {
for (int i = availableRows.getStart(); i < availableRows
.getEnd(); ++i) {
final JsonObject row = dataSource.getRow(i);
if (row != null) {
RowHandle<JsonObject> handle = dataSource.getHandle(row);
@@ -300,8 +303,8 @@ public class MultiSelectionModelConnector extends
* rows. Unpins any pinned rows.
*/
private void sendDeselected() {
getRpcProxy(MultiSelectionModelServerRpc.class).deselect(
getRowKeys(deselected));
getRpcProxy(MultiSelectionModelServerRpc.class)
.deselect(getRowKeys(deselected));

if (isBeingBatchSelected()) {
for (RowHandle<JsonObject> row : deselected) {
@@ -317,8 +320,8 @@ public class MultiSelectionModelConnector extends
* Unpins any pinned rows.
*/
private void sendSelected() {
getRpcProxy(MultiSelectionModelServerRpc.class).select(
getRowKeys(selected));
getRpcProxy(MultiSelectionModelServerRpc.class)
.select(getRowKeys(selected));

if (isBeingBatchSelected()) {
for (RowHandle<JsonObject> row : selected) {
@@ -347,7 +350,8 @@ public class MultiSelectionModelConnector extends

@Override
public void startBatchSelect() {
assert selected.isEmpty() && deselected.isEmpty() : "Row caches were not clear.";
assert selected.isEmpty()
&& deselected.isEmpty() : "Row caches were not clear.";
batchSelect = true;
}


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

@@ -30,8 +30,8 @@ import elemental.json.JsonObject;
* @author Vaadin Ltd
*/
@Connect(NoSelectionModel.class)
public class NoSelectionModelConnector extends
AbstractSelectionModelConnector<SelectionModel<JsonObject>> {
public class NoSelectionModelConnector
extends AbstractSelectionModelConnector<SelectionModel<JsonObject>> {

@Override
protected void extend(ServerConnector target) {

+ 2
- 3
client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java View File

@@ -18,9 +18,8 @@ package com.vaadin.client.connectors;
import com.vaadin.shared.ui.Connect;

/**
* A connector for
* {@link com.vaadin.ui.components.grid.renderers.NumberRenderer NumberRenderer}
* .
* A connector for {@link com.vaadin.ui.components.grid.renderers.NumberRenderer
* NumberRenderer} .
* <p>
* The server-side Renderer operates on numbers, but the data is serialized as a
* string, and displayed as-is on the client side. This is to be able to support

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

@@ -25,8 +25,8 @@ import com.vaadin.shared.ui.Connect;
* @author Vaadin Ltd
*/
@Connect(com.vaadin.ui.renderers.ProgressBarRenderer.class)
public class ProgressBarRendererConnector extends
AbstractRendererConnector<Double> {
public class ProgressBarRendererConnector
extends AbstractRendererConnector<Double> {

@Override
public ProgressBarRenderer getRenderer() {

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

@@ -133,8 +133,8 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector {

Range cached = getCachedRange();

rpcProxy.requestRows(firstRowIndex, numberOfRows,
cached.getStart(), cached.length());
rpcProxy.requestRows(firstRowIndex, numberOfRows, cached.getStart(),
cached.length());

/*
* Show the progress indicator if there is a pending data request

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

@@ -78,8 +78,8 @@ public class SingleSelectionModelConnector extends
/**
* SingleSelectionModel without a selection column renderer.
*/
public class SingleSelectionModel extends AbstractSelectionModel implements
SelectionModel.Single<JsonObject> {
public class SingleSelectionModel extends AbstractSelectionModel
implements SelectionModel.Single<JsonObject> {

private RowHandle<JsonObject> selectedRow;
private boolean deselectAllowed;
@@ -110,8 +110,8 @@ public class SingleSelectionModelConnector extends
// Check if currently re-selected row was deselected from
// the server.
if (row != null && getRowHandle(row).equals(selectedRow)) {
if (selectedRow.getRow().hasKey(
GridState.JSONKEY_SELECTED)) {
if (selectedRow.getRow()
.hasKey(GridState.JSONKEY_SELECTED)) {
// Everything is OK, no need to do anything.
return false;
}
@@ -130,8 +130,8 @@ public class SingleSelectionModelConnector extends
}

if (changed) {
getRpcProxy(SingleSelectionModelServerRpc.class).select(
getRowKey(row));
getRpcProxy(SingleSelectionModelServerRpc.class)
.select(getRowKey(row));
}

return changed;

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

@@ -26,8 +26,8 @@ import com.vaadin.shared.ui.Connect;
* @author Vaadin Ltd
*/
@Connect(com.vaadin.ui.renderers.HtmlRenderer.class)
public class UnsafeHtmlRendererConnector extends
AbstractRendererConnector<String> {
public class UnsafeHtmlRendererConnector
extends AbstractRendererConnector<String> {

public static class UnsafeHtmlRenderer implements Renderer<String> {
@Override

+ 14
- 9
client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java View File

@@ -437,8 +437,10 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> {
Range received = Range.withLength(firstRowIndex, rowData.size());

if (isWaitingForData()) {
cacheStrategy.onDataArrive(Duration.currentTimeMillis()
- currentRequestCallback.requestStart, received.length());
cacheStrategy.onDataArrive(
Duration.currentTimeMillis()
- currentRequestCallback.requestStart,
received.length());

currentRequestCallback = null;
}
@@ -450,17 +452,20 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> {
Range newUsefulData = partition[1];
if (!newUsefulData.isEmpty()) {
// Update the parts that are actually inside
for (int i = newUsefulData.getStart(); i < newUsefulData.getEnd(); i++) {
for (int i = newUsefulData.getStart(); i < newUsefulData
.getEnd(); i++) {
final T row = rowData.get(i - firstRowIndex);
indexToRowMap.put(Integer.valueOf(i), row);
keyToIndexMap.put(getRowKey(row), Integer.valueOf(i));
}

if (dataChangeHandler != null) {
Profiler.enter("AbstractRemoteDataSource.setRowData notify dataChangeHandler");
Profiler.enter(
"AbstractRemoteDataSource.setRowData notify dataChangeHandler");
dataChangeHandler.dataUpdated(newUsefulData.getStart(),
newUsefulData.length());
Profiler.leave("AbstractRemoteDataSource.setRowData notify dataChangeHandler");
Profiler.leave(
"AbstractRemoteDataSource.setRowData notify dataChangeHandler");
}

// Potentially extend the range
@@ -552,8 +557,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> {
// Removal and cache share some indices. fix accordingly.
Range[] partitions = cached.partitionWith(removedRange);
Range remainsBefore = partitions[0];
Range transposedRemainsAfter = partitions[2].offsetBy(-removedRange
.length());
Range transposedRemainsAfter = partitions[2]
.offsetBy(-removedRange.length());
cached = remainsBefore.combineWith(transposedRemainsAfter);
} else if (removedRange.getEnd() <= cached.getStart()) {
// Removal was before the cache. offset the cache.
@@ -696,8 +701,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> {
Object key = getRowKey(row);

if (key == null) {
throw new NullPointerException("key may not be null (row: " + row
+ ")");
throw new NullPointerException(
"key may not be null (row: " + row + ")");
}

if (pinnedRows.containsKey(key)) {

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

@@ -46,8 +46,8 @@ public interface CacheStrategy {
Range estimatedAvailableRange) {
int cacheSize = getMinimumCacheSize(displayedRange.length());

return displayedRange.expand(cacheSize, cacheSize).restrictTo(
estimatedAvailableRange);
return displayedRange.expand(cacheSize, cacheSize)
.restrictTo(estimatedAvailableRange);
}

@Override
@@ -55,8 +55,8 @@ public interface CacheStrategy {
Range estimatedAvailableRange) {
int cacheSize = getMaximumCacheSize(displayedRange.length());

return displayedRange.expand(cacheSize, cacheSize).restrictTo(
estimatedAvailableRange);
return displayedRange.expand(cacheSize, cacheSize)
.restrictTo(estimatedAvailableRange);
}

/**
@@ -86,8 +86,8 @@ public interface CacheStrategy {
* the cache and items are discarded if there's yet another page size worth
* of items cached in either direction.
*/
public static class DefaultCacheStrategy extends
AbstractBasicSymmetricalCacheStrategy {
public static class DefaultCacheStrategy
extends AbstractBasicSymmetricalCacheStrategy {
private final int minimumRatio;
private final int maximumRatio;


+ 14
- 15
client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java View File

@@ -68,8 +68,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
int size = valueMapArray.length();

if (size > 0) {
SimpleTree root = new SimpleTree("Layouts analyzed, " + size
+ " top level problems");
SimpleTree root = new SimpleTree(
"Layouts analyzed, " + size + " top level problems");
for (int i = 0; i < size; i++) {
printLayoutError(ac, valueMapArray.get(i), root);
}
@@ -94,7 +94,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
printClientSideDetectedIssues(zeroHeightComponents, ac);
}
if (zeroWidthComponents.size() > 0) {
add(new HTML("<p><strong>Horizontally zero size:</strong></p>"));
add(new HTML(
"<p><strong>Horizontally zero size:</strong></p>"));
printClientSideDetectedIssues(zeroWidthComponents, ac);
}
}
@@ -111,12 +112,10 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
final ServerConnector parent = connector.getParent();
final String parentId = parent.getConnectorId();

final Label errorDetails = new Label(connector.getClass()
.getSimpleName()
+ "["
+ connector.getConnectorId()
+ "]"
+ " inside " + parent.getClass().getSimpleName());
final Label errorDetails = new Label(
connector.getClass().getSimpleName() + "["
+ connector.getConnectorId() + "]" + " inside "
+ parent.getClass().getSimpleName());

if (parent instanceof ComponentConnector) {
final ComponentConnector parentConnector = (ComponentConnector) parent;
@@ -173,8 +172,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel {

Highlight.show(connector);

final SimpleTree errorNode = new SimpleTree(connector.getClass()
.getSimpleName() + " id: " + pid);
final SimpleTree errorNode = new SimpleTree(
connector.getClass().getSimpleName() + " id: " + pid);
errorNode.addDomHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
@@ -205,12 +204,12 @@ public class AnalyzeLayoutsPanel extends FlowPanel {
VerticalPanel errorDetails = new VerticalPanel();

if (valueMap.containsKey("heightMsg")) {
errorDetails.add(new Label("Height problem: "
+ valueMap.getString("heightMsg")));
errorDetails.add(new Label(
"Height problem: " + valueMap.getString("heightMsg")));
}
if (valueMap.containsKey("widthMsg")) {
errorDetails.add(new Label("Width problem: "
+ valueMap.getString("widthMsg")));
errorDetails.add(new Label(
"Width problem: " + valueMap.getString("widthMsg")));
}
if (errorDetails.getWidgetCount() > 0) {
errorNode.add(errorDetails);

+ 4
- 4
client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java View File

@@ -57,13 +57,13 @@ public class ConnectorInfoPanel extends FlowPanel {
if (connector instanceof ComponentConnector) {
ComponentConnector component = (ComponentConnector) connector;

ignoreProperties.addAll(Arrays.asList("caption", "description",
"width", "height"));
ignoreProperties.addAll(
Arrays.asList("caption", "description", "width", "height"));

AbstractComponentState componentState = component.getState();

html += getRowHTML("Widget", component.getWidget().getClass()
.getSimpleName());
html += getRowHTML("Widget",
component.getWidget().getClass().getSimpleName());
html += getRowHTML("Caption", componentState.caption);
html += getRowHTML("Description", componentState.description);
html += getRowHTML("Width", componentState.width + " (actual: "

+ 1
- 1
client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java View File

@@ -44,7 +44,7 @@ public class DebugButton extends Button {
public DebugButton(String caption) {
this(null, null, caption);
}
public DebugButton(String caption, String title) {
this(null, title, caption);
}

+ 2
- 2
client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java View File

@@ -66,8 +66,8 @@ public class ErrorNotificationHandler extends Handler {
.getRunningApplications().get(0);
owner = connection.getUIConnector().getWidget();
}
VNotification n = VNotification.createNotification(
VNotification.DELAY_FOREVER, owner);
VNotification n = VNotification
.createNotification(VNotification.DELAY_FOREVER, owner);
n.getElement().getStyle().setTextAlign(TextAlign.LEFT);
n.show("<h1>Uncaught client side exception</h1><br />"
+ exceptionText.replace("\n", "<br/>\n"),

+ 10
- 10
client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java View File

@@ -121,8 +121,8 @@ public class HierarchySection implements Section {
stopFind();
connector.getConnection().getUIConnector()
.showServerDesign(connector);
content.setWidget(new HTML(
"Design file for component sent to server log"));
content.setWidget(
new HTML("Design file for component sent to server log"));
}

};
@@ -334,17 +334,17 @@ public class HierarchySection implements Section {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {

if (event.getTypeInt() == Event.ONKEYDOWN
&& event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) {
if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent()
.getKeyCode() == KeyCodes.KEY_ESCAPE) {
stopFind();
Highlight.hideAll();
return;
}
if (event.getTypeInt() == Event.ONMOUSEMOVE) {
Highlight.hideAll();
Element eventTarget = WidgetUtil.getElementFromPoint(event
.getNativeEvent().getClientX(), event.getNativeEvent()
.getClientY());
Element eventTarget = WidgetUtil.getElementFromPoint(
event.getNativeEvent().getClientX(),
event.getNativeEvent().getClientY());

if (VDebugWindow.get().getElement().isOrHasChild(eventTarget)) {
// Do not prevent using debug window controls
@@ -376,9 +376,9 @@ public class HierarchySection implements Section {
event.cancel();
event.consume();
event.getNativeEvent().stopPropagation();
Element eventTarget = WidgetUtil.getElementFromPoint(event
.getNativeEvent().getClientX(), event.getNativeEvent()
.getClientY());
Element eventTarget = WidgetUtil.getElementFromPoint(
event.getNativeEvent().getClientX(),
event.getNativeEvent().getClientY());
for (ApplicationConnection a : ApplicationConfiguration
.getRunningApplications()) {
ComponentConnector connector = Util.getConnectorForElement(

+ 2
- 2
client/src/main/java/com/vaadin/client/debug/internal/Highlight.java View File

@@ -204,8 +204,8 @@ public class Highlight {
style.setBackgroundColor(color);
style.setOpacity(DEFAULT_OPACITY);
if (BrowserInfo.get().isIE()) {
style.setProperty("filter", "alpha(opacity="
+ (DEFAULT_OPACITY * 100) + ")");
style.setProperty("filter",
"alpha(opacity=" + (DEFAULT_OPACITY * 100) + ")");
}

highlights.add(highlight);

+ 6
- 6
client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java View File

@@ -165,8 +165,8 @@ public class InfoSection implements Section {
addRow("Widget set", GWT.getModuleName());
addRow("Theme", connection.getUIConnector().getActiveTheme());

String communicationMethodInfo = connection
.getMessageSender().getCommunicationMethodName();
String communicationMethodInfo = connection.getMessageSender()
.getCommunicationMethodName();
int pollInterval = connection.getUIConnector().getState().pollInterval;
if (pollInterval > 0) {
communicationMethodInfo += " (poll interval " + pollInterval
@@ -211,10 +211,10 @@ public class InfoSection implements Section {
themeVersion);
boolean servletOk = equalsEither(servletVersion, clientVersion,
themeVersion);
addRow("Client engine version", clientVersion, clientOk ? null
: ERROR_STYLE);
addRow("Server engine version", servletVersion, servletOk ? null
: ERROR_STYLE);
addRow("Client engine version", clientVersion,
clientOk ? null : ERROR_STYLE);
addRow("Server engine version", servletVersion,
servletOk ? null : ERROR_STYLE);
addRow("Theme version", themeVersion, themeOk ? null : ERROR_STYLE);
if (jsVersion != null) {
addRow("Push server version", atmosphereVersion);

+ 6
- 5
client/src/main/java/com/vaadin/client/debug/internal/LogSection.java View File

@@ -61,7 +61,8 @@ public class LogSection implements Section {
}

@Override
protected String getRecordInfo(LogRecord event, String newline) {
protected String getRecordInfo(LogRecord event,
String newline) {
return "";
}
});
@@ -157,8 +158,8 @@ public class LogSection implements Section {
public void onClick(ClickEvent event) {
Element el = Element
.as(event.getNativeEvent().getEventTarget());
while (!el.getClassName().contains(
VDebugWindow.STYLENAME + "-message")) {
while (!el.getClassName()
.contains(VDebugWindow.STYLENAME + "-message")) {
if (el == contentElement) {
// clicked something else
return;
@@ -336,8 +337,8 @@ public class LogSection implements Section {
+ "'></span><span class='" + VDebugWindow.STYLENAME
+ "-time' title='"
+ VDebugWindow.getTimingTooltip(sinceStart, sinceReset) + "'>"
+ sinceReset + "ms</span><span class='"
+ VDebugWindow.STYLENAME + "-message'>" + msg + "</span>";
+ sinceReset + "ms</span><span class='" + VDebugWindow.STYLENAME
+ "-message'>" + msg + "</span>";
row.setInnerHTML(inner);

contentElement.appendChild(row);

+ 2
- 2
client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java View File

@@ -84,8 +84,8 @@ public class NetworkSection implements Section {
VUIDLBrowser vuidlBrowser = new VUIDLBrowser(uidl, ac);
vuidlBrowser.addStyleName(VDebugWindow.STYLENAME + "-row");
vuidlBrowser.setText("Response @ " + sinceReset + "ms");
vuidlBrowser.setTitle(VDebugWindow.getTimingTooltip(sinceStart,
sinceReset));
vuidlBrowser.setTitle(
VDebugWindow.getTimingTooltip(sinceStart, sinceReset));
vuidlBrowser.close();

content.add(vuidlBrowser);

+ 2
- 2
client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java View File

@@ -95,8 +95,8 @@ public class OptimizedWidgetsetPanel extends FlowPanel {
tag++;
if (tag > 10000) {
// Sanity check
getLogger()
.severe("Search for used connector classes was forcefully terminated");
getLogger().severe(
"Search for used connector classes was forcefully terminated");
break;
}
}

+ 9
- 7
client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java View File

@@ -69,13 +69,13 @@ public class ProfilerSection implements Section {
SimpleTree offendersTree = new SimpleTree("Longest events");
for (int i = 0; i < totals.size() && i < 20; i++) {
Node node = totals.get(i);
offendersTree.add(new Label(node
.getStringRepresentation("")));
offendersTree
.add(new Label(node.getStringRepresentation("")));
}

SimpleTree root = new SimpleTree(eventCount
+ " profiler events using " + Util.round(totalTime, 3)
+ " ms");
SimpleTree root = new SimpleTree(
eventCount + " profiler events using "
+ Util.round(totalTime, 3) + " ms");
root.add(drillDownTree);
root.add(offendersTree);
root.open(false);
@@ -85,12 +85,14 @@ public class ProfilerSection implements Section {
}

@Override
public void addBootstrapData(LinkedHashMap<String, Double> timings) {
public void addBootstrapData(
LinkedHashMap<String, Double> timings) {
SimpleTree tree = new SimpleTree(
"Time since window.performance.timing events");
Set<Entry<String, Double>> entrySet = timings.entrySet();
for (Entry<String, Double> entry : entrySet) {
tree.add(new Label(entry.getValue() + " " + entry.getKey()));
tree.add(
new Label(entry.getValue() + " " + entry.getKey()));
}

tree.open(false);

+ 2
- 1
client/src/main/java/com/vaadin/client/debug/internal/Section.java View File

@@ -31,7 +31,8 @@ public interface Section {
* Returns a button that will be used to activate this section, displayed as
* a tab in {@link VDebugWindow}.
* <p>
* <em>The same instance <b>must</b> be returned each time this method is called.</em>
* <em>The same instance <b>must</b> be returned each time this method is
* called.</em>
* </p>
* <p>
* The button should preferably only have an icon (no caption), and should

+ 0
- 0
client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java View File


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

Loading…
Cancel
Save