• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FaceletContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.faces.view.facelets.FaceletContext的典型用法代码示例。如果您正苦于以下问题:Java FaceletContext类的具体用法?Java FaceletContext怎么用?Java FaceletContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FaceletContext类属于javax.faces.view.facelets包,在下文中一共展示了FaceletContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: applyMetadata

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void applyMetadata(FaceletContext ctx, Object instance) 
{
  Class klass = instance.getClass();
  try
  {
    Method setter = klass.getMethod("setValueExpression", _SETTER_ARGS);
    setter.invoke(instance, new Object[]{_name, _attr.getValueExpression(ctx, _type)});
  }
  // No user-readable messages are needed since we should never install this rule
  // for objects not supportingg setvalueExpression() 
  catch (NoSuchMethodException ncm)
  {
    _LOG.severe(ncm);
  }
  catch(IllegalAccessException iae)
  {
    _LOG.severe(iae);
  }
  catch(InvocationTargetException ite)
  {
    _LOG.severe(ite);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:24,代码来源:ValueExpressionTagRule.java


示例2: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void apply(FaceletContext faceletContext,
                  UIComponent parent) throws FaceletException, ELException
{
  if (ComponentHandler.isNew(parent))
  {
    // =-=AEW Couldn't this be cached?
    ValueExpression fromExpression = _from.getValueExpression(faceletContext,
                                                              Object.class);
    ValueExpression toExpression=  _to.getValueExpression(faceletContext,
                                                          Object.class);
    ActionSource actionSource= (ActionSource) parent;
    SetActionListener listener = new SetActionListener();
    listener.setValueExpression("from", fromExpression);
    listener.setValueExpression("to", toExpression);
    actionSource.addActionListener(listener);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:SetActionListenerTag.java


示例3: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void apply(FaceletContext faceletContext,
        UIComponent parent) throws IOException, FacesException, FaceletException, ELException
{
  if(ComponentHandler.isNew(parent))
  {
    ActionSource actionSource = (ActionSource)parent;
    ReturnActionListener listener = new ReturnActionListener();
    if (_value != null)
    {
      ValueExpression valueExp = _value.getValueExpression(faceletContext, Object.class);
      listener.setValueExpression(ReturnActionListener.VALUE_KEY,valueExp);
    }

    actionSource.addActionListener(listener);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:ReturnActionListenerTag.java


示例4: applyMetadata

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void applyMetadata(FaceletContext ctx, Object instance)
{
  ValueExpression expr = _attribute.getValueExpression(ctx, String.class);
  UIXComponent uixcomp = (UIXComponent) instance;
  FacesBean bean = uixcomp.getFacesBean();
  PropertyKey mainKey = bean.getType().findKey(_mainMethodName);
  if (mainKey == null)
    throw new TagAttributeException(_attribute,
                                    "No support for '" + _mainMethodName +
                                    "' attribute on " + instance);
  PropertyKey accessKeyKey = bean.getType().findKey("accessKey");
  if (accessKeyKey == null)
    throw new TagAttributeException(_attribute,
                                    "No support for 'accessKey' attribute on " + instance);
  VirtualAttributeUtils.setAccessKeyAttribute(bean, expr, mainKey, accessKeyKey);
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:19,代码来源:AccessKeyPropertyTagRule.java


示例5: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException {
	if (SecurityContextHolder.getContext().getAuthentication() == null) {
		return;
	}

	AuthorizeFaceletsTag authorizeTag = new AuthorizeFaceletsTag(faceletContext, this.access, this.url, this.method, this.ifAllGranted, this.ifAnyGranted, this.ifNotGranted);

	boolean isAuthorized = authorizeTag.authorize();

	if (isAuthorized) {
		this.nextHandler.apply(faceletContext, parent);
	}

	if (this.var != null) {
		faceletContext.setAttribute(this.var.getValue(faceletContext), Boolean.valueOf(isAuthorized));
	}
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:19,代码来源:AuthorizeFaceletsTagHandler.java


示例6: testApplyVar

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Test
public void testApplyVar() throws IOException {
	Authentication authentication = AuthenticationFactory.authentication(Roles.ROLE_A);
	new SpringSecurityMock().init(authentication);

	MockTagAttribute myVariableTagAttribute = new MockTagAttribute("myVariable");
	getJsfMock().getMockTagAttributes().getTagAttributes().put(
		"var", myVariableTagAttribute);
	getJsfMock().getMockTagAttributes().getTagAttributes().put(
		"ifAllGranted", new MockTagAttribute(Roles.ROLE_A));

	FaceletContext mockFaceletContext = getJsfMock().getMockFaceletContext();

	AuthorizeFaceletsTagHandler tag = new AuthorizeFaceletsTagHandler(
		getJsfMock().getMockTagConfig());

	tag.apply(mockFaceletContext, null);

	assertThat(mockFaceletContext.getAttribute("myVariable"))
		.isEqualTo(Boolean.TRUE);
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:22,代码来源:AuthorizeFaceletsTagHandlerIT.java


示例7: setAttributes

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void setAttributes(FaceletContext ctx, Object instance)
{
    EntityConverter converter = (EntityConverter) instance;
    if (this.nullEntity != null) {
        converter.setNullEntity(this.nullEntity.getValue(ctx));
    }
    if (this.transientEntity != null) {
        converter.setTransientEntity(this.transientEntity.getValue(ctx));
    }
    if (this.entityManager != null) {
        converter.setEntityManager((EntityManager) this.entityManager.getObject(ctx));
    }
    if (this.targetEntityClass != null) {
        converter.setTargetEntityClass(this.targetEntityClass.getValue(ctx));
    }
}
 
开发者ID:Inspiredsoft,项目名称:parco,代码行数:18,代码来源:EntityConverterHandler.java


示例8: setAttr

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void setAttr(FaceletContext ctx, String name, TagAttribute attr, UIComponent target) {
		String value = attr.getValue(ctx);
		target.getAttributes().put(name, value);


//		value = new Object[] { ctx.getExpressionFactory().coerceToType(str, method.getParameterTypes()[0]) };
//
//		try {
//			method.invoke(instance, this.value);
//		} catch (InvocationTargetException e) {
//			throw new TagAttributeException(this.attribute, e.getCause());
//		} catch (Exception e) {
//			throw new TagAttributeException(this.attribute, e);
//		}


//		if (targetExpr != null) {
//			ValueExpression srcExpr = attr.getValueExpression(ctx, targetExpr.getType(elContext));
//			targetExpr.setValue(elContext, value);
//		} else {
//			ExpressionFactory exprFactory = ctx.getFacesContext().getApplication().getExpressionFactory();
//			targetExpr = exprFactory.createValueExpression(elContext, "#{" + name + "}", value.getClass());
//			target.setValueExpression(name, targetExpr);
//			targetExpr.setValue(elContext, value);
//		}
	}
 
开发者ID:edvin,项目名称:tornadofaces,代码行数:27,代码来源:Input.java


示例9: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void apply(FaceletContext ctx, UIComponent parent) throws IOException
{
	VariableMapper overloadedVarMapper = ctx.getVariableMapper();
	
	try
	{
		CompositeVariableMapper compositeVarMapper = new CompositeVariableMapper(overloadedVarMapper);
		ctx.setVariableMapper(compositeVarMapper);
	
		this.nextHandler.apply(ctx, parent);
	}
	finally
	{
		ctx.setVariableMapper(overloadedVarMapper);
	}
}
 
开发者ID:skybber,项目名称:Tagext,代码行数:18,代码来源:CompositeComponentHandler.java


示例10: aclCheck

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public boolean aclCheck(String fragment, String contextData, ForumsACLProvider forumsACLProvider,
		UserModule userModule, FaceletContext ctx) {
	boolean isAccessAllowed;
	try {
		Object[] runtime = null;
		FacesContext facesContext = ctx.getFacesContext();
		if (contextData != null && contextData.trim().length() > 0) {
			StringTokenizer st = new StringTokenizer(contextData, ",");
			runtime = new Object[st.countTokens()];
			int i = 0;
			while (st.hasMoreTokens()) {
				String parameter = st.nextToken();
				Object parameterValue = null;

				ExpressionFactory f = ctx.getExpressionFactory();
				ValueExpression expr = f.createValueExpression(ctx, parameter, Object.class);
				parameterValue = expr.getValue(facesContext.getELContext());

				runtime[i++] = parameterValue;
			}
		}

		UIContext securityContext = new UIContext(getUser(userModule));
		securityContext.setFragment(fragment);
		securityContext.setContextData(runtime);
		isAccessAllowed = forumsACLProvider.hasAccess(securityContext);
	} catch (NoSuchMethodException nsme) {
		throw new FacesException(nsme);
	} catch (Exception e) {
		throw new FacesException(e);
	}

	return isAccessAllowed;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:35,代码来源:ACLRenderingController.java


示例11: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, ELException {
	if (when.isAllowed(ctx)) {
		when.apply(ctx, parent);
		return;
	} else {
		if (otherwise != null) {
			otherwise.apply(ctx, parent);
		}
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:11,代码来源:ACLChooseTagHandler.java


示例12: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@TransactionAttribute
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, ELException {
	ForumsACLProvider forumsACLProvider = (ForumsACLProvider) forumsACLProviderAttr.getObject(ctx);
	UserModule userModule = (UserModule) userModuleAttr.getObject(ctx);
	boolean skipAuth = false;
	try {
		if (forumsACLProvider == null) {
			skipAuth = true;
		}
	} catch (Exception e) {
		skipAuth = true;
	}

	if (skipAuth) {
		nextHandler.apply(ctx, parent);
		return;
	}

	String resource = fragment.getValue();
	String contextStr = null;

	if (this.contextData != null) {
		contextStr = contextData.getValue();
	}
	boolean isAccessAllowed = new ACLRenderingController().aclCheck(resource, contextStr, forumsACLProvider,
			userModule, ctx);

	if (isAccessAllowed) {
		nextHandler.apply(ctx, parent);
	}
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:32,代码来源:ACLTagHandler.java


示例13: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void apply(FaceletContext faceletContext,
    UIComponent parent) throws IOException, FacesException, FaceletException, ELException
{
  if(ComponentHandler.isNew(parent))
  {
    ActionSource actionSource = (ActionSource)parent;
    ResetActionListener listener = new ResetActionListener();
    actionSource.addActionListener(listener);
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:11,代码来源:ResetActionListenerTag.java


示例14: onComponentPopulated

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void onComponentPopulated(FaceletContext context,
                                   UIComponent component,
                                   UIComponent parent)
{
  assert (_markInitialState != null);

  if ((component instanceof UIXComponent) &&
      (_markInitialState == Boolean.TRUE))
  {
    if (component.getId() == null)
      component.setId(context.generateUniqueId(UIViewRoot.UNIQUE_ID_PREFIX));
    
    PhaseId phase = context.getFacesContext().getCurrentPhaseId();
    
    // In jsf2 markInitialState will be called by the framework during restore view, 
    // and in fact the framework should always be the one
    // calling markInitialState, but it doesn't always do that in render response, see
    // http://java.net/jira/browse/JAVASERVERFACES-2285
    // Also don't call markInitialState unless initialStateMarked returns false, otherwise
    // any deltas previously saved may get blown away.
    if (PhaseId.RENDER_RESPONSE.equals(phase) && !component.initialStateMarked())
    {
      component.markInitialState();
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:28,代码来源:TrinidadComponentHandler.java


示例15: setAttributes

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
/**
 * Invoking/extending this method will cause the results of the created
 * MetaRuleset to auto-wire state to the passed instance.
 *
 * @param ctx
 * @param instance
 */
protected void setAttributes(FaceletContext ctx, Object instance) {
    if (instance != null) {
        Class type = instance.getClass();
        if (mapper == null || !this.lastType.equals(type)) {
            this.lastType = type;
            this.mapper = this.createMetaRuleset(type).finish();
        }
        this.mapper.applyMetadata(ctx, instance);
    }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:18,代码来源:MetaTagHandler.java


示例16: getAttributeValue

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
private String getAttributeValue(FaceletContext faceletContext, TagAttribute tagAttribute, boolean evaluate) {
	String value = null;
	if (tagAttribute != null) {
		if (evaluate) {
			ValueExpression expression = tagAttribute.getValueExpression(faceletContext, String.class);
			value = (String) expression.getValue(faceletContext.getFacesContext().getELContext());
		}
		else {
			value = tagAttribute.getValue();
		}
	}
	return value;
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:14,代码来源:AuthorizeFaceletsTag.java


示例17: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException {
	AnonymousFaceletsTag anonymousTag = new AnonymousFaceletsTag();

	boolean isAuthorized = anonymousTag.authorize();

	if (isAuthorized) {
		this.nextHandler.apply(faceletContext, parent);
	}
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:10,代码来源:AnonymousFaceletsTagHandler.java


示例18: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException {
	FullyAuthenticatedFaceletsTag fullyAuthenticatedTag = new FullyAuthenticatedFaceletsTag();

	boolean isAuthorized = fullyAuthenticatedTag.authorize();

	if (isAuthorized) {
		this.nextHandler.apply(faceletContext, parent);
	}
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:11,代码来源:FullyAuthenticatedFaceletsTagHandler.java


示例19: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException {
	AuthenticatedFaceletsTag authenticatedTag = new AuthenticatedFaceletsTag();

	boolean isAuthorized = authenticatedTag.authorize();

	if (isAuthorized) {
		this.nextHandler.apply(faceletContext, parent);
	}
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:11,代码来源:AuthenticatedFaceletsTagHandler.java


示例20: apply

import javax.faces.view.facelets.FaceletContext; //导入依赖的package包/类
@Override
public void apply(FaceletContext facelets, UIComponent parent) throws IOException {
    if (ComponentHandler.isNew(parent)) {
        UIComponent c = (UIComponent) component.getObject(facelets);
        parent.getChildren().add(c);
        assign_id_recursively(facelets.getFacesContext(), c);
    }
    nextHandler.apply(facelets, parent);
}
 
开发者ID:rogerkeays,项目名称:novdl,代码行数:10,代码来源:CompositeTag.java



注:本文中的javax.faces.view.facelets.FaceletContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WindowPeer类代码示例发布时间:2022-05-21
下一篇:
Java XmlResponse类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap