BrightSide Workbench Full Report + Source Code
SummaryView.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.plugin.command;
20 
21 import java.util.Collection;
22 import org.turro.plugin.contacts.IContact;
23 import org.zkoss.zk.ui.Component;
24 import org.zkoss.zk.ui.ext.AfterCompose;
25 import org.zkoss.zul.Borderlayout;
26 import org.zkoss.zul.Center;
27 import org.zkoss.zul.Vlayout;
28 import org.zkoss.zul.Window;
29 
34 public class SummaryView extends Window implements AfterCompose {
35 
36  private IContact iContact;
37  private String summary;
38 
39  public void setIContact(IContact iContact) {
40  this.iContact = iContact;
41  }
42 
43  public void setSummary(String summary) {
44  this.summary = summary;
45  }
46 
47  @Override
48  public void afterCompose() {
49  if(iContact != null && iContact.isValid()) {
50  Collection comps = SummaryPlugin
51  .getSummaryFor(iContact, summary);
52  if(comps != null) {
53  setVflex("true");
54  Borderlayout bl = new Borderlayout();
55  appendChild(bl);
56  bl.setWidth("100%");
57  bl.setHeight("100%");
58  Center c = new Center();
59  bl.appendChild(c);
60  c.setBorder("none");
61  c.setAutoscroll(true);
62  Vlayout vbox = new Vlayout();
63  c.appendChild(vbox);
64  for(Object comp : comps) {
65  if(comp instanceof Component) {
66  vbox.appendChild((Component) comp);
67  }
68  }
69  }
70  }
71  }
72 
73 }
74 
static Collection< Object > getSummaryFor(IContact contact, String name)
void setIContact(IContact iContact)