Java 类java.awt.TrayIcon.MessageType 实例源码

项目:owa-notifier    文件:SystemDesktopProxy.java   
@Override
protected void processEvent(InboxChangeEvent event) throws IOException {
    // TODO Auto-generated method stub
    if (SystemTray.isSupported()) {
        if(event.getUnreadItemCount() > 0) {
            trayIcon.setImage(this.imageNewMail);
        } else {
            trayIcon.setImage(this.imageNoMail);
        }

        if(OwaNotifier.getInstance().getProps().getProperty("notification.type").contentEquals("system")) {
            trayIcon.displayMessage(event.getEventTitle(), event.getEventText(), MessageType.INFO);
        }
    } else {
        logger.error("System tray not supported!");
    }
    if(event.getUnreadItemCount() > 0) {
        this.setToolTip(event.getUnreadItemCount() + " message(s) non lu");
    } else {
        this.setToolTip("Pas de message non lu");
    }
}
项目:ILIASDownloader2    文件:MainController.java   
private void showError(final String description, final Throwable e) {

        if(trayIcon != null && iliasProperties.isShowNotifications()){
            trayIcon.displayMessage(APP_NAME, "Fehler: "+ description, MessageType.ERROR);
            trayIcon.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent ev) {
                    if(trayIcon != null){
                        trayIcon.removeActionListener(this);
                    }
                    showError(mainFrame, description, e);
                }
            });

        }else{
            showError(mainFrame, description, e);
        }
    }
项目:ILIASDownloader2    文件:MainController.java   
@Override
public void syncFinished() {
    mainFrame.getProgressBar().setVisible(false);
    mainFrame.getButtonSync().setText(MainFrame.SYNCHRONISIERE);

    if(iliasProperties.isShowNotifications() && trayIcon != null){
        int updatedFileCount = 0;
        int errorFileCount = 0;

        for(val f : fileObjectTableModel.getRowObjects()){
            switch(f.getSyncState()){
            case UPDATED: updatedFileCount++; break;
            case ERROR: errorFileCount++; break;
            case CORRUPT: errorFileCount++; break;
            default: break;
            }
        }

        if(updatedFileCount > 0 || errorFileCount > 0){
            trayIcon.displayMessage(APP_NAME, "Aktualisiert: " + updatedFileCount + (errorFileCount > 0 ? " Fehler: " + errorFileCount : ""), MessageType.INFO);
        }
    }
}
项目:AudioProcessingBox    文件:JSoundCapture.java   
/**
 * Creates the audio input stream.
 * 
 * @param file
 *            the file
 * @param updateComponents
 *            the update components
 */
