diff options
Diffstat (limited to 'src/com/vaadin/terminal/gwt/client/TooltipInfo.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/TooltipInfo.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/TooltipInfo.java b/src/com/vaadin/terminal/gwt/client/TooltipInfo.java index fb33a56c56..1ad1ea43cd 100644 --- a/src/com/vaadin/terminal/gwt/client/TooltipInfo.java +++ b/src/com/vaadin/terminal/gwt/client/TooltipInfo.java @@ -16,6 +16,11 @@ public class TooltipInfo { setTitle(tooltip); } + public TooltipInfo(String tooltip, String errorMessage) { + setTitle(tooltip); + setErrorMessage(errorMessage); + } + public String getTitle() { return title; } @@ -32,4 +37,18 @@ public class TooltipInfo { errorMessageHtml = errorMessage; } + /** + * Checks is a message has been defined for the tooltip. + * + * @return true if title or error message is present, false if both are + * empty + */ + public boolean hasMessage() { + return (title != null && !title.isEmpty()) + || (errorMessageHtml != null && errorMessageHtml.isEmpty()); + } + + public boolean equals(TooltipInfo other) { + return (other != null && other.title == title && other.errorMessageHtml == errorMessageHtml); + } } |