summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/client/VCaption.java
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-03-15 11:50:44 +0200
committerArtur Signell <artur@vaadin.com>2012-03-21 17:52:35 +0200
commit1072afbb2eeb26083fb90ad6f06357a4cba0cb52 (patch)
treee5bd4602457e09aa7c4f9d1cfe1ed94883e2ee87 /src/com/vaadin/terminal/gwt/client/VCaption.java
parente905f033ff2b2aa094b51eae72fef63e68bd1800 (diff)
downloadvaadin-framework-1072afbb2eeb26083fb90ad6f06357a4cba0cb52.tar.gz
vaadin-framework-1072afbb2eeb26083fb90ad6f06357a4cba0cb52.zip
Refactor error messages not to use UIDL (#8437).
This change removes support for error messages on tabs of a tabsheet or an accordion. Those should be implemented differently if needed.
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/VCaption.java')
-rw-r--r--src/com/vaadin/terminal/gwt/client/VCaption.java32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/VCaption.java b/src/com/vaadin/terminal/gwt/client/VCaption.java
index 40ade41998..b1adb83db8 100644
--- a/src/com/vaadin/terminal/gwt/client/VCaption.java
+++ b/src/com/vaadin/terminal/gwt/client/VCaption.java
@@ -32,11 +32,9 @@ public class VCaption extends HTML {
private int maxWidth = -1;
- protected static final String ATTRIBUTE_ICON = AbstractComponentConnector.ATTRIBUTE_ICON;
protected static final String ATTRIBUTE_CAPTION = "caption";
protected static final String ATTRIBUTE_DESCRIPTION = "description";
protected static final String ATTRIBUTE_REQUIRED = AbstractComponentConnector.ATTRIBUTE_REQUIRED;
- protected static final String ATTRIBUTE_ERROR = AbstractComponentConnector.ATTRIBUTE_ERROR;
protected static final String ATTRIBUTE_HIDEERRORS = AbstractComponentConnector.ATTRIBUTE_HIDEERRORS;
private enum InsertPosition {
@@ -120,8 +118,7 @@ public class VCaption extends HTML {
boolean hasIcon = owner.getState().getIcon() != null;
boolean showRequired = uidl
.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED);
- boolean showError = uidl
- .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
+ boolean showError = owner.getState().getErrorMessage() != null
&& !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);
if (hasIcon) {
@@ -279,9 +276,6 @@ public class VCaption extends HTML {
}
}
boolean hasIcon = iconURL != null;
- boolean showError = uidl
- .hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
- && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);
if (hasIcon) {
if (icon == null) {
@@ -324,7 +318,7 @@ public class VCaption extends HTML {
// browsers when it is set to the empty string. If there is an
// icon, error indicator or required indicator they will ensure
// that space is reserved.
- if (!hasIcon && !showError) {
+ if (!hasIcon) {
captionText.setInnerHTML("&nbsp;");
}
} else {
@@ -337,22 +331,6 @@ public class VCaption extends HTML {
captionText = null;
}
- if (showError) {
- if (errorIndicatorElement == null) {
- errorIndicatorElement = DOM.createDiv();
- DOM.setInnerHTML(errorIndicatorElement, "&nbsp;");
- DOM.setElementProperty(errorIndicatorElement, "className",
- "v-errorindicator");
-
- DOM.insertChild(getElement(), errorIndicatorElement,
- getInsertPosition(InsertPosition.ERROR));
- }
- } else if (errorIndicatorElement != null) {
- // Remove existing
- getElement().removeChild(errorIndicatorElement);
- errorIndicatorElement = null;
- }
-
return (wasPlacedAfterComponent != placedAfterComponent);
}
@@ -400,6 +378,9 @@ public class VCaption extends HTML {
if (state.getIcon() != null) {
return true;
}
+ if (state.getErrorMessage() != null) {
+ return true;
+ }
} else {
// TODO fallback for cases where the caption has no owner (Tabsheet,
// Accordion)
@@ -410,9 +391,6 @@ public class VCaption extends HTML {
return true;
}
}
- if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
- return true;
- }
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED)) {
return true;
}