BrightSide Workbench Full Report + Source Code
org.turro.valuation.ValuesGrid Class Reference
Inheritance diagram for org.turro.valuation.ValuesGrid:
Collaboration diagram for org.turro.valuation.ValuesGrid:

Public Member Functions

ValuationModel getValuationModel ()
 
void setModes (Collection< MarginOverCostMode > marginModes, Collection< PropossedPriceMode > priceModes)
 
void setShowUnits (boolean showUnits)
 
void refreshRows ()
 
- Public Member Functions inherited from org.turro.zkoss.grid.PagingGrid
void setColumns (int columns)
 
void setColumns (String hflexs)
 
void refine ()
 
boolean isDefaultBehavior ()
 
void setDefaultBehavior (boolean defaultBehavior)
 
String getRefineValue ()
 
void setRefineValue (String value)
 
int getMaxResults ()
 
void setMaxResults (int maxResults)
 
String getPagingMold ()
 
void setPagingMold (String pagingMold)
 
int getRowCount ()
 
void setRowCount (int rows)
 
void setHeadersVisible (boolean value)
 
boolean isHeadersVisible ()
 
String getVarColumns ()
 
void setVarColumns (String varColumns)
 
Collection< String > getVarColumnsList (String defaultCols)
 
void addDetailColumn ()
 
void addDetailColumn (HtmlBasedComponent caption)
 
void openDetails ()
 
boolean isEmpty ()
 
void clearColumns ()
 
void clearRows ()
 
void clearEmptyGroups ()
 
Columns getColumns (boolean create)
 
Rows getRows (boolean create)
 
Foot getFoot (boolean create)
 
Foot createFoot ()
 
void exportToPdf ()
 

Protected Member Functions

void addRows ()
 
void refreshValue (Row row, final ValuationItem value)
 
void refreshFoot (Foot foot)
 
void addColumns ()
 
String getBreakdownImage (ValuationItem value)
 
void changeBreakdownState (ValuationItem value)
 
boolean isShowBreakdown (ValuationItem value)
 
boolean isVisible (ValuationItem value)
 

Protected Attributes

ValuationModel model
 
String currencyFormat = "#0.00"
 
boolean showUnits = false
 
ArrayList< XulElement > unitHeads = new ArrayList<XulElement>()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 42 of file ValuesGrid.java.

Member Function Documentation

◆ addColumns()

void org.turro.valuation.ValuesGrid.addColumns ( )
protected

Definition at line 231 of file ValuesGrid.java.

