Package org.apache.myfaces.tobago.renderkit.html

Examples of org.apache.myfaces.tobago.renderkit.html.CommandRendererHelper


        && ((UICommand) component).getActionListeners().length == 0) {
      String searchId = component.getClientId(facesContext)
          + MenuBarRenderer.SEARCH_ID_POSTFIX;
      return "tobagoButtonOpenMenu(this, '" + searchId + "')";
    } else {
      CommandRendererHelper helper
          = new CommandRendererHelper(facesContext, (UICommand) component);
      return helper.getOnclick();
    }
  }
View Full Code Here


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

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

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

    LabelWithAccessKey label = new LabelWithAccessKey(component);

    if (helper.isDisabled()) {
      writer.startElement(HtmlConstants.SPAN, component);
    } else {
      writer.startElement(HtmlConstants.A, component);
      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);
      }
    }
    writer.writeClassAttribute();
    writer.writeIdAttribute(clientId);
    writer.writeNameAttribute(clientId);
View Full Code Here

  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
    String clientId = component.getClientId(facesContext);
    String buttonType = createButtonType(component);

    CommandRendererHelper helper
        = new CommandRendererHelper(facesContext, (UICommand) component, CommandRendererHelper.Tag.BUTTON);

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    LabelWithAccessKey label = new LabelWithAccessKey(component);

    writer.startElement(HtmlConstants.BUTTON, component);
    writer.writeAttribute(HtmlAttributes.TYPE, buttonType, false);
    writer.writeNameAttribute(clientId);
    writer.writeIdAttribute(clientId);
    writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
    writer.writeAttribute(HtmlAttributes.DISABLED, helper.isDisabled());
    if (helper.getOnclick() != null) {
      writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
    }
    writer.writeStyleAttribute();
    writer.writeClassAttribute();
    writer.flush(); // force closing the start tag
View Full Code Here

    return index;
  }

  private void addMenuEntry(StringBuilder sb, String var, FacesContext facesContext, UICommand command)
      throws IOException {
    CommandRendererHelper helper = new CommandRendererHelper(facesContext, command);
    String onclick = helper.getOnclick();
    if (command instanceof UIMenuCommand) {
      if (command.getFacet(FACET_ITEMS) != null) {
        UIComponent facet = command.getFacet(FACET_ITEMS);
        if (facet instanceof UISelectOne) {
          addSelectOne(sb, var, facesContext, command, onclick);
View Full Code Here

        && ((UICommand) component).getActionListeners().length == 0) {
      String searchId = component.getClientId(facesContext)
          + MenuBarRenderer.SEARCH_ID_POSTFIX;
      return "tobagoButtonOpenMenu(this, '" + searchId + "')";
    } else {
      CommandRendererHelper helper
          = new CommandRendererHelper(facesContext, (UICommand) component);
      return helper.getOnclick();
    }
  }
View Full Code Here

        UICommand pagerCommand = (UICommand) data.getFacet(FACET_PAGER_ROW);
        if (pagerCommand == null) {
          pagerCommand = createPagingCommand(application, PageAction.TO_ROW, false);
          data.getFacets().put(FACET_PAGER_ROW, pagerCommand);
        }
        String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
        final String pagerCommandId = pagerCommand.getClientId(facesContext);

        final String className = "tobago-sheet-paging-rows-span"
            + " tobago-sheet-paging-span-" + showRowRange;

        writer.startElement(HtmlConstants.SPAN, null);
        writer.writeAttribute(HtmlAttributes.ONCLICK, "tobagoSheetEditPagingRow(this, '"
            + pagerCommandId + "', '" + pagingOnClick + "')", true);
        writer.writeClassAttribute(className);
        writer.writeAttribute(HtmlAttributes.TITLE, ResourceManagerUtil.getPropertyNotNull(
            facesContext, "tobago", "sheetPagingInfoRowPagingTip"), true);
        writer.writeText("");
        writer.write(createSheetPagingInfo(data, facesContext,
            pagerCommandId, true));
        writer.endElement(HtmlConstants.SPAN);
      }


      if (isValidPagingValue(showDirectLinks)) {
        final String className = "tobago-sheet-paging-links-span"
            + " tobago-sheet-paging-span-" + showDirectLinks;

        writer.startElement(HtmlConstants.SPAN, null);
        writer.writeClassAttribute(className);
        writer.writeIdAttribute(sheetId + SUBCOMPONENT_SEP + "pagingLinks");
        writeDirectPagingLinks(writer, facesContext, application, data);
        writer.endElement(HtmlConstants.SPAN);
      }

      if (isValidPagingValue(showPageRange)) {
        UICommand pagerCommand
            = (UICommand) data.getFacet(FACET_PAGER_PAGE);
        if (pagerCommand == null) {
          pagerCommand = createPagingCommand(
              application, PageAction.TO_PAGE, false);
          data.getFacets().put(FACET_PAGER_PAGE, pagerCommand);
        }
        String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
        final String pagerCommandId = pagerCommand.getClientId(facesContext);

        final String className = "tobago-sheet-paging-pages-span"
            + " tobago-sheet-paging-span-" + showPageRange;
View Full Code Here

        + (disabled ? " tobago-sheet-footer-pager-button-disabled" : ""));
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
    writer.writeAttribute(HtmlAttributes.ALT, "", false);
    if (!disabled) {
      CommandRendererHelper helper = new CommandRendererHelper(facesContext, link);
      String onClick = helper.getOnclick();
      writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, true);
    }
    writer.endElement(HtmlConstants.IMG);
  }
