[Ejtools-cvs] libraries/adwt/src/main/org/ejtools/adwt/service AboutService.java,1.4,1.5 AboutServic
Brought to you by:
letiemble
Update of /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service In directory sc8-pr-cvs1:/tmp/cvs-serv19233/adwt/src/main/org/ejtools/adwt/service Modified Files: AboutService.java AboutServiceProvider.java BeanContextInternalFrame.java ConsoleService.java ConsoleServiceInternalFrame.java ConsoleServiceProvider.java FrameService.java FrameServiceProvider.java MDIFrameService.java MDIFrameServiceProvider.java MenuBarServiceProvider.java PreferencesService.java SDIFrameService.java SDIFrameServiceProvider.java StatusBarService.java StatusBarServiceProvider.java ToolBarService.java Log Message: Add more javadocs. Add package.html files. Index: AboutService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/AboutService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AboutService.java 15 Sep 2003 22:37:14 -0000 1.4 --- AboutService.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,34 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.Container; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface AboutService ! { ! /** ! * Description of the Method ! * ! * @return The value of panel attribute ! */ ! public Container getPanel(); ! ! ! /** ! * Getter for the title attribute ! * ! * @return The value of title attribute ! */ ! public String getTitle(); ! } --- 1,34 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.Container; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface AboutService ! { ! /** ! * Description of the Method ! * ! * @return The value of panel attribute ! */ ! public Container getPanel(); ! ! ! /** ! * Getter for the title attribute ! * ! * @return The value of title attribute ! */ ! public String getTitle(); ! } Index: AboutServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/AboutServiceProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AboutServiceProvider.java 15 Sep 2003 22:37:14 -0000 1.4 --- AboutServiceProvider.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,208 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Container; ! import java.awt.GridLayout; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JOptionPane; ! import javax.swing.JPanel; ! import javax.swing.SwingConstants; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.help.AboutAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo I18N to complete ! */ ! public class AboutServiceProvider extends CustomBeanContextServiceProvider implements AboutService ! { ! /** Description of the Field */ ! protected JPanel panel = null; ! /** Description of the Field */ ! protected AboutService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(AboutServiceProvider.class); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Constructor for the AboutServiceProvider object ! * ! * @param service Description of Parameter ! */ ! public AboutServiceProvider(AboutService service) ! { ! this.service = service; ! } ! ! ! /** ! * Gets the currentServiceSelectors attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of Parameter ! * @param serviceClass Description of Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) ! { ! return (new Vector().iterator()); ! } ! ! ! /** ! * Gets the panel attribute of the AboutServiceProvider object ! * ! * @return The panel value ! */ ! public Container getPanel() ! { ! if (this.panel == null) ! { ! this.createPanel(); ! } ! return this.panel; ! } ! ! ! /** ! * Gets the service attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param serviceClass Description of Parameter ! * @param serviceSelector Description of Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Getter for the title attribute ! * ! * @return The value of title attribute ! * @todo I18N ! */ ! public String getTitle() ! { ! return "About Service"; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param service Description of Parameter ! */ ! public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @todo I18N ! */ ! protected void createPanel() ! { ! this.panel = new JPanel(new BorderLayout()); ! ! // North part ! this.panel.add("North", new JLabel("Insert your logo here")); ! ! // Center part ! this.panel.add("Center", new JLabel("This is the default AboutService")); ! ! // South part ! JPanel info = new JPanel(new GridLayout(2, 1)); ! JLabel java = new JLabel("Java version:" + System.getProperty("java.version"), SwingConstants.CENTER); ! java.setForeground(Color.black); ! info.add(java); ! JLabel vm = new JLabel("VM:" + System.getProperty("java.vm.name") + ", " + System.getProperty("java.vm.version"), SwingConstants.CENTER); ! vm.setForeground(Color.black); ! info.add(vm); ! this.panel.add("South", info); ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{AboutService.class}; ! } ! ! ! /** */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! ! // Add the About button ! this.add(new AboutAction( ! new Command() ! { ! public void execute() ! { ! AboutServiceProvider.this.show(); ! } ! } ! )); ! ! logger.debug("AboutService added"); ! } ! ! ! /** Description of the Method */ ! protected void show() ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (context.hasService(FrameService.class)) ! { ! logger.debug("Using service FrameService..."); ! try ! { ! FrameService fservice = (FrameService) context.getService(this, this, FrameService.class, this, this); ! JFrame frame = (JFrame) fservice.getContainer(); ! // I18N Todo ! JOptionPane.showMessageDialog(frame, service.getPanel(), service.getTitle(), JOptionPane.PLAIN_MESSAGE); ! context.releaseService(this, this, FrameService.class); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation ofgetBeanContext() service FrameService (" + e.getMessage() + ")"); ! } ! } ! } ! } ! --- 1,208 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Container; ! import java.awt.GridLayout; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JOptionPane; ! import javax.swing.JPanel; ! import javax.swing.SwingConstants; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.help.AboutAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo I18N to complete ! */ ! public class AboutServiceProvider extends CustomBeanContextServiceProvider implements AboutService ! { ! /** Description of the Field */ ! protected JPanel panel = null; ! /** Description of the Field */ ! protected AboutService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(AboutServiceProvider.class); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public AboutServiceProvider() ! { ! this.service = this; ! } ! ! ! /** ! * Constructor for the AboutServiceProvider object ! * ! * @param service Description of Parameter ! */ ! public AboutServiceProvider(AboutService service) ! { ! this.service = service; ! } ! ! ! /** ! * Gets the currentServiceSelectors attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of Parameter ! * @param serviceClass Description of Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) ! { ! return (new Vector().iterator()); ! } ! ! ! /** ! * Gets the panel attribute of the AboutServiceProvider object ! * ! * @return The panel value ! */ ! public Container getPanel() ! { ! if (this.panel == null) ! { ! this.createPanel(); ! } ! return this.panel; ! } ! ! ! /** ! * Gets the service attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param serviceClass Description of Parameter ! * @param serviceSelector Description of Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Getter for the title attribute ! * ! * @return The value of title attribute ! * @todo I18N ! */ ! public String getTitle() ! { ! return "About Service"; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of Parameter ! * @param requestor Description of Parameter ! * @param service Description of Parameter ! */ ! public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } ! ! ! /** ! * Description of the Method ! * ! * @todo I18N ! */ ! protected void createPanel() ! { ! this.panel = new JPanel(new BorderLayout()); ! ! // North part ! this.panel.add("North", new JLabel("Insert your logo here")); ! ! // Center part ! this.panel.add("Center", new JLabel("This is the default AboutService")); ! ! // South part ! JPanel info = new JPanel(new GridLayout(2, 1)); ! JLabel java = new JLabel("Java version:" + System.getProperty("java.version"), SwingConstants.CENTER); ! java.setForeground(Color.black); ! info.add(java); ! JLabel vm = new JLabel("VM:" + System.getProperty("java.vm.name") + ", " + System.getProperty("java.vm.version"), SwingConstants.CENTER); ! vm.setForeground(Color.black); ! info.add(vm); ! this.panel.add("South", info); ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{AboutService.class}; ! } ! ! ! /** */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! ! // Add the About button ! this.add(new AboutAction( ! new Command() ! { ! public void execute() ! { ! AboutServiceProvider.this.show(); ! } ! } ! )); ! ! logger.debug("AboutService added"); ! } ! ! ! /** Description of the Method */ ! protected void show() ! { ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (context.hasService(FrameService.class)) ! { ! logger.debug("Using service FrameService..."); ! try ! { ! FrameService fservice = (FrameService) context.getService(this, this, FrameService.class, this, this); ! JFrame frame = (JFrame) fservice.getContainer(); ! // I18N Todo ! JOptionPane.showMessageDialog(frame, service.getPanel(), service.getTitle(), JOptionPane.PLAIN_MESSAGE); ! context.releaseService(this, this, FrameService.class); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation ofgetBeanContext() service FrameService (" + e.getMessage() + ")"); ! } ! } ! } ! } ! Index: BeanContextInternalFrame.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/BeanContextInternalFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BeanContextInternalFrame.java 15 Sep 2003 22:37:14 -0000 1.5 --- BeanContextInternalFrame.java 13 Dec 2003 21:29:35 -0000 1.6 *************** *** 1,271 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.Component; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextServices; ! ! import javax.swing.Action; ! import javax.swing.JInternalFrame; ! import javax.swing.event.InternalFrameEvent; ! import javax.swing.event.InternalFrameListener; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.CommandAction; ! import org.ejtools.adwt.action.window.InternalFrameAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BeanContextInternalFrame extends CustomBeanContextServicesSupport implements InternalFrameListener ! { ! /** Description of the Field */ ! protected CommandAction action; ! /** Description of the Field */ ! protected JInternalFrame frame; ! /** Description of the Field */ ! protected MDIFrameService service; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(BeanContextInternalFrame.class); ! ! ! /** Constructor for the BeanContextInternalFrame object */ ! public BeanContextInternalFrame() ! { ! super(); ! ! this.frame = new JInternalFrame("", true, true, true, true); ! this.frame.addInternalFrameListener(this); ! ! this.action = new InternalFrameAction( ! new Command() ! { ! public void execute() ! { ! BeanContextInternalFrame.this.activate(); ! } ! }); ! } ! ! ! /** Description of the Method */ ! public void activate() ! { ! try ! { ! if (this.service != null) ! { ! this.service.activate(this); ! } ! if (this.action != null) ! { ! this.action.getMenuItem().setSelected(true); ! } ! } ! catch (Exception e) ! { ! // Do nothing ! } ! } ! ! ! /** Description of the Method */ ! public void close() ! { ! this.frame.doDefaultCloseAction(); ! } ! ! ! /** ! * Gets the action attribute of the BeanContextInternalFrame object ! * ! * @return The action value ! */ ! public CommandAction getAction() ! { ! return this.action; ! } ! ! ! /** ! * Gets the component attribute of the BeanContextInternalFrame object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! return this.frame; ! } ! ! ! /** ! * Gets the title attribute of the BeanContextInternalFrame object ! * ! * @return The title value ! */ ! public String getTitle() ! { ! return this.frame.getTitle(); ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameActivated(InternalFrameEvent event) ! { ! this.activate(); ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameClosed(InternalFrameEvent event) ! { ! BeanContext context = this.getBeanContext(); ! if (context != null) ! { ! context.remove(this); ! } ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameClosing(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameDeactivated(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameDeiconified(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameIconified(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameOpened(InternalFrameEvent event) { } ! ! ! /** ! * Sets the title attribute of the BeanContextInternalFrame object ! * ! * @param title The new title value ! */ ! public void setTitle(String title) ! { ! this.frame.setTitle(title); ! this.action.putValue(Action.NAME, title); ! } ! ! ! /** Description of the Method */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! ! logger.debug("In initializeBeanContextResources"); ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! this.useServices(context); ! ! if (this.service != null) ! { ! this.service.register(this); ! } ! ! context.add(action); ! ! this.activate(); ! } ! ! ! /** Description of the Method */ ! protected void releaseBeanContextResources() ! { ! logger.debug("In releaseBeanContextResources"); ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (this.service != null) ! { ! this.service.unregister(this); ! } ! ! context.remove(action); ! this.releaseServices(context); ! ! super.releaseBeanContextResources(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! protected void releaseServices(BeanContextServices context) ! { ! if (context.hasService(MDIFrameService.class)) ! { ! logger.debug("Using service MDIFrameService..."); ! try ! { ! context.releaseService(this, this, MDIFrameService.class); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); ! e.printStackTrace(); ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! protected void useServices(BeanContextServices context) ! { ! if (context.hasService(MDIFrameService.class)) ! { ! logger.debug("Using service MDIFrameService..."); ! try ! { ! this.service = (MDIFrameService) context.getService(this, this, MDIFrameService.class, this.frame, this); ! logger.debug("Service MDIFrameService registered"); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); ! e.printStackTrace(); ! } ! } ! } ! ! } --- 1,271 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.Component; ! import java.beans.beancontext.BeanContext; ! import java.beans.beancontext.BeanContextServices; ! ! import javax.swing.Action; ! import javax.swing.JInternalFrame; ! import javax.swing.event.InternalFrameEvent; ! import javax.swing.event.InternalFrameListener; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.CommandAction; ! import org.ejtools.adwt.action.window.InternalFrameAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class BeanContextInternalFrame extends CustomBeanContextServicesSupport implements InternalFrameListener ! { ! /** Description of the Field */ ! protected CommandAction action; ! /** Description of the Field */ ! protected JInternalFrame frame; ! /** Description of the Field */ ! protected MDIFrameService service; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(BeanContextInternalFrame.class); ! ! ! /** Constructor for the BeanContextInternalFrame object */ ! public BeanContextInternalFrame() ! { ! super(); ! ! this.frame = new JInternalFrame("", true, true, true, true); ! this.frame.addInternalFrameListener(this); ! ! this.action = new InternalFrameAction( ! new Command() ! { ! public void execute() ! { ! BeanContextInternalFrame.this.activate(); ! } ! }); ! } ! ! ! /** Description of the Method */ ! public void activate() ! { ! try ! { ! if (this.service != null) ! { ! this.service.activate(this); ! } ! if (this.action != null) ! { ! this.action.getMenuItem().setSelected(true); ! } ! } ! catch (Exception e) ! { ! // Do nothing ! } ! } ! ! ! /** Description of the Method */ ! public void close() ! { ! this.frame.doDefaultCloseAction(); ! } ! ! ! /** ! * Gets the action attribute of the BeanContextInternalFrame object ! * ! * @return The action value ! */ ! public CommandAction getAction() ! { ! return this.action; ! } ! ! ! /** ! * Gets the component attribute of the BeanContextInternalFrame object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! return this.frame; ! } ! ! ! /** ! * Gets the title attribute of the BeanContextInternalFrame object ! * ! * @return The title value ! */ ! public String getTitle() ! { ! return this.frame.getTitle(); ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameActivated(InternalFrameEvent event) ! { ! this.activate(); ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameClosed(InternalFrameEvent event) ! { ! BeanContext context = this.getBeanContext(); ! if (context != null) ! { ! context.remove(this); ! } ! } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameClosing(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameDeactivated(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameDeiconified(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameIconified(InternalFrameEvent event) { } ! ! ! /** ! * @param event Description of the Parameter ! */ ! public void internalFrameOpened(InternalFrameEvent event) { } ! ! ! /** ! * Sets the title attribute of the BeanContextInternalFrame object ! * ! * @param title The new title value ! */ ! public void setTitle(String title) ! { ! this.frame.setTitle(title); ! this.action.putValue(Action.NAME, title); ! } ! ! ! /** Description of the Method */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! ! logger.debug("In initializeBeanContextResources"); ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! this.useServices(context); ! ! if (this.service != null) ! { ! this.service.register(this); ! } ! ! context.add(action); ! ! this.activate(); ! } ! ! ! /** Description of the Method */ ! protected void releaseBeanContextResources() ! { ! logger.debug("In releaseBeanContextResources"); ! BeanContextServices context = (BeanContextServices) getBeanContext(); ! ! if (this.service != null) ! { ! this.service.unregister(this); ! } ! ! context.remove(action); ! this.releaseServices(context); ! ! super.releaseBeanContextResources(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! protected void releaseServices(BeanContextServices context) ! { ! if (context.hasService(MDIFrameService.class)) ! { ! logger.debug("Using service MDIFrameService..."); ! try ! { ! context.releaseService(this, this, MDIFrameService.class); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); ! e.printStackTrace(); ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! protected void useServices(BeanContextServices context) ! { ! if (context.hasService(MDIFrameService.class)) ! { ! logger.debug("Using service MDIFrameService..."); ! try ! { ! this.service = (MDIFrameService) context.getService(this, this, MDIFrameService.class, this.frame, this); ! logger.debug("Service MDIFrameService registered"); ! } ! catch (Exception e) ! { ! logger.error("Error during utilisation of service MDIFrameService (" + e.getMessage() + ")"); ! e.printStackTrace(); ! } ! } ! } ! ! } Index: ConsoleService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/ConsoleService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConsoleService.java 15 Sep 2003 22:37:14 -0000 1.4 --- ConsoleService.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,42 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface ConsoleService ! { ! /** ! * Description of the Method ! * ! * @param message Description of the Parameter ! */ ! public void append(String message); ! ! ! /** Description of the Method */ ! public void delete(); ! ! ! /** Description of the Method */ ! public void copy(); ! ! ! /** Description of the Method */ ! public void cut(); ! ! ! /** Description of the Method */ ! public void show(); ! ! ! /** Description of the Method */ ! public void hide(); ! } --- 1,42 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface ConsoleService ! { ! /** ! * Description of the Method ! * ! * @param message Description of the Parameter ! */ ! public void append(String message); ! ! ! /** Description of the Method */ ! public void delete(); ! ! ! /** Description of the Method */ ! public void copy(); ! ! ! /** Description of the Method */ ! public void cut(); ! ! ! /** Description of the Method */ ! public void show(); ! ! ! /** Description of the Method */ ! public void hide(); ! } Index: ConsoleServiceInternalFrame.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/ConsoleServiceInternalFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConsoleServiceInternalFrame.java 15 Sep 2003 22:37:14 -0000 1.5 --- ConsoleServiceInternalFrame.java 13 Dec 2003 21:29:35 -0000 1.6 *************** *** 1,146 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.beans.beancontext.BeanContext; ! import java.util.ResourceBundle; ! ! import javax.swing.JMenuBar; ! import javax.swing.JScrollPane; ! import javax.swing.JTextArea; ! ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.edit.CopyAction; ! import org.ejtools.adwt.action.edit.CutAction; ! import org.ejtools.adwt.action.edit.DeleteAction; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class ConsoleServiceInternalFrame extends BeanContextInternalFrame implements ConsoleService ! { ! /** Description of the Field */ ! protected BeanContext context = null; ! /** Description of the Field */ ! protected MenuBarServiceProvider menubarProvider; ! /** Description of the Field */ ! protected JTextArea textarea = null; ! /** Description of the Field */ ! protected ToolBarServiceProvider toolbarProvider; ! /** Description of the Field */ ! private final static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.adwt.service.ConsoleService"); ! ! ! /** ! * Constructor for ConsoleServiceInternalFrame. ! * ! * @param context Description of the Parameter ! */ ! public ConsoleServiceInternalFrame(BeanContext context) ! { ! super(); ! this.context = context; ! this.textarea = new JTextArea(); ! ! this.menubarProvider = new MenuBarServiceProvider(); ! this.toolbarProvider = new ToolBarServiceProvider(); ! ! this.add(this.toolbarProvider); ! this.add(this.menubarProvider); ! ! this.add(new CutAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.cut(); ! } ! })); ! ! this.add(new CopyAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.copy(); ! } ! })); ! ! this.add(new DeleteAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.delete(); ! } ! })); ! ! this.frame.setJMenuBar((JMenuBar) this.menubarProvider.getContainer()); ! this.frame.getContentPane().add(BorderLayout.NORTH, this.toolbarProvider.getContainer()); ! this.frame.getContentPane().add(BorderLayout.CENTER, new JScrollPane(this.textarea)); ! ! this.setTitle(resources.getString("frame.title")); ! } ! ! ! /** ! * @param message Description of the Parameter ! */ ! public void append(String message) ! { ! this.textarea.append(message); ! this.textarea.append("\n"); ! this.show(); ! } ! ! ! /** */ ! public void copy() ! { ! this.textarea.copy(); ! } ! ! ! /** */ ! public void cut() ! { ! this.textarea.cut(); ! } ! ! ! /** */ ! public void delete() ! { ! this.textarea.setText(""); ! } ! ! ! /** */ ! public void hide() ! { ! if (this.context.contains(this)) ! { ! this.close(); ! } ! } ! ! ! /** */ ! public void show() ! { ! if (!this.context.contains(this)) ! { ! this.context.add(this); ! } ! this.activate(); ! } ! } --- 1,146 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.beans.beancontext.BeanContext; ! import java.util.ResourceBundle; ! ! import javax.swing.JMenuBar; ! import javax.swing.JScrollPane; ! import javax.swing.JTextArea; ! ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.edit.CopyAction; ! import org.ejtools.adwt.action.edit.CutAction; ! import org.ejtools.adwt.action.edit.DeleteAction; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class ConsoleServiceInternalFrame extends BeanContextInternalFrame implements ConsoleService ! { ! /** Description of the Field */ ! protected BeanContext context = null; ! /** Description of the Field */ ! protected MenuBarServiceProvider menubarProvider; ! /** Description of the Field */ ! protected JTextArea textarea = null; ! /** Description of the Field */ ! protected ToolBarServiceProvider toolbarProvider; ! /** Description of the Field */ ! private final static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.adwt.service.ConsoleService"); ! ! ! /** ! * Constructor for ConsoleServiceInternalFrame. ! * ! * @param context Description of the Parameter ! */ ! public ConsoleServiceInternalFrame(BeanContext context) ! { ! super(); ! this.context = context; ! this.textarea = new JTextArea(); ! ! this.menubarProvider = new MenuBarServiceProvider(); ! this.toolbarProvider = new ToolBarServiceProvider(); ! ! this.add(this.toolbarProvider); ! this.add(this.menubarProvider); ! ! this.add(new CutAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.cut(); ! } ! })); ! ! this.add(new CopyAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.copy(); ! } ! })); ! ! this.add(new DeleteAction( ! new Command() ! { ! /** */ ! public void execute() ! { ! ConsoleServiceInternalFrame.this.delete(); ! } ! })); ! ! this.frame.setJMenuBar((JMenuBar) this.menubarProvider.getContainer()); ! this.frame.getContentPane().add(BorderLayout.NORTH, this.toolbarProvider.getContainer()); ! this.frame.getContentPane().add(BorderLayout.CENTER, new JScrollPane(this.textarea)); ! ! this.setTitle(resources.getString("frame.title")); ! } ! ! ! /** ! * @param message Description of the Parameter ! */ ! public void append(String message) ! { ! this.textarea.append(message); ! this.textarea.append("\n"); ! this.show(); ! } ! ! ! /** */ ! public void copy() ! { ! this.textarea.copy(); ! } ! ! ! /** */ ! public void cut() ! { ! this.textarea.cut(); ! } ! ! ! /** */ ! public void delete() ! { ! this.textarea.setText(""); ! } ! ! ! /** */ ! public void hide() ! { ! if (this.context.contains(this)) ! { ! this.close(); ! } ! } ! ! ! /** */ ! public void show() ! { ! if (!this.context.contains(this)) ! { ! this.context.add(this); ! } ! this.activate(); ! } ! } Index: ConsoleServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/ConsoleServiceProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConsoleServiceProvider.java 15 Sep 2003 22:37:14 -0000 1.4 --- ConsoleServiceProvider.java 13 Dec 2003 21:29:35 -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.adwt.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.view.ShowConsoleAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo I18N to complete ! */ ! public class ConsoleServiceProvider extends CustomBeanContextServiceProvider ! { ! /** Description of the Field */ ! protected ConsoleService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(ConsoleServiceProvider.class); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public ConsoleServiceProvider() ! { ! super(); ! } ! ! ! /** ! * Gets the currentServiceSelectors attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) ! { ! return (new Vector().iterator()); ! } ! ! ! /** ! * Gets the service attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Returns the service. ! * ! * @return ConsoleService ! */ ! public ConsoleService getService() ! { ! return service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{ConsoleService.class}; ! } ! ! ! /** */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! this.service = new ConsoleServiceInternalFrame(this.getBeanContext()); ! ! this.add(new ShowConsoleAction( ! new Command() ! { ! public void execute() ! { ! ConsoleServiceProvider.this.service.show(); ! } ! } ! )); ! ! logger.debug("Console Service installed"); ! } ! } --- 1,117 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.view.ShowConsoleAction; ! import org.ejtools.beans.beancontext.CustomBeanContextServiceProvider; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! * @todo I18N to complete ! */ ! public class ConsoleServiceProvider extends CustomBeanContextServiceProvider ! { ! /** Description of the Field */ ! protected ConsoleService service = null; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(ConsoleServiceProvider.class); ! ! ! /** Constructor for the AboutServiceProvider object */ ! public ConsoleServiceProvider() ! { ! super(); ! } ! ! ! /** ! * Gets the currentServiceSelectors attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @return The currentServiceSelectors value ! */ ! public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) ! { ! return (new Vector().iterator()); ! } ! ! ! /** ! * Gets the service attribute of the ApplicationServiceProvider object ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param serviceClass Description of the Parameter ! * @param serviceSelector Description of the Parameter ! * @return The service value ! */ ! public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) ! { ! return this.service; ! } ! ! ! /** ! * Returns the service. ! * ! * @return ConsoleService ! */ ! public ConsoleService getService() ! { ! return service; ! } ! ! ! /** ! * Description of the Method ! * ! * @param bcs Description of the Parameter ! * @param requestor Description of the Parameter ! * @param service Description of the Parameter ! */ ! public void releaseService(BeanContextServices bcs, Object requestor, Object service) { } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{ConsoleService.class}; ! } ! ! ! /** */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! this.service = new ConsoleServiceInternalFrame(this.getBeanContext()); ! ! this.add(new ShowConsoleAction( ! new Command() ! { ! public void execute() ! { ! ConsoleServiceProvider.this.service.show(); ! } ! } ! )); ! ! logger.debug("Console Service installed"); ! } ! } Index: FrameService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/FrameService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FrameService.java 15 Sep 2003 22:37:14 -0000 1.4 --- FrameService.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,50 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.event.WindowListener; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface FrameService extends BeanContextContainerProxy, MenuBarService.Listener ! { ! /** Description of the Field */ ! public final static int MDI = 0; ! /** Description of the Field */ ! public final static int SDI = 1; ! ! ! /** ! * Setter for the title attribute ! * ! * @param title The new value ! */ ! public void setTitle(String title); ! ! ! /** ! * Adds a feature to the WindowListener attribute of the FrameService object ! * ! * @param l The feature to be added to the WindowListener attribute ! */ ! public void addWindowListener(WindowListener l); ! ! ! /** ! * Description of the Method ! * ! * @param l Description of Parameter ! */ ! public void removeWindowListener(WindowListener l); ! } ! --- 1,50 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.event.WindowListener; ! import java.beans.beancontext.BeanContextContainerProxy; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface FrameService extends BeanContextContainerProxy, MenuBarService.Listener ! { ! /** Description of the Field */ ! public final static int MDI = 0; ! /** Description of the Field */ ! public final static int SDI = 1; ! ! ! /** ! * Setter for the title attribute ! * ! * @param title The new value ! */ ! public void setTitle(String title); ! ! ! /** ! * Adds a feature to the WindowListener attribute of the FrameService object ! * ! * @param l The feature to be added to the WindowListener attribute ! */ ! public void addWindowListener(WindowListener l); ! ! ! /** ! * Description of the Method ! * ! * @param l Description of Parameter ! */ ! public void removeWindowListener(WindowListener l); ! } ! Index: FrameServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/FrameServiceProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FrameServiceProvider.java 15 Sep 2003 22:37:14 -0000 1.4 --- FrameServiceProvider.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 14,17 **** --- 14,18 ---- import java.util.Vector; + import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JMenuBar; *************** *** 144,147 **** --- 145,161 ---- this.frame.setJMenuBar(menuBar); this.frame.setVisible(true); + } + + + /** Description of the Method */ + protected void initializeBeanContextResources() + { + super.initializeBeanContextResources(); + + ImageIcon icon = new ImageIcon(this.getClass().getResource("/frameGraphics/ejtools.gif")); + if (icon != null) + { + this.frame.setIconImage(icon.getImage()); + } } Index: MDIFrameService.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/MDIFrameService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MDIFrameService.java 15 Sep 2003 22:37:14 -0000 1.4 --- MDIFrameService.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,42 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface MDIFrameService extends FrameService ! { ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void register(BeanContextInternalFrame frame); ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void unregister(BeanContextInternalFrame frame); ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void activate(BeanContextInternalFrame frame); ! } ! --- 1,42 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface MDIFrameService extends FrameService ! { ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void register(BeanContextInternalFrame frame); ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void unregister(BeanContextInternalFrame frame); ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void activate(BeanContextInternalFrame frame); ! } ! Index: MDIFrameServiceProvider.java =================================================================== RCS file: /cvsroot/ejtools/libraries/adwt/src/main/org/ejtools/adwt/service/MDIFrameServiceProvider.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MDIFrameServiceProvider.java 15 Sep 2003 22:37:14 -0000 1.4 --- MDIFrameServiceProvider.java 13 Dec 2003 21:29:35 -0000 1.5 *************** *** 1,222 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.awt.Dimension; ! import java.awt.Toolkit; ! import java.beans.PropertyVetoException; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.ButtonGroup; ! import javax.swing.JInternalFrame; ! import javax.swing.WindowConstants; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.window.CascadeAction; ! import org.ejtools.adwt.action.window.CloseAction; ! import org.ejtools.adwt.action.window.CloseAllAction; ! import org.ejtools.adwt.action.window.TileAction; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class MDIFrameServiceProvider extends FrameServiceProvider implements MDIFrameService ! { ! /** Description of the Field */ ! protected MDIDesktopPane desktop = new MDIDesktopPane(); ! /** Description of the Field */ ! protected Vector frames = new Vector(); ! /** Description of the Field */ ! protected ButtonGroup group = new ButtonGroup(); ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(MDIFrameServiceProvider.class); ! ! ! /** Constructor for the FrameServiceProvider object */ ! public MDIFrameServiceProvider() ! { ! super(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void activate(BeanContextInternalFrame frame) ! { ! try ! { ! JInternalFrame internalFrame = (JInternalFrame) frame.getComponent(); ! internalFrame.setSelected(true); ! this.desktop.getDesktopManager().activateFrame(internalFrame); ! } ! catch (PropertyVetoException e) ! { ! } ! } ! ! ! /** ! * Gets the activated attribute of the FrameServiceProvider object ! * ! * @return The activated value ! */ ! public BeanContextInternalFrame getActivated() ! { ! Iterator it = frames.iterator(); ! while (it.hasNext()) ! { ! BeanContextInternalFrame frame = (BeanContextInternalFrame) it.next(); ! if (this.isActivated(frame)) ! { ! return frame; ! } ! } ! return null; ! } ! ! ! /** ! * Gets the activated attribute of the FrameServiceProvider object ! * ! * @param frame Description of Parameter ! * @return The activated value ! */ ! public boolean isActivated(BeanContextInternalFrame frame) ! { ! JInternalFrame selected = this.desktop.getSelectedFrame(); ! JInternalFrame internalFrame = (JInternalFrame) frame.getComponent(); ! return selected.equals(internalFrame); ! } ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void register(BeanContextInternalFrame frame) ! { ! JInternalFrame internalFrame = (JInternalFrame) frame.getComponent(); ! this.frames.add(frame); ! this.desktop.add(internalFrame); ! this.group.add(frame.getAction().getMenuItem()); ! } ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void unregister(BeanContextInternalFrame frame) ! { ! JInternalFrame internalFrame = (JInternalFrame) frame.getComponent(); ! this.group.remove(frame.getAction().getMenuItem()); ! this.desktop.remove(internalFrame); ! this.frames.remove(frame); ! } ! ! ! /** ! * @return The serviceClass value ! */ ! protected Class[] getServiceClass() ! { ! return new Class[]{FrameService.class, MDIFrameService.class}; ! } ! ! ! /** Description of the Method */ ! protected void initializeBeanContextResources() ! { ! super.initializeBeanContextResources(); ! ! BeanContextServices context = (BeanContextServices) this.getBeanContext(); ! ! this.frame.setSize(new Dimension(700, 500)); ! ! this.scrollPane.getViewport().add(desktop); ! this.frame.getContentPane().add(BorderLayout.CENTER, scrollPane); ! ! Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); ! this.frame.setLocation(screen.width / 2 - frame.getSize().width / 2, screen.height / 2 - frame.getSize().height / 2); ! this.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! ! this.add(new CascadeAction( ! new Command() ! { ! public void execute() ! { ! MDIFrameServiceProvider.this.desktop.cascadeFrames(); ! } ! } ! )); ! ! this.add(new TileAction( ! new Command() ! { ! public void execute() ! { ! MDIFrameServiceProvider.this.desktop.tileFrames(); ! } ! } ! )); ! ! this.add(new CloseAction( ! new Command() ! { ! public void execute() ! { ! BeanContextInternalFrame frame = MDIFrameServiceProvider.this.getActivated(); ! if (frame != null) ! { ! frame.close(); ! } ! } ! } ! )); ! ! this.add(new CloseAllAction( ! new Command() ! { ! public void execute() ! { ! while (!MDIFrameServiceProvider.this.frames.isEmpty()) ! { ! BeanContextInternalFrame frame = (BeanContextInternalFrame) MDIFrameServiceProvider.this.frames.lastElement(); ! frame.close(); ! } ! } ! } ! )); ! ! this.useServices(context); ! this.frame.setVisible(true); ! ! logger.debug("MDIFrameService added"); ! } ! ! ! /** */ ! protected void releaseBeanContextResources() ! { ! super.releaseBeanContextResources(); ! ! logger.debug("MDIFrameService removed"); ! } ! } --- 1,222 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.adwt.service; ! ! import java.awt.BorderLayout; ! import java.awt.Dimension; ! import java.awt.Toolkit; ! import java.beans.PropertyVetoException; ! import java.beans.beancontext.BeanContextServices; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.swing.ButtonGroup; ! import javax.swing.JInternalFrame; ! import javax.swing.WindowConstants; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.action.Command; ! import org.ejtools.adwt.action.window.CascadeAction; ! import org.ejtools.adwt.action.window.CloseAction; ! import org.ejtools.adwt.action.window.CloseAllAction; ! import org.ejtools.adwt.action.window.TileAction; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class MDIFrameServiceProvider extends FrameServiceProvider implements MDIFrameService ! { ! /** Description of the Field */ ! protected MDIDesktopPane desktop = new MDIDesktopPane(); ! /** Description of the Field */ ! protected Vector frames = new Vector(); ! /** Description of the Field */ ! protected ButtonGroup group = new ButtonGroup(); ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(MDIFrameServiceProvider.class); ! ! ! /** Constructor for the FrameServiceProvider object */ ! public MDIFrameServiceProvider() ! { ! super(); ! } ! ! ! /** ! * Description of the Method ! * ! * @param frame Description of Parameter ! */ ! public void activate(BeanContextInternalFrame frame) ! { ! try ! { ! JInternalFrame internalFrame = (JInternalFrame) frame.getComponent(); ! internalFrame.setSelected(true); ! this.desktop.getDesktopManager().activateFram... [truncated message content] |