use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class CallManager method showIncomingCall.
private void showIncomingCall(final InterlocutorUI ic) {
try {
EventQueue.invokeAndWait(new Runnable() {
public void run() {
final SparkToaster toasterManager = new SparkToaster();
toasters.put(ic, toasterManager);
final IncomingCallUI incomingCall = new IncomingCallUI(ic);
toasterManager.setToasterHeight(230);
toasterManager.setToasterWidth(300);
toasterManager.setDisplayTime(500000000);
toasterManager.showToaster(PhoneRes.getIString("phone.incomingcall"), incomingCall);
toasterManager.hideTitle();
toasterManager.setHidable(false);
incomingCall.getAcceptButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SparkManager.getMainWindow().toFront();
closeToaster(ic);
SoftPhoneManager.getInstance().getDefaultGuiManager().answer();
}
});
incomingCall.getRejectButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeToaster(ic);
SoftPhoneManager.getInstance().getDefaultGuiManager().hangup(ic);
}
});
}
});
} catch (Exception e) {
Log.error(e);
}
}
use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class CallManager method closeToaster.
private void closeToaster(InterlocutorUI ic) {
SparkToaster toaster = toasters.get(ic);
if (toaster != null) {
toaster.close();
toasters.remove(ic);
}
}
use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class ConferenceServices method showToaster.
private void showToaster(String message, String title, GroupChatRoom groupChatRoom) {
if (_localPreferences.getShowToasterPopup()) {
SparkToaster toaster = new SparkToaster();
toaster.setCustomAction(new AbstractAction() {
private static final long serialVersionUID = -4546475740161533555L;
@Override
public void actionPerformed(ActionEvent e) {
ChatFrame chatFrame = SparkManager.getChatManager().getChatContainer().getChatFrame();
chatFrame.setState(Frame.NORMAL);
chatFrame.setVisible(true);
}
});
toaster.setDisplayTime(5000);
toaster.setBorder(BorderFactory.createBevelBorder(0));
toaster.setToasterHeight(150);
toaster.setToasterWidth(200);
toaster.setTitle(title);
toaster.showToaster(groupChatRoom.getTabIcon(), message);
}
}
use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class PhonePlugin method displayRingUI.
private void displayRingUI(RingEvent event) {
IncomingCall incomingCall = new IncomingCall();
boolean idExists = false;
if (ModelUtil.hasLength(event.getCallerIDName())) {
incomingCall.setCallerName(event.getCallerIDName());
idExists = true;
}
if (ModelUtil.hasLength(event.getCallerID())) {
incomingCall.setCallerNumber(event.getCallerID());
idExists = true;
}
if (!idExists) {
incomingCall.setCallerName(Res.getString("message.no.caller.id"));
}
if (!SettingsManager.getLocalPreferences().getDisableAsteriskToasterPopup()) {
SparkToaster toasterManager = new SparkToaster();
toasterManager.setTitle("Incoming Phone Call");
toasterManager.setDisplayTime(15000);
toasterManager.showToaster(SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE));
toasterManager.setComponent(incomingCall);
}
}
use of org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster in project Spark by igniterealtime.
the class NotificationPlugin method notifyUserOnline.
/**
* Notify client that a user has come online.
*
* @param jid the jid of the user that has come online.
* @param presence Presence of the online user.
*/
private void notifyUserOnline(final String jid, final Presence presence) {
try {
EventQueue.invokeAndWait(() -> {
SparkToaster toaster = new SparkToaster();
toaster.setDisplayTime(preferences.getNotificationsDisplayTime());
toaster.setBorder(BorderFactory.createBevelBorder(0));
toaster.setCustomAction(new ChatAction(jid));
NotificationAlertUI alertUI = new NotificationAlertUI(jid, true, presence);
toaster.setToasterHeight((int) alertUI.getPreferredSize().getHeight() + 40);
int width = (int) alertUI.getPreferredSize().getWidth() + 40;
if (width < 300) {
width = 300;
}
toaster.setToasterWidth(width);
toaster.showToaster(alertUI.topLabel.getText(), alertUI);
toaster.setTitleAlert(new Font("Dialog", Font.BOLD, 13), presence);
});
} catch (Exception ex) {
Log.error(ex);
}
}
Aggregations