Example #1
0
        internal IChange CreateChange(MapTree.AttributeSpec spec, MapTree.AttributeSpecEventArgs e)
        {
            switch (e.Change)
            {
            case MapTree.AttributeSpecChange.Added:
                return(new AttributeSpecAdd(spec));

            case MapTree.AttributeSpecChange.Removed:
                return(new AttributeSpecDelete(spec));

            case MapTree.AttributeSpecChange.NameChanged:
                return(new AttributeSpecName(spec, (string)e.OldValue));

            case MapTree.AttributeSpecChange.VisibilityChanged:
                return(new AttributeSpecVisibility(spec, (bool)e.OldValue));

            case MapTree.AttributeSpecChange.DataTypedChanged:
                return(new AttributeSpecDataType(spec, (MapTree.AttributeDataType)e.OldValue));

            case MapTree.AttributeSpecChange.TypeChanged:
                return(new AttributeSpecType(spec, (MapTree.AttributeType)e.OldValue));

            case MapTree.AttributeSpecChange.ListTypeChanged:
                return(new AttributeSpecListType(spec, (MapTree.AttributeListOption)e.OldValue));

            case MapTree.AttributeSpecChange.ListValueAdded:
                return(new AttributeSpecValueAdd(spec, (string)e.OldValue));

            case MapTree.AttributeSpecChange.ListValueRemoved:
                return(new AttributeSpecValueRemove(spec, (string)e.OldValue));

            default:
                return(null);
            }
        }
Example #2
0
 public void AddAttribute(string attributeName, string value)
 {
     MapTree.AttributeSpec aSpec = Tree.GetAttributeSpec(attributeName);
     if (aSpec == null) aSpec = new MapTree.AttributeSpec(Tree, attributeName);
     MapNode.Attribute attribute = new Attribute(aSpec, value);
     AddAttribute(attribute);
 }
Example #3
0
 /// <summary>
 /// Delete this attribute from the given node if attribute exists
 /// </summary>
 /// <param name="node"></param>
 public static void RemoveTaskStatus(MapNode node)
 {
     MapTree.AttributeSpec aspec = GetAttributeSpec(node.Tree);
     if (aspec != null)
     {
         node.DeleteAttribute(aspec);
     }
 }
 /// <summary>
 /// Delete this attribute from the given node if attribute exists
 /// </summary>
 /// <param name="node"></param>
 public static void RemoveCompletionDate(MapNode node)
 {
     MapTree.AttributeSpec aspec = GetAttributeSpec(node.Tree);
     if (aspec != null)
     {
         node.DeleteAttribute(aspec);
     }
 }
Example #5
0
 public static void SetStartDate(this MapNode node, DateTime value)
 {
     MapTree.AttributeSpec aSpec = node.Tree.GetAttributeSpec(START_DATE_ATTRIBUTE);
     if (aSpec == null)
     {
         aSpec = new MapTree.AttributeSpec(node.Tree, START_DATE_ATTRIBUTE, false, MapTree.AttributeDataType.DateTime, MapTree.AttributeListOption.NoList, null, MapTree.AttributeType.System);
     }
     node.AddUpdateAttribute(new MapNode.Attribute(aSpec, DateHelper.ToString(value)));
 }
Example #6
0
        private void Tree_AttributeSpecChangeEvent(MapTree.AttributeSpec node, MapTree.AttributeSpecEventArgs e)
        {
            IChange change = factory.CreateChange(node, e);

            if (change != null)
            {
                RecordChange(change);
            }
        }
        public static MapTree.AttributeSpec GetOrCreateAttributeSpec(MapTree tree)
        {
            MapTree.AttributeSpec aspec = GetAttributeSpec(tree);
            if (aspec == null)
            {
                aspec = tree.CreateAttributeSpec();
            }

            return(aspec);
        }
Example #8
0
 /// <summary>
 /// Checks if this attribute spec exists on the given node
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public static bool TaskStatusExists(MapNode node)
 {
     MapTree.AttributeSpec aspec = TaskStatusAttribute.GetAttributeSpec(node.Tree);
     if (aspec != null)
     {
         return(node.ContainsAttribute(aspec));
     }
     else
     {
         return(false);
     }
 }
Example #9
0
 /// <summary>
 /// Checks if this attribute spec exists on the given node
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public static bool CompletionDateExists(this MapNode node)
 {
     MapTree.AttributeSpec aspec = CompletionDateAttribute.GetAttributeSpec(node.Tree);
     if (aspec != null)
     {
         return(node.ContainsAttribute(aspec));
     }
     else
     {
         return(false);
     }
 }
Example #10
0
        public static bool GetAttribute(MapNode node, out MapNode.Attribute attribute)
        {
            MapTree.AttributeSpec aspec = GetAttributeSpec(node.Tree);
            if (aspec != null)
            {
                if (node.GetAttribute(aspec, out attribute))
                {
                    return(true);
                }
            }

            attribute = MapNode.Attribute.Empty;
            return(false);
        }
Example #11
0
 public AttributeSpecDelete(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Example #12
0
 public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue)
 {
     this.spec = spec;
     this.oldValue = oldValue;
 }
Example #13
0
 public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Example #14
0
 public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value)
 {
     this.spec  = spec;
     this.value = value;
 }
Example #15
0
 public AttributeSpecDelete(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Example #16
0
 public Attribute(MapTree.AttributeSpec aspec, object val)
 {
     this.AttributeSpec = aspec;
     this.Value = val;
 }
Example #17
0
 public AttributeSpecName(MapTree.AttributeSpec spec, string oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Example #18
0
 public AttributeSpecDataType(MapTree.AttributeSpec spec, MapTree.AttributeDataType oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Example #19
0
 public static bool IsStartDate(this MapTree.AttributeSpec aSpec)
 {
     return(aSpec.Name.Equals(START_DATE_ATTRIBUTE));
 }
Example #20
0
 public AttributeSpecListType(MapTree.AttributeSpec spec, MapTree.AttributeListOption oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Example #21
0
 public static MapTree.AttributeSpec GetAttributeSpec(MapTree tree)
 {
     MapTree.AttributeSpec aspec = tree.GetAttributeSpec(ATTRIBUTE_NAME);
     return(aspec);
 }
Example #22
0
 public static void SetCompletionDate(MapNode node, DateTime value)
 {
     MapTree.AttributeSpec aspec = GetOrCreateAttributeSpec(node.Tree);
     node.AddUpdateAttribute(new MapNode.Attribute(aspec, DateHelper.ToString(value)));
 }
Example #23
0
 public static void SetTaskStatus(MapNode node, TaskStatus value)
 {
     MapTree.AttributeSpec aspec = GetOrCreateAttributeSpec(node.Tree);
     node.AddUpdateAttribute(new MapNode.Attribute(aspec, value.ToString()));
 }
Example #24
0
 public static bool IsTaskStatus(this MapTree.AttributeSpec aspec)
 {
     return(aspec.Name == ATTRIBUTE_NAME);
 }
Example #25
0
 public static bool IsCompletionDate(this MapTree.AttributeSpec aspec)
 {
     return(aspec.Name == ATTRIBUTE_NAME);
 }
Example #26
0
 public AttributeSpecAdd(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Example #27
0
 public AttributeSpecAdd(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Example #28
0
 public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value)
 {
     this.spec = spec;
     this.value = value;
 }