use of org.freeplane.view.swing.features.filepreview.ImageLoadingListener in project freeplane by freeplane.
the class MapView method assignViewerToBackgroundComponent.
private void assignViewerToBackgroundComponent(final IViewerFactory factory, final URI uri) {
try {
if (fitToViewport) {
final JViewport vp = (JViewport) getParent();
if (vp != null) {
final Dimension viewPortSize = vp.getVisibleRect().getSize();
backgroundComponent = (JComponent) factory.createViewer(uri, viewPortSize);
} else
backgroundComponent = (JComponent) factory.createViewer(uri, new Dimension(1, 1));
} else
backgroundComponent = (JComponent) factory.createViewer(uri, zoom);
((ScalableComponent) backgroundComponent).setCenter(true);
((ScalableComponent) backgroundComponent).setImageLoadingListener(new ImageLoadingListener() {
public void imageLoaded() {
repaint();
}
});
} catch (final MalformedURLException e1) {
LogUtils.severe(e1);
} catch (final IOException e1) {
LogUtils.severe(e1);
}
}
Aggregations