Package javax.faces.component

Examples of javax.faces.component.UIGraphic


        {
            out.writeURIAttribute("background", getImageSrc(context, tree, "line-trunk.gif"), null);
        }

//      add the appropriate image for the nav control
        UIGraphic image = new UIGraphic();
        image.setId(IMAGE_PREFIX);
        image.setUrl(navSrcUrl);
        Map imageAttrs = image.getAttributes();
        imageAttrs.put(HTML.WIDTH_ATTR, "19");
        imageAttrs.put(HTML.HEIGHT_ATTR, "18");
        imageAttrs.put(HTML.BORDER_ATTR, "0");

        if (clientSideToggle)
        {
            /**
             * With client side toggle, user has the option to specify open/closed images for the node (in addition to
             * the navigtion ones provided by the component.)
             */
            String expandImgSrc = "";
            String collapseImgSrc = "";
            String nodeImageId = "";

            UIComponent expandFacet = nodeTypeFacet.getFacet("expand");
            if (expandFacet != null)
            {
                UIGraphic expandImg = (UIGraphic)expandFacet;
                expandImgSrc = context.getApplication().getViewHandler().getResourceURL(context, expandImg.getUrl());
                if (expandImg.isRendered())
                {
                    expandImg.setId(IMAGE_PREFIX + NODE_STATE_EXPANDED);
                    expandImg.setParent(tree);
                    nodeImageId = expandImg.getClientId(context);
                    nodeImgFacet = expandFacet;
                }
            }

            UIComponent collapseFacet = nodeTypeFacet.getFacet("collapse");
            if (collapseFacet != null)
            {
                UIGraphic collapseImg = (UIGraphic)collapseFacet;
                collapseImgSrc = context.getApplication().getViewHandler().getResourceURL(context, collapseImg.getUrl());
                if (collapseImg.isRendered())
                {
                    collapseImg.setId(IMAGE_PREFIX + NODE_STATE_CLOSED);
                    collapseImg.setParent(tree);
                    nodeImageId = collapseImg.getClientId(context);
                    nodeImgFacet = collapseFacet;
                }
            }

            image.setParent(tree);
View Full Code Here


    attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
        facesContext, "tobago", "datePickerCancel"));
    cancelButton.setId(DatePickerController.CLOSE_POPUP);

    // create image
    UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
        facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
    image.setRendered(true);
    image.setValue("image/date.gif");
    image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
    StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
    link.getChildren().add(image);
  }
