Search in sources :

Example 11 with SparkToaster

use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.

the class CallManager method showOutgoingCall.

private void showOutgoingCall(final InterlocutorUI ic) {
    final SparkToaster toasterManager = new SparkToaster();
    toasters.put(ic, toasterManager);
    final OutgoingCallUI incomingCall = new OutgoingCallUI(ic);
    toasterManager.setToasterHeight(230);
    toasterManager.setToasterWidth(300);
    toasterManager.setDisplayTime(500000000);
    toasterManager.setHidable(false);
    toasterManager.showToaster(PhoneRes.getIString("phone.incomingcall"), incomingCall);
    toasterManager.hideTitle();
    incomingCall.getRejectButton().addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            closeToaster(ic);
            SoftPhoneManager.getInstance().getDefaultGuiManager().hangup(ic);
        }
    });
}
Also used : SparkToaster(org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 12 with SparkToaster

use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.

the class ChatContainer method checkNotificationPreferences.

/**
 * Handles Notification preferences for incoming messages and rooms.
 *
 * @param room the chat room.
 */
private void checkNotificationPreferences(final ChatRoom room, boolean customMsg, String customMsgText, String customMsgTitle) {
    LocalPreferences pref = SettingsManager.getLocalPreferences();
    if (pref.getWindowTakesFocus()) {
        chatFrame.setState(Frame.NORMAL);
        chatFrame.setVisible(true);
    }
    if (pref.getShowToasterPopup()) {
        SparkToaster toaster = new SparkToaster();
        toaster.setCustomAction(new AbstractAction() {

            private static final long serialVersionUID = -2759404307378067515L;

            public void actionPerformed(ActionEvent actionEvent) {
                chatFrame.setState(Frame.NORMAL);
                chatFrame.setVisible(true);
                int tabLocation = indexOfComponent(room);
                if (tabLocation != -1) {
                    setSelectedIndex(tabLocation);
                }
            }
        });
        toaster.setDisplayTime(5000);
        toaster.setBorder(BorderFactory.createBevelBorder(0));
        String nickname = room.getRoomTitle();
        toaster.setToasterHeight(150);
        toaster.setToasterWidth(200);
        int size = room.getTranscripts().size();
        if (customMsg) {
            toaster.setTitle(customMsgTitle);
            toaster.showToaster(room.getTabIcon(), customMsgText);
        } else {
            toaster.setTitle(nickname);
            if (size > 0) {
                Message message = room.getTranscripts().get(size - 1);
                toaster.showToaster(room.getTabIcon(), message.getBody());
            }
        }
    }
}
Also used : SparkToaster(org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster) Message(org.jivesoftware.smack.packet.Message) LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences)

Aggregations

SparkToaster (org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster)12 ActionEvent (java.awt.event.ActionEvent)4 Date (java.util.Date)3 Font (java.awt.Font)2 ActionListener (java.awt.event.ActionListener)2 TimerTask (java.util.TimerTask)2 MouseEvent (java.awt.event.MouseEvent)1 ArrayList (java.util.ArrayList)1 AbstractAction (javax.swing.AbstractAction)1 Action (javax.swing.Action)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JPopupMenu (javax.swing.JPopupMenu)1 JScrollPane (javax.swing.JScrollPane)1 StanzaTypeFilter (org.jivesoftware.smack.filter.StanzaTypeFilter)1 Message (org.jivesoftware.smack.packet.Message)1 Presence (org.jivesoftware.smack.packet.Presence)1 VCard (org.jivesoftware.smackx.vcardtemp.packet.VCard)1 VerticalFlowLayout (org.jivesoftware.spark.component.VerticalFlowLayout)1 ContextMenuListener (org.jivesoftware.spark.plugin.ContextMenuListener)1