[Ejtools-cvs] applications/management.browser/src/main/org/ejtools/management/browser AboutDialog.ja
Brought to you by:
letiemble
From: <let...@us...> - 2003-11-27 01:39:51
|
Update of /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser In directory sc8-pr-cvs1:/tmp/cvs-serv18798/management.browser/src/main/org/ejtools/management/browser Modified Files: AboutDialog.java Browser.java Main.java Log Message: Address Todo #800902 Address Todo #755528 Index: AboutDialog.java =================================================================== RCS file: /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser/AboutDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AboutDialog.java 24 Feb 2003 22:35:20 -0000 1.2 --- AboutDialog.java 27 Nov 2003 01:39:47 -0000 1.3 *************** *** 16,19 **** --- 16,21 ---- import javax.swing.JLabel; import javax.swing.JPanel; + import javax.swing.SwingConstants; + import javax.swing.UIManager; import org.ejtools.adwt.service.AboutService; *************** *** 23,27 **** * * @author Laurent Etiemble - * @created 2 novembre 2001 * @version $Revision$ * @todo Javadoc to complete --- 25,28 ---- *************** *** 70,76 **** 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")))); --- 71,74 ---- *************** *** 80,98 **** // South part of the panel ! JPanel info = new JPanel(new GridLayout(2, 1)); JLabel java = new JLabel( ! resources.getString("about.dialog.text.javaVersion") ! + " : " ! + System.getProperty("java.version"), JLabel.CENTER); 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"), JLabel.CENTER); vm.setForeground(Color.black); info.add(vm); this.panel.add("South", info); } --- 78,105 ---- // 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Browser.java 24 Feb 2003 22:35:22 -0000 1.3 --- Browser.java 27 Nov 2003 01:39:47 -0000 1.4 *************** *** 9,24 **** --- 9,33 ---- import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; + import java.net.URL; import java.util.Arrays; import java.util.List; import java.util.ResourceBundle; + import javax.swing.JFileChooser; import javax.swing.JOptionPane; import org.apache.log4j.Logger; + import org.ejtools.adwt.FileUtil; + import org.ejtools.adwt.LookAndFeelUtil; import org.ejtools.adwt.action.Command; import org.ejtools.adwt.action.file.ExitAction; import org.ejtools.adwt.action.file.NewAction; + import org.ejtools.adwt.action.file.OpenWorkspaceAction; + import org.ejtools.adwt.action.file.SaveAsWorkspaceAction; + import org.ejtools.adwt.action.file.SaveWorkspaceAction; import org.ejtools.adwt.service.AboutServiceProvider; import org.ejtools.adwt.service.ConsoleServiceProvider; + import org.ejtools.adwt.service.HistoryService; + import org.ejtools.adwt.service.HistoryServiceProvider; import org.ejtools.adwt.service.MDIFrameServiceProvider; import org.ejtools.adwt.service.MenuBarServiceProvider; *************** *** 27,31 **** --- 36,42 ---- import org.ejtools.graph.service.GraphServiceProvider; import org.ejtools.management.browser.frame.ServerInternalFrame; + import org.ejtools.management.browser.model.Server; import org.ejtools.management.browser.model.service.ConnectionMetaData; + import org.ejtools.management.browser.state.WorkbenchState; import org.ejtools.util.service.Profile; import org.ejtools.util.service.ProfileServiceProvider; *************** *** 35,59 **** * * @author Laurent Etiemble ! * @created 21 mars 2002 * @version $Revision$ * @todo Javadoc to complete */ ! public class Browser extends CustomBeanContextServicesSupport { ! /** 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 MenuBarServiceProvider menuBarService; ! /** Description of the Field */ ! protected ToolBarServiceProvider toolBarService; ! /** Description of the Field */ private static Logger logger = Logger.getLogger(Browser.class); /** Bundle for I18N */ --- 46,66 ---- * * @author Laurent Etiemble ! * @created 17 novembre 2003 * @version $Revision$ * @todo Javadoc to complete */ ! public final class Browser extends CustomBeanContextServicesSupport implements HistoryService.Holder { ! private AboutServiceProvider aboutService; ! private ConsoleServiceProvider consoleService; ! private ProfileServiceProvider factoryProvider; ! private MDIFrameServiceProvider frameService; ! private GraphServiceProvider graphService; ! private HistoryServiceProvider historyService; ! private MenuBarServiceProvider menuBarService; ! private WorkbenchState stateManager; ! private ToolBarServiceProvider toolBarService; ! ! /** Default logger */ private static Logger logger = Logger.getLogger(Browser.class); /** Bundle for I18N */ *************** *** 61,69 **** ! /** Constructor for the EJX object */ public Browser() { logger.debug("Management Browser starting..."); this.frameService = new MDIFrameServiceProvider(); this.aboutService = new AboutServiceProvider(new AboutDialog()); --- 68,85 ---- ! /**Constructor for the Browser object */ public Browser() { logger.debug("Management Browser starting..."); + // Search for custom Look and Feel + LookAndFeelUtil.setLookAndFeel(); + + // Set the hyperlink navigation for ObjectName + if (System.getProperty("ejtools.objectname.hyperlink") == null) + { + System.setProperty("ejtools.objectname.hyperlink", "true"); + } + this.frameService = new MDIFrameServiceProvider(); this.aboutService = new AboutServiceProvider(new AboutDialog()); *************** *** 73,76 **** --- 89,94 ---- this.consoleService = new ConsoleServiceProvider(); this.graphService = new GraphServiceProvider(); + this.historyService = new HistoryServiceProvider(this, 4); + this.stateManager = new WorkbenchState(this); try *************** *** 90,101 **** { Object selectedValue = JOptionPane.showInputDialog( ! null, ! resources.getString("connection.dialog.text.description"), ! resources.getString("connection.dialog.title"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! factories.toArray(), ! factories.get(0) ! ); if (selectedValue == null) --- 108,119 ---- { Object selectedValue = JOptionPane.showInputDialog( ! null, ! resources.getString("connection.dialog.text.description"), ! resources.getString("connection.dialog.title"), ! JOptionPane.QUESTION_MESSAGE, ! null, ! factories.toArray(), ! factories.get(0) ! ); if (selectedValue == null) *************** *** 113,124 **** if (idx >= 0) { ! Browser.this.add( ! new ServerInternalFrame(Browser.this.factoryProvider.getProfile(idx)) ! ); } } } ! )); this.add(this.consoleService); --- 131,219 ---- if (idx >= 0) { ! Profile profile = Browser.this.factoryProvider.getProfile(idx); ! ServerInternalFrame frame = new ServerInternalFrame(); ! frame.setProfile(profile); ! frame.setServer(new Server()); ! Browser.this.add(frame); } } } ! )); ! ! this.add(this.stateManager); + this.add(new OpenWorkspaceAction( + new Command() + { + public void execute() + { + try + { + URL selectedURL = FileUtil.selectWorkspaceFile(resources.getString("file.dialog.title.load"), JFileChooser.OPEN_DIALOG); + if (selectedURL != null) + { + loadResource(selectedURL, null); + } + } + catch (Exception e) + { + // JOptionPane.showMessageDialog(null, "Could not load file:" + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + logger.error("Error while loading workspace", e); + } + } + } + )); + + this.add(new SaveWorkspaceAction( + new Command() + { + public void execute() + { + try + { + 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); + } + } + if (Browser.this.stateManager.getWorkbenchURL() != null) + { + Browser.this.stateManager.store(); + } + } + catch (Exception e) + { + logger.error("Error while saving workspace", e); + } + } + } + )); + + this.add(new SaveAsWorkspaceAction( + new Command() + { + public void execute() + { + 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(); + } + } + catch (Exception e) + { + logger.error("Error while saving workspace", e); + } + } + } + )); + + this.add(this.historyService); this.add(this.consoleService); *************** *** 131,135 **** } } ! )); this.add(this.frameService); --- 226,230 ---- } } ! )); this.add(this.frameService); *************** *** 155,158 **** --- 250,267 ---- throw e; } + } + + + /** + * Description of the Method + * + * @param url Description of the Parameter + * @param context Description of the Parameter + */ + public void loadResource(URL url, Object context) + { + this.stateManager.setWorkbenchURL(url); + this.stateManager.load(); + this.historyService.push(url, context); } Index: Main.java =================================================================== RCS file: /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser/Main.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.java 24 Feb 2003 22:35:21 -0000 1.3 --- Main.java 27 Nov 2003 01:39:47 -0000 1.4 *************** *** 22,26 **** * * @author Laurent Etiemble - * @created 21 mars 2002 * @version $Revision$ * @todo Javadoc to complete --- 22,25 ---- *************** *** 28,32 **** public class Main { ! /** Description of the Field */ private static Logger logger = Logger.getLogger(Main.class); --- 27,31 ---- public class Main { ! /** Default logger */ private static Logger logger = Logger.getLogger(Main.class); *************** *** 86,91 **** URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); Thread.currentThread().setContextClassLoader( ! new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader()) ! ); // Custom security manager --- 85,90 ---- URL[] pluginURLs = (URL[]) list.toArray(new URL[list.size()]); Thread.currentThread().setContextClassLoader( ! new URLClassLoader(pluginURLs, Thread.currentThread().getContextClassLoader()) ! ); // Custom security manager *************** *** 108,114 **** { Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.management.browser.Browser" ! ); return null; } --- 107,113 ---- { Beans.instantiate( ! Thread.currentThread().getContextClassLoader(), ! "org.ejtools.management.browser.Browser" ! ); return null; } |