KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > export > JRHyperlinkProducerMapFactory


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.export;
29
30 import java.io.Serializable JavaDoc;
31 import java.util.HashMap JavaDoc;
32 import java.util.Map JavaDoc;
33
34 import net.sf.jasperreports.engine.JRConstants;
35
36
37 /**
38  * Map-based hyperlink producer factory implementation.
39  * <p>
40  * This implementation wraps a hyperlink type to hyperling producer instance
41  * association map.
42  * </p>
43  *
44  * @author Lucian Chirita (lucianc@users.sourceforge.net)
45  * @version $Id: JRHyperlinkProducerMapFactory.java 1368 2006-09-01 15:01:52 +0300 (Fri, 01 Sep 2006) lucianc $
46  */

47 public class JRHyperlinkProducerMapFactory extends JRHyperlinkProducerFactory implements Serializable JavaDoc
48 {
49     
50     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
51
52     private Map JavaDoc producers;
53     
54     
55     /**
56      * Creates a blank factory.
57      */

58     public JRHyperlinkProducerMapFactory()
59     {
60         producers = new HashMap JavaDoc();
61     }
62
63     
64     /**
65      * Exposes the type to producer association map.
66      *
67      * @return the type to producer association map
68      */

69     public Map JavaDoc getProducersMap()
70     {
71         return producers;
72     }
73
74     
75     /**
76      * Sets the type to producer association map.
77      *
78      * @param producers bulk type to producer association map
79      * @see #getProducersMap()
80      */

81     public void setProducersMap(Map JavaDoc producers)
82     {
83         this.producers = producers;
84     }
85     
86     
87     /**
88      * Adds a hyperlink producer instance associated to a hyperlink type.
89      *
90      * @param linkType the type
91      * @param producer the producer
92      */

93     public void addProducer(String JavaDoc linkType, JRHyperlinkProducer producer)
94     {
95         producers.put(linkType, producer);
96     }
97     
98     
99     /**
100      * Removes a type to producer association.
101      *
102      * @param linkType the hyperlink type
103      * @return the producer which was associated to the type, if any
104      */

105     public JRHyperlinkProducer removeProducer(String JavaDoc linkType)
106     {
107         return (JRHyperlinkProducer) producers.remove(linkType);
108     }
109     
110     
111     public JRHyperlinkProducer getHandler(String JavaDoc linkType)
112     {
113         return (JRHyperlinkProducer) producers.get(linkType);
114     }
115
116 }
117
Popular Tags