KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > communication > sms > component > UISmsMonitor


1 /**
2  * Copyright 2001-2004 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5 package org.exoplatform.portlets.communication.sms.component;
6
7 import java.io.IOException JavaDoc;
8 import java.util.ResourceBundle JavaDoc;
9
10 import javax.faces.component.UIOutput;
11 import javax.faces.context.FacesContext;
12 import org.exoplatform.faces.core.component.UIGrid;
13 import org.exoplatform.faces.core.component.model.Cell;
14 import org.exoplatform.faces.core.component.model.ComponentCell;
15 import org.exoplatform.faces.core.component.model.HeaderRow;
16 import org.exoplatform.faces.core.component.model.Row;
17 import org.exoplatform.services.communication.sms.SmsMonitorService;
18
19
20 /**
21  * @author Ove Ranheim (oranheim@yahoo.no)
22  * @since Jun 21, 2004 12:45:24 PM
23  */

24 public class UISmsMonitor extends UIGrid {
25
26     private SmsMonitorService _monitor;
27     private ResourceBundle JavaDoc _res;
28
29     private UIOutput _uiNumberOfSentMessages;
30     private UIOutput _uiNumberOfSuccessfulMessages;
31     private UIOutput _uiNumberOfFailedMessages;
32     private UIOutput _uiNumberOfErroneousMessages;
33
34     public UISmsMonitor(SmsMonitorService smsMonitorService, ResourceBundle JavaDoc res) {
35         super();
36         setId("UISmsMonitorForm");
37         setRendererType("SmsMonitorRenderer");
38         setClazz("UISmsForm");
39         _monitor = smsMonitorService;
40         _res = res;
41
42         _uiNumberOfSentMessages = new UIOutput();
43         _uiNumberOfSentMessages.setId("NumberOfSentMessages");
44         _uiNumberOfSuccessfulMessages = new UIOutput();
45         _uiNumberOfSuccessfulMessages.setId("NumberOfSuccessfulMessages");
46         _uiNumberOfFailedMessages = new UIOutput();
47         _uiNumberOfFailedMessages.setId("NumberOfFailedMessages");
48         _uiNumberOfErroneousMessages = new UIOutput();
49         _uiNumberOfErroneousMessages.setId("NumberOfErroneousMessages");
50         
51         //updateCounter();
52

53         add(new HeaderRow().
54             add(new Cell("SMS Monitor").
55             addColspan("2")));
56         add(new Row().
57             add(new Cell("Total number sent Messages").addClazz("counter-label")).
58             add(new ComponentCell(this, _uiNumberOfSentMessages)));
59         add(new Row().
60             add(new Cell("Successfull Messages").addClazz("counter-label")).
61             add(new ComponentCell(this, _uiNumberOfSuccessfulMessages)));
62         add(new Row().
63             add(new Cell("Failed Messages").addClazz("counter-label")).
64             add(new ComponentCell(this, _uiNumberOfFailedMessages)));
65         add(new Row().
66                 add(new Cell("Erroneous Messages").addClazz("counter-label")).
67                 add(new ComponentCell(this, _uiNumberOfErroneousMessages)));
68     }
69
70     public String JavaDoc getFamily() {
71         return "org.exoplatform.portlets.communication.sms.component.UISmsMonitor";
72     }
73     
74     public void updateCounter() {
75         _uiNumberOfSentMessages.setValue(_monitor.getCountMessages());
76         _uiNumberOfSuccessfulMessages.setValue(_monitor.getSuccessfullMessages());
77         _uiNumberOfFailedMessages.setValue(_monitor.getFailedMessages());
78         _uiNumberOfErroneousMessages.setValue(_monitor.getErroneousMessage());
79         
80     }
81
82 }
Popular Tags