/// <summary> /// Encode the given mxStylesheet. /// </summary> public override XmlNode Encode(mxCodec enc, Object obj) { XmlElement node = enc.Document.CreateElement(GetName()); if (obj is mxStylesheet) { mxStylesheet stylesheet = (mxStylesheet)obj; foreach (KeyValuePair <string, Dictionary <string, Object> > entry in stylesheet.Styles) { XmlElement styleNode = enc.Document.CreateElement("add"); styleNode.SetAttribute("as", entry.Key); foreach (KeyValuePair <string, Object> entry2 in entry.Value) { XmlElement entryNode = enc.Document.CreateElement("add"); entryNode.SetAttribute("as", entry2.Key); entryNode.SetAttribute("value", getStringValue(entry2)); styleNode.AppendChild(entryNode); } if (styleNode.ChildNodes.Count > 0) { node.AppendChild(styleNode); } } } return(node); }
/// <summary> /// Constructs a new graph for the specified model. If no model is /// specified, then a new, empty graph model is used. /// </summary> public mxGraph(mxStylesheet stylesheet) : this(null, stylesheet) { }
/// <summary> /// Constructs a new graph for the specified model. If no model is /// specified, then a new, empty graph model is used. /// </summary> public mxGraph(mxIGraphModel model, mxStylesheet stylesheet) { this.Model = (model != null) ? model : new mxGraphModel(); this.Stylesheet = (stylesheet != null) ? stylesheet : CreateStylesheet(); this.View = CreateGraphView(); }