BrightSide Workbench Full Report + Source Code
CustomerFilterGrid.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.crm.zul.customer;
20 
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.crm.zul.sector.ActivitySectorListbox;
26 import org.turro.crm.zul.sector.TechnologyListbox;
27 import org.turro.elephant.db.WhereClause;
28 import org.turro.zkoss.filter.FilterField;
29 import org.turro.zkoss.filter.FilterGrid;
30 import org.zkoss.zk.ui.HtmlBasedComponent;
31 
36 public class CustomerFilterGrid extends FilterGrid {
37 
38  public CustomerFilterGrid() {
39  super();
40  addField(new FilterField("Name", "") {
41  @Override
42  public void addConstraint(WhereClause wc) {
43  doAddConstraint(wc, "cust.name");
44  }
45  });
46  addField(new FilterField("Activity sector") {
47  @Override
48  protected HtmlBasedComponent createEditor() {
50  asl.setMold("select");
51  return asl;
52  }
53  @Override
54  public void addConstraint(WhereClause wc) {
55  doAddConstraint(wc, "actsec");
56  }
57  });
58  addField(new FilterField("Technology") {
59  @Override
60  protected HtmlBasedComponent createEditor() {
62  asl.setMold("select");
63  return asl;
64  }
65  @Override
66  public void addConstraint(WhereClause wc) {
67  doAddConstraint(wc, "tech");
68  }
69  });
70  addField(new FilterField("Customer sector") {
71  @Override
72  protected HtmlBasedComponent createEditor() {
74  asl.setMold("select");
75  return asl;
76  }
77  @Override
78  public void addConstraint(WhereClause wc) {
79  doAddConstraint(wc, "cussec");
80  }
81  });
83  @Override
84  public String getContactField() {
85  return "cust.idContact";
86  }
87  });
89  @Override
90  public String getContactField() {
91  return "cust.idContact";
92  }
93  });
95  @Override
96  public String getContactField() {
97  return "cust.idContact";
98  }
99  });
101  @Override
102  public String getContactField() {
103  return "cust.idContact";
104  }
105  });
106  if(!loadPreferences(this.getClass().getName()+"_filter")) {
107  addCurrentField("Name");
108  }
109  }
110 
111 }
FilterField addField(FilterField filterField)
Definition: FilterGrid.java:62
boolean loadPreferences(String preference)
FilterField addCurrentField(String label)
Definition: FilterGrid.java:67