From 074b1095ee302af67626055820853ed1b8a4ea86 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Fri, 7 Sep 2012 10:09:02 +0300 Subject: [PATCH] Now using HTML5 content mode. Also deprecated the XHTML content modes. --- .../vaadin/client/ui/label/LabelConnector.java | 1 + .../com/vaadin/server/AbstractErrorMessage.java | 15 +++++++++++++-- .../src/com/vaadin/server/BootstrapHandler.java | 7 +++---- server/src/com/vaadin/server/SystemError.java | 4 ++-- server/src/com/vaadin/server/UserError.java | 4 ++-- server/src/com/vaadin/ui/Label.java | 5 +++-- server/src/com/vaadin/ui/LoginForm.java | 5 +---- .../com/vaadin/shared/ui/label/ContentMode.java | 12 ++++++++++-- 8 files changed, 35 insertions(+), 18 deletions(-) diff --git a/client/src/com/vaadin/client/ui/label/LabelConnector.java b/client/src/com/vaadin/client/ui/label/LabelConnector.java index 33ec07b9f2..b52809c90e 100644 --- a/client/src/com/vaadin/client/ui/label/LabelConnector.java +++ b/client/src/com/vaadin/client/ui/label/LabelConnector.java @@ -58,6 +58,7 @@ public class LabelConnector extends AbstractComponentConnector { break; case XHTML: + case HTML: case RAW: sinkOnloads = true; case XML: diff --git a/server/src/com/vaadin/server/AbstractErrorMessage.java b/server/src/com/vaadin/server/AbstractErrorMessage.java index 4e30dff06f..3ab0e73c8a 100644 --- a/server/src/com/vaadin/server/AbstractErrorMessage.java +++ b/server/src/com/vaadin/server/AbstractErrorMessage.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -43,9 +43,19 @@ public abstract class AbstractErrorMessage implements ErrorMessage { * Content mode, where the error contains preformatted text. */ PREFORMATTED, + + /** + * Content mode, where the error contains XHTML. + * + */ + HTML, + /** * Content mode, where the error contains XHTML. + * + * @deprecated Use {@link ContentMode.HTML} */ + @Deprecated XHTML; } @@ -116,6 +126,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage { + ""; break; case XHTML: + case HTML: result = getMessage(); break; } @@ -151,7 +162,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage { } else if (t instanceof Validator.InvalidValueException) { UserError error = new UserError( ((Validator.InvalidValueException) t).getHtmlMessage(), - ContentMode.XHTML, ErrorLevel.ERROR); + ContentMode.HTML, ErrorLevel.ERROR); for (Validator.InvalidValueException nestedException : ((Validator.InvalidValueException) t) .getCauses()) { error.addCause(getErrorMessageForException(nestedException)); diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 491830fb81..1301978fd4 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -200,10 +200,9 @@ public abstract class BootstrapHandler implements RequestHandler { Document document = response.getDocument(); - DocumentType doctype = new DocumentType("html", - "-//W3C//DTD XHTML 1.0 Transitional//EN", - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", + DocumentType doctype = new DocumentType("html", "", "", document.baseUri()); + document.child(0).before(doctype); document.body().parent().attr("xmlns", "http://www.w3.org/1999/xhtml"); @@ -303,7 +302,7 @@ public abstract class BootstrapHandler implements RequestHandler { * .v-app-loading * .v-app- *- Additionally added from javascript: - * .v-theme- + * .v-theme- */ String appClass = "v-app-" diff --git a/server/src/com/vaadin/server/SystemError.java b/server/src/com/vaadin/server/SystemError.java index aa9ffcaf52..14fc0831a4 100644 --- a/server/src/com/vaadin/server/SystemError.java +++ b/server/src/com/vaadin/server/SystemError.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -40,7 +40,7 @@ public class SystemError extends AbstractErrorMessage { public SystemError(String message) { super(message); setErrorLevel(ErrorLevel.SYSTEMERROR); - setMode(ContentMode.XHTML); + setMode(ContentMode.HTML); setMessage(getHtmlMessage()); } diff --git a/server/src/com/vaadin/server/UserError.java b/server/src/com/vaadin/server/UserError.java index 756f2e70e0..c59eb382ee 100644 --- a/server/src/com/vaadin/server/UserError.java +++ b/server/src/com/vaadin/server/UserError.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -39,7 +39,7 @@ public class UserError extends AbstractErrorMessage { public static final ContentMode CONTENT_PREFORMATTED = ContentMode.PREFORMATTED; /** - * @deprecated from 7.0, use {@link ContentMode#XHTML} instead     + * @deprecated from 7.0, use {@link ContentMode#HTML} instead     */ @Deprecated public static final ContentMode CONTENT_XHTML = ContentMode.XHTML; diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index 86cbdb3253..b3a6f43e64 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -414,7 +414,8 @@ public class Label extends AbstractComponent implements Property, } if (getContentMode() == ContentMode.XHTML - || getContentMode() == ContentMode.XML) { + || getContentMode() == ContentMode.XML + || getContentMode() == ContentMode.HTML) { return stripTags(stringValue); } else { return stringValue; diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index 2e372e8512..69778c4c07 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -135,10 +135,7 @@ public class LoginForm extends CustomComponent { String appUri = getSession().getURL().toString(); try { - return ("\n" + "" + return ("\n" + "" + "