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); } }
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); }
/// <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); } }
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))); }
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); }
/// <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); } }
/// <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); } }
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); }
public AttributeSpecDelete(MapTree.AttributeSpec spec) { this.spec = spec; }
public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue) { this.spec = spec; this.oldValue = oldValue; }
public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value) { this.spec = spec; this.value = value; }
public Attribute(MapTree.AttributeSpec aspec, object val) { this.AttributeSpec = aspec; this.Value = val; }
public AttributeSpecName(MapTree.AttributeSpec spec, string oldValue) { this.spec = spec; this.oldValue = oldValue; }
public AttributeSpecDataType(MapTree.AttributeSpec spec, MapTree.AttributeDataType oldValue) { this.spec = spec; this.oldValue = oldValue; }
public static bool IsStartDate(this MapTree.AttributeSpec aSpec) { return(aSpec.Name.Equals(START_DATE_ATTRIBUTE)); }
public AttributeSpecListType(MapTree.AttributeSpec spec, MapTree.AttributeListOption oldValue) { this.spec = spec; this.oldValue = oldValue; }
public static MapTree.AttributeSpec GetAttributeSpec(MapTree tree) { MapTree.AttributeSpec aspec = tree.GetAttributeSpec(ATTRIBUTE_NAME); return(aspec); }
public static void SetCompletionDate(MapNode node, DateTime value) { MapTree.AttributeSpec aspec = GetOrCreateAttributeSpec(node.Tree); node.AddUpdateAttribute(new MapNode.Attribute(aspec, DateHelper.ToString(value))); }
public static void SetTaskStatus(MapNode node, TaskStatus value) { MapTree.AttributeSpec aspec = GetOrCreateAttributeSpec(node.Tree); node.AddUpdateAttribute(new MapNode.Attribute(aspec, value.ToString())); }
public static bool IsTaskStatus(this MapTree.AttributeSpec aspec) { return(aspec.Name == ATTRIBUTE_NAME); }
public static bool IsCompletionDate(this MapTree.AttributeSpec aspec) { return(aspec.Name == ATTRIBUTE_NAME); }
public AttributeSpecAdd(MapTree.AttributeSpec spec) { this.spec = spec; }