|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AnnotatedXHTMLImageRenderer | Line # 44 | 7 | 0% | 3 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (13) | |||
| Result | |||
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
|
1.0
|
org.xwiki.rendering.test.integration.RenderingTest.execute
org.xwiki.rendering.test.integration.RenderingTest.execute
|
1 PASS | |
| 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.internal.renderer.xhtml.image; | |
| 21 | ||
| 22 | import java.util.Map; | |
| 23 | ||
| 24 | import javax.inject.Inject; | |
| 25 | import javax.inject.Named; | |
| 26 | ||
| 27 | import org.xwiki.rendering.listener.reference.ResourceReference; | |
| 28 | import org.xwiki.rendering.renderer.printer.XHTMLWikiPrinter; | |
| 29 | import org.xwiki.component.annotation.Component; | |
| 30 | import org.xwiki.component.annotation.InstantiationStrategy; | |
| 31 | import org.xwiki.component.descriptor.ComponentInstantiationStrategy; | |
| 32 | import org.xwiki.rendering.renderer.reference.ResourceReferenceSerializer; | |
| 33 | ||
| 34 | /** | |
| 35 | * Render images as XHTML, using annotations (see | |
| 36 | * {@link org.xwiki.rendering.internal.renderer.xhtml.AnnotatedXHTMLRenderer} for more details). | |
| 37 | * | |
| 38 | * @version $Id: e057eb346706fac7571203d46b497fc67c6e4011 $ | |
| 39 | * @since 2.0M3 | |
| 40 | */ | |
| 41 | @Component | |
| 42 | @Named("annotated") | |
| 43 | @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) | |
| 44 | public class AnnotatedXHTMLImageRenderer implements XHTMLImageRenderer | |
| 45 | { | |
| 46 | /** | |
| 47 | * Used to print Image reference as XHTML comments. | |
| 48 | */ | |
| 49 | @Inject | |
| 50 | @Named("xhtmlmarker") | |
| 51 | private ResourceReferenceSerializer xhtmlMarkerSerializer; | |
| 52 | ||
| 53 | /** | |
| 54 | * The default XHTML Link Renderer that we're wrapping. | |
| 55 | */ | |
| 56 | @Inject | |
| 57 | private XHTMLImageRenderer defaultImageRenderer; | |
| 58 | ||
| 59 | 16 |
@Override |
| 60 | public void setXHTMLWikiPrinter(XHTMLWikiPrinter printer) | |
| 61 | { | |
| 62 | 16 | this.defaultImageRenderer.setXHTMLWikiPrinter(printer); |
| 63 | } | |
| 64 | ||
| 65 | 32 |
@Override |
| 66 | public XHTMLWikiPrinter getXHTMLWikiPrinter() | |
| 67 | { | |
| 68 | 32 | return this.defaultImageRenderer.getXHTMLWikiPrinter(); |
| 69 | } | |
| 70 | ||
| 71 | 16 |
@Override |
| 72 | public void onImage(ResourceReference reference, boolean isFreeStandingURI, Map<String, String> parameters) | |
| 73 | { | |
| 74 | // We need to save the image location in XML comment so that it can be reconstructed later on when moving | |
| 75 | // from XHTML to wiki syntax. | |
| 76 | 16 | StringBuffer buffer = new StringBuffer("startimage:"); |
| 77 | 16 | buffer.append(this.xhtmlMarkerSerializer.serialize(reference)); |
| 78 | ||
| 79 | 16 | getXHTMLWikiPrinter().printXMLComment(buffer.toString(), true); |
| 80 | 16 | this.defaultImageRenderer.onImage(reference, isFreeStandingURI, parameters); |
| 81 | 16 | getXHTMLWikiPrinter().printXMLComment("stopimage"); |
| 82 | } | |
| 83 | } | |
|
||||||||||||