231  {
232  Auxhead ah = new Auxhead();
233  appendChild(ah);
234 
235  Auxheader ahr = new Auxheader();
236  ah.appendChild(ahr);
237 
238  ahr = new Auxheader(I_.get("Units"));
239  ahr.setAlign("center");
240  ahr.setColspan(3);
241  ah.appendChild(ahr);
242  unitHeads.add(ahr);
243 
244  ahr = new Auxheader(I_.get("Cost"));
245  ahr.setAlign("center");
246  ahr.setColspan(2);
247  ah.appendChild(ahr);
248 
249  ahr = new Auxheader(I_.get("Price"));
250  ahr.setAlign("center");
251  ahr.setColspan(5);
252  ah.appendChild(ahr);
253 
254  Columns cols = new Columns();
255  cols.setSizable(true);
256  appendChild(cols);
257 
258  Column col = new Column();
259  col.setLabel("");
260  cols.appendChild(col);
261 
262  col = new Column();
263  col.setLabel(I_.get("Expressed"));
264  col.setAlign("right");
265  col.setWidth("100px");
266  cols.appendChild(col);
267  unitHeads.add(col);
268 
269  col = new Column();
270  col.setLabel(I_.get("Estimated"));
271  col.setAlign("right");
272  col.setWidth("100px");
273  cols.appendChild(col);
274  unitHeads.add(col);
275 
276  col = new Column();
277  col.setLabel(I_.get("Real"));
278  col.setAlign("right");
279  col.setWidth("100px");
280  cols.appendChild(col);
281  unitHeads.add(col);
282 
283  col = new Column();
284  col.setLabel(I_.get("Estimated"));
285  col.setAlign("right");
286  col.setWidth("100px");
287  cols.appendChild(col);
288 
289  col = new Column();
290  col.setLabel(I_.get("Real"));
291  col.setAlign("right");
292  col.setWidth("100px");
293  cols.appendChild(col);
294 
295  col = new Column();
296  col.setLabel(I_.get("Estimated"));
297  col.setAlign("right");
298  col.setWidth("100px");
299  cols.appendChild(col);
300 
301  col = new Column();
302  col.setLabel(I_.get("Real"));
303  col.setAlign("right");
304  col.setWidth("100px");
305  cols.appendChild(col);
306 
307  col = new Column();
308  col.setLabel(I_.get("Final"));
309  //col.setAlign("right");
310  col.setWidth("140px");
311  cols.appendChild(col);
312 
313  col = new Column();
314  col.setLabel(I_.get("Profit margin"));
315  col.setAlign("right");
316  col.setWidth("100px");
317  cols.appendChild(col);
318 
319  col = new Column();
320  col.setLabel(I_.get("Market"));
321  col.setAlign("right");
322  col.setWidth("100px");
323  cols.appendChild(col);
324 
325  Foot foot = createFoot();
326 
327  Footer footer = new Footer();
328  foot.appendChild(footer);
329 
330  footer = new Footer();
331  footer.setAlign("right");
332  foot.appendChild(footer);
333  unitHeads.add(footer);
334 
335  footer = new Footer();
336  footer.setAlign("right");
337  foot.appendChild(footer);
338  unitHeads.add(footer);
339 
340  footer = new Footer();
341  footer.setAlign("right");
342  foot.appendChild(footer);
343  unitHeads.add(footer);
344 
345  footer = new Footer();
346  footer.setAlign("right");
347  foot.appendChild(footer);
348 
349  footer = new Footer();
350  footer.setAlign("right");
351  foot.appendChild(footer);
352 
353  footer = new Footer();
354  footer.setAlign("right");
355  foot.appendChild(footer);
356 
357  footer = new Footer();
358  footer.setAlign("right");
359  foot.appendChild(footer);
360 
361  footer = new Footer();
362  footer.setAlign("right");
363  foot.appendChild(footer);
364 
365  footer = new Footer();
366  footer.setAlign("right");
367  foot.appendChild(footer);
368 
369  footer = new Footer();
370  footer.setAlign("right");
371  foot.appendChild(footer);
372 
374  }
ArrayList< XulElement > unitHeads
Definition: ValuesGrid.java:48
void setShowUnits(boolean showUnits)
Definition: ValuesGrid.java:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addRows()

void org.turro.valuation.ValuesGrid.addRows ( )
protected

Definition at line 67 of file ValuesGrid.java.

67  {
68  Rows rows = getRows(true);
69  rows.getChildren().clear();
70 
71  for(Value value : model.getRootValues()) {
72  processValue(value);
73  }
74 
75  refreshRows();
76 
77  setRowCount(rows.getChildren().size());
78  }
Rows getRows(boolean create)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeBreakdownState()

void org.turro.valuation.ValuesGrid.changeBreakdownState ( ValuationItem  value)
protected

Definition at line 384 of file ValuesGrid.java.

384  {
385  if(value.getData() instanceof NodeData) {
386  ((NodeData) value.getData()).changeState();
387  }
388  }
Here is the caller graph for this function:

◆ getBreakdownImage()

String org.turro.valuation.ValuesGrid.getBreakdownImage ( ValuationItem  value)
protected

Definition at line 376 of file ValuesGrid.java.

