protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); if (!_selecting) { if (SelectedObject != null) { if (this.SelectedIndex > 0) { ComponentDataDisplay s = this.Items[this.SelectedIndex] as ComponentDataDisplay; if (s != null) { EventArgsObjectSelection ev = new EventArgsObjectSelection(s); SelectedObject(this, ev); } else { HtmlElement_BodyBase heb = this.Items[this.SelectedIndex] as HtmlElement_BodyBase; if (heb != null) { EventArgsHtmlElementSelection eh = new EventArgsHtmlElementSelection(heb); SelectedObject(this, eh); } } } } } }
public void SelectHtmlElement(HtmlElement_BodyBase element) { bool found = false; if (this.Items.Count > 0) { for (int i = 0; i < this.Items.Count; i++) { HtmlElement_BodyBase heb = this.Items[i] as HtmlElement_BodyBase; if (heb != null) { if (heb.IsSameElement(element)) { found = true; _selecting = true; this.SelectedIndex = i; _selecting = false; break; } } } if (!found) { this.SelectedIndex = 0; } } }
private static void setDataBind0(HtmlNode node, HtmlElement_BodyBase hbb) { bool first = true; StringBuilder dbs = new StringBuilder(); for (int i = 0; i < hbb.DataBindings.Count; i++) { if (hbb.DataBindings[i].BindingMemberInfo != null && !string.IsNullOrEmpty(hbb.DataBindings[i].BindingMemberInfo.BindingPath) && !string.IsNullOrEmpty(hbb.DataBindings[i].BindingMemberInfo.BindingField) && !string.IsNullOrEmpty(hbb.DataBindings[i].PropertyName) ) { if (first) { first = false; } else { dbs.Append(";"); } dbs.Append(hbb.DataBindings[i].BindingMemberInfo.BindingPath); dbs.Append(":"); dbs.Append(hbb.DataBindings[i].BindingMemberInfo.BindingField); dbs.Append(":"); dbs.Append(hbb.DataBindings[i].PropertyName); } } node.SetAttributeValue("jsdb", dbs.ToString()); }
public override void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (typeof(HtmlElement_BodyBase).IsAssignableFrom(this.ParameterLibType)) { HtmlElement_BodyBase.CompilerCreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver); } else { WebPageCompilerUtility.CreateActionJavaScript(this.GetJavaScriptReferenceCode(code), methodName, code, parameters, returnReceiver); } }
public TreeNodeHtmlElement(HtmlElement_BodyBase element) : base(element) { ShowText(); ImageIndex = getTreeIcon(); SelectedImageIndex = ImageIndex; if (!(element is HtmlElementUnknown)) { this.Nodes.Add(new TreeNodeHtmlMemberLoader()); this.Nodes.Add(new ActionLoader(false)); } }
private void mi_useIt(object sender, EventArgs e) { if (!(this.HtmlElement is HtmlElementUnknown) && this.HtmlElement.ElementGuid == Guid.Empty) { HtmlElement_BodyBase hbb = this.HtmlElement as HtmlElement_BodyBase; if (hbb != null) { ClassPointer root = this.RootClassPointer; if (root != null) { root.UseHtmlElement(hbb, this.FindForm()); } } } }
private void mi_useIt(object sender, EventArgs e) { if (!(this.HtmlElement is HtmlElementUnknown) && this.HtmlElement.ElementGuid == Guid.Empty) { HtmlElement_BodyBase hbb = this.HtmlElement as HtmlElement_BodyBase; if (hbb != null) { TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer; if (tv != null) { TreeNodeClassRoot ownerNode = tv.DesignerRootNode; if (ownerNode != null) { ClassPointer root = ownerNode.ClassData.RootClassID; root.UseHtmlElement(hbb, tv.FindForm()); } } } } }
//an html element is used. guid and id should have been created public void OnUseHtmlElement(HtmlElement_BodyBase element) { _objExplorer.OnUseHtmlElement(element); }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { if (tv != null && tv.RootId != null && parentNode != null && parentNode.OwnerPointer != null && parentNode.OwnerPointer.RootPointer != null) { if (tv.Project != null && (tv.Project.ProjectType == EnumProjectType.WebAppPhp || tv.Project.ProjectType == EnumProjectType.WebAppAspx)) { if (tv.RootId.ClassId != parentNode.OwnerPointer.RootPointer.ClassId) { return; } } } IObjectPointer objRef = parentNode.OwnerPointer; TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; bool forPhp = false; if (tv.Project != null) { forPhp = (tv.Project.ProjectType == EnumProjectType.WebAppPhp); } Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; MethodInfo[] mifs = heb.GetType().GetMethods(); if (mifs != null) { for (int i = 0; i < mifs.Length; i++) { if (parentNode.SelectionTarget == EnumObjectSelectType.Object) { if (mifs[i].ReturnType.Equals(typeof(void))) { continue; } ParameterInfo[] ps = mifs[i].GetParameters(); if (ps != null && ps.Length > 0) { continue; } } if (VPLUtil.IsNotForProgramming(mifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientMethod(mifs[i]) && !WebServerMemberAttribute.IsServerMethod(mifs[i])) { continue; } MethodInfoPointer mp = new MethodInfoPointer(); mp.Owner = objRef; mp.SetMethodInfo(mifs[i]); int c; TreeNodeMethod nodeMethod = new TreeNodeMethod(ForStatic, mp); string key = mp.GetMethodSignature(out c); TreeNode nodeExist; if (newNodes.TryGetValue(key, out nodeExist)) { TreeNodeMethod mnd = (TreeNodeMethod)nodeExist; if (mnd.MethodInformation.DeclaringType.Equals(mnd.MethodInformation.ReflectedType)) { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } else { if (mifs[i].DeclaringType.Equals(mifs[i].ReflectedType)) { newNodes[key] = nodeMethod; key = key + " - " + mnd.MethodInformation.DeclaringType.Name; newNodes.Add(key, mnd); } else { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } } } else { newNodes.Add(key, nodeMethod); } //load actions if (actions != null) { bool bHasActions = false; foreach (IAction a in actions.Values) { ActionClass ac = a as ActionClass; if (ac != null) { MethodPointer mp0 = ac.ActionMethod as MethodPointer; if (mp0 != null) { if (mp0.IsSameObjectRef(mp)) { bHasActions = true; break; } } } } if (bHasActions) { nodeMethod.ShowActionIcon(); } } } parentNode.AddSortedNodes(newNodes); } }
public EventArgsHtmlElementSelection(HtmlElement_BodyBase obj) { _obj = obj; }
//an html element is used. guid and id should have been created public void OnUseHtmlElement(HtmlElement_BodyBase element) { }
public TreeNodeHtmlElementCurrent(HtmlElement_BodyBase element) : base(element) { }
public HtmlElementPointer(HtmlElement_BodyBase element) { _element = element; }
//an html element is used. guid and id should have been created public void OnUseHtmlElement(HtmlElement_BodyBase element) { _eventPath.OnUseHtmlElement(element); }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { UInt32 scopeId = parentNode.ScopeMethodId; SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; PropertyDescriptorCollection pifs = TypeDescriptor.GetProperties(heb.GetType()); TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { if (tv != null) { if (tv.RootClassNode != null) { actions = tv.RootClassNode.GetActions(); } } if (actions == null) { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } } for (int i = 0; i < pifs.Count; i++) { if (NotForProgrammingAttribute.IsNotForProgramming(pifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientProperty(pifs[i]) && !WebServerMemberAttribute.IsServerProperty(pifs[i])) { continue; } TreeNodeProperty nodeProperty; PropertyPointer pp; pp = new PropertyPointer(); pp.Owner = new HtmlElementPointer(heb); pp.SetPropertyInfo(pifs[i]); if (!newNodes.ContainsKey(pp.Name)) { nodeProperty = new TreeNodeProperty(ForStatic, pp); try { newNodes.Add(pp.Name, nodeProperty); } catch (Exception err) { MathNode.Log(tv != null ? tv.FindForm() : null, err); } //load actions bool bHasActions = false; if (string.CompareOrdinal(pp.Name, "Cursor") == 0) { bHasActions = false; } if (actions != null) { foreach (IAction a in actions.Values) { if (a != null && a.IsStatic == parentNode.IsStatic) { if (nodeProperty.IncludeAction(a, tv, scopeId, false)) { bHasActions = true; break; } } } if (bHasActions) { nodeProperty.OnShowActionIcon(); } } } } parentNode.AddSortedNodes(newNodes); }