Package org.apache.myfaces.tobago.component

Examples of org.apache.myfaces.tobago.component.UILink


  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UILink component = (UILink) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (actionListener != null) {
      component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (link != null) {
      component.setValueExpression("link", link);
    }

    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (inline != null) {
      if (!inline.isLiteralText()) {
        component.setValueExpression("inline", inline);
      } else {
        component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
      }
    }
    if (action != null) {
      component.setActionExpression(action);
    }
    if (resource != null) {
      component.setValueExpression("resource", resource);
    }

    if (jsfResource != null) {
      if (!jsfResource.isLiteralText()) {
        component.setValueExpression("jsfResource", jsfResource);
      } else {
        component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
      }
    }
    if (transition != null) {
      if (!transition.isLiteralText()) {
        component.setValueExpression("transition", transition);
      } else {
        component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        component.setValueExpression("immediate", immediate);
      } else {
        component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
      }
    }
    if (renderedPartially != null) {
      if (!renderedPartially.isLiteralText()) {
        component.setValueExpression("renderedPartially", renderedPartially);
      } else {
        component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
      }
    }
    if (target != null) {
      component.setValueExpression("target", target);
    }

    if (onclick != null) {
      component.setValueExpression("onclick", onclick);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here


  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UILink component = (UILink) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (actionListener != null) {
      component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (link != null) {
      component.setValueExpression("link", link);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (inline != null) {
      if (!inline.isLiteralText()) {
        component.setValueExpression("inline", inline);
      } else {
        component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
      }
    }
    if (action != null) {
      component.setActionExpression(action);
    }
    if (resource != null) {
      component.setValueExpression("resource", resource);
    }

    if (jsfResource != null) {
      if (!jsfResource.isLiteralText()) {
        component.setValueExpression("jsfResource", jsfResource);
      } else {
        component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
      }
    }
    if (transition != null) {
      if (!transition.isLiteralText()) {
        component.setValueExpression("transition", transition);
      } else {
        component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        component.setValueExpression("immediate", immediate);
      } else {
        component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
      }
    }
    if (renderedPartially != null) {
      if (!renderedPartially.isLiteralText()) {
        component.setValueExpression("renderedPartially", renderedPartially);
      } else {
        component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
      }
    }
    if (target != null) {
      component.setValueExpression("target", target);
    }

    if (onclick != null) {
      component.setValueExpression("onclick", onclick);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

  private static final Logger LOG = LoggerFactory.getLogger(LinkRenderer.class);

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

    UILink link = (UILink) component;
    String clientId = link.getClientId(facesContext);
    CommandRendererHelper helper = new CommandRendererHelper(facesContext, link, CommandRendererHelper.Tag.ANCHOR);
    String href = helper.getHref();
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    LabelWithAccessKey label = new LabelWithAccessKey(link);

    if (helper.isDisabled()) {
      writer.startElement(HtmlElements.SPAN, link);
    } else {
      writer.startElement(HtmlElements.A, link);
      writer.writeAttribute(HtmlAttributes.HREF, href, true);
      if (helper.getOnclick() != null) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
      }
      if (helper.getTarget() != null) {
        writer.writeAttribute(HtmlAttributes.TARGET, helper.getTarget(), true);
      }
      Integer tabIndex = null;
      if (link instanceof UILink) {
        tabIndex = ((UILink) link).getTabIndex();
      } else {
        Deprecation.LOG.warn("LinkRenderer should only render UILink but got " + link.getClass().getName()
        + " id=" + link.getClientId(facesContext));
      }
      if (tabIndex != null) {
        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
      }
    }
    Style style = new Style(facesContext, link);
    writer.writeStyleAttribute(style);
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);
    writer.writeClassAttribute(Classes.create(link));
    writer.writeIdAttribute(clientId);
    writer.writeNameAttribute(clientId);
    HtmlRendererUtils.renderTip(link, writer);
    writer.flush();

//  image
    String image = link.getImage();
    if (image != null) {
      if (ResourceManagerUtils.isAbsoluteResource(image)) {
        // absolute Path to image : nothing to do
      } else {
        image = getImageWithPath(facesContext, image, helper.isDisabled());
      }
      writer.startElement(HtmlElements.IMG, link);
      writer.writeAttribute(HtmlAttributes.SRC, image, true);
      writer.writeAttribute(HtmlAttributes.BORDER, 0); // TODO: is border=0 setting via style possible?
      String tip = link.getTip();
      writer.writeAttribute(HtmlAttributes.ALT, tip != null ? tip : "", true);
      if (tip != null) {
        writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
      }
      writer.endElement(HtmlElements.IMG);
View Full Code Here

    }
  }

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

    UILink link = (UILink) component;
    ResponseWriter writer = facesContext.getResponseWriter();
    if (link.isDisabled()) {
      writer.endElement(HtmlElements.SPAN);
    } else {
      writer.endElement(HtmlElements.A);
    }
  }
View Full Code Here

  private static final Logger LOG = LoggerFactory.getLogger(LinkRenderer.class);

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

    UILink link = (UILink) component;
    String clientId = link.getClientId(facesContext);
    CommandRendererHelper helper = new CommandRendererHelper(facesContext, link, CommandRendererHelper.Tag.ANCHOR);
    String href = helper.getHref();
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    LabelWithAccessKey label = new LabelWithAccessKey(link);

    if (helper.isDisabled()) {
      writer.startElement(HtmlElements.SPAN, link);
    } else {
      writer.startElement(HtmlElements.A, link);
      writer.writeAttribute(HtmlAttributes.HREF, href, true);
      if (helper.getOnclick() != null) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
      }
      if (helper.getTarget() != null) {
        writer.writeAttribute(HtmlAttributes.TARGET, helper.getTarget(), true);
      }
      Integer tabIndex = null;
      if (link instanceof UILink) {
        tabIndex = ((UILink) link).getTabIndex();
      } else {
        Deprecation.LOG.warn("LinkRenderer should only render UILink but got " + link.getClass().getName()
        + " id=" + link.getClientId(facesContext));
      }
      if (tabIndex != null) {
        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
      }
    }
    Style style = new Style(facesContext, link);
    writer.writeStyleAttribute(style);
    HtmlRendererUtils.renderDojoDndItem(component, writer, true);
    writer.writeClassAttribute(Classes.create(link));
    writer.writeIdAttribute(clientId);
    writer.writeNameAttribute(clientId);
    HtmlRendererUtils.renderTip(link, writer);
    writer.flush();

