18 package org.turro.contacts.zul.label;
20 import org.turro.string.Strings;
21 import org.turro.action.Contacts;
22 import org.turro.contacts.*;
23 import org.turro.contacts.db.ContactsPU;
24 import org.turro.contacts.zul.fields.FieldLabel;
25 import org.turro.contacts.zul.relation.RelationLayout;
26 import org.turro.elephant.context.Application;
27 import org.turro.elephant.util.Images;
28 import org.turro.file.util.FileAttach;
29 import org.turro.i18n.I_;
30 import org.turro.plugin.contacts.IContact;
31 import org.turro.zkoss.image.ImageWrapper;
32 import org.turro.zkoss.label.LabelTypes;
33 import org.turro.zul.frame.Framework;
34 import org.zkoss.zk.ui.Component;
35 import org.zkoss.zk.ui.event.Event;
36 import org.zkoss.zk.ui.event.EventListener;
37 import org.zkoss.zk.ui.event.Events;
38 import org.zkoss.zul.*;
48 private boolean onlyIcon;
62 this(contactId,
null);
69 if(ic !=
null && ic.
isValid()) {
88 this.contact = contact;
101 this.onlyIcon = onlyIcon;
110 private void addClickListener() {
111 addEventListener(Events.ON_CLICK,
new EventListener() {
113 public void onEvent(Event event)
throws Exception {
119 private void fillContactPopup() {
120 if(contact ==
null) {
124 if(popup !=
null) popup.open(
this);
131 if(popup ==
null)
return null;
133 Hlayout backlayout =
new Hlayout();
134 backlayout.setSpacing(
"10px");
135 popup.appendChild(backlayout);
138 String face = fileAttach.
getPublicFile(
"/profile/face.png",
false);
140 if(!org.zkoss.lang.Strings.isBlank(face)) {
144 Vlayout vbox =
new Vlayout();
146 vbox.setStyle(
"font-size:11px");
147 backlayout.appendChild(vbox);
149 String name = contact.
getName();
158 if(app.
isInRole(
"contact-tag:list")) {
160 if(!Strings.isEmpty(tags)) {
165 if(app.
isInRole(
"contact-address:list")) {
171 if(app.
isInRole(
"contact-connector:list")) {
177 if(app.
isInRole(
"contact-value:list")) {
179 vbox.appendChild(getFieldLine(fv));
183 if(app.
isInRole(
"contact-relation:list")) {
186 if(rl.hasContent()) {
187 vbox.appendChild(rl);
190 if(!vbox.getChildren().isEmpty()) {
197 private static Component getFieldLine(
FieldValue fv) {
198 Hlayout hbox =
new Hlayout();
200 fl.setSclass(
"softLabel");
202 hbox.appendChild(fl);
203 hbox.appendChild(
new Label(
": "));
205 fl.setSclass(
"softLabel");
207 hbox.appendChild(fl);
211 private void updateLabel() {
212 if(contact !=
null) {
214 String name = contact.
getName();
215 if(!org.zkoss.lang.Strings.isBlank(contact.
getGrouping())) {
boolean isInRole(String role)
static Application getApplication()
static String getImage(String image)
String getPublicFile(String file)
static String byKey(String key)
static String get(String msg)
static Label getCaptionLabel(String value)
static Label getTinyLabel(String value)
static Label getSoftLabel(String value)
static Framework getCurrent()