19 package org.turro.sendable;
21 import java.util.Collection;
22 import org.turro.action.IElephantSendable;
23 import org.turro.auth.Authentication;
24 import org.turro.command.Command;
25 import org.turro.command.Context;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.db.ElephantPU;
28 import org.turro.elephant.entities.db.Sendable;
29 import org.turro.entities.Entities;
30 import org.turro.plugin.contacts.ContactList;
31 import org.turro.plugin.contacts.IContact;
32 import org.zkoss.zk.ui.Executions;
33 import org.zkoss.zk.ui.IdSpace;
34 import org.zkoss.zk.ui.ext.AfterCompose;
35 import org.zkoss.zk.ui.select.Selectors;
36 import org.zkoss.zk.ui.select.annotation.Listen;
37 import org.zkoss.zk.ui.select.annotation.Wire;
38 import org.zkoss.zul.Checkbox;
39 import org.zkoss.zul.Datebox;
40 import org.zkoss.zul.East;
41 import org.zkoss.zul.Panel;
49 private boolean withAssistants =
true;
51 private String entityPath;
52 private Object entity;
55 private Datebox schedule;
58 private Checkbox sent;
61 private East assistPanel;
66 @Listen(
"onChange = #schedule")
71 @Listen(
"onCheck = #sent")
73 sendable.
setSent(sent.isChecked());
76 @Listen(
"onClick = #save")
84 @Listen(
"onClick = #delete")
90 @Listen(
"onClick = #sendTest")
96 public Object execute(Context context) {
109 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/sendable/sendableControl.zul",
this,
null);
110 Selectors.wireComponents(
this,
this,
false);
111 Selectors.wireEventListeners(
this,
this);
115 this.withAssistants = withAssistants;
119 this.entityPath = entityPath;
124 this.entity = entity;
134 private void initComponents() {
135 assistPanel.setVisible(withAssistants);
137 sent.setChecked(sendable.
isSent());
142 private void updateButtons() {
145 private void checkSendable() {
146 sendable = Sendables.getSendable(entityPath);
147 if(sendable ==
null) {
148 sendable =
new Sendable();
static IContact getIContact()
IConstructor getConstructor()
static Application getApplication()
void setSchedule(Date schedule)
void setSent(boolean sent)
void setEntityPath(String entityPath)
static IElephantEntity getController(String path)
void setSendable(Sendable sendable)
static void selectRecipients(Collection< IContact > recipients, Command command)
Collection< IContact > getRecipients()
void setWithAssistants(boolean withAssistants)
void setEntityPath(String entityPath)
void setEntity(Object entity)
static void delete(String entityPath)
static void cleanOrphans()
void send(IConstructor constructor)
IElephantSendable getSendable()