//  image
    String image = link.getImage();
    if (image != null) {
      if (ResourceManagerUtils.isAbsoluteResource(image)) {
        // absolute Path to image : nothing to do
      } else {
        image = getImageWithPath(facesContext, image, helper.isDisabled());
      }
      writer.startElement(HtmlElements.IMG, link);
      writer.writeAttribute(HtmlAttributes.SRC, image, true);
      writer.writeAttribute(HtmlAttributes.BORDER, 0); // TODO: is border=0 setting via style possible?
      String tip = link.getTip();
      writer.writeAttribute(HtmlAttributes.ALT, tip != null ? tip : "", true);
      if (tip != null) {
        writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
      }
      writer.endElement(HtmlElements.IMG);
View Full Code Here

    }
  }

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

    UILink link = (UILink) component;
    ResponseWriter writer = facesContext.getResponseWriter();
    if (link.isDisabled()) {
      writer.endElement(HtmlElements.SPAN);
    } else {
      writer.endElement(HtmlElements.A);
    }
  }
View Full Code Here

    }
  }

  @Override
  public Measure getPreferredWidth(FacesContext facesContext, Configurable component) {
    UILink link = (UILink) component;
    LabelWithAccessKey label = new LabelWithAccessKey(link);
    return RenderUtils.calculateStringWidth(facesContext, link, label.getText());
  }
