KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > component > UICommandPortlet


1 /***************************************************************************
2  * Copyright 2001-2003 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.faces.core.component;
6
7 import java.io.IOException JavaDoc;
8 import java.util.List JavaDoc;
9
10 import javax.faces.application.FacesMessage;
11 import javax.faces.context.FacesContext;
12 import org.exoplatform.faces.core.component.model.Information;
13
14 /**
15  * Jun 2, 2004
16  * @author: Tuan Nguyen
17  * @email: tuan08@users.sourceforge.net
18  * @version: $ID$
19  **/

20 public class UICommandPortlet extends UICommandNode implements InformationProvider {
21     private Information information_ = new Information() ;
22     private int displayMessageType_ = FOOTER_MESSAGE_TYPE ;
23     
24     public int getDisplayMessageType() { return displayMessageType_ ; }
25     public void setDisplayMessageType(int type) { displayMessageType_ = type ; }
26     public void addMessage(FacesMessage message) { information_.addMessage(message); }
27     public void clearMessages() { information_.clearMessages() ;}
28   public List JavaDoc getMessages() { return information_.getMessages() ; }
29     public boolean hasMessage() { return information_.hasMessage() ; }
30   
31   public void encodeChildren(FacesContext context) throws IOException JavaDoc {
32     if(information_.hasMessage()) {
33       if(displayMessageType_ == BODY_MESSAGE_TYPE) {
34         Information.renderBodyInformation(context, this) ;
35         return ;
36       }
37     }
38     super.encodeChildren(context);
39     if(information_.hasMessage()) {
40       if(displayMessageType_ == FOOTER_MESSAGE_TYPE) {
41         Information.renderFooterInformation(context, this) ;
42         return ;
43       }
44     }
45   }
46 }
Popular Tags