當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.createValueBinding方法代碼示例

本文整理匯總了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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:9,代碼來源:RichTextEditArea.java

示例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;
}
 
開發者ID:hmsiccbl,項目名稱:screensaver,代碼行數:29,代碼來源:Functions.java

示例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;
}
 
開發者ID:hmsiccbl,項目名稱:screensaver,代碼行數:32,代碼來源:Functions.java

示例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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:29,代碼來源:JsfCreator.java

示例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;
}
 
開發者ID:directwebremoting,項目名稱:dwr,代碼行數:30,代碼來源:JsfCreator.java

示例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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:10,代碼來源:TagUtil.java

示例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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:11,代碼來源:TagUtil.java

示例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));
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:8,代碼來源:CustomSelectOneRadioTag.java

示例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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:8,代碼來源:Tags.java

示例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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:8,代碼來源:Tags.java

示例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);
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:9,代碼來源:ShowAreaTag.java

示例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);
}
 
開發者ID:FenixEdu,項目名稱:fenixedu-academic,代碼行數:8,代碼來源:JsfTagUtils.java

示例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");
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:58,代碼來源:HelpFrameSetRender.java

示例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();
	}
	;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:48,代碼來源:AjaxPhaseListener.java

示例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;
}
 
開發者ID:majkilde,項目名稱:LogFileReader,代碼行數:7,代碼來源:XSPUtils.java


注:本文中的javax.faces.application.Application.createValueBinding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。