diff options
author | Yana Stamcheva <yana@jitsi.org> | 2006-11-22 12:23:44 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2006-11-22 12:23:44 +0000 |
commit | ad68448c6b5c963f9f92822a0f24d86ac9a4161e (patch) | |
tree | 9a62921e71215e1c7b0a01a7c0c261d790a3c121 | |
parent | 445992ece4fdc7ecb5c9e5844821dc51adc35634 (diff) | |
download | jitsi-ad68448c6b5c963f9f92822a0f24d86ac9a4161e.zip jitsi-ad68448c6b5c963f9f92822a0f24d86ac9a4161e.tar.gz jitsi-ad68448c6b5c963f9f92822a0f24d86ac9a4161e.tar.bz2 |
bugs concerning the state of history arrow buttons fixed
4 files changed, 27 insertions, 20 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java index 1617904..4ec4339 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java @@ -78,7 +78,7 @@ public class ChatConversationPanel private Date lastIncomingMsgTimestamp = new Date(0); - private Date pageFirstMsgTimestamp = new Date(System.currentTimeMillis()); + private Date pageFirstMsgTimestamp = new Date(Long.MAX_VALUE); private Date pageLastMsgTimestamp = new Date(0); diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatPanel.java index d6d46fa..005bd3f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatPanel.java @@ -127,7 +127,6 @@ public class ChatPanel loadHistoryPeriod(); } }.start(); - } /** @@ -383,17 +382,12 @@ public class ChatPanel JTabbedPane tabbedPane = (JTabbedPane) parent; if (tabbedPane.getSelectedComponent() == component) { SwingUtilities.invokeLater(new Runnable() { - public void run() { - getChatWindow().setTitle( - getMetaContact().getDisplayName()); + public void run() { chatWindow.setCurrentChatPanel(ChatPanel.this); - - chatWindow.getMainToolBar().changeHistoryButtonsSate( - ChatPanel.this); - + writeMessagePanel.getEditorPane() - .requestFocus(); + .requestFocus(); } }); } @@ -788,6 +782,8 @@ public class ChatPanel this.lastHistoryMsgTimestamp = evt.getTimestamp(); } } + + this.chatWindow.getMainToolBar().changeHistoryButtonsState(this); } public Date getFirstHistoryMsgTimestamp() diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java index 759398d..23fe636 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java @@ -186,7 +186,6 @@ public class ChatWindow public ChatPanel createChat(MetaContact contact, PresenceStatus status, Contact protocolContact) { - ChatPanel chatPanel = new ChatPanel(this, contact, protocolContact); this.contactChats.put(contact.getMetaUID(), chatPanel); @@ -418,6 +417,10 @@ public class ChatWindow public void setCurrentChatPanel(ChatPanel currentChatPanel) { this.currentChatPanel = currentChatPanel; + + this.setTitle(currentChatPanel.getMetaContact().getDisplayName()); + + this.getMainToolBar().changeHistoryButtonsState(currentChatPanel); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/message/toolBars/MainToolBar.java b/src/net/java/sip/communicator/impl/gui/main/message/toolBars/MainToolBar.java index af414ef..15455fe 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/toolBars/MainToolBar.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/toolBars/MainToolBar.java @@ -92,7 +92,8 @@ public class MainToolBar this.setBorder(BorderFactory.createEmptyBorder(2, 2, 5, 2)); this.nextButton.setEnabled(false); - + this.previousButton.setEnabled(false); + this.add(saveButton); this.add(printButton); @@ -374,7 +375,7 @@ public class MainToolBar conversationPanel.setDefaultContent(); - changeHistoryButtonsSate(chatPanel); + changeHistoryButtonsState(chatPanel); } } @@ -382,23 +383,30 @@ public class MainToolBar * Disables/Enables history arrow buttons depending on whether the * current page is the first, the last page or a middle page. */ - public void changeHistoryButtonsSate(ChatPanel chatPanel) - { + public void changeHistoryButtonsState(ChatPanel chatPanel) + { ChatConversationPanel convPanel = chatPanel.getChatConversationPanel(); - if(chatPanel.getFirstHistoryMsgTimestamp() == null) + Date firstMsgInHistory = chatPanel.getFirstHistoryMsgTimestamp(); + Date lastMsgInHistory = chatPanel.getLastHistoryMsgTimestamp(); + Date firstMsgInPage = convPanel.getPageFirstMsgTimestamp(); + Date lastMsgInPage = convPanel.getPageLastMsgTimestamp(); + + if(firstMsgInHistory == null || lastMsgInHistory == null) { + previousButton.setEnabled(false); + nextButton.setEnabled(false); return; + } - if(chatPanel.getFirstHistoryMsgTimestamp() - .compareTo(convPanel.getPageFirstMsgTimestamp()) < 0) { + if(firstMsgInHistory.compareTo(firstMsgInPage) < 0) { previousButton.setEnabled(true); } else { previousButton.setEnabled(false); } - if(chatPanel.getLastHistoryMsgTimestamp() - .compareTo(convPanel.getPageLastMsgTimestamp()) > 0) { + if(lastMsgInPage.getTime() > 0 + && (lastMsgInHistory.compareTo(lastMsgInPage) > 0)) { nextButton.setEnabled(true); } else { |