001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine.export;
029:
030: import java.io.Serializable;
031: import java.util.HashMap;
032: import java.util.Map;
033:
034: import net.sf.jasperreports.engine.JRConstants;
035:
036: /**
037: * Map-based hyperlink producer factory implementation.
038: * <p>
039: * This implementation wraps a hyperlink type to hyperling producer instance
040: * association map.
041: * </p>
042: *
043: * @author Lucian Chirita (lucianc@users.sourceforge.net)
044: * @version $Id: JRHyperlinkProducerMapFactory.java 1368 2006-09-01 12:01:52Z lucianc $
045: */
046: public class JRHyperlinkProducerMapFactory extends
047: JRHyperlinkProducerFactory implements Serializable {
048:
049: private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
050:
051: private Map producers;
052:
053: /**
054: * Creates a blank factory.
055: */
056: public JRHyperlinkProducerMapFactory() {
057: producers = new HashMap();
058: }
059:
060: /**
061: * Exposes the type to producer association map.
062: *
063: * @return the type to producer association map
064: */
065: public Map getProducersMap() {
066: return producers;
067: }
068:
069: /**
070: * Sets the type to producer association map.
071: *
072: * @param producers bulk type to producer association map
073: * @see #getProducersMap()
074: */
075: public void setProducersMap(Map producers) {
076: this .producers = producers;
077: }
078:
079: /**
080: * Adds a hyperlink producer instance associated to a hyperlink type.
081: *
082: * @param linkType the type
083: * @param producer the producer
084: */
085: public void addProducer(String linkType,
086: JRHyperlinkProducer producer) {
087: producers.put(linkType, producer);
088: }
089:
090: /**
091: * Removes a type to producer association.
092: *
093: * @param linkType the hyperlink type
094: * @return the producer which was associated to the type, if any
095: */
096: public JRHyperlinkProducer removeProducer(String linkType) {
097: return (JRHyperlinkProducer) producers.remove(linkType);
098: }
099:
100: public JRHyperlinkProducer getHandler(String linkType) {
101: return (JRHyperlinkProducer) producers.get(linkType);
102: }
103:
104: }
|