private IEnumerable <XNode> GetClassNameOptionsValueNodes(ParameterList parameters)
        {
            BaseRuntimeTreeNode classNameOptionsRuntimeTreeNode = null;

            if (parameters.TryGetParameterRuntimeTreeNode(FontIconSelectorWidgetFuntion.ClassNameOptionsParameterName, out classNameOptionsRuntimeTreeNode))
            {
                object value = parameters.GetParameter(FontIconSelectorWidgetFuntion.ClassNameOptionsParameterName);
                if (value is string)
                {
                    yield return(new XText((string)value));
                }
                else
                {
                    foreach (var node in classNameOptionsRuntimeTreeNode.Serialize().Nodes())
                    {
                        yield return(node);
                    }
                }
            }
        }
Пример #2
0
        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)
        {
            BaseRuntimeTreeNode runtimeTreeNode = null;

            if (parameters.TryGetParameterRuntimeTreeNode("Options", out runtimeTreeNode))
            {
                string keyFieldName   = parameters.GetParameter <string>("KeyFieldName");
                string labelFieldName = parameters.GetParameter <string>("LabelFieldName");
                bool   multiple       = parameters.GetParameter <bool>("Multiple");
                bool   required       = parameters.GetParameter <bool>("Required");
                bool   compact        = parameters.GetParameter <bool>("Compact");

                XElement optionsDescriptor = new XElement("SelectorOptionsSource",
                                                          new XAttribute("KeyFieldName", parameters.GetParameter <string>("KeyFieldName") ?? ""),
                                                          new XAttribute("LabelFieldName", parameters.GetParameter <string>("LabelFieldName") ?? ""),
                                                          new XElement("TreeNode",
                                                                       runtimeTreeNode.Serialize()));

                return(StandardWidgetFunctions.BuildStaticCallPopulatedSelectorFormsMarkup(
                           parameters,
                           label,
                           helpDefinition,
                           bindingSourceName,
                           this.GetType(),
                           "GetOptions",
                           optionsDescriptor.ToString(),
                           "Key",
                           "Label",
                           multiple,
                           compact,
                           required,
                           true));
            }
            else
            {
                throw new InvalidOperationException("Could not get BaseRuntimeTreeNode for parameter 'Options'.");
            }
        }
Пример #3
0
        public override XElement GetWidgetMarkup(ParameterList parameters, string label, HelpDefinition helpDefinition, string bindingSourceName)
        {
            BaseRuntimeTreeNode optionsRuntimeTreeNode = null;

            if (parameters.TryGetParameterRuntimeTreeNode("TreeNodes", out optionsRuntimeTreeNode))
            {
                bool required           = parameters.GetParameter <bool>("Required");
                bool autoSelectChildren = parameters.GetParameter <bool>("AutoSelectChildren");
                bool autoSelectParents  = parameters.GetParameter <bool>("AutoSelectParents");

                XElement formElement = base.BuildBasicWidgetMarkup("HierarchicalSelector", "SelectedKeys", label, helpDefinition, bindingSourceName);
                formElement.Add(new XElement(Namespaces.BindingFormsStdUiControls10 + "HierarchicalSelector.TreeNodes",
                                             optionsRuntimeTreeNode.Serialize()));
                formElement.Add(new XAttribute("AutoSelectChildren", autoSelectChildren));
                formElement.Add(new XAttribute("AutoSelectParents", autoSelectParents));

                return(formElement);
            }
            else
            {
                throw new InvalidOperationException("Could not get BaseRuntimeTreeNode for parameter 'TreeNodes'.");
            }
        }
Пример #4
0
        public override object Execute(ParameterList parameters, FunctionContextContainer context)
        {
            var result       = new XhtmlDocument();
            var functionCall = new XElement(Composite.Core.Xml.Namespaces.Function10 + "function",
                                            new XAttribute("name", "Composite.Forms.RendererControl"));
            BaseRuntimeTreeNode paramNode = null;

            foreach (var parameterName in parameters.AllParameterNames)
            {
                try
                {
                    if (parameters.TryGetParameterRuntimeTreeNode(parameterName, out paramNode))
                    {
                        functionCall.Add(paramNode.Serialize());
                    }
                }
                //Ignore
                catch { }
            }
            result.Body.Add(
                new XElement(Namespaces.AspNetControls + "form",
                             functionCall));
            return(result);
        }