18 package org.turro.financials.contract.filter;
20 import org.turro.contacts.Contact;
21 import org.turro.contacts.filter.CityFilterField;
22 import org.turro.contacts.filter.GlobalIdentifierFilterField;
23 import org.turro.contacts.filter.ProvinceFilterField;
24 import org.turro.contacts.filter.ZipCodeFilterField;
25 import org.turro.contacts.util.ContactCombobox;
26 import org.turro.elephant.db.WhereClause;
27 import org.turro.financials.contract.ContractDefinitionCombobox;
28 import org.turro.zkoss.filter.FilterField;
29 import org.turro.zkoss.filter.FilterFieldOperator;
30 import org.turro.zkoss.filter.FilterGrid;
31 import org.zkoss.zk.ui.HtmlBasedComponent;
44 doAddConstraint(wc,
"ctc.name");
49 public void addConstraint(WhereClause wc) {
50 doAddConstraint(wc,
"ctc.id");
56 doAddConstraint(wc,
"ctc.active");
59 addField(
new FilterField(
"Contract model") {
61 protected HtmlBasedComponent createEditor() {
62 return new ContractDefinitionCombobox();
65 public void addConstraint(WhereClause wc) {
66 doAddConstraint(wc,
"ctc.contractDefinition");
69 addField(
new FilterField(
"Contact") {
71 protected HtmlBasedComponent createEditor() {
72 return new ContactCombobox();
75 protected Object getEditorValue() {
76 Contact c = ((ContactCombobox) editor).getContact();
77 return c ==
null ? null : c.getId();
80 public void addConstraint(WhereClause wc) {
81 doAddConstraint(wc,
"ctc.contractor");
86 public String getContactField() {
87 return "ctc.contractor";
92 public String getContactField() {
93 return "ctc.contractor";
98 public String getContactField() {
99 return "ctc.contractor";
102 addField(
new GlobalIdentifierFilterField() {
104 public String getContactField() {
105 return "ctc.contractor";
108 addField(
new FilterField(
"Contract alias",
"", FilterFieldOperator.FILTER_EQUAL) {
110 public void addConstraint(WhereClause wc) {
111 doAddConstraint(wc,
"ctc.globalId");
114 addField(
new FilterField(
"Notes",
"") {
116 public void addConstraint(WhereClause wc) {
117 doAddConstraint(wc,
"ctc.notes");
120 if(!loadPreferences(this.getClass().getName()+
"_filter")) {
121 addCurrentField(
"Name");
FilterField addField(FilterField filterField)