use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class CallManager method showOutgoingCall.
private void showOutgoingCall(final InterlocutorUI ic) {
final SparkToaster toasterManager = new SparkToaster();
toasters.put(ic, toasterManager);
final OutgoingCallUI incomingCall = new OutgoingCallUI(ic);
toasterManager.setToasterHeight(230);
toasterManager.setToasterWidth(300);
toasterManager.setDisplayTime(500000000);
toasterManager.setHidable(false);
toasterManager.showToaster(PhoneRes.getIString("phone.incomingcall"), incomingCall);
toasterManager.hideTitle();
incomingCall.getRejectButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeToaster(ic);
SoftPhoneManager.getInstance().getDefaultGuiManager().hangup(ic);
}
});
}
use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class ChatContainer method checkNotificationPreferences.
/**
* Handles Notification preferences for incoming messages and rooms.
*
* @param room the chat room.
*/
private void checkNotificationPreferences(final ChatRoom room, boolean customMsg, String customMsgText, String customMsgTitle) {
LocalPreferences pref = SettingsManager.getLocalPreferences();
if (pref.getWindowTakesFocus()) {
chatFrame.setState(Frame.NORMAL);
chatFrame.setVisible(true);
}
if (pref.getShowToasterPopup()) {
SparkToaster toaster = new SparkToaster();
toaster.setCustomAction(new AbstractAction() {
private static final long serialVersionUID = -2759404307378067515L;
public void actionPerformed(ActionEvent actionEvent) {
chatFrame.setState(Frame.NORMAL);
chatFrame.setVisible(true);
int tabLocation = indexOfComponent(room);
if (tabLocation != -1) {
setSelectedIndex(tabLocation);
}
}
});
toaster.setDisplayTime(5000);
toaster.setBorder(BorderFactory.createBevelBorder(0));
String nickname = room.getRoomTitle();
toaster.setToasterHeight(150);
toaster.setToasterWidth(200);
int size = room.getTranscripts().size();
if (customMsg) {
toaster.setTitle(customMsgTitle);
toaster.showToaster(room.getTabIcon(), customMsgText);
} else {
toaster.setTitle(nickname);
if (size > 0) {
Message message = room.getTranscripts().get(size - 1);
toaster.showToaster(room.getTabIcon(), message.getBody());
}
}
}
}
Aggregations