| Method from com.sun.faces.context.FacesContextImpl Detail: |
public void addMessage(String clientId,
FacesMessage message) {
assertNotReleased();
// Validate our preconditions
Util.notNull("message", message);
if (maxSeverity == null) {
maxSeverity = message.getSeverity();
} else {
Severity sev = message.getSeverity();
if (sev.getOrdinal() > maxSeverity.getOrdinal()) {
maxSeverity = sev;
}
}
if (componentMessageLists == null) {
componentMessageLists =
new LinkedHashMap< String, List< FacesMessage > >();
}
// Add this message to our internal queue
List< FacesMessage > list = componentMessageLists.get(clientId);
if (list == null) {
list = new ArrayList< FacesMessage >();
componentMessageLists.put(clientId, list);
}
list.add(message);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Adding Message[sourceId=" +
(clientId != null ? clientId : "< < NONE > >") +
",summary=" + message.getSummary() + ")");
}
}
|
public Application getApplication() {
assertNotReleased();
if (null != application) {
return application;
}
ApplicationFactory aFactory =
(ApplicationFactory) FactoryFinder.getFactory(
FactoryFinder.APPLICATION_FACTORY);
application = aFactory.getApplication();
assert (null != application);
return application;
}
|
public Map<Object, Object> getAttributes() {
assertNotReleased();
if (attributes == null) {
attributes = new HashMap< Object, Object >();
}
return attributes;
}
|
public Iterator<String> getClientIdsWithMessages() {
assertNotReleased();
return ((componentMessageLists == null)
? Collections.< String >emptyList().iterator()
: componentMessageLists.keySet().iterator());
}
|
public PhaseId getCurrentPhaseId() {
assertNotReleased();
return currentPhaseId;
}
|
public static FacesContext getDefaultFacesContext() {
return DEFAULT_FACES_CONTEXT.get();
}
|
public ELContext getELContext() {
assertNotReleased();
if (elContext == null) {
Application app = getApplication();
elContext = new ELContextImpl(app.getELResolver());
elContext.putContext(FacesContext.class, this);
UIViewRoot root = this.getViewRoot();
if (null != root) {
elContext.setLocale(root.getLocale());
}
ELContextListener[] listeners = app.getELContextListeners();
if (listeners.length > 0) {
ELContextEvent event = new ELContextEvent(elContext);
for (ELContextListener listener: listeners) {
listener.contextCreated(event);
}
}
}
return elContext;
}
|
public ExceptionHandler getExceptionHandler() {
return exceptionHandler;
}
|
public ExternalContext getExternalContext() {
assertNotReleased();
return externalContext;
}
|
public Severity getMaximumSeverity() {
assertNotReleased();
Severity result = null;
if (componentMessageLists != null
&& !(componentMessageLists.isEmpty())) {
for (Iterator< FacesMessage > i =
new ComponentMessagesIterator(componentMessageLists);
i.hasNext();) {
Severity severity = i.next().getSeverity();
if (result == null || severity.compareTo(result) > 0) {
result = severity;
}
if (result == FacesMessage.SEVERITY_FATAL) {
break;
}
}
}
return result;
}
|
public List<FacesMessage> getMessageList() {
assertNotReleased();
if (null == componentMessageLists) {
return Collections
.unmodifiableList(Collections.< FacesMessage >emptyList());
} else {
List< FacesMessage > messages = new ArrayList< FacesMessage >();
for (List< FacesMessage > list : componentMessageLists.values()) {
messages.addAll(list);
}
return Collections.unmodifiableList(messages);
}
}
|
public List<FacesMessage> getMessageList(String clientId) {
assertNotReleased();
if (null == componentMessageLists) {
return Collections
.unmodifiableList(Collections.< FacesMessage >emptyList());
} else {
List< FacesMessage > list = componentMessageLists.get(clientId);
return Collections.unmodifiableList((list != null)
? list
: Collections.< FacesMessage >emptyList());
}
}
|
public Iterator<FacesMessage> getMessages() {
assertNotReleased();
if (null == componentMessageLists) {
List< FacesMessage > emptyList = Collections.emptyList();
return (emptyList.iterator());
}
if (componentMessageLists.size() > 0) {
return new ComponentMessagesIterator(componentMessageLists);
} else {
List< FacesMessage > emptyList = Collections.emptyList();
return (emptyList.iterator());
}
}
|
public Iterator<FacesMessage> getMessages(String clientId) {
assertNotReleased();
// If no messages have been enqueued at all,
// return an empty List Iterator
if (null == componentMessageLists) {
List< FacesMessage > emptyList = Collections.emptyList();
return (emptyList.iterator());
}
List< FacesMessage > list = componentMessageLists.get(clientId);
if (list == null) {
List< FacesMessage > emptyList = Collections.emptyList();
return (emptyList.iterator());
}
return (list.iterator());
}
|
public PartialViewContext getPartialViewContext() {
assertNotReleased();
if (partialViewContext == null) {
PartialViewContextFactory f = (PartialViewContextFactory)
FactoryFinder.getFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY);
partialViewContext = f.getPartialViewContext(this);
}
return partialViewContext;
}
|
public RenderKit getRenderKit() {
assertNotReleased();
UIViewRoot vr = getViewRoot();
if (vr == null) {
return (null);
}
String renderKitId = vr.getRenderKitId();
if (renderKitId == null) {
return null;
}
if (renderKitId.equals(lastRkId)) {
return lastRk;
} else {
lastRk = rkFactory.getRenderKit(this, renderKitId);
lastRkId = renderKitId;
return lastRk;
}
}
|
public boolean getRenderResponse() {
assertNotReleased();
return renderResponse;
}
|
public boolean getResponseComplete() {
assertNotReleased();
return responseComplete;
}
|
public ResponseStream getResponseStream() {
assertNotReleased();
return responseStream;
}
|
public ResponseWriter getResponseWriter() {
assertNotReleased();
return responseWriter;
}
|
public UIViewRoot getViewRoot() {
assertNotReleased();
return viewRoot;
}
|
public boolean isPostback() {
assertNotReleased();
Boolean postback = (Boolean) this.getAttributes().get(POST_BACK_MARKER);
if (postback == null) {
RenderKit rk = this.getRenderKit();
if (rk != null) {
postback = rk.getResponseStateManager().isPostback(this);
} else {
// ViewRoot hasn't been set yet, so calculate the RK
ViewHandler vh = this.getApplication().getViewHandler();
String rkId = vh.calculateRenderKitId(this);
postback = RenderKitUtils.getResponseStateManager(this, rkId)
.isPostback(this);
}
this.getAttributes().put(POST_BACK_MARKER, postback);
}
return postback;
}
|
public boolean isValidationFailed() {
assertNotReleased();
return validationFailed;
}
|
public void release() {
released = true;
externalContext = null;
responseStream = null;
responseWriter = null;
componentMessageLists = null;
renderResponse = false;
responseComplete = false;
validationFailed = false;
viewRoot = null;
maxSeverity = null;
application = null;
currentPhaseId = null;
if (attributes != null) {
attributes.clear();
attributes = null;
}
partialViewContext = null;
exceptionHandler = null;
elContext = null;
rkFactory = null;
lastRk = null;
lastRkId = null;
// PENDING(edburns): write testcase that verifies that release
// actually works. This will be important to keep working as
// ivars are added and removed on this class over time.
// Make sure to clear our ThreadLocal instance.
setCurrentInstance(null);
// remove our private ThreadLocal instance.
DEFAULT_FACES_CONTEXT.remove();
}
|
public void renderResponse() {
assertNotReleased();
renderResponse = true;
}
|
public void responseComplete() {
assertNotReleased();
responseComplete = true;
}
|
public void setCurrentPhaseId(PhaseId currentPhaseId) {
assertNotReleased();
this.currentPhaseId = currentPhaseId;
}
|
public void setExceptionHandler(ExceptionHandler exceptionHandler) {
this.exceptionHandler = exceptionHandler;
}
|
public void setResponseStream(ResponseStream responseStream) {
assertNotReleased();
Util.notNull("responseStrean", responseStream);
this.responseStream = responseStream;
}
|
public void setResponseWriter(ResponseWriter responseWriter) {
assertNotReleased();
Util.notNull("responseWriter", responseWriter);
this.responseWriter = responseWriter;
}
|
public void setViewRoot(UIViewRoot root) {
assertNotReleased();
Util.notNull("root", root);
if (viewRoot != null && !viewRoot.equals(root)) {
Map< String, Object > viewMap = viewRoot.getViewMap(false);
if (viewMap != null) {
viewRoot.getViewMap().clear();
}
}
viewRoot = root;
}
|
public void validationFailed() {
assertNotReleased();
validationFailed = true;
}
|