Turn on/off outgoing typing notifications

cusax-fix
Yana Stamcheva 20 years ago
parent 6662878fe6
commit 68549ccdc3

@ -0,0 +1,33 @@
/*
* 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.gui.lookandfeel;
import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
import net.java.sip.communicator.impl.gui.utils.AntialiasingManager;
/**
* The SIPCommCheckBoxMenuItemUI implementation.
*
* @author Yana Stamcheva
*/
public class SIPCommCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
/**
* Creates a new SIPCommCheckBoxMenuItemUI instance.
*/
public static ComponentUI createUI(JComponent x) {
return new SIPCommCheckBoxMenuItemUI();
}
public void paint(Graphics g, JComponent c) {
AntialiasingManager.activateAntialiasing(g);
super.paint(g, c);
}
}

@ -60,6 +60,7 @@ protected void initClassDefaults(UIDefaults table) {
"LabelUI", lfPackageName + "SIPCommLabelUI",
"EditorPaneUI", lfPackageName + "SIPCommEditorPaneUI",
"MenuItemUI", lfPackageName + "SIPCommMenuItemUI",
"CheckBoxMenuItemUI", lfPackageName + "SIPCommCheckBoxMenuItemUI",
"MenuUI", lfPackageName + "SIPCommMenuUI",
"ToolBarSeparatorUI", lfPackageName + "SIPCommToolBarSeparatorUI",
"TabbedPaneUI", lfPackageName + "SIPCommTabbedPaneUI",

@ -80,6 +80,7 @@ statusChangeGeneralError=The status could not be changed due to a general applic
statusChangeNetworkFailure=The status could not be changed due to a network \n failure. Please check yout network connection.
today=Today
tools=Tools
typingNotifications=Typing notifications
uin=UIN:
unknown=Unknown user
unregisteredMessage=You have been disconnected from the ? server. Please check your network connection.

@ -82,6 +82,8 @@ public class ChatPanel extends JPanel {
private OperationSetTypingNotifications tnOperationSet;
private Contact protocolContact;
private boolean enableTypingNotification = true;
/**
* Creates a chat panel which is added to the given chat window.
@ -525,4 +527,12 @@ public void openProtocolSelectorBox() {
popup.setVisible(true);
}
}
public void enableTypingNotification(boolean enable) {
this.enableTypingNotification = enable;
}
public boolean isTypingNotificationEnabled(){
return enableTypingNotification;
}
}

@ -56,6 +56,7 @@ public class ChatWritePanel extends JScrollPane implements
private int typingState = -1;
private StyledEditorKit styledEditor = new StyledEditorKit();
/**
* Creates an instance of ChatWritePanel.
* @param chatPanel The parent ChatPanel.
@ -158,7 +159,7 @@ else if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK
redo();
}
}
else {
else if (chatPanel.isTypingNotificationEnabled()){
if (typingState != OperationSetTypingNotifications.STATE_TYPING) {
stoppedTypingTimer.setDelay(2 * 1000);
typingState = OperationSetTypingNotifications.STATE_TYPING;

@ -20,6 +20,7 @@
import net.java.sip.communicator.impl.gui.utils.ImageLoader;
/**
* The FileMenu contains save, print and close.
*
* @author Yana Stamcheva
*/
public class FileMenu extends JMenu

@ -23,7 +23,7 @@ public class MessageWindowMenuBar extends JMenuBar {
private EditMenu editMenu;
private JMenu settingsMenu = new JMenu(Messages.getString("settings"));
private SettingsMenu settingsMenu;
private JMenu helpMenu = new JMenu(Messages.getString("help"));
@ -41,6 +41,8 @@ public MessageWindowMenuBar(ChatWindow parentWindow) {
editMenu = new EditMenu(this.parentWindow);
settingsMenu = new SettingsMenu(this.parentWindow);
this.init();
}
@ -58,7 +60,6 @@ private void init() {
this.add(helpMenu);
// Disable all menus that are not yet implemented.
this.settingsMenu.setEnabled(false);
this.helpMenu.setEnabled(false);
}
}

@ -0,0 +1,44 @@
package net.java.sip.communicator.impl.gui.main.message.menu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.message.ChatWindow;
public class SettingsMenu extends JMenu
implements ActionListener {
private JCheckBoxMenuItem typingNotificationsItem
= new JCheckBoxMenuItem(Messages.getString("typingNotifications"), true);
private ChatWindow chatWindow;
public SettingsMenu(ChatWindow chatWindow){
super(Messages.getString("settings"));
this.chatWindow = chatWindow;
this.init();
}
private void init(){
this.add(typingNotificationsItem);
this.typingNotificationsItem.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
JCheckBoxMenuItem item = (JCheckBoxMenuItem)e.getSource();
if (item.isSelected()) {
chatWindow.getCurrentChatPanel().enableTypingNotification(true);
}
else {
chatWindow.getCurrentChatPanel().enableTypingNotification(false);
}
}
}
Loading…
Cancel
Save