public void createAudioInputStream(File file, boolean updateComponents) {
    if (file != null && file.isFile()) {
        try {
            this.file = file;
            errStr = null;
            audioInputStream = AudioSystem.getAudioInputStream(file);
            playB.setEnabled(true);
            // fileName = file.getName();
            long milliseconds = (long) ((audioInputStream.getFrameLength() * 1000) / audioInputStream.getFormat().getFrameRate());
            duration = milliseconds / 1000.0;

            saveB.setEnabled(true);
            if (updateComponents) {
                formatControls.setFormat(audioInputStream.getFormat());
                if (isDrawingRequired) samplingGraph.createWaveForm(null);
            }
        } catch (Exception ex) {
            reportStatus(ex.toString(), MessageType.ERROR);
        }
    }
    else {
        reportStatus("Audio file required.", MessageType.INFO);
    }
}
项目:dynjc    文件:EclipseCompiler.java   
private List<EclipseMessage> parseMessages(StringWriter errorOut) {
    List<EclipseMessage> messages = new LinkedList<EclipseMessage>();
    for (String item : errorOut.toString().split("----------")) {
        item = item.trim();
        if (item.isEmpty())
            continue;
        String[] parts = item.split(Strings.lineSeparator);
        if (parts.length < 4)
            continue;
        String place = parts[1].trim();
        String msg = parts[3].trim();
        String first = parts[0].trim();
        parts = first.split(" in ");
        String[] subParts = parts[0].split(". ");
        int id = Integer.parseInt(subParts[0]);
        MessageType mtype = MessageType.valueOf(subParts[1]);
        subParts = parts[1].split(" \\(at line ");
        if (subParts.length != 2)
            continue;
        File file = new File(subParts[0].trim());
        int line = Integer.parseInt(subParts[1].replace(')', ' ').trim());
        messages.add(new EclipseMessage(file, id, mtype, line, place, msg));
    }
    return messages;
}
项目:PanBox    文件:PanboxClient.java   
public PanboxShare reloadShare(PanboxShare share) {
    showTrayMessage(bundle.getString("client.warn"),
            MessageFormat.format(bundle.getString("client.shareReloadNotification"), share.getName()),
            MessageType.WARNING);
    try {
        PanboxShare nshare = shareManager.reloadShareMetadata(share);
        PanboxShare tmp;
        if ((tmp = checkShareIntegrity(share)) != null) {
            nshare = tmp;
        }

        int index = shareList.indexOf(share);
        if (index != -1) {
            shareList.setElementAt(nshare, index);
        } else {
            logger.error("Could not find share instance " + share + " in shareList");
        }
        getMainWindow().refreshShare();
        return nshare;
    } catch (ShareManagerException e) {
        JOptionPane.showMessageDialog(null, bundle.getString("client.error.shareReloadFailed"),
                bundle.getString("error"), JOptionPane.ERROR_MESSAGE);
    }
    return null;
}
项目:PanBox    文件:PanboxClientGUI.java   
public void addShare(PanboxShare newShare) {
    char[] password = null;
    try {
        password = PasswordEnterDialog.invoke(PermissionType.SHARE);

        client.showTrayMessage(bundle.getString("PleaseWait"),
                bundle.getString("tray.addShare.message"), MessageType.INFO);
        client.addShare(newShare, password);

        enableDisableAddDeviceContactForShare();

        // Also update share list for selected device
        if (device != null) {
            deviceShareList.setModel(client.getDeviceShares(device));
        }
    } finally {
        if (password != null) {
            Utils.eraseChars(password);
        }
    }
}
项目:taskerbox    文件:SocketTesterAction.java   
@Override
public void action(final SocketTesterVO entry) {
  log.debug("Action on SocketTesterAction: " + entry);

  StringBuffer sb = new StringBuffer();
  sb.append("Environment Problems");

  if (entry.getName() != null) {
    sb.append(" - ").append(entry.getName());
  }
  if (entry.getHost() != null) {
    sb.append(" - ").append(entry.getHost()).append(":").append(entry.getPort());
  }
  if (entry.getService() != null) {
    sb.append(" - Service: ").append(entry.getService());
  }

  TaskerboxTrayUtils.displayMessage("Taskerbox - Socket Tester", sb.toString(),
      MessageType.ERROR, this.actionListener);
}
项目:taskerbox    文件:TaskerboxTrayUtils.java   
/**
 * Displays a message at the system tray
 *
 * @param caption
 * @param text
 * @param messageType
 * @param listener
 */
public static void displayMessage(String caption, String text, MessageType messageType,
    ActionListener listener) {

  log.info(messageType + ": " + text);

  if (SystemTray.isSupported()) {

    removeAllListeners();
    if (listener != null) {
      getTrayIcon().addActionListener(listener);
    }

    getTrayIcon().displayMessage(caption, text, messageType);
  }
}
项目:ScreenSlice-Old    文件:pastebinUpload.java   
public pastebinUpload(String content) {
    this.content = content;
    try{
        if(!uploadTxt().contains("http://")) {
            JOptionPane.showMessageDialog(null,
                    "Error! use FTP server for text uploads",
                    "Error!", JOptionPane.ERROR_MESSAGE);
        } else {
            System.out.println(uploadTxt());
            String link = uploadTxt();
            String linkSplit[] = link.split("com/");
            String name = linkSplit[1];
            mainWindow.tray.displayMessage("Successfully uploaded!", "Image Uploaded, URL has been copied to clipboard.", MessageType.INFO);
            mainWindow.model.insertRow(0, new Object[] { name, "0" + "KB","<html><a href='" + link + "'>" + link + "</a></html>" });
            StringSelection stringSelection = new StringSelection(link);
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            clipboard.setContents(stringSelection, null);
        }
    }catch(Exception e){e.printStackTrace();}
}
项目:PeerWasp    文件:JSystemTray.java   
private void showMessage(String title, String message, MessageType type) {
    if (!appConfig.isTrayNotificationEnabled()) {
        return;
    }

    if (title == null) {
        title = "";
    }
    if (message == null) {
        message = "";
    }

    logger.info("{} Message: \n{}\n{}", type.toString(), title, message);
    if (trayIcon != null) {
        trayIcon.displayMessage(title, message, type);
    }

}
项目:LanTexter    文件:TrayView.java   
/**
 * @inheritDoc
 */
