18 package org.turro.zkoss.print;
20 import org.turro.i18n.I_;
21 import org.zkoss.zk.ui.event.Event;
22 import org.zkoss.zk.ui.event.EventListener;
23 import org.zkoss.zk.ui.event.Events;
24 import org.zkoss.zk.ui.ext.AfterCompose;
25 import org.zkoss.zul.Button;
26 import org.zkoss.zul.Menuitem;
27 import org.zkoss.zul.Menupopup;
33 public abstract class ReportButton extends Button implements AfterCompose {
42 this.showLabels = showLabels;
57 setLabel(
I_.
get(
"Print"));
59 setTooltiptext(I_.get(
"Print"));
61 setImage(
"/_zul/images/printer.png");
64 setLabel(I_.get(
"Print with no values"));
66 setTooltiptext(I_.get(
"Print with no values"));
68 setImage(
"/_zul/images/printer-novalues.png");
70 Menupopup menu =
new Menupopup();
71 for (
final ReportTypeEnum rt : ReportTypeEnum.values()) {
72 Menuitem mi =
new Menuitem(rt.getLabel(), rt.getImage());
73 mi.addEventListener(Events.ON_CLICK,
new EventListener() {
75 public void onEvent(Event event)
throws Exception {
81 getParent().appendChild(menu);
83 addEventListener(Events.ON_CLICK,
new EventListener() {
85 public void onEvent(Event event)
throws Exception {
86 print((String) ReportTypeEnum.PRINT_PDF.getType());
91 protected abstract void print(String type);
static String get(String msg)