GoDiagram Win Reference
InheritsFromTransformer Property

Gets or sets a transformer from which this transformer will inherit implementation of the IGoXmlTransformer methods.
Syntax
'Declaration
 
Public Property InheritsFromTransformer As IGoXmlTransformer
public IGoXmlTransformer InheritsFromTransformer {get; set;}

Property Value

this defaults to null
Remarks

Normally when you want to extend the behavior of a GoXmlWriter or a GoXmlReader, you define your own transformer inheriting from GoXmlTransformer and add it to the writer and/or the reader. You can do this for additional Types, or you can replace the transformer for a Type.

Sometimes you would like to modify the behavior of a transformer but for some reason you are unable to inherit from that IGoXmlTransformer-implementing class. This property makes it easier to insert additional functionality into an existing GoXmlWriter by replacing a particular Type's transformer with your own transformer that does some stuff and then delegates the rest of the implementation to the old transformer that had been registered for that Type.

For example, imagine that you are using a GoXmlWriter such as GoSvgWriter that already knows how to handle many Types, but you want to add some attributes and some elements to what is generated for that Type. If you cannot easily define your own transformer class inheriting from the Type's existing transformer class, you could do something such as the following to add information to each generated SVG element for GoSubGraphs. public class ExtraSubGraphTransformer : GoSvgGenerator { public ExtraSubGraphTransformer() { this.TransformerType = typeof(GoSubGraph); } public override void GenerateAttributes(Object obj) { WriteAttrVal("extra", "attribute"); base.GenerateAttributes(obj); } public override void GenerateBody(Object obj) { WriteStartElement("extra"); WriteTextBody("element"); WriteEndElement(); base.GenerateBody(obj); } } Then where you initialize the GoSvgWriter, you can replace the transformer for GoSubGraph with your own transformer that also makes use of the old one. GoSvgWriter w = new GoSvgWriter(); ExtraSubGraphTransformer egt = new ExtraSubGraphTransformer(); egt.InheritsFromTransformer = w.GetTransformer(typeof(GoSubGraph)); w.SetTransformer(typeof(GoSubGraph), egt); . . . more initialization and use of the writer

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GoXmlTransformer Class
GoXmlTransformer Members

 

 


© 2015. Northwoods Software Corporation. All Rights Reserved.

Send Feedback