mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Adding stale room icon support
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4899 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -245,7 +245,11 @@ public class SparkRes {
|
|||||||
public static final String MSN_TRANSPORT_INACTIVE_IMAGE = "MSN_TRANSPORT_INACTIVE_IMAGE";
|
public static final String MSN_TRANSPORT_INACTIVE_IMAGE = "MSN_TRANSPORT_INACTIVE_IMAGE";
|
||||||
public static final String YAHOO_TRANSPORT_ACTIVE_IMAGE = "YAHOO_TRANSPORT_ACTIVE_IMAGE";
|
public static final String YAHOO_TRANSPORT_ACTIVE_IMAGE = "YAHOO_TRANSPORT_ACTIVE_IMAGE";
|
||||||
public static final String YAHOO_TRANSPORT_INACTIVE_IMAGE = "YAHOO_TRANSPORT_INACTIVE_IMAGE";
|
public static final String YAHOO_TRANSPORT_INACTIVE_IMAGE = "YAHOO_TRANSPORT_INACTIVE_IMAGE";
|
||||||
|
public static final String IM_AVAILABLE_STALE_IMAGE = "IM_AVAILABLE_STALE_IMAGE";
|
||||||
|
public static final String IM_AWAY_STALE_IMAGE = "IM_AWAY_STALE_IMAGE";
|
||||||
|
public static final String IM_DND_STALE_IMAGE = "IM_AWAY_STALE_IMAGE";
|
||||||
|
public static final String IM_FREE_CHAT_STALE_IMAGE = "IM_FREE_CHAT_STALE_IMAGE";
|
||||||
|
public static final String IM_UNAVAILABLE_STALE_IMAGE = "IM_UNAVAILABLE_STALE_IMAGE";
|
||||||
|
|
||||||
static ClassLoader cl = SparkRes.class.getClassLoader();
|
static ClassLoader cl = SparkRes.class.getClassLoader();
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ MAIL_16x16 = images/mail_16x16.png
|
|||||||
MAIL_FORWARD_16x16 = images/mail_forward_16x16.png
|
MAIL_FORWARD_16x16 = images/mail_forward_16x16.png
|
||||||
MAIL_INTO_16x16 = images/mail_into_16x16.png
|
MAIL_INTO_16x16 = images/mail_into_16x16.png
|
||||||
RED_BALL = images/red-ball.png
|
RED_BALL = images/red-ball.png
|
||||||
GREEN_BALL = images/green-ball.png
|
GREEN_BALL = images/im_available.png
|
||||||
BLUE_BALL = images/blue-ball.png
|
BLUE_BALL = images/blue-ball.png
|
||||||
YELLOW_BALL = images/yellow-ball.png
|
YELLOW_BALL = images/yellow-ball.png
|
||||||
PAWN_GLASS_GREEN = images/pawn_glass_green.png
|
PAWN_GLASS_GREEN = images/pawn_glass_green.png
|
||||||
@ -180,7 +180,7 @@ SERVER_ICON = images/server.png
|
|||||||
BOOKMARK_ICON = images/bookmark.png
|
BOOKMARK_ICON = images/bookmark.png
|
||||||
ADD_BOOKMARK_ICON = images/bookmark_add.png
|
ADD_BOOKMARK_ICON = images/bookmark_add.png
|
||||||
DELETE_BOOKMARK_ICON = images/bookmark_delete.png
|
DELETE_BOOKMARK_ICON = images/bookmark_delete.png
|
||||||
CLEAR_BALL_ICON = images/bullet_ball_glass_clear.png
|
CLEAR_BALL_ICON = images/im_unavailable.png
|
||||||
CALL_ICON = images/call.png
|
CALL_ICON = images/call.png
|
||||||
PROFILE_ICON = images/profile.png
|
PROFILE_ICON = images/profile.png
|
||||||
SEND_FILE_ICON = images/document_into.png
|
SEND_FILE_ICON = images/document_into.png
|
||||||
@ -246,3 +246,10 @@ MSN_TRANSPORT_ACTIVE_IMAGE = images/msn.gif
|
|||||||
MSN_TRANSPORT_INACTIVE_IMAGE = images/msn-gray.gif
|
MSN_TRANSPORT_INACTIVE_IMAGE = images/msn-gray.gif
|
||||||
YAHOO_TRANSPORT_ACTIVE_IMAGE = images/yahoo.gif
|
YAHOO_TRANSPORT_ACTIVE_IMAGE = images/yahoo.gif
|
||||||
YAHOO_TRANSPORT_INACTIVE_IMAGE = images/yahoo-gray.gif
|
YAHOO_TRANSPORT_INACTIVE_IMAGE = images/yahoo-gray.gif
|
||||||
|
|
||||||
|
#Stale Images
|
||||||
|
IM_AVAILABLE_STALE_IMAGE = images/im_available_stale.png
|
||||||
|
IM_AWAY_STALE_IMAGE = images/im_away_stale.png
|
||||||
|
IM_DND_STALE_IMAGE = images/im_dnd_stale.png
|
||||||
|
IM_FREE_CHAT_STALE_IMAGE = images/im_free_chat_stale.png
|
||||||
|
IM_UNAVAILABLE_STALE_IMAGE = images/im_unavailable_stale.png
|
||||||
@ -34,20 +34,6 @@ import org.jivesoftware.spark.util.log.Log;
|
|||||||
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.JComponent;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.KeyStroke;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -69,6 +55,20 @@ import java.util.Map;
|
|||||||
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.JComponent;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.KeyStroke;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.event.ChangeEvent;
|
||||||
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all <code>ChatRoom</code> objects within Spark.
|
* Contains all <code>ChatRoom</code> objects within Spark.
|
||||||
*
|
*
|
||||||
@ -924,6 +924,11 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
|||||||
|
|
||||||
final JLabel titleLabel = tab.getTitleLabel();
|
final JLabel titleLabel = tab.getTitleLabel();
|
||||||
|
|
||||||
|
if(room instanceof ChatRoomImpl){
|
||||||
|
Icon icon = ((ChatRoomImpl)room).getTabIcon();
|
||||||
|
tab.setIcon(icon);
|
||||||
|
}
|
||||||
|
|
||||||
titleLabel.setForeground(Color.black);
|
titleLabel.setForeground(Color.black);
|
||||||
titleLabel.setFont(defaultFont);
|
titleLabel.setFont(defaultFont);
|
||||||
}
|
}
|
||||||
@ -997,7 +1002,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Start timer
|
// Start timer
|
||||||
checkRoomsForTimeout();
|
checkForStaleRooms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1147,7 +1152,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
|||||||
/**
|
/**
|
||||||
* Checks every room every 30 seconds to see if it's timed out.
|
* Checks every room every 30 seconds to see if it's timed out.
|
||||||
*/
|
*/
|
||||||
private void checkRoomsForTimeout() {
|
private void checkForStaleRooms() {
|
||||||
int delay = 1000; // delay for 1 minute
|
int delay = 1000; // delay for 1 minute
|
||||||
int period = 60000; // repeat every 30 seconds.
|
int period = 60000; // repeat every 30 seconds.
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
@ -1162,6 +1167,32 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
|||||||
final JLabel titleLabel = tab.getTitleLabel();
|
final JLabel titleLabel = tab.getTitleLabel();
|
||||||
titleLabel.setForeground(Color.gray);
|
titleLabel.setForeground(Color.gray);
|
||||||
titleLabel.setFont(tab.getDefaultFont());
|
titleLabel.setFont(tab.getDefaultFont());
|
||||||
|
|
||||||
|
String jid = ((ChatRoomImpl)chatRoom).getParticipantJID();
|
||||||
|
Presence presence = SparkManager.getConnection().getRoster().getPresence(jid);
|
||||||
|
|
||||||
|
if (presence == null || presence.getType() == Presence.Type.unavailable) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_UNAVAILABLE_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
else if (presence != null) {
|
||||||
|
Presence.Mode mode = presence.getMode();
|
||||||
|
if (mode == Presence.Mode.available) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AVAILABLE_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
else if (mode == Presence.Mode.away) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AWAY_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
else if (mode == Presence.Mode.chat) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_FREE_CHAT_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
else if (mode == Presence.Mode.dnd) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
else if (mode == Presence.Mode.xa) {
|
||||||
|
tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
titleLabel.validate();
|
titleLabel.validate();
|
||||||
titleLabel.repaint();
|
titleLabel.repaint();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user