17
17
package stroom .widget .menu .client .presenter ;
18
18
19
19
import stroom .widget .util .client .KeyBinding .Action ;
20
+ import stroom .widget .util .client .SafeHtmlUtil ;
20
21
22
+ import com .google .gwt .safehtml .shared .SafeHtml ;
21
23
import com .google .gwt .user .client .Command ;
22
24
23
25
public abstract class MenuItem extends Item {
24
26
25
- private final String text ;
27
+ private final SafeHtml text ;
28
+ private final SafeHtml tooltip ;
26
29
private final Action action ;
27
30
private final Command command ;
28
31
private final boolean enabled ;
29
32
30
33
protected MenuItem (final int priority ,
31
- final String text ,
34
+ final SafeHtml text ,
35
+ final SafeHtml tooltip ,
32
36
final Action action ,
33
37
final boolean enabled ,
34
38
final Command command ) {
35
39
super (priority );
36
40
this .text = text ;
41
+ this .tooltip = tooltip ;
37
42
this .action = action ;
38
43
this .enabled = enabled ;
39
44
this .command = command ;
40
45
}
41
46
42
- public String getText () {
47
+ public SafeHtml getText () {
43
48
return text ;
44
49
}
45
50
51
+ public SafeHtml getTooltip () {
52
+ return tooltip ;
53
+ }
54
+
46
55
public Action getAction () {
47
56
return action ;
48
57
}
@@ -62,16 +71,27 @@ public Command getCommand() {
62
71
protected abstract static class AbstractBuilder <T extends MenuItem , B extends MenuItem .AbstractBuilder <T , ?>>
63
72
extends Item .AbstractBuilder <T , B > {
64
73
65
- protected String text ;
74
+ protected SafeHtml text ;
75
+ protected SafeHtml tooltip ;
66
76
protected Action action ;
67
77
protected Command command ;
68
78
protected boolean enabled = true ;
69
79
70
- public B text (final String text ) {
80
+ public B text (final SafeHtml text ) {
71
81
this .text = text ;
72
82
return self ();
73
83
}
74
84
85
+ public B text (final String text ) {
86
+ this .text = SafeHtmlUtil .from (text );
87
+ return self ();
88
+ }
89
+
90
+ public B tooltip (final String tooltip ) {
91
+ this .tooltip = SafeHtmlUtil .from (tooltip );
92
+ return self ();
93
+ }
94
+
75
95
public B action (final Action action ) {
76
96
this .action = action ;
77
97
return self ();
0 commit comments