コード例 #1
0
        public override ReactElement Render()
        {
            // Margin : marge externe, Padding : marge interne
            var lblAtt = new LabelAttributes
            {
                Style = Style.Margin(20).Padding(5)
            };                                       //.FontSize(12)

            var iAtt = new InputAttributes {
                Type      = InputType.Checkbox,
                ClassName = props.ClassName.Value,
                Checked   = props.Checked,
                Disabled  = props.Disabled,
                OnChange  = e => props.OnChange(e.CurrentTarget.Value)
            };

            return
                (DOM.Span(
                     new Attributes {
                ClassName = props.ClassName.Value
            },
                     DOM.Label(lblAtt, props.Title.Value),
                     DOM.Input(iAtt)
                     ));
        }
コード例 #2
0
            public override bool Equals(Object o)
            {
                if (this == o)
                {
                    return(true);
                }
                if (o == null || GetType() != o.GetType())
                {
                    return(false);
                }

                LabelAttributes that = (LabelAttributes)o;

                if (this.abbreviationTableId != that.abbreviationTableId)
                {
                    return(false);
                }
                if (Double.compare(this.offset, that.offset) != 0)
                {
                    return(false);
                }
                if (this.append != null ? !this.append.Equals(that.append) : that.append != null)
                {
                    return(false);
                }
                if (this.attributeName != null ? !this.attributeName.Equals(that.attributeName)
                : that.attributeName != null)
                {
                    return(false);
                }
                if (this.backgroundColor != null ? !this.backgroundColor.Equals(that.backgroundColor)
                : that.backgroundColor != null)
                {
                    return(false);
                }
                if (this.color != null ? !this.color.Equals(that.color) : that.color != null)
                {
                    return(false);
                }
                if (this.font != null ? !this.font.Equals(that.font) : that.font != null)
                {
                    return(false);
                }
                if (this.offsetAngle != null ? !this.offsetAngle.Equals(that.offsetAngle) : that.offsetAngle != null)
                {
                    return(false);
                }
                if (this.prepend != null ? !this.prepend.Equals(that.prepend) : that.prepend != null)
                {
                    return(false);
                }

                return(true);
            }
コード例 #3
0
 protected virtual void RenderLabel(HtmlTextWriter writer, string text, string clientID)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.For, clientID);
     if ((LabelAttributes != null) && (LabelAttributes.Count != 0))
     {
         LabelAttributes.AddAttributes(writer);
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Label);
     writer.Write(text);
     writer.RenderEndTag();
 }
コード例 #4
0
        public override ReactElement Render()
        {
            var iAtt = new InputAttributes {
                Type      = InputType.Checkbox,
                ClassName = props.ClassName.Value,
                Checked   = props.Checked,
                Disabled  = props.Disabled,
                OnChange  = e => props.OnChange(e.CurrentTarget.Value)
            };

            if (!string.IsNullOrEmpty(props.Tip))
            {
                var tooltipAtt = new Attributes {
                    ClassName = "tooltip"
                };
                var tooltiptextAtt = new Attributes {
                    ClassName = "tooltiptext"
                };

                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Div(tooltipAtt,
                                 props.Title,
                                 DOM.Span(tooltiptextAtt, props.Tip)
                                 ),
                         DOM.Input(iAtt)
                         ));
            }
            else
            {
                // Margin : marge externe, Padding : marge interne
                var lblAtt = new LabelAttributes
                {
                    Style = Style.Margin(20).Padding(5)
                };                                       //.FontSize(12)

                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Label(lblAtt, props.Title),
                         DOM.Input(iAtt)
                         ));
            }
        }
コード例 #5
0
        private void RenderLabel(HtmlTextWriter writer, string text, string clientID)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.For, clientID);

            if (BinaryCompatibility.Current.TargetsAtLeastFramework48 && _labelAttributesState != null && _labelAttributesState.Count != 0)
            {
                LabelAttributes.AddAttributes(writer);
            }
            else if (_labelAttributes != null && _labelAttributes.Count != 0)
            {
                _labelAttributes.AddAttributes(writer);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write(text);
            writer.RenderEndTag();
        }
