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

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


        LOG.warn("Illegal value for attibute 'forceVerticalScrollbar' : \""
            + forceScroolbar + "\"");
      }
    }

    HtmlStyleMap style = (HtmlStyleMap) data.getAttributes().get(ATTR_STYLE);
    Integer height = HtmlRendererUtil.getStyleAttributeIntValue(style, "height");
    if (height != null) {
      int first = data.getFirst();
      int rows = Math.min(data.getRowCount(), first + data.getRows()) - first;
      int heightNeeded = getHeaderHeight(facesContext, data)
View Full Code Here


    HtmlRendererUtil.prepareInnerStyle(component);

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

    HtmlStyleMap style = (HtmlStyleMap) component.getAttributes().get(ATTR_STYLE);

    if (style != null) {
      Integer styleHeight = style.getInt("height");
      if (styleHeight != null) {
        style.put("height", styleHeight-1);
      }
    }

    String clientId = component.getClientId(facesContext);
    writer.startElement(HtmlConstants.DIV, component);
View Full Code Here

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

  protected void encodeContent(TobagoResponseWriter writer,
      FacesContext facesContext, UIPanel activeTab) throws IOException {

    HtmlStyleMap bodyStyle = (HtmlStyleMap)
        activeTab.getParent().getAttributes().get(ATTR_STYLE_BODY);
    writer.startElement(HtmlConstants.TR, null);
    writer.startElement(HtmlConstants.TD, null);
    if (bodyStyle != null) {
      writer.writeAttribute(HtmlAttributes.STYLE, bodyStyle, null);
View Full Code Here

    UIData data = (UIData) uiComponent;

    HtmlRendererUtil.createHeaderAndBodyStyles(facesContext, data);

    final String sheetId = data.getClientId(facesContext);
    HtmlStyleMap sheetStyle = (HtmlStyleMap) data.getAttributes().get(ATTR_STYLE);

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    // Outher sheet div
    writer.startElement(HtmlConstants.DIV, null);
View Full Code Here

    String image1x1 = contextPath + resourceManager.getImage(viewRoot, "image/1x1.gif");
    String selectorDisabled = contextPath + resourceManager.getImage(viewRoot, "image/sheetUncheckedDisabled.gif");
    String unchecked = contextPath + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");

    Map attributes = data.getAttributes();
    HtmlStyleMap sheetStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE);
    //HtmlStyleMap headerStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE_HEADER);
//    String sheetWidthString = LayoutUtil.getStyleAttributeValue(sheetStyle,
//        "width");
    Integer sheetHeight = HtmlRendererUtil.getStyleAttributeIntValue(sheetStyle, "height");
    if (sheetHeight == null) {
      // FIXME: nullpointer if height not defined
      LOG.error("no height in parent container, setting to 100");
      sheetHeight = 100;
    }
    //HtmlStyleMap bodyStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE_BODY);
    int footerHeight = (Integer) attributes.get(ATTR_FOOTER_HEIGHT);

    String selectable = data.getSelectable();

    SheetState state = data.getSheetState(facesContext);
    List<Integer> columnWidths = data.getWidthList();

    String selectedRows = StringUtil.toString(getSelectedRows(data, state));
    List<UIColumn> renderedColumnList = data.getRenderedColumns();

    writer.startElement(HtmlConstants.INPUT, null);
    writer.writeIdAttribute(sheetId + WIDTHS_POSTFIX);
    writer.writeNameAttribute(sheetId + WIDTHS_POSTFIX);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    writer.writeAttribute(HtmlAttributes.VALUE, StringUtil.toString(columnWidths), false);
    writer.endElement(HtmlConstants.INPUT);

    writer.startElement(HtmlConstants.INPUT, null);
    writer.writeIdAttribute(sheetId + SCROLL_POSTFIX);
    writer.writeNameAttribute(sheetId + SCROLL_POSTFIX);
    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
    Integer[] scrollPosition = data.getScrollPosition();
    if (scrollPosition != null) {
      String scroll = scrollPosition[0] + ";" + scrollPosition[1];
      writer.writeAttribute(HtmlAttributes.VALUE, scroll, false);
    } else {
      writer.writeAttribute(HtmlAttributes.VALUE, "", false);
    }
    writer.endElement(HtmlConstants.INPUT);

    if (!NONE.equals(selectable)) {
      writer.startElement(HtmlConstants.INPUT, null);
      writer.writeIdAttribute(sheetId + SELECTED_POSTFIX);
      writer.writeNameAttribute(sheetId + SELECTED_POSTFIX);
      writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
      writer.writeAttribute(HtmlAttributes.VALUE, selectedRows, true);
      writer.endElement(HtmlConstants.INPUT);
    }


    final boolean showHeader = data.isShowHeader();
    if (showHeader) {
      // begin rendering header
      writer.startElement(HtmlConstants.DIV, null);
      writer.writeIdAttribute(sheetId + "_header_div");
      writer.writeClassAttribute("tobago-sheet-header-div");
     
      HtmlStyleMap headerStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE_HEADER);
      if (headerStyle != null) {
        Integer zIndex = (Integer) facesContext.getExternalContext().getRequestMap().get(TobagoConstants.ATTR_ZINDEX);
        if (zIndex == null) {
          zIndex = 1;
        } else {
          zIndex = zIndex + 4;
        }
        headerStyle.put("z-index", zIndex);
        writer.writeStyleAttribute(headerStyle);
      }

      int columnCount = 0;
      final int sortMarkerWidth = getAscendingMarkerWidth(facesContext, data);
      String imageAscending = contextPath + resourceManager.getImage(viewRoot, "image/ascending.gif");
      String imageDescending = contextPath + resourceManager.getImage(viewRoot, "image/descending.gif");
      String img = resourceManager.getImage(viewRoot, "image/unsorted.gif", true);
      String imageUnsorted = image1x1;
      if (img != null) {
        imageUnsorted = contextPath + img;
      }
      for (UIColumn column : renderedColumnList) {
        renderColumnHeader(facesContext, writer, data, columnCount, column,
            imageAscending, imageDescending, imageUnsorted, image1x1, sortMarkerWidth);
        columnCount++;
      }
      writer.startElement(HtmlConstants.DIV, null);
      writer.writeIdAttribute(sheetId + "_header_box_filler");
      writer.writeClassAttribute("tobago-sheet-header-box");
      writer.writeAttribute(HtmlAttributes.STYLE, "width: 0px", false);

      writer.startElement(HtmlConstants.DIV, null);
      writer.writeClassAttribute("tobago-sheet-header");
      writer.flush();
      writer.write("&nbsp;");
      writer.endElement(HtmlConstants.DIV);

      writer.endElement(HtmlConstants.DIV);
      writer.endElement(HtmlConstants.DIV);
      // end rendering header
    }

// BEGIN RENDER BODY CONTENT
    HtmlStyleMap bodyStyle = (HtmlStyleMap) attributes.get(ATTR_STYLE_BODY);
    HtmlRendererUtil.replaceStyleAttribute(data, ATTR_STYLE_BODY, "height", (sheetHeight - footerHeight));
    writer.startElement(HtmlConstants.DIV, null);
    writer.writeIdAttribute(sheetId + "_data_div");
    writer.writeClassAttribute("tobago-sheet-body-div ");
    writer.writeAttribute(HtmlAttributes.STYLE, bodyStyle.toString() + (showHeader?"":" padding-top: 0px;"), false);
    Integer space = HtmlRendererUtil.getStyleAttributeIntValue(bodyStyle, "width");
    HtmlStyleMap sheetBodyStyle = (HtmlStyleMap) bodyStyle.clone();
    //String sheetBodyStyle;
    if (space != null) {
//      intSpace -= columnWidths.get(columnWidths.size() - 1);
      space -= getContentBorder(facesContext, data);
      if (needVerticalScrollbar(facesContext, data)) {
        space -= getScrollbarWidth(facesContext, data);
      }
      sheetBodyStyle.put("width", space);
    }
    sheetBodyStyle.remove("height");



    writer.startElement(HtmlConstants.TABLE, null);
    writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
View Full Code Here

    if (isValidPagingValue(showRowRange)
        || isValidPagingValue(showPageRange)
        || isValidPagingValue(showDirectLinks)) {
      final Application application = facesContext.getApplication();
      final HtmlStyleMap footerStyle = (HtmlStyleMap) bodyStyle.clone();
      footerStyle.put("height", footerHeight);
      footerStyle.put("top", (sheetHeight - footerHeight));

        //  "height", MessageFormat.format("{0}px", footerHeight));
        //  + " top: " + (sheetHeight - footerHeight) + "px;";

      writer.startElement(HtmlConstants.DIV, data);
View Full Code Here

        LOG.warn("Illegal value for attibute 'forceVerticalScrollbar' : \""
            + forceScroolbar + "\"");
      }
    }

    HtmlStyleMap style = (HtmlStyleMap) data.getAttributes().get(ATTR_STYLE);
    Integer height = HtmlRendererUtil.getStyleAttributeIntValue(style, "height");
    if (height != null) {
      int first = data.getFirst();
      int rows = Math.min(data.getRowCount(), first + data.getRows()) - first;
      int heightNeeded = getHeaderHeight(facesContext, data)
View Full Code Here

public class BoxRenderer extends BoxRendererBase {

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

    HtmlStyleMap innerStyle = HtmlRendererUtil.prepareInnerStyle(component);

    UIComponent label = component.getFacet(FACET_LABEL);
    String labelString
        = (String) component.getAttributes().get(ATTR_LABEL);
    UIPanel toolbar = (UIPanel) component.getFacet(FACET_TOOL_BAR);
    if (toolbar != null) {
      final int padding = getConfiguredValue(facesContext, component, "paddingTopWhenToolbar");
      HtmlRendererUtil.replaceStyleAttribute(component, getAttrStyleKey(), "padding-top", padding);
      HtmlRendererUtil.replaceStyleAttribute(component, getAttrStyleKey(), "padding-bottom", 0);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlConstants.FIELDSET, component);
    writer.writeClassAttribute();
    writer.writeAttributeFromComponent(HtmlAttributes.STYLE, getAttrStyleKey());

    if (label != null || labelString != null) {
      writer.startElement(HtmlConstants.LEGEND, component);
      writer.writeClassAttribute();

      if (label != null) {
        RenderUtil.encode(facesContext, label);
      } else {
        writer.writeText(labelString);
      }
      writer.endElement(HtmlConstants.LEGEND);
    }

    if (toolbar != null) {
      writer.startElement(HtmlConstants.DIV, null);
      writer.writeClassAttribute("tobago-box-toolbar-div");
      writer.startElement(HtmlConstants.DIV, null);
      writer.writeClassAttribute("tobago-box-toolbar-span");
      final Map attributes = toolbar.getAttributes();
      attributes.put(
          ATTR_SUPPPRESS_TOOLBAR_CONTAINER, Boolean.TRUE);
      if (ToolBarTag.LABEL_BOTTOM.equals(attributes.get(ATTR_LABEL_POSITION))) {
        attributes.put(ATTR_LABEL_POSITION, ToolBarTag.LABEL_RIGHT);
      }
      if (ToolBarTag.ICON_BIG.equals(attributes.get(ATTR_ICON_SIZE))) {
        attributes.put(ATTR_ICON_SIZE, ToolBarTag.ICON_SMALL);
      }
      RenderUtil.encode(facesContext, toolbar);
      writer.endElement(HtmlConstants.DIV);
      writer.endElement(HtmlConstants.DIV);
      if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie()) {
        innerStyle.put("top", -10);
      }
    }
    writer.startElement(HtmlConstants.DIV, component);
    writer.writeClassAttribute();
    writer.writeStyleAttribute(innerStyle);
View Full Code Here

  }

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

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    HtmlStyleMap style = (HtmlStyleMap) component.getAttributes().get(ATTR_STYLE);

    if (style != null) {
      Integer styleHeight = style.getInt("height");
      if (styleHeight != null) {
        style.put("height", styleHeight-1);
      }
    }

    String clientId = component.getClientId(facesContext);
    writer.startElement(HtmlConstants.DIV, component);
View Full Code Here

    encodeBeginInner(facesContext, writer, component);
  }

  private void encodeBeginInner(FacesContext facesContext,
      TobagoResponseWriter writer, UIComponent component) throws IOException {
    HtmlStyleMap innerStyle = HtmlRendererUtil.prepareInnerStyle(component);

    renderBoxHeader(facesContext, writer, component);


    writer.startElement(HtmlConstants.DIV, component);
View Full Code Here

TOP

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

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.