19 package org.turro.contacts.util;
21 import org.turro.string.Strings;
22 import org.turro.contacts.Contact;
23 import org.turro.contacts.db.ContactsPU;
24 import org.turro.contacts.zul.label.ContactInfo;
25 import org.turro.plugin.contacts.IContact;
26 import org.zkoss.zk.ui.Executions;
27 import org.zkoss.zk.ui.IdSpace;
28 import org.zkoss.zk.ui.event.Event;
29 import org.zkoss.zk.ui.event.Events;
30 import org.zkoss.zk.ui.ext.AfterCompose;
31 import org.zkoss.zk.ui.select.Selectors;
32 import org.zkoss.zk.ui.select.annotation.Listen;
33 import org.zkoss.zk.ui.select.annotation.Wire;
34 import org.zkoss.zul.Div;
35 import org.zkoss.zul.Hbox;
44 private Hbox layoutbox;
51 private boolean enterprise;
52 private boolean readOnly;
55 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/contact/contactControl.zul",
this,
null);
56 Selectors.wireComponents(
this,
this,
false);
57 Selectors.wireEventListeners(
this,
this);
60 @Listen(
"onChange = #contactbox")
62 contact = contactbox.getContact();
64 Events.postEvent(
new Event(Events.ON_CHANGE,
this));
72 this.enterprise = enterprise;
80 this.contact = contact;
94 return contact !=
null ? contact.
getId() :
null;
98 this.contact = Strings.isBlank(idContact) ? null :
108 this.readOnly = readOnly;
111 private void updateControls() {
112 if(contact !=
null && !Strings.isBlank(contact.
getId())) {
113 contactbox.setContact(contact);
114 contactinf.setContact(contact);
115 contactinf.setVisible(
true);
117 contactbox.setContact(
null);
118 contactinf.setContact(
null);
119 contactinf.setVisible(
false);
122 contactbox.setReadonly(readOnly);
123 contactinf.setDisabled(readOnly);
126 private void initControls() {
127 contactinf.setOnlyIcon(
true);