Chat room subject fixed.

cusax-fix
Yana Stamcheva 19 years ago
parent 58a28e1278
commit 4c058bd0b2

@ -19,7 +19,8 @@
import net.java.sip.communicator.util.*;
/**
* The panel containing the subject of the chat room.
* The panel containing the subject of the chat room and the configuration
* button.
*
* @author Yana Stamcheva
*/
@ -45,30 +46,39 @@ public class ChatRoomSubjectPanel
/**
* Creates the panel containing the chat room subject.
*
* @param chatWindow the chat window, where this panel is added
* @param chatRoomWrapper the chat room wrapper, from which we obtain the
* chat room subject and the configuration information.
*/
public ChatRoomSubjectPanel(ChatWindow window,
ChatRoomWrapper chatRoomWrap)
public ChatRoomSubjectPanel(ChatWindow chatWindow,
ChatRoomWrapper chatRoomWrapper)
{
super(new BorderLayout(5, 5));
this.chatRoomWrapper = chatRoomWrap;
this.chatWindow = window;
this.chatRoomWrapper = chatRoomWrapper;
this.chatWindow = chatWindow;
this.add(subjectLabel, BorderLayout.WEST);
this.add(subjectField, BorderLayout.CENTER);
this.add(configButton, BorderLayout.EAST);
this.configButton.setPreferredSize(new Dimension(26, 26));
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
this.configButton.addActionListener(new ConfigButtonActionListener());
if(chatRoomWrapper.getChatRoom() != null)
{
this.subjectField.setText(
chatRoomWrapper.getChatRoom().getSubject());
}
// The subject is set not editable until we implement this functionality.
// TODO: Implement the editing of the chat room subject
this.subjectField.setEditable(false);
}
/**
* Sets the subject in the corresponding field.
*
@ -78,12 +88,16 @@ public void setSubject(String subject)
{
this.subjectField.setText(subject);
}
/*
* Opens the configuration dialog when the configure buttons is pressed.
*/
private class ConfigButtonActionListener implements ActionListener
{
/**
* Obtains and opens the configuration form of the corresponding chat
* room when user clicks on the configuration button.
*/
public void actionPerformed(ActionEvent evt)
{
if(chatRoomWrapper.getChatRoom() == null)
@ -94,11 +108,11 @@ public void actionPerformed(ActionEvent evt)
ChatRoomConfigurationForm configForm
= chatRoomWrapper.getChatRoom()
.getConfigurationForm();
ChatRoomConfigurationWindow configWindow
= new ChatRoomConfigurationWindow(
chatRoomWrapper.getChatRoomName(), configForm);
configWindow.setVisible(true);
}
catch (OperationFailedException e)

@ -51,13 +51,13 @@ public ConferenceChatPanel(ChatWindow chatWindow,
this.chatRoomWrapper = chatRoomWrapper;
subjectPanel = new ChatRoomSubjectPanel(chatWindow, chatRoomWrapper);
// The subject panel is added here, because it's specific for the
// multi user chat and is not contained in the single chat chat panel.
this.add(subjectPanel, BorderLayout.NORTH);
ChatRoom chatRoom = chatRoomWrapper.getChatRoom();
if(chatRoom != null && chatRoom.isJoined())
{
this.loadChatRoom(chatRoom);

@ -491,7 +491,7 @@ public void run()
}.start();
}
}
/**
* Refreshes the chat room's list. Meant to be invoked when a modification
* in a chat room is made and the list should be refreshed in order to show

@ -1031,4 +1031,14 @@ protected void setNickName(String nickName)
{
this.userNickName = nickName;
}
/**
* Sets the subject obtained from the server once we're connected.
*
* @param subject the subject to set
*/
protected void setSubjectFromServer(String subject)
{
this.chatSubject = subject;
}
}

@ -452,8 +452,7 @@ protected void onJoin( String channel,
String login,
String hostname)
{
if (logger.isDebugEnabled())
logger.debug("JOIN on " + channel + ": Received from " + sender
logger.trace("JOIN on " + channel + ": Received from " + sender
+ " " + login + "@" + hostname);
ChatRoomIrcImpl chatRoom
@ -1471,9 +1470,13 @@ protected void onTopic( String channel,
= new ChatRoomPropertyChangeEvent(
chatRoom,
ChatRoomPropertyChangeEvent.CHAT_ROOM_SUBJECT,
topic,
chatRoom.getSubject(),
topic);
// After creating the event with the old and new value of the subject
// we could change the subject property of the chat room.
chatRoom.setSubjectFromServer(topic);
chatRoom.firePropertyChangeEvent(evt);
}

Loading…
Cancel
Save