KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > adwt > service > SDIFrameServiceProvider


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.adwt.service;
8
9 import java.awt.BorderLayout JavaDoc;
10 import java.awt.Container JavaDoc;
11 import java.awt.Dimension JavaDoc;
12 import java.awt.Toolkit JavaDoc;
13 import java.beans.beancontext.BeanContextServices JavaDoc;
14
15 import javax.swing.JPanel JavaDoc;
16 import javax.swing.WindowConstants JavaDoc;
17
18 import org.apache.log4j.Logger;
19
20 /**
21  * Description of the Class
22  *
23  * @author Laurent Etiemble
24  * @version $Revision: 1.5 $
25  * @todo Javadoc to complete
26  */

27 public class SDIFrameServiceProvider extends FrameServiceProvider implements SDIFrameService
28 {
29    /** Description of the Field */
30    protected Container JavaDoc content = new JPanel JavaDoc();
31    /** Description of the Field */
32    private static Logger logger = Logger.getLogger(SDIFrameServiceProvider.class);
33
34
35    /** Constructor for the FrameServiceProvider object */
36    public SDIFrameServiceProvider()
37    {
38       super();
39    }
40
41
42    /**
43     * Sets the content attribute of the FrameServiceProvider object
44     *
45     * @param c The new content value
46     */

47    public void setContent(Container JavaDoc c)
48    {
49       this.content = c;
50    }
51
52
53    /**
54     * @return The serviceClass value
55     */

56    protected Class JavaDoc[] getServiceClass()
57    {
58       return new Class JavaDoc[]{FrameService.class, SDIFrameService.class};
59    }
60
61
62    /** Description of the Method */
63    protected void initializeBeanContextResources()
64    {
65       super.initializeBeanContextResources();
66
67       BeanContextServices JavaDoc context = (BeanContextServices JavaDoc) getBeanContext();
68
69       frame.setSize(new Dimension JavaDoc(700, 500));
70
71       this.scrollPane.getViewport().add(content);
72       this.frame.getContentPane().add(BorderLayout.CENTER, scrollPane);
73
74       Dimension JavaDoc screen = Toolkit.getDefaultToolkit().getScreenSize();
75       this.frame.setLocation(screen.width / 2 - frame.getSize().width / 2, screen.height / 2 - frame.getSize().height / 2);
76       this.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
77
78       this.useServices(context);
79       this.frame.setVisible(true);
80
81       logger.debug("SDIFrameService added");
82    }
83
84
85    /** */
86    protected void releaseBeanContextResources()
87    {
88       super.releaseBeanContextResources();
89
90       logger.debug("SDIFrameService removed");
91    }
92 }
93
94
Popular Tags