コード例 #6
0
        public override ReactElement Render()
        {
            // Span : Horizontal
            var itemsElements = props.ItemAPI.GetItems()
                                .Select(
                idAndString => DOM.Span(
                    new Attributes {
                Key       = idAndString.Item1,
                ClassName = props.ClassName.Value
            },
                    DOM.Label(new LabelAttributes {
            }, idAndString.Item2),
                    GetInputX(idAndString.Item1, idAndString.Item2)
                    )
                );

            if (string.IsNullOrEmpty(props.Title))
            {
                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Span(null, itemsElements)
                         ));
            }
            else
            {
                // Margin : marge externe, Padding : marge interne
                var lblAtt = new LabelAttributes
                {
                    Style = Style.Margin(20).Padding(5)
                };                                           //.FontSize(12)
                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Label(lblAtt, props.Title),
                         DOM.Span(null, itemsElements)
                         ));
            }
        }
コード例 #7
0
            public LabelAttributes(LabelAttributes attributes)
            {
                if (attributes == null)
                {
                    String message = Logging.getMessage("nullValue.AttributesIsNull");
                    Logging.logger().severe(message);
                    throw new ArgumentException(message);
                }

                this.font                = attributes.getFont();
                this.color               = attributes.getColor();
                this.backgroundColor     = attributes.getBackgroundColor();
                this.offset              = attributes.getOffset();
                this.offsetAngle         = attributes.getOffsetAngle();
                this.prepend             = attributes.getPrepend();
                this.append              = attributes.getAppend();
                this.attributeName       = attributes.getAttributeName();
                this.abbreviationTableId = attributes.getAbbreviationTableId();
            }
コード例 #8
0
        public override ReactElement Render()
        {
            // Div : Vertical : ToDo : faire une option facultative
            //var itemsElements = props.ItemApi.GetItems()
            //    .Select(
            //        idAndString => DOM.Div(
            //        new Attributes { Key = idAndString.Item1, ClassName = "ItemCBLG" },
            //        DOM.Label(new LabelAttributes { }, idAndString.Item2),
            //        GetInputX(idAndString.Item1, idAndString.Item2)
            //        )
            //    );

            // Span : Horizontal
            var itemsElements = props.ItemAPI.GetItems()
                                .Select(
                idAndString => DOM.Span(
                    new Attributes {
                Key       = idAndString.Item1,
                ClassName = props.ClassName.Value
            },
                    DOM.Label(new LabelAttributes {
            }, idAndString.Item2),
                    GetInputX(idAndString.Item1, idAndString.Item2)
                    )
                );

            // Margin : marge externe, Padding : marge interne
            var lblAtt = new LabelAttributes
            {
                Style = Style.Margin(20).Padding(5)
            };                                       //.FontSize(12)

            return
                (DOM.Span(
                     new Attributes {
                ClassName = props.Titre.Value
            },
                     DOM.Label(lblAtt, props.Titre.Value),
                     DOM.Span(null, itemsElements)
                     ));
        }
