Browse Source

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.
tags/7.0.0.alpha2
Henri Sara 12 years ago
parent
commit
1072afbb2e

+ 3
- 8
src/com/vaadin/Application.java View File

import com.vaadin.data.util.converter.ConverterFactory; import com.vaadin.data.util.converter.ConverterFactory;
import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.data.util.converter.DefaultConverterFactory;
import com.vaadin.service.ApplicationContext; import com.vaadin.service.ApplicationContext;
import com.vaadin.terminal.AbstractErrorMessage;
import com.vaadin.terminal.ApplicationResource; import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.CombinedRequest; import com.vaadin.terminal.CombinedRequest;
import com.vaadin.terminal.ErrorMessage;
import com.vaadin.terminal.RequestHandler; import com.vaadin.terminal.RequestHandler;
import com.vaadin.terminal.SystemError;
import com.vaadin.terminal.Terminal; import com.vaadin.terminal.Terminal;
import com.vaadin.terminal.VariableOwner; import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedRequest;


// Shows the error in AbstractComponent // Shows the error in AbstractComponent
if (owner instanceof AbstractComponent) { if (owner instanceof AbstractComponent) {
if (t instanceof ErrorMessage) {
((AbstractComponent) owner).setComponentError((ErrorMessage) t);
} else {
((AbstractComponent) owner)
.setComponentError(new SystemError(t));
}
((AbstractComponent) owner).setComponentError(AbstractErrorMessage
.getErrorMessageForException(t));
} }


// also print the error on console // also print the error on console

+ 24
- 27
src/com/vaadin/terminal/AbstractErrorMessage.java View File



import com.vaadin.data.Buffered; import com.vaadin.data.Buffered;
import com.vaadin.data.Validator; import com.vaadin.data.Validator;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;


/** /**
this.message = message; this.message = message;
} }


protected String getMessage() {
public String getMessage() {
return message; return message;
} }


causes.add(cause); causes.add(cause);
} }


@Deprecated
public void paint(PaintTarget target) throws PaintException {

// TODO if no message and only one cause, paint cause only? error level?

target.startTag(AbstractComponentConnector.ATTRIBUTE_ERROR);
target.addAttribute("level", level.getText());

paintContent(target);

target.endTag(AbstractComponentConnector.ATTRIBUTE_ERROR);
}

// TODO temporary method - move logic to client side
@Deprecated
protected void paintContent(PaintTarget target) throws PaintException {
// Paint the message
public String getFormattedHtmlMessage() {
String result = null;
switch (getMode()) { switch (getMode()) {
case TEXT: case TEXT:
target.addText(AbstractApplicationServlet
.safeEscapeForHtml(getMessage()));
result = AbstractApplicationServlet.safeEscapeForHtml(getMessage());
break; break;
case PREFORMATTED: case PREFORMATTED:
target.addText("<pre>"
result = "<pre>"
+ AbstractApplicationServlet + AbstractApplicationServlet
.safeEscapeForHtml(getMessage()) + "</pre>");
.safeEscapeForHtml(getMessage()) + "</pre>";
break; break;
case XHTML: case XHTML:
target.addText(getMessage());
result = getMessage();
break; break;
} }

if (getCauses().size() > 0) {
// if no message, combine the messages of all children
if (null == result && null != getCauses() && getCauses().size() > 0) {
StringBuilder sb = new StringBuilder();
for (ErrorMessage cause : getCauses()) { for (ErrorMessage cause : getCauses()) {
cause.paint(target);
String childMessage = cause.getFormattedHtmlMessage();
if (null != childMessage) {
sb.append("<div>");
sb.append(childMessage);
sb.append("</div>\n");
}
} }
if (sb.length() > 0) {
result = sb.toString();
}
}
// still no message? use an empty string for backwards compatibility
if (null == result) {
result = "";
} }
return result;
} }


// TODO replace this with a helper method elsewhere? // TODO replace this with a helper method elsewhere?

+ 9
- 12
src/com/vaadin/terminal/ErrorMessage.java View File

public ErrorLevel getErrorLevel(); public ErrorLevel getErrorLevel();


/** /**
* <p>
* Paints the error message into a UIDL stream. This method creates the UIDL
* sequence describing it and outputs it to the given UIDL stream.
* </p>
* Returns the HTML formatted message to show in as the error message on the
* client.
* *
* @param target
* the target UIDL stream where the error should paint itself to.
* @throws PaintException
* if the paint operation failed.
* @deprecated error messages should not be painted to UIDL but sent
* differently
* This method should perform any necessary escaping to avoid XSS attacks.
*
* TODO this API may still change to use a separate data transfer object
*
* @return HTML formatted string for the error message
* @since 7.0
*/ */
@Deprecated
public void paint(PaintTarget target) throws PaintException;
public String getFormattedHtmlMessage();


} }

