18 package org.turro.financials.contract;
20 import org.turro.string.Strings;
21 import org.turro.contacts.Address;
22 import org.turro.contacts.Contact;
23 import org.turro.contacts.zul.menu.ContactMenu;
24 import org.turro.elephant.security.IUser;
25 import org.turro.financials.model.contract.ContractDisagreements;
26 import org.turro.i18n.I_;
27 import org.turro.util.PhraseBuilder;
28 import org.turro.zkoss.grid.CollectionGrid;
29 import org.turro.zkoss.grid.EditableCell;
30 import org.zkoss.zk.ui.HtmlBasedComponent;
31 import org.zkoss.zk.ui.event.Event;
32 import org.zkoss.zk.ui.event.EventListener;
33 import org.zkoss.zk.ui.event.Events;
34 import org.zkoss.zul.A;
35 import org.zkoss.zul.Row;
66 A b =
new A(getDisagreementString(contact));
67 b.setImage(
"/_zul/images/contact.png");
68 b.addEventListener(Events.ON_CLICK,
new EventListener() {
70 public void onEvent(Event event)
throws Exception {
76 return super.createRenderer(editableCell);
86 private void addColumns() {
88 "fullName",
null, 0,
false,
false);
91 private String getDisagreementString(Contact contact) {
92 PhraseBuilder pb =
new PhraseBuilder();
94 pb.addWord(contact.getName());
95 if(Strings.isBlank(contact.getGlobalIdentifier())) {
96 pb.addWord(I_.get(
"Global identifier"),
"[]");
98 pb.addWord(contact.getGlobalIdentifier());
100 Address address = contact.getAddressMap().get(IUser.ADDRESS_FISCAL);
101 if(address ==
null) {
102 pb.addWord(I_.get(
"Address"),
"[]");
104 pb.addWord(address.getAddressString());
105 if(Strings.isBlank(address.getZipCode())) {
106 pb.addWord(I_.get(
"Zip code"),
"[]");
110 return pb.toString();
HtmlBasedComponent createRenderer(EditableCell editableCell)
ContractDisagreementsGrid()
boolean deleteRow(Row row)
boolean isValid(Contact v)
void initiateRow(Row row, Contact value)
static String get(String msg)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
void setReadOnly(boolean readOnly)