Package com.google.gwt.safecss.shared

Examples of com.google.gwt.safecss.shared.SafeStyles


    setElement(Document.get().createDivElement());
    setStyleName(styles.footer());
    getElement().getStyle().setOverflow(Overflow.HIDDEN);

    SafeStyles rowStyles = XDOM.EMPTY_SAFE_STYLE;

    getElement().setInnerHTML(
        tpls.table("", rowStyles, SafeHtmlUtils.EMPTY_SAFE_HTML,
            gridView.renderHiddenHeaders(gridView.getColumnWidths())).asString());
View Full Code Here


    if (height == -1) {
      // default
      height = 200;
    }

    SafeStyles offsetStyles = createThumbStyles(fractionalValue, height);
    SafeStyles heightStyle = SafeStylesUtils.fromTrustedString("");

    // ends
    height -= getTrackPadding();
    heightStyle = SafeStylesUtils.fromTrustedString("height: " + height + "px;");
View Full Code Here

    }
   
    // padding
    width -= getTrackPadding();

    SafeStyles offsetStyles = createThumbStyles(fractionalValue, width);
    SafeStyles widthStyle = SafeStylesUtils.fromTrustedString("width: " + width + "px;");
    sb.append(template.template(resources.style(), widthStyle, offsetStyles));
  }
View Full Code Here

  protected SafeStyles createThumbStyles(double fractionalValue, int width) {
    int offset = (int) (fractionalValue * (width - 21)) - getHalfThumbWidth();

    offset = Math.max(-(getHalfThumbWidth()), offset);

    SafeStyles offsetStyles = SafeStylesUtils.fromTrustedString("left:" + offset + "px;");
    return offsetStyles;
  }