+ 27
- 0
src/com/vaadin/terminal/gwt/client/ComponentState.java View File

*/ */
private Set<String> registeredEventListeners = null; private Set<String> registeredEventListeners = null;


// HTML formatted error message for the component
// TODO this could be an object with more information, but currently the UI
// only uses the message
private String errorMessage = null;

/** /**
* Returns the component height as set by the server. * Returns the component height as set by the server.
* *
if (registeredEventListeners.size() == 0) { if (registeredEventListeners.size() == 0) {
registeredEventListeners = null; registeredEventListeners = null;
} }
}


/**
* Returns the current error message for the component.
*
* @return HTML formatted error message to show for the component or null if
* none
*/
public String getErrorMessage() {
return errorMessage;
}

/**
* Sets the current error message for the component.
*
* TODO this could use an object with more details about the error
*
* @param errorMessage
* HTML formatted error message to show for the component or null
* for none
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
} }


} }

+ 5
- 5
src/com/vaadin/terminal/gwt/client/TooltipInfo.java View File



private String title; private String title;


private UIDL errorUidl;
private String errorMessageHtml;


public TooltipInfo() { public TooltipInfo() {
} }
this.title = title; this.title = title;
} }


public UIDL getErrorUidl() {
return errorUidl;
public String getErrorMessage() {
return errorMessageHtml;
} }


public void setErrorUidl(UIDL errorUidl) {
this.errorUidl = errorUidl;
public void setErrorMessage(String errorMessage) {
errorMessageHtml = errorMessage;
} }


} }

+ 0
- 11
src/com/vaadin/terminal/gwt/client/UIDL.java View File

return this.length - 2; return this.length - 2;
}-*/; }-*/;


/**
* Shorthand that returns the component errors as UIDL. Only applicable for
* Paintables.
*
* @return the error UIDL if available
*/
public native UIDL getErrors()
/*-{
return this[1]['error'];
}-*/;

