ParseBorder() public method

public ParseBorder ( String border ) : String>.IDictionary
border String
return String>.IDictionary
Ejemplo n.º 1
0
        virtual public void PopulateOneCss(IDictionary <String, String> aggregatedProps, IDictionary <String, String> cssDeclaration)
        {
            IDictionary <String, String> css = new Dictionary <String, String>();

            foreach (KeyValuePair <String, String> e in cssDeclaration)
            {
                String key   = utils.StripDoubleSpacesTrimAndToLowerCase(e.Key);
                String value = utils.StripDoubleSpacesAndTrim(e.Value);
                if (Util.EqualsIgnoreCase(CSS.Property.BORDER, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBorder(value));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_TOP, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBorder(value, CSS.Property.BORDER_TOP));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_BOTTOM, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBorder(value, CSS.Property.BORDER_BOTTOM));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_LEFT, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBorder(value, CSS.Property.BORDER_LEFT));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_RIGHT, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBorder(value, CSS.Property.BORDER_RIGHT));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.MARGIN, key))
                {
                    IDictionary <String, String> margins = utils.ParseBoxValues(value, "margin-", "");
                    foreach (String marginKey in margins.Keys)
                    {
                        if (!css.ContainsKey(marginKey))
                        {
                            css.Add(marginKey, margins[marginKey]);
                        }
                    }
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_WIDTH, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBoxValues(value, "border-", "-width"));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_STYLE, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBoxValues(value, "border-", "-style"));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BORDER_COLOR, key))
                {
                    CssUtils.MapPutAll(css, utils.ParseBoxValues(value, "border-", "-color"));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.PADDING, key))
                {
                    IDictionary <String, String> paddings = utils.ParseBoxValues(value, "padding-", "");
                    foreach (String paddingKey in paddings.Keys)
                    {
                        if (!css.ContainsKey(paddingKey))
                        {
                            css.Add(paddingKey, paddings[paddingKey]);
                        }
                    }
                    //CssUtils.MapPutAll(css, utils.ParseBoxValues(value, "padding-", ""));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.FONT, key))
                {
                    CssUtils.MapPutAll(css, utils.ProcessFont(value));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.LIST_STYLE, key))
                {
                    CssUtils.MapPutAll(css, utils.ProcessListStyle(value));
                }
                else if (Util.EqualsIgnoreCase(CSS.Property.BACKGROUND, key))
                {
                    IDictionary <String, String> backgroundStyles = utils.ProcessBackground(value);
                    foreach (String backgroundKey in backgroundStyles.Keys)
                    {
                        if (!css.ContainsKey(backgroundKey))
                        {
                            css.Add(backgroundKey, backgroundStyles[backgroundKey]);
                        }
                    }
                }
                else
                {
                    css[key] = value;
                }
            }
            CssUtils.MapPutAll(aggregatedProps, css);
        }