コード例 #1
0
  protected void encodeButton(FacesContext context, UIComponent component) throws IOException {
    FacesContext currentInstance = FacesContext.getCurrentInstance();
    ScrollButton scrollButton = (ScrollButton) component;
    ResponseWriter writer = context.getResponseWriter();

    writeIdAttribute(context, scrollButton);
    writer.startElement("div", scrollButton);
    writer.writeAttribute(
        "class",
        Styles.getCSSClass(
            context,
            scrollButton,
            scrollButton.getButtonStyle(),
            StyleGroup.regularStyleGroup(),
            scrollButton.getButtonClass(),
            getDefaultScrollButtonClass()),
        null);
    writer.writeAttribute("nowrap", "nowrap", null);
    writer.writeAttribute("align", "center", null);
    writer.writeAttribute("valign", "middle", null);

    String imageUrl;
    String buttonImageUrl = (String) scrollButton.getAttributes().get("buttonImageUrl");
    if (scrollButton.getScrollDirection().equals(ScrollDirection.UP))
      imageUrl = Resources.getURL(context, buttonImageUrl, null, "input/scrollButtonUp.gif");
    else imageUrl = Resources.getURL(context, buttonImageUrl, null, "input/scrollButtonDown.gif");
    writer.startElement("img", scrollButton);
    writeIdAttribute(context, scrollButton);
    writer.writeAttribute("src", imageUrl, null);
    writer.endElement("img");

    writer.endElement("div");
    InitScript initScript = renderInitScript(currentInstance, scrollButton);
    Rendering.renderInitScripts(currentInstance, initScript);
  }