376  {
377  if(isShowBreakdown(value)) {
378  return "/_zul/images/breakdown-open.png";
379  } else {
380  return "/_zul/images/breakdown-closed.png";
381  }
382  }
boolean isShowBreakdown(ValuationItem value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getValuationModel()

ValuationModel org.turro.valuation.ValuesGrid.getValuationModel ( )

Definition at line 50 of file ValuesGrid.java.

50  {
51  return model;
52  }

◆ isShowBreakdown()

boolean org.turro.valuation.ValuesGrid.isShowBreakdown ( ValuationItem  value)
protected

Definition at line 390 of file ValuesGrid.java.

390  {
391  if(value.getData() instanceof NodeData) {
392  return ((NodeData) value.getData()).showBreakdown;
393  }
394  return true;
395  }
Here is the caller graph for this function:

◆ isVisible()

boolean org.turro.valuation.ValuesGrid.isVisible ( ValuationItem  value)
protected

Definition at line 397 of file ValuesGrid.java.

397  {
398  Value tmp = value.getParent();
399  while(tmp != null) {
400  if(tmp.getData() instanceof NodeData) {
401  if(!((NodeData) tmp.getData()).showBreakdown) {
402  return false;
403  }
404  }
405  tmp = tmp.getParent();
406  }
407  return true;
408  }
Here is the caller graph for this function:

◆ refreshFoot()

void org.turro.valuation.ValuesGrid.refreshFoot ( Foot  foot)
protected

Definition at line 217 of file ValuesGrid.java.

217  {
218  foot.setSclass("valuation-foot-row");
219  ((Footer) foot.getChildren().get(1)).setLabel(DecimalFormats.format(model.getExpressedUnits(), unitFormat));
220  ((Footer) foot.getChildren().get(2)).setLabel(DecimalFormats.format(model.getEstimatedUnits(), unitFormat));
221  ((Footer) foot.getChildren().get(3)).setLabel(DecimalFormats.format(model.getRealUnits(), unitFormat));
222  ((Footer) foot.getChildren().get(4)).setLabel(DecimalFormats.format(model.getEstimatedCost(), currencyFormat));
223  ((Footer) foot.getChildren().get(5)).setLabel(DecimalFormats.format(model.getRealCost(), currencyFormat));
224  ((Footer) foot.getChildren().get(6)).setLabel(DecimalFormats.format(model.getEstimatedPrice(), currencyFormat));
225  ((Footer) foot.getChildren().get(7)).setLabel(DecimalFormats.format(model.getRealPrice(), currencyFormat));
226  ((Footer) foot.getChildren().get(8)).setLabel(DecimalFormats.format(model.getAsModePrice(), currencyFormat));
227  ((Footer) foot.getChildren().get(9)).setLabel(DecimalFormats.formatPercent(model.getRealMargin()));
228  ((Footer) foot.getChildren().get(10)).setLabel(DecimalFormats.format(model.getMarketPrice(), currencyFormat));
229  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshRows()

void org.turro.valuation.ValuesGrid.refreshRows ( )

Definition at line 101 of file ValuesGrid.java.

101  {
102  for(Object row : getRows().getChildren()) {
103  if(row instanceof Row) {
104  if(((Row) row).getValue() instanceof ValuationItem) {
105  refreshValue((Row) row, (ValuationItem) ((Row) row).getValue());
106  }
107  }
108  }
109  refreshFoot(getFoot());
110  }
void refreshValue(Row row, final ValuationItem value)
Foot getFoot(boolean create)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshValue()

void org.turro.valuation.ValuesGrid.refreshValue ( Row  row,
final ValuationItem  value 
)
protected

Definition at line 112 of file ValuesGrid.java.

112  {
113  row.getChildren().clear();
114 
115  final EnumSet<ResourceStatus> status = value.getStatus();
116 
117  row.setVisible(isVisible(value));
118  row.setSclass(value.getType() + "-row");
119 
120  Hlayout hbox = new Hlayout();
121  Space s = new Space();
122  s.setWidth(value.getLevel() * 15 + "px");
123  hbox.appendChild(s);
124 
125  if(value instanceof Value) {
126  Toolbarbutton breakdown = new Toolbarbutton();
127  breakdown.setImage(getBreakdownImage(value));
128  breakdown.addEventListener(Events.ON_CLICK, new EventListener() {
129  @Override
130  public void onEvent(Event event) throws Exception {
131  changeBreakdownState(value);
132  refreshRows();
133  }
134  });
135  hbox.appendChild(breakdown);
136  }
137  hbox.appendChild(new Image("/_zul/images/" + value.getType() + ".png"));
138  hbox.appendChild(new LabelTip(value.getName()));
139  if(value.getUsage() != null) {
140  hbox.appendChild(new Space());
141  hbox.appendChild(new Image("/_zul/images/" + value.getUsage().getType() + ".png"));
142  hbox.appendChild(new LabelTip(value.getUsage().getName()));
143  }
144  row.appendChild(hbox);
145 
146  if(value instanceof Value) {
147  if(((Value) value).getExpressedUnits() == 0.0d) {
148  row.appendChild(new Space());
149  } else {
150  row.appendChild(new Label(DecimalFormats.format(((Value) value).getExpressedUnits(), unitFormat)));
151  }
152  } else {
153  row.appendChild(new Space());
154  }
155 
156  row.appendChild(new Label(DecimalFormats.format(value.getEstimatedUnits(), unitFormat)));
157 
158  row.appendChild(new Label(DecimalFormats.format(value.getRealUnits(), unitFormat)));
159 
160  row.appendChild(new AbstractLabel(DecimalFormats.format(value.getEstimatedCost(), currencyFormat)) {
161  @Override
162  protected void doSomething() {
163  if(status.contains(ResourceStatus.RESOURCE_NO_ESTIMATED_COST)) {
164  setSclass("warnLabel");
165  final Component comp = this;
166  addEventListener(Events.ON_CLICK, new EventListener() {
167  @Override
168  public void onEvent(Event event) throws Exception {
169  showTooltip(comp, value);
170  }
171  });
172  }
173  }
174  });
175 
176  row.appendChild(new AbstractLabel(DecimalFormats.format(value.getRealCost(), currencyFormat)) {
177  @Override
178  protected void doSomething() {
179  if(status.contains(ResourceStatus.RESOURCE_NO_COST)) {
180  setSclass("warnLabel");
181  final Component comp = this;
182  addEventListener(Events.ON_CLICK, new EventListener() {
183  @Override
184  public void onEvent(Event event) throws Exception {
185  showTooltip(comp, value);
186  }
187  });
188  }
189  }
190  });
191 
192  row.appendChild(new Label(DecimalFormats.format(value.getEstimatedPrice(), currencyFormat)));
193 
194  row.appendChild(new Label(DecimalFormats.format(value.getRealPrice(), currencyFormat)));
195 
196  row.appendChild(getFinalPriceCell(value, status));
197 
198  row.appendChild(new AbstractLabel(DecimalFormats.formatPercent(value.getRealMargin())) {
199  @Override
200  protected void doSomething() {
201  if(status.contains(ResourceStatus.RESOURCE_UNDER_MARGIN)) {
202  setSclass("warnLabel");
203  final Component comp = this;
204  addEventListener(Events.ON_CLICK, new EventListener() {
205  @Override
206  public void onEvent(Event event) throws Exception {
207  showTooltip(comp, value);
208  }
209  });
210  }
211  }
212  });
213 
214  row.appendChild(new Label(DecimalFormats.format(value.getMarketPrice(), currencyFormat)));
215  }
boolean isVisible(ValuationItem value)
void changeBreakdownState(ValuationItem value)
String getBreakdownImage(ValuationItem value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setModes()

void org.turro.valuation.ValuesGrid.setModes ( Collection< MarginOverCostMode >  marginModes,
Collection< PropossedPriceMode >  priceModes 
)

Definition at line 54 of file ValuesGrid.java.

54  {
55  model.setMarginModes(marginModes);
56  model.setPriceModes(priceModes);
57  refreshRows();
58  }
Here is the call graph for this function:

◆ setShowUnits()

void org.turro.valuation.ValuesGrid.setShowUnits ( boolean  showUnits)

Definition at line 60 of file ValuesGrid.java.

60  {
61  this.showUnits = showUnits;
62  for(XulElement xe : unitHeads) {
63  xe.setVisible(showUnits);
64  }
65  }
Here is the caller graph for this function:

Member Data Documentation

◆ currencyFormat

String org.turro.valuation.ValuesGrid.currencyFormat = "#0.00"
protected

Definition at line 45 of file ValuesGrid.java.

◆ model

ValuationModel org.turro.valuation.ValuesGrid.model
protected

Definition at line 44 of file ValuesGrid.java.

◆ showUnits

boolean org.turro.valuation.ValuesGrid.showUnits = false
protected

Definition at line 47 of file ValuesGrid.java.

◆ unitHeads

ArrayList<XulElement> org.turro.valuation.ValuesGrid.unitHeads = new ArrayList<XulElement>()
protected

Definition at line 48 of file ValuesGrid.java.


The documentation for this class was generated from the following file: