/** * @param cssName * @return TODO */ public String getStringProperty(CSSName cssName) { return valueByName(cssName).asString(); }
public FSColor asColor(CSSName cssName) { FSDerivedValue prop = valueByName(cssName); if (prop == IdentValue.TRANSPARENT) { return FSRGBColor.TRANSPARENT; } else { return prop.asColor(); } }
protected static Integer getLengthValue(CalculatedStyle style, CSSName cssName) { FSDerivedValue widthValue = style.valueByName(cssName); if (widthValue instanceof LengthValue) { return new Integer((int)widthValue.asFloat()); } return null; } }
public Length asLength(CssContext c, CSSName cssName) { Length result = new Length(); FSDerivedValue value = valueByName(cssName); if (value instanceof LengthValue || value instanceof NumberValue) { if (value.hasAbsoluteUnit()) { result.setValue((int) value.getFloatProportionalTo(cssName, 0, c)); result.setType(Length.FIXED); } else { result.setValue((int) value.asFloat()); result.setType(Length.PERCENT); } } return result; }
/** * @param cssName * @param parentHeight * @param ctx * @return TODO */ public float getFloatPropertyProportionalHeight(CSSName cssName, float parentHeight, CssContext ctx) { return valueByName(cssName).getFloatProportionalTo(cssName, parentHeight, ctx); }
public boolean isAbsoluteWidth() { return valueByName(CSSName.WIDTH).hasAbsoluteUnit(); }
public String[] asStringArray(CSSName cssName) { return valueByName(cssName).asStringArray(); }
/** * Gets the ident attribute of the CalculatedStyle object * * @param cssName PARAM * @return The ident value */ public IdentValue getIdent(CSSName cssName) { return valueByName(cssName).asIdentValue(); }
public Length asLength(CssContext c, CSSName cssName) { Length result = new Length(); FSDerivedValue value = valueByName(cssName); if (value instanceof LengthValue || value instanceof NumberValue) { if (value.hasAbsoluteUnit()) { result.setValue((int) value.getFloatProportionalTo(cssName, 0, c)); result.setType(Length.FIXED); } else { result.setValue((int) value.asFloat()); result.setType(Length.PERCENT); } } return result; }
/** * @param cssName * @param parentWidth * @param ctx * @return TODO */ public float getFloatPropertyProportionalWidth(CSSName cssName, float parentWidth, CssContext ctx) { return valueByName(cssName).getFloatProportionalTo(cssName, parentWidth, ctx); }
public boolean hasAbsoluteUnit(CSSName cssName) { boolean isAbs = false; try { isAbs = valueByName(cssName).hasAbsoluteUnit(); } catch (Exception e) { XRLog.layout(Level.WARNING, "Property " + cssName + " has an assignment we don't understand, " + "and can't tell if it's an absolute unit or not. Assuming it is not. Exception was: " + e.getMessage()); isAbs = false; } return isAbs; }
public String[] asStringArray(CSSName cssName) { return valueByName(cssName).asStringArray(); }
/** * Gets the ident attribute of the CalculatedStyle object * * @param cssName PARAM * @return The ident value */ public IdentValue getIdent(CSSName cssName) { return valueByName(cssName).asIdentValue(); }
/** * @param cssName * @return TODO */ public String getStringProperty(CSSName cssName) { return valueByName(cssName).asString(); }
/** * @param cssName * @param parentWidth * @param ctx * @return TODO */ public float getFloatPropertyProportionalWidth(CSSName cssName, float parentWidth, CssContext ctx) { return valueByName(cssName).getFloatProportionalTo(cssName, parentWidth, ctx); }
public boolean hasAbsoluteUnit(CSSName cssName) { boolean isAbs = false; try { isAbs = valueByName(cssName).hasAbsoluteUnit(); } catch (Exception e) { XRLog.layout(Level.WARNING, "Property " + cssName + " has an assignment we don't understand, " + "and can't tell if it's an absolute unit or not. Assuming it is not. Exception was: " + e.getMessage()); isAbs = false; } return isAbs; }
public float asFloat(CSSName cssName) { return valueByName(cssName).asFloat(); }
public FontSpecification getFont(CssContext ctx) { if (_font == null) { _font = new FontSpecification(); _font.families = valueByName(CSSName.FONT_FAMILY).asStringArray(); FSDerivedValue fontSize = valueByName(CSSName.FONT_SIZE); if (fontSize instanceof IdentValue) { PropertyValue replacement; IdentValue resolved = resolveAbsoluteFontSize(); if (resolved != null) { replacement = FontSizeHelper.resolveAbsoluteFontSize(resolved, _font.families); } else { replacement = FontSizeHelper.getDefaultRelativeFontSize((IdentValue) fontSize); } _font.size = LengthValue.calcFloatProportionalValue( this, CSSName.FONT_SIZE, replacement.getCssText(), replacement.getFloatValue(), replacement.getPrimitiveType(), 0, ctx); } else { _font.size = getFloatPropertyProportionalTo(CSSName.FONT_SIZE, 0, ctx); } _font.fontWeight = getIdent(CSSName.FONT_WEIGHT); _font.fontStyle = getIdent(CSSName.FONT_STYLE); _font.variant = getIdent(CSSName.FONT_VARIANT); } return _font; }
public FSColor asColor(CSSName cssName) { FSDerivedValue prop = valueByName(cssName); if (prop == IdentValue.TRANSPARENT) { return FSRGBColor.TRANSPARENT; } else { return prop.asColor(); } }
public String asString(CSSName cssName) { return valueByName(cssName).asString(); }