Asterisk (*) added to the title of the msg window upon new msgs

cusax-fix
Yana Stamcheva 20 years ago
parent c94a6b9a9d
commit ff6209f575

@ -267,21 +267,22 @@ else if (component instanceof JButton) {
SwingUtilities.invokeLater(new RunInfoWindow(selectedCellPoint,
contact));
}
else if (component instanceof JPanel
&& component.getName().equals("buttonsPanel")) {
JPanel panel = (JPanel) component;
int internalX = translatedX
- (renderer.getWidth() - panel.getWidth() - 2);
int internalY = translatedY
- (renderer.getHeight() - panel.getHeight());
Component c = panel.getComponentAt(4, 4);
if (c instanceof ContactProtocolButton) {
SwingUtilities.invokeLater(new RunMessageWindow(contact,
((ContactProtocolButton) c).getProtocolContact()));
else if (component instanceof JPanel) {
if(component.getName().equals("buttonsPanel")){
JPanel panel = (JPanel) component;
int internalX = translatedX
- (renderer.getWidth() - panel.getWidth() - 2);
int internalY = translatedY
- (renderer.getHeight() - panel.getHeight());
Component c = panel.getComponentAt(4, 4);
if (c instanceof ContactProtocolButton) {
SwingUtilities.invokeLater(new RunMessageWindow(contact,
((ContactProtocolButton) c).getProtocolContact()));
}
}
}
@ -454,7 +455,7 @@ public void run() {
}
/**
* When message is received determines whether to open a new chat
* When a message is received determines whether to open a new chat
* window or chat window tab, or to indicate that a message is received
* from a contact which already has an open chat. When the chat is found
* checks if in mode "Auto popup enabled" and if this is the case shows
@ -475,7 +476,7 @@ public void messageReceived(MessageReceivedEvent evt) {
.getModel()).getMetaContactStatus(metaContact);
if (!Constants.TABBED_CHAT_WINDOW) {
//If in mode "open all message s in new window"
//If in mode "open all messages in new window"
if (contactMsgWindows.containsKey(metaContact)) {
/*
* If a chat window for this contact is already opened
@ -489,7 +490,13 @@ public void messageReceived(MessageReceivedEvent evt) {
date, Constants.INCOMING_MESSAGE,
message.getContent());
msgWindow.setVisible(true);
if(msgWindow.getState() == JFrame.ICONIFIED) {
msgWindow.setTitle(msgWindow.getTitle()+"*");
}
if(Constants.AUTO_POPUP_NEW_MESSAGE) {
msgWindow.setVisible(true);
}
}
else {
ChatWindow msgWindow = new ChatWindow(mainFrame);
@ -530,7 +537,9 @@ public void windowClosing(WindowEvent e) {
});
}
Hashtable contactTabsTable = tabbedChatWindow.getContactChatsTable();
Hashtable contactTabsTable
= tabbedChatWindow.getContactChatsTable();
ChatPanel chatPanel;
//If there's no open tab for the given contact.
@ -563,18 +572,28 @@ public void windowClosing(WindowEvent e) {
protocolContact.getDisplayName(),
date, Constants.INCOMING_MESSAGE,
message.getContent());
if(chatPanel.isDialogVisible()) {
tabbedChatWindow.setVisible(true);
if (tabbedChatWindow.getState() == JFrame.ICONIFIED) {
if (tabbedChatWindow.getTabCount() > 1) {
tabbedChatWindow.setSelectedContactTab(metaContact);
}
if (!tabbedChatWindow.getTitle().endsWith("*")) {
tabbedChatWindow.setTitle(
tabbedChatWindow.getTitle() + "*");
}
}
else {
if (tabbedChatWindow.getTabCount() > 1) {
tabbedChatWindow.highlightTab(metaContact);
}
tabbedChatWindow.setVisible(true);
}
}
}
if(Constants.AUTO_POPUP_NEW_MESSAGE)
if (Constants.AUTO_POPUP_NEW_MESSAGE)
Constants.getDefaultAudio().play();
}

@ -92,8 +92,6 @@ public ChatWindow(MainFrame mainFrame) {
this.init();
this.addWindowListener(new ChatWindowAdapter());
getRootPane().getActionMap()
.put("close", new CloseAction());
getRootPane().getActionMap()
@ -129,11 +127,7 @@ public ChatWindow(MainFrame mainFrame) {
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_P,
KeyEvent.ALT_DOWN_MASK), "changeProtocol");
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
close();
}
});
this.addWindowListener(new ChatWindowAdapter());
}
/**
@ -350,7 +344,9 @@ public void setSelectedContactTab(MetaContact contact) {
ChatPanel chatPanel = ((ChatPanel) this.contactChats
.get(contact.getMetaUID()));
this.chatTabbedPane.setSelectedComponent(chatPanel);
this.chatTabbedPane.setSelectedComponent(chatPanel);
this.setTitle(chatPanel.getDefaultContact().getDisplayName());
this.setCurrentChatPanel(chatPanel);
chatPanel.requestFocusInWriteArea();
}
}
@ -365,6 +361,7 @@ public void setSelectedContactTab(int index) {
this.setCurrentChatPanel(chatPanel);
this.chatTabbedPane.setSelectedIndex(index);
this.setTitle(chatPanel.getDefaultContact().getDisplayName());
this.setVisible(true);
chatPanel.requestFocusInWriteArea();
}
@ -629,6 +626,14 @@ public boolean isTypingNotificationEnabled(){
*/
public class ChatWindowAdapter extends WindowAdapter {
public void windowDeiconified(WindowEvent e) {
String title = getTitle();
if (title.endsWith("*")) {
setTitle(title.substring(0, title.length() - 1));
}
}
public void windowClosing(WindowEvent e) {
ConfigurationService configService
= GuiActivator.getConfigurationService();
@ -654,6 +659,8 @@ public void windowClosing(WindowEvent e) {
logger.error("The proposed property change "
+ "represents an unacceptable value");
}
close();
}
}

Loading…
Cancel
Save