1 5 package org.exoplatform.faces.core.component; 6 7 import java.io.IOException ; 8 import java.util.List ; 9 10 import javax.faces.application.FacesMessage; 11 import javax.faces.context.FacesContext; 12 import org.exoplatform.faces.core.component.model.Information; 13 14 20 public class UIFormWithInformationProvider extends UISimpleForm implements InformationProvider { 21 private Information information_ = new Information() ; 22 private int displayMessageType_ = FOOTER_MESSAGE_TYPE ; 23 24 public UIFormWithInformationProvider(String name, String method, String formId) { 25 super(name, method, formId) ; 26 } 27 28 public int getDisplayMessageType() { return displayMessageType_ ; } 29 public void setDisplayMessageType(int type) { displayMessageType_ = type ; } 30 public void addMessage(FacesMessage message) { information_.addMessage(message); } 31 public void clearMessages() { information_.clearMessages() ;} 32 public List getMessages() { return information_.getMessages() ; } 33 public boolean hasMessage() { return information_.hasMessage() ; } 34 35 public void encodeChildren(FacesContext context) throws IOException { 36 if(information_.hasMessage()) { 37 if(displayMessageType_ == BODY_MESSAGE_TYPE) { 38 Information.renderBodyInformation(context, this) ; 39 return ; 40 } 41 } 42 super.encodeChildren(context); 43 if(information_.hasMessage()) { 44 if(displayMessageType_ == FOOTER_MESSAGE_TYPE) { 45 Information.renderFooterInformation(context, this) ; 46 return ; 47 } 48 } 49 } 50 } | Popular Tags |