Exemple #1
0
  /**
   * Resets this instance to its default state. This method is meant to be used when recycling
   * {@link CSSNode} instances.
   */
  public void reset() {
    if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
      throw new IllegalStateException("You should not reset an attached CSSNode");
    }

    cssstyle.reset();
    csslayout.resetResult();
    lineIndex = 0;
    mLayoutState = LayoutState.DIRTY;
  }
Exemple #2
0
  private void toStringWithIndentation(StringBuilder result, int level) {
    // Spaces and tabs are dropped by IntelliJ logcat integration, so rely on __ instead.
    StringBuilder indentation = new StringBuilder();
    for (int i = 0; i < level; ++i) {
      indentation.append("__");
    }

    result.append(indentation.toString());
    result.append(csslayout.toString());
    result.append(cssstyle.toString());

    if (getChildCount() == 0) {
      return;
    }

    result.append(", children: [\n");
    for (int i = 0; i < getChildCount(); i++) {
      getChildAt(i).toStringWithIndentation(result, level + 1);
      result.append("\n");
    }
    result.append(indentation + "]");
  }
Exemple #3
0
 /** Performs the actual csslayout and saves the results in {@link #csslayout} */
 public void calculateLayout(CSSLayoutContext layoutContext) {
   csslayout.resetResult();
   LayoutEngine.layoutNode(layoutContext, this, CSSConstants.UNDEFINED, null);
 }