summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/client/TooltipInfo.java
blob: 712d2636957becf9c1c072b44e353ade69707f75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* 
@VaadinApache2LicenseForJavaFiles@
 */
package com.vaadin.terminal.gwt.client;

public class TooltipInfo {

    private String title;

    private String errorMessageHtml;

    public TooltipInfo() {
    }

    public TooltipInfo(String tooltip) {
        setTitle(tooltip);
    }

    public TooltipInfo(String tooltip, String errorMessage) {
        setTitle(tooltip);
        setErrorMessage(errorMessage);
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getErrorMessage() {
        return errorMessageHtml;
    }

    public void setErrorMessage(String errorMessage) {
        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);
    }
}