native boolean isMapAttribute(String name) native boolean isMapAttribute(String name)
/*-{ /*-{
return typeof this[1][name] == "object"; return typeof this[1][name] == "object";

+ 5
- 27
src/com/vaadin/terminal/gwt/client/VCaption.java View File



private int maxWidth = -1; 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_CAPTION = "caption";
protected static final String ATTRIBUTE_DESCRIPTION = "description"; protected static final String ATTRIBUTE_DESCRIPTION = "description";
protected static final String ATTRIBUTE_REQUIRED = AbstractComponentConnector.ATTRIBUTE_REQUIRED; 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; protected static final String ATTRIBUTE_HIDEERRORS = AbstractComponentConnector.ATTRIBUTE_HIDEERRORS;


private enum InsertPosition { private enum InsertPosition {
boolean hasIcon = owner.getState().getIcon() != null; boolean hasIcon = owner.getState().getIcon() != null;
boolean showRequired = uidl boolean showRequired = uidl
.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED); .getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED);
boolean showError = uidl
.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
boolean showError = owner.getState().getErrorMessage() != null
&& !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS); && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);


if (hasIcon) { if (hasIcon) {
} }
} }
boolean hasIcon = iconURL != null; boolean hasIcon = iconURL != null;
boolean showError = uidl
.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
&& !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS);


if (hasIcon) { if (hasIcon) {
if (icon == null) { if (icon == null) {
// browsers when it is set to the empty string. If there is an // browsers when it is set to the empty string. If there is an
// icon, error indicator or required indicator they will ensure // icon, error indicator or required indicator they will ensure
// that space is reserved. // that space is reserved.
if (!hasIcon && !showError) {
if (!hasIcon) {
captionText.setInnerHTML("&nbsp;"); captionText.setInnerHTML("&nbsp;");
} }
} else { } else {
captionText = null; 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); return (wasPlacedAfterComponent != placedAfterComponent);
} }


if (state.getIcon() != null) { if (state.getIcon() != null) {
return true; return true;
} }
if (state.getErrorMessage() != null) {
return true;
}
} else { } else {
// TODO fallback for cases where the caption has no owner (Tabsheet, // TODO fallback for cases where the caption has no owner (Tabsheet,
// Accordion) // Accordion)
return true; return true;
} }
} }
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
return true;
}
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED)) { if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_REQUIRED)) {
return true; return true;
} }

+ 4
- 23
src/com/vaadin/terminal/gwt/client/VErrorMessage.java View File



package com.vaadin.terminal.gwt.client; package com.vaadin.terminal.gwt.client;


import java.util.Iterator;

import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
setStyleName(CLASSNAME); setStyleName(CLASSNAME);
} }


public void updateFromUIDL(UIDL uidl) {
public void updateMessage(String htmlErrorMessage) {
clear(); clear();
if (uidl.getChildCount() == 0) {
if (htmlErrorMessage == null || htmlErrorMessage.length() == 0) {
add(new HTML(" ")); add(new HTML(" "));
} else { } else {
for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
final Object child = it.next();
if (child instanceof String) {
final String errorMessage = (String) child;
add(new HTML(errorMessage));
} else {
try {
final VErrorMessage childError = new VErrorMessage();
childError.updateFromUIDL((UIDL) child);
add(childError);
} catch (Exception e) {
// TODO XML type error, check if this can even happen
// anymore??
final UIDL.XML xml = (UIDL.XML) child;
add(new HTML(xml.getXMLAsString()));

}
}
}
// pre-formatted on the server as div per child
add(new HTML(htmlErrorMessage));
} }
} }



+ 2
- 2
src/com/vaadin/terminal/gwt/client/VTooltip.java View File

*/ */
private void show(TooltipInfo info) { private void show(TooltipInfo info) {
boolean hasContent = false; boolean hasContent = false;
if (info.getErrorUidl() != null) {
if (info.getErrorMessage() != null) {
em.setVisible(true); em.setVisible(true);
em.updateFromUIDL(info.getErrorUidl());
em.updateMessage(info.getErrorMessage());
hasContent = true; hasContent = true;
} else { } else {
em.setVisible(false); em.setVisible(false);

+ 2
- 7
src/com/vaadin/terminal/gwt/client/ui/AbstractComponentConnector.java View File

// Not all references to the string literals have been converted to use // Not all references to the string literals have been converted to use
// these! // these!
public static final String ATTRIBUTE_REQUIRED = "required"; public static final String ATTRIBUTE_REQUIRED = "required";
public static final String ATTRIBUTE_ERROR = "error";
public static final String ATTRIBUTE_HIDEERRORS = "hideErrors"; public static final String ATTRIBUTE_HIDEERRORS = "hideErrors";


private Widget widget; private Widget widget;
tooltipInfo.setTitle(null); tooltipInfo.setTitle(null);
} }
// add error info to tooltip if present // add error info to tooltip if present
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
tooltipInfo.setErrorUidl(uidl.getErrors());
} else {
tooltipInfo.setErrorUidl(null);
}
tooltipInfo.setErrorMessage(getState().getErrorMessage());


// Set captions // Set captions
if (delegateCaptionHandling()) { if (delegateCaptionHandling()) {
} }


// add error classname to components w/ error // add error classname to components w/ error
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
if (null != state.getErrorMessage()) {
styleBuf.append(" "); styleBuf.append(" ");
styleBuf.append(primaryStyleName); styleBuf.append(primaryStyleName);
styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT); styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT);

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/ButtonConnector.java View File

getWidget().disableOnClick = getState().isDisableOnClick(); getWidget().disableOnClick = getState().isDisableOnClick();