View Full Code Here

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UILink component = (UILink) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (actionListener != null) {
      component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (link != null) {
      component.setValueExpression("link", link);
    }

    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (inline != null) {
      if (!inline.isLiteralText()) {
        component.setValueExpression("inline", inline);
      } else {
        component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
      }
    }
    if (action != null) {
      component.setActionExpression(action);
    }
    if (jsfResource != null) {
      if (!jsfResource.isLiteralText()) {
        component.setValueExpression("jsfResource", jsfResource);
      } else {
        component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
      }
    }
    if (resource != null) {
      component.setValueExpression("resource", resource);
    }

    if (transition != null) {
      if (!transition.isLiteralText()) {
        component.setValueExpression("transition", transition);
      } else {
        component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        component.setValueExpression("immediate", immediate);
      } else {
        component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
      }
    }
    if (omit != null) {
      if (!omit.isLiteralText()) {
        component.setValueExpression("omit", omit);
      } else {
        component.setOmit(Boolean.parseBoolean(omit.getExpressionString()));
      }
    }
    if (renderedPartially != null) {
      if (!renderedPartially.isLiteralText()) {
        component.setValueExpression("renderedPartially", renderedPartially);
      } else {
        component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
      }
    }
    if (target != null) {
      component.setValueExpression("target", target);
    }

    if (onclick != null) {
      component.setValueExpression("onclick", onclick);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UILink component = (UILink) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (actionListener != null) {
      component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (link != null) {
      component.setValueExpression("link", link);
    }

    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (inline != null) {
      if (!inline.isLiteralText()) {
        component.setValueExpression("inline", inline);
      } else {
        component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
      }
    }
    if (action != null) {
      component.setActionExpression(action);
    }
    if (jsfResource != null) {
      if (!jsfResource.isLiteralText()) {
        component.setValueExpression("jsfResource", jsfResource);
      } else {
        component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
      }
    }
    if (resource != null) {
      component.setValueExpression("resource", resource);
    }

    if (transition != null) {
      if (!transition.isLiteralText()) {
        component.setValueExpression("transition", transition);
      } else {
        component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        component.setValueExpression("immediate", immediate);
      } else {
        component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
      }
    }
    if (omit != null) {
      if (!omit.isLiteralText()) {
        component.setValueExpression("omit", omit);
      } else {
        component.setOmit(Boolean.parseBoolean(omit.getExpressionString()));
      }
    }
    if (renderedPartially != null) {
      if (!renderedPartially.isLiteralText()) {
        component.setValueExpression("renderedPartially", renderedPartially);
      } else {
        component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
      }
    }
    if (target != null) {
      component.setValueExpression("target", target);
    }

    if (onclick != null) {
      component.setValueExpression("onclick", onclick);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UILink component = (UILink) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (actionListener != null) {
      component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (link != null) {
      component.setValueExpression("link", link);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (action != null) {
      component.setActionExpression(action);
    }
    if (jsfResource != null) {
      if (!jsfResource.isLiteralText()) {
        component.setValueExpression("jsfResource", jsfResource);
      } else {
        component.setJsfResource(Boolean.parseBoolean(jsfResource.getExpressionString()));
      }
    }
    if (resource != null) {
      component.setValueExpression("resource", resource);
    }

    if (transition != null) {
      if (!transition.isLiteralText()) {
        component.setValueExpression("transition", transition);
      } else {
        component.setTransition(Boolean.parseBoolean(transition.getExpressionString()));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        component.setValueExpression("immediate", immediate);
      } else {
        component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
      }
    }
    if (omit != null) {
      if (!omit.isLiteralText()) {
        component.setValueExpression("omit", omit);
      } else {
        component.setOmit(Boolean.parseBoolean(omit.getExpressionString()));
      }
    }
    if (renderedPartially != null) {
      if (!renderedPartially.isLiteralText()) {
        component.setValueExpression("renderedPartially", renderedPartially);
      } else {
        component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
      }
    }
    if (target != null) {
      component.setValueExpression("target", target);
    }

    if (onclick != null) {
      component.setValueExpression("onclick", onclick);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.component.UILink

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.