BrightSide Workbench Full Report + Source Code
TouchPointGrid.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 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.touch;
20 
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import org.turro.crm.db.CrmPU;
24 import org.turro.crm.entity.TouchPoint;
25 import org.turro.crm.zul.sector.ActivitySectorGrid;
26 import org.turro.elephant.context.ElephantContext;
27 import org.turro.i18n.I_;
28 import org.turro.jpa.grid.JpaGrid;
29 import org.zkoss.zul.Row;
30 
35 public class TouchPointGrid extends JpaGrid<TouchPoint> {
36 
37  public TouchPointGrid() {
38  super(new CrmPU(),
39  "select tpoint from TouchPoint as tpoint " +
40  "order by tpoint.touchDegree, tpoint.name", true);
41  addColumns();
42  }
43 
44  @Override
45  protected void initiateRow(Row row, TouchPoint value) {
46  if(value == null) value = new TouchPoint();
47  row.setValue(value);
48  }
49 
50  @Override
51  protected boolean isValid(TouchPoint v) {
52  return v.isValid();
53  }
54 
55  public void addColumns() {
56  try {
57  addColumn(I_.get("Name"), String.class, "name", null, 0, false, false);
58  addColumn(I_.get("Degree"), "int", "touchDegree", null, 0, false, false).setWidth("150px");
59  addColumn(I_.get("Ends sale"), "boolean", "endsSale", null, 0, false, false).setWidth("150px");
60  addColumn(I_.get("Positive"), "boolean", "positive", null, 0, false, false).setWidth("150px");
61  } catch (ClassNotFoundException ex) {
62  Logger.getLogger(ActivitySectorGrid.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
63  }
64  }
65 
66 }
67 
void initiateRow(Row row, TouchPoint value)
static String get(String msg)
Definition: I_.java:41
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)