/** * Sets an FXG attribute on this FXG node. Delegates to the parent class to process attributes * that are not in the list below. * * <p>Graphic content nodes support the following attributes: * * <ul> * <li><b>rotation</b> (ASDegrees): Defaults to 0. * <li><b>scaleX</b> (Number): Defaults to 1. * <li><b>scaleY</b> (Number): Defaults to 1. * <li><b>x</b> (Number): The horizontal placement of the left edge of the text box, relative to * the parent grouping element. Defaults to 0. * <li><b>y</b> (Number): The vertical placement of the top edge of the text box, relative to * the parent grouping element. Defaults to 0. * <li><b>blendMode</b> (String): [normal, add, alpha, darken, difference, erase, hardlight, * invert, layer, lighten, multiply, normal, subtract, screen, overlay, auto, colordodge, * colorburn, exclusion, softlight, hue, saturation, color, luminosity] Defaults to auto. * <li><b>alpha</b> (ASAlpha): Defaults to 1. * <li><b>maskType</b> (String):[clip, alpha]: Defaults to clip. * <li><b>visible</b> (Boolean): Whether or not the text box is visible. Defaults to true. * </ul> * * <p>Graphic content nodes also support an id attribute. * * @param name - the unqualified attribute name * @param value - the attribute value * @throws FXGException if a value is out of the valid range. * @see com.adobe.internal.fxg.dom.AbstractFXGNode#setAttribute(java.lang.String, * java.lang.String) */ @Override public void setAttribute(String name, String value) { if (FXG_X_ATTRIBUTE.equals(name)) { x = DOMParserHelper.parseDouble(this, value, name); translateSet = true; } else if (FXG_Y_ATTRIBUTE.equals(name)) { y = DOMParserHelper.parseDouble(this, value, name); translateSet = true; } else if (FXG_ROTATION_ATTRIBUTE.equals(name)) { rotation = DOMParserHelper.parseDouble(this, value, name); rotationSet = true; } else if (FXG_SCALEX_ATTRIBUTE.equals(name)) { scaleX = DOMParserHelper.parseDouble(this, value, name); scaleSet = true; } else if (FXG_SCALEY_ATTRIBUTE.equals(name)) { scaleY = DOMParserHelper.parseDouble(this, value, name); scaleSet = true; } else if (FXG_ALPHA_ATTRIBUTE.equals(name)) { alpha = DOMParserHelper.parseDouble( this, value, name, ALPHA_MIN_INCLUSIVE, ALPHA_MAX_INCLUSIVE, alpha); alphaSet = true; } else if (FXG_BLENDMODE_ATTRIBUTE.equals(name)) { blendMode = parseBlendMode(this, value, blendMode); } else if (FXG_VISIBLE_ATTRIBUTE.equals(name)) { visible = DOMParserHelper.parseBoolean(this, value, name); } else if (FXG_ID_ATTRIBUTE.equals(name)) { id = value; } else if (FXG_MASKTYPE_ATTRIBUTE.equals(name)) { maskType = DOMParserHelper.parseMaskType(this, value, name, maskType); // Luminosity mask is not supported by Flex on Mobile in // FXG 2.0. if (isForMobile() && (maskType == MaskType.LUMINOSITY)) { FXGLog.getLogger() .log( FXGLogger.WARN, "MobileUnsupportedLuminosityMask", null, ((AbstractFXGNode) this).getDocumentName(), startLine, startColumn); maskTypeSet = false; } else { maskTypeSet = true; } } else if (getFileVersion().equalTo(FXGVersion.v1_0)) { // Rest of the attributes are not supported by FXG 1.0 // Exception:Attribute {0} not supported by node {1}. throw new FXGException( getStartLine(), getStartColumn(), "InvalidNodeAttribute", name, getNodeName()); } else if (FXG_LUMINOSITYCLIP_ATTRIBUTE.equals(name)) { luminosityClip = DOMParserHelper.parseBoolean(this, value, name); } else if (FXG_LUMINOSITYINVERT_ATTRIBUTE.equals(name)) { luminosityInvert = DOMParserHelper.parseBoolean(this, value, name); } else { super.setAttribute(name, value); } }
/** * Sets an FXG attribute on this text node. Delegates to the parent class to process attributes * that are not in the list below. * * @param name - the unqualified attribute name. * @param value - the attribute value. * @see com.adobe.internal.fxg.dom.AbstractFXGNode#addChild(FXGNode) */ @Override public void setAttribute(String name, String value) { if (FXG_ID_ATTRIBUTE.equals(name)) { id = value; } else { super.setAttribute(name, value); return; } // Remember attribute was set on this node. rememberAttribute(name, value); }
/** * Sets an FXG attribute on this stroke node. * * @param name - the unqualified attribute name. * @param value - the attribute value. * @param problems problem collection used to collect problems occurred within this method */ @Override public void setAttribute(String name, String value, Collection<ICompilerProblem> problems) { if (FXG_SCALEMODE_ATTRIBUTE.equals(name)) scaleMode = getScaleMode(value, problems); else if (FXG_CAPS_ATTRIBUTE.equals(name)) caps = getCaps(value, problems); else if (FXG_WEIGHT_ATTRIBUTE.equals(name)) weight = DOMParserHelper.parseDouble( this, value, name, WEIGHT_MIN_INCLUSIVE, WEIGHT_MAX_INCLUSIVE, weight, problems); else if (FXG_PIXELHINTING_ATTRIBUTE.equals(name)) pixelHinting = DOMParserHelper.parseBoolean(this, value, name, pixelHinting, problems); else if (FXG_JOINTS_ATTRIBUTE.equals(name)) joints = getJoints(value, problems); else if (FXG_MITERLIMIT_ATTRIBUTE.equals(name)) miterLimit = DOMParserHelper.parseDouble( this, value, name, MITERLIMIT_MIN_INCLUSIVE, MITERLIMIT_MAX_INCLUSIVE, miterLimit, problems); else if (FXG_ID_ATTRIBUTE.equals(name)) id = value; else super.setAttribute(name, value, problems); }