mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
1) Update roster to show groups with pending contacts.
2) Update RosterDialog. git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@5847 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
package org.jivesoftware.resource;
|
package org.jivesoftware.resource;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JEditorPane;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -17,11 +22,6 @@ import java.util.Enumeration;
|
|||||||
import java.util.PropertyResourceBundle;
|
import java.util.PropertyResourceBundle;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JEditorPane;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
|
|
||||||
public class SparkRes {
|
public class SparkRes {
|
||||||
private static PropertyResourceBundle prb;
|
private static PropertyResourceBundle prb;
|
||||||
|
|
||||||
@ -253,6 +253,7 @@ public class SparkRes {
|
|||||||
public static final String ICQ_TRANSPORT_ACTIVE_IMAGE = "ICQ_TRANSPORT_ACTIVE_IMAGE";
|
public static final String ICQ_TRANSPORT_ACTIVE_IMAGE = "ICQ_TRANSPORT_ACTIVE_IMAGE";
|
||||||
public static final String ICQ_TRANSPORT_INACTIVE_IMAGE = "ICQ_TRANSPORT_INACTIVE_IMAGE";
|
public static final String ICQ_TRANSPORT_INACTIVE_IMAGE = "ICQ_TRANSPORT_INACTIVE_IMAGE";
|
||||||
public static final String PROFILE_IMAGE_16x16 = "PROFILE_IMAGE_16x16";
|
public static final String PROFILE_IMAGE_16x16 = "PROFILE_IMAGE_16x16";
|
||||||
|
public static final String LIGHTBULB_ON_16x16_IMAGE = "LIGHTBULB_ON_16x16_IMAGE";
|
||||||
|
|
||||||
static ClassLoader cl = SparkRes.class.getClassLoader();
|
static ClassLoader cl = SparkRes.class.getClassLoader();
|
||||||
|
|
||||||
|
|||||||
@ -226,6 +226,7 @@ HISTORY_24x24 = images/history-24x24.png
|
|||||||
PANE_UP_ARROW_IMAGE = images/metallic_up.png
|
PANE_UP_ARROW_IMAGE = images/metallic_up.png
|
||||||
PANE_DOWN_ARROW_IMAGE = images/metallic_down.png
|
PANE_DOWN_ARROW_IMAGE = images/metallic_down.png
|
||||||
PROFILE_IMAGE_16x16 = images/profile_16x16.png
|
PROFILE_IMAGE_16x16 = images/profile_16x16.png
|
||||||
|
LIGHTBULB_ON_16x16_IMAGE = images/lightbulb_on.png
|
||||||
|
|
||||||
#Fastpath Icons
|
#Fastpath Icons
|
||||||
FASTPATH_IMAGE_16x16 = images/fastpath16.png
|
FASTPATH_IMAGE_16x16 = images/fastpath16.png
|
||||||
|
|||||||
@ -51,6 +51,23 @@ import org.jivesoftware.sparkimpl.profile.VCardManager;
|
|||||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||||
|
|
||||||
|
import javax.swing.AbstractAction;
|
||||||
|
import javax.swing.Action;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JMenu;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JToolBar;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
@ -78,23 +95,6 @@ import java.util.StringTokenizer;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
|
||||||
import javax.swing.Action;
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.Icon;
|
|
||||||
import javax.swing.JCheckBoxMenuItem;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JToolBar;
|
|
||||||
import javax.swing.KeyStroke;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.UIManager;
|
|
||||||
|
|
||||||
public final class ContactList extends JPanel implements ActionListener, ContactGroupListener, Plugin, RosterListener, ConnectionListener {
|
public final class ContactList extends JPanel implements ActionListener, ContactGroupListener, Plugin, RosterListener, ConnectionListener {
|
||||||
private JPanel mainPanel = new JPanel();
|
private JPanel mainPanel = new JPanel();
|
||||||
private JScrollPane treeScroller;
|
private JScrollPane treeScroller;
|
||||||
@ -261,7 +261,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
|||||||
|
|
||||||
RosterEntry entry = roster.getEntry(bareJID);
|
RosterEntry entry = roster.getEntry(bareJID);
|
||||||
boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)
|
boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)
|
||||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
|
||||||
|
|
||||||
// If online, check to see if they are in the offline group.
|
// If online, check to see if they are in the offline group.
|
||||||
// If so, remove from offline group and add to all groups they
|
// If so, remove from offline group and add to all groups they
|
||||||
@ -424,7 +424,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
|||||||
ContactItem contactItem = new ContactItem(name, entry.getUser());
|
ContactItem contactItem = new ContactItem(name, entry.getUser());
|
||||||
contactItem.setPresence(null);
|
contactItem.setPresence(null);
|
||||||
if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)
|
if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)
|
||||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||||
// Add to contact group.
|
// Add to contact group.
|
||||||
contactGroup.addContactItem(contactItem);
|
contactGroup.addContactItem(contactItem);
|
||||||
contactGroup.setVisible(true);
|
contactGroup.setVisible(true);
|
||||||
@ -611,9 +611,16 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
|||||||
|
|
||||||
// If not, just update their presence.
|
// If not, just update their presence.
|
||||||
else {
|
else {
|
||||||
|
RosterEntry entry = roster.getEntry(jid);
|
||||||
Presence presence = roster.getPresence(jid);
|
Presence presence = roster.getPresence(jid);
|
||||||
item.setPresence(presence);
|
item.setPresence(presence);
|
||||||
updateUserPresence(presence);
|
updateUserPresence(presence);
|
||||||
|
|
||||||
|
if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM)
|
||||||
|
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) {
|
||||||
|
contactGroup.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
contactGroup.fireContactGroupUpdated();
|
contactGroup.fireContactGroupUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,7 +661,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
|||||||
ContactItem offlineItem = offlineGroup.getContactItemByJID(jid);
|
ContactItem offlineItem = offlineGroup.getContactItemByJID(jid);
|
||||||
if (offlineItem != null) {
|
if (offlineItem != null) {
|
||||||
if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM)
|
if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM)
|
||||||
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) {
|
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) {
|
||||||
// Remove from offlineItem and add to unfiledItem.
|
// Remove from offlineItem and add to unfiledItem.
|
||||||
offlineGroup.removeContactItem(offlineItem);
|
offlineGroup.removeContactItem(offlineItem);
|
||||||
unfiledGroup.addContactItem(offlineItem);
|
unfiledGroup.addContactItem(offlineItem);
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import javax.swing.JTextField;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
@ -100,6 +101,8 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
panel.add(accountsLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
panel.add(accountsLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
panel.add(accounts, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
panel.add(accounts, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
|
|
||||||
|
accountsLabel.setVisible(false);
|
||||||
|
accounts.setVisible(false);
|
||||||
|
|
||||||
panel.add(groupLabel, new GridBagConstraints(0, 3, 1, 1, 0.0D, 0.0D, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
panel.add(groupLabel, new GridBagConstraints(0, 3, 1, 1, 0.0D, 0.0D, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
panel.add(groupBox, new GridBagConstraints(1, 3, 1, 1, 1.0D, 0.0D, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
panel.add(groupBox, new GridBagConstraints(1, 3, 1, 1, 1.0D, 0.0D, 17, 2, new Insets(5, 5, 5, 5), 0, 0));
|
||||||
@ -149,10 +152,18 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (AccountItem item : getAccounts()) {
|
final List<AccountItem> accountCol = getAccounts();
|
||||||
|
for (AccountItem item : accountCol) {
|
||||||
accounts.addItem(item);
|
accounts.addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accountCol.size() > 1) {
|
||||||
|
accountsLabel.setVisible(true);
|
||||||
|
accounts.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -207,7 +218,16 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
*/
|
*/
|
||||||
public void showRosterDialog(JFrame parent) {
|
public void showRosterDialog(JFrame parent) {
|
||||||
TitlePanel titlePanel = new TitlePanel(Res.getString("title.add.contact"), Res.getString("message.add.contact.to.list"), SparkRes.getImageIcon(SparkRes.USER1_32x32), true);
|
TitlePanel titlePanel = new TitlePanel(Res.getString("title.add.contact"), Res.getString("message.add.contact.to.list"), SparkRes.getImageIcon(SparkRes.USER1_32x32), true);
|
||||||
JPanel mainPanel = new JPanel();
|
|
||||||
|
|
||||||
|
JPanel mainPanel = new JPanel() {
|
||||||
|
public Dimension getPreferredSize() {
|
||||||
|
final Dimension size = super.getPreferredSize();
|
||||||
|
size.width = 350;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
mainPanel.setLayout(new BorderLayout());
|
mainPanel.setLayout(new BorderLayout());
|
||||||
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
||||||
Object[] options = {
|
Object[] options = {
|
||||||
@ -216,9 +236,8 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
pane = new JOptionPane(panel, -1, 2, null, options, options[0]);
|
pane = new JOptionPane(panel, -1, 2, null, options, options[0]);
|
||||||
mainPanel.add(pane, BorderLayout.CENTER);
|
mainPanel.add(pane, BorderLayout.CENTER);
|
||||||
dialog = new JDialog(parent, Res.getString("title.add.contact"), true);
|
dialog = new JDialog(parent, Res.getString("title.add.contact"), true);
|
||||||
dialog.pack();
|
|
||||||
dialog.setContentPane(mainPanel);
|
dialog.setContentPane(mainPanel);
|
||||||
dialog.setSize(350, 350);
|
dialog.pack();
|
||||||
|
|
||||||
dialog.setLocationRelativeTo(parent);
|
dialog.setLocationRelativeTo(parent);
|
||||||
pane.addPropertyChangeListener(this);
|
pane.addPropertyChangeListener(this);
|
||||||
@ -260,7 +279,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
|
|
||||||
if (transport == null) {
|
if (transport == null) {
|
||||||
if (contact.indexOf("@") == -1) {
|
if (contact.indexOf("@") == -1) {
|
||||||
contact = contact + "@" + SparkManager.getConnection().getHost();
|
contact = contact + "@" + SparkManager.getConnection().getServiceName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -317,7 +336,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
if (item.getTransport() == null) {
|
if (item.getTransport() == null) {
|
||||||
String jid = jidField.getText();
|
String jid = jidField.getText();
|
||||||
if (jid.indexOf("@") == -1) {
|
if (jid.indexOf("@") == -1) {
|
||||||
jid = jid + "@" + SparkManager.getConnection().getHost();
|
jid = jid + "@" + SparkManager.getConnection().getServiceName();
|
||||||
}
|
}
|
||||||
String nickname = nicknameField.getText();
|
String nickname = nicknameField.getText();
|
||||||
String group = (String)groupBox.getSelectedItem();
|
String group = (String)groupBox.getSelectedItem();
|
||||||
@ -395,7 +414,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
|||||||
List<AccountItem> list = new ArrayList<AccountItem>();
|
List<AccountItem> list = new ArrayList<AccountItem>();
|
||||||
|
|
||||||
// Create Jabber Account
|
// Create Jabber Account
|
||||||
AccountItem account = new AccountItem(SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE), "Jabber", null);
|
AccountItem account = new AccountItem(SparkRes.getImageIcon(SparkRes.LIGHTBULB_ON_16x16_IMAGE), "XMPP", null);
|
||||||
list.add(account);
|
list.add(account);
|
||||||
|
|
||||||
for (Transport transport : TransportManager.getTransports()) {
|
for (Transport transport : TransportManager.getTransports()) {
|
||||||
|
|||||||
BIN
src/resources/images/lightbulb_on.png
Normal file
BIN
src/resources/images/lightbulb_on.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 684 B |
Reference in New Issue
Block a user