/** Constructs the <tt>AuthenticationWindow</tt>. */ private void init() { this.idValue = new JTextField( chatRoom.getParentProvider().getProtocolProvider().getAccountID().getUserID()); this.infoTextArea.setOpaque(false); this.infoTextArea.setLineWrap(true); this.infoTextArea.setWrapStyleWord(true); this.infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD)); this.infoTextArea.setEditable(false); this.infoTextArea.setText( GuiActivator.getResources() .getI18NString( "service.gui.CHAT_ROOM_REQUIRES_PASSWORD", new String[] {chatRoom.getChatRoomName()})); this.idLabel.setFont(idLabel.getFont().deriveFont(Font.BOLD)); this.passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD)); this.labelsPanel.add(idLabel); this.labelsPanel.add(passwdLabel); this.textFieldsPanel.add(idValue); this.textFieldsPanel.add(passwdField); this.buttonsPanel.add(loginButton); this.buttonsPanel.add(cancelButton); this.mainPanel.add(infoTextArea, BorderLayout.NORTH); this.mainPanel.add(labelsPanel, BorderLayout.WEST); this.mainPanel.add(textFieldsPanel, BorderLayout.CENTER); this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH); this.backgroundPanel.add(mainPanel, BorderLayout.CENTER); this.loginButton.setName("ok"); this.cancelButton.setName("cancel"); this.loginButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.OK")); this.cancelButton.setMnemonic( GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL")); this.loginButton.addActionListener(this); this.cancelButton.addActionListener(this); this.getRootPane().setDefaultButton(loginButton); this.setTransparent(true); }
/** * Handles the <tt>ActionEvent</tt>. Determines which menu item was selected and makes the * appropriate operations. * * @param e the event. */ public void actionPerformed(ActionEvent e) { JMenuItem menuItem = (JMenuItem) e.getSource(); String itemName = menuItem.getName(); ConferenceChatManager conferenceManager = GuiActivator.getUIService().getConferenceChatManager(); if (itemName.equals("removeChatRoom")) { conferenceManager.removeChatRoom(chatRoomWrapper); } else if (itemName.equals("leaveChatRoom")) { conferenceManager.leaveChatRoom(chatRoomWrapper); } else if (itemName.equals("joinChatRoom")) { conferenceManager.joinChatRoom(chatRoomWrapper); } else if (itemName.equals("openChatRoom")) { if (chatRoomWrapper.getChatRoom() != null) { if (!chatRoomWrapper.getChatRoom().isJoined()) { conferenceManager.joinChatRoom(chatRoomWrapper); } } else { // this is not a server persistent room we must create it // and join chatRoomWrapper = GuiActivator.getUIService() .getConferenceChatManager() .createChatRoom( chatRoomWrapper.getChatRoomName(), chatRoomWrapper.getParentProvider().getProtocolProvider(), new ArrayList<String>(), "", true, true); } ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); ChatPanel chatPanel = chatWindowManager.getMultiChat(chatRoomWrapper, true); chatWindowManager.openChat(chatPanel, true); } else if (itemName.equals("joinAsChatRoom")) { ChatRoomAuthenticationWindow authWindow = new ChatRoomAuthenticationWindow(chatRoomWrapper); authWindow.setVisible(true); } }
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ChatRoomWrapper chatRoom = (ChatRoomWrapper) value; this.setText(chatRoom.getChatRoomName()); Image chatRoomImage = ImageLoader.getImage(ImageLoader.CHAT_ROOM_16x16_ICON); if (chatRoom.getChatRoom() == null || !chatRoom.getChatRoom().isJoined()) { chatRoomImage = LightGrayFilter.createDisabledImage(chatRoomImage); } this.setIcon(new ImageIcon(chatRoomImage)); this.setFont(this.getFont().deriveFont(Font.PLAIN)); if (isSelected) this.setBackground(table.getSelectionBackground()); else this.setBackground(UIManager.getColor("Table.background")); return this; }
/** * Handles the <tt>ActionEvent</tt>. Determines which menu item was selected and makes the * appropriate operations. * * @param e the event. */ public void actionPerformed(ActionEvent e) { JMenuItem menuItem = (JMenuItem) e.getSource(); String itemName = menuItem.getName(); ConferenceChatManager conferenceManager = GuiActivator.getUIService().getConferenceChatManager(); if (itemName.equals("removeChatRoom")) { conferenceManager.removeChatRoom(chatRoomWrapper); } else if (itemName.equals("leaveChatRoom")) { conferenceManager.leaveChatRoom(chatRoomWrapper); } else if (itemName.equals("joinChatRoom")) { String nickName = null; nickName = ConfigurationManager.getChatRoomProperty( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), "userNickName"); if (nickName == null) nickName = getNickname(); if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null); else conferenceManager.joinChatRoom(chatRoomWrapper); } else if (itemName.equals("openChatRoom")) { if (chatRoomWrapper.getChatRoom() != null) { if (!chatRoomWrapper.getChatRoom().isJoined()) { String nickName = null; nickName = ConfigurationManager.getChatRoomProperty( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), "userNickName"); if (nickName == null) nickName = getNickname(); if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null); else conferenceManager.joinChatRoom(chatRoomWrapper); } } else { // this is not a server persistent room we must create it // and join chatRoomWrapper = GuiActivator.getUIService() .getConferenceChatManager() .createChatRoom( chatRoomWrapper.getChatRoomName(), chatRoomWrapper.getParentProvider().getProtocolProvider(), new ArrayList<String>(), "", false, true); String nickName = null; nickName = ConfigurationManager.getChatRoomProperty( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), "userNickName"); if (nickName == null) nickName = getNickname(); if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null); else conferenceManager.joinChatRoom(chatRoomWrapper); } ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); ChatPanel chatPanel = chatWindowManager.getMultiChat(chatRoomWrapper, true); chatWindowManager.openChat(chatPanel, true); } else if (itemName.equals("joinAsChatRoom")) { ChatRoomAuthenticationWindow authWindow = new ChatRoomAuthenticationWindow(chatRoomWrapper); authWindow.setVisible(true); } else if (itemName.equals("nickNameChatRoom")) { String nickName = null; nickName = ConfigurationManager.getChatRoomProperty( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), "userNickName"); ChatOperationReasonDialog reasonDialog = new ChatOperationReasonDialog( GuiActivator.getResources().getI18NString("service.gui.CHANGE_NICKNAME"), GuiActivator.getResources().getI18NString("service.gui.CHANGE_NICKNAME_LABEL")); reasonDialog.setReasonFieldText( nickName == null ? chatRoomWrapper.getParentProvider().getProtocolProvider().getAccountID().getUserID() : nickName); int result = reasonDialog.showDialog(); if (result == MessageDialog.OK_RETURN_CODE) { nickName = reasonDialog.getReason().trim(); } ConfigurationManager.updateChatRoomProperty( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), "userNickName", nickName); } }