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;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
@ -17,11 +22,6 @@ import java.util.Enumeration;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
public class SparkRes {
|
||||
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_INACTIVE_IMAGE = "ICQ_TRANSPORT_INACTIVE_IMAGE";
|
||||
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();
|
||||
|
||||
|
||||
@ -226,6 +226,7 @@ HISTORY_24x24 = images/history-24x24.png
|
||||
PANE_UP_ARROW_IMAGE = images/metallic_up.png
|
||||
PANE_DOWN_ARROW_IMAGE = images/metallic_down.png
|
||||
PROFILE_IMAGE_16x16 = images/profile_16x16.png
|
||||
LIGHTBULB_ON_16x16_IMAGE = images/lightbulb_on.png
|
||||
|
||||
#Fastpath Icons
|
||||
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.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.Color;
|
||||
import java.awt.Component;
|
||||
@ -78,23 +95,6 @@ import java.util.StringTokenizer;
|
||||
import java.util.Timer;
|
||||
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 {
|
||||
private JPanel mainPanel = new JPanel();
|
||||
private JScrollPane treeScroller;
|
||||
@ -611,9 +611,16 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
// If not, just update their presence.
|
||||
else {
|
||||
RosterEntry entry = roster.getEntry(jid);
|
||||
Presence presence = roster.getPresence(jid);
|
||||
item.setPresence(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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ import javax.swing.JTextField;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
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(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(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);
|
||||
}
|
||||
|
||||
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) {
|
||||
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.add(titlePanel, BorderLayout.NORTH);
|
||||
Object[] options = {
|
||||
@ -216,9 +236,8 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
||||
pane = new JOptionPane(panel, -1, 2, null, options, options[0]);
|
||||
mainPanel.add(pane, BorderLayout.CENTER);
|
||||
dialog = new JDialog(parent, Res.getString("title.add.contact"), true);
|
||||
dialog.pack();
|
||||
dialog.setContentPane(mainPanel);
|
||||
dialog.setSize(350, 350);
|
||||
dialog.pack();
|
||||
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
pane.addPropertyChangeListener(this);
|
||||
@ -260,7 +279,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
||||
|
||||
if (transport == null) {
|
||||
if (contact.indexOf("@") == -1) {
|
||||
contact = contact + "@" + SparkManager.getConnection().getHost();
|
||||
contact = contact + "@" + SparkManager.getConnection().getServiceName();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -317,7 +336,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
||||
if (item.getTransport() == null) {
|
||||
String jid = jidField.getText();
|
||||
if (jid.indexOf("@") == -1) {
|
||||
jid = jid + "@" + SparkManager.getConnection().getHost();
|
||||
jid = jid + "@" + SparkManager.getConnection().getServiceName();
|
||||
}
|
||||
String nickname = nicknameField.getText();
|
||||
String group = (String)groupBox.getSelectedItem();
|
||||
@ -395,7 +414,7 @@ public class RosterDialog implements PropertyChangeListener, ActionListener {
|
||||
List<AccountItem> list = new ArrayList<AccountItem>();
|
||||
|
||||
// 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);
|
||||
|
||||
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