KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > editors > report > ReportPanel


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.him.editors.report;
20
21 import java.awt.*;
22
23 import javax.swing.*;
24
25 import org.openharmonise.him.editors.report.rqom.*;
26
27
28 /**
29  * The main report query editor pane.
30  *
31  * @author Matthew Large
32  * @version $Revision: 1.1 $
33  *
34  */

35 public class ReportPanel extends JPanel implements LayoutManager {
36     
37     /**
38      * Report query.
39      */

40     private ReportQuery m_reportQuery = null;
41
42     /**
43      * Header panel.
44      */

45     private ReportHeader m_header = null;
46     
47     /**
48      * Metadata panel.
49      */

50     private ReportMetadata m_metadata = null;
51     
52     /**
53      * Workflow panel.
54      */

55     private ReportWorkflows m_workflows = null;
56     
57     /**
58      * Users panel.
59      */

60     private ReportUsers m_users = null;
61     
62     /**
63      * Footer panel.
64      */

65     private ReportFooter m_footer = null;
66     
67     /**
68      * Order by panel.
69      */

70     private ReportOrderBy m_orderBy = null;
71     
72     /**
73      * Panel height.
74      */

75     private int m_nHeight = 100;
76
77     /**
78      * Constructs a new report panel.
79      *
80      * @param query Report query.
81      */

82     public ReportPanel(ReportQuery query) {
83         super();
84         this.m_reportQuery = query;
85         this.setup();
86     }
87     
88     /**
89      * Configures this component.
90      *
91      */

92     private void setup() {
93         this.setLayout(this);
94         
95         this.m_header = new ReportHeader(this.m_reportQuery);
96         this.add(m_header);
97         
98         this.m_metadata = new ReportMetadata(this.m_reportQuery);
99         this.add(m_metadata);
100         
101         this.m_workflows = new ReportWorkflows(this.m_reportQuery);
102         this.add(m_workflows);
103         
104         this.m_users = new ReportUsers(this.m_reportQuery);
105         this.add(m_users);
106         
107         this.m_orderBy = new ReportOrderBy(m_reportQuery);
108         this.add(m_orderBy);
109         
110         this.m_footer = new ReportFooter(this.m_reportQuery);
111         this.add(m_footer);
112     }
113
114     /* (non-Javadoc)
115      * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
116      */

117     public void layoutContainer(Container arg0) {
118         int nHeight = 0;
119         this.m_header.setSize(this.m_header.getPreferredSize());
120         this.m_header.setLocation(0, nHeight);
121         nHeight = nHeight + this.m_header.getSize().height;
122         
123         this.m_metadata.setSize(this.m_metadata.getPreferredSize());
124         this.m_metadata.setLocation(0, nHeight);
125         nHeight = nHeight + this.m_metadata.getSize().height;
126         
127         this.m_workflows.setSize(this.m_workflows.getPreferredSize());
128         this.m_workflows.setLocation(0, nHeight);
129         nHeight = nHeight + this.m_workflows.getSize().height;
130         
131         this.m_users.setSize(this.m_users.getPreferredSize());
132         this.m_users.setLocation(0, nHeight);
133         nHeight = nHeight + this.m_users.getSize().height;
134         
135         m_orderBy.setSize(m_orderBy.getPreferredSize());
136         m_orderBy.setLocation(0, nHeight);
137         nHeight = nHeight + m_orderBy.getSize().height;
138         
139         this.m_footer.setSize(this.m_footer.getPreferredSize());
140         this.m_footer.setLocation(0, nHeight);
141         nHeight = nHeight + this.m_footer.getSize().height;
142         
143         this.m_nHeight = nHeight;
144     }
145
146     /* (non-Javadoc)
147      * @see java.awt.Component#getPreferredSize()
148      */

149     public Dimension getPreferredSize() {
150         return new Dimension(700, this.m_nHeight);
151     }
152
153     /**
154      * @param arg0
155      */

156     private ReportPanel(boolean arg0) {
157         super(arg0);
158     }
159
160     /**
161      * @param arg0
162      */

163     private ReportPanel(LayoutManager arg0) {
164         super(arg0);
165     }
166
167     /**
168      * @param arg0
169      * @param arg1
170      */

171     private ReportPanel(LayoutManager arg0, boolean arg1) {
172         super(arg0, arg1);
173     }
174
175     /* (non-Javadoc)
176      * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
177      */

178     public void removeLayoutComponent(Component arg0) {
179     }
180
181     /* (non-Javadoc)
182      * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
183      */

184     public void addLayoutComponent(String JavaDoc arg0, Component arg1) {
185     }
186
187     /* (non-Javadoc)
188      * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
189      */

190     public Dimension minimumLayoutSize(Container arg0) {
191         return this.getPreferredSize();
192     }
193
194     /* (non-Javadoc)
195      * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
196      */

197     public Dimension preferredLayoutSize(Container arg0) {
198         return this.getPreferredSize();
199     }
200     public void setScopeEnabled(boolean isEnabled){
201         this.m_header.setScopeEnabled(isEnabled);
202     }
203 }
204
Popular Tags