mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
SPARK-791 added refresh button to user information to manually force a reload. spark checks for vcard changes on startup.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12346 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
holger.bergunde
parent
c94eb8b5c1
commit
c7b4f26d6d
@ -64,6 +64,7 @@ public class VCardEditor {
|
|||||||
private HomePanel homePanel;
|
private HomePanel homePanel;
|
||||||
private AvatarPanel avatarPanel;
|
private AvatarPanel avatarPanel;
|
||||||
private JLabel avatarLabel;
|
private JLabel avatarLabel;
|
||||||
|
private VCard _vcard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the VCard for an individual.
|
* Displays the VCard for an individual.
|
||||||
@ -184,6 +185,7 @@ public class VCardEditor {
|
|||||||
tabbedPane.addTab(Res.getString("tab.avatar"), avatarPanel);
|
tabbedPane.addTab(Res.getString("tab.avatar"), avatarPanel);
|
||||||
|
|
||||||
// Build the UI
|
// Build the UI
|
||||||
|
_vcard = vCard;
|
||||||
buildUI(vCard);
|
buildUI(vCard);
|
||||||
|
|
||||||
final JOptionPane pane;
|
final JOptionPane pane;
|
||||||
@ -206,7 +208,7 @@ public class VCardEditor {
|
|||||||
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
mainPanel.add(titlePanel, BorderLayout.NORTH);
|
||||||
|
|
||||||
// The user should only be able to close this dialog.
|
// The user should only be able to close this dialog.
|
||||||
Object[] options = { Res.getString("close") };
|
Object[] options = { Res.getString("close"), Res.getString("refresh") };
|
||||||
pane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
pane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
||||||
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
||||||
|
|
||||||
@ -221,7 +223,6 @@ public class VCardEditor {
|
|||||||
dlg.setResizable(true);
|
dlg.setResizable(true);
|
||||||
dlg.setContentPane(mainPanel);
|
dlg.setContentPane(mainPanel);
|
||||||
dlg.setLocationRelativeTo(parent);
|
dlg.setLocationRelativeTo(parent);
|
||||||
|
|
||||||
PropertyChangeListener changeListener = new PropertyChangeListener() {
|
PropertyChangeListener changeListener = new PropertyChangeListener() {
|
||||||
public void propertyChange(PropertyChangeEvent e) {
|
public void propertyChange(PropertyChangeEvent e) {
|
||||||
Object o = pane.getValue();
|
Object o = pane.getValue();
|
||||||
@ -236,6 +237,14 @@ public class VCardEditor {
|
|||||||
pane.removePropertyChangeListener(this);
|
pane.removePropertyChangeListener(this);
|
||||||
dlg.dispose();
|
dlg.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Res.getString("refresh").equals(value)) {
|
||||||
|
VCardManager manager = SparkManager.getVCardManager();
|
||||||
|
VCard card = manager.reloadVCard(vCard.getJabberId());
|
||||||
|
fillUI(card);
|
||||||
|
saveVCard();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -329,6 +338,24 @@ public class VCardEditor {
|
|||||||
* the vcard used to build the UI.
|
* the vcard used to build the UI.
|
||||||
*/
|
*/
|
||||||
private void buildUI(VCard vcard) {
|
private void buildUI(VCard vcard) {
|
||||||
|
|
||||||
|
fillUI(vcard);
|
||||||
|
|
||||||
|
// Set avatar
|
||||||
|
byte[] bytes = vcard.getAvatar();
|
||||||
|
if (bytes != null && bytes.length > 0) {
|
||||||
|
ImageIcon icon = new ImageIcon(bytes);
|
||||||
|
avatarPanel.setAvatar(icon);
|
||||||
|
avatarPanel.setAvatarBytes(bytes);
|
||||||
|
if (avatarLabel != null) {
|
||||||
|
icon = GraphicUtils.scaleImageIcon(icon, 48, 48);
|
||||||
|
|
||||||
|
avatarLabel.setIcon(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillUI(VCard vcard){
|
||||||
personalPanel.setFirstName(vcard.getFirstName());
|
personalPanel.setFirstName(vcard.getFirstName());
|
||||||
personalPanel.setMiddleName(vcard.getMiddleName());
|
personalPanel.setMiddleName(vcard.getMiddleName());
|
||||||
personalPanel.setLastName(vcard.getLastName());
|
personalPanel.setLastName(vcard.getLastName());
|
||||||
@ -360,20 +387,8 @@ public class VCardEditor {
|
|||||||
homePanel.setFax(vcard.getPhoneHome("FAX"));
|
homePanel.setFax(vcard.getPhoneHome("FAX"));
|
||||||
homePanel.setPager(vcard.getPhoneHome("PAGER"));
|
homePanel.setPager(vcard.getPhoneHome("PAGER"));
|
||||||
homePanel.setMobile(vcard.getPhoneHome("CELL"));
|
homePanel.setMobile(vcard.getPhoneHome("CELL"));
|
||||||
|
}
|
||||||
|
|
||||||
// Set avatar
|
|
||||||
byte[] bytes = vcard.getAvatar();
|
|
||||||
if (bytes != null && bytes.length > 0) {
|
|
||||||
ImageIcon icon = new ImageIcon(bytes);
|
|
||||||
avatarPanel.setAvatar(icon);
|
|
||||||
avatarPanel.setAvatarBytes(bytes);
|
|
||||||
if (avatarLabel != null) {
|
|
||||||
icon = GraphicUtils.scaleImageIcon(icon, 48, 48);
|
|
||||||
|
|
||||||
avatarLabel.setIcon(icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the VCard.
|
* Saves the VCard.
|
||||||
|
|||||||
@ -248,6 +248,7 @@ reject = Reject
|
|||||||
retry = Retry
|
retry = Retry
|
||||||
room.name = Room Name
|
room.name = Room Name
|
||||||
save = Save
|
save = Save
|
||||||
|
refresh = Refresh
|
||||||
subject = Subject
|
subject = Subject
|
||||||
unfiled = Unfiled
|
unfiled = Unfiled
|
||||||
use.default = Use Default
|
use.default = Use Default
|
||||||
|
|||||||
@ -148,6 +148,7 @@ retry = Wiederholen
|
|||||||
active = Aktiv
|
active = Aktiv
|
||||||
not.registered = Nicht registriert
|
not.registered = Nicht registriert
|
||||||
save = Speichern
|
save = Speichern
|
||||||
|
refresh = Aktualisieren
|
||||||
yes = Ja
|
yes = Ja
|
||||||
no = Nein
|
no = Nein
|
||||||
broadcast = Rundnachricht
|
broadcast = Rundnachricht
|
||||||
|
|||||||
Reference in New Issue
Block a user