1) Update spark phone.

2) Have dial use other thread.
3) Update new spark ico.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7799 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-03-29 20:36:13 +00:00
committed by derek
parent 07529d71ed
commit 5642311002
3 changed files with 39 additions and 24 deletions

Binary file not shown.

View File

@ -21,6 +21,10 @@ 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;
@ -28,10 +32,6 @@ 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.
@ -180,33 +180,48 @@ public class PhoneManager implements ChatRoomListener, ContextMenuListener {
} }
public void poppingUp(Object object, JPopupMenu popup) { public void poppingUp(Object object, final JPopupMenu popup) {
if (!phones.isEmpty()) { if (!phones.isEmpty()) {
if (object instanceof ContactItem) { if (object instanceof ContactItem) {
ContactItem contactItem = (ContactItem)object; final ContactItem contactItem = (ContactItem)object;
final List<Action> actions = new ArrayList<Action>(); final List<Action> actions = new ArrayList<Action>();
for (Phone phone : phones) {
final Collection<Action> itemActions = phone.getPhoneActions(contactItem.getJID());
for (Action action : itemActions) {
actions.add(action);
}
}
SwingWorker worker = new SwingWorker() {
if (actions.size() > 0) { public Object construct() {
final JMenu dialMenu = new JMenu("Dial"); for (Phone phone : phones) {
dialMenu.setIcon(SparkRes.getImageIcon(SparkRes.DIAL_PHONE_IMAGE_16x16)); final Collection<Action> itemActions = phone.getPhoneActions(contactItem.getJID());
for (Action action : itemActions) {
for (Action action : actions) { actions.add(action);
dialMenu.add(action); }
}
return null;
} }
int count = popup.getComponentCount(); public void finished() {
if (count > 2) {
popup.insert(dialMenu, 2); if (actions.size() > 0) {
} final JMenu dialMenu = new JMenu("Dial");
dialMenu.setIcon(SparkRes.getImageIcon(SparkRes.DIAL_PHONE_IMAGE_16x16));
for (Action action : actions) {
dialMenu.add(action);
}
int count = popup.getComponentCount();
if (count > 2) {
popup.insert(dialMenu, 2);
}
popup.invalidate();
popup.validate();
popup.repaint();
}
}
};
worker.start();
}
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 284 KiB