19 package org.turro.contacts.zul.relation;
21 import java.util.List;
22 import java.util.function.Consumer;
23 import org.turro.contacts.Contact;
24 import org.turro.contacts.zul.label.ContactInfo;
25 import org.turro.entities.Entities;
26 import org.turro.entities.IElephantEntity;
27 import org.turro.plugin.contacts.ContactRelations;
28 import org.turro.plugin.contacts.IContactRelation;
29 import org.turro.util.Chars;
30 import org.turro.zkoss.label.LabelTypes;
31 import org.zkoss.zk.ui.HtmlBasedComponent;
32 import org.zkoss.zk.ui.event.Event;
33 import org.zkoss.zk.ui.event.Events;
34 import org.zkoss.zul.A;
35 import org.zkoss.zul.Hlayout;
36 import org.zkoss.zul.Image;
37 import org.zkoss.zul.Label;
38 import org.zkoss.zul.Vlayout;
47 private boolean hasContent;
48 private Consumer<Contact> onClick;
51 this.contact = contact;
55 this.onClick = onClick;
62 private void processContactInfo(List<IContactRelation> contactRelationList) {
65 Hlayout rbox =
new Hlayout();
66 rbox.appendChild(
getIcon(relation.getValidated()));
67 rbox.appendChild(
new Image(relation.getImage()));
68 if(relation.asWorker()) {
72 ci.setSclass(
"softLabel");
75 ContactInfo ci =
new ContactInfo(relation.getRelatedId());
76 ci.setSclass(
"softLabel");
78 rbox.appendChild(LabelTypes.getSoftLabel(Chars.forward().spaced().toString()));
79 rbox.appendChild(LabelTypes.getSoftLabel(relation.getDue()));
89 private void process(List<IContactRelation> contactRelationList) {
92 Hlayout rbox =
new Hlayout();
93 rbox.appendChild(
getIcon(relation.getValidated()));
94 rbox.appendChild(
new Image(relation.getImage()));
96 if(relation.asWorker()) {
97 Label l =
new Label(relation.getDue());
98 l.setSclass(
"relation");
100 rbox.appendChild(
new Label(Chars.forward().spaced().toString()));
101 Label label =
new Label(iee.
getName());
102 label.setStyle(
"cursor:pointer");
103 label.setSclass(
"contact");
104 if(onClick !=
null) {
105 label.addEventListener(Events.ON_CLICK, (Event event) -> {
106 onClick.accept((Contact) iee.getEntity());
109 rbox.appendChild(label);
111 Label label =
new Label(iee.
getName());
112 label.setStyle(
"cursor:pointer");
113 label.setSclass(
"contact");
114 if(onClick !=
null) {
115 label.addEventListener(Events.ON_CLICK, (Event event) -> {
116 onClick.accept((Contact) iee.getEntity());
119 rbox.appendChild(label);
120 rbox.appendChild(
new Label(Chars.forward().spaced().toString()));
121 Label l =
new Label(relation.getDue());
122 l.setSclass(
"relation");
129 public HtmlBasedComponent
getIcon(
boolean validated) {
131 a.setStyle(
"cursor:none;");
133 a.setIconSclass(
"z-icon-check");
135 a.setIconSclass(
"z-icon-times");
static IElephantEntity getController(String path)
static Label getSoftLabel(String value)