View Full Code Here

      pagerCommand = createPagingCommand(
          application, PageAction.TO_PAGE, false);
      data.getFacets().put(FACET_PAGER_PAGE, pagerCommand);
    }
    String pagerCommandId = pagerCommand.getClientId(facesContext);
    String onclick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
    String hrefPostfix = "', '" + onclick + "');";

    int linkCount = ComponentUtil.getIntAttribute(data, ATTR_DIRECT_LINK_COUNT);
    linkCount--;  // current page needs no link
    ArrayList<Integer> prevs = new ArrayList<Integer>(linkCount);
View Full Code Here

        UICommand pagerCommand = (UICommand) data.getFacet(FACET_PAGER_ROW);
        if (pagerCommand == null) {
          pagerCommand = createPagingCommand(application, PageAction.TO_ROW, false);
          data.getFacets().put(FACET_PAGER_ROW, pagerCommand);
        }
        String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
        final String pagerCommandId = pagerCommand.getClientId(facesContext);

        final String className = "tobago-sheet-paging-rows-span"
            + " tobago-sheet-paging-span-" + showRowRange;

        writer.startElement(HtmlConstants.SPAN, null);
        writer.writeAttribute(HtmlAttributes.ONCLICK, "tobagoSheetEditPagingRow(this, '"
            + pagerCommandId + "', '" + pagingOnClick + "')", true);
        writer.writeClassAttribute(className);
        writer.writeAttribute(HtmlAttributes.TITLE, ResourceManagerUtil.getPropertyNotNull(
            facesContext, "tobago", "sheetPagingInfoRowPagingTip"), true);
        writer.writeText("");
        writer.write(createSheetPagingInfo(data, facesContext,
            pagerCommandId, true));
        writer.endElement(HtmlConstants.SPAN);
      }


      if (isValidPagingValue(showDirectLinks)) {
        final String className = "tobago-sheet-paging-links-span"
            + " tobago-sheet-paging-span-" + showDirectLinks;

        writer.startElement(HtmlConstants.SPAN, null);
        writer.writeClassAttribute(className);
        writer.writeIdAttribute(sheetId + SUBCOMPONENT_SEP + "pagingLinks");
        writeDirectPagingLinks(writer, facesContext, application, data);
        writer.endElement(HtmlConstants.SPAN);
      }

      if (isValidPagingValue(showPageRange)) {
        UICommand pagerCommand
            = (UICommand) data.getFacet(FACET_PAGER_PAGE);
        if (pagerCommand == null) {
          pagerCommand = createPagingCommand(
              application, PageAction.TO_PAGE, false);
          data.getFacets().put(FACET_PAGER_PAGE, pagerCommand);
        }
        String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
        final String pagerCommandId = pagerCommand.getClientId(facesContext);

        final String className = "tobago-sheet-paging-pages-span"
            + " tobago-sheet-paging-span-" + showPageRange;
View Full Code Here

        + (disabled ? " tobago-sheet-footer-pager-button-disabled" : ""));
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
    writer.writeAttribute(HtmlAttributes.ALT, "", false);
    if (!disabled) {
      CommandRendererHelper helper = new CommandRendererHelper(facesContext, link);
      String onClick = helper.getOnclick();
      writer.writeAttribute(HtmlAttributes.ONCLICK, onClick, true);
    }
    writer.endElement(HtmlConstants.IMG);
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.renderkit.html.CommandRendererHelper

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.