18 package org.turro.zkoss.print;
20 import org.turro.i18n.I_;
21 import org.zkoss.lang.Strings;
22 import org.zkoss.zk.ui.event.Event;
23 import org.zkoss.zk.ui.event.EventListener;
24 import org.zkoss.zk.ui.event.Events;
25 import org.zkoss.zk.ui.ext.AfterCompose;
26 import org.zkoss.zul.Menuitem;
27 import org.zkoss.zul.Menupopup;
28 import org.zkoss.zul.Toolbarbutton;
43 this.showLabels = showLabels;
58 if(Strings.isBlank(getLabel())) setLabel(
I_.
get(
"Print"));
60 if(Strings.isBlank(getTooltiptext())) setTooltiptext(I_.get(
"Print"));
62 if(Strings.isBlank(getImage())) setImage(
"/_zul/images/printer.png");
65 if(Strings.isBlank(getLabel())) setLabel(I_.get(
"Print with no values"));
67 if(Strings.isBlank(getTooltiptext())) setTooltiptext(I_.get(
"Print with no values"));
69 if(Strings.isBlank(getImage())) setImage(
"/_zul/images/printer-novalues.png");
71 Menupopup menu =
new Menupopup();
72 for (
final ReportTypeEnum rt : ReportTypeEnum.values()) {
73 Menuitem mi =
new Menuitem(rt.getLabel(), rt.getImage());
74 mi.addEventListener(Events.ON_CLICK,
new EventListener() {
76 public void onEvent(Event event)
throws Exception {
82 getParent().appendChild(menu);
84 addEventListener(Events.ON_CLICK,
new EventListener() {
86 public void onEvent(Event event)
throws Exception {
87 print((String) ReportTypeEnum.PRINT_PDF.getType());
96 protected abstract void print(String type);
static String get(String msg)