growl.java
来自「开源项目openfire的完整源程序」· Java 代码 · 共 466 行 · 第 1/2 页
JAVA
466 行
if (inSticky) { noteDict.setObjectForKey(new Integer(1), GROWL_NOTIFICATION_STICKY); } if (inExtraInfo != null) { noteDict.addEntriesFromDictionary(inExtraInfo); } theCenter.postNotification(GROWL_NOTIFICATION, (String)null, noteDict, true); } /** * Convenience method that defers to notifyGrowlOf(String inNotificationName, * NSData inIconData, String inTitle, String inDescription, * NSDictionary inExtraInfo, boolean inSticky) * This is primarily for compatibility with older code * * @param inNotificationName - The name of one of the notifications we told growl * about. * @param inIconData - The NSData for the icon for this notification, can be null * @param inTitle - The Title of our Notification as Growl will show it * @param inDescription - The Description of our Notification as Growl will * display it * @param inExtraInfo - Growl is flexible and allows Display Plugins to do as * they please with their own special keys and values, you * may use them here. These may be ignored by either the * user's preferences or the current Display Plugin. This * can be null. * * @throws Exception When a notification is not known * */ public void notifyGrowlOf(String inNotificationName, NSData inIconData, String inTitle, String inDescription, NSDictionary inExtraInfo) throws Exception { notifyGrowlOf(inNotificationName, inIconData, inTitle, inDescription, inExtraInfo, false); } /** * Convenienve method that defers to notifyGrowlOf(String inNotificationName, * NSData inIconData, String inTitle, String inDescription, * NSDictionary inExtraInfo) with null passed for icon and extraInfo arguments * * @param inNotificationName - The name of one of the notifications we told growl * about. * @param inTitle - The Title of our Notification as Growl will show it * @param inDescription - The Description of our Notification as Growl will * display it * * @throws Exception When a notification is not known */ public void notifyGrowlOf(String inNotificationName, String inTitle, String inDescription) throws Exception { notifyGrowlOf(inNotificationName, (NSData)null, inTitle, inDescription, (NSDictionary)null, false); } /** * Convenience method that defers to notifyGrowlOf(String inNotificationName, * NSData inIconData, String inTitle, String inDescription, * NSDictionary inExtraInfo, boolean inSticky) * with null passed for icon and extraInfo arguments * * @param inNotificationName - The name of one of the notifications we told growl * about. * @param inTitle - The Title of our Notification as Growl will show it * @param inDescription - The Description of our Notification as Growl will * display it * @param inSticky - Whether our notification should be sticky * * @throws Exception When a notification is not known * */ public void notifyGrowlOf(String inNotificationName, String inTitle, String inDescription, boolean inSticky) throws Exception { notifyGrowlOf(inNotificationName, (NSData)null, inTitle, inDescription, (NSDictionary)null, inSticky); } /** * Defers to notifyGrowlOf(String inNotificationName, NSData inIconData, * String inTitle, String inDescription, NSDictionary inExtraInfo) with null * passed for icon and extraInfo arguments * * @param inNotificationName - The name of one of the notifications we told growl * about. * @param inImage - The notification image. * @param inTitle - The Title of our Notification as Growl will show it * @param inDescription - The Description of our Notification as Growl will * display it * @param inExtraInfo - Look above for info * * @throws Exception When a notification is not known * */ public void notifyGrowlOf(String inNotificationName, NSImage inImage, String inTitle, String inDescription, NSDictionary inExtraInfo) throws Exception { notifyGrowlOf(inNotificationName, inImage.TIFFRepresentation(), inTitle, inDescription, inExtraInfo, false); } /** * Convenienve method that defers to notifyGrowlOf(String inNotificationName, * NSData inIconData, String inTitle, String inDescription, * NSDictionary inExtraInfo) with null passed for extraInfo * * @param inNotificationName - The name of one of the notifications we told growl * about. * @param inImagePath - Path to the image for this notification * @param inTitle - The Title of our Notification as Growl will show it * @param inDescription - The Description of our Notification as Growl will * display it * * @throws Exception When a notification is not known */ public void notifyGrowlOf(String inNotificationName, String inImagePath, String inTitle, String inDescription) throws Exception { notifyGrowlOf(inNotificationName, new NSImage(inImagePath, false).TIFFRepresentation(), inTitle, inDescription, (NSDictionary)null, false); } //************ Accessors **************// /** * Accessor for The currently set "Application" Name * * @return String - Application Name */ public String applicationName() { return appName; } /** * Accessor for the Array of allowed Notifications returned an NSArray * * @return the array of allowed notifications. */ public NSArray allowedNotifications() { return allNotes; } /** * Accessor for the Array of default Notifications returned as an NSArray * * @return the array of default notifications. */ public NSArray defaultNotifications() { return defNotes; } //************ Mutators **************// /** * Sets The name of the Application talking to growl * * @param inAppName - The Application Name */ public void setApplicationName(String inAppName) { appName = inAppName; } /** * Set the list of allowed Notifications * * @param inAllNotes - The array of allowed Notifications */ public void setAllowedNotifications(NSArray inAllNotes) { allNotes = inAllNotes; } /** * Set the list of allowed Notifications * * @param inAllNotes - The array of allowed Notifications * */ public void setAllowedNotifications(String[] inAllNotes) { allNotes = new NSArray(inAllNotes); } /** * Set the list of Default Notfiications * * @param inDefNotes - The default Notifications * * @throws Exception when an element of the array is not in the * allowedNotifications */ public void setDefaultNotifications(NSArray inDefNotes) throws Exception { int stop = inDefNotes.count(); int i = 0; for(i = 0; i < stop; i++) { if (!allNotes.containsObject(inDefNotes.objectAtIndex(i))) { throw new Exception("Array Element not in Allowed Notifications"); } } defNotes = inDefNotes; } /** * Set the list of Default Notfiications * * @param inDefNotes - The default Notifications * * @throws Exception when an element of the array is not in the * allowedNotifications * */ public void setDefaultNotifications(String [] inDefNotes) throws Exception { int stop = inDefNotes.length; int i = 0; for(i = 0; i < stop; i++) { if (! allNotes.containsObject(inDefNotes[i])) { throw new Exception("Array Element not in Allowed Notifications"); } } defNotes = new NSArray(inDefNotes); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?