01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings;
14:
15: import org.wings.session.SessionManager;
16: import java.io.Serializable;
17: import java.util.Set;
18:
19: /**
20: * Defines the behaviour of component tooltips.
21: *
22: * @author hengels
23: */
24: public class SToolTipManager implements Serializable {
25: private int initialDelay = 1000;
26: private int dismissDelay = 3000;
27: private boolean followMouse = true;
28:
29: /**
30: * @return The initial delay in ms the mouse pointer has to rest over a component
31: * before it's tooltip is shown
32: */
33: public int getInitialDelay() {
34: return initialDelay;
35: }
36:
37: /**
38: * @param initialDelay The initial delay in ms the mouse pointer has to rest over a component
39: * before it's tooltip is shown
40: */
41: public void setInitialDelay(int initialDelay) {
42: if (this .initialDelay != initialDelay) {
43: Set<SFrame> frames = SessionManager.getSession()
44: .getFrames();
45: for (SFrame frame : frames) {
46: frame.reload();
47: }
48: this .initialDelay = initialDelay;
49: }
50: }
51:
52: /**
53: * @return The delay in ms before a tooltip is hidden automatically
54: */
55: public int getDismissDelay() {
56: return dismissDelay;
57: }
58:
59: /**
60: * @param dismissDelay The delay in ms before a tooltip is hidden automatically
61: */
62: public void setDismissDelay(int dismissDelay) {
63: if (this .dismissDelay != dismissDelay) {
64: Set<SFrame> frames = SessionManager.getSession()
65: .getFrames();
66: for (SFrame frame : frames) {
67: frame.reload();
68: }
69: this .dismissDelay = dismissDelay;
70: }
71: }
72:
73: /**
74: * @return <code>true</code> if the tooltip popup should follow the mouse movements.
75: */
76: public boolean isFollowMouse() {
77: return followMouse;
78: }
79:
80: /**
81: * @param followMouse <code>true</code> if the tooltip popup should follow the mouse movements.
82: */
83: public void setFollowMouse(boolean followMouse) {
84: if (this .followMouse != followMouse) {
85: Set<SFrame> frames = SessionManager.getSession()
86: .getFrames();
87: for (SFrame frame : frames) {
88: frame.reload();
89: }
90: this .followMouse = followMouse;
91: }
92: }
93:
94: public static SToolTipManager sharedInstance() {
95: return SessionManager.getSession().getToolTipManager();
96: }
97: }
|