01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * 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.util.Iterator;
22:
23: import javax.swing.JPanel;
24:
25: import org.openharmonise.him.editors.report.rqom.*;
26:
27: /**
28: * Panel for the metadata section of the report query editor.
29: *
30: * @author Matthew Large
31: * @version $Revision: 1.1 $
32: *
33: */
34: public class ReportMetadata extends ReportMultiPanel {
35:
36: /**
37: * Constructs a new report metadata panel.
38: *
39: * @param query
40: */
41: public ReportMetadata(ReportQuery query) {
42: super (query, "Filter the resource");
43: this .setup();
44: }
45:
46: /**
47: * Configures this component.
48: *
49: */
50: private void setup() {
51: Iterator itor = this .m_reportQuery.getMetadata().iterator();
52: while (itor.hasNext()) {
53: Metadata metadata = (Metadata) itor.next();
54: MetadataPanel metadataPanel = new MetadataPanel(
55: this .m_reportQuery, metadata);
56: super .addValueComponent(metadataPanel);
57: }
58: }
59:
60: /* (non-Javadoc)
61: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#getNewValueComponent()
62: */
63: public JPanel getNewValueComponent() {
64: Metadata metadata = new Metadata(null, this .m_reportQuery);
65: this .m_reportQuery.addMetadata(metadata);
66: MetadataPanel metadataPanel = new MetadataPanel(
67: this .m_reportQuery, metadata);
68: return metadataPanel;
69: }
70:
71: /* (non-Javadoc)
72: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#removeValueComponent(javax.swing.JPanel)
73: */
74: public void removeValueComponent(JPanel valueComponent) {
75: MetadataPanel panel = (MetadataPanel) valueComponent;
76: this .m_reportQuery.removeMetadata(panel.getMetadata());
77: }
78:
79: /* (non-Javadoc)
80: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#getComponentCount()
81: */
82: public int getValueComponentCount() {
83: return m_reportQuery.getMetadata().size();
84: }
85:
86: }
|