View Full Code Here

      throw new JspException(e);
    }
  }

  public static UIGraphic getFirstGraphicChild(UIComponent component) {
    UIGraphic graphic = null;
    for (Object o : component.getChildren()) {
      UIComponent uiComponent = (UIComponent) o;
      if (uiComponent instanceof UIGraphic) {
        graphic = (UIGraphic) uiComponent;
        break;
View Full Code Here

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

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    UIGraphic graphic = (UIGraphic) component;
    final String value = graphic.getUrl();
    String src = value;
    if (src != null) {
      final String ucSrc = src.toUpperCase(Locale.ENGLISH);
      if (ucSrc.startsWith("HTTP:") || ucSrc.startsWith("FTP:")
          || ucSrc.startsWith("/")) {
        // absolute Path to image : nothing to do
      } else {
        src = null;
        if (isDisabled(graphic)) {
          src = ResourceManagerUtil.getImageWithPath(
              facesContext, HtmlRendererUtil.createSrc(value, "Disabled"), true);
        }
        if (src == null) {
          src = ResourceManagerUtil.getImageWithPath(facesContext, value);
        }
        HtmlRendererUtil.addImageSources(facesContext, writer, graphic.getUrl(),
            graphic.getClientId(facesContext));
      }
    }

    String border = (String) graphic.getAttributes().get(ATTR_BORDER);
    if (border == null) {
      border = "0";
    }
    String alt = (String) graphic.getAttributes().get(ATTR_ALT);
    if (alt == null) {
      alt = "";
    }
    String tip = (String) graphic.getAttributes().get(ATTR_TIP);



    writer.startElement(HtmlConstants.IMG, graphic);
    final String clientId = graphic.getClientId(facesContext);
    writer.writeIdAttribute(clientId);
    if (ComponentUtil.isHoverEnabled(graphic) && !isDisabled(graphic)) {
      writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
          "Tobago.imageMouseover('" + clientId + "')", false);
      writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
View Full Code Here

      throw new JspException(e);
    }
  }

  public static UIGraphic getFirstGraphicChild(UIComponent component) {
    UIGraphic graphic = null;
    for (UIComponent child : component.getChildren()) {
      if (child instanceof UIGraphic) {
        graphic = (UIGraphic) child;
        break;
      }
View Full Code Here

        {
            out.writeURIAttribute("background", getImageSrc(context, tree, "line-trunk.gif", true), null);
        }

//      add the appropriate image for the nav control
        UIGraphic image = new UIGraphic();
        image.setId(IMAGE_PREFIX);
        image.setUrl(navSrcUrl);
        Map imageAttrs = image.getAttributes();
        imageAttrs.put(HTML.WIDTH_ATTR, "19");
        imageAttrs.put(HTML.HEIGHT_ATTR, "18");
        imageAttrs.put(HTML.BORDER_ATTR, "0");

        if (clientSideToggle)
        {
            /**
             * With client side toggle, user has the option to specify open/closed images for the node (in addition to
             * the navigtion ones provided by the component.)
             */
            String expandImgSrc = "";
            String collapseImgSrc = "";
            String nodeImageId = "";

            UIComponent expandFacet = nodeTypeFacet.getFacet("expand");
            if (expandFacet != null)
            {
                UIGraphic expandImg = (UIGraphic)expandFacet;
                expandImgSrc = context.getApplication().getViewHandler().getResourceURL(context, expandImg.getUrl());
                if (expandImg.isRendered())
                {
                    expandImg.setId(IMAGE_PREFIX + NODE_STATE_EXPANDED);
                    expandImg.setParent(tree);
                    nodeImageId = expandImg.getClientId(context);
                    nodeImgFacet = expandFacet;
                }
            }

            UIComponent collapseFacet = nodeTypeFacet.getFacet("collapse");
            if (collapseFacet != null)
            {
                UIGraphic collapseImg = (UIGraphic)collapseFacet;
                collapseImgSrc = context.getApplication().getViewHandler().getResourceURL(context, collapseImg.getUrl());
                if (collapseImg.isRendered())
                {
                    collapseImg.setId(IMAGE_PREFIX + NODE_STATE_CLOSED);
                    collapseImg.setParent(tree);
                    nodeImageId = collapseImg.getClientId(context);
                    nodeImgFacet = collapseFacet;
                }
            }

            image.setParent(tree);
View Full Code Here

        {
            out.writeURIAttribute("background", getImageSrc(context, tree, "line-trunk.gif"), null);
        }

        // add the appropriate image for the nav control
        UIGraphic image = new UIGraphic();
        image.setId(context.getViewRoot().createUniqueId());
        image.setUrl(navSrcUrl);
        Map imageAttrs = image.getAttributes();
        imageAttrs.put(HTML.WIDTH_ATTR, "19");
        imageAttrs.put(HTML.HEIGHT_ATTR, "18");
        imageAttrs.put(HTML.BORDER_ATTR, "0");

        if (clientSideToggle)
        {
            /**
             * With client side toggle, user has the option to specify open/closed images for the node (in addition to
             * the navigtion ones provided by the component.)
             */
            String expandImgSrc = "";
            String collapseImgSrc = "";
            String nodeImageId = "";

            UIComponent expandFacet = nodeTypeFacet.getFacet("expand");
            if (expandFacet != null)
            {
                UIGraphic expandImg = (UIGraphic)expandFacet;
                expandImgSrc = expandImg.getUrl();
                if (expandImg.isRendered())
                {
                    expandImg.setId(context.getViewRoot().createUniqueId());
                    nodeImageId = expandImg.getClientId(context);
                    nodeImgFacet = expandFacet;
                }
            }

            UIComponent collapseFacet = nodeTypeFacet.getFacet("collapse");
            if (collapseFacet != null)
            {
                UIGraphic collapseImg = (UIGraphic)collapseFacet;
                collapseImgSrc = collapseImg.getUrl();
                if (collapseImg.isRendered())
                {
                    collapseImg.setId(context.getViewRoot().createUniqueId());
                    nodeImageId = collapseImg.getClientId(context);
                    nodeImgFacet = collapseFacet;
                }
            }

            if (node.getChildCount() > 0)
View Full Code Here

        // remove previous sort images
        List<UIComponent> children = component.getChildren();
        for (int i = children.size() - 1; i >= 0; i--) {
            // should only be one, but let's loop-remove just in case
            if (children.get(i) instanceof UIGraphic) {
                UIGraphic outputGraphic = (UIGraphic) children.get(i);
                if (!outputGraphic.getUrl().startsWith("/images/tb_sort")) {
                    continue; // only remove sort images, to allow images to exist in the sortable column
                }
                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
View Full Code Here

      throw new JspException(e);
    }
  }

  public static UIGraphic getFirstGraphicChild(UIComponent component) {
    UIGraphic graphic = null;
    for (Object o : component.getChildren()) {
      UIComponent uiComponent = (UIComponent) o;
      if (uiComponent instanceof UIGraphic) {
        graphic = (UIGraphic) uiComponent;
        break;
View Full Code Here

    attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
        facesContext, "tobago", "datePickerCancel"));
    cancelButton.setId(DatePickerController.CLOSE_POPUP);

    // create image
    UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
        facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
    image.setRendered(true);
    image.setValue("image/date.gif");
    image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
    image.getAttributes().put(ATTR_STYLE_CLASS, "tobago-input-picker");
    link.getChildren().add(image);
  }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIGraphic

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.