blob: 4c0b3fe7e473681f81ee0f70012da1e9dbf8a28b (
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
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
|
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.systray.jdic;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import net.java.sip.communicator.impl.systray.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The <tt>StatusSubMenu</tt> provides a menu which allow
* to select the status for each of the protocol providers
* registered when the menu appears
*
* @author Nicolas Chamouard
*
*/
public class StatusSubMenu
extends JMenu
//implements ActionListener
{
/**
* A reference of <tt>Systray</tt>
*/
private SystrayServiceJdicImpl parentSystray;
/**
* Creates an instance of <tt>StatusSubMenu</tt>.
* @param tray a reference of the parent <tt>Systray</tt>
*/
public StatusSubMenu(SystrayServiceJdicImpl tray)
{
parentSystray = tray;
this.setText(Resources.getString("setStatus"));
this.setIcon(
new ImageIcon(Resources.getImage("statusMenuIcon")));
/* makes the menu look better */
this.setPreferredSize(new Dimension(28, 24));
update();
}
/**
* Updates the Menu by retrieving provider informations
*/
public void update()
{
this.removeAll();
Iterator it=parentSystray.getProtocolProviders();
while(it.hasNext()){
ProtocolProviderService provider =
(ProtocolProviderService) it.next();
Map supportedOperationSets
= provider.getSupportedOperationSets();
OperationSetPresence presence = (OperationSetPresence)
supportedOperationSets.get(OperationSetPresence.class.getName());
if (presence == null)
{
StatusSimpleSelector s =
new StatusSimpleSelector(parentSystray,provider);
this.add(s);
}
else
{
StatusSelector s =
new StatusSelector(parentSystray,provider,presence);
this.add(s);
}
}
}
}
|