@Override
public void update(Observable arg0, Object arg1) {
    ModelNotification notificationType = (ModelNotification) arg1;
    switch(notificationType) {
        case LIST_OF_PARTICIPANTS_CHANGED: 

            break;
        case LANGUAGE_CHANGED:
            refreshLabels();
            break;
        case MESSAGE_RECEIVED: 
            if(chatGuiMinimizedToTray) {
                trayIcon.displayMessage(constsAndProps.getLanguage().getLabel("notification_newmessage"), chatHistory.getLatestMessage().toString(), MessageType.INFO);
            }
            break;                      
    }
}
项目:logback-tray    文件:SystemTrayAppender.java   
@Override
protected void append(ILoggingEvent eventObject) {
    final MessageType type;
    Level level = eventObject.getLevel();
    if (level.isGreaterOrEqual(Level.ERROR)) {
        type = MessageType.ERROR;
    } else if (level.isGreaterOrEqual(Level.WARN)) {
        type = MessageType.WARNING;
    } else {
        type = MessageType.INFO;
    }

    final String caption = level.toString();
    final String text = eventObject.getFormattedMessage();
    final TrayIcon i = icon;
    if (i != null) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                i.displayMessage(caption, text, type);
            }
        });
    }
}
项目:zayf    文件:Zayf.java   
private static void addIconActionListener(final MainWindow mainWindow, final ZayfTrayIcon icon)
{
   icon.addIconActionListener(new ActionListener()
   {

      @Override
      public void actionPerformed(ActionEvent e)
      {
         boolean show = !mainWindow.isVisible();
         if (!show)
         {
            icon.displayMessage("Zayf is minimized",
                                "Double-click to restore. Right-click and select 'exit' to close",
                                MessageType.INFO);
         }
         mainWindow.setVisible(show);
      }
   });
}
项目:TwitchBouyomi    文件:MyBot.java   
public void onMessage(String channel, String sender,
                     String login, String hostname, String message) {
String tmpMessage = message;
if(!isBlockedUser(sender)){
    tmpMessage = readEmote ? urlReplace(tmpMessage) : urlReplace(emoteReplace(tmpMessage));
    tmpMessage = readName ? tmpMessage+", "+sender : tmpMessage;
    if(useEnglish && isEnglish(message)) sapi.speakAsyMsg(wordReplaceEN(tmpMessage));
    else talker.talk(wordReplaceJP(tmpMessage));

    if(usePopup){
        icon.displayMessage(sender, message, MessageType.NONE);
    }
}
  }
项目:SER316-Dresden    文件:WindowsDesktopNotification.java   
public void displayTray(String title, String tooltip, String message) throws AWTException, java.net.MalformedURLException {
    SystemTray tray = SystemTray.getSystemTray();

    Image image = (Image)IconFontSwing.buildIcon(GoogleMaterialDesignIcons.DELETE, 24, ColorMap.ICON);

    TrayIcon trayIcon = new TrayIcon(image, title);
    trayIcon.setImageAutoSize(true);
    trayIcon.setToolTip(tooltip);
    tray.add(trayIcon);
    trayIcon.displayMessage(title, message, MessageType.INFO);
}
项目:CanReg5    文件:CanRegServerImpl.java   
/**
 * 
 * @param username
 * @throws java.rmi.RemoteException
 * @throws java.lang.SecurityException
 */
@Override
public void userLoggedIn(String username)
        throws RemoteException, SecurityException {
    userManager.userLoggedIn(username);
    displayTrayIconPopUpMessage("User logged in", "User " + username + " logged in.", MessageType.INFO);
}
项目:CanReg5    文件:CanRegServerImpl.java   
/**
 * 
 * @param username
 * @throws java.rmi.RemoteException
 * @throws java.lang.SecurityException
 */
