| | |
| | /** |
| | - * The order is important: Swing factory will replace SVG images with |
| | - * a blank image, which will cause the chained factory to cache the image |
| | - * and exit. Instead, the SVG must execute first to rasterize the content. |
| | - * Consequently, the chained factory must maintain insertion order. |
| | - */ |
| | - private static final ChainedReplacedElementFactory sFactory |
| | - = new ChainedReplacedElementFactory( |
| | - new SvgReplacedElementFactory(), |
| | - new SwingReplacedElementFactory() |
| | - ); |
| | - |
| | - /** |
| | * Used to populate the {@link #HTML_HEAD} with stylesheet file references. |
| | */ |
 |
| | |
| | private static final URL HTML_STYLE_PREVIEW = toUrl( STYLESHEET_PREVIEW ); |
| | + |
| | + /** |
| | + * The order is important: Swing factory will replace SVG images with |
| | + * a blank image, which will cause the chained factory to cache the image |
| | + * and exit. Instead, the SVG must execute first to rasterize the content. |
| | + * Consequently, the chained factory must maintain insertion order. |
| | + */ |
| | + private final ChainedReplacedElementFactory mFactory; |
| | |
| | /** |
 |
| | public HtmlPreview( final Workspace workspace ) { |
| | mWorkspace = workspace; |
| | + mFactory = new ChainedReplacedElementFactory( |
| | + mWorkspace, |
| | + new SvgReplacedElementFactory(), |
| | + new SwingReplacedElementFactory() |
| | + ); |
| | |
| | // Attempts to prevent a flash of black un-styled content upon load. |
 |
| | setCacheHint( SPEED ); |
| | setContent( wrapper ); |
| | - wrapper.addComponentListener( sFactory ); |
| | + wrapper.addComponentListener( mFactory ); |
| | |
| | final var context = mView.getSharedContext(); |
| | final var textRenderer = context.getTextRenderer(); |
| | - context.setReplacedElementFactory( sFactory ); |
| | + context.setReplacedElementFactory( mFactory ); |
| | textRenderer.setSmoothingThreshold( 0 ); |
| | |
 |
| | */ |
| | public void refresh() { |
| | - sFactory.clearCache(); |
| | + mFactory.clearCache(); |
| | rerender(); |
| | } |