コード例 #9
0
        public override ReactElement Render()
        {
            var itemsElements = props.ItemApi.GetItems().Select(idAndString =>
                                                                GetOptionX(idAndString.Item1, idAndString.Item2));

            // Margin : marge externe, Padding : marge interne
            var lblAtt = new LabelAttributes
            {
                Style = Style.Margin(20).Padding(5)
            };                                       //.FontSize(12)

            var tooltipAtt = new Attributes {
                ClassName = "tooltip"
            };
            var tooltiptextAtt = new Attributes {
                ClassName = "tooltiptext"
            };

            if (props.Multiple.Value)
            {
                var selAttMultiple = new SelectAttributes
                {
                    ClassName = props.ClassName.Value,
                    Name      = props.Title.ToString(),
                    Values    = SetItems(props.CheckBoxArray),
                    Multiple  = props.Multiple.Value,
                    Size      = itemsElements.Count(),
                    Disabled  = props.Disabled.Value,
                    // Pour cacher le scroll vertical, il faudrait appliquer un ReactStyle :
                    // OverFlow = Hidden, : appartient à ReactStyle
                    //Padding = 10,
                    //ReadOnly = true,
                    OnChange = e => props.OnChange(e.CurrentTarget.Value),
                };

                if (props.OneListPerLine.Value)
                {
                    if (string.IsNullOrEmpty(props.Tip))
                    {
                        return
                            (DOM.FieldSet(
                                 new FieldSetAttributes {
                            ClassName = props.ClassName.Value
                        },
                                 DOM.Legend(null, props.Title.ToString()),
                                 DOM.Select(selAttMultiple, itemsElements)
                                 ));
                    }
                    else
                    {
                        return
                            (DOM.FieldSet(
                                 new FieldSetAttributes {
                            ClassName = props.ClassName.Value
                        },
                                 DOM.Div(tooltipAtt, props.Title,
                                         DOM.Span(tooltiptextAtt, props.Tip)),
                                 DOM.Select(selAttMultiple, itemsElements)
                                 ));
                    }
                }

                if (string.IsNullOrEmpty(props.Tip))
                {
                    return
                        (DOM.Span(
                             new Attributes {
                        ClassName = props.ClassName.Value
                    },
                             DOM.Label(lblAtt, props.Title.ToString()),
                             DOM.Select(selAttMultiple, itemsElements)
                             ));
                }
                else
                {
                    return
                        (DOM.Span(
                             new Attributes {
                        ClassName = props.ClassName.Value
                    },
                             DOM.Div(tooltipAtt, props.Title,
                                     DOM.Span(tooltiptextAtt, props.Tip)),
                             DOM.Select(selAttMultiple, itemsElements)
                             ));
                }
            }

            var selAttSimple = new SelectAttributes
            {
                ClassName = props.ClassName.Value,
                Name      = props.Title.ToString(),
                Value     = props.ItemSelected.Value,
                Multiple  = props.Multiple.Value,
                Size      = itemsElements.Count(),
                Disabled  = props.Disabled.Value,
                OnChange  = e => props.OnChange(e.CurrentTarget.Value)
            };

            if (props.OneListPerLine.Value)
            {
                // Saut de ligne, un seul SelectList sur une ligne
                // The <fieldset> tag is used to group related elements in a form.
                // The <fieldset> tag draws a box around the related elements.
                // https://www.w3schools.com/tags/tag_fieldset.asp

                if (string.IsNullOrEmpty(props.Tip))
                {
                    return
                        (DOM.FieldSet(
                             new FieldSetAttributes {
                        ClassName = props.ClassName.Value
                    },
                             DOM.Legend(null, props.Title.ToString()),
                             DOM.Select(selAttSimple, itemsElements)
                             ));
                }
                else
                {
                    return
                        (DOM.FieldSet(
                             new FieldSetAttributes {
                        ClassName = props.ClassName.Value
                    },
                             DOM.Div(tooltipAtt, props.Title,
                                     DOM.Span(tooltiptextAtt, props.Tip)),
                             DOM.Select(selAttSimple, itemsElements)
                             ));
                }
            }

            // Pas de saut de ligne, on peut avoir plusieurs SelectList sur une ligne
            if (string.IsNullOrEmpty(props.Tip))
            {
                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Label(lblAtt, props.Title.ToString()),
                         DOM.Select(selAttSimple, itemsElements)
                         ));
            }
            else
            {
                return
                    (DOM.Span(
                         new Attributes {
                    ClassName = props.ClassName.Value
                },
                         DOM.Div(tooltipAtt, props.Title,
                                 DOM.Span(tooltiptextAtt, props.Tip)),
                         DOM.Select(selAttSimple, itemsElements)
                         ));
            }
        }
コード例 #10
0
ファイル: DOM.cs プロジェクト: Terricide/Bridge.React
 public extern static ReactElement Label(LabelAttributes properties, params ReactElementOrText[] children);