/* This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *
* This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.rzo.yajsw.tray; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import org.rzo.yajsw.boot.WrapperLoader; import org.rzo.yajsw.config.YajswConfigurationImpl; import org.rzo.yajsw.os.OperatingSystem; import org.rzo.yajsw.os.Process; import org.rzo.yajsw.util.Utils; // TODO: Auto-generated Javadoc /** * A factory for creating WrapperTrayIcon objects. */ public class WrapperTrayIconFactory { /** * Creates a new WrapperTrayIcon object. * * @param name * the name * @param icon * the icon * * @return the wrapper tray icon */ public static WrapperTrayIcon createTrayIcon(String name, String icon, YajswConfigurationImpl config) { WrapperTrayIcon result = null; if (config == null) config = new YajswConfigurationImpl(); try { result = new WrapperTrayIconImpl(name, icon, config); } catch (Throwable ex) { System.out.println("java version does not support SystemTray: " + ex.getMessage()); ex.printStackTrace(); } if (result == null || !result.isInit()) result = new WrapperTrayIconDummy(); return result; } /** * Start tray icon process. * * @param config * the config * * @return the process */ public static Process startTrayIconProcess(YajswConfigurationImpl config, Logger logger) { if (config == null) return null; String wrapperConfFileName = config.getCachedPath(false); final Process osProcess = OperatingSystem.instance().processManagerInstance().createProcess(); try { List