19 package org.turro.contacts.form;
21 import java.util.Date;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import org.turro.collections.KeyValueMap;
25 import org.turro.contacts.BusinessRelation;
26 import org.turro.contacts.Contact;
27 import org.turro.contacts.ContactType;
28 import org.turro.contacts.organigram.RelationType;
29 import org.turro.contacts.zul.organigram.OrganigramListbox;
30 import org.turro.elephant.context.ElephantContext;
31 import org.turro.entities.EntityCombobox;
32 import org.turro.i18n.I_;
33 import org.turro.jpa.entity.EntityCollections;
34 import org.turro.plugin.contacts.ContactRelations;
35 import org.turro.zkoss.grid.CollectionGrid;
36 import org.turro.zkoss.grid.EditableCell;
37 import org.zkoss.zk.ui.HtmlBasedComponent;
38 import org.zkoss.zk.ui.ext.AfterCompose;
39 import org.zkoss.zk.ui.util.Clients;
40 import org.zkoss.zul.Row;
51 this.contact = contact;
100 return super.createEditor(editableCell);
115 return super.getEditorValue(editableCell);
121 return ((
Contact) value).getFullName();
127 return super.formatCell(editableCell, value);
133 super.afterCompose();
136 private void addColumns() {
140 "business",
null, 0,
false,
false).setHflex(
"2");
142 "relationType",
null, 0,
false,
false).setHflex(
"2");
144 "description",
null, 0,
false,
false).setHflex(
"2");
146 "startDate",
null, 0,
true,
false).setHflex(
"1");
148 "endDate",
null, 0,
true,
false).setHflex(
"1");
150 "preferential",
null, 0,
false,
false).setHflex(
"1");
152 "validated",
null, 0,
false,
false).setHflex(
"1");
153 }
catch (ClassNotFoundException ex) {
158 private boolean checkBusiness(Object business) {
159 if(business instanceof Contact) {
160 boolean right = contact.
getId() ==
null || ContactRelations.checkBusiness(contact.
getId(), ((Contact) business).getId());
161 if(!right) Clients.showNotification(I_.get(
"Wrong relation"));
static String logMsg(String msg)
void setParameters(KeyValueMap kvm)
void setRoot(String root)
static String byKey(String key)
static String get(String msg)
static EntityCollections entities(Collection values)
void setCollection(Collection< V > collection)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
Object getCellValue(EditableCell editableCell)