[jetrix-cvs] SF.net SVN: jetrix: [711] jetrix/trunk
Brought to you by:
smanux
From: <Sm...@us...> - 2007-08-27 15:35:31
|
Revision: 711 http://jetrix.svn.sourceforge.net/jetrix/?rev=711&view=rev Author: Smanux Date: 2007-08-25 16:18:04 -0700 (Sat, 25 Aug 2007) Log Message: ----------- Moved to Java 6 Removed the dependency on JDIC Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/doc/changelog.txt jetrix/trunk/project.properties jetrix/trunk/project.xml jetrix/trunk/src/java/net/jetrix/SystrayManager.java jetrix/trunk/src/java/net/jetrix/services/VersionService.java Removed Paths: ------------- jetrix/trunk/lib/jdic-tray-0.9.jar jetrix/trunk/lib/jdic-tray-win-0.9.jar jetrix/trunk/lib/tray.dll Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/build.xml 2007-08-25 23:18:04 UTC (rev 711) @@ -155,8 +155,6 @@ <antcall target="pack.lib" inheritAll="true"><param name="library" value="servlet-light"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jasper-runtime"/></antcall> <antcall target="pack.lib" inheritAll="true"><param name="library" value="jcrontab-1.4.1-light"/></antcall> - <antcall target="pack.lib" inheritAll="true"><param name="library" value="jdic-tray-0.9"/></antcall> - <antcall target="pack.lib" inheritAll="true"><param name="library" value="jdic-tray-win-0.9"/></antcall> </target> <target name="pack.lib" description="Pack the library specified by the ${library} property"> @@ -207,8 +205,6 @@ <include name="servlet-light*.pack"/> <include name="jasper-runtime*.pack"/> <include name="jcrontab*.pack"/> - <include name="jdic*.pack" /> - <include name="tray.dll" /> </zipfileset> <zipfileset prefix="jetrix-${version}/lib/" dir="${dist}/webapp/"> <include name="*.war.pack" /> @@ -248,8 +244,6 @@ <include name="servlet-light*.pack"/> <include name="jasper-runtime*.pack"/> <include name="jcrontab*.pack"/> - <include name="jdic*.pack" /> - <exclude name="jdic-tray-win*.pack" /> </tarfileset> <tarfileset prefix="jetrix-${version}/lib/" dir="${dist}/webapp/"> <include name="*.war.pack" /> Modified: jetrix/trunk/doc/changelog.txt =================================================================== --- jetrix/trunk/doc/changelog.txt 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/doc/changelog.txt 2007-08-25 23:18:04 UTC (rev 711) @@ -12,6 +12,7 @@ - The number of players and spectators currently online is now displayed on logging in Admin visible changes +- Jetrix now requires Java 6 - Fixed a bug preventing the modification of the access level of a command when the "access-level" attribute was set on the <command> element - Added a visibility parameter on channels, it's now possible to have an invisible channel on the /list result - Channels can now be created from the administration console @@ -20,6 +21,7 @@ Developer visible changes - added a readLine(Reader) method in the Protocol interface - Renamed Client.receiveMessage() into Client.receive() +- removed the dependency on JDIC Changes in version 0.2.1 (2005-02-18) Deleted: jetrix/trunk/lib/jdic-tray-0.9.jar =================================================================== (Binary files differ) Deleted: jetrix/trunk/lib/jdic-tray-win-0.9.jar =================================================================== (Binary files differ) Deleted: jetrix/trunk/lib/tray.dll =================================================================== (Binary files differ) Modified: jetrix/trunk/project.properties =================================================================== --- jetrix/trunk/project.properties 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/project.properties 2007-08-25 23:18:04 UTC (rev 711) @@ -9,8 +9,6 @@ maven.jar.override=on maven.jar.jcrontab=lib/jcrontab-1.4.1-light.jar -maven.jar.jdic-tray=lib/jdic-tray-0.9.jar -maven.jar.jdic-tray-win=lib/jdic-tray-win-0.9.jar maven.javadoc.use=false maven.javadoc.links=http://java.sun.com/j2se/1.5/docs/api/, http://jetty.mortbay.org/javadoc/, http://jakarta.apache.org/commons/digester/apidocs/, http://jakarta.apache.org/commons/collections/apidocs/, http://jakarta.apache.org/commons/lang/apidocs/ Modified: jetrix/trunk/project.xml =================================================================== --- jetrix/trunk/project.xml 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/project.xml 2007-08-25 23:18:04 UTC (rev 711) @@ -160,16 +160,6 @@ <version>1.4.1</version> </dependency> - <dependency> - <id>jdic-tray</id> - <version>0.9</version> - </dependency> - - <dependency> - <id>jdic-tray-win</id> - <version>0.9</version> - </dependency> - <!-- Needed for testing --> <dependency> <id>junit</id> Modified: jetrix/trunk/src/java/net/jetrix/SystrayManager.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2007-08-25 23:18:04 UTC (rev 711) @@ -19,21 +19,23 @@ package net.jetrix; -import net.jetrix.config.ServerConfig; -import net.jetrix.listeners.HttpListener; -import org.jdesktop.jdic.tray.SystemTray; -import org.jdesktop.jdic.tray.TrayIcon; - -import javax.swing.*; -import javax.swing.event.PopupMenuListener; -import javax.swing.event.PopupMenuEvent; -import java.awt.*; +import java.awt.AWTException; +import java.awt.Font; +import java.awt.Image; +import java.awt.MenuItem; +import java.awt.PopupMenu; +import java.awt.SystemTray; +import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.ImageIcon; +import net.jetrix.config.ServerConfig; +import net.jetrix.listeners.HttpListener; + /** * Manages the system trayIcon (windows only). * @@ -54,11 +56,11 @@ { if (trayIcon == null) { - SystemTray tray = null; + SystemTray tray; try { - tray = SystemTray.getDefaultSystemTray(); + tray = SystemTray.getSystemTray(); } catch (Throwable t) { @@ -66,23 +68,12 @@ return; } - // adjust the look & feel - System.setProperty("javax.swing.adjustPopupLocationToFit", "false"); - try - { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } - catch (Exception e) - { - log.log(Level.WARNING, e.getMessage(), e); - } - // build the menu items - JMenuItem itemAdmin = new JMenuItem("Administration"); - Font font = itemAdmin.getFont(); - itemAdmin.setFont(new Font(font.getName(), Font.BOLD, font.getSize())); + Font font = new Font(Font.DIALOG, Font.PLAIN, 11); + MenuItem itemAdmin = new MenuItem("Administration"); + itemAdmin.setFont(font.deriveFont(Font.BOLD)); itemAdmin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -91,13 +82,13 @@ } }); - JMenuItem itemLink = new JMenuItem("Jetrix Website"); + MenuItem itemLink = new MenuItem("Jetrix Website"); itemLink.addActionListener(new OpenURLActionListener("http://jetrix.sourceforge.net")); - JMenuItem itemSupport = new JMenuItem("Technical Support"); + MenuItem itemSupport = new MenuItem("Technical Support"); itemSupport.addActionListener(new OpenURLActionListener("http://sourceforge.net/forum/forum.php?forum_id=172941")); - JMenuItem itemExit = new JMenuItem("Stop & Exit"); + MenuItem itemExit = new MenuItem("Stop & Exit"); itemExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -107,36 +98,20 @@ }); // build the menu - final JPopupMenu menu = new JPopupMenu(); + final PopupMenu menu = new PopupMenu(); menu.add(itemAdmin); menu.add(itemLink); menu.add(itemSupport); menu.addSeparator(); menu.add(itemExit); + + menu.setFont(font); - menu.addPopupMenuListener(new PopupMenuListener() - { - public void popupMenuWillBecomeVisible(PopupMenuEvent e) - { - // un arm the items - MenuElement[] elements = menu.getSubElements(); - for (MenuElement element : elements) - { - JMenuItem item = (JMenuItem) element; - item.setArmed(false); - } - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } - - public void popupMenuCanceled(PopupMenuEvent e) { } - }); - // build the trayIcon icon - ImageIcon icon = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("jetrix-16x16.png")); + Image icon = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource("jetrix-16x16.png")).getImage(); trayIcon = new TrayIcon(icon, TITLE, menu); - trayIcon.setIconAutoSize(true); + trayIcon.setImageAutoSize(true); trayIcon.addActionListener(new ActionListener() { private long timestamp; @@ -154,7 +129,11 @@ }); // display the trayIcon icon - tray.addTrayIcon(trayIcon); + try { + tray.add(trayIcon); + } catch (AWTException e) { + log.log(Level.WARNING, "Unable to display the tray", e); + } } } @@ -165,7 +144,7 @@ { if (trayIcon != null) { - SystemTray.getDefaultSystemTray().removeTrayIcon(trayIcon); + SystemTray.getSystemTray().remove(trayIcon); trayIcon = null; } } @@ -174,10 +153,10 @@ * Display a baloon message on the trayIcon icon. * * @param message the message to display - * @param type the type of the message (0: info, 1: error, 2: warning, 3: none) + * @param type the type of the message * @since 0.3 */ - public static void notify(String message, int type) + public static void notify(String message, TrayIcon.MessageType type) { if (trayIcon != null) { Modified: jetrix/trunk/src/java/net/jetrix/services/VersionService.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/services/VersionService.java 2006-11-03 21:38:39 UTC (rev 710) +++ jetrix/trunk/src/java/net/jetrix/services/VersionService.java 2007-08-25 23:18:04 UTC (rev 711) @@ -19,13 +19,17 @@ package net.jetrix.services; +import java.awt.TrayIcon; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.logging.Level; + +import net.jetrix.SystrayManager; import net.jetrix.config.ServerConfig; -import net.jetrix.SystrayManager; -import java.net.*; -import java.io.*; -import java.util.logging.*; - /** * Service checking the availability of a new release. * @@ -58,7 +62,7 @@ { String message = "A new version is available (" + VersionService.getLatestVersion() + "), download it on http://jetrix.sf.net now!"; log.warning(message); - SystrayManager.notify(message, 0); + SystrayManager.notify(message, TrayIcon.MessageType.INFO); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |