示例#1
0
        public bool Matches(Element element)
        {
            bool ret = false;

            Element currentElement = element;
            for (int i = _simpleSelectors.Count - 1; i >= 0; )
            {
                SimpleSelector currentSelector = _simpleSelectors[i];
                ret = currentSelector.Matches(currentElement);
                if (ret)
                {
                    currentElement = currentElement.Parent;
                    i--;
                }
                else
                {
                    if (i == _simpleSelectors.Count - 1 || currentElement.Parent == null)
                        break;
                    else
                        currentElement = currentElement.Parent;
                }
            }

            return ret;
        }
示例#2
0
        public bool Matches(Element element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            bool ret = false;

            AttributeInfo ai;
            if (element.Attributes.TryGetValue(_attributeName, out ai))
            {
                if (_attributeValue == null || _attributeValue == ai.Value)
                    ret = true;
            }

            return ret;
        }
示例#3
0
        public bool Matches(Element element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            bool ret = false;

            if (string.IsNullOrEmpty(_elementName) || _elementName == element.Name)
            {
                ret = true;
                foreach (AttributeSelector attributeSelector in _attributeSelectors)
                {
                    if (!attributeSelector.Matches(element))
                    {
                        ret = false;
                        break;
                    }
                }
            }

            return ret;
        }
示例#4
0
        private static void AddMilestone(GanttView gantt, Element parent, DateTime date, DateTime? basePlanDate, string id, string tag)
        {
            string type = "Milestone";

            gantt.CreatePointElement(parent, date, id, type, tag);

            if (basePlanDate != null && basePlanDate.Value != date)
            {
                string direction = basePlanDate.Value > date ? "Right" : "Left";

                PointElement small = gantt.CreatePointElement(parent, date, null, type, "BasePlanSmall");
                small.AddAttribute("direction", direction);

                PointElement large = gantt.CreatePointElement(parent, basePlanDate.Value, null, type, "BasePlanLarge");
                large.AddAttribute("direction", direction);
            }
        }
示例#5
0
        private static Element AddInterval2(GanttView gantt, Element parent, DateTime? start, DateTime? finish, string id, string type, string tag)
        {
            Element child = null;

            if (start != null && finish != null)
            {
                child = gantt.CreateIntervalElement(parent, start.Value, finish.Value, id, type, tag);
                if (type == "Summary")
                {
                    gantt.CreatePointElement(child, start.Value, null, type + "Start", tag);
                    gantt.CreatePointElement(child, finish.Value, null, type + "Finish", tag);
                }
            }
            else
            {
                if (start != null)
                {
                    child = gantt.CreatePointElement(parent, start.Value, id, type + "Start", tag);
                }
                if (finish != null)
                {
                    child = gantt.CreatePointElement(parent, finish.Value, id, type + "Finish", tag);
                }
            }

            return child;
        }
示例#6
0
 private static Element AddInterval(DataRow dr, GanttView gantt, Element parent, string startName, string finishName, string id, string type, string tag)
 {
     return AddInterval2(gantt, parent, GetDate(dr, startName), GetDate(dr, finishName), id, type, tag);
 }
示例#7
0
文件: Element.cs 项目: 0anion0/IBN
 internal void AddChild(Element element)
 {
     _children.Add(element);
     element.Parent = this;
 }
示例#8
0
文件: GanttView.cs 项目: 0anion0/IBN
        private void ApplyStyle(Element element)
        {
            List<Style> styles = new List<Style>();
            foreach (Style style in _styles)
            {
                if (style.Selector.Matches(element))
                    styles.Add(style);
            }

            GanttStyle computedStyle = new GanttStyle();

            bool allPropertiesAreDefined = false;
            for (int i = styles.Count - 1; i >= 0; i--)
            {
                allPropertiesAreDefined = computedStyle.CopyFrom(styles[i], false);
                if (allPropertiesAreDefined)
                    break;
            }

            if(!allPropertiesAreDefined && element.Parent != null)
                allPropertiesAreDefined = computedStyle.CopyFrom(element.Parent.Style, true);

            if (!allPropertiesAreDefined)
                computedStyle.ApplyDefaultValues();

            computedStyle.CalculateValues();
            element.Style = computedStyle;

            foreach (Element child in element.Children)
            {
                ApplyStyle(child);
            }
        }
示例#9
0
文件: GanttView.cs 项目: 0anion0/IBN
 private void AddElementToMap(Element element)
 {
     AttributeInfo id;
     if (element.Attributes.TryGetValue("id", out id) && id != null && !string.IsNullOrEmpty(id.Value))
         _map.Add(id.Value, element);
 }
示例#10
0
文件: GanttView.cs 项目: 0anion0/IBN
 private void AddElement(Element element, Element parent)
 {
     if (element != null)
     {
         AddElementToMap(element);
         if (parent != null)
         {
             parent.AddChild(element);
         }
     }
 }
示例#11
0
文件: GanttView.cs 项目: 0anion0/IBN
 public PointElement CreatePointElement(Element parent, DateTime value, string id, string type, string tag)
 {
     PointElement element = new PointElement(this, value, id, type, tag);
     AddElement(element, parent);
     return element;
 }
示例#12
0
文件: GanttView.cs 项目: 0anion0/IBN
 public IntervalElement CreateIntervalElement(Element parent, DateTime start, DateTime finish, string id, string type, string tag)
 {
     IntervalElement element = new IntervalElement(this, start, finish, id, type, tag);
     AddElement(element, parent);
     return element;
 }