mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Check phone in sepearte thread.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7776 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -21,10 +21,6 @@ import org.jivesoftware.spark.ui.rooms.ChatRoomImpl;
|
|||||||
import org.jivesoftware.spark.util.SwingWorker;
|
import org.jivesoftware.spark.util.SwingWorker;
|
||||||
import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
|
import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
|
||||||
|
|
||||||
import javax.swing.Action;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -32,6 +28,10 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles general phone behavior in Spark. This allows for many different phone systems
|
* Handles general phone behavior in Spark. This allows for many different phone systems
|
||||||
* to plug into Spark in a more elegant way.
|
* to plug into Spark in a more elegant way.
|
||||||
@ -104,6 +104,8 @@ public class PhoneManager implements ChatRoomListener, ContextMenuListener {
|
|||||||
dialButton.setToolTipText("Place a phone call to this user.");
|
dialButton.setToolTipText("Place a phone call to this user.");
|
||||||
|
|
||||||
final List<Action> actions = new ArrayList<Action>();
|
final List<Action> actions = new ArrayList<Action>();
|
||||||
|
SwingWorker actionWorker = new SwingWorker() {
|
||||||
|
public Object construct() {
|
||||||
for (Phone phone : phones) {
|
for (Phone phone : phones) {
|
||||||
final Collection<Action> phoneActions = phone.getPhoneActions(chatRoomImpl.getParticipantJID());
|
final Collection<Action> phoneActions = phone.getPhoneActions(chatRoomImpl.getParticipantJID());
|
||||||
if (phoneActions != null) {
|
if (phoneActions != null) {
|
||||||
@ -112,6 +114,21 @@ public class PhoneManager implements ChatRoomListener, ContextMenuListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finished() {
|
||||||
|
if (!actions.isEmpty()) {
|
||||||
|
room.getToolBar().addChatRoomButton(dialButton);
|
||||||
|
room.getToolBar().invalidate();
|
||||||
|
room.getToolBar().validate();
|
||||||
|
room.getToolBar().repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
actionWorker.start();
|
||||||
|
|
||||||
|
|
||||||
dialButton.addMouseListener(new MouseAdapter() {
|
dialButton.addMouseListener(new MouseAdapter() {
|
||||||
public void mousePressed(final MouseEvent e) {
|
public void mousePressed(final MouseEvent e) {
|
||||||
@ -148,11 +165,6 @@ public class PhoneManager implements ChatRoomListener, ContextMenuListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (!actions.isEmpty()) {
|
|
||||||
room.getToolBar().addChatRoomButton(dialButton);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user