本文整理匯總了Java中javax.faces.application.Application.createValueBinding方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.createValueBinding方法的具體用法?Java Application.createValueBinding怎麽用?Java Application.createValueBinding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.application.Application
的用法示例。
在下文中一共展示了Application.createValueBinding方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component, String attributeName,
String attributeValue)
{
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(attributeValue);
component.setValueBinding(attributeName, vb);
}
示例2: transform
import javax.faces.application.Application; //導入方法依賴的package包/類
/**
* Evaluate an expression for each element in a collection and return a collection of the evaluation results.
*
* @param original an iterable object
* @param variable a binding to which the element can be assigned
* @param expression a binding (perhaps involving the variable) to return for each element
* @return a collection containing the results
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Collection transform(Iterable original, String variable, String expression) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ValueBinding variableBinding = application.createValueBinding(variable);
ValueBinding expressionBinding = application.createValueBinding(expression);
Collection transformed = new ArrayList();
Iterator current = original.iterator();
while(current.hasNext()) {
Object next = current.next();
variableBinding.setValue(context, next);
transformed.add(expressionBinding.getValue(context));
}
return transformed;
}
示例3: filter
import javax.faces.application.Application; //導入方法依賴的package包/類
/**
* Evaluate an expression for each element in a collection and return a collection containing
* those elements where the expression evaluates to Boolean.TRUE.
*
* @param original an iterable object
* @param variable a binding to which the element can be assigned
* @param expression a binding (perhaps involving the variable) to return for each element
*
* @return a collection containing the elements where the expression evaluates to true.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Collection filter(Iterable original, String variable, String expression) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ValueBinding variableBinding = application.createValueBinding(variable);
ValueBinding expressionBinding = application.createValueBinding(expression);
Collection filtered = new ArrayList();
Iterator current = original.iterator();
while(current.hasNext()) {
Object next = current.next();
variableBinding.setValue(context, next);
if(Boolean.TRUE.equals(expressionBinding.getValue(context)))
filtered.add(next);
}
return filtered;
}
示例4: getInstance
import javax.faces.application.Application; //導入方法依賴的package包/類
public Object getInstance() throws InstantiationException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null)
{
log.error("Object " + getManagedBeanName() + " cannot be created since the faces context is null");
return null;
}
Application application = facesContext.getApplication();
Object resolvedObject = null;
if (isVBExpression(getManagedBeanName()))
{
ValueBinding vb = application.createValueBinding(getManagedBeanName());
if (vb != null)
{
resolvedObject = vb.getValue(facesContext);
}
}
else
{
VariableResolver resolver = application.getVariableResolver();
resolvedObject = resolver.resolveVariable(facesContext, getManagedBeanName());
}
return resolvedObject;
}
示例5: getInstance
import javax.faces.application.Application; //導入方法依賴的package包/類
@Override
public Object getInstance() throws InstantiationException
{
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null)
{
log.error("Object " + getManagedBeanName() + " cannot be created since the faces context is null");
return null;
}
Application application = facesContext.getApplication();
Object resolvedObject = null;
if (isVBExpression(getManagedBeanName()))
{
ValueBinding vb = application.createValueBinding(getManagedBeanName());
if (vb != null)
{
resolvedObject = vb.getValue(facesContext);
}
}
else
{
VariableResolver resolver = application.getVariableResolver();
resolvedObject = resolver.resolveVariable(facesContext, getManagedBeanName());
}
return resolvedObject;
}
示例6: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component,
String attributeName,
String attributeValue)
{
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(attributeValue);
component.setValueBinding(attributeName, vb);
}
示例7: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
/**
* Set a ValueBinding on a component - used by tags setProperties() method.
*/
public static void setValueBinding(UIComponent component, String name, String value)
{
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(value);
component.setValueBinding(name, vb);
}
示例8: getValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public ValueBinding getValueBinding(String valueRef) {
ApplicationFactory af =
(ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
Application a = af.getApplication();
return (a.createValueBinding(valueRef));
}
示例9: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component, String attributeName,
String attributeValue) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(attributeValue);
component.setValueBinding(attributeName, vb);
}
示例10: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component,
String attributeName, String attributeValue) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(attributeValue);
component.setValueBinding(attributeName, vb);
}
示例11: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component,
String attributeName, String attributeValue)
{
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding vb = app.createValueBinding(attributeValue);
component.setValueBinding(attributeName, vb);
}
示例12: setValueBinding
import javax.faces.application.Application; //導入方法依賴的package包/類
public static void setValueBinding(UIComponent component, String attributeName, String attributeValue) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ValueBinding valueBinding = application.createValueBinding(attributeValue);
component.setValueBinding(attributeName, valueBinding);
}
示例13: encodeBegin
import javax.faces.application.Application; //導入方法依賴的package包/類
/**
* @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
public void encodeBegin(FacesContext context, UIComponent component)
throws IOException
{
ResponseWriter writer = context.getResponseWriter();
String helpWindowTitle = (String) component.getAttributes().get(
"helpWindowTitle");
String searchToolUrl = (String) component.getAttributes().get(
"searchToolUrl");
String tocToolUrl = (String) component.getAttributes().get("tocToolUrl");
String helpParameter = ((HttpServletRequest) context.getExternalContext()
.getRequest()).getParameter("help");
if (helpParameter != null) {
Pattern p = Pattern.compile(HELP_DOC_REGEXP);
Matcher m = p.matcher(helpParameter);
if (!m.matches()) {
helpParameter = "unknown";
}
}
String welcomepage = getWelcomePage(context);
tocToolUrl = tocToolUrl + "?help=" + helpParameter;
EventTrackingService.post(EventTrackingService.newEvent("help.access", helpParameter, false));
helpWindowTitle = ServerConfigurationService.getString("ui.service", "Sakai") + " " + component.getAttributes().get("helpWindowTitle");
writer.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">\n");
writer.write("<html><head><title>" + helpWindowTitle + "</title></head>\n");
writer.write("<FRAMESET cols=\"20%, 80%\"><FRAMESET rows=\"150, 450\">");
writer.write("<FRAME src=\"" + searchToolUrl + "\" name=\"search\">");
writer.write("<FRAME src=\"" + tocToolUrl + "\" name=\"toc\">");
writer.write("</FRAMESET>\n");
Application app = context.getApplication();
ValueBinding binding = app.createValueBinding("#{Components['org.sakaiproject.api.app.help.HelpManager']}");
HelpManager manager = (HelpManager) binding.getValue(context);
if(manager.getWelcomePage() == null) {
if (welcomepage == DEFAULT_WELCOME_PAGE) {
writer.write("<FRAME src=\"content.hlp?docId=" + welcomepage + "\" name=\"content\">");
} else {
writer.write("<FRAME src=\"" + welcomepage + "\" name=\"content\">");
}
}
else {
writer.write("<FRAME src=\"content.hlp?docId=" + manager.getWelcomePage() + "\" name=\"content\">");
}
writer.write("</FRAMESET></html>\n");
}
示例14: afterPhase
import javax.faces.application.Application; //導入方法依賴的package包/類
public void afterPhase(PhaseEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding binding = app.createValueBinding("#{ForumTool}");
DiscussionForumTool forumTool = (DiscussionForumTool) binding
.getValue(context);
Map requestParams = context.getExternalContext()
.getRequestParameterMap();
String action = (String) requestParams.get("action");
String messageId = (String) requestParams.get("messageId");
String topicId = (String) requestParams.get("topicId");
String ajax = (String) requestParams.get("ajax");
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
if ("true".equals(ajax)) {
try {
ServletOutputStream out = response.getOutputStream();
response.setHeader("Pragma", "No-Cache");
response.setHeader("Cache-Control",
"no-cache,no-store,max-age=0");
response.setDateHeader("Expires", 1);
if (action == null) {
out.println("FAIL");
} else if ("markMessageAsRead".equals(action)) {
// Ajax call to mark messages as read for user
if (messageId != null && topicId != null) {
if (!forumTool.isMessageReadForUser(Long.valueOf(topicId),
Long.valueOf(messageId))) {
forumTool.markMessageReadForUser(Long.valueOf(topicId),
Long.valueOf(messageId), true);
out.println("SUCCESS");
} else {
// also output success in case message is read, but
// page rendered mail icon (old state)
out.println("SUCCESS");
}
}
}
out.flush();
} catch (Exception ee) {
log.error(ee.getMessage(), ee);
}
context.responseComplete();
}
;
}
示例15: getBean
import javax.faces.application.Application; //導入方法依賴的package包/類
public static Object getBean(String expr) {
Application app = getContext().getApplication();
ValueBinding binding = app.createValueBinding("#{" + expr + "}");
Object value = binding.getValue(getContext());
return value;
}