001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.editors.report;
020:
021: import java.awt.*;
022:
023: import javax.swing.*;
024:
025: import org.openharmonise.him.editors.report.rqom.*;
026:
027: /**
028: * The main report query editor pane.
029: *
030: * @author Matthew Large
031: * @version $Revision: 1.1 $
032: *
033: */
034: public class ReportPanel extends JPanel implements LayoutManager {
035:
036: /**
037: * Report query.
038: */
039: private ReportQuery m_reportQuery = null;
040:
041: /**
042: * Header panel.
043: */
044: private ReportHeader m_header = null;
045:
046: /**
047: * Metadata panel.
048: */
049: private ReportMetadata m_metadata = null;
050:
051: /**
052: * Workflow panel.
053: */
054: private ReportWorkflows m_workflows = null;
055:
056: /**
057: * Users panel.
058: */
059: private ReportUsers m_users = null;
060:
061: /**
062: * Footer panel.
063: */
064: private ReportFooter m_footer = null;
065:
066: /**
067: * Order by panel.
068: */
069: private ReportOrderBy m_orderBy = null;
070:
071: /**
072: * Panel height.
073: */
074: private int m_nHeight = 100;
075:
076: /**
077: * Constructs a new report panel.
078: *
079: * @param query Report query.
080: */
081: public ReportPanel(ReportQuery query) {
082: super ();
083: this .m_reportQuery = query;
084: this .setup();
085: }
086:
087: /**
088: * Configures this component.
089: *
090: */
091: private void setup() {
092: this .setLayout(this );
093:
094: this .m_header = new ReportHeader(this .m_reportQuery);
095: this .add(m_header);
096:
097: this .m_metadata = new ReportMetadata(this .m_reportQuery);
098: this .add(m_metadata);
099:
100: this .m_workflows = new ReportWorkflows(this .m_reportQuery);
101: this .add(m_workflows);
102:
103: this .m_users = new ReportUsers(this .m_reportQuery);
104: this .add(m_users);
105:
106: this .m_orderBy = new ReportOrderBy(m_reportQuery);
107: this .add(m_orderBy);
108:
109: this .m_footer = new ReportFooter(this .m_reportQuery);
110: this .add(m_footer);
111: }
112:
113: /* (non-Javadoc)
114: * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
115: */
116: public void layoutContainer(Container arg0) {
117: int nHeight = 0;
118: this .m_header.setSize(this .m_header.getPreferredSize());
119: this .m_header.setLocation(0, nHeight);
120: nHeight = nHeight + this .m_header.getSize().height;
121:
122: this .m_metadata.setSize(this .m_metadata.getPreferredSize());
123: this .m_metadata.setLocation(0, nHeight);
124: nHeight = nHeight + this .m_metadata.getSize().height;
125:
126: this .m_workflows.setSize(this .m_workflows.getPreferredSize());
127: this .m_workflows.setLocation(0, nHeight);
128: nHeight = nHeight + this .m_workflows.getSize().height;
129:
130: this .m_users.setSize(this .m_users.getPreferredSize());
131: this .m_users.setLocation(0, nHeight);
132: nHeight = nHeight + this .m_users.getSize().height;
133:
134: m_orderBy.setSize(m_orderBy.getPreferredSize());
135: m_orderBy.setLocation(0, nHeight);
136: nHeight = nHeight + m_orderBy.getSize().height;
137:
138: this .m_footer.setSize(this .m_footer.getPreferredSize());
139: this .m_footer.setLocation(0, nHeight);
140: nHeight = nHeight + this .m_footer.getSize().height;
141:
142: this .m_nHeight = nHeight;
143: }
144:
145: /* (non-Javadoc)
146: * @see java.awt.Component#getPreferredSize()
147: */
148: public Dimension getPreferredSize() {
149: return new Dimension(700, this .m_nHeight);
150: }
151:
152: /**
153: * @param arg0
154: */
155: private ReportPanel(boolean arg0) {
156: super (arg0);
157: }
158:
159: /**
160: * @param arg0
161: */
162: private ReportPanel(LayoutManager arg0) {
163: super (arg0);
164: }
165:
166: /**
167: * @param arg0
168: * @param arg1
169: */
170: private ReportPanel(LayoutManager arg0, boolean arg1) {
171: super (arg0, arg1);
172: }
173:
174: /* (non-Javadoc)
175: * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
176: */
177: public void removeLayoutComponent(Component arg0) {
178: }
179:
180: /* (non-Javadoc)
181: * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
182: */
183: public void addLayoutComponent(String arg0, Component arg1) {
184: }
185:
186: /* (non-Javadoc)
187: * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
188: */
189: public Dimension minimumLayoutSize(Container arg0) {
190: return this .getPreferredSize();
191: }
192:
193: /* (non-Javadoc)
194: * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
195: */
196: public Dimension preferredLayoutSize(Container arg0) {
197: return this .getPreferredSize();
198: }
199:
200: public void setScopeEnabled(boolean isEnabled) {
201: this.m_header.setScopeEnabled(isEnabled);
202: }
203: }
|