Search in sources :

Example 11 with SwingTimerTask

use of org.jivesoftware.spark.util.SwingTimerTask in project Spark by igniterealtime.

the class OutgoingCall method sessionEstablished.

public void sessionEstablished(PayloadType payloadType, TransportCandidate transportCandidate, TransportCandidate transportCandidate1, JingleSession jingleSession) {
    established = true;
    mediaReceivedTask = new SwingTimerTask() {

        public void doRun() {
            if (!mediaReceived) {
                if (session != null) {
                    try {
                        session.terminate("No Media Received. This may be caused by firewall configuration problems.");
                    } catch (XMPPException | SmackException e) {
                        Log.error(e);
                    }
                }
            }
        }
    };
    TaskEngine.getInstance().schedule(mediaReceivedTask, WAIT_FOR_MEDIA_DELAY, WAIT_FOR_MEDIA_DELAY);
    SwingUtilities.invokeLater(() -> updateOutgoingCallPanel());
}
Also used : SwingTimerTask(org.jivesoftware.spark.util.SwingTimerTask)

Example 12 with SwingTimerTask

use of org.jivesoftware.spark.util.SwingTimerTask in project Spark by igniterealtime.

the class ChatContainer method handleStaleChats.

/**
 * Checks every room every 30 seconds to see if it's timed out.
 */
private void handleStaleChats() {
    // delay for 1 second.
    int delay = 1000;
    // repeat every minute.
    int period = 60000;
    final TimerTask task = new SwingTimerTask() {

        public void doRun() {
            for (ChatRoom chatRoom : getStaleChatRooms()) {
                // Notify decorators
                SparkManager.getChatManager().notifySparkTabHandlers(chatRoom);
            }
        }
    };
    TaskEngine.getInstance().scheduleAtFixedRate(task, delay, period);
}
Also used : SwingTimerTask(org.jivesoftware.spark.util.SwingTimerTask) SwingTimerTask(org.jivesoftware.spark.util.SwingTimerTask) GroupChatRoom(org.jivesoftware.spark.ui.rooms.GroupChatRoom)

Aggregations

SwingTimerTask (org.jivesoftware.spark.util.SwingTimerTask)12 TimerTask (java.util.TimerTask)8 Message (org.jivesoftware.smack.packet.Message)3 SmackException (org.jivesoftware.smack.SmackException)2 StanzaTypeFilter (org.jivesoftware.smack.filter.StanzaTypeFilter)2 SwingWorker (org.jivesoftware.spark.util.SwingWorker)2 java.awt (java.awt)1 BorderLayout (java.awt.BorderLayout)1 Component (java.awt.Component)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 java.awt.event (java.awt.event)1 ActionEvent (java.awt.event.ActionEvent)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 WindowAdapter (java.awt.event.WindowAdapter)1