@Override
public void userLoggedOut(String username)
        throws RemoteException, SecurityException {
    userManager.userLoggedOut(username);
    displayTrayIconPopUpMessage("User logged out", "User " + username + " logged out.", MessageType.INFO);
}
项目:Forum-Notifier    文件:NotificationUtils.java   
private static void sendWindowsNotification(Notification notification) {
    TrayIcon trayIcon = new TrayIcon(notification.getImage());
    trayIcon.setImageAutoSize(true);
    if (SystemTray.isSupported()) {
        if (!windowsTrayIconExists(trayIcon)) { // make sure we don't duplicate it / cause an error
            try {
                SystemTray.getSystemTray().add(trayIcon);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        trayIcon.displayMessage(String.valueOf(notification.getTitle()), String.valueOf(notification.getSubtitle()), MessageType.NONE);
    }
}
项目:AudioProcessingBox    文件:JSoundCapture.java   
/**
 * Report status.
 * 
 * @param msg
 *            the msg
 */
private void reportStatus(String msg, MessageType type) {
    if ((errStr = msg) != null) {
        System.out.println(errStr);
        if (isDrawingRequired) samplingGraph.repaint();
    }
}
项目:dynjc    文件:EclipseMessage.java   
public EclipseMessage(File source, int id, MessageType type, int line, String place, String message) {
    this.source = source;
    this.id = id;
    this.type = type;
    this.line = line;
    this.place = place;
    this.message = message;
}
项目:PanBox    文件:PanboxClient.java   
@Override
public void showTrayMessage(String title, String message, MessageType type) {
    if (!FALLBACK_TRAY_JAVA_OPTION) {
        try {
            PanboxTrayIcon.getInstance(FALLBACK_TRAY_GTK_OPTION)
                    .showNotification(message);
        } catch (TrayIconException e) {
            logger.error("Error sending notification via tray icon!", e);
        }
    } else if (fallbackTrayApp != null) {
        fallbackTrayApp.displayMessage(title, message, type);
    }
}
项目:PanBox    文件:PanboxClient.java   
@Override
public void informAddShare(PanboxShare share) throws Exception {
    if (trayApp != null) {
        MessageFormat formatter = new MessageFormat("", Settings
                .getInstance().getLocale());
        formatter.applyPattern(bundle.getString("tray.addedShareMessage"));
        trayApp.displayMessage(bundle.getString("tray.addedShare"),
                formatter.format(new Object[] { share.getName() }),
                MessageType.INFO);
    }
}
项目:PanBox    文件:PanboxClient.java   
@Override
public void informRemoveShare(PanboxShare share) throws Exception {
    if (trayApp != null) {
        MessageFormat formatter = new MessageFormat("", Settings
                .getInstance().getLocale());
        formatter
                .applyPattern(bundle.getString("tray.removedShareMessage"));
        trayApp.displayMessage(bundle.getString("tray.removedShare"),
                formatter.format(new Object[] { share.getName() }),
                MessageType.INFO);
    }
}
项目:taskerbox    文件:PlivoSMSAction.java   
@Override
public void action(Object text) {
  logInfo(log, "Sending SMS: " + text.toString());

  RestAPI restAPI = new RestAPI(this.authId, this.authToken, "v1");

  LinkedHashMap<String, String> params = new LinkedHashMap<>();
  params.put("src", this.from);
  params.put("dst", this.to);

  if (text instanceof ITaskerboxMessageable) {
    ITaskerboxMessageable messageble = (ITaskerboxMessageable) text;
    params.put(
        "text",
        messageble.getMessageTitle(getChannel()) + " - "
            + messageble.getMessageBody(getChannel()));
  } else if (text instanceof ITaskerboxEmailable) {
    ITaskerboxEmailable emailable = (ITaskerboxEmailable) text;
    params.put("text",
        emailable.getEmailTitle(getChannel()) + " - " + emailable.getEmailBody(getChannel()));
  } else {
    params.put("text", text.toString());
  }

  MessageResponse response;
  try {
    response = restAPI.sendMessage(params);
    logInfo(log, "Response: " + response.apiId);
  } catch (PlivoException e) {
    logError(log, "Error while sending SMS", e);
  }

  TaskerboxTrayUtils.displayMessage(TaskerboxConstants.TITLE, "Sending SMS " + text,
      MessageType.INFO, null);
}
项目:taskerbox    文件:CorreiosToasterAction.java   
@Override
public void action(final CorreiosTrackingWrapper entry) {
  log.debug("Action on CorreiosToasterAction: " + entry);
  TaskerboxTrayUtils.displayMessage(this.title, CorreiosChannel.formatTracking(entry.getValue(),
      getChannel().getProperty("tracking"), getChannel().getProperty("descricao")),
      MessageType.INFO, this.actionListener);
}
项目:send-notification    文件:SystemTrayNotifier.java   
private static MessageType toMessageType(Notification.Level level) {
    switch (level) {
        case INFO:
            return MessageType.INFO;
        case WARNING:
            return MessageType.WARNING;
        case ERROR:
            return MessageType.ERROR;
        default:
            return MessageType.NONE;
    }
}
项目:ScreenSlice-Old    文件:imgurUpload.java   
public imgurUpload(String randName) {
        try {
            String response = imageToString(mainWindow.checkOSName() + randName);
            //System.out.println(response);
            String fileSize[] = response.split("size\":");
            //System.out.println(fileSize[1]);
            String fileSize1[] = fileSize[1].split(",\"views");
            int imageSize = Integer.parseInt(fileSize1[0]);
            int imgSize = imageSize / 1024;
            String link = response.substring(
                    response.lastIndexOf("\"http") + 1,
                    response.lastIndexOf(".png"))
                    + ".png";
            newLink = link.replaceAll("\\\\", "");
            mainWindow.imgurLink = newLink;
            String[] parts = newLink.split("m/");
            String name = parts[1];
            mainWindow.tray.displayMessage("Successfully uploaded!", "Image Uploaded, URL has been copied to clipboard.", MessageType.INFO);
/*          JOptionPane.showMessageDialog(null,
                    "File uploaded! Address has been copied to clipboard.",
                    "Success!", JOptionPane.INFORMATION_MESSAGE);*/
            mainWindow.model.insertRow(0, new Object[] {
                    name,
                    imgSize + "KB",
                    "<html><a href='" + newLink + "'>" + newLink
                            + "</a></html>" });
            StringSelection stringSelection = new StringSelection(newLink);
            Clipboard clipboard = Toolkit.getDefaultToolkit()
                    .getSystemClipboard();
            clipboard.setContents(stringSelection, null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
项目:PeerWasp    文件:JSystemTray.java   
/**
 * NOTIFICATIONS - implementation of the ITrayNotifications interface
 */

@Override
@Handler
public void showInformation(InformationNotification in) {
    ActionListener listener = new ShowActivityActionListener();
    setNewMessageActionListener(listener);
    showMessage(in.getTitle(), in.getMessage(), MessageType.INFO);
}
项目:PeerWasp    文件:JSystemTray.java   
@Override
@Handler
public void showFileEvents(AggregatedFileEventStatus event) {
    String msg = generateAggregatedFileEventStatusMessage(event);
    ActionListener listener = new ShowSettingsActionListener();
    setNewMessageActionListener(listener);
    showMessage("File Synchronization", msg, MessageType.INFO);
}
项目:jSimpleMirror    文件:TrayManager.java   
/**
 * Shows a notification on system tray.
 * @param aCaption      {@link String} of caption / title of message.
 * @param aText         {@link String} of text message.
 * @param aMessageType  {@link MessageType} of notification.
 * @return              {@code true} if tray icon is available, {@code false} othwerise.
 */
public static boolean showNotification(String aCaption, String aText, MessageType aMessageType){
    if( mTrayIcon != null ){
        mTrayIcon.displayMessage(aCaption, aText, aMessageType);
        return true;
    }

    return false;
}
项目:spezi-gdx    文件:Message.java   
public Message(MessageType category, long id, long lastUpdate, M message,
        boolean read, boolean rewardCollected, long timestamp,
        Object[] values) {
    this.category = category;
    this.id = id;
    this.lastUpdate = lastUpdate;
    this.message = message;
    this.read = read;
    this.rewardCollected = rewardCollected;
    this.timestamp = timestamp;
    this.values = values;
}
项目:CanReg5    文件:CanRegServerImpl.java   
private void displayTrayIconPopUpMessage(String caption, String text, MessageType messageType) {
    if (trayIcon != null) {
        trayIcon.displayMessage(caption, text, messageType);
    }
}
项目:gscrot    文件:Utils.java   
public static void setColorInClipboard(Color color) {
    String s = color.getRed() + ", " + color.getGreen() + ", " + color.getBlue();
    ClipboardHelper.setString(s);

    TrayIconHelper.showMessage(s + " copied to clipboard", MessageType.INFO);
}
项目:gscrot    文件:TrayIconHelper.java   
public static void showMessage(String title, MessageType type) {
    if (icon != null) {
        icon.displayMessage("gscrot", title, type);
    }
}
项目:PanBox    文件:PanboxClient.java   
private void showTrayMessage(String string) {
    showTrayMessage("", string, MessageType.INFO);
}
项目:PanBox    文件:PanboxClient.java   
public void showTrayMessage(String title, String message, MessageType type) {
    trayApp.displayMessage(title, message, type);
}
项目:taskerbox    文件:StringToasterAction.java   
@Override
public void action(final String entry) {
  log.debug("Action on StringToasterAction: " + this.title + " / " + entry);
  TaskerboxTrayUtils.displayMessage(this.title, entry, MessageType.INFO, this.actionListener);
}
项目:taskerbox    文件:ToasterAction.java   
@Override
public void action(T object) {
  TaskerboxTrayUtils.displayMessage(TaskerboxConstants.TITLE, object.toString(),
      MessageType.INFO, null);
}