Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 4
0
 /// <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);
     }
 }
Exemplo n.º 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)));
 }
Exemplo n.º 6
0
        private void Tree_AttributeSpecChangeEvent(MapTree.AttributeSpec node, MapTree.AttributeSpecEventArgs e)
        {
            IChange change = factory.CreateChange(node, e);

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

            return(aspec);
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 11
0
 public AttributeSpecDelete(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Exemplo n.º 12
0
 public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue)
 {
     this.spec = spec;
     this.oldValue = oldValue;
 }
Exemplo n.º 13
0
 public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Exemplo n.º 14
0
 public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value)
 {
     this.spec  = spec;
     this.value = value;
 }
Exemplo n.º 15
0
 public AttributeSpecDelete(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Exemplo n.º 16
0
 public Attribute(MapTree.AttributeSpec aspec, object val)
 {
     this.AttributeSpec = aspec;
     this.Value = val;
 }
Exemplo n.º 17
0
 public AttributeSpecName(MapTree.AttributeSpec spec, string oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Exemplo n.º 18
0
 public AttributeSpecDataType(MapTree.AttributeSpec spec, MapTree.AttributeDataType oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Exemplo n.º 19
0
 public static bool IsStartDate(this MapTree.AttributeSpec aSpec)
 {
     return(aSpec.Name.Equals(START_DATE_ATTRIBUTE));
 }
Exemplo n.º 20
0
 public AttributeSpecListType(MapTree.AttributeSpec spec, MapTree.AttributeListOption oldValue)
 {
     this.spec     = spec;
     this.oldValue = oldValue;
 }
Exemplo n.º 21
0
 public static MapTree.AttributeSpec GetAttributeSpec(MapTree tree)
 {
     MapTree.AttributeSpec aspec = tree.GetAttributeSpec(ATTRIBUTE_NAME);
     return(aspec);
 }
Exemplo n.º 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)));
 }
Exemplo n.º 23
0
 public static void SetTaskStatus(MapNode node, TaskStatus value)
 {
     MapTree.AttributeSpec aspec = GetOrCreateAttributeSpec(node.Tree);
     node.AddUpdateAttribute(new MapNode.Attribute(aspec, value.ToString()));
 }
Exemplo n.º 24
0
 public static bool IsTaskStatus(this MapTree.AttributeSpec aspec)
 {
     return(aspec.Name == ATTRIBUTE_NAME);
 }
Exemplo n.º 25
0
 public static bool IsCompletionDate(this MapTree.AttributeSpec aspec)
 {
     return(aspec.Name == ATTRIBUTE_NAME);
 }
Exemplo n.º 26
0
 public AttributeSpecAdd(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Exemplo n.º 27
0
 public AttributeSpecAdd(MapTree.AttributeSpec spec)
 {
     this.spec = spec;
 }
Exemplo n.º 28
0
 public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value)
 {
     this.spec = spec;
     this.value = value;
 }