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 workflow section of the report query editor.
29: *
30: * @author Matthew Large
31: * @version $Revision: 1.1 $
32: *
33: */
34: public class ReportWorkflows extends ReportMultiPanel {
35:
36: /**
37: * Constructs a new workflow panel.
38: *
39: * @param query Report query
40: */
41: public ReportWorkflows(ReportQuery query) {
42: super (query, "Workflow stage");
43: this .setup();
44: }
45:
46: /**
47: * Configures this component.
48: *
49: */
50: private void setup() {
51: Iterator itor = this .m_reportQuery.getWorkflowStages()
52: .iterator();
53: while (itor.hasNext()) {
54: WorkflowStage workflowStage = (WorkflowStage) itor.next();
55: WorkflowStagePanel workflowStagePanel = new WorkflowStagePanel(
56: this .m_reportQuery, workflowStage);
57: super .addValueComponent(workflowStagePanel);
58: }
59: }
60:
61: /* (non-Javadoc)
62: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#getNewValueComponent()
63: */
64: public JPanel getNewValueComponent() {
65: WorkflowStage workflowStage = new WorkflowStage(null,
66: this .m_reportQuery);
67: this .m_reportQuery.addWorkflowStage(workflowStage);
68: WorkflowStagePanel workflowStagePanel = new WorkflowStagePanel(
69: this .m_reportQuery, workflowStage);
70: return workflowStagePanel;
71: }
72:
73: /* (non-Javadoc)
74: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#removeValueComponent(javax.swing.JPanel)
75: */
76: public void removeValueComponent(JPanel valueComponent) {
77: WorkflowStagePanel panel = (WorkflowStagePanel) valueComponent;
78: this .m_reportQuery.removeWorkflowStage(panel.getStage());
79: }
80:
81: /* (non-Javadoc)
82: * @see com.simulacramedia.contentmanager.editors.report.ReportMultiPanel#getValueComponentCount()
83: */
84: public int getValueComponentCount() {
85: return m_reportQuery.getWorkflowStages().size();
86: }
87:
88: }
|