BrightSide Workbench Full Report + Source Code
GanttResourceData.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.zkoss.svg;
20 
21 import java.util.TreeSet;
22 
27 public class GanttResourceData extends TreeSet<GanttResourceItem> {
28 
29  public static final int
31  CHAR_PIXELS = 8;
32 
33  public int getMaxNameLenght() {
34  int maxLenght = 0;
35  for(GanttResourceItem gi : this) {
36  maxLenght = Math.max(gi.getName().length(), maxLenght);
37  }
38  return Math.min(maxLenght, MAX_NAME_LENGTH);
39  }
40 
41  public double getMaxHoursLenght() {
42  double maxLenght = 0.0;
43  for(GanttResourceItem gi : this) {
44  maxLenght = Math.max(gi.getExpected() + gi.getVariable(), maxLenght);
45  }
46  return maxLenght;
47  }
48 
49  public GanttResourceItem getItem(String index) {
50  for(GanttResourceItem gi : this) {
51  if(gi.getUniqueId().equals(index)) {
52  return gi;
53  }
54  }
55  return null;
56  }
57 
58 }
GanttResourceItem getItem(String index)