19 package org.turro.contacts.zul.proposal;
21 import java.util.List;
22 import org.turro.string.Strings;
23 import org.turro.contacts.Contact;
24 import org.turro.contacts.proposal.ContactProposal;
25 import org.turro.contacts.proposal.GenericAttribute;
26 import org.turro.contacts.proposal.IAttribute;
27 import org.turro.i18n.I_;
28 import org.turro.zul.frame.Framework;
29 import org.zkoss.zk.ui.Executions;
30 import org.zkoss.zk.ui.IdSpace;
31 import org.zkoss.zk.ui.event.Event;
32 import org.zkoss.zk.ui.event.Events;
33 import org.zkoss.zk.ui.select.Selectors;
34 import org.zkoss.zk.ui.select.annotation.Listen;
35 import org.zkoss.zk.ui.select.annotation.Wire;
36 import org.zkoss.zul.Button;
37 import org.zkoss.zul.Caption;
38 import org.zkoss.zul.Groupbox;
39 import org.zkoss.zul.Label;
40 import org.zkoss.zul.Vlayout;
41 import org.zkoss.zul.Window;
47 public class Duplicates extends Window implements IdSpace {
51 private boolean canSave =
true;
53 @Wire
private Vlayout posdups;
54 @Wire
private Button save, cancel;
57 this.contact = contact;
59 setTitle(
I_.
get(
"Posibles duplicates"));
61 Executions.createComponents(
"/WEB-INF/_zul/contact/duplicates.zul",
this,
null);
62 Selectors.wireComponents(
this,
this,
false);
63 Selectors.wireEventListeners(
this,
this);
86 save.setLabel(
I_.
get(
"Confirm saving"));
88 save.setVisible(
false);
90 cancel.setLabel(
I_.
get(
"Cancel"));
93 @Listen(
"onClick = #save")
96 Events.postEvent(
new Event(Events.ON_CLOSE,
this));
99 @Listen(
"onClick = #cancel")
102 Events.postEvent(
new Event(Events.ON_CLOSE,
this));
105 private void addAttributes() {
107 if(!ga.getRelated().isEmpty()) {
108 Groupbox gb =
new Groupbox();
109 posdups.appendChild(gb);
111 Caption gbc =
new Caption(ga.getAttributeName() +
": " + ga.getAsString());
114 Vlayout cvbox =
new Vlayout();
115 gb.appendChild(cvbox);
117 for(
IAttribute ia : (List<IAttribute>) ga.getRelated()) {
118 cvbox.appendChild(
new Label(
119 ia.getAsString() +
": " + ia.getContact().getName()
static String get(String msg)
static Framework getCurrent()