1 /*
2 * Copyright 2006-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.kuali.rice.krad.uif.widget;
18
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.view.View;
21
22 /**
23 * Widget that renders a Tooltip on a component
24 *
25 * <p>
26 * Tooltips can display extra information about an element. The content can be plain text or rich HTML. Tooltips
27 * can be triggered by focus or mouse hover events.
28 * </p>
29 *
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 */
32 public class Tooltip extends WidgetBase {
33
34 private String tooltipContent;
35
36 private boolean onFocus;
37
38 private boolean onMouseHover;
39
40 public Tooltip() {
41 super();
42 }
43
44 /**
45 * @see org.kuali.rice.krad.uif.component.ComponentBase#performFinalize(org.kuali.rice.krad.uif.view.View,
46 * Object, org.kuali.rice.krad.uif.component.Component)
47 */
48 @Override
49 public void performFinalize(View view, Object model, Component parent) {
50 super.performFinalize(view, model, parent);
51 }
52
53 /**
54 * Plain text or HTML string that will be used to render the tooltip div
55 *
56 * @return String
57 */
58 public String getTooltipContent() {
59 return tooltipContent;
60 }
61
62 /**
63 * Setter for the tooltip content text
64 *
65 * @param tooltipContent
66 */
67 public void setTooltipContent(String tooltipContent) {
68 this.tooltipContent = tooltipContent.replace("\"", """).replace("'", "'");
69 }
70
71 /**
72 * Indicates the tooltip should be triggered by focus/blur
73 *
74 * @return boolean
75 */
76 public boolean isOnFocus() {
77 return onFocus;
78 }
79
80 /**
81 * Setter for the onFocus
82 *
83 * @param onFocus
84 */
85 public void setOnFocus(boolean onFocus) {
86 this.onFocus = onFocus;
87 }
88
89 /**
90 * Indicates the tooltip should be triggered by mouse hover
91 *
92 * @return boolean
93 */
94 public boolean isOnMouseHover() {
95 return onMouseHover;
96 }
97
98 /**
99 * Setter for onMouseHover
100 *
101 * @param onMouseHover
102 */
103 public void setOnMouseHover(boolean onMouseHover) {
104 this.onMouseHover = onMouseHover;
105 }
106 }