BrightSide Workbench Full Report + Source Code
HandshakeSelfSummary.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 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.financials.command;
20 
21 import org.turro.elephant.context.Application;
22 import org.turro.elephant.util.Images;
23 import org.turro.financials.handshake.HandshakeList;
24 import org.turro.i18n.I_;
25 import org.turro.menu.ElephantMenu;
26 import org.turro.plugin.command.SelfSummaryPlugin;
27 import org.turro.zkoss.label.LabelTypes;
28 import org.turro.zkoss.layout.GroupboxArrow;
29 import org.zkoss.zk.ui.event.Event;
30 import org.zkoss.zk.ui.event.EventListener;
31 import org.zkoss.zk.ui.event.Events;
32 import org.zkoss.zul.Button;
33 import org.zkoss.zul.Hlayout;
34 import org.zkoss.zul.Image;
35 
41 
42  @Override
43  protected void executePlugin() {
45  if(app.isInRole("document:list")) {
46  int pending = HandshakeList.count();
47  if(pending > 0) {
48  GroupboxArrow gba = new GroupboxArrow() {
49  @Override
50  protected void doFillContent() {
51  }
52  };
53  Hlayout hbox = new Hlayout();
54  gba.setCaption(hbox);
55  hbox.setSclass("z-valign-middle");
56  hbox.setValign("middle");
57  hbox.appendChild(new Image(Images.getImage("handshake")));
58  hbox.appendChild(LabelTypes.getSoftLabel(I_.get("Handshakes") + ":"));
59  hbox.appendChild(LabelTypes.getPreLabel(pending + ""));
60  Button visit = new Button(I_.get("Handshakes"));
61  visit.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
62  @Override
63  public void onEvent(Event event) throws Exception {
64  ElephantMenu.showZulFile("Handshakes", "/financials/handshake/queue.zul");
65  }
66  });
67  hbox.appendChild(visit);
68  gba.setOpen(false);
69  addResult("handshake", gba);
70  }
71  }
72  }
73 
74 }
Object addResult(String key, Object value)
static String getImage(String image)
Definition: Images.java:36
static String get(String msg)
Definition: I_.java:41
static Label getPreLabel(String value)
Definition: LabelTypes.java:52
static Label getSoftLabel(String value)
Definition: LabelTypes.java:28