Esempio n. 1
0
        /// <summary>
        /// Creates a CheckBoxObject instance with specified name and parent.
        /// </summary>
        /// <param name="name">The name of the CheckBoxObject instance.</param>
        /// <param name="parent">The parent of the CheckBoxObject instance.</param>
        /// <returns>The CheckBoxObject instance.</returns>
        public static CheckBoxObject CreateCheckBoxObject(string name, Base parent)
        {
            CheckBoxObject checkBox = new CheckBoxObject();

            checkBox.Name   = name;
            checkBox.Parent = parent;
            return(checkBox);
        }
Esempio n. 2
0
        private void LoadCheckBox(XmlNode node, Base parent)
        {
            CheckBoxObject checkBox = ComponentsFactory.CreateCheckBoxObject(node.Name, parent);

            AddLocalizationItemsAttributes(node);
            LoadComponent(node, checkBox);
            LoadSize(node, checkBox);
            LoadBorder(node, checkBox.Border);
            checkBox.Checked = UnitsConverter.ConvertBool(GetAttribute(node, "Checked"));
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            CheckBoxObject checkBoxObject = vObject as CheckBoxObject;

            if (checkBoxObject == null || (!((ResourceData)this.NormalBackFileData != (ResourceData)null) || checkBoxObject.NormalBackFileData.GetResourceData().Type == this.NormalBackFileData.Type))
            {
                return;
            }
            checkBoxObject.NormalBackFileData = (ResourceFile)null;
        }
        /// <summary>
        /// Creates a CheckBoxObject instance with specified name and parent.
        /// </summary>
        /// <param name="name">The name of the CheckBoxObject instance.</param>
        /// <param name="parent">The parent of the CheckBoxObject instance.</param>
        /// <returns>The CheckBoxObject instance.</returns>
        public static CheckBoxObject CreateCheckBoxObject(string name, Base parent)
        {
            CheckBoxObject checkBox = new CheckBoxObject();

            checkBox.Name = name;
            if ((parent as IParent).CanContain(checkBox))
            {
                checkBox.Parent = parent;
            }
            return(checkBox);
        }
Esempio n. 5
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            CheckBoxObject checkBoxObject = vObject as CheckBoxObject;

            if (checkBoxObject != null)
            {
                if (this.NormalBackFileData != null && checkBoxObject.NormalBackFileData.GetResourceData().Type != this.NormalBackFileData.Type)
                {
                    checkBoxObject.NormalBackFileData = null;
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Восстановление объекта из xml
        /// </summary>
        public CheckBoxViewModel(CheckBoxObject storedObj, DataProvider dataProvider)
        {
            _objectsRepository = dataProvider.ObjectsRepository;
            var variablesRepository = dataProvider.VariablesRepository;

            Properties = new ObjectBaseProperties(storedObj.Id, storedObj.Name, dataProvider.CommonSettings.AppMode, _objectsRepository);
            Properties.FontSettings.Update(storedObj.FontSettings);
            TextProperties = new ObjectTextProperties(variablesRepository)
            {
                Text = storedObj.Text
            };

            var variable = variablesRepository.Find(storedObj.VariableName);

            if (variable != null)
            {
                variable.IsAssigned = true;
                ActionProperties    = new ObjectActionProperties(variable, variablesRepository, _objectsRepository);
                ActionProperties.Variable.ValueChanged += OnValueChanged;
                IsChecked = ((BoolVariableWrapper)ActionProperties.Variable).IsSet;
                ActionProperties.UpdateActions(storedObj.Actions);
            }
        }
        private void Layer(FastString Page, ReportComponentBase obj,
                           float Left, float Top, float Width, float Height, FastString Text, string style, FastString addstyletag)
        {
            if (Page != null && obj != null)
            {
                string onclick = null;

                if (!String.IsNullOrEmpty(ReportID))
                {
                    if (!String.IsNullOrEmpty(obj.ClickEvent) || obj.HasClickListeners())
                    {
                        onclick = "click";
                    }

                    CheckBoxObject checkBoxObject = obj as CheckBoxObject;
                    if (checkBoxObject != null && checkBoxObject.Editable)
                    {
                        onclick = "checkbox_click";
                    }

                    TextObject textObject = obj as TextObject;
                    if (textObject != null && textObject.Editable)
                    {
                        onclick = "text_edit";
                    }
                }

                // we need to adjust left, top, width and height values because borders take up space in html elements
                float borderLeft   = 0;
                float borderRight  = 0;
                float borderTop    = 0;
                float borderBottom = 0;
                HTMLBorderWidthValues(obj, out borderLeft, out borderTop, out borderRight, out borderBottom);

                Page.Append("<div ").Append(style).Append(" style=\"").
                Append(onclick != null ? "cursor:pointer;" : "").
                Append("left:").Append(Px((leftMargin + Left) * Zoom - borderLeft / 2f)).
                Append("top:").Append(Px((topMargin + Top) * Zoom - borderTop / 2f)).
                Append("width:").Append(Px(Width * Zoom - borderRight / 2f - borderLeft / 2f)).
                Append("height:").Append(Px(Height * Zoom - borderBottom / 2f - borderTop / 2f));

                if (addstyletag != null)
                {
                    Page.Append(addstyletag);
                }

                Page.Append("\"");

                if (onclick != null)
                {
                    string eventParam = String.Format("{0},{1},{2},{3}",
                                                      obj.Name,
                                                      CurPage,
                                                      obj.AbsLeft.ToString("#0"),
                                                      obj.AbsTop.ToString("#0"));

                    Page.Append(" onclick=\"")
                    .AppendFormat(OnClickTemplate, ReportID, onclick, eventParam)
                    .Append("\"");
                }

                Page.Append(">");
                if (Text == null)
                {
                    Page.Append(NBSP);
                }
                else
                {
                    Page.Append(Text);
                }
                Page.AppendLine("</div>");
            }
        }
 private void CheckboxClick(CheckBoxObject checkBox, ReportPage page, int pageN)
 {
     checkBox.Checked = !checkBox.Checked;
     Refresh(pageN, page);
 }