[Ejtools-cvs] applications/management.browser/src/main/org/ejtools/management/browser AboutDialog.ja
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 08:40:53
|
Update of /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser In directory sc8-pr-cvs1:/tmp/cvs-serv21061/management.browser/src/main/org/ejtools/management/browser Modified Files: AboutDialog.java Browser.java Main.java Log Message: Add more javadocs. Adjust workspace persistence. Index: AboutDialog.java =================================================================== RCS file: /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/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:39:47 -0000 1.3 --- AboutDialog.java 13 Dec 2003 22:31:56 -0000 1.4 *************** *** 1,107 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.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 ! * @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.management.browser.Resources"); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() { } ! ! ! /** ! * 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,107 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.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 ! * @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.management.browser.Resources"); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() { } ! ! ! /** ! * 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/management.browser/src/main/org/ejtools/management/browser/Browser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Browser.java 27 Nov 2003 01:39:47 -0000 1.4 --- Browser.java 13 Dec 2003 22:31:56 -0000 1.5 *************** *** 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.management.browser.model.service.ConnectionMetaData; import org.ejtools.management.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; /** *************** *** 46,51 **** * * @author Laurent Etiemble - * @created 17 novembre 2003 * @version $Revision$ * @todo Javadoc to complete */ --- 48,53 ---- * * @author Laurent Etiemble * @version $Revision$ + * @created 17 novembre 2003 * @todo Javadoc to complete */ *************** *** 150,157 **** try { ! URL selectedURL = FileUtil.selectWorkspaceFile(resources.getString("file.dialog.title.load"), JFileChooser.OPEN_DIALOG); ! if (selectedURL != null) { ! loadResource(selectedURL, null); } } --- 152,159 ---- 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); } } --- 176,183 ---- 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(); } --- 202,209 ---- 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/management.browser/src/main/org/ejtools/management/browser/Main.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Main.java 27 Nov 2003 01:39:47 -0000 1.4 --- Main.java 13 Dec 2003 22:31:56 -0000 1.5 *************** *** 1,117 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.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 ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Main ! { ! /** Default logger */ ! 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 Management Browser JavaBean ! logger.debug("Launching EJTools Management Browser"); ! AccessController.doPrivileged( ! new PrivilegedExceptionAction() ! { ! public Object run() ! throws Exception ! { ! Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.management.browser.Browser" ! ); ! return null; ! } ! }); ! } ! } ! --- 1,117 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.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 ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class Main ! { ! /** Default logger */ ! 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 Management Browser JavaBean ! logger.debug("Launching EJTools Management Browser"); ! AccessController.doPrivileged( ! new PrivilegedExceptionAction() ! { ! public Object run() ! throws Exception ! { ! Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.management.browser.Browser" ! ); ! return null; ! } ! }); ! } ! } ! |