File | Line |
---|
javax/faces/component/_MessageUtils.java | 67 |
javax/faces/convert/_MessageUtils.java | 47 |
args);
}
static FacesMessage getMessage(FacesContext facesContext,
Locale locale,
FacesMessage.Severity severity,
String messageId,
Object args[])
{
ResourceBundle appBundle;
ResourceBundle defBundle;
String summary;
String detail;
appBundle = getApplicationBundle(facesContext, locale);
summary = getBundleString(appBundle, messageId);
if (summary != null)
{
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
}
else
{
defBundle = getDefaultBundle(facesContext, locale);
summary = getBundleString(defBundle, messageId);
if (summary != null)
{
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
}
else
{
//Try to find detail alone
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
if (detail != null)
{
summary = null;
}
else
{
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
if (detail != null)
{
summary = null;
}
else
{
//Neither detail nor summary found
facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
return new FacesMessage(severity, messageId, null);
}
}
}
}
if (args != null && args.length > 0)
{
return new _ParametrizableFacesMessage(severity, summary, detail, args, locale);
}
else
{
return new FacesMessage(severity, summary, detail);
}
}
private static String getBundleString(ResourceBundle bundle, String key)
{
try
{
return bundle == null ? null : bundle.getString(key);
}
catch (MissingResourceException e)
{
return null;
}
}
private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale)
{
String bundleName = facesContext.getApplication().getMessageBundle();
return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
}
private static ResourceBundle getDefaultBundle(FacesContext facesContext,
Locale locale)
{
return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
}
private static ResourceBundle getBundle(FacesContext facesContext,
Locale locale,
String bundleName)
{
try
{
//First we try the JSF implementation class loader
return ResourceBundle.getBundle(bundleName,
locale,
facesContext.getClass().getClassLoader());
}
catch (MissingResourceException ignore1)
{
try
{
//Next we try the JSF API class loader
return ResourceBundle.getBundle(bundleName,
locale,
_MessageUtils.class.getClassLoader());
}
catch (MissingResourceException ignore2)
{
try
{
//Last resort is the context class loader
return ResourceBundle.getBundle(bundleName,
locale,
Thread.currentThread().getContextClassLoader());
}
catch (MissingResourceException damned)
{
facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
return null;
}
}
}
}
static Object getLabel(FacesContext facesContext, UIComponent component) {
Object label = component.getAttributes().get("label");
if(label != null)
return label;
ValueExpression expression = component.getValueExpression("label");
if(expression != null)
return expression;
//If no label is not specified, use clientId
return component.getClientId( facesContext );
}
} |
File | Line |
---|
javax/faces/component/_MessageUtils.java | 82 |
javax/faces/validator/_MessageUtils.java | 66 |
appBundle = getApplicationBundle(facesContext, locale);
summary = getBundleString(appBundle, messageId);
if (summary != null)
{
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
}
else
{
defBundle = getDefaultBundle(facesContext, locale);
summary = getBundleString(defBundle, messageId);
if (summary != null)
{
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
}
else
{
//Try to find detail alone
detail = getBundleString(appBundle, messageId + DETAIL_SUFFIX);
if (detail != null)
{
summary = null;
}
else
{
detail = getBundleString(defBundle, messageId + DETAIL_SUFFIX);
if (detail != null)
{
summary = null;
}
else
{
//Neither detail nor summary found
facesContext.getExternalContext().log("No message with id " + messageId + " found in any bundle");
return new FacesMessage(severity, messageId, null);
}
}
}
}
if (args != null && args.length > 0)
{
return new _ParametrizableFacesMessage(severity, summary, detail, args, locale);
}
else
{
return new FacesMessage(severity, summary, detail);
}
}
private static String getBundleString(ResourceBundle bundle, String key)
{
try
{
return bundle == null ? null : bundle.getString(key);
}
catch (MissingResourceException e)
{
return null;
}
}
private static ResourceBundle getApplicationBundle(FacesContext facesContext, Locale locale)
{
String bundleName = facesContext.getApplication().getMessageBundle();
return bundleName != null ? getBundle(facesContext, locale, bundleName) : null;
}
private static ResourceBundle getDefaultBundle(FacesContext facesContext,
Locale locale)
{
return getBundle(facesContext, locale, FacesMessage.FACES_MESSAGES);
}
private static ResourceBundle getBundle(FacesContext facesContext,
Locale locale,
String bundleName)
{
try
{
//First we try the JSF implementation class loader
return ResourceBundle.getBundle(bundleName,
locale,
facesContext.getClass().getClassLoader());
}
catch (MissingResourceException ignore1)
{
try
{
//Next we try the JSF API class loader
return ResourceBundle.getBundle(bundleName,
locale,
_MessageUtils.class.getClassLoader());
}
catch (MissingResourceException ignore2)
{
try
{
//Last resort is the context class loader
return ResourceBundle.getBundle(bundleName,
locale,
Thread.currentThread().getContextClassLoader());
}
catch (MissingResourceException damned)
{
facesContext.getExternalContext().log("resource bundle " + bundleName + " could not be found");
return null;
}
}
}
}
static Object getLabel(FacesContext facesContext, UIComponent component) {
Object label = component.getAttributes().get("label");
if(label != null)
return label;
ValueExpression expression = component.getValueExpression("label");
if(expression != null)
return expression;
//If no label is not specified, use clientId
return component.getClientId( facesContext );
}
} |
File | Line |
---|
javax/faces/component/_ParametrizableFacesMessage.java | 36 |
javax/faces/validator/_ParametrizableFacesMessage.java | 36 |
class _ParametrizableFacesMessage extends FacesMessage
{
/**
*
*/
private static final long serialVersionUID = 7792947730961657948L;
private final Object _args[];
private String _evaluatedDetail;
private String _evaluatedSummary;
private transient Object _evaluatedArgs[];
private Locale _locale;
public _ParametrizableFacesMessage(
String summary, String detail, Object[] args, Locale locale)
{
super(summary, detail);
if(locale == null) throw new NullPointerException("locale");
_locale = locale;
_args = args;
}
public _ParametrizableFacesMessage(FacesMessage.Severity severity,
String summary, String detail, Object[] args, Locale locale)
{
super(severity, summary, detail);
if(locale == null) throw new NullPointerException("locale");
_locale = locale;
_args = args;
}
@Override
public String getDetail()
{
if (_evaluatedArgs == null && _args != null)
{
evaluateArgs();
}
if (_evaluatedDetail == null)
{
MessageFormat format = new MessageFormat(super.getDetail(), _locale);
_evaluatedDetail = format.format(_evaluatedArgs);
}
return _evaluatedDetail;
}
@Override
public void setDetail(String detail)
{
super.setDetail(detail);
_evaluatedDetail = null;
}
public String getUnformattedDetail()
{
return super.getDetail();
}
@Override
public String getSummary()
{
if (_evaluatedArgs == null && _args != null)
{
evaluateArgs();
}
if (_evaluatedSummary == null)
{
MessageFormat format = new MessageFormat(super.getSummary(), _locale);
_evaluatedSummary = format.format(_evaluatedArgs);
}
return _evaluatedSummary;
}
@Override
public void setSummary(String summary)
{
super.setSummary(summary);
_evaluatedSummary = null;
}
public String getUnformattedSummary()
{
return super.getSummary();
}
private void evaluateArgs()
{
_evaluatedArgs = new Object[_args.length];
FacesContext facesContext = null;
for (int i = 0; i < _args.length; i++)
{
if (_args[i] == null)
{
continue;
}
else if (_args[i] instanceof ValueBinding)
{
if (facesContext == null)
{
facesContext = FacesContext.getCurrentInstance();
}
_evaluatedArgs[i] = ((ValueBinding)_args[i]).getValue(facesContext);
}
else if (_args[i] instanceof ValueExpression)
{
if (facesContext == null)
{
facesContext = FacesContext.getCurrentInstance();
}
_evaluatedArgs[i] = ((ValueExpression)_args[i]).getValue(facesContext.getELContext());
}
else
{
_evaluatedArgs[i] = _args[i];
}
}
}
} |
File | Line |
---|
javax/faces/component/UIData.java | 762 |
javax/faces/component/UIData.java | 843 |
UIComponent child = parent.getChildren().get(i);
if (!child.isTransient())
{
// Add an entry to the collection, being an array of two
// elements. The first element is the state of the children
// of this component; the second is the state of the current
// child itself.
if (child instanceof EditableValueHolder)
{
if (childStates == null)
{
childStates = new ArrayList<Object[]>(
parent.getFacetCount()
+ parent.getChildCount()
- totalChildCount
+ childEmptyIndex);
for (int ci = 0; ci < childEmptyIndex; ci++)
{
childStates.add(LEAF_NO_STATE);
}
}
childStates.add(child.getChildCount() > 0 ?
new Object[]{new EditableValueHolderState((EditableValueHolder) child),
saveDescendantComponentStates(child, saveChildFacets, true)} :
new Object[]{new EditableValueHolderState((EditableValueHolder) child),
null});
}
else if (child.getChildCount() > 0 || (saveChildFacets && child.getFacetCount() > 0))
{
Object descendantSavedState = saveDescendantComponentStates(child, saveChildFacets, true);
if (descendantSavedState == null)
{
if (childStates == null)
{
childEmptyIndex++;
}
else
{
childStates.add(LEAF_NO_STATE);
}
}
else
{
if (childStates == null)
{
childStates = new ArrayList<Object[]>(
parent.getFacetCount()
+ parent.getChildCount()
- totalChildCount
+ childEmptyIndex);
for (int ci = 0; ci < childEmptyIndex; ci++)
{
childStates.add(LEAF_NO_STATE);
}
}
childStates.add(new Object[]{null, descendantSavedState});
}
}
else
{
if (childStates == null)
{
childEmptyIndex++;
}
else
{
childStates.add(LEAF_NO_STATE);
}
}
}
totalChildCount++;
}
} |
File | Line |
---|
javax/faces/component/_LabeledFacesMessage.java | 33 |
javax/faces/convert/_LabeledFacesMessage.java | 33 |
class _LabeledFacesMessage extends FacesMessage{
public _LabeledFacesMessage() {
super();
}
public _LabeledFacesMessage(Severity severity, String summary,
String detail, Object args[]) {
super(severity, summary, detail);
}
public _LabeledFacesMessage(Severity severity, String summary,
String detail) {
super(severity, summary, detail);
}
public _LabeledFacesMessage(String summary, String detail) {
super(summary, detail);
}
public _LabeledFacesMessage(String summary) {
super(summary);
}
@Override
public String getDetail() {
FacesContext facesContext = FacesContext.getCurrentInstance();
ValueExpression value = facesContext.getApplication().getExpressionFactory().
createValueExpression(facesContext.getELContext(), super.getDetail(), String.class);
return (String) value.getValue(facesContext.getELContext());
}
@Override
public String getSummary() {
FacesContext facesContext = FacesContext.getCurrentInstance();
ValueExpression value = facesContext.getApplication().getExpressionFactory().
createValueExpression(facesContext.getELContext(), super.getSummary(), String.class);
return (String) value.getValue(facesContext.getELContext());
}
} |
File | Line |
---|
javax/faces/component/UIComponentBase.java | 939 |
javax/faces/component/_SelectItemsIterator.java | 205 |
}
private String getPathToComponent(UIComponent component)
{
StringBuffer buf = new StringBuffer();
if(component == null)
{
buf.append("{Component-Path : ");
buf.append("[null]}");
return buf.toString();
}
getPathToComponent(component,buf);
buf.insert(0,"{Component-Path : ");
buf.append("}");
return buf.toString();
}
private void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
return;
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf); |
File | Line |
---|
javax/faces/component/_ComponentUtils.java | 243 |
javax/faces/webapp/UIComponentClassicTagBase.java | 935 |
private String getPathToComponent(UIComponent component)
{
StringBuffer buf = new StringBuffer();
if(component == null)
{
buf.append("{Component-Path : ");
buf.append("[null]}");
return buf.toString();
}
getPathToComponent(component,buf);
buf.insert(0,"{Component-Path : ");
buf.append("}");
return buf.toString();
}
/** Generate diagnostic output. */
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
return;
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf); |
File | Line |
---|
javax/faces/component/UIData.java | 609 |
javax/faces/component/UIData.java | 652 |
UIComponent component = parent.getChildren().get(i);
// reset the client id (see spec 3.1.6)
component.setId(component.getId());
if (!component.isTransient())
{
if (descendantStateIndex == -1)
{
stateCollection = ((List<? extends Object[]>) state);
descendantStateIndex = stateCollection.isEmpty() ? -1 : 0;
}
if (descendantStateIndex != -1 && descendantStateIndex < stateCollection.size())
{
Object[] object = stateCollection.get(descendantStateIndex);
if (object[0] != null && component instanceof EditableValueHolder)
{
((EditableValueHolderState) object[0]).restoreState((EditableValueHolder) component);
}
// If there is descendant state to restore, call it recursively, otherwise
// it is safe to skip iteration.
if (object[1] != null)
{
restoreDescendantComponentStates(component, restoreChildFacets, object[1], true);
}
else
{
restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
}
}
else
{
restoreDescendantComponentWithoutRestoreState(component, restoreChildFacets, true);
}
descendantStateIndex++;
}
}
} |
File | Line |
---|
javax/faces/model/ArrayDataModel.java | 85 |
javax/faces/model/ListDataModel.java | 88 |
}
public void setRowIndex(int rowIndex)
{
if (rowIndex < -1)
{
throw new IllegalArgumentException("illegal rowIndex " + rowIndex);
}
int oldRowIndex = _rowIndex;
_rowIndex = rowIndex;
if (_data != null && oldRowIndex != _rowIndex)
{
Object data = isRowAvailable() ? getRowData() : null;
DataModelEvent event = new DataModelEvent(this, _rowIndex, data);
DataModelListener[] listeners = getDataModelListeners();
for (int i = 0; i < listeners.length; i++)
{
listeners[i].rowSelected(event);
}
}
}
public void setWrappedData(Object data)
{
if (data == null)
{
setRowIndex(-1);
_data = null;
}
else
{
_data = (List)data; |
File | Line |
---|
javax/faces/model/ArrayDataModel.java | 85 |
javax/faces/model/ScalarDataModel.java | 80 |
}
public void setRowIndex(int rowIndex)
{
if (rowIndex < -1)
{
throw new IllegalArgumentException("illegal rowIndex " + rowIndex);
}
int oldRowIndex = _rowIndex;
_rowIndex = rowIndex;
if (_data != null && oldRowIndex != _rowIndex)
{
Object data = isRowAvailable() ? getRowData() : null;
DataModelEvent event = new DataModelEvent(this, _rowIndex, data);
DataModelListener[] listeners = getDataModelListeners();
for (int i = 0; i < listeners.length; i++)
{
listeners[i].rowSelected(event);
}
}
}
public void setWrappedData(Object data)
{
if (data == null)
{
setRowIndex(-1);
_data = null;
}
else
{
_data = data; |
File | Line |
---|
javax/faces/component/UIComponentBase.java | 960 |
javax/faces/component/_ComponentUtils.java | 261 |
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
return;
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf.toString());
getPathToComponent(component.getParent(), buf);
} |
File | Line |
---|
javax/faces/event/MethodExpressionActionListener.java | 50 |
javax/faces/event/MethodExpressionValueChangeListener.java | 50 |
Object[] params = new Object[]{event};
methodExpression.invoke(elContext(), params);
}
catch (ELException e)
{
Throwable cause = e.getCause();
if (cause != null && cause instanceof AbortProcessingException)
{
throw (AbortProcessingException)cause;
}
else
{
throw e;
}
}
}
private ELContext elContext() {
return FacesContext.getCurrentInstance().getELContext();
}
public void restoreState(FacesContext context, Object state) {
methodExpression = (MethodExpression)state;
}
public Object saveState(FacesContext context) {
return methodExpression;
}
public void setTransient(boolean newTransientValue) {
isTransient = newTransientValue;
}
public boolean isTransient() {
return isTransient;
}
} |
File | Line |
---|
javax/faces/component/_SelectItemsIterator.java | 227 |
javax/faces/webapp/UIComponentClassicTagBase.java | 955 |
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
return;
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf); |
File | Line |
---|
javax/faces/component/UIComponentBase.java | 960 |
javax/faces/webapp/UIComponentClassicTagBase.java | 955 |
private static void getPathToComponent(UIComponent component, StringBuffer buf)
{
if(component == null)
return;
StringBuffer intBuf = new StringBuffer();
intBuf.append("[Class: ");
intBuf.append(component.getClass().getName());
if(component instanceof UIViewRoot)
{
intBuf.append(",ViewId: ");
intBuf.append(((UIViewRoot) component).getViewId());
}
else
{
intBuf.append(",Id: ");
intBuf.append(component.getId());
}
intBuf.append("]");
buf.insert(0,intBuf); |