mirror of
https://github.com/igniterealtime/Spark.git
synced 2026-08-18 11:10:02 +00:00
Updating image backgrounds.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4752 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -207,6 +207,7 @@ public class PluginManager implements MainWindowListener {
|
||||
minSparkVersion = plugin.selectSingleNode("minSparkVersion").getText();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -51,28 +51,6 @@ 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.JButton;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
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.JTextField;
|
||||
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;
|
||||
@ -104,6 +82,28 @@ 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.JButton;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
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.JTextField;
|
||||
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;
|
||||
@ -207,6 +207,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
|
||||
// Add ActionListener(s) to menus
|
||||
addContactGroup(unfiledGroup);
|
||||
addContactGroup(offlineGroup);
|
||||
|
||||
showHideMenu.setSelected(false);
|
||||
@ -241,8 +242,9 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
JPanel commandPanel = statusBar.getCommandPanel();
|
||||
|
||||
|
||||
final RolloverButton addContactButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE));
|
||||
final RolloverButton addContactButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16));
|
||||
commandPanel.add(addContactButton);
|
||||
addContactButton.setToolTipText("Add a contact");
|
||||
addContactButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new RosterDialog().showRosterDialog();
|
||||
@ -268,7 +270,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
RosterEntry entry = roster.getEntry(bareJID);
|
||||
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 so, remove from offline group and add to all groups they
|
||||
@ -409,8 +411,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
final Iterator rosterGroups = roster.getGroups();
|
||||
while (rosterGroups.hasNext()) {
|
||||
RosterGroup group = (RosterGroup)rosterGroups.next();
|
||||
ContactGroup contactGroup = new ContactGroup(group.getName());
|
||||
addContactGroup(contactGroup);
|
||||
ContactGroup contactGroup = addContactGroup(group.getName());
|
||||
|
||||
Iterator entries = group.getEntries();
|
||||
while (entries.hasNext()) {
|
||||
@ -423,7 +424,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
ContactItem contactItem = new ContactItem(name, entry.getUser());
|
||||
contactItem.setPresence(null);
|
||||
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.
|
||||
contactGroup.addContactItem(contactItem);
|
||||
contactGroup.setVisible(true);
|
||||
@ -438,7 +439,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
|
||||
// Add Unfiled Group
|
||||
addContactGroup(unfiledGroup);
|
||||
// addContactGroup(unfiledGroup);
|
||||
final Iterator unfiledEntries = roster.getUnfiledEntries();
|
||||
while (unfiledEntries.hasNext()) {
|
||||
RosterEntry entry = (RosterEntry)unfiledEntries.next();
|
||||
@ -498,8 +499,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
final RosterGroup group = (RosterGroup)groups.next();
|
||||
ContactGroup contactGroup = getContactGroup(group.getName());
|
||||
if (contactGroup == null) {
|
||||
contactGroup = new ContactGroup(group.getName());
|
||||
addContactGroup(contactGroup);
|
||||
contactGroup = addContactGroup(group.getName());
|
||||
}
|
||||
contactGroup.addContactItem(newContactItem);
|
||||
}
|
||||
@ -553,9 +553,8 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
// Handle if this is a new Entry in a new Group.
|
||||
if (getContactGroup(group.getName()) == null) {
|
||||
// Create group.
|
||||
ContactGroup contactGroup = new ContactGroup(group.getName());
|
||||
ContactGroup contactGroup = addContactGroup(group.getName());
|
||||
contactGroup.setVisible(false);
|
||||
addContactGroup(contactGroup);
|
||||
contactGroup = getContactGroup(group.getName());
|
||||
String name = rosterEntry.getName();
|
||||
if (name == null) {
|
||||
@ -635,7 +634,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
ContactItem offlineItem = offlineGroup.getContactItemByJID(jid);
|
||||
if (offlineItem != null) {
|
||||
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.
|
||||
offlineGroup.removeContactItem(offlineItem);
|
||||
unfiledGroup.addContactItem(offlineItem);
|
||||
@ -709,9 +708,34 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addContactGroup(ContactGroup group) {
|
||||
groupList.add(group);
|
||||
|
||||
private void addContactGroup(ContactGroup contactGroup) {
|
||||
String groupName = contactGroup.getGroupName();
|
||||
try {
|
||||
mainPanel.add(group, groupList.size() - 1);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("Unable to add Contact Group" + group.getGroupName());
|
||||
Log.error(e);
|
||||
}
|
||||
|
||||
group.addContactGroupListener(this);
|
||||
|
||||
|
||||
fireContactGroupAdded(group);
|
||||
|
||||
// Check state
|
||||
|
||||
String prop = props.getProperty(group.getGroupName());
|
||||
if (prop != null) {
|
||||
boolean isCollapsed = Boolean.valueOf(prop).booleanValue();
|
||||
group.setCollapsed(isCollapsed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ContactGroup addContactGroup(String groupName) {
|
||||
StringTokenizer tkn = new StringTokenizer(groupName, "::");
|
||||
|
||||
ContactGroup rootGroup = null;
|
||||
@ -731,16 +755,8 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
name = name.substring(0, name.length() - 2);
|
||||
}
|
||||
|
||||
ContactGroup newContactGroup = null;
|
||||
if (contactGroup == offlineGroup) {
|
||||
newContactGroup = offlineGroup;
|
||||
}
|
||||
else if (contactGroup == unfiledGroup) {
|
||||
newContactGroup = unfiledGroup;
|
||||
}
|
||||
else {
|
||||
newContactGroup = getContactGroup(name);
|
||||
}
|
||||
ContactGroup newContactGroup = getContactGroup(name);
|
||||
|
||||
|
||||
if (newContactGroup == null) {
|
||||
newContactGroup = new ContactGroup(group);
|
||||
@ -797,7 +813,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
|
||||
if (!groupAdded) {
|
||||
return;
|
||||
return getContactGroup(groupName);
|
||||
}
|
||||
|
||||
|
||||
@ -832,6 +848,8 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
Log.error(e);
|
||||
}
|
||||
|
||||
return getContactGroup(groupName);
|
||||
|
||||
}
|
||||
|
||||
private void removeContactGroup(ContactGroup contactGroup) {
|
||||
@ -1288,8 +1306,8 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
}
|
||||
pane.setText(buf.toString());
|
||||
MessageDialog.showComponent("Presence History", "History of user activity while online.",
|
||||
SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE), new JScrollPane(pane),
|
||||
getGUI(), 400, 400, false);
|
||||
SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE), new JScrollPane(pane),
|
||||
getGUI(), 400, 400, false);
|
||||
|
||||
}
|
||||
};
|
||||
@ -1575,7 +1593,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
// Add To Contacts Menu
|
||||
final JMenu contactsMenu = SparkManager.getMainWindow().getMenuByName("Contacts");
|
||||
JMenuItem addContactsMenu = new JMenuItem("", SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE));
|
||||
JMenuItem addContactsMenu = new JMenuItem("", SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16));
|
||||
ResourceUtils.resButton(addContactsMenu, "&Add Contact");
|
||||
ResourceUtils.resButton(addContactGroupMenu, "Add Contact &Group");
|
||||
|
||||
@ -1594,8 +1612,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
if (ModelUtil.hasLength(groupName)) {
|
||||
ContactGroup contactGroup = getContactGroup(groupName);
|
||||
if (contactGroup == null) {
|
||||
contactGroup = new ContactGroup(groupName);
|
||||
addContactGroup(contactGroup);
|
||||
contactGroup = addContactGroup(groupName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1925,7 +1942,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
|
||||
|
||||
public void connectionClosed() {
|
||||
// No reason to reconnect.
|
||||
// No reason to reconnect.
|
||||
}
|
||||
|
||||
private void reconnect(final String message, final boolean conflict) {
|
||||
|
||||
@ -31,6 +31,7 @@ import java.awt.Insets;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
/**
|
||||
* UI to display VCard Information in Wizards, Dialogs, Chat Rooms and any other container.
|
||||
@ -74,7 +75,7 @@ public class VCardPanel extends JPanel {
|
||||
icon = VCardManager.scale(icon);
|
||||
if (icon.getIconWidth() > 0) {
|
||||
avatarImage.setIcon(icon);
|
||||
avatarImage.setBorder(new PartialLineBorder(Color.LIGHT_GRAY, 1));
|
||||
avatarImage.setBorder(BorderFactory.createBevelBorder(0, Color.white, Color.lightGray));
|
||||
}
|
||||
setupUI(vcard);
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
import org.jivesoftware.smackx.packet.VCard;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.component.borders.PartialLineBorder;
|
||||
import org.jivesoftware.spark.ui.PresenceListener;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
import org.jivesoftware.spark.util.ModelUtil;
|
||||
@ -449,7 +448,7 @@ public class StatusBar extends JPanel {
|
||||
ImageIcon avatarIcon = new ImageIcon(avatarBytes);
|
||||
avatarIcon = VCardManager.scale(avatarIcon);
|
||||
imageLabel.setIcon(avatarIcon);
|
||||
imageLabel.setBorder(new PartialLineBorder(Color.LIGHT_GRAY, 1));
|
||||
imageLabel.setBorder(BorderFactory.createBevelBorder(0, Color.white, Color.lightGray));
|
||||
imageLabel.invalidate();
|
||||
imageLabel.validate();
|
||||
imageLabel.repaint();
|
||||
|
||||
@ -11,23 +11,11 @@
|
||||
package org.jivesoftware.sparkimpl.profile;
|
||||
|
||||
import org.jivesoftware.Spark;
|
||||
import org.jivesoftware.spark.component.borders.PartialLineBorder;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
import org.jivesoftware.spark.util.SwingWorker;
|
||||
import org.jivesoftware.spark.util.WindowsFileSystemView;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
@ -39,6 +27,18 @@ import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
public class AvatarPanel extends JPanel implements ActionListener {
|
||||
private JLabel avatar;
|
||||
private byte[] bytes;
|
||||
@ -73,7 +73,7 @@ public class AvatarPanel extends JPanel implements ActionListener {
|
||||
avatar.setText("No avatar was configured by the user.");
|
||||
|
||||
GraphicUtils.makeSameSize(new JComponent[]{browseButton, clearButton});
|
||||
avatar.setBorder(new PartialLineBorder(Color.lightGray, 1));
|
||||
avatar.setBorder(BorderFactory.createBevelBorder(0, Color.white, Color.lightGray));
|
||||
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@ -183,11 +183,11 @@ public class AvatarPanel extends JPanel implements ActionListener {
|
||||
String extension = getExtension(f);
|
||||
if (extension != null) {
|
||||
if (
|
||||
extension.equals(gif) ||
|
||||
extension.equals(jpeg) ||
|
||||
extension.equals(jpg) ||
|
||||
extension.equals(png)
|
||||
) {
|
||||
extension.equals(gif) ||
|
||||
extension.equals(jpeg) ||
|
||||
extension.equals(jpg) ||
|
||||
extension.equals(png)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
||||
@ -45,6 +45,7 @@ import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
@ -238,7 +239,7 @@ public class VCardManager {
|
||||
|
||||
avatarLabel = new JLabel();
|
||||
avatarLabel.setHorizontalAlignment(JButton.RIGHT);
|
||||
avatarLabel.setBorder(new PartialLineBorder(Color.gray, 1));
|
||||
avatarLabel.setBorder(BorderFactory.createBevelBorder(0, Color.white, Color.lightGray));
|
||||
|
||||
// Construct main panel w/ layout.
|
||||
final JPanel mainPanel = new JPanel();
|
||||
|
||||
Reference in New Issue
Block a user