// handle error // handle error
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
if (null != getState().getErrorMessage()) {
if (getWidget().errorIndicatorElement == null) { if (getWidget().errorIndicatorElement == null) {
getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement = DOM.createSpan();
getWidget().errorIndicatorElement getWidget().errorIndicatorElement

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/CheckBoxConnector.java View File

getWidget().blurHandlerRegistration = EventHelper.updateBlurHandler( getWidget().blurHandlerRegistration = EventHelper.updateBlurHandler(
this, client, getWidget().blurHandlerRegistration); this, client, getWidget().blurHandlerRegistration);


if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
if (null != getState().getErrorMessage()) {
if (getWidget().errorIndicatorElement == null) { if (getWidget().errorIndicatorElement == null) {
getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement = DOM.createSpan();
getWidget().errorIndicatorElement.setInnerHTML("&nbsp;"); getWidget().errorIndicatorElement.setInnerHTML("&nbsp;");

+ 3
- 3
src/com/vaadin/terminal/gwt/client/ui/FormConnector.java View File

getWidget().removeStyleDependentName("nocaption"); getWidget().removeStyleDependentName("nocaption");
} }


if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
final UIDL errorUidl = uidl.getErrors();
getWidget().errorMessage.updateFromUIDL(errorUidl);
if (null != getState().getErrorMessage()) {
getWidget().errorMessage.updateMessage(getState()
.getErrorMessage());
getWidget().errorMessage.setVisible(true); getWidget().errorMessage.setVisible(true);
} else { } else {
getWidget().errorMessage.setVisible(false); getWidget().errorMessage.setVisible(false);

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/LinkConnector.java View File

getWidget().captionElement.setInnerText(getState().getCaption()); getWidget().captionElement.setInnerText(getState().getCaption());


// handle error // handle error
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
if (null != getState().getErrorMessage()) {
if (getWidget().errorIndicatorElement == null) { if (getWidget().errorIndicatorElement == null) {
getWidget().errorIndicatorElement = DOM.createDiv(); getWidget().errorIndicatorElement = DOM.createDiv();
DOM.setElementProperty(getWidget().errorIndicatorElement, DOM.setElementProperty(getWidget().errorIndicatorElement,

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/NativeButtonConnector.java View File

getWidget().setText(getState().getCaption()); getWidget().setText(getState().getCaption());


// handle error // handle error
if (uidl.hasAttribute(ATTRIBUTE_ERROR)) {
if (null != getState().getErrorMessage()) {
if (getWidget().errorIndicatorElement == null) { if (getWidget().errorIndicatorElement == null) {
getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement = DOM.createSpan();
getWidget().errorIndicatorElement getWidget().errorIndicatorElement

+ 2
- 1
src/com/vaadin/terminal/gwt/client/ui/PanelConnector.java View File

getWidget().setIconUri(null, client); getWidget().setIconUri(null, client);
} }


getWidget().handleError(uidl);
getWidget().setErrorIndicatorVisible(
null != getState().getErrorMessage());


// We may have actions attached to this panel // We may have actions attached to this panel
if (uidl.getChildCount() > 0) { if (uidl.getChildCount() > 0) {

+ 1
- 1
src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java View File



public void updateFromUIDL(UIDL uidl, ComponentConnector component) { public void updateFromUIDL(UIDL uidl, ComponentConnector component) {
owner = component; owner = component;
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)
if (null != owner.getState().getErrorMessage()
&& !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS)) { && !uidl.getBooleanAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS)) {
if (errorIndicatorElement == null) { if (errorIndicatorElement == null) {
errorIndicatorElement = DOM.createDiv(); errorIndicatorElement = DOM.createDiv();

+ 2
- 2
src/com/vaadin/terminal/gwt/client/ui/VPanel.java View File

DOM.setInnerHTML(captionText, text); DOM.setInnerHTML(captionText, text);
} }


void handleError(UIDL uidl) {
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
void setErrorIndicatorVisible(boolean showError) {
if (showError) {
if (errorIndicatorElement == null) { if (errorIndicatorElement == null) {
errorIndicatorElement = DOM.createSpan(); errorIndicatorElement = DOM.createSpan();
DOM.setElementProperty(errorIndicatorElement, "className", DOM.setElementProperty(errorIndicatorElement, "className",

+ 2
- 5
src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java View File



@Override @Override
public boolean updateCaption(UIDL uidl) { public boolean updateCaption(UIDL uidl) {
if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)
|| uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)) {
TooltipInfo tooltipInfo = new TooltipInfo(); TooltipInfo tooltipInfo = new TooltipInfo();
tooltipInfo tooltipInfo
.setTitle(uidl .setTitle(uidl
.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)); .getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION));
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) {
tooltipInfo.setErrorUidl(uidl.getErrors());
}
// TODO currently, there is no error indicator and message for a tab
client.registerTooltip(getTabsheet(), getElement(), tooltipInfo); client.registerTooltip(getTabsheet(), getElement(), tooltipInfo);
} else { } else {
client.registerTooltip(getTabsheet(), getElement(), null); client.registerTooltip(getTabsheet(), getElement(), null);

+ 1
- 23
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java View File

import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.ThemeResource;
import com.vaadin.terminal.VariableOwner; import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.gwt.client.Connector; import com.vaadin.terminal.gwt.client.Connector;
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector;
import com.vaadin.ui.Alignment; import com.vaadin.ui.Alignment;
import com.vaadin.ui.ClientWidget; import com.vaadin.ui.ClientWidget;
import com.vaadin.ui.CustomLayout; import com.vaadin.ui.CustomLayout;


private JsonTag tag; private JsonTag tag;


private int errorsOpen;

private boolean cacheEnabled = false; private boolean cacheEnabled = false;


private final Collection<Paintable> paintedComponents = new HashSet<Paintable>(); private final Collection<Paintable> paintedComponents = new HashSet<Paintable>();


tag = new JsonTag(tagName); tag = new JsonTag(tagName);


if (AbstractComponentConnector.ATTRIBUTE_ERROR.equals(tagName)) {
errorsOpen++;
}

customLayoutArgumentsOpen = false; customLayoutArgumentsOpen = false;


} }
+ tagName + "' expected: '" + lastTag + "'."); + tagName + "' expected: '" + lastTag + "'.");
} }


// simple hack which writes error uidl structure into attribute
if (AbstractComponentConnector.ATTRIBUTE_ERROR.equals(lastTag)) {
if (errorsOpen == 1) {
parent.addAttribute("\""
+ AbstractComponentConnector.ATTRIBUTE_ERROR
+ "\":[\""
+ AbstractComponentConnector.ATTRIBUTE_ERROR
+ "\",{}" + tag.getData() + "]");
} else {
// sub error
parent.addData(tag.getJSON());
}
errorsOpen--;
} else {
parent.addData(tag.getJSON());
}
parent.addData(tag.getJSON());


tag = parent; tag = parent;
} else { } else {

+ 5
- 4
src/com/vaadin/ui/AbstractComponent.java View File

// Paint the contents of the component // Paint the contents of the component
paintContent(target); paintContent(target);


final ErrorMessage error = getErrorMessage();
if (error != null) {
error.paint(target);
}
} }
target.endPaintable(this); target.endPaintable(this);


sharedState.setWidth(""); sharedState.setWidth("");
} }


ErrorMessage error = getErrorMessage();
if (null != error) {
sharedState.setErrorMessage(error.getFormattedHtmlMessage());
}

return sharedState; return sharedState;
} }



+ 3
- 9
src/com/vaadin/ui/TabSheet.java View File

description); description);
} }


final ErrorMessage componentError = tab.getComponentError();
if (componentError != null) {
componentError.paint(target);
}

final String styleName = tab.getStyleName(); final String styleName = tab.getStyleName();
if (styleName != null && styleName.length() != 0) { if (styleName != null && styleName.length() != 0) {
target.addAttribute(VTabsheet.TAB_STYLE_NAME, styleName); target.addAttribute(VTabsheet.TAB_STYLE_NAME, styleName);
public void setComponentError(ErrorMessage componentError); public void setComponentError(ErrorMessage componentError);


/** /**
* Gets the curent error message shown for the tab.
* Gets the current error message shown for the tab.
* *
* @see AbstractComponent#setComponentError(ErrorMessage)
* TODO currently not sent to the client
* *
* @param error
* message or null if none
* @see AbstractComponent#setComponentError(ErrorMessage)
*/ */
public ErrorMessage getComponentError(); public ErrorMessage getComponentError();



Loading…
Cancel
Save