Blame view

ihm/app/Messages.js 2.46 KB
346b85c6   Benjamin Renard   First commit with...
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Ext.define("treps.Messages",
	{
		requires: [
			"Ext.window.MessageBox",
			"treps.Constants"
		],
	
		singleton  : true,

		bubble : null,
        
		showWarning: function(message)
		{
			Ext.Msg.show({
				title:treps.Constants.APP_TITLE+" - Warning",
				msg: message,
				buttons: Ext.Msg.OK,
				icon: Ext.Msg.WARNING
			});
		},
		
		showError: function(message,onOk)
		{
			Ext.Msg.show({
				title:treps.Constants.APP_TITLE+" - Error",
				msg: message,
				buttons: Ext.Msg.OK,
				icon: Ext.Msg.ERROR,
				fn: function(buttonId)
				{
					if ((buttonId == "ok") && (onOk != null))
						onOk.call();
				}
			});
		},
		
		showInfo: function(message,onOk)
		{
			Ext.Msg.show({
				title:treps.Constants.APP_TITLE+" - Info",
				msg: message,
				buttons: Ext.Msg.OK,
				icon: Ext.Msg.INFO
			});
		},

		showQuestion: function(message,onYes,onNo)
		{
			Ext.Msg.show({
				title:treps.Constants.APP_TITLE+" - Question",
				msg: message,
				buttons: Ext.Msg.YESNO,
				icon: Ext.Msg.QUESTION,
				fn: function(buttonId)
					{
						if ((buttonId == "yes") && (onYes != null))
							onYes.call();
						if ((buttonId == "no") && (onNo != null))
                                                        onNo.call();
					}
			});
		},

		showBubble: function(title, messageHTML, target, anchor)
		{
			if (!this.bubble)
				this.bubble = new Ext.ToolTip({
					target: target,
					anchor: anchor,
					anchorToTarget: true,
					title: title,
					html: messageHTML,
					closable: true,
					autoHide: false
				});
			else
			{
				this.hideBubble();
				this.bubble.setTitle(title);
				this.bubble.update(messageHTML);
				this.bubble.setTarget(target);
				this.bubble.anchor = anchor;
			}

			this.bubble.show();
		},

		hideBubble: function()
		{
			if (this.bubble)
			{
				this.bubble.hide();
				this.bubble.setTarget(null);
			}
6c54c49f   Laurent BEIGBEDER   9059: ajout d'un ...
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
		},

		showBubbleTT: function(title, messageHTML, target, anchor)
		{
			if (!this.bubble)
				this.bubble = new Ext.ToolTip({
					target: target,
					anchor: anchor,
					anchorToTarget: true,
					title: title,
					html: messageHTML,
					closable: false,
					showDelay: 1000,
					dismissDelay: 10000,
					autoHide: true
				});
			else
			{
				this.hideBubble();
				this.bubble.setTitle(title);
				this.bubble.update(messageHTML);
				this.bubble.setTarget(target);
				this.bubble.anchor = anchor;
				this.bubble.showDelay = 1000;
				this.bubble.dismissDelay = 10000;
				this.bubble.autoHide = true;
			}

			this.bubble.show();
346b85c6   Benjamin Renard   First commit with...
124
		}
6c54c49f   Laurent BEIGBEDER   9059: ajout d'un ...
125

346b85c6   Benjamin Renard   First commit with...
126
	}
6c54c49f   Laurent BEIGBEDER   9059: ajout d'un ...
127
128
	
	
346b85c6   Benjamin Renard   First commit with...
129
);