public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var idCond = (PseudoClassCondition)condition;

            container.Add(new XElement("pseudo-class", idCond.Value));
        }
Beispiel #2
0
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var idCond = (IdCondition)condition;

            container.Add(new XElement("id", idCond.Value));
        }
Beispiel #3
0
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var n          = (NotCondition)condition;
            var notElement = new XElement("not");

            childWriter.Write(styleSystem, notElement, n.Condition, childWriter);
            container.Add(notElement);
        }
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var idCond  = (AttributeCondition)condition;
            var content = new XElement("attribute");

            content.Add(new XElement("name", idCond.Property));
            if (idCond.Value != null)
            {
                IStylePropertySerializer serializer;
                if (Find(idCond.Value, out serializer))
                {
                    var valueElement = new XElement("value");
                    serializer.Write(styleSystem, valueElement, idCond.Value);

                    var id = serializer.TypeId ?? serializer.TargetType.FullName;
                    content.Add(new XElement("type", id));
                    content.Add(valueElement);
                }
                else
                {
                    throw new StyleParseException("There is no handle for attribute-condition value of " + idCond.Value.GetType(), container);
                }
            }
            container.Add(content);
        }
Beispiel #5
0
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            IConditionWriter w;

            if (writers.TryGetValue(condition.GetType(), out w))
            {
                w.Write(styleSystem, container, condition, childWriter);
            }
            else
            {
                throw new StyleWriterException("There is no writer for condition " + condition.GetType().Name);
            }
        }
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var a = (AndCondition)condition;

            childWriter.Write(styleSystem, container, a.First, childWriter);
            childWriter.Write(styleSystem, container, a.Second, childWriter);
        }
        public void Write(IStyleSystem styleSystem, XContainer container, ICondition condition, IConditionWriter childWriter)
        {
            var a = (OrCondition)condition;

            if (container.NodeType == XmlNodeType.Element)
            {
                var e = (XElement)container;
                if (e.Name == "or")
                {
                    childWriter.Write(styleSystem, e, a.First, childWriter);
                    childWriter.Write(styleSystem, e, a.Second, childWriter);
                    return;
                }
            }

            var orElement = new XElement("or");

            childWriter.Write(styleSystem, orElement, a.First, childWriter);
            childWriter.Write(styleSystem, orElement, a.Second, childWriter);
            container.Add(orElement);
        }