KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > print > layout > HeaderFooter


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.print.layout;
15
16 import java.awt.*;
17 import java.util.*;
18
19 import org.compiere.model.*;
20
21 /**
22  * Header Footer
23  *
24  * @author Jorg Janke
25  * @version $Id: HeaderFooter.java,v 1.6 2002/08/28 04:24:32 jjanke Exp $
26  */

27 public class HeaderFooter
28 {
29     /**
30      * Standard Constructor
31      * @param ctx context
32      */

33     public HeaderFooter (Properties ctx)
34     {
35         m_ctx = ctx;
36     } // HeaderFooter
37

38     /** Context */
39     private Properties m_ctx;
40
41     /** Header/Footer content */
42     private ArrayList m_elements = new ArrayList();
43
44     /**
45      * Add Print Element to Page
46      * @param element print element
47      */

48     public void addElement (PrintElement element)
49     {
50         if (element != null)
51             m_elements.add(element);
52     } // addElement
53

54
55     /**
56      * Paint Page Header/Footer on Graphics in Bounds
57      *
58      * @param g2D graphics
59      * @param bounds page bounds
60      * @param isView true if online view (IDs are links)
61      */

62     public void paint (Graphics2D g2D, Rectangle bounds, boolean isView)
63     {
64         Point pageStart = new Point(bounds.getLocation());
65         for (int i = 0; i < m_elements.size(); i++)
66         {
67             PrintElement e = (PrintElement)m_elements.get(i);
68             e.paint(g2D, 0, pageStart, m_ctx, isView);
69         }
70     } // paint
71

72     /**
73      * Get DrillDown value
74      * @param relativePoint relative Point
75      * @return if found NamePait or null
76      */

77     public MQuery getDrillDown (Point relativePoint)
78     {
79         MQuery retValue = null;
80         for (int i = 0; i < m_elements.size() && retValue == null; i++)
81         {
82             PrintElement element = (PrintElement)m_elements.get(i);
83             retValue = element.getDrillDown (relativePoint, 1);
84         }
85         return retValue;
86     } // getDrillDown
87

88 } // HeaderFooter
89
Popular Tags