protected override void FillOutParameters(Node pars, BaseControl ctrl)
        {
            base.FillOutParameters(pars, ctrl);

            Node ip = Ip(pars);
            Node codeNode = ip["_code"].Get<Node>();
            BaseWebControlFormElementText that = ctrl as BaseWebControlFormElementText;

            if (that != null && codeNode.ContainsValue("value"))
                that.Value = codeNode["value"].Get<string>();
        }
예제 #2
0
        /*
         * fills out the attributes
         */
        protected override void FillOutParameters(Node pars, BaseControl ctrl)
        {
            base.FillOutParameters(pars, ctrl);

            Node ip = Ip(pars);
            Node node = ip["_code"].Get<Node>();

            AttributeControl atrCtrl = ctrl as AttributeControl;
            foreach (Node idx in node)
            {
                if (idx.Name.StartsWith("@"))
                {
                    atrCtrl.Attributes.Add(new AttributeControl.Attribute(idx.Name.Substring(1), idx.Get<string>()));
                }
            }
        }
 protected override void FillOutParameters(Node pars, BaseControl ctrl)
 {
     base.FillOutParameters(pars, ctrl);
     BaseWebControlListFormElement ret = ctrl as BaseWebControlListFormElement;
     Node ip = Ip(pars);
     Node node = ip["_code"].Get<Node>();
     if (node.Contains("items"))
     {
         foreach (Node idxItemNode in node["items"])
         {
             if (idxItemNode.Name == null)
                 throw new ArgumentException("list item for select needs unique name of node to be used as value");
             if (idxItemNode.Value == null)
                 throw new ArgumentException("list item for select needs value of node to be used as text to show user in item");
             ListItem item = new ListItem(idxItemNode.Get<string>(), idxItemNode.Name);
             if (!idxItemNode.GetValue("enabled", true))
                 item.Enabled = false;
             ret.Items.Add(item);
         }
     }
 }
        protected override void FillOutParameters(Node pars, BaseControl ctrl)
        {
            base.FillOutParameters(pars, ctrl);
            BaseWebControlFormElementInputText ret = ctrl as BaseWebControlFormElementInputText;

            Node ip = Ip(pars);
            Node node = ip["_code"].Get<Node>();
            if (node.ContainsValue("placeholder"))
                ret.PlaceHolder = node["placeholder"].Get<string>();

            if (ShouldHandleEvent("ontextchanged", node))
            {
                Node codeNode = node["ontextchanged"].Clone();
                ret.TextChanged += delegate(object sender2, EventArgs e2)
                {
                    FillOutEventInputParameters(codeNode, sender2);
                    RaiseActiveEvent(
                        "magix.execute",
                        codeNode);
                };
            }
        }
        protected override void FillOutParameters(Node pars, BaseControl ctrl)
        {
            base.FillOutParameters(pars, ctrl);

            Node ip = Ip(pars);
            Node node = ip["_code"].Get<Node>();
            BaseWebControlFormElement that = ctrl as BaseWebControlFormElement;

            if (node.ContainsValue("accesskey"))
                that.AccessKey = node["accesskey"].Get<string>();

            if (node.ContainsValue("disabled"))
                that.Disabled = node["disabled"].Get<bool>();

            if (ShouldHandleEvent("onfocus", node))
            {
                Node codeNode = node["onfocus"].Clone();
                that.Focused += delegate(object sender, EventArgs e)
                {
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
                        "magix.execute",
                        codeNode);
                };
            }

            if (ShouldHandleEvent("onblur", node))
            {
                Node codeNode = node["onblur"].Clone();
                that.Blur += delegate(object sender, EventArgs e)
                {
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
                        "magix.execute",
                        codeNode);
                };
            }
        }
예제 #6
0
		/*
		 * fills out the stuff from basewebcontrol
		 */
		protected override void FillOutParameters(Node pars, BaseControl ctrl)
		{
			base.FillOutParameters(pars, ctrl);
            BaseWebControl that = ctrl as BaseWebControl;

            Node ip = Ip(pars);
            Node node = ip["_code"].Get<Node>();

            if (node.ContainsValue("class"))
				that.Class = node["class"].Get<string>();

            if (node.ContainsValue("dir"))
				that.Dir = node["dir"].Get<string>();

            if (node.ContainsValue("tabindex"))
                that.TabIndex = node["tabindex"].Get<string>();

            if (node.ContainsValue("title"))
                that.Title = node["title"].Get<string>();

            if (node.ContainsValue("style"))
			{
				string[] styles = 
					node["style"].Get<string>().Replace("\n", "").Replace("\r", "").Split(
						new char[] {';'}, 
						StringSplitOptions.RemoveEmptyEntries);
				foreach (string idxStyle in styles)
				{
					that.Style[idxStyle.Split(':')[0]] = idxStyle.Split(':')[1];
				}
			}

			if (ShouldHandleEvent("onclick", node))
			{
				Node codeNode = node["onclick"].Clone();
				that.Click += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
					RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("ondblclick", node))
			{
				Node codeNode = node["ondblclick"].Clone();
				that.DblClick += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onmousedown", node))
			{
				Node codeNode = node["onmousedown"].Clone();
				that.MouseDown += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onmouseup", node))
			{
				Node codeNode = node["onmouseup"].Clone();
				that.MouseUp += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onmouseover", node))
			{
				Node codeNode = node["onmouseover"].Clone();
				that.MouseOver += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onmouseout", node))
			{
				Node codeNode = node["onmouseout"].Clone();
				that.MouseOut += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onkeypress", node))
			{
				Node codeNode = node["onkeypress"].Clone();
				that.KeyPress += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}

			if (ShouldHandleEvent("onesc", node))
			{
				Node codeNode = node["onesc"].Clone();
				that.Esc += delegate(object sender, EventArgs e)
				{
                    FillOutEventInputParameters(codeNode, sender);
                    RaiseActiveEvent(
						"magix.execute",
						codeNode);
				};
			}
		}
예제 #7
0
파일: Manager.cs 프로젝트: polterguy/magix
 internal void InitializePage(BaseControl ctrl)
 {
     MuxControls.Add(ctrl);
     if (MuxControls.Count == 1)
     {
         // we only run this logic once
         // basically we're adding up the callback filter for custom response rendering
         if (IsAjaxCallback)
         {
             Page.LoadComplete += LoadComplete_Ajax_Callback;
             Page.Response.Filter = new AjaxFilter(Page.Response.Filter);
         }
         else
         {
             Page.LoadComplete += Page_Load_No_Ajax;
             Page.Response.Filter = new ResponseFilter(Page.Response.Filter);
         }
     }
 }