BrightSide Workbench Full Report + Source Code
org.turro.contacts.zul.control.ContactFinder Class Reference
Inheritance diagram for org.turro.contacts.zul.control.ContactFinder:
Collaboration diagram for org.turro.contacts.zul.control.ContactFinder:

Public Member Functions

ContactFieldList getFields ()
 
Contact getObjectValue ()
 
void setObjectValue (Contact v)
 
- Public Member Functions inherited from org.turro.zkoss.input.GenericBandbox< V >
Bandpopup getBandPopup ()
 
boolean isFilled ()
 
void afterCompose ()
 
abstract void setObjectValue (V v)
 

Protected Member Functions

void fillPopup ()
 
- Protected Member Functions inherited from org.turro.zkoss.input.GenericBandbox< V >
void setPopupComponent (Component component)
 
void setBandText (String text)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.zkoss.input.GenericBandbox< V >
value
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 42 of file ContactFinder.java.

Member Function Documentation

◆ fillPopup()

void org.turro.contacts.zul.control.ContactFinder.fillPopup ( )
protected

Reimplemented from org.turro.zkoss.input.GenericBandbox< V >.

Definition at line 53 of file ContactFinder.java.

53  {
54  if(!isFilled()) {
55  getBandPopup().setHeight("300px");
56  getBandPopup().setWidth("400px");
57  setAutodrop(true);
58  Vlayout vbox = new Vlayout();
59  vbox.setVflex("true");
60  contacts.setVflex(true);
61  contacts.setSelectFirst(false);
62  vbox.appendChild(contacts);
63  addEventListener(Events.ON_CHANGING, new EventListener() {
64  @Override
65  public void onEvent(Event event) throws Exception {
66  try {
67  typing = true;
68  contacts.setPartialName(((InputEvent) event).getValue());
69  } finally {
70  typing = false;
71  }
72  }
73  });
74  contacts.afterCompose();
75  contacts.addEventListener(Events.ON_SELECT, new EventListener() {
76  @Override
77  public void onEvent(Event event) {
78  if(!typing && getObjectValue() != null) {
79  Events.postEvent(new Event(Events.ON_CHANGE, ContactFinder.this));
80  ContactFinder.this.close();
81  }
82  }
83  });
84  if(Application.getApplication().isInRole("contact:new")) {
85  Hbox butCont = new Hbox();
86  butCont.setSclass("buttonDialogContainer");
87  butCont.setHflex("true");
88  butCont.setPack("end");
89  butCont.setStyle("padding:10px");
90  butCont.setSpacing("15px");
91  Button newContact = new Button(I_.get("New contact"));
92  newContact.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
93  @Override
94  public void onEvent(Event event) throws Exception {
95  if(fields.isEmpty()) {
96  fields.createMinimumContact();
97  }
98  ContactForm.newContact(fields, new Command() {
99  @Override
100  public Object execute(Context context) {
101  Contact contact = (Contact) context.get("contact");
102  if(contact != null) {
103  if(contacts.getCollection() == null) {
104  contacts.setCollection(new ArrayList<Contact>());
105  }
106  contacts.getCollection().add(contact);
107  contacts.updateCollection();
108  setObjectValue(contact);
109  }
110  return null;
111  }
112  });
113  }
114  });
115  butCont.appendChild(newContact);
116  vbox.appendChild(butCont);
117  }
118  setPopupComponent(vbox);
119  }
120  }
void setPopupComponent(Component component)
void setSelectFirst(boolean selectFirst)
Here is the call graph for this function:

◆ getFields()

ContactFieldList org.turro.contacts.zul.control.ContactFinder.getFields ( )

Definition at line 48 of file ContactFinder.java.

48  {
49  return fields;
50  }

◆ getObjectValue()

Contact org.turro.contacts.zul.control.ContactFinder.getObjectValue ( )

Reimplemented from org.turro.zkoss.input.GenericBandbox< V >.

Definition at line 123 of file ContactFinder.java.

123  {
124  Contact v = contacts.getObjectValue();
125  if(v != null) {
126  setBandText(v.getName());
127  } else {
128  setBandText("");
129  }
130  return v;
131  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setObjectValue()

void org.turro.contacts.zul.control.ContactFinder.setObjectValue ( Contact  v)

Definition at line 134 of file ContactFinder.java.

134  {
135  contacts.setObjectValue(v);
136  if(v != null) {
137  setBandText(v.getName());
138  } else {
139  setBandText("");
140  }
141  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: