mirror of https://github.com/sipwise/jitsi.git
parent
cbfe3ee202
commit
51dd74637c
@ -0,0 +1,13 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import javax.swing.JList;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.ContactItem;
|
||||
import net.java.sip.communicator.impl.gui.main.ContactList;
|
||||
|
||||
public class ChatConferenceList extends JList {
|
||||
|
||||
public ChatConferenceList (){
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.ContactItem;
|
||||
import net.java.sip.communicator.impl.gui.main.ContactPanel;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
|
||||
public class ChatConferencePanel extends JPanel {
|
||||
|
||||
private JScrollPane contactsScrollPane = new JScrollPane ();
|
||||
|
||||
private JPanel contactsPanel = new JPanel ();
|
||||
|
||||
private JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private SIPCommButton addToChatButton
|
||||
= new SIPCommButton(Constants.ADD_TO_CHAT_BUTTON,
|
||||
Constants.ADD_TO_CHAT_ROLLOVER_BUTTON,
|
||||
Constants.ADD_TO_CHAT_ICON);
|
||||
|
||||
private JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
private ChatContactPanel chatContactPanel;
|
||||
|
||||
|
||||
public ChatConferencePanel (){
|
||||
|
||||
super (new BorderLayout(5, 5));
|
||||
|
||||
this.setMinimumSize(new Dimension(150, 100));
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
this.contactsPanel.setLayout(new BoxLayout(this.contactsPanel, BoxLayout.Y_AXIS));
|
||||
|
||||
this.mainPanel.add(contactsPanel, BorderLayout.NORTH);
|
||||
this.contactsScrollPane.getViewport().add(this.mainPanel);
|
||||
|
||||
this.buttonPanel.add(addToChatButton);
|
||||
|
||||
this.add(contactsScrollPane, BorderLayout.CENTER);
|
||||
this.add(buttonPanel, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
public void addContactToChat (ContactItem contactItem){
|
||||
|
||||
chatContactPanel = new ChatContactPanel(contactItem);
|
||||
|
||||
this.contactsPanel.add(chatContactPanel);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.BevelBorder;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.ContactItem;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class ChatContactPanel extends JPanel {
|
||||
|
||||
private SIPCommButton callButton
|
||||
= new SIPCommButton(Constants.CHAT_CONTACT_CALL_BUTTON,
|
||||
Constants.CHAT_CONTACT_CALL_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton infoButton
|
||||
= new SIPCommButton(Constants.CHAT_CONTACT_INFO_BUTTON,
|
||||
Constants.CHAT_CONTACT_INFO_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton sendFileButton
|
||||
= new SIPCommButton(Constants.CHAT_CONTACT_SEND_FILE_BUTTON,
|
||||
Constants.CHAT_SEND_FILE_ROLLOVER_BUTTON);
|
||||
|
||||
private JLabel personPhotoLabel = new JLabel();
|
||||
|
||||
private JLabel personNameLabel = new JLabel();
|
||||
|
||||
private JPanel buttonsPanel
|
||||
= new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
private JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private JPanel contactNamePanel
|
||||
= new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
|
||||
|
||||
private ContactItem contactItem;
|
||||
|
||||
private boolean isMouseOver = false;
|
||||
private boolean isSelected = false;
|
||||
|
||||
public ChatContactPanel(ContactItem contactItem){
|
||||
|
||||
super(new BorderLayout());
|
||||
|
||||
this.setPreferredSize(new Dimension (100, 60));
|
||||
|
||||
this.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
|
||||
|
||||
this.contactItem = contactItem;
|
||||
|
||||
this.setOpaque(false);
|
||||
this.mainPanel.setOpaque(false);
|
||||
this.contactNamePanel.setOpaque(false);
|
||||
this.buttonsPanel.setOpaque(false);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
this.personNameLabel.setText(contactItem.getNickName());
|
||||
this.personNameLabel.setFont(this.getFont().deriveFont(Font.BOLD));
|
||||
|
||||
this.personPhotoLabel.setIcon(new ImageIcon(contactItem.getPhoto()));
|
||||
|
||||
this.buttonsPanel.add(callButton);
|
||||
this.buttonsPanel.add(infoButton);
|
||||
this.buttonsPanel.add(sendFileButton);
|
||||
|
||||
this.contactNamePanel.add(personNameLabel);
|
||||
|
||||
this.mainPanel.add(buttonsPanel, BorderLayout.NORTH);
|
||||
this.mainPanel.add(contactNamePanel, BorderLayout.CENTER);
|
||||
|
||||
this.add(personPhotoLabel, BorderLayout.WEST);
|
||||
this.add(mainPanel, BorderLayout.CENTER);
|
||||
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g){
|
||||
super.paintComponent(g);
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
GradientPaint p = new GradientPaint(this.getWidth()/2,
|
||||
0,
|
||||
Constants.CONTACTPANEL_MOVER_START_COLOR,
|
||||
this.getWidth()/2,
|
||||
Constants.CONTACTPANEL_GRADIENT_SIZE,
|
||||
Constants.CONTACTPANEL_MOVER_END_COLOR);
|
||||
|
||||
GradientPaint p1 = new GradientPaint( this.getWidth()/2,
|
||||
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE,
|
||||
Constants.CONTACTPANEL_MOVER_END_COLOR,
|
||||
this.getWidth()/2,
|
||||
this.getHeight(),
|
||||
Constants.CONTACTPANEL_MOVER_START_COLOR);
|
||||
|
||||
g2.setPaint(p);
|
||||
g2.fillRect(0, 0, this.getWidth(), Constants.CONTACTPANEL_GRADIENT_SIZE);
|
||||
|
||||
g2.setColor(Constants.CONTACTPANEL_MOVER_END_COLOR);
|
||||
g2.fillRect(0,
|
||||
Constants.CONTACTPANEL_GRADIENT_SIZE,
|
||||
this.getWidth(),
|
||||
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE);
|
||||
|
||||
g2.setPaint(p1);
|
||||
g2.fillRect(0, this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
|
||||
public void setMouseOver(boolean isMouseOver) {
|
||||
this.isMouseOver = isMouseOver;
|
||||
}
|
||||
|
||||
public void setSelected(boolean isSelected) {
|
||||
if(this.isSelected != isSelected) {
|
||||
this.isSelected = isSelected;
|
||||
|
||||
this.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMouseOver() {
|
||||
return isMouseOver;
|
||||
}
|
||||
|
||||
public boolean isSelected() {
|
||||
return isSelected;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.User;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
|
||||
public class ChatPanel extends JPanel {
|
||||
|
||||
private MessageWindow msgWindow;
|
||||
|
||||
private JEditorPane chatEditorPane = new JEditorPane();
|
||||
|
||||
public ChatPanel(MessageWindow msgWindow){
|
||||
|
||||
super();
|
||||
|
||||
this.msgWindow = msgWindow;
|
||||
|
||||
this.chatEditorPane.setEditable(false);
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
//this.add(chatEditorPane);
|
||||
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g){
|
||||
|
||||
g.setClip(3, 3, this.getWidth() - 7, this.getHeight() - 5);
|
||||
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
g2.setColor(Constants.MSG_WINDOW_BORDER_COLOR);
|
||||
g2.setStroke(new BasicStroke(1.5f));
|
||||
|
||||
g2.drawRoundRect(3, 3, this.getWidth() - 7, this.getHeight() - 5, 8, 8);
|
||||
|
||||
}
|
||||
|
||||
public void showReceivedMessage(){
|
||||
|
||||
}
|
||||
|
||||
public void showSentMessage(User sender, Calendar calendar, String message){
|
||||
|
||||
String messageString = "<HTML><B><FONT COLOR=\"#2e538b\">" + sender.getName() + " at " + calendar.getTime() +
|
||||
"</FONT></B><BR>"+ message + "</HTML>";
|
||||
|
||||
JLabel messageLabel = new JLabel(messageString);
|
||||
|
||||
this.add(messageLabel);
|
||||
|
||||
this.validate();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.message.menu.MessageWindowMenuBar;
|
||||
import net.java.sip.communicator.impl.gui.main.message.toolBars.EditTextToolBar;
|
||||
import net.java.sip.communicator.impl.gui.main.message.toolBars.MainToolBar;
|
||||
|
||||
public class MenusPanel extends JPanel {
|
||||
|
||||
private MessageWindowMenuBar menuBar;
|
||||
|
||||
private EditTextToolBar editTextToolBar = new EditTextToolBar();
|
||||
|
||||
private MainToolBar mainToolBar;
|
||||
|
||||
private MessageWindow parentWindow;
|
||||
|
||||
public MenusPanel (MessageWindow parentWindow){
|
||||
|
||||
super();
|
||||
|
||||
this.parentWindow = parentWindow;
|
||||
|
||||
mainToolBar = new MainToolBar(this.parentWindow);
|
||||
menuBar = new MessageWindowMenuBar(this.parentWindow);
|
||||
|
||||
this.setLayout(new GridLayout(0, 1));
|
||||
|
||||
this.add(menuBar);
|
||||
this.add(mainToolBar);
|
||||
//this.add(editTextToolBar);
|
||||
}
|
||||
|
||||
public void addToolBar(JToolBar toolBar){
|
||||
this.add(toolBar);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class MessageSendPanel extends JPanel implements ActionListener {
|
||||
|
||||
private JButton sendButton = new JButton(Messages.getString("send"));
|
||||
|
||||
private JPanel statusPanel = new JPanel();
|
||||
|
||||
private JLabel statusLabel = new JLabel();
|
||||
|
||||
private MessageWindow msgWindow;
|
||||
|
||||
public MessageSendPanel(MessageWindow msgWindow) {
|
||||
|
||||
super(new BorderLayout(5, 5));
|
||||
|
||||
this.msgWindow = msgWindow;
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
|
||||
|
||||
this.statusPanel.add(statusLabel);
|
||||
|
||||
this.add(sendButton, BorderLayout.EAST);
|
||||
this.add(statusPanel, BorderLayout.CENTER);
|
||||
|
||||
this.sendButton.addActionListener(this);
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
|
||||
g2.setColor(Constants.CONTACTPANEL_MOVER_START_COLOR);
|
||||
g2.setStroke(new BasicStroke(1f));
|
||||
|
||||
g2.drawRoundRect(3, 7, this.statusPanel.getWidth() - 4,
|
||||
this.statusPanel.getHeight() - 4, 8, 8);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JEditorPane messagePane = this.msgWindow.getWriteMessagePanel()
|
||||
.getEditorPane();
|
||||
|
||||
// TODO: Send the text to the protocol service.
|
||||
|
||||
// TODO: Receive a notice that message is delivered.
|
||||
|
||||
this.msgWindow.getChatPanel().showSentMessage(
|
||||
this.msgWindow.getParentWindow().getUser(),
|
||||
Calendar.getInstance(),
|
||||
messagePane.getText());
|
||||
|
||||
messagePane.setText("");
|
||||
|
||||
messagePane.requestFocus();
|
||||
}
|
||||
|
||||
public JButton getSendButton() {
|
||||
return sendButton;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.ContactItem;
|
||||
import net.java.sip.communicator.impl.gui.main.MainFrame;
|
||||
|
||||
public class MessageWindow extends JFrame {
|
||||
|
||||
private JSplitPane messagePane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||||
|
||||
private ChatPanel chatPanel;
|
||||
|
||||
private WriteMessagePanel writeMessagePanel;
|
||||
|
||||
private MenusPanel menusPanel;
|
||||
|
||||
private MessageSendPanel sendPanel;
|
||||
|
||||
private JPanel topPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private JPanel bottomPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private ChatConferencePanel chatConferencePanel = new ChatConferencePanel();
|
||||
|
||||
private JSplitPane topSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
|
||||
private MainFrame parentWindow;
|
||||
|
||||
private String windowTitle = "";
|
||||
|
||||
private Vector chatContacts = new Vector();
|
||||
|
||||
|
||||
|
||||
public MessageWindow (MainFrame parentWindow){
|
||||
|
||||
this.parentWindow = parentWindow;
|
||||
|
||||
this.setSize(550, 450);
|
||||
|
||||
this.setIconImage(Constants.SIP_LOGO);
|
||||
|
||||
menusPanel = new MenusPanel(this);
|
||||
|
||||
chatPanel = new ChatPanel(this);
|
||||
|
||||
writeMessagePanel = new WriteMessagePanel(this);
|
||||
|
||||
sendPanel = new MessageSendPanel(this);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init (){
|
||||
|
||||
this.topSplitPane.setDividerLocation(370);
|
||||
this.topSplitPane.setOneTouchExpandable(true);
|
||||
|
||||
topSplitPane.add(chatPanel);
|
||||
topSplitPane.add(chatConferencePanel);
|
||||
|
||||
this.topPanel.add(menusPanel, BorderLayout.NORTH);
|
||||
this.topPanel.add(topSplitPane, BorderLayout.CENTER);
|
||||
|
||||
this.bottomPanel.add(writeMessagePanel, BorderLayout.CENTER);
|
||||
this.bottomPanel.add(sendPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.messagePane.setDividerLocation(300);
|
||||
|
||||
this.messagePane.add(topPanel);
|
||||
this.messagePane.add(bottomPanel);
|
||||
|
||||
this.getContentPane().add(messagePane);
|
||||
}
|
||||
|
||||
public void addContactToChat (ContactItem contactItem){
|
||||
|
||||
this.chatContacts.add(contactItem);
|
||||
|
||||
this.chatConferencePanel.addContactToChat(contactItem);
|
||||
|
||||
this.windowTitle += contactItem.getNickName() + " ";
|
||||
|
||||
this.setTitle(this.windowTitle);
|
||||
}
|
||||
|
||||
public void removeContactFromChat (ContactItem contactItem){
|
||||
this.chatContacts.remove(contactItem);
|
||||
}
|
||||
|
||||
public Vector getChatContacts() {
|
||||
return chatContacts;
|
||||
}
|
||||
|
||||
public void setChatContacts(Vector chatContacts) {
|
||||
this.chatContacts = chatContacts;
|
||||
}
|
||||
|
||||
public MainFrame getParentWindow() {
|
||||
return parentWindow;
|
||||
}
|
||||
|
||||
public void setParentWindow(MainFrame parentWindow) {
|
||||
this.parentWindow = parentWindow;
|
||||
}
|
||||
|
||||
public WriteMessagePanel getWriteMessagePanel() {
|
||||
return writeMessagePanel;
|
||||
}
|
||||
|
||||
public MessageSendPanel getSendPanel() {
|
||||
return sendPanel;
|
||||
}
|
||||
|
||||
public void enableKeyboardSending(){
|
||||
this.writeMessagePanel.enableKeyboardSending();
|
||||
}
|
||||
|
||||
public ChatPanel getChatPanel() {
|
||||
return chatPanel;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class WriteMessagePanel extends JPanel {
|
||||
|
||||
private JEditorPane editorPane = new JEditorPane();
|
||||
|
||||
private MessageWindow msgWindow;
|
||||
|
||||
public WriteMessagePanel (MessageWindow msgWindow){
|
||||
|
||||
super(new BorderLayout());
|
||||
|
||||
this.msgWindow = msgWindow;
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
this.add(editorPane, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
|
||||
Graphics2D g2 = (Graphics2D)g;
|
||||
|
||||
g2.setColor(Constants.MSG_WINDOW_BORDER_COLOR);
|
||||
g2.setStroke(new BasicStroke(1.5f));
|
||||
|
||||
g2.drawRoundRect(3, 3, this.getWidth() - 4, this.getHeight() - 4, 8, 8);
|
||||
|
||||
}
|
||||
|
||||
public JEditorPane getEditorPane() {
|
||||
return editorPane;
|
||||
}
|
||||
|
||||
public void enableKeyboardSending(){
|
||||
|
||||
this.editorPane.addKeyListener(new KeyAdapter(){
|
||||
public void keyPressed(KeyEvent e){
|
||||
|
||||
if( (e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK &&
|
||||
(e.getKeyCode() == KeyEvent.VK_ENTER) ){
|
||||
|
||||
msgWindow.getSendPanel().getSendButton().requestFocus();
|
||||
|
||||
msgWindow.getSendPanel().getSendButton().doClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message.menu;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenuItem;
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class EditMenu extends JMenu {
|
||||
|
||||
private AntialiasedMenuItem cutMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("cut")
|
||||
, new ImageIcon(Constants.CUT_ICON));
|
||||
|
||||
private AntialiasedMenuItem copyMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("copy")
|
||||
, new ImageIcon(Constants.COPY_ICON));
|
||||
|
||||
private AntialiasedMenuItem pasteMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("paste")
|
||||
, new ImageIcon(Constants.PASTE_ICON));
|
||||
|
||||
public EditMenu(){
|
||||
|
||||
super(Messages.getString("edit"));
|
||||
|
||||
this.add(cutMenuItem);
|
||||
this.add(copyMenuItem);
|
||||
this.add(pasteMenuItem);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message.menu;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenuItem;
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class FileMenu extends JMenu
|
||||
implements ActionListener{
|
||||
|
||||
private AntialiasedMenuItem saveMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("save")
|
||||
, new ImageIcon(Constants.SAVE_ICON));
|
||||
|
||||
private AntialiasedMenuItem printMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("print")
|
||||
, new ImageIcon(Constants.PRINT_ICON));
|
||||
|
||||
private AntialiasedMenuItem closeMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("close")
|
||||
, new ImageIcon(Constants.CLOSE_ICON));
|
||||
|
||||
private AntialiasedMenuItem quitMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("quit")
|
||||
, new ImageIcon(Constants.QUIT_ICON));
|
||||
|
||||
private MessageWindow parentWindow;
|
||||
|
||||
public FileMenu(MessageWindow parentWindow){
|
||||
|
||||
super(Messages.getString("file"));
|
||||
|
||||
this.parentWindow = parentWindow;
|
||||
|
||||
this.add(saveMenuItem);
|
||||
this.add(printMenuItem);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(closeMenuItem);
|
||||
this.add(quitMenuItem);
|
||||
|
||||
this.saveMenuItem.setName("save");
|
||||
this.printMenuItem.setName("print");
|
||||
this.closeMenuItem.setName("close");
|
||||
this.quitMenuItem.setName("quit");
|
||||
|
||||
this.saveMenuItem.addActionListener(this);
|
||||
this.printMenuItem.addActionListener(this);
|
||||
this.closeMenuItem.addActionListener(this);
|
||||
this.quitMenuItem.addActionListener(this);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JMenuItem menuItem = (JMenuItem)e.getSource();
|
||||
String itemText = menuItem.getName();
|
||||
|
||||
if (itemText.equalsIgnoreCase("save")){
|
||||
|
||||
} else if (itemText.equalsIgnoreCase("print")){
|
||||
|
||||
} else if (itemText.equalsIgnoreCase("close")){
|
||||
|
||||
this.parentWindow.setVisible(false);
|
||||
this.parentWindow.dispose();
|
||||
|
||||
} else if (itemText.equalsIgnoreCase("quit")){
|
||||
|
||||
this.parentWindow.setVisible(false);
|
||||
this.parentWindow.dispose();
|
||||
this.parentWindow.getParentWindow().setVisible(false);
|
||||
this.parentWindow.getParentWindow().dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message.menu;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class MessageWindowMenuBar extends JMenuBar {
|
||||
|
||||
private FileMenu fileMenu;
|
||||
|
||||
private EditMenu editMenu = new EditMenu();
|
||||
|
||||
private JMenu settingsMenu = new JMenu(Messages.getString("settings"));
|
||||
|
||||
private JMenu helpMenu = new JMenu(Messages.getString("help"));
|
||||
|
||||
private MessageWindow parentWindow;
|
||||
|
||||
public MessageWindowMenuBar(MessageWindow parentWindow){
|
||||
|
||||
this.parentWindow = parentWindow;
|
||||
|
||||
fileMenu = new FileMenu(this.parentWindow);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
this.add(fileMenu);
|
||||
|
||||
this.add(editMenu);
|
||||
|
||||
this.add(settingsMenu);
|
||||
|
||||
this.add(helpMenu);
|
||||
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message.toolBars;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
|
||||
public class EditTextToolBar extends JToolBar {
|
||||
|
||||
private SIPCommButton textBoldButton
|
||||
= new SIPCommButton(Constants.TEXT_BOLD_BUTTON,
|
||||
Constants.TEXT_BOLD_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton textItalicButton
|
||||
= new SIPCommButton(Constants.TEXT_ITALIC_BUTTON,
|
||||
Constants.TEXT_ITALIC_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton textUnderlinedButton
|
||||
= new SIPCommButton(Constants.TEXT_UNDERLINED_BUTTON,
|
||||
Constants.TEXT_UNDERLINED_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton alignLeftButton
|
||||
= new SIPCommButton(Constants.ALIGN_LEFT_BUTTON,
|
||||
Constants.ALIGN_LEFT_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton alignRightButton
|
||||
= new SIPCommButton(Constants.ALIGN_RIGHT_BUTTON,
|
||||
Constants.ALIGN_RIGHT_ROLLOVER_BUTTON);
|
||||
|
||||
private SIPCommButton alignCenterButton
|
||||
= new SIPCommButton(Constants.ALIGN_CENTER_BUTTON,
|
||||
Constants.ALIGN_CENTER_ROLLOVER_BUTTON);
|
||||
|
||||
private JComboBox fontSizeCombo = new JComboBox();
|
||||
|
||||
private JComboBox fontNameCombo = new JComboBox();
|
||||
|
||||
public EditTextToolBar (){
|
||||
|
||||
this.setRollover(true);
|
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
|
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
|
||||
|
||||
this.fontSizeCombo.setPreferredSize (new Dimension (55, 21));
|
||||
|
||||
this.add(textBoldButton);
|
||||
this.add(textItalicButton);
|
||||
this.add(textUnderlinedButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(fontNameCombo);
|
||||
this.add(fontSizeCombo);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(alignLeftButton);
|
||||
this.add(alignCenterButton);
|
||||
this.add(alignRightButton);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,154 @@
|
||||
package net.java.sip.communicator.impl.gui.main.message.toolBars;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.MsgToolbarButton;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
import net.java.sip.communicator.impl.gui.main.history.HistoryWindow;
|
||||
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
|
||||
|
||||
public class MainToolBar extends JToolBar
|
||||
implements ActionListener {
|
||||
|
||||
private MsgToolbarButton copyButton
|
||||
= new MsgToolbarButton(Constants.COPY_ICON);
|
||||
|
||||
private MsgToolbarButton cutButton
|
||||
= new MsgToolbarButton(Constants.CUT_ICON);
|
||||
|
||||
private MsgToolbarButton pasteButton
|
||||
= new MsgToolbarButton(Constants.PASTE_ICON);
|
||||
|
||||
private MsgToolbarButton smilyButton
|
||||
= new MsgToolbarButton(Constants.SMILIES_ICON);
|
||||
|
||||
private MsgToolbarButton saveButton
|
||||
= new MsgToolbarButton(Constants.SAVE_ICON);
|
||||
|
||||
private MsgToolbarButton printButton
|
||||
= new MsgToolbarButton(Constants.PRINT_ICON);
|
||||
|
||||
private MsgToolbarButton previousButton
|
||||
= new MsgToolbarButton(Constants.PREVIOUS_ICON);
|
||||
|
||||
private MsgToolbarButton nextButton
|
||||
= new MsgToolbarButton(Constants.NEXT_ICON);
|
||||
|
||||
private MsgToolbarButton historyButton
|
||||
= new MsgToolbarButton(Constants.HISTORY_ICON);
|
||||
|
||||
private MsgToolbarButton sendFileButton
|
||||
= new MsgToolbarButton(Constants.SEND_FILE_ICON);
|
||||
|
||||
private MsgToolbarButton fontButton
|
||||
= new MsgToolbarButton(Constants.FONT_ICON);
|
||||
|
||||
private JLabel toolbarDivider = new JLabel(new ImageIcon
|
||||
(Constants.TOOLBAR_DIVIDER));
|
||||
|
||||
private MessageWindow messageWindow;
|
||||
|
||||
public MainToolBar (MessageWindow messageWindow){
|
||||
|
||||
this.messageWindow = messageWindow;
|
||||
|
||||
this.setRollover(true);
|
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
|
||||
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||
|
||||
this.add(saveButton);
|
||||
this.add(printButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(cutButton);
|
||||
this.add(copyButton);
|
||||
this.add(pasteButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(smilyButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(previousButton);
|
||||
this.add(nextButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(sendFileButton);
|
||||
this.add(historyButton);
|
||||
|
||||
this.addSeparator();
|
||||
|
||||
this.add(fontButton);
|
||||
|
||||
this.saveButton.setName("save");
|
||||
this.printButton.setName("print");
|
||||
this.cutButton.setName("cut");
|
||||
this.copyButton.setName("copy");
|
||||
this.pasteButton.setName("paste");
|
||||
this.smilyButton.setName("smily");
|
||||
this.previousButton.setName("previous");
|
||||
this.nextButton.setName("next");
|
||||
this.sendFileButton.setName("sendFile");
|
||||
this.historyButton.setName("history");
|
||||
this.fontButton.setName("font");
|
||||
|
||||
this.saveButton.addActionListener(this);
|
||||
this.printButton.addActionListener(this);
|
||||
this.cutButton.addActionListener(this);
|
||||
this.copyButton.addActionListener(this);
|
||||
this.pasteButton.addActionListener(this);
|
||||
this.smilyButton.addActionListener(this);
|
||||
this.previousButton.addActionListener(this);
|
||||
this.nextButton.addActionListener(this);
|
||||
this.sendFileButton.addActionListener(this);
|
||||
this.historyButton.addActionListener(this);
|
||||
this.fontButton.addActionListener(this);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
MsgToolbarButton button = (MsgToolbarButton)e.getSource();
|
||||
String buttonText = button.getName();
|
||||
|
||||
if (buttonText.equalsIgnoreCase("save")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("print")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("cut")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("copy")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("paste")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("smily")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("previous")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("next")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("sendFile")) {
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("history")) {
|
||||
|
||||
HistoryWindow history = new HistoryWindow();
|
||||
|
||||
history.setContacts(messageWindow.getChatContacts());
|
||||
history.setVisible(true);
|
||||
|
||||
} else if (buttonText.equalsIgnoreCase("font")) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue