aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/spellcheck/CheckerToggleButton.java
blob: f8d6f0f260049cbbfd2cfc4a8c40e4c7e86603bd (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
/*
 * 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.spellcheck;

import java.awt.event.*;

import javax.swing.*;

import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.Contact;

/**
 * Toggle-able button that sets the spell checker to be either enabled or
 * disabled.
 * 
 * @author Damian Johnson
 */
public class CheckerToggleButton
    implements PluginComponent
{
    private final JToggleButton toggleButton;

    CheckerToggleButton(final SpellChecker checker)
    {
        this.toggleButton =
            new JToggleButton(Resources.getImage("plugin.spellcheck.DISABLE"));
        this.toggleButton.setSelectedIcon(Resources
            .getImage("plugin.spellcheck.ENABLE"));
        this.toggleButton.setSelected(checker.isEnabled());
        this.toggleButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent event)
            {
                checker.setEnabled(toggleButton.isSelected());
            }
        });
    }

    public Object getComponent()
    {
        return this.toggleButton;
    }

    public String getConstraints()
    {
        return Container.RIGHT;
    }

    public Container getContainer()
    {
        return Container.CONTAINER_CHAT_TOOL_BAR;
    }

    public String getName()
    {
        return "Spell Checker Toggle";
    }

    public int getPositionIndex()
    {
        return -1;
    }

    public boolean isNativeComponent()
    {
        return false;
    }

    public void setCurrentContact(MetaContact metaContact)
    {

    }

    public void setCurrentContactGroup(MetaContactGroup metaGroup)
    {

    }

    public void setCurrentContact(Contact contact)
    {

    }
}