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
10   107   6   1.67
0   40   0.6   6
6     1  
1    
 
  ImageBlock       Line # 34 10 0% 6 0 100% 1.0
 
  (79)
 
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.Map;
24   
25    import org.xwiki.rendering.listener.Listener;
26    import org.xwiki.rendering.listener.reference.ResourceReference;
27   
28    /**
29    * Represents an image.
30    *
31    * @version $Id: c4dcacc3c715ba922de2e34139336ad3a4a19e2a $
32    * @since 1.7M2
33    */
 
34    public class ImageBlock extends AbstractBlock
35    {
36    /**
37    * A reference to the image target. See {@link org.xwiki.rendering.listener.reference.ResourceReference} for more details.
38    */
39    private ResourceReference reference;
40   
41    /**
42    * If true then the image is defined as a free standing URI directly in the text.
43    */
44    private boolean isFreeStandingURI;
45   
46    /**
47    * @param reference the image reference
48    * @param isFreeStandingURI indicate if the image syntax is simple a full descriptive syntax (detail depending of
49    * the syntax)
50    * @since 2.5RC1
51    */
 
52  58 toggle public ImageBlock(ResourceReference reference, boolean isFreeStandingURI)
53    {
54  58 this(reference, isFreeStandingURI, Collections.<String, String> emptyMap());
55    }
56   
57    /**
58    * @param reference the image reference
59    * @param isFreeStandingURI indicate if the image syntax is simple a full descriptive syntax (detail depending of
60    * the syntax)
61    * @param parameters the custom parameters
62    * @since 2.5RC1
63    */
 
64  165 toggle public ImageBlock(ResourceReference reference, boolean isFreeStandingURI, Map<String, String> parameters)
65    {
66  165 super(parameters);
67   
68  165 this.reference = reference;
69  165 this.isFreeStandingURI = isFreeStandingURI;
70    }
71   
72    /**
73    * @return the reference to the image
74    * @see org.xwiki.rendering.listener.reference.ResourceReference
75    * @since 2.5RC1
76    */
 
77  151 toggle public ResourceReference getReference()
78    {
79  151 return this.reference;
80    }
81   
82    /**
83    * @return true if the image is defined as a free standing URI directly in the text, false otherwise
84    */
 
85  130 toggle public boolean isFreeStandingURI()
86    {
87  130 return this.isFreeStandingURI;
88    }
89   
 
90  130 toggle @Override
91    public void traverse(Listener listener)
92    {
93  130 listener.onImage(getReference(), isFreeStandingURI(), getParameters());
94    }
95   
96    /**
97    * {@inheritDoc}
98    * @since 1.8RC2
99    */
 
100  19 toggle @Override
101    public ImageBlock clone(BlockFilter blockFilter)
102    {
103  19 ImageBlock clone = (ImageBlock) super.clone(blockFilter);
104  19 clone.reference = getReference().clone();
105  19 return clone;
106    }
107    }