View Full Code Here

    if (!hideTrigger) {
      width -= getResources().triggerArrow().getWidth();
    }
    width = Math.max(0, width);
    SafeStyles inputStyles = SafeStylesUtils.fromTrustedString("width:" + width + "px;");

    sb.appendHtmlConstant("<div style='" + wrapStyles + "' class='" + getStyle().wrap() + "'>");

    if (!hideTrigger) {
      sb.appendHtmlConstant("<table cellpadding=0 cellspacing=0><tr><td>");
View Full Code Here

    int rows = cm.getAggregationRows().size();

    String cellInner = styles.cellInner() + " " + gridView.getStateStyles().cellInner();

    SafeStyles empty = XDOM.EMPTY_SAFE_STYLE;

    for (int j = 0; j < rows; j++) {
      AggregationRowConfig<M> config = cm.getAggregationRow(j);

      SafeHtmlBuilder trBuilder = new SafeHtmlBuilder();

      // loop each cell per row
      for (int i = 0; i < colCount; i++) {
        String cellClass = styles.cell() + " " + gridView.getStateStyles().cell();
        String cs = config.getCellStyle(cm.getColumn(i));
        if (cs != null) {
          cellClass += " " + cs;
        }
        HorizontalAlignmentConstant align = cm.getColumnAlignment(i);
        SafeStyles s = empty;
        if (align != null) {
          s = SafeStylesUtils.fromTrustedString("text-align:" + align.getTextAlignString() + ";");
        }
        trBuilder.append(tpls.td(i, cellClass, empty, cellInner, s, getRenderedValue(j, i)));
      }
View Full Code Here

    SafeHtml iconHtml = AbstractImagePrototype.create(icon).getSafeHtml();
    if (height == -1) {
      builder.append(templates.icon(style.iconWrap(), iconHtml));
    } else {
      int adjustedHeight = height - heightOffset;
      SafeStyles heightStyle = SafeStylesUtils.fromTrustedString("height:" + adjustedHeight + "px;");
      builder.append(templates.iconWithStyles(style.iconWrap(), heightStyle, iconHtml));
    }
  }
View Full Code Here

    int[] columnWidths = getColumnWidths();

    // root builder
    SafeHtmlBuilder buf = new SafeHtmlBuilder();

    final SafeStyles rowStyles = SafeStylesUtils.fromTrustedString("width: " + getTotalWidth() + "px;");

    final String unselectableClass = unselectable;
    final String rowAltClass = styles.rowAlt();
    final String rowDirtyClass = styles.rowDirty();

    final String cellClass = styles.cell() + " " + states.cell();
    final String cellInnerClass = styles.cellInner() + " " + states.cellInner();
    final String cellFirstClass = "x-grid-cell-first";
    final String cellLastClass = "x-grid-cell-last";
    final String cellDirty = styles.cellDirty();

    final String rowWrap = styles.rowWrap() + " " + states.rowWrap();
    final String rowBody = styles.rowBody() + " " + states.rowBody();
    final String rowBodyRow = states.rowBodyRow();

    // loop over all rows
    for (int j = 0; j < rows.size(); j++) {
      M model = rows.get(j);

      ListStore<M>.Record r = ds.hasRecord(model) ? ds.getRecord(model) : null;

      int rowBodyColSpanCount = colCount;
      if (enableRowBody) {
        for (ColumnConfig<M, ?> c : cm.getColumns()) {
          if (c instanceof RowExpander) {
            rowBodyColSpanCount--;
          }
        }
      }

      int rowIndex = (j + startRow);

      String rowClasses = styles.row() + " " + states.row();

      if (!selectable) {
        rowClasses += " " + unselectableClass;
      }
      if (isStripeRows() && ((rowIndex + 1) % 2 == 0)) {
        rowClasses += " " + rowAltClass;
      }

      if (showDirtyCells && r != null && r.isDirty()) {
        rowClasses += " " + rowDirtyClass;
      }

      if (viewConfig != null) {
        rowClasses += " " + viewConfig.getRowStyle(model, rowIndex);
      }

      SafeHtmlBuilder trBuilder = new SafeHtmlBuilder();

      // loop each cell per row
      for (int i = 0; i < colCount; i++) {
        SafeHtml rv = getRenderedValue(rowIndex, i, model, r);
        ColumnConfig<M, ?> columnConfig = cm.getColumn(i);
        ColumnData columnData = cs.get(i);

        String cellClasses = cellClass;
        if (i == 0) {
          cellClasses += " " + cellFirstClass;
        } else if (i == last) {
          cellClasses += " " + cellLastClass;
        }

        String cellInnerClasses = cellInnerClass;
        if (columnConfig.getColumnTextClassName() != null) {
          cellInnerClasses += " " + columnConfig.getColumnTextClassName();
        }
        if (!columnConfig.isCellPadding()) {
          cellInnerClasses += " " + styles.noPadding();
        }

        if (columnData.getClassNames() != null) {
          cellClasses += " " + columnData.getClassNames();
        }

        if (columnConfig.getCellClassName() != null) {
          cellClasses += " " + columnConfig.getCellClassName();
        }

        if (showDirtyCells && r != null && r.getChange(columnConfig.getValueProvider()) != null) {
          cellClasses += " " + cellDirty;
        }

        if (viewConfig != null) {
          cellClasses += " " + viewConfig.getColStyle(model, cm.getValueProvider(i), rowIndex, i);
        }

        final SafeStyles cellStyles = columnData.getStyles();

        final SafeHtml tdContent;
        if (enableRowBody && i == 0) {
          tdContent = tpls.tdRowSpan(i, cellClasses, cellStyles, rowBodyRowSpan, cellInnerClasses, rv);
        } else {
View Full Code Here

   * @return the styles
   */
  protected SafeStyles getColumnStyle(int colIndex, boolean isHeader) {
    SafeStylesBuilder builder = new SafeStylesBuilder();
    if (!isHeader) {
      SafeStyles columnStyles = cm.getColumnStyles(colIndex);
      if (columnStyles != null) {
        builder.append(columnStyles);
      }
    }

View Full Code Here

      txt = SafeHtmlUtils.fromString(text);
    }
   
    int adj = GXT.isIE() ? 4 : 2;

    SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:" + (options.getWidth() - adj) + "px;");
    SafeStyles progressBarStyles = SafeStylesUtils.fromTrustedString("width:" + vw + "px;");
    SafeStyles progressTextStyles = SafeStylesUtils.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
    SafeStyles widthStyles = SafeStylesUtils.fromTrustedString("width:" + (Math.max(0, options.getWidth() - adj)) + "px;");
    sb.append(template.render(txt, style, wrapStyles, progressBarStyles, progressTextStyles, widthStyles));
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.safecss.shared.SafeStyles

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.