19 package org.turro.file.zul;
21 import java.awt.image.BufferedImage;
23 import javax.imageio.ImageIO;
24 import org.turro.elephant.util.Images;
25 import org.turro.i18n.I_;
26 import org.turro.preview.Preview;
27 import org.turro.zkoss.dialog.Windows;
28 import org.zkoss.zk.ui.event.Event;
29 import org.zkoss.zk.ui.event.EventListener;
30 import org.zkoss.zk.ui.event.Events;
31 import org.zkoss.zul.Image;
32 import org.zkoss.zul.Toolbarbutton;
38 public class PreviewButton extends Toolbarbutton implements EventListener<Event> {
40 private final File file;
45 setTooltiptext(
I_.
get(
"Preview"));
46 addEventListener(Events.ON_CLICK,
this);
50 public void onEvent(Event event)
throws Exception {
51 Preview preview = Preview.from(file);
52 File result = preview.get();
54 BufferedImage bi = ImageIO.read(result);
55 Image image =
new Image();
static String getImage(String image)
static String get(String msg)
static Windows title(String title)
Windows addComponent(HtmlBasedComponent component)
Windows adaptHeight(int height)
Windows onClose(Consumer< Windows > onClose)
Windows adaptWidth(int width)