KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Iterator JavaDoc;
22
23 import javax.swing.JPanel JavaDoc;
24
25 import org.openharmonise.him.editors.report.rqom.*;
26
27
28 /**
29  * Panel for the metadata section of the report query editor.
30  *
31  * @author Matthew Large
32  * @version $Revision: 1.1 $
33  *
34  */

35 public class ReportMetadata extends ReportMultiPanel {
36
37     /**
38      * Constructs a new report metadata panel.
39      *
40      * @param query
41      */

42     public ReportMetadata(ReportQuery query) {
43         super(query, "Filter the resource");
44         this.setup();
45     }
46     
47     /**
48      * Configures this component.
49      *
50      */

51     private void setup() {
52         Iterator JavaDoc itor = this.m_reportQuery.getMetadata().iterator();
53         while (itor.hasNext()) {
54             Metadata metadata = (Metadata) itor.next();
55             MetadataPanel metadataPanel = new MetadataPanel(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 JavaDoc getNewValueComponent() {
64         Metadata metadata = new Metadata(null, this.m_reportQuery);
65         this.m_reportQuery.addMetadata(metadata);
66         MetadataPanel metadataPanel = new MetadataPanel(this.m_reportQuery, metadata);
67         return metadataPanel;
68     }
69
70     /* (non-Javadoc)
71      * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#removeValueComponent(javax.swing.JPanel)
72      */

73     public void removeValueComponent(JPanel JavaDoc valueComponent) {
74         MetadataPanel panel = (MetadataPanel) valueComponent;
75         this.m_reportQuery.removeMetadata(panel.getMetadata());
76     }
77
78     /* (non-Javadoc)
79      * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#getComponentCount()
80      */

81     public int getValueComponentCount() {
82         return m_reportQuery.getMetadata().size();
83     }
84
85 }
Popular Tags