/** * Returns a new DateTimeConverter * * @see DateTimeConverter * @see com.sun.facelets.tag.jsf.ConvertHandler#createConverter(com.sun.facelets.FaceletContext) */ protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException { return ctx.getFacesContext().getApplication().createConverter(DateTimeConverter.CONVERTER_ID); }
/** * Returns a new NumberConverter * * @see NumberConverter * @see com.sun.facelets.tag.jsf.ConverterHandler#createConverter(com.sun.facelets.FaceletContext) */ protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException { return ctx.getFacesContext().getApplication().createConverter(NumberConverter.CONVERTER_ID); }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { this.next.apply(ctx, parent); ctx.getFacesContext().getExternalContext().getRequestMap().put("facelets.Encoding", this.encoding); }
protected void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException, FacesException, ELException { AliasBeansScope aliasBean = (AliasBeansScope) c; aliasBean.makeAliases(ctx.getFacesContext()); super.applyNextHandler(ctx, c); aliasBean.removeAliases(ctx.getFacesContext()); } }
protected void applyNextHandler(FaceletContext ctx, UIComponent component) throws IOException, FacesException, ELException { AliasBean aliasBean = (AliasBean) component; aliasBean.makeAlias(ctx.getFacesContext()); super.applyNextHandler(ctx, component); aliasBean.removeAlias(ctx.getFacesContext()); }
public void applyMetadata(FaceletContext ctx, Object instance) { ((ValueHolder) instance).setConverter(ctx.getFacesContext() .getApplication().createConverter(this.converterId)); } }
/** * Uses the specified "validatorId" to get a new Validator instance from the * Application. * * @see javax.faces.application.Application#createValidator(java.lang.String) * @see com.sun.facelets.tag.jsf.ValidateHandler#createValidator(com.sun.facelets.FaceletContext) */ protected Validator createValidator(FaceletContext ctx) { return ctx.getFacesContext().getApplication().createValidator( this.validatorId.getValue(ctx)); }
protected void onComponentPopulated(FaceletContext context, UIComponent component, UIComponent parent) { if (component instanceof OnComponentPopulated && component.getAttributes().get(OnComponentPopulated.MARKER) == null) { component.getAttributes().put(OnComponentPopulated.MARKER, Boolean.TRUE); ((OnComponentPopulated) component).onComponentPopulated(context.getFacesContext(), parent); } // TODO call only if component was created if (component instanceof EditableValueHolder) { addDefaultValidators(context.getFacesContext(), (EditableValueHolder) component); } }
public void applyMetadata(FaceletContext ctx, Object instance) { ((EditableValueHolder) instance).addValidator(ctx.getFacesContext() .getApplication().createValidator(this.validatorId)); } }
/** * Uses the specified "converterId" to pull an instance from the Application * * @see javax.faces.application.Application#createComponent(java.lang.String) * @see com.sun.facelets.tag.jsf.ConverterHandler#createConverter(com.sun.facelets.FaceletContext) */ protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException { return ctx.getFacesContext().getApplication().createConverter( this.converterId.getValue(ctx)); }
/** * Create a Converter instance * * @param ctx * FaceletContext to use * @return Converter instance, cannot be null */ protected Converter createConverter(FaceletContext ctx) { if (this.converterId == null) { throw new TagException( this.tag, "Default behavior invoked of requiring a converter-id passed in the constructor, must override ConvertHandler(ConverterConfig)"); } return ctx.getFacesContext().getApplication().createConverter(this.converterId); }
protected void onComponentCreated(FaceletContext context, UIComponent component, UIComponent parent) { if (component instanceof OnComponentCreated && component.getAttributes().get(OnComponentCreated.MARKER) == null) { component.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE); ((OnComponentCreated) component).onComponentCreated(context.getFacesContext(), parent); } }
/** * Template method for creating a Validator instance * * @param ctx * FaceletContext to use * @return a new Validator instance */ protected Validator createValidator(FaceletContext ctx) { if (this.validatorId == null) { throw new TagException( this.tag, "Default behavior invoked of requiring a validator-id passed in the constructor, must override ValidateHandler(ValidatorConfig)"); } return ctx.getFacesContext().getApplication().createValidator( this.validatorId); }
public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException, FacesException, ELException { String name = basename.getValue(faceletContext); BundleMapWrapper map = new BundleMapWrapper(name); FacesContext facesContext = faceletContext.getFacesContext(); // TODO find a better way facesContext.getExternalContext(). getSessionMap().put(var.getValue(faceletContext), map); //getRequestMap().put(var.getValue(faceletContext), map); } }
protected void onComponentPopulated(FaceletContext faceletContext, UIComponent component, UIComponent parent) { super.onComponentPopulated(faceletContext, component, parent); if (component.getChildren().size() > 1 && component.getChildren().get(1) instanceof EditableValueHolder) { TobagoComponentHandler.addDefaultValidators(faceletContext.getFacesContext(), (EditableValueHolder) component.getChildren().get(1)); } }
private void setConverter( FaceletContext faceletContext, UIComponent parent, String nameValue, ValueExpression expression) { if (expression.isLiteralText()) { Converter converter = faceletContext.getFacesContext().getApplication().createConverter(expression.getExpressionString()); ((ValueHolder) parent).setConverter(converter); } else { ELAdaptor.setExpression(parent, nameValue, expression); } } }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent menuCommand, UIComponent parent) { Application application = faceletContext.getFacesContext().getApplication(); UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent); UIComponent component = application.createComponent(getSubComponentType()); final String uid; if (fieldIdAttribute != null) { uid = fieldIdAttribute.getValue(faceletContext); } else { uid = root.createUniqueId(); } component.setId(uid); component.setRendererType(getSubRendererType()); setSubComponentAttributes(faceletContext, component); menuCommand.getFacets().put(getFacetName(), component); }
/** * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext, * javax.faces.component.UIComponent) */ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { logger.debug("Apply called. Component: " + parent); ActionSource actionSource = (ActionSource) parent; if (sourceHasProperty(actionSource)) return; UpdateActionListener al = new UpdateActionListener(); if (converterAttr != null) al.setConverter((Converter) converterAttr.getObject(ctx)); Application app = ctx.getFacesContext().getApplication(); ValueBinding vb = app.createValueBinding(valueAttr.getValue()); al.setValueBinding(vb); vb = app.createValueBinding(propertyAttr.getValue()); al.setPropertyBinding(vb); actionSource.addActionListener(al); }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent separator, UIComponent parent) { Application application = faceletContext.getFacesContext().getApplication(); UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent); UIOutput label = (UIOutput) application.createComponent(UILabel.COMPONENT_TYPE); label.setId(root.createUniqueId()); label.setRendererType("Label"); setAttributes(faceletContext, label); separator.getFacets().put(Facets.LABEL, label); if (labelAttribute != null) { if (labelAttribute.isLiteral()) { label.setValue(labelAttribute.getValue(faceletContext)); } else { ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class); ELAdaptor.setExpression(label, Attributes.VALUE, expression); } } }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent panel, UIComponent parent) { Application application = faceletContext.getFacesContext().getApplication(); UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent); addGridLayout(faceletContext, panel, root); addLabel(faceletContext, (UIPanel) panel, root); String uid; if (fieldIdAttribute != null) { uid = fieldIdAttribute.getValue(faceletContext); } else { uid = root.createUniqueId(); } if (checkForAlreadyCreated(panel, uid)) { return; } UIComponent input = application.createComponent(getSubComponentType()); input.setRendererType(getSubRendererType()); input.setId(uid); setSubComponentAttributes(faceletContext, input); enrichInput(faceletContext, input); panel.getChildren().add(input); }