19 package org.turro.attach.zul.navigator;
21 import org.turro.attach.db.AttachPU;
22 import org.turro.attach.entity.Attachment;
23 import org.turro.elephant.util.Images;
24 import org.turro.i18n.I_;
25 import org.turro.jpa.Dao;
26 import org.zkoss.zk.ui.event.Event;
27 import org.zkoss.zk.ui.event.EventListener;
28 import org.zkoss.zk.ui.event.Events;
29 import org.zkoss.zul.Toolbarbutton;
37 private final String fileName, path;
38 private boolean publishable;
39 private final Dao dao;
43 this.path = attachment.
getPath();
46 updateImage(publishable);
50 private void initState() {
51 addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
53 public void onEvent(Event event) throws Exception {
54 publishable = !publishable;
56 "update Attachment set publishable = ? " +
57 "where fileName = ? and path = ?",
58 new Object[] { publishable, fileName, path });
59 updateImage(publishable);
64 private void updateImage(
boolean publishable) {
66 setImage(Images.getImage(
"published"));
67 setTooltiptext(I_.get(
"Publishable"));
69 setImage(Images.getImage(
"not_published"));
70 setTooltiptext(I_.get(
"Internal"));