Package javax.faces.component

Examples of javax.faces.component.UIOutput


    public int doAfterBody() throws JspException
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent != null)
        {
            UIOutput component = (UIOutput)getComponentInstance();
            component.setValue(bodyContent.getString());
        }
        return super.doAfterBody();
    }
View Full Code Here


        }
      }
      else
      {
         // Oh well, can't simply create the component so put a dummy one in its place
         return new UIOutput();
      }
   }
View Full Code Here

    public int doAfterBody() throws JspException
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent != null)
        {
            UIOutput component = (UIOutput)getComponentInstance();
            component.setValue(bodyContent.getString());
            bodyContent.clearBody();
        }
        return super.getDoAfterBodyValue();
    }
View Full Code Here

    /**
     * Creates a UIComponent from the BodyContent
     */
    protected UIComponent createVerbatimComponentFromBodyContent()
    {
        UIOutput verbatimComp = null;

        if (bodyContent != null)
        {
            String strContent = bodyContent.getString();

            if (strContent != null)
            {
                String trimmedContent = strContent.trim();
                if (trimmedContent.length() > 0 && !isComment(strContent))
                {
                    verbatimComp = createVerbatimComponent();
                    verbatimComp.setValue(strContent);
                }
            }

            bodyContent.clearBody();
        }
View Full Code Here

     * <code>id</code> is <code>FacesContext.getViewRoot().createUniqueId()</code>
     * </p>
     */
    protected UIOutput createVerbatimComponent()
    {
        UIOutput verbatimComp =
                (UIOutput)getFacesContext().getApplication().createComponent("javax.faces.HtmlOutputText");
        verbatimComp.setTransient(true);
        verbatimComp.getAttributes().put("escape", Boolean.FALSE);
        verbatimComp.setId(getFacesContext().getViewRoot().createUniqueId());

        return verbatimComp;
    }
View Full Code Here

        {
            Application application = context.getApplication();
           
            // Create a UIOutput instance by passing javax.faces.Output. to
            // Application.createComponent(java.lang.String).
            UIOutput output = (UIOutput) application.createComponent(context, UIOutput.COMPONENT_TYPE, null);
           
            // Get the annotation instance from the class and obtain the values of the name, library, and
            // target attributes.
            String name = annotation.name();
            if (name != null && name.length() > 0)
            {
                name = ELText.parse(getExpressionFactory(),
                                    context.getELContext(), name).toString(context.getELContext());
            }
           
            // Obtain the renderer-type for the resource name by passing name to
            // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
            String rendererType = application.getResourceHandler().getRendererTypeForResourceName(name);
           
            // Call setRendererType on the UIOutput instance, passing the renderer-type.
            output.setRendererType(rendererType);
           
            // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
            Map<String, Object> attributes = output.getAttributes();
           
            // Store the name into the attributes Map under the key "name".
            attributes.put("name", name);
           
            // If library is the empty string, let library be null.
View Full Code Here

        // If this annotation is not present on the class in question, no action must be taken.
        if (annotation != null)
        {
            // Create a UIOutput instance by passing javax.faces.Output. to
            // Application.createComponent(java.lang.String).
            UIOutput output = (UIOutput) createComponent(context, UIOutput.COMPONENT_TYPE, null);

            // Get the annotation instance from the class and obtain the values of the name, library, and
            // target attributes.
            String name = annotation.name();
            if (name != null && name.length() > 0)
            {
                name = ELText.parse(getExpressionFactory(),
                                    context.getELContext(), name).toString(context.getELContext());
            }

            // Obtain the renderer-type for the resource name by passing name to
            // ResourceHandler.getRendererTypeForResourceName(java.lang.String).
            // (note that we can not use this.getResourceHandler(), because the Application might be wrapped)
            String rendererType = context.getApplication().getResourceHandler().getRendererTypeForResourceName(name);

            // Call setRendererType on the UIOutput instance, passing the renderer-type.
            output.setRendererType(rendererType);

            // Obtain the Map of attributes from the UIOutput component by calling UIComponent.getAttributes().
            Map<String, Object> attributes = output.getAttributes();

            // Store the name into the attributes Map under the key "name".
            attributes.put("name", name);

            // If library is the empty string, let library be null.
View Full Code Here

     * @return UIComponent or null
     */
    @Override
    protected UIComponent createVerbatimComponentFromBodyContent()
    {
        UIOutput component = (UIOutput)super.createVerbatimComponentFromBodyContent();
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Object response = facesContext.getExternalContext().getResponse();
        String wrappedOutput;

        if (response instanceof ServletViewResponseWrapper)
        {
            ServletViewResponseWrapper wrappedResponse = (ServletViewResponseWrapper)response;
            wrappedOutput = wrappedResponse.toString();
            if (wrappedOutput != null && wrappedOutput.length() > 0)
            {
                String componentvalue = null;
                if (component != null)
                {
                    // save the Value of the Bodycontent
                    componentvalue = (String)component.getValue();
                }
                component = super.createVerbatimComponent();
                if (componentvalue != null)
                {
                    component.setValue(wrappedOutput + componentvalue);
                }
                else
                {
                    component.setValue(wrappedOutput);
                }
                wrappedResponse.reset();
            }
        }
        return component;
View Full Code Here

    return "Bouquet de Jasmin et d'Euphorbe<br/>Pour une femme passionnée<br/>entrainez dans votre sillage les sphynxs de l'orient ...</br>";
  }

  public HtmlOutputText getHtml() {
    HtmlOutputText result = new HtmlOutputText();
    UIOutput out = new SimpleOutput();
    String id = request.getParameter("id");
    String htmlContent = getHtmlContentInDb(id);
    out.setValue(htmlContent);
    result.setValue(out);
    result.setEscape(true);
    return result;
  }
View Full Code Here

    @NotNull
    public static UIOutput addJavaScript(@NotNull
    UIComponent parent, FacesComponentIdFactory idFactory, @Nullable
    CharSequence src, @Nullable
    CharSequence script) {
        UIOutput output = createComponent(UIOutput.class, idFactory);
        output.getAttributes().put("escape", Boolean.FALSE);
        StringBuilder value = new StringBuilder();
        value.append("\n<script language=\"JavaScript\" type=\"text/javascript\"");
        if (src != null) {
            value.append(" src=\"").append(src).append("\"");
        }

        value.append(">");
        if (script != null) {
            value.append("\n").append(script).append("\n");
        }

        value.append("</script>\n");
        output.setValue(value);
        parent.getChildren().add(output);
        return output;
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.