public DesignObjects(UInt32 classId, ClassPointer rootPointer, ILimnorDesignPane pane, ObjectIDmap map) { _classId = classId; _rootPointer = rootPointer; _pane = pane; _map = map; }
/// <summary> /// it must be called from a separated app domain other than the designer. /// </summary> /// <param name="xmlFile"></param> public void Load(string xmlFile) { ProjectEnvironment.RunMode = true; XmlDocument doc = new XmlDocument(); doc.Load(xmlFile); XmlNode _node = doc.DocumentElement; LimnorProject project = new LimnorProject(LimnorProject.GetProjectFileByComponentFile(xmlFile)); //create root object UInt32 classId = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ClassID); UInt32 memberId = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ComponentID); ObjectIDmap map = new ObjectIDmap(project, DesignUtil.MakeDDWord(memberId, classId), _node); XmlObjectReader xr = new XmlObjectReader(map, ClassPointer.OnAfterReadRootComponent, ClassPointer.OnRootComponentCreated); map.SetReader(xr); _rootId = new ClassPointer(classId, memberId, map, null); string file = project.GetComponentFileByClassId(classId); ComponentLoader loader = new ComponentLoader(xr, file); DesignSurface ds = new DesignSurface(); ds.BeginLoad(loader); if (xr.Errors != null && xr.Errors.Count > 0) { MathNode.Log(xr.Errors); } _rootId.LoadActionInstances(); }
public static DesignObjects RemoveDesignObjects(LimnorProject project, UInt32 classId) { ClassPointer rootPointer = null; if (project.HasTypedData <ClassPointer>(classId)) { rootPointer = project.GetTypedData <ClassPointer>(classId); } ILimnorDesignPane pane = null; if (project.HasTypedData <ILimnorDesignPane>(classId)) { pane = project.GetTypedData <ILimnorDesignPane>(classId); } ObjectIDmap map = null; if (project.HasTypedData <ObjectIDmap>(classId)) { map = project.GetTypedData <ObjectIDmap>(classId); } DesignObjects obj = new DesignObjects(classId, rootPointer, pane, map); project.RemoveTypedData <ILimnorDesignPane>(classId); project.RemoveTypedData <ClassPointer>(classId); project.RemoveTypedData <ObjectIDmap>(classId); return(obj); }
public void OnComponentRemoved(object obj) { ObjectIDmap map = null; ClassInstancePointer cr = obj as ClassInstancePointer; if (cr != null) { map = _loader.ObjectMap.GetMap(cr.ObjectInstance); } else { map = _loader.ObjectMap.GetMap(obj); } if (map != null) { TreeNode node = null; if (cr != null) { node = _objExplorer.LocateNode(cr); } else { IObjectPointer o = DesignUtil.CreateObjectPointer(map, obj); node = _objExplorer.LocateNode(o); } if (node != null) { node.Remove(); } } }
public void OnComponentRemoved(object obj) { ObjectIDmap map = null; ClassInstancePointer cr = obj as ClassInstancePointer; if (cr != null) { map = _loader.ObjectMap.GetMap(cr.ObjectInstance); } else { map = _loader.ObjectMap.GetMap(obj); } //if (map == null) //{ // throw new DesignerException("object map not found for {0} when removing component", obj); //} if (map != null) { TreeNode node = null; if (cr != null) { node = _objExplorer.LocateNode(cr); } else { IObjectPointer o = DesignUtil.CreateObjectPointer(map, obj); node = _objExplorer.LocateNode(o); } if (node != null) { node.Remove(); } } }
public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (_owner != null) { _owner.OnPostSerialize(objMap, objectNode, saved, serializer); } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (_prj == null) { _prj = objMap.Project; } resolveDataType(); }
public CustomEventHandlerType(ObjectIDmap objList) : this( objList.ClassId, objList.MemberId, objList ) { }
public void OnDelayedPostSerialize(ObjectIDmap objMap, XmlNode objectNode, XmlObjectReader reader) { if (_prj == null) { _prj = objMap.Project; } resolveDataType(); }
public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (_resource == null) { ProjectResources rh = objMap.Project.GetProjectSingleData <ProjectResources>(); _resource = rh.GetResourcePointerById(_id); } }
public RootComponentData(bool isMain, ObjectIDmap map, RootClassId rootId, XmlNode xml, LimnorProject prj) { IsMainRoot = isMain; _objectMap = map; _rootClassId = rootId; _node = xml; _project = prj; }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { } else { } }
public virtual void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (BaseClassType != null) { if (BaseClassType.IsGenericParameter || BaseClassType.IsGenericType) { XmlObjectReader xr = serializer as XmlObjectReader; if (xr != null) { if (xr.ObjectStack.Count > 0) { DataTypePointer dp = null; IEnumerator ie = xr.ObjectStack.GetEnumerator(); while (ie.MoveNext()) { if (ie.Current != this) { ActionClass act = ie.Current as ActionClass; if (act != null) { dp = act.GetConcreteType(this.BaseClassType); if (dp != null) { break; } } else { MethodClass mc = ie.Current as MethodClass; if (mc != null) { dp = mc.GetConcreteType(this.BaseClassType); if (dp != null) { break; } } } } } if (dp != null) { if (BaseClassType.IsGenericParameter) { _type.SetConcreteType(dp); } else { _type.TypeParameters = dp.TypeParameters; } } } } } } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { base.OnPostSerialize(objMap, objectNode, saved, serializer); MemberId = XmlUtility.XmlUtil.GetAttributeUInt(objectNode, XmlTags.XMLATT_memberId); //load attributes from base ClassPointer root = objMap.GetTypedData <ClassPointer>(); PropertyClassInherited p = root.GetBaseProperty(this.Name, BaseClassId, BasePropertyId); CopyFromInherited(p); }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { _prj = objMap.Project; _root = objMap.RootPointer as ClassPointer; Type cp = this.ClassType; if (cp != null) { SetLabelText(cp.Name); } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { } else { if (this.ClassPointer == null) { this.ClassPointer = new ActionBranchParameter(_actionBranch); } } }
public void OnPostSerialize(ObjectIDmap objMap, System.Xml.XmlNode objectNode, bool saved, object serializer) { if (saved) { } else { if (_method != null) { SetOwnerMethod(_method); } LinkJumpedBranches(); } }
public override void OnDelayedPostSerialize(ObjectIDmap objMap, XmlNode objectNode, XmlObjectReader reader) { base.OnDelayedPostSerialize(objMap, objectNode, reader); string refName = XmlUtil.GetAttribute(objectNode, XML_ATTR_DataSource); if (!string.IsNullOrEmpty(refName)) { IComponent ic = RootPointer.GetComponentByName(refName); if (ic != null) { _dataSource = ic; } } }
/// <summary> /// find the tree node for the object to adjust text /// </summary> /// <param name="obj"></param> /// <param name="newName"></param> public void OnComponentRename(object obj, string newName) { ObjectIDmap map = _loader.ObjectMap.GetMap(obj); if (map == null) { throw new DesignerException("object map not found for {0} when setting new name {1}", obj, newName); } IObjectPointer o = DesignUtil.CreateObjectPointer(map, obj); TreeNodeObject node = _objExplorer.LocateNode(o) as TreeNodeObject; if (node != null) { node.ShowText(); } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { } else { if (MemberId == objMap.MemberId) { ClassPointer = objMap.GetTypedData <ClassPointer>(); } else { ClassInstancePointer cr = DesignUtil.GetClassRef(WholeId, objMap); if (cr != null) { ClassPointer = cr; } else { object v = objMap.GetObjectByID(MemberId); if (v == null) { if (objMap.Count == 0) { } else { if (MemberId == 3667767822) { //it is the HtmlElement_body } else { //this time the object may not be available. } } } else { MemberComponentId mc = MemberComponentId.CreateMemberComponentId(objMap.GetTypedData <ClassPointer>(), v, MemberId, null); ClassPointer = mc; } } } } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { } else { if (ClassPointer == null) { if (_type != null) { LocalVariable v = _type.CreateVariable(_name, objMap.ClassId, MemberId); v.Owner = Method; ClassPointer = v; } } } }
public void OnComponentRemoved(object obj) { ObjectIDmap map = null; ClassInstancePointer cr = obj as ClassInstancePointer; if (cr != null) { map = _loader.ObjectMap.GetMap(cr.ObjectInstance); } else { map = _loader.ObjectMap.GetMap(obj); if (map == null) { IComponent ic = obj as IComponent; if (ic != null && ic.Site != null) { object key = _loader.ObjectMap.GetObjectByName(ic.Site.Name); if (key != null) { obj = key; map = _loader.ObjectMap; } } } } if (map != null) { TreeNode node = null; if (cr != null) { node = _objExplorer.LocateNode(cr); } else { IObjectPointer o = DesignUtil.CreateObjectPointer(map, obj); node = _objExplorer.LocateNode(o); } if (node != null) { node.Remove(); } } }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_MethodID, MemberId); XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_ClassID, ClassId); } else { UInt32 classId = XmlUtil.GetAttributeUInt(objectNode, XmlTags.XMLATT_ClassID); MemberId = XmlUtil.GetAttributeUInt(objectNode, XmlTags.XMLATT_MethodID); ClassPointer root = RootPointer; if (root == null) { throw new DesignerException("Owner class not set for base method [{0},{1}]", classId, MemberId); } if (classId == root.ClassId) { SetDeclarerDirect(root); } else { ClassPointer declarer = root.GetBaseClass(classId); if (declarer == null) { throw new DesignerException("Base class not set for base method [{0},{1}]", classId, MemberId); } SetDeclarerDirect(declarer); } MethodOverride baseMethod = root.GetCustomMethodByBaseMethodId(classId, MemberId); if (baseMethod == null) { throw new DesignerException("Base method not found [{0},{1}]", classId, MemberId); } DataTypePointer[] dps = new DataTypePointer[baseMethod.ParameterCount]; for (int i = 0; i < baseMethod.ParameterCount; i++) { dps[i] = baseMethod.Parameters[i]; } ParametersMatch(dps); Parameters = baseMethod.Parameters; } }
public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { if (saved) { tryDeseirialize(); if (_parameter != null) { XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_MethodID, _parameter.MethodId); XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_ParamId, _parameter.ParameterID); XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_NAME, _parameter.Name); XmlUtil.SetAttribute(objectNode, XmlTags.XMLATT_ClassID, _parameter.ClassId); } } else { _reader = serializer as XmlObjectReader; _objMap = objMap; _objectNode = objectNode; } }
/// <summary> /// find the tree node for the object to adjust text /// </summary> /// <param name="obj"></param> /// <param name="newName"></param> public void OnComponentRename(object obj, string newName) { HtmlElement_ItemBase hei = obj as HtmlElement_ItemBase; if (hei != null) { _objExplorer.OnHtmlElementIdChanged(hei); } else { ObjectIDmap map = _loader.ObjectMap.GetMap(obj); if (map == null) { map = _loader.ObjectMap; } IObjectPointer o = DesignUtil.CreateObjectPointer(map, obj); TreeNodeObject node = _objExplorer.LocateNode(o) as TreeNodeObject; if (node != null) { node.ShowText(); } } }
public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { }
public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { base.OnPostSerialize(objMap, objectNode, saved, serializer); }
public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer) { throw new NotImplementedException(); }
public void SetReader(ObjectIDmap objMap, XmlNode objectNode, XmlObjectReader reader) { _objMap = objMap; _objectNode = objectNode; _reader = reader; }
public void OnDelayedPostSerialize(ObjectIDmap objMap, XmlNode objectNode, XmlObjectReader reader) { OnDeserialize(objMap.GetTypedData <ClassPointer>()); }