OLD | NEW |
(Empty) | |
| 1 package org.chromium.distiller.webdocument; |
| 2 |
| 3 import com.google.gwt.dom.client.Document; |
| 4 import com.google.gwt.dom.client.Element; |
| 5 |
| 6 public class WebFigure extends WebImage { |
| 7 |
| 8 private String figCaption; |
| 9 |
| 10 public WebFigure(Element e, int w, int h, String src, String caption) { |
| 11 super(e, w, h, src); |
| 12 figCaption = caption; |
| 13 } |
| 14 |
| 15 @Override |
| 16 public String generateOutput(boolean textOnly) { |
| 17 if (textOnly) return figCaption; |
| 18 |
| 19 Element fig = Document.get().createElement("FIGURE"); |
| 20 fig.setInnerHTML(super.generateOutput(false)); |
| 21 if (!figCaption.isEmpty()) { |
| 22 Element cap = Document.get().createElement("FIGCAPTION"); |
| 23 cap.setInnerHTML(figCaption); |
| 24 fig.appendChild(cap); |
| 25 } |
| 26 return fig.getString(); |
| 27 } |
| 28 } |
OLD | NEW |