/** * Creates a new instance of PropertyDeclaration from an {@link * CSSPrimitiveValue} instance. * * @param cssName * @param value The CSSValue to wrap * @param imp True if property was declared important! and false if * not. * @param orig int constant from {@link Stylesheet} for the origin of * the property declaration, that is, the origin of the style sheet * where it was declared. See {@link StylesheetInfo#USER_AGENT}, {@link * StylesheetInfo#USER}, and {@link StylesheetInfo#AUTHOR}. */ public PropertyDeclaration(CSSName cssName, org.w3c.dom.css.CSSPrimitiveValue value, boolean imp, int orig) { this.propName = cssName.toString(); this.cssName = cssName; this.cssPrimitiveValue = value; this.important = imp; this.origin = orig; }
/** * Creates a new instance of PropertyDeclaration from an {@link * CSSPrimitiveValue} instance. * * @param cssName * @param value The CSSValue to wrap * @param imp True if property was declared important! and false if * not. * @param orig int constant from {@link Stylesheet} for the origin of * the property declaration, that is, the origin of the style sheet * where it was declared. See {@link StylesheetInfo#USER_AGENT}, {@link * StylesheetInfo#USER}, and {@link StylesheetInfo#AUTHOR}. */ public PropertyDeclaration(CSSName cssName, org.w3c.dom.css.CSSPrimitiveValue value, boolean imp, int orig) { this.propName = cssName.toString(); this.cssName = cssName; this.cssPrimitiveValue = value; this.important = imp; this.origin = orig; }
private String genStyleKey() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < _derivedValuesById.length; i++) { CSSName name = CSSName.getByID(i); FSDerivedValue val = _derivedValuesById[i]; if (val != null) { sb.append(name.toString()); } else { sb.append("(no prop assigned in this pos)"); } sb.append("|\n"); } return sb.toString(); }
private String genStyleKey() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < _derivedValuesById.length; i++) { CSSName name = CSSName.getByID(i); FSDerivedValue val = _derivedValuesById[i]; if (val != null) { sb.append(name.toString()); } else { sb.append("(no prop assigned in this pos)"); } sb.append("|\n"); } return sb.toString(); }
private static void adjustTablePadding(Element tableElement, double finalRatio) { Collection<Element> tds = findElementsByTagName(tableElement, ELEMENT_TD); for (Element tdElement : tds) { setStyleToElement(tdElement, CSSName.PADDING_SHORTHAND.toString(), finalRatio / 2 + "em"); } }
/** * Scale down the table element based on its number of characters * * @param tableElement html table element to be scaled down */ public static void scaleTableBaseOnNumberOfCharacters(Element tableElement) { if (tableElement == null) { return; } int noOfTRCharacters = detectCrossTableMaxCharacters(tableElement); double scaleRatio = FontRangeHelper.getCharacterCountInstance().getFontSize(noOfTRCharacters).doubleValue(); setStyleToElement(tableElement, CSSName.FONT_SIZE.toString(), String.valueOf(scaleRatio) + "em"); }
/** * Scale down the table element based on its number of columns * * @param tableElement html table element to be scaled down */ public static void scaleTableBaseOnNumberOfColumns(Element tableElement) { if (tableElement == null) { return; } int numOfColumn = detectNumberOfColumnsFromElement(tableElement); if (numOfColumn == 0) { return; } double scaleRatio = FontRangeHelper.getColumnCountInstance().getFontSize(numOfColumn).doubleValue(); setStyleToElement(tableElement, CSSName.FONT_SIZE.toString(), String.valueOf(scaleRatio) + "em"); }
setStyleToElement(tableElement, CSSName.FONT_SIZE.toString(), String.valueOf(finalRatio) + "em");