|
|
|
|
@ -1,58 +1,70 @@
|
|
|
|
|
/*
|
|
|
|
|
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
|
|
|
|
*
|
|
|
|
|
* Distributable under LGPL license.
|
|
|
|
|
* See terms of license at gnu.org.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package net.java.sip.communicator.impl.gui.main.message.toolBars;
|
|
|
|
|
|
|
|
|
|
import java.awt.Component;
|
|
|
|
|
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.JEditorPane;
|
|
|
|
|
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.customcontrols.SIPCommToolBar;
|
|
|
|
|
import net.java.sip.communicator.impl.gui.main.history.HistoryWindow;
|
|
|
|
|
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
|
|
|
|
|
import net.java.sip.communicator.impl.gui.main.message.SmiliesSelectorBox;
|
|
|
|
|
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
|
|
|
|
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
|
|
|
|
|
|
|
|
|
|
public class MainToolBar extends JToolBar
|
|
|
|
|
public class MainToolBar extends SIPCommToolBar
|
|
|
|
|
implements ActionListener {
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton copyButton
|
|
|
|
|
= new MsgToolbarButton(Constants.COPY_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.COPY_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton cutButton
|
|
|
|
|
= new MsgToolbarButton(Constants.CUT_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.CUT_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton pasteButton
|
|
|
|
|
= new MsgToolbarButton(Constants.PASTE_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PASTE_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton smilyButton
|
|
|
|
|
= new MsgToolbarButton(Constants.SMILIES_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SMILIES_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton saveButton
|
|
|
|
|
= new MsgToolbarButton(Constants.SAVE_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SAVE_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton printButton
|
|
|
|
|
= new MsgToolbarButton(Constants.PRINT_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PRINT_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton previousButton
|
|
|
|
|
= new MsgToolbarButton(Constants.PREVIOUS_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PREVIOUS_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton nextButton
|
|
|
|
|
= new MsgToolbarButton(Constants.NEXT_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.NEXT_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton historyButton
|
|
|
|
|
= new MsgToolbarButton(Constants.HISTORY_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.HISTORY_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton sendFileButton
|
|
|
|
|
= new MsgToolbarButton(Constants.SEND_FILE_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SEND_FILE_ICON));
|
|
|
|
|
|
|
|
|
|
private MsgToolbarButton fontButton
|
|
|
|
|
= new MsgToolbarButton(Constants.FONT_ICON);
|
|
|
|
|
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.FONT_ICON));
|
|
|
|
|
|
|
|
|
|
private JLabel toolbarDivider = new JLabel(new ImageIcon
|
|
|
|
|
(Constants.TOOLBAR_DIVIDER));
|
|
|
|
|
(ImageLoader.getImage(ImageLoader.TOOLBAR_DIVIDER)));
|
|
|
|
|
|
|
|
|
|
private MessageWindow messageWindow;
|
|
|
|
|
|
|
|
|
|
@ -62,7 +74,7 @@ public MainToolBar (MessageWindow messageWindow){
|
|
|
|
|
|
|
|
|
|
this.setRollover(true);
|
|
|
|
|
this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
|
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 5, 2));
|
|
|
|
|
|
|
|
|
|
this.add(saveButton);
|
|
|
|
|
this.add(printButton);
|
|
|
|
|
@ -127,12 +139,40 @@ public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("cut")) {
|
|
|
|
|
|
|
|
|
|
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
|
|
|
|
|
|
|
|
|
|
editorPane.cut();
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("copy")) {
|
|
|
|
|
|
|
|
|
|
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
|
|
|
|
|
|
|
|
|
|
editorPane.copy();
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("paste")) {
|
|
|
|
|
|
|
|
|
|
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
|
|
|
|
|
|
|
|
|
|
editorPane.paste();
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("smily")) {
|
|
|
|
|
|
|
|
|
|
if (e.getSource() instanceof SIPCommButton){
|
|
|
|
|
|
|
|
|
|
SmiliesSelectorBox smiliesBox = new SmiliesSelectorBox(ImageLoader.getDefaultSmiliesPack());
|
|
|
|
|
|
|
|
|
|
if (!smiliesBox.isVisible()) {
|
|
|
|
|
|
|
|
|
|
smiliesBox.setInvoker((Component)e.getSource());
|
|
|
|
|
|
|
|
|
|
smiliesBox.setMessageWindow(this.messageWindow);
|
|
|
|
|
|
|
|
|
|
smiliesBox.setLocation(smiliesBox.getPopupLocation());
|
|
|
|
|
|
|
|
|
|
smiliesBox.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("previous")) {
|
|
|
|
|
|
|
|
|
|
} else if (buttonText.equalsIgnoreCase("next")) {
|
|
|
|
|
|