/// <summary>
 /// Construct BaseLayoutConfiguration instance from xml element.
 /// </summary>
 /// <param name="baseLayoutConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 protected BaseLayoutConfiguration(XmlElement baseLayoutConfigurationElement, XmlParser xmlParser)
 {
     this.HeaderText = xmlParser.ParseString(baseLayoutConfigurationElement, "@HeaderText");
     this.Collapsible = xmlParser.ParseBoolean(baseLayoutConfigurationElement, "@Collapsible", false);
     this.Collapsed = xmlParser.ParseBoolean(baseLayoutConfigurationElement, "@Collapsed", false);
     this.EnableBorder = xmlParser.ParseBoolean(baseLayoutConfigurationElement, "@EnableBorder", false);
     this.EnableFrame = xmlParser.ParseBoolean(baseLayoutConfigurationElement, "@EnableFrame", false);
 }
 /// <summary>
 /// Construct DecimalConfiguration instance from xml element.
 /// </summary>
 /// <param name="baseControlConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 public DecimalConfiguration(XmlElement baseControlConfigurationElement, XmlParser xmlParser)
     : base(baseControlConfigurationElement, xmlParser)
 {
     XmlElement numbericElement = baseControlConfigurationElement;
     this.AllowNegative = xmlParser.ParseBoolean(numbericElement, "@AllowNegative", true);
     this.DecimalPrecision = xmlParser.ParseInt(numbericElement, "@DecimalPrecision", 2);
 }
        /// <summary>
        /// Construct ComboBoxConfiguration instance from xml element.
        /// </summary>
        /// <param name="baseControlConfigurationElement"></param>
        /// <param name="xmlParser"></param>
        public ComboBoxConfiguration(XmlElement baseControlConfigurationElement, XmlParser xmlParser)
            : base(baseControlConfigurationElement, xmlParser)
        {
            XmlElement comboBoxElement = baseControlConfigurationElement;
            this.Editable = xmlParser.ParseBoolean(comboBoxElement, "@Editable", false);
            this.ForceSelection = xmlParser.ParseBoolean(comboBoxElement, "@ForceSelection", false);
            this.MinChars = xmlParser.ParseInt(comboBoxElement, "@MinChars", 2);
            this.OnSelectedIndexChanged = xmlParser.ParseString(comboBoxElement, "@OnSelectedIndexChanged");

            XmlElement staticDataSourceElement = comboBoxElement.SelectSingleNode("p:StaticDataSource", xmlParser.NamespaceManager) as XmlElement;
            if (staticDataSourceElement != null)
            {
                this.StaticDataSource = new Collection<ComboBoxItemConfiguration>();
                XmlNodeList itemNodes = staticDataSourceElement.SelectNodes("p:Item", xmlParser.NamespaceManager);
                foreach (XmlElement itemNode in itemNodes.Cast<XmlElement>())
                    this.StaticDataSource.Add(new ComboBoxItemConfiguration(itemNode, xmlParser));
            }

            XmlElement dynamicDataSourceElement = comboBoxElement.SelectSingleNode("p:DynamicDataSource", xmlParser.NamespaceManager) as XmlElement;
            if (dynamicDataSourceElement != null)
                this.DynamicDataSource = new ComboBoxDynamicDataSourceConfiguration(dynamicDataSourceElement, xmlParser);
        }
 /// <summary>
 /// Construct ComboBoxItemConfiguration instance from xml element.
 /// </summary>
 /// <param name="comboBoxItemConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 public ComboBoxItemConfiguration(XmlElement comboBoxItemConfigurationElement, XmlParser xmlParser)
 {
     this.Text = xmlParser.ParseString(comboBoxItemConfigurationElement, "@Text");
     this.Value = xmlParser.ParseString(comboBoxItemConfigurationElement, "@Value");
     this.Checked = xmlParser.ParseBoolean(comboBoxItemConfigurationElement, "@Checked", false);
 }
        /// <summary>
        /// Construct GridView Configuration
        /// </summary>
        /// <param name="gridViewElement"></param>
        /// <param name="xmlParser"></param>
        public GridViewPanelConfiguration(XmlElement gridViewElement, XmlParser xmlParser)
            : base(gridViewElement, xmlParser)
        {
            this.EntityName = xmlParser.ParseString(gridViewElement, "@EntityName");
            this.PrimaryKeyFieldName = xmlParser.ParseString(gridViewElement, "@PrimaryKeyFieldName");
            this.PageSize = xmlParser.ParseInt(gridViewElement, "@PageSize", 25);
            this.EnabledCheckBoxField = xmlParser.ParseBoolean(gridViewElement, "@EnabledCheckBoxField", false);
            this.ExecuteQueryWhenLoaded = xmlParser.ParseBoolean(gridViewElement, "@ExecuteQueryWhenLoaded", true);
            this.EnabledColumnMove = xmlParser.ParseBoolean(gridViewElement, "@EnabledColumnMove", false);
            this.EnabledColumnResize = xmlParser.ParseBoolean(gridViewElement, "@EnabledColumnResize", false);
            this.Height = xmlParser.ParseInt(gridViewElement, "@Height", 500);
            this.DefaultSortField = xmlParser.ParseString(gridViewElement, "@DefaultSortField");
            this.DefaultSortDirection = xmlParser.ParseEnum<GridViewFieldSortDirection>(gridViewElement, "@DefaultSortDirection");

            XmlElement viewButtomElement = gridViewElement.SelectSingleNode("p:ViewButton", xmlParser.NamespaceManager) as XmlElement;
            if (viewButtomElement != null)
                this.ViewButton = new GridViewRowButtonConfiguration(viewButtomElement, xmlParser);

            XmlElement editButtomElement = gridViewElement.SelectSingleNode("p:EditButton", xmlParser.NamespaceManager) as XmlElement;
            if (editButtomElement != null)
                this.EditButton = new GridViewRowButtonConfiguration(editButtomElement, xmlParser);

            XmlElement deleteButtomElement = gridViewElement.SelectSingleNode("p:DeleteButton", xmlParser.NamespaceManager) as XmlElement;
            if (deleteButtomElement != null)
                this.DeleteButton = new GridViewRowButtonConfiguration(deleteButtomElement, xmlParser);

            this.Fields = new Collection<GridViewFieldConfiguration>();
            XmlNodeList fieldNodes = gridViewElement.SelectNodes("p:Fields/p:Field", xmlParser.NamespaceManager);
            foreach (XmlElement fieldElement in fieldNodes.Cast<XmlElement>())
                this.Fields.Add(new GridViewFieldConfiguration(fieldElement, xmlParser));

            XmlElement rowViewElement = gridViewElement.SelectSingleNode("p:Fields/p:RowView", xmlParser.NamespaceManager) as XmlElement;
            if (rowViewElement != null)
                this.RowView = new GridViewFieldRowViewConfiguration(rowViewElement, xmlParser);
        }
 /// <summary>
 /// Construct GridViewFieldValueTransformSwitchCase instance from xml element.
 /// </summary>
 /// <param name="switchCaseElement"></param>
 /// <param name="xmlParser"></param>
 public GridViewFieldValueTransformSwitchCase(XmlElement switchCaseElement, XmlParser xmlParser)
 {
     this.Value = xmlParser.ParseString(switchCaseElement, "@Value");
     this.CaseSensitive = xmlParser.ParseBoolean(switchCaseElement, "@CaseSensitive", false);
     this.Output = switchCaseElement.InnerText;
 }
 /// <summary>
 /// Construct CheckBoxConfiguration instance from xml element.
 /// </summary>
 /// <param name="baseControlConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 public CheckBoxConfiguration(XmlElement baseControlConfigurationElement, XmlParser xmlParser)
     : base(baseControlConfigurationElement, xmlParser)
 {
     this.Text = xmlParser.ParseString(baseControlConfigurationElement, "@Text");
     this.Checked = xmlParser.ParseBoolean(baseControlConfigurationElement, "@Checked", false);
 }
        /// <summary>
        /// Construct GridViewFieldConfiguration instance.
        /// </summary>
        /// <param name="gridViewFieldElement"></param>
        /// <param name="xmlParser"></param>
        public GridViewFieldConfiguration(XmlElement gridViewFieldElement, XmlParser xmlParser)
        {
            this.FieldName = xmlParser.ParseString(gridViewFieldElement, "@FieldName");
            this.HeaderText = xmlParser.ParseString(gridViewFieldElement, "@HeaderText");
            this.SortingFieldName = xmlParser.ParseString(gridViewFieldElement, "@SortingFieldName");
            this.Sortable = xmlParser.ParseBoolean(gridViewFieldElement, "@Sortable", true);
            this.Resizable = xmlParser.ParseBoolean(gridViewFieldElement, "@Resizble", true);
            this.Css = xmlParser.ParseString(gridViewFieldElement, "@Css");
            this.Width = xmlParser.ParseInt(gridViewFieldElement, "@Width", null);
            this.ExtJsRenderer = xmlParser.ParseString(gridViewFieldElement, "p:ExtJs-Renderer");
            this.Align = xmlParser.ParseEnum<HorizontalAlign>(gridViewFieldElement, "p:Align");
            this.Hidden = xmlParser.ParseBoolean(gridViewFieldElement, "@Hidden", false);

            foreach (XmlElement transformNode in gridViewFieldElement.ChildNodes)
            {
                XmlElement transformElement = transformNode as XmlElement;
                if (transformElement != null && SUPPORT_TRANSFORM_TYPES.Contains(transformElement.LocalName))
                    this.Transformer = new GridViewFieldValueTransformConfiguration(transformElement, xmlParser);
            }
        }
 /// <summary>
 /// Construct IntegerConfiguration instance from xml element.
 /// </summary>
 /// <param name="baseControlConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 public IntegerConfiguration(XmlElement baseControlConfigurationElement, XmlParser xmlParser)
     : base(baseControlConfigurationElement, xmlParser)
 {
     XmlElement numbericElement = baseControlConfigurationElement;
     this.AllowNegative = xmlParser.ParseBoolean(numbericElement, "@AllowNegative", true);
 }
        /// <summary>
        /// Construct AggregatePanelConfiguration instance from xml element.
        /// </summary>
        /// <param name="panelElement"></param>
        /// <param name="xmlParser"></param>
        public AggregatePanelConfiguration(XmlElement panelElement, XmlParser xmlParser)
            : base(panelElement, xmlParser)
        {
            this.CommandArgument = xmlParser.ParseString(panelElement, "@CommandArgument") ?? string.Empty;
            this.typeName = xmlParser.ParseString(panelElement, "p:Type");
            string objectId = panelElement.OwnerDocument.SelectSingleNode("p:Page/@ObjectId", xmlParser.NamespaceManager).Value;
            ValidateTypeName(this.CommandArgument, this.typeName);

            this.SkinPath = xmlParser.ParseString(panelElement, "p:SkinPath");
            this.Width = xmlParser.ParseInt(panelElement, "@Width", 960);
            this.Height = xmlParser.ParseInt(panelElement, "@Height", 600);
            this.Resizable = xmlParser.ParseBoolean(panelElement, "@Resizable", false);
            this.Draggable = xmlParser.ParseBoolean(panelElement, "@Draggable", false);
            this.ShowMessageAfterSavedSuccessfully = xmlParser.ParseBoolean(panelElement, "@ShowMessageAfterSavedSuccessfully", true);
            this.SetFocusOnFirstInputControlAutomatically = xmlParser.ParseBoolean(panelElement, "@SetFocusOnFirstInputControlAutomatically", true);

            short defaultFormButtons = 0;
            XmlElement saveButtonElement = panelElement.SelectSingleNode("p:SaveButton", xmlParser.NamespaceManager) as XmlElement;
            if (saveButtonElement != null)
            {
                this.SaveButton = new FormPanelButtonConfiguration(saveButtonElement, xmlParser);
                this.SaveButton.Text = this.SaveButton.Text ?? Resources.DPCtrl_SaveText;
                if (this.SaveButton.IsFormDefaultButton) defaultFormButtons++;
            }

            XmlElement cancelButtonElement = panelElement.SelectSingleNode("p:CancelButton", xmlParser.NamespaceManager) as XmlElement;
            if (cancelButtonElement != null)
            {
                this.CancelButton = new FormPanelButtonConfiguration(cancelButtonElement, xmlParser);
                this.CancelButton.Text = this.CancelButton.Text ?? Resources.DPCtrl_CancelText;
                if (this.CancelButton.IsFormDefaultButton) defaultFormButtons++;
            }

            if (defaultFormButtons > 1)
                throw new ConfigurationErrorsException(@"The buttons with attribute ""IsFormDefaultButton"" equals to true should be one at maximum.");
        }
 /// <summary>
 /// Construct FormPanelButtonConfiguration instance from xml element.
 /// </summary>
 /// <param name="buttonElement"></param>
 /// <param name="xmlParser"></param>
 public FormPanelButtonConfiguration(XmlElement buttonElement, XmlParser xmlParser)
 {
     this.Text = xmlParser.ParseString(buttonElement, "@Text");
     this.ToolTip = xmlParser.ParseString(buttonElement, "@ToolTip");
     this.IsFormDefaultButton = xmlParser.ParseBoolean(buttonElement, "@IsFormDefaultButton", false);
 }
 /// <summary>
 /// Construct GridViewRowButtonConfiguration instance from xml element.
 /// </summary>
 /// <param name="buttonElement"></param>
 /// <param name="xmlParser"></param>
 public GridViewRowButtonConfiguration(XmlElement buttonElement, XmlParser xmlParser)
 {
     this.ToolTip = xmlParser.ParseString(buttonElement, "@ToolTip");
     this.DisplayAsImage = xmlParser.ParseBoolean(buttonElement, "@DisplayAsImage", true);
 }
 /// <summary>
 /// Construct RadioGroupItemConfiguration instance from xml element.
 /// </summary>
 /// <param name="radioGroupItemConfigurationElement"></param>
 /// <param name="xmlParser"></param>
 public RadioGroupItemConfiguration(XmlElement radioGroupItemConfigurationElement, XmlParser xmlParser)
 {
     this.Text = xmlParser.ParseString(radioGroupItemConfigurationElement, "@Text");
     this.Value = xmlParser.ParseString(radioGroupItemConfigurationElement, "@Value");
     this.Checked = xmlParser.ParseBoolean(radioGroupItemConfigurationElement, "@Checked", false);
 }