18 package org.turro.financials.contract;
20 import org.turro.string.Strings;
21 import org.turro.contacts.zul.label.ContactInfo;
22 import org.turro.elephant.util.Images;
23 import org.turro.financials.entity.Contract;
24 import org.turro.financials.entity.ContractParticipant;
25 import org.turro.i18n.I_;
26 import org.turro.zkoss.label.LabelExtended;
27 import org.turro.zkoss.label.LabelTypes;
28 import org.turro.zul.frame.Framework;
29 import org.zkoss.zk.ui.event.Event;
30 import org.zkoss.zk.ui.event.EventListener;
31 import org.zkoss.zk.ui.event.Events;
32 import org.zkoss.zk.ui.ext.AfterCompose;
33 import org.zkoss.zul.A;
34 import org.zkoss.zul.Hlayout;
35 import org.zkoss.zul.Image;
36 import org.zkoss.zul.Popup;
37 import org.zkoss.zul.Vlayout;
46 private boolean onlyIcon;
49 this.contract = contract;
61 this.contract = contract;
70 this.onlyIcon = onlyIcon;
80 private void addClickListener() {
81 addEventListener(Events.ON_CLICK,
new EventListener() {
83 public void onEvent(Event event)
throws Exception {
89 private void fillContactPopup() {
90 if(contract ==
null) {
94 Popup popup = Framework.getCurrent().getGlobalPopup();
96 Vlayout vbox =
new Vlayout();
97 vbox.setStyle(
"font-size:11px");
98 popup.appendChild(vbox);
103 vbox.appendChild(LabelTypes.getSoftLabel(I_.get(
"Global identifier") +
": " + contract.
getGlobalId()));
109 vbox.appendChild(LabelTypes.getSoftLabel(I_.get(
"Service") +
": " + contract.
getService().
getFullName()));
113 ci.setSclass(
"softLabel");
114 vbox.appendChild(ci);
116 if(contract.
getFee() > 0) {
117 Hlayout hbox =
new Hlayout();
118 hbox.appendChild(
new LabelExtended().setDouble(contract.
getFee()));
119 hbox.appendChild(
new LabelExtended().setEnum(contract.
getPeriodicity()));
120 vbox.appendChild(hbox);
122 if(!Strings.isBlank(contract.
getNotes())) {
123 vbox.appendChild(LabelTypes.getPreLabel(contract.
getNotes()));
126 Hlayout hbox =
new Hlayout();
127 ContactInfo ci =
new ContactInfo(cp.getIdContact());
128 ci.setSclass(
"softLabel");
129 hbox.appendChild(ci);
130 hbox.appendChild(
new LabelExtended().setEnum(cp.getInterventionType()));
131 if(cp.isSendDocuments()) {
132 hbox.appendChild(
new Image(Images.getImage(
"mail_send")));
134 vbox.appendChild(hbox);
136 if(!vbox.getChildren().isEmpty()) popup.open(
this);
139 private void updateLabel() {
140 if(contract !=
null) {
143 setImage(Images.getImage(
"contract"));
146 setImage(Images.getImage(
"info"));
150 setImage(Images.getImage(
"info"));
void setContract(Contract contract)
ContractInfo(Contract contract)
void setOnlyIcon(boolean onlyIcon)
Periodicity getPeriodicity()
Set< ContractParticipant > getParticipants()
Department getDepartment()
ContractDefinition getContractDefinition()
String getFullDescription()