aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2008-05-26 09:38:05 +0000
committerDamian Minkov <damencho@jitsi.org>2008-05-26 09:38:05 +0000
commitc86f5769ebed292405f598c407d44945b094db4a (patch)
tree2636c792d9c9d3be8fad158316404e4a4ec2d3b6 /src/net/java/sip
parentd2df560e62292479cd7e81589366c8318e26574a (diff)
downloadjitsi-c86f5769ebed292405f598c407d44945b094db4a.zip
jitsi-c86f5769ebed292405f598c407d44945b094db4a.tar.gz
jitsi-c86f5769ebed292405f598c407d44945b094db4a.tar.bz2
Fix Previous/Next buttons states on receiving new messages.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java10
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java93
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java7
3 files changed, 14 insertions, 96 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java
index bdd58ae..2a51fd4 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatPanel.java
@@ -175,12 +175,18 @@ public class MetaContactChatPanel
*
* @param escapedMessageID The id of the message that should be ignored.
*/
- public void loadHistory(String escapedMessageID)
+ public void loadHistory(final String escapedMessageID)
{
+ // Load the history period, which initializes the
+ // firstMessageTimestamp and the lastMessageTimeStamp variables.
+ // Used to disable/enable history flash buttons in the chat
+ // window tool bar.
+ loadHistoryPeriod();
+
Collection historyList = msgHistory.findLast(
metaContact, Constants.CHAT_HISTORY_SIZE);
- processHistory(historyList, escapedMessageID);
+ processHistory(historyList, escapedMessageID);
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java
index 4f8c0ec..56df3e7 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/toolBars/ExtendedMainToolBar.java
@@ -302,66 +302,6 @@ public class ExtendedMainToolBar
}
}
- /**
- * Returns the button used to show the list of smilies.
- *
- * @return the button used to show the list of smilies.
- */
- public SmiliesSelectorBox getSmiliesSelectorBox()
- {
- return smiliesBox;
- }
-
- /**
- * Returns TRUE if there are selected menus in this toolbar, otherwise
- * returns FALSE.
- * @return TRUE if there are selected menus in this toolbar, otherwise
- * returns FALSE
- */
- public boolean hasSelectedMenus()
- {
- if(smiliesBox.isMenuSelected())
- return true;
-
- return false;
- }
-
- /**
- * Disables/Enables history arrow buttons depending on whether the
- * current page is the first, the last page or a middle page.
- */
- public void changeHistoryButtonsState(ChatPanel chatPanel)
- {
- ChatConversationPanel convPanel = chatPanel.getChatConversationPanel();
-
- 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(firstMsgInHistory.compareTo(firstMsgInPage) < 0)
- previousButton.setEnabled(true);
- else
- previousButton.setEnabled(false);
-
- if(lastMsgInPage.getTime() > 0
- && (lastMsgInHistory.compareTo(lastMsgInPage) > 0))
- {
- nextButton.setEnabled(true);
- }
- else
- {
- nextButton.setEnabled(false);
- }
- }
-
private void initPluginComponents()
{
Iterator pluginComponents = GuiActivator.getUIService()
@@ -417,39 +357,6 @@ public class ExtendedMainToolBar
GuiActivator.getUIService().addPluginComponentListener(this);
}
-
- /**
- * Implements the <code>PluginComponentListener.pluginComponentAdded</code>
- * method.
- */
- public void pluginComponentAdded(PluginComponentEvent event)
- {
- PluginComponent c = event.getPluginComponent();
-
- if(c.getContainer().equals(Container.CONTAINER_CHAT_TOOL_BAR))
- {
- this.addSeparator();
- this.add((Component) c.getComponent());
-
- this.revalidate();
- this.repaint();
- }
- }
-
- /**
- * Implements the <code>PluginComponentListener.pluginComponentRemoved</code>
- * method.
- */
- public void pluginComponentRemoved(PluginComponentEvent event)
- {
- PluginComponent c = event.getPluginComponent();
-
- if(c.getContainer().equals(Container.CONTAINER_CHAT_TOOL_BAR))
- {
- this.remove((Component) c.getComponent());
- }
- }
-
public void paintComponent(Graphics g)
{
super.paintComponent(g);
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
index aad49a9..69eb13b 100755
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
@@ -340,6 +340,12 @@ public class ContactListPanel
chatPanel.processMessage(protocolContact.getDisplayName(), date,
messageType, message.getContent(),
message.getContentType());
+
+ // A bug Fix for Previous/Next buttons .
+ // Must update buttons state after message is processed
+ // otherwise states are not proper
+ chatPanel.getChatWindow().getMainToolBar().
+ changeHistoryButtonsState(chatPanel);
// Opens the chat panel with the new message in the UI thread.
SwingUtilities.invokeLater(new Runnable()
@@ -386,7 +392,6 @@ public class ContactListPanel
Message msg = evt.getSourceMessage();
- ChatWindowManager chatWindowManager = mainFrame.getChatWindowManager();
MetaContactChatPanel chatPanel = null;
if(chatWindowManager.isChatOpenedForContact(metaContact))