BrightSide Workbench Full Report + Source Code
RequiredAptitudeListbox.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 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 package org.turro.erp.resource;
19 
20 import org.turro.elephant.context.Application;
21 import org.turro.elephant.util.DecimalFormats;
22 import org.turro.erp.entity.AptitudeDegree;
23 import org.turro.erp.entity.Resource;
24 import org.turro.zkoss.input.CollectionListbox;
25 import org.turro.zkoss.layout.ListheaderAdapter;
26 import org.turro.zkoss.layout.ListheaderRightAdapter;
27 import org.zkoss.zul.Listhead;
28 
33 public class RequiredAptitudeListbox extends CollectionListbox<AptitudeDegree> {
34 
35  private Resource resource;
36 
37  public Resource getResource() {
38  return resource;
39  }
40 
41  public void setResource(Resource resource) {
42  this.resource = resource;
44  }
45 
46  @Override
47  protected String convertToString(AptitudeDegree v) {
48  return v.getFullName() + ITEM_SEPARATOR +
51  }
52 
53  @Override
54  public void afterCompose() {
55  addHeaders();
56  super.afterCompose();
57  }
58 
59  private void addHeaders() {
60  if(getListhead() != null) return;
61  Listhead lh = new Listhead();
62  lh.setSizable(true);
63  lh.appendChild(new ListheaderAdapter(Application.getString("lAptitude"), "3"));
64  lh.appendChild(new ListheaderRightAdapter(Application.getString("lCost"), "1"));
65  lh.appendChild(new ListheaderRightAdapter(Application.getString("lPrice"), "1"));
66  appendChild(lh);
67  }
68 
69 }
70 
static String getString(String key)
static String format(Number value, String pattern)
Set< AptitudeDegree > getAptitudeDegrees()
Definition: Resource.java:98
void setCollection(Collection< V > collection)