18 package org.turro.financials.business;
20 import java.util.Iterator;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import org.turro.string.Strings;
24 import org.turro.action.Contacts;
25 import org.turro.contacts.Contact;
26 import org.turro.contacts.util.ContactCombobox;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.financials.db.FinancialsPU;
29 import org.turro.financials.entity.Company;
30 import org.turro.financials.entity.Department;
31 import org.turro.financials.entity.Headquarters;
32 import org.turro.financials.entity.Service;
33 import org.turro.i18n.I_;
34 import org.turro.jpa.grid.JpaGrid;
35 import org.turro.plugin.contacts.IContact;
36 import org.turro.zkoss.grid.EditableCell;
37 import org.zkoss.zk.ui.HtmlBasedComponent;
38 import org.zkoss.zul.Row;
48 "select company from Company as company " +
49 "order by company.name",
false);
57 Iterator<Service> its = c.getServices().iterator();
58 while(its.hasNext()) {
60 if(Strings.isBlank(s.
getName())) {
64 Iterator<Headquarters> ith = c.getHeadquarters().iterator();
65 while(ith.hasNext()) {
71 while(itd.hasNext()) {
73 if(Strings.isBlank(d.
getName())) {
85 if(value ==
null) value =
new Company();
92 return !Strings.isBlank(v.
getName());
103 return super.createEditor(editableCell);
109 HtmlBasedComponent hbc = (HtmlBasedComponent) editableCell.
getEditor();
119 return super.getEditorValue(editableCell);
131 return super.formatCell(editableCell, value);
134 private void addColumns() {
138 "idContact",
null, 0,
false,
false).setImage(
"/_zul/images/b_company.png");
140 "structureMargin",
"0.00", 1,
false,
false).setWidth(
"160px");
142 "profitMargin",
"0.00", 1,
false,
false).setWidth(
"160px");
144 "alwaysApply",
null, 0,
false,
false).setWidth(
"160px");
145 }
catch (ClassNotFoundException ex) {
146 Logger.getLogger(
CompanyGrid.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
150 private void addDetail(Row row) {
151 row.getChildren().clear();
152 CompanyDetail detail =
new CompanyDetail(row,
this);
153 row.appendChild(detail);
Object getEditorValue(EditableCell editableCell)
boolean isValid(Company v)
void initiateRow(Row row, Company value)
HtmlBasedComponent createEditor(EditableCell editableCell)
String formatCell(EditableCell editableCell, Object value)
Set< Department > getDepartments()
static String get(String msg)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
Object getCellValue(EditableCell editableCell)
void setDefaultBehavior(boolean defaultBehavior)