Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
11   114   7   1.57
0   47   0.64   7
7     1  
1    
 
  LinkBlock       Line # 35 11 0% 7 0 100% 1.0
 
  (183)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.block;
21   
22    import java.util.Collections;
23    import java.util.List;
24    import java.util.Map;
25   
26    import org.xwiki.rendering.listener.Listener;
27    import org.xwiki.rendering.listener.reference.ResourceReference;
28   
29    /**
30    * Represents a Link element in a page.
31    *
32    * @version $Id: 6bd29f37f8e17d53d51df02bdb9972f10fcdabc9 $
33    * @since 1.5M2
34    */
 
35    public class LinkBlock extends AbstractBlock
36    {
37    /**
38    * A reference to the link target. See {@link org.xwiki.rendering.listener.reference.ResourceReference} for more details.
39    */
40    private ResourceReference reference;
41   
42    /**
43    * If true then the link is a free standing URI directly in the text.
44    */
45    private boolean isFreeStandingURI;
46   
47    /**
48    * @param childrenBlocks the nested children blocks
49    * @param reference the reference to the target resource to link to
50    * @param isFreeStandingURI if true then the link is a free standing URI directly in the text
51    * @since 2.5RC1
52    */
 
53  53 toggle public LinkBlock(List<Block> childrenBlocks, ResourceReference reference, boolean isFreeStandingURI)
54    {
55  53 this(childrenBlocks, reference, isFreeStandingURI, Collections.<String, String> emptyMap());
56    }
57   
58    /**
59    * @param childrenBlocks the nested children blocks
60    * @param reference the reference to the target resource to link to
61    * @param isFreeStandingURI if true then the link is a free standing URI directly in the text
62    * @param parameters the parameters to set
63    * @since 2.5RC1
64    */
 
65  332 toggle public LinkBlock(List<Block> childrenBlocks, ResourceReference reference, boolean isFreeStandingURI,
66    Map<String, String> parameters)
67    {
68  332 super(childrenBlocks, parameters);
69  332 this.reference = reference;
70  332 this.isFreeStandingURI = isFreeStandingURI;
71    }
72   
73    /**
74    * @return the reference to the target to link to
75    * @see org.xwiki.rendering.listener.reference.ResourceReference
76    * @since 2.5RC1
77    */
 
78  665 toggle public ResourceReference getReference()
79    {
80  665 return this.reference;
81    }
82   
83    /**
84    * @return true if the link is a free standing URI directly in the text, false otherwise
85    */
 
86  642 toggle public boolean isFreeStandingURI()
87    {
88  642 return this.isFreeStandingURI;
89    }
90   
 
91  321 toggle @Override
92    public void before(Listener listener)
93    {
94  321 listener.beginLink(getReference(), isFreeStandingURI(), getParameters());
95    }
96   
 
97  321 toggle @Override
98    public void after(Listener listener)
99    {
100  321 listener.endLink(getReference(), isFreeStandingURI(), getParameters());
101    }
102   
103    /**
104    * {@inheritDoc}
105    * @since 1.8RC2
106    */
 
107  2 toggle @Override
108    public LinkBlock clone(BlockFilter blockFilter)
109    {
110  2 LinkBlock clone = (LinkBlock) super.clone(blockFilter);
111  2 clone.reference = getReference().clone();
112  2 return clone;
113    }
114    }