Package javax.faces.component

Examples of javax.faces.component.UIOutput


                }
                children.remove(i);
            }

            if (children.get(i) instanceof UIOutput) {
                UIOutput output = (UIOutput) children.get(i);
                String value = output.getValue().toString();
                if (isNumber(value)) {
                    // also remove sort index labels ('1', '2', '3') since they will be reconstructed below
                    children.remove(i);
                }
            }
        }

        PageControl pc = getPageControl(component);
        // changing the sort on the column

        int i = 0;
        for (OrderingField field : pc.getOrderingFields()) {
            i++;
            if (field.getField().equals(sort)) {
                UIGraphic image = new UIGraphic();
                if (field.getOrdering().equals(PageOrdering.ASC)) {
                    if (i == 1) {
                        image.setUrl("/images/tb_sortup.gif");
                    } else {
                        image.setUrl("/images/tb_sortup_inactive.gif");
                    }
                } else {
                    if (i == 1) {
                        image.setUrl("/images/tb_sortdown.gif");
                    } else {
                        image.setUrl("/images/tb_sortdown_inactive.gif");
                    }
                }

                /*
                 * add the image at the end of all components, which will make it into part of the hyperlink
                 */
                children.add(image);

                /*
                 * also, add a tiny number to indicate what order the columns are sorted in
                 */
                UIOutput label = new HtmlOutputLabel();
                label.setValue(String.valueOf(i));
                children.add(label);

                break;
            }
        }
View Full Code Here


    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

  public static boolean isHoverEnabled(UIComponent component) {
    return ComponentUtil.getBooleanAttribute(component, ATTR_HOVER);
  }

  public static UIOutput getFirstNonGraphicChild(UIComponent component) {
    UIOutput output = null;
    for (Object o : component.getChildren()) {
      UIComponent uiComponent = (UIComponent) o;
      if ((uiComponent instanceof UIOutput)
          && !(uiComponent instanceof UIGraphic)) {
        output = (UIOutput) uiComponent;
View Full Code Here

  private static final Log LOG = LogFactory.getLog(ProgressRenderer.class);
      
  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UIOutput component = (UIOutput) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(4, 1, 0, 10);
    }
View Full Code Here

  private static final Log LOG = LogFactory.getLog(ProgressRenderer.class);

  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UIOutput component = (UIOutput) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(40, 1, 0, 100);
    }

    String image = ResourceManagerUtil.getImageWithPath(facesContext, "image/1x1.gif");

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(
        model.getMaximum() - model.getValue());


    String title = (String) component.getAttributes().get(ATTR_TIP);
    if (title == null) {
      title = Integer.toString(100 * model.getValue()
          / (model.getMaximum() - model.getMinimum()))
          + " %";
    }
View Full Code Here

    };


  public void encodeEnd(FacesContext facesContext,
      UIComponent component) throws IOException {
    UIOutput output = (UIOutput) component;
    UIPage page = ComponentUtil.findPage(output);
    for (String script : SCRIPTS) {
      page.getScriptFiles().add(script);     
    }

    String id = output.getClientId(facesContext);

    String dateTextBoxId = (String) component.getAttributes().get(ATTR_CALENDAR_DATE_INPUT_ID);

    if (LOG.isDebugEnabled()) {
      LOG.debug("dateTextBoxId = '" + dateTextBoxId + "'");
    }

    Locale locale = facesContext.getViewRoot().getLocale();
    SimpleDateFormat dateFormat = new SimpleDateFormat("MMMMM yyyy", locale);

    Object value = output.getValue();
    Calendar calendar;
    if (value instanceof Calendar) {
      calendar = (Calendar) value;
    } else {
      calendar = new GregorianCalendar();
View Full Code Here

  }

  public void encodeEnd(
      FacesContext facesContext, UIComponent component) throws IOException {

    UIOutput output = (UIOutput) component;

    Integer width = LayoutUtil.getLayoutWidth(output);
    if (width == null
        && !(ComponentUtil.getBooleanAttribute(findParent(component), ATTR_INLINE)
             || ComponentUtil.getBooleanAttribute(component, ATTR_INLINE))) {
      width = new
          Integer(getConfiguredValue(facesContext, component, "labelWidth"));     
    }

    LabelWithAccessKey label = new LabelWithAccessKey(component);

    String forValue = ComponentUtil.findClientIdFor(output, facesContext);

    createClassAttribute(component);
    TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();

    writer.startElement(HtmlConstants.DIV, output);
    writer.writeComponentClass();   
    writer.writeAttribute(HtmlAttributes.STYLE, null, ATTR_STYLE);
    writer.startElement(HtmlConstants.A, output);
    writer.writeComponentClass();
    writer.startElement(HtmlConstants.LABEL, output);
    String clientId = output.getClientId(facesContext);
    writer.writeIdAttribute(clientId);
    if (forValue != null) {
      writer.writeAttribute(HtmlAttributes.FOR, forValue, null);
    }
    writer.writeComponentClass();
View Full Code Here

  }

  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);
      }
    }
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(UIOutput.COMPONENT_TYPE);
           
            // 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(UIOutput.COMPONENT_TYPE);

            // 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

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.