blob: bf126df12d3238f1145ed60bf213a76c86ae4def (
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
95
96
97
98
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license. See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.propertieseditor;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
/**
* The <tt>WarningPanel</tt> allows users to change Jitsi configuration
* properties at runtime. It wraps the <tt>PropertiesEditorPanel</tt> in order
* to provide some more explanations and make complex configurations available
* only to advanced users.
*
* @author Marin Dzhigarov
*/
public class WarningPanel
extends TransparentPanel
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 1L;
private ResourceManagementService resourceManagementService =
PropertiesEditorActivator.getResourceManagementService();
private ConfigurationService confService = PropertiesEditorActivator
.getConfigurationService();
private JCheckBox checkBox;
/**
* Creates an instance <tt>WarningPanel</tt>
*
* @param startingPanel
*/
public WarningPanel(final StartingPanel startingPanel)
{
super(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
JPanel mainPanel = new TransparentPanel(new BorderLayout(0, 10));
add(mainPanel, BorderLayout.NORTH);
JTextPane warningMsg = new JTextPane();
warningMsg.setEditable(false);
warningMsg.setOpaque(false);
warningMsg.setText(resourceManagementService
.getI18NString("plugin.propertieseditor.DESCRIPTION"));
checkBox =
new JCheckBox(
resourceManagementService
.getI18NString("plugin.propertieseditor.CHECK_BOX"));
checkBox.setOpaque(false);
checkBox.setSelected(true);
mainPanel.add(warningMsg, BorderLayout.NORTH);
mainPanel.add(checkBox, BorderLayout.CENTER);
JButton btn =
new JButton(
resourceManagementService
.getI18NString("plugin.propertieseditor.IM_AWARE"));
btn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
confService.setProperty(Constants.SHOW_WARNING_MSG_PROP,
new Boolean(checkBox.isSelected()));
startingPanel.removeAll();
startingPanel.add(startingPanel.propertiesEditorPanel,
BorderLayout.CENTER);
startingPanel.propertiesEditorPanel.setVisible(true);
startingPanel.revalidate();
startingPanel.repaint();
}
});
JPanel buttonPanel =
new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
buttonPanel.add(btn);
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
}
}
|