Thread: [Ejtools-cvs] CVS: applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser AboutDialo
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-05-02 21:05:06
|
Update of /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser In directory usw-pr-cvs1:/tmp/cvs-serv29853/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser Modified Files: AboutDialog.java JNDIBrowser.java SelectFactoryAction.java SplashWindow.java Log Message: Add some JavaDocs Index: AboutDialog.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/AboutDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AboutDialog.java 30 Apr 2002 21:13:19 -0000 1.2 --- AboutDialog.java 2 May 2002 20:52:10 -0000 1.3 *************** *** 12,87 **** import java.awt.GridLayout; import java.util.ResourceBundle; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; - import net.sourceforge.ejtools.awt.action.Command; - import net.sourceforge.ejtools.awt.action.help.AboutAction; import net.sourceforge.ejtools.awt.services.AboutService; - import net.sourceforge.ejtools.awt.services.FrameService; /** ! * Description of the Class * ! * @author letiembl ! * @created 2 novembre 2001 ! * @todo Javadoc to complete ! * @todo I18N to complete */ public class AboutDialog implements AboutService { ! /** Description of the Field */ private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); - /** Description of the Field */ - private JPanel panel = null; ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() ! { ! } /** ! * Getter for the panel attribute * ! * @return The value */ public Container getPanel() { ! if (panel == null) { ! createPanel(); } ! return panel; } /** ! * Getter for the title attribute * ! * @return The value of title attribute */ public String getTitle() { ! return res.getString("title.about.dialog"); } ! /** Description of the Method */ ! private void createPanel() { ! panel = new JPanel(new BorderLayout()); String display = null; JLabel label = null; ! // North part ! panel.add("North", new JLabel(new ImageIcon(getClass().getResource("/images/logo.png")))); ! // Center part ! panel.add("Center", new JLabel(" ")); ! // South part JPanel info = new JPanel(new GridLayout(2, 1)); JLabel java = new JLabel(res.getString("text.about.javaVersion") + " : " + System.getProperty("java.version"), JLabel.CENTER); --- 12,84 ---- import java.awt.GridLayout; import java.util.ResourceBundle; + import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import net.sourceforge.ejtools.awt.services.AboutService; /** ! * Custom AboutService that shows the EJTools logo and some informations about ! * the virtual machine. * ! * @author letiemble ! * @created 2 novembre 2001 ! * @version $Revision$ */ public class AboutDialog implements AboutService { ! /** The main panel */ ! protected JPanel panel = null; ! /** Bundle for I18N */ private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); ! /** Constructor for the AboutServiceProvider object */ ! public AboutDialog() { } /** ! * Implementation of AboutService. Return the main panel to show. * ! * @return The main panel */ public Container getPanel() { ! // Lazy creation ! if (this.panel == null) { ! this.createPanel(); } ! return this.panel; } /** ! * Implementation of AboutService. Return the title of the About box. * ! * @return The String to display as title */ public String getTitle() { ! return this.res.getString("title.about.dialog"); } ! /** Creation of the panel to show */ ! protected void createPanel() { ! this.panel = new JPanel(new BorderLayout()); String display = null; JLabel label = null; ! // 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(2, 1)); JLabel java = new JLabel(res.getString("text.about.javaVersion") + " : " + System.getProperty("java.version"), JLabel.CENTER); *************** *** 91,97 **** vm.setForeground(Color.black); info.add(vm); ! panel.add("South", info); } } - --- 88,93 ---- vm.setForeground(Color.black); info.add(vm); ! this.panel.add("South", info); } } Index: JNDIBrowser.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/JNDIBrowser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JNDIBrowser.java 30 Apr 2002 21:13:19 -0000 1.3 --- JNDIBrowser.java 2 May 2002 20:52:10 -0000 1.4 *************** *** 12,16 **** import java.util.ResourceBundle; import java.util.Vector; - import javax.swing.ImageIcon; import net.sourceforge.ejtools.awt.BeanContextTreePanel; --- 12,15 ---- *************** *** 18,29 **** import net.sourceforge.ejtools.awt.action.CommandAction; import net.sourceforge.ejtools.awt.action.file.ExitAction; - import net.sourceforge.ejtools.awt.action.file.NewAction; - import net.sourceforge.ejtools.awt.action.file.OpenAction; - import net.sourceforge.ejtools.awt.action.file.SaveAction; - import net.sourceforge.ejtools.awt.action.file.SaveAsAction; import net.sourceforge.ejtools.awt.services.AboutServiceProvider; import net.sourceforge.ejtools.awt.services.FrameServiceProvider; import net.sourceforge.ejtools.awt.services.MenuBarServiceProvider; - import net.sourceforge.ejtools.awt.services.StatusBarService; import net.sourceforge.ejtools.awt.services.StatusBarServiceProvider; import net.sourceforge.ejtools.awt.services.ToolBarServiceProvider; --- 17,23 ---- *************** *** 31,126 **** import net.sourceforge.ejtools.jndibrowser.model.jms.ConnectionService; import net.sourceforge.ejtools.jndibrowser.model.jms.ConnectionServiceProvider; import org.apache.log4j.Category; /** ! * Description of the Class * ! * @author letiembl ! * @created 21 mars 2002 ! * @todo Javadoc to complete ! * @todo Add log4j logs ! * @todo I18N to complete ! * @todo Clean services used */ public class JNDIBrowser extends BeanContextServicesSupport { ! /** Description of the Field */ ! private static Category logger = Category.getInstance(JNDIBrowser.class); ! /** Description of the Field */ ! private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); ! /** Description of the Field */ ! private static Vector factories; ! /** Description of the Field */ ! CommandAction action = null; ! /** Description of the Field */ AboutServiceProvider aboutService; ! /** Description of the Field */ ConnectionServiceProvider connectionService; ! /** Description of the Field */ FrameServiceProvider frameService; ! /** Description of the Field */ MenuBarServiceProvider menuBarService; ! /** Description of the Field */ ! StatusBarServiceProvider statusBarService; ! /** Description of the Field */ ! ToolBarServiceProvider toolBarService; ! /** Constructor for the EJX object */ public JNDIBrowser() { ! SplashWindow splash = new SplashWindow("JNDIBrowser starting...", 14); splash.show(); logger.debug("JNDIBrowser starting..."); ! frameService = new FrameServiceProvider("SDI"); ! splash.progress("Creating Frame Service..."); ! aboutService = new AboutServiceProvider(new AboutDialog()); ! splash.progress("Creating About Service..."); ! menuBarService = new MenuBarServiceProvider(); ! splash.progress("Creating MenuBar Service..."); ! toolBarService = new ToolBarServiceProvider(); ! splash.progress("Creating ToolBar Service..."); ! statusBarService = new StatusBarServiceProvider(); ! splash.progress("Creating StatusBar Service..."); ! connectionService = new ConnectionServiceProvider(); ! splash.progress("Creating Connection Service..."); try { ! add(menuBarService); ! splash.progress("Adding MenuBar Service..."); ! add(toolBarService); ! // add(statusBarService); ! add(connectionService); ! splash.progress("Adding Connection Service..."); ! frameService.setTitle(res.getString("title.application")); final Server server = new Server(); ! add(server); frameService.setContent(new BeanContextTreePanel(server)); - splash.progress("Adding Server Entry Point..."); - - frameService.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent evt) { - quit(); - } - }); ! add(new ExitAction( new Command() { public void execute() { ! quit(); } } )); - splash.progress("Adding Exit Action..."); ! add(new SelectFactoryAction("action.options.selectQueueFactory", new Command() { --- 25,115 ---- import net.sourceforge.ejtools.jndibrowser.model.jms.ConnectionService; import net.sourceforge.ejtools.jndibrowser.model.jms.ConnectionServiceProvider; + import org.apache.log4j.Category; /** ! * Description of the Class * ! * @author letiembl ! * @created 21 mars 2002 ! * @version $Revision$ ! * @todo Javadoc to complete */ public class JNDIBrowser extends BeanContextServicesSupport { ! /** Service to display About box */ AboutServiceProvider aboutService; ! /** Service to connect the JNDI server */ ConnectionServiceProvider connectionService; ! /** Service to display a SDI Frame */ FrameServiceProvider frameService; ! /** Service to displau a menu bar */ MenuBarServiceProvider menuBarService; ! /** Log4j Logger */ ! private static Category logger = Category.getInstance(JNDIBrowser.class); ! /** Bundle for I18N */ ! private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); ! /** Constructor for the JNDIBrowser object */ public JNDIBrowser() { ! // Create a splash window ! SplashWindow splash = new SplashWindow(res.getString("text.progress.task.start"), 14); splash.show(); logger.debug("JNDIBrowser starting..."); ! splash.progress(res.getString("text.progress.task.create.menubar.service")); ! this.menuBarService = new MenuBarServiceProvider(); ! ! splash.progress(res.getString("text.progress.task.create.connection.service")); ! this.connectionService = new ConnectionServiceProvider(); ! ! splash.progress(res.getString("text.progress.task.create.frame.service")); ! this.frameService = new FrameServiceProvider("SDI"); ! ! splash.progress(res.getString("text.progress.task.create.about.service")); ! this.aboutService = new AboutServiceProvider(new AboutDialog()); try { ! splash.progress(res.getString("text.progress.task.add.menubar.service")); ! this.add(menuBarService); ! splash.progress(res.getString("text.progress.task.add.connection.service")); ! this.add(connectionService); ! // Create the main frame ! this.frameService.setTitle(res.getString("title.application")); ! // Has window hook ! this.frameService.addWindowListener( ! new WindowAdapter() ! { ! public void windowClosing(WindowEvent evt) ! { ! JNDIBrowser.this.quit(); ! } ! }); ! ! splash.progress(res.getString("text.progress.task.add.server")); final Server server = new Server(); ! this.add(server); frameService.setContent(new BeanContextTreePanel(server)); ! splash.progress(res.getString("text.progress.task.add.action.quit")); ! this.add(new ExitAction( new Command() { public void execute() { ! JNDIBrowser.this.quit(); } } )); ! splash.progress(res.getString("text.progress.task.add.action.queue")); ! this.add(new SelectFactoryAction("action.options.selectQueueFactory", new Command() { *************** *** 131,137 **** } )); - splash.progress("Adding Action..."); ! add(new SelectFactoryAction("action.options.selectTopicFactory", new Command() { --- 120,126 ---- } )); ! splash.progress(res.getString("text.progress.task.add.action.topic")); ! this.add(new SelectFactoryAction("action.options.selectTopicFactory", new Command() { *************** *** 142,152 **** } )); - splash.progress("Adding Action..."); ! add(frameService); ! splash.progress("Adding Frame Service..."); ! add(aboutService); ! splash.progress("Adding About Service..."); splash.dispose(); --- 131,140 ---- } )); ! splash.progress(res.getString("text.progress.task.add.frame.service")); ! this.add(frameService); ! splash.progress(res.getString("text.progress.task.add.about.service")); ! this.add(aboutService); splash.dispose(); *************** *** 154,165 **** catch (RuntimeException e) { ! logger.fatal("Error occured " + e.getMessage()); throw e; } } - public void quit() { - System.exit(0); - } - } --- 142,155 ---- catch (RuntimeException e) { ! logger.fatal("An error occured " + e.getMessage()); throw e; } } + /** Quit method */ + public void quit() + { + System.exit(0); + } + } Index: SelectFactoryAction.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/SelectFactoryAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectFactoryAction.java 30 Apr 2002 21:13:19 -0000 1.2 --- SelectFactoryAction.java 2 May 2002 20:52:10 -0000 1.3 *************** *** 13,33 **** /** ! * Description of the Class * ! * @author laurent ! * @created 29 décembre 2001 ! * @todo Javadoc to complete */ public class SelectFactoryAction extends CommandAction { ! /** Description of the Field */ private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); /** ! * Constructor for the NewAction object * ! * @param command Description of Parameter ! * @param key Description of Parameter */ public SelectFactoryAction(String key, Command command) --- 13,34 ---- /** ! * Custom CommandAction to allow the selection of the default ! * QueueConnectionFactory or the default TopicConnectionFactory. * ! * @author letiemble ! * @created 29 décembre 2001 ! * @version $Revision$ */ public class SelectFactoryAction extends CommandAction { ! /** Bundle for I18N */ private final static ResourceBundle res = ResourceBundle.getBundle("ApplicationResources"); /** ! * Build the SelectFactoryAction with the given key * ! * @param key The I18N key to use ! * @param command The Command associated with this Action */ public SelectFactoryAction(String key, Command command) Index: SplashWindow.java =================================================================== RCS file: /cvsroot/ejtools/applications/jndi.browser/src/main/net/sourceforge/ejtools/jndibrowser/SplashWindow.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SplashWindow.java 30 Apr 2002 21:13:19 -0000 1.2 --- SplashWindow.java 2 May 2002 20:52:10 -0000 1.3 *************** *** 10,13 **** --- 10,14 ---- import java.awt.Dimension; import java.awt.Toolkit; + import javax.swing.ImageIcon; import javax.swing.JLabel; *************** *** 18,47 **** /** ! * Description of the Class * ! * @author letiembl ! * @created 2 novembre 2001 ! * @todo Javadoc to complete */ public class SplashWindow extends JWindow { ! /** Description of the Field */ ! protected JPanel panel = null; ! /** Description of the Field */ protected JLabel message = null; ! /** Description of the Field */ protected JProgressBar progressBar = null; - /** Description of the Field */ - protected int length = 0; /** ! *Constructor for the SplashWindow object * ! * @param message Description of Parameter ! * @param length Description of Parameter */ public SplashWindow(String message, int length) { this.length = length; this.message = new JLabel(message); --- 19,50 ---- /** ! * A basic splash window that show a logo and some text. * ! * @author letiemble ! * @created 2 novembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete */ public class SplashWindow extends JWindow { ! /** Number of task */ ! protected int length = 0; ! /** The text to display */ protected JLabel message = null; ! /** The main panel */ ! protected JPanel panel = null; ! /** The progess bar */ protected JProgressBar progressBar = null; /** ! * Constructor for the SplashWindow object * ! * @param message The initial message to display ! * @param length The number of task */ public SplashWindow(String message, int length) { + // Init some variables this.length = length; this.message = new JLabel(message); *************** *** 50,53 **** --- 53,57 ---- this.pack(); + // Center on screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation(screen.width / 2 - this.getSize().width / 2, screen.height / 2 - this.getSize().height / 2); *************** *** 56,71 **** /** ! * Description of the Method * ! * @param message Description of Parameter */ public void progress(String message) { this.message.setText(message); int value = this.progressBar.getValue(); value++; this.progressBar.setValue(value); SwingUtilities.invokeLater( new Runnable() --- 60,78 ---- /** ! * Increment the counter of task and display a message * ! * @param message The message to display */ public void progress(String message) { + // Store the new message this.message.setText(message); + // Increment the counter int value = this.progressBar.getValue(); value++; this.progressBar.setValue(value); + // Delegate the paint SwingUtilities.invokeLater( new Runnable() *************** *** 73,77 **** public void run() { ! repaint(); } }); --- 80,84 ---- public void run() { ! SplashWindow.this.repaint(); } }); *************** *** 79,101 **** ! /** Description of the Method */ protected void createPanel() { ! panel = new JPanel(new BorderLayout()); ! // North part ! panel.add("North", new JLabel(new ImageIcon(getClass().getResource("/images/logo.png")))); ! // Center part ! panel.add("Center", message); ! // South part ! progressBar = new JProgressBar(0, this.length); ! progressBar.setValue(0); ! progressBar.setStringPainted(false); ! progressBar.setBorderPainted(false); ! panel.add("South", progressBar); } } - --- 86,107 ---- ! /** Create the main panel */ 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", message); ! // South part of the panel ! this.progressBar = new JProgressBar(0, this.length); ! this.progressBar.setValue(0); ! this.progressBar.setStringPainted(false); ! this.progressBar.setBorderPainted(false); ! this.panel.add("South", progressBar); } } |