[Ejtools-cvs] applications/jmx.browser/src/main/org/ejtools/jmx/browser AboutDialog.java,1.3,1.4 Bro
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 08:38:22
|
Update of /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser In directory sc8-pr-cvs1:/tmp/cvs-serv11709/jmx.browser/src/main/org/ejtools/jmx/browser Modified Files: AboutDialog.java Browser.java Main.java Log Message: Add more javadocs. Adjust some things. Index: AboutDialog.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/AboutDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AboutDialog.java 27 Nov 2003 01:13:06 -0000 1.3 --- AboutDialog.java 13 Dec 2003 22:15:06 -0000 1.4 *************** *** 1,111 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Container; ! import java.awt.GridLayout; ! import java.util.ResourceBundle; ! ! import javax.swing.ImageIcon; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.SwingConstants; ! import javax.swing.UIManager; ! ! import org.ejtools.adwt.service.AboutService; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @created 2 novembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public final class AboutDialog implements AboutService ! { ! /** Description of the Field */ ! private JPanel panel = null; ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jmx.browser.Resources"); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() ! { ! super(); ! } ! ! ! /** ! * Gets the panel attribute of the AboutDialog object ! * ! * @return The panel value ! */ ! public Container getPanel() ! { ! if (this.panel == null) ! { ! this.createPanel(); ! } ! ! return this.panel; ! } ! ! ! /** ! * Description of the Method ! * ! * @return The title value ! */ ! public String getTitle() ! { ! return resources.getString("about.dialog.title"); ! } ! ! ! /** Creation of the panel to show */ ! protected void createPanel() ! { ! this.panel = new JPanel(new BorderLayout()); ! ! // North part of the panel ! this.panel.add("North", new JLabel(new ImageIcon(getClass().getResource("/images/logo.png")))); ! ! // Center part of the panel ! this.panel.add("Center", new JLabel(" ")); ! ! // South part of the panel ! JPanel info = new JPanel(new GridLayout(3, 1)); ! ! JLabel java = new JLabel( ! resources.getString("about.dialog.text.javaVersion") ! + " : " ! + System.getProperty("java.version"), SwingConstants.LEADING); ! java.setForeground(Color.black); ! info.add(java); ! ! JLabel vm = new JLabel( ! resources.getString("about.dialog.text.virtualMachine") ! + " : " ! + System.getProperty("java.vm.name") ! + ", " ! + System.getProperty("java.vm.version"), SwingConstants.LEADING); ! vm.setForeground(Color.black); ! info.add(vm); ! ! JLabel laf = new JLabel( ! resources.getString("about.dialog.text.lookAndFeel") ! + " : " ! + UIManager.getLookAndFeel().getName(), SwingConstants.LEADING); ! vm.setForeground(Color.black); ! info.add(laf); ! this.panel.add("South", info); ! } ! } --- 1,111 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Container; ! import java.awt.GridLayout; ! import java.util.ResourceBundle; ! ! import javax.swing.ImageIcon; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.SwingConstants; ! import javax.swing.UIManager; ! ! import org.ejtools.adwt.service.AboutService; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @created 2 novembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public final class AboutDialog implements AboutService ! { ! /** Description of the Field */ ! private JPanel panel = null; ! /** Description of the Field */ ! private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.jmx.browser.Resources"); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() ! { ! super(); ! } ! ! ! /** ! * Gets the panel attribute of the AboutDialog object ! * ! * @return The panel value ! */ ! public Container getPanel() ! { ! if (this.panel == null) ! { ! this.createPanel(); ! } ! ! return this.panel; ! } ! ! ! /** ! * Description of the Method ! * ! * @return The title value ! */ ! public String getTitle() ! { ! return resources.getString("about.dialog.title"); ! } ! ! ! /** Creation of the panel to show */ ! protected void createPanel() ! { ! this.panel = new JPanel(new BorderLayout()); ! ! // North part of the panel ! this.panel.add("North", new JLabel(new ImageIcon(getClass().getResource("/images/logo.png")))); ! ! // Center part of the panel ! this.panel.add("Center", new JLabel(" ")); ! ! // South part of the panel ! JPanel info = new JPanel(new GridLayout(3, 1)); ! ! JLabel java = new JLabel( ! resources.getString("about.dialog.text.javaVersion") ! + " : " ! + System.getProperty("java.version"), SwingConstants.LEADING); ! java.setForeground(Color.black); ! info.add(java); ! ! JLabel vm = new JLabel( ! resources.getString("about.dialog.text.virtualMachine") ! + " : " ! + System.getProperty("java.vm.name") ! + ", " ! + System.getProperty("java.vm.version"), SwingConstants.LEADING); ! vm.setForeground(Color.black); ! info.add(vm); ! ! JLabel laf = new JLabel( ! resources.getString("about.dialog.text.lookAndFeel") ! + " : " ! + UIManager.getLookAndFeel().getName(), SwingConstants.LEADING); ! vm.setForeground(Color.black); ! info.add(laf); ! this.panel.add("South", info); ! } ! } Index: Browser.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/Browser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Browser.java 27 Nov 2003 01:13:06 -0000 1.2 --- Browser.java 13 Dec 2003 22:15:07 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; + import java.io.File; import java.net.URL; import java.util.Arrays; *************** *** 18,22 **** import org.apache.log4j.Logger; - import org.ejtools.adwt.FileUtil; import org.ejtools.adwt.LookAndFeelUtil; import org.ejtools.adwt.action.Command; --- 19,22 ---- *************** *** 39,44 **** --- 39,46 ---- import org.ejtools.jmx.browser.model.service.ConnectionMetaData; import org.ejtools.jmx.browser.state.WorkbenchState; + import org.ejtools.util.FileTools; import org.ejtools.util.service.Profile; import org.ejtools.util.service.ProfileServiceProvider; + import org.ejtools.util.state.WorkspaceFileTools; /** *************** *** 52,65 **** public class Browser extends CustomBeanContextServicesSupport implements HistoryService.Holder { protected AboutServiceProvider aboutService; protected ConsoleServiceProvider consoleService; protected ProfileServiceProvider factoryProvider; protected MDIFrameServiceProvider frameService; protected GraphServiceProvider graphService; protected HistoryServiceProvider historyService; protected MenuBarServiceProvider menuBarService; protected WorkbenchState stateManager; protected ToolBarServiceProvider toolBarService; ! /** Default logger */ private static Logger logger = Logger.getLogger(Browser.class); /** Bundle for I18N */ --- 54,76 ---- public class Browser extends CustomBeanContextServicesSupport implements HistoryService.Holder { + /** Description of the Field */ protected AboutServiceProvider aboutService; + /** Description of the Field */ protected ConsoleServiceProvider consoleService; + /** Description of the Field */ protected ProfileServiceProvider factoryProvider; + /** Description of the Field */ protected MDIFrameServiceProvider frameService; + /** Description of the Field */ protected GraphServiceProvider graphService; + /** Description of the Field */ protected HistoryServiceProvider historyService; + /** Description of the Field */ protected MenuBarServiceProvider menuBarService; + /** Description of the Field */ protected WorkbenchState stateManager; + /** Description of the Field */ protected ToolBarServiceProvider toolBarService; ! /** Default logger */ private static Logger logger = Logger.getLogger(Browser.class); /** Bundle for I18N */ *************** *** 150,157 **** try { ! URL selectedURL = FileUtil.selectWorkspaceFile(resources.getString("file.dialog.title.load"), JFileChooser.OPEN_DIALOG); ! if (selectedURL != null) { ! loadResource(selectedURL, null); } } --- 161,168 ---- try { ! File selectedFile = FileTools.selectFile(resources.getString("file.dialog.title.load"), resources.getString("file.dialog.button.load"), JFileChooser.OPEN_DIALOG, WorkspaceFileTools.WORKSPACE_FILE_FILTER); ! if (selectedFile != null) { ! Browser.this.loadResource(selectedFile.toURL(), null); } } *************** *** 174,181 **** if (Browser.this.stateManager.getWorkbenchURL() == null) { ! URL selectedURL = FileUtil.selectWorkspaceFile(resources.getString("file.dialog.title.save"), JFileChooser.SAVE_DIALOG); ! if (selectedURL != null) { ! Browser.this.stateManager.setWorkbenchURL(selectedURL); } } --- 185,192 ---- if (Browser.this.stateManager.getWorkbenchURL() == null) { ! File selectedFile = FileTools.selectFile(resources.getString("file.dialog.title.save"), resources.getString("file.dialog.button.save"), JFileChooser.SAVE_DIALOG, WorkspaceFileTools.WORKSPACE_FILE_FILTER); ! if (selectedFile != null) { ! Browser.this.stateManager.setWorkbenchURL(selectedFile.toURL()); } } *************** *** 200,207 **** try { ! URL selectedURL = FileUtil.selectWorkspaceFile(resources.getString("file.dialog.title.save"), JFileChooser.SAVE_DIALOG); ! if (selectedURL != null) { ! Browser.this.stateManager.setWorkbenchURL(selectedURL); Browser.this.stateManager.store(); } --- 211,218 ---- try { ! File selectedFile = FileTools.selectFile(resources.getString("file.dialog.title.save"), resources.getString("file.dialog.button.save"), JFileChooser.SAVE_DIALOG, WorkspaceFileTools.WORKSPACE_FILE_FILTER); ! if (selectedFile != null) { ! Browser.this.stateManager.setWorkbenchURL(selectedFile.toURL()); Browser.this.stateManager.store(); } Index: Main.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/Main.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.java 27 Nov 2003 01:13:06 -0000 1.3 --- Main.java 13 Dec 2003 22:15:07 -0000 1.4 *************** *** 1,108 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms at http://opensource.org/licenses/lgpl-license.php ! */ ! package org.ejtools.jmx.browser; ! ! import java.beans.Beans; ! import java.io.File; ! import java.net.URL; ! import java.net.URLClassLoader; ! import java.security.AccessController; ! import java.security.Permission; ! import java.security.PrivilegedExceptionAction; ! import java.util.LinkedList; ! ! import org.apache.log4j.Logger; ! ! /** ! * Description of the Class ! * ! * @version $Revision$ ! * @author Laurent Etiemble ! * @created 21 mars 2002 ! */ ! public class Main { ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(Main.class); ! ! ! /** ! * The main program for the Main class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception { ! logger.debug("========================================"); ! logger.debug("JAVA_HOME : " + System.getProperty("java.home")); ! logger.debug("Vendor : " + System.getProperty("java.vendor")); ! logger.debug("Version : " + System.getProperty("java.version")); ! logger.debug("Operating Sys. : " + System.getProperty("os.name")); ! logger.debug("Architecture : " + System.getProperty("os.arch")); ! logger.debug("Version : " + System.getProperty("os.version")); ! logger.debug("========================================"); ! ! File pluginDir; ! File[] plugins; ! LinkedList list = new LinkedList(); ! ! logger.debug("Building classpath..."); ! ! // Store the files from lib directory ! logger.debug("Scanning lib directory..."); ! pluginDir = new File("../lib"); ! plugins = pluginDir.listFiles(); ! if (plugins != null) { ! for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); ! list.add(plugins[i].toURL()); ! } ! } ! ! // Store the files from lib/ext directory ! logger.debug("Scanning lib/ext directory..."); ! pluginDir = new File("../lib/ext"); ! plugins = pluginDir.listFiles(); ! if (plugins != null) { ! for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); ! list.add(plugins[i].toURL()); ! } ! } ! logger.debug("========================================"); ! ! // Create a custom classloader ! URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); ! Thread.currentThread().setContextClassLoader( ! new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader()) ! ); ! ! // Custom security manager ! System.setSecurityManager( ! new SecurityManager() { ! public void checkPermission(Permission p) { } ! ! ! public void checkPermission(Permission perm, Object context) { } ! }); ! ! // Create the JMX Browser JavaBean ! logger.debug("Launching EJTools JMX Browser"); ! AccessController.doPrivileged( ! new PrivilegedExceptionAction() { ! public Object run() ! throws Exception { ! Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.jmx.browser.Browser" ! ); ! return null; ! } ! }); ! } ! } ! --- 1,108 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms at http://opensource.org/licenses/lgpl-license.php ! */ ! package org.ejtools.jmx.browser; ! ! import java.beans.Beans; ! import java.io.File; ! import java.net.URL; ! import java.net.URLClassLoader; ! import java.security.AccessController; ! import java.security.Permission; ! import java.security.PrivilegedExceptionAction; ! import java.util.LinkedList; ! ! import org.apache.log4j.Logger; ! ! /** ! * Description of the Class ! * ! * @version $Revision$ ! * @author Laurent Etiemble ! * @created 21 mars 2002 ! */ ! public class Main { ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(Main.class); ! ! ! /** ! * The main program for the Main class ! * ! * @param args The command line arguments ! * @exception Exception Description of the Exception ! */ ! public static void main(String[] args) ! throws Exception { ! logger.debug("========================================"); ! logger.debug("JAVA_HOME : " + System.getProperty("java.home")); ! logger.debug("Vendor : " + System.getProperty("java.vendor")); ! logger.debug("Version : " + System.getProperty("java.version")); ! logger.debug("Operating Sys. : " + System.getProperty("os.name")); ! logger.debug("Architecture : " + System.getProperty("os.arch")); ! logger.debug("Version : " + System.getProperty("os.version")); ! logger.debug("========================================"); ! ! File pluginDir; ! File[] plugins; ! LinkedList list = new LinkedList(); ! ! logger.debug("Building classpath..."); ! ! // Store the files from lib directory ! logger.debug("Scanning lib directory..."); ! pluginDir = new File("../lib"); ! plugins = pluginDir.listFiles(); ! if (plugins != null) { ! for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); ! list.add(plugins[i].toURL()); ! } ! } ! ! // Store the files from lib/ext directory ! logger.debug("Scanning lib/ext directory..."); ! pluginDir = new File("../lib/ext"); ! plugins = pluginDir.listFiles(); ! if (plugins != null) { ! for (int i = 0; i < plugins.length; i++) { ! logger.debug("Found " + plugins[i].toURL()); ! list.add(plugins[i].toURL()); ! } ! } ! logger.debug("========================================"); ! ! // Create a custom classloader ! URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); ! Thread.currentThread().setContextClassLoader( ! new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader()) ! ); ! ! // Custom security manager ! System.setSecurityManager( ! new SecurityManager() { ! public void checkPermission(Permission p) { } ! ! ! public void checkPermission(Permission perm, Object context) { } ! }); ! ! // Create the JMX Browser JavaBean ! logger.debug("Launching EJTools JMX Browser"); ! AccessController.doPrivileged( ! new PrivilegedExceptionAction() { ! public Object run() ! throws Exception { ! Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.jmx.browser.Browser" ! ); ! return null; ! } ! }); ! } ! } ! |