[runtime] Fix corlib out of date error with disabled COM
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / PropertyEditing / PropertyOrder.cs
1 namespace System.Activities.Presentation.PropertyEditing {
2     using System;
3     using System.ComponentModel;
4     using System.Runtime;
5     using System.Activities.Presentation;
6     using System.Diagnostics.CodeAnalysis;
7
8     /// <summary>
9     /// This class is used to set the order in which properties show up within a category, 
10     /// or within a list of sub-properties.  3rd parties may choose to derive from this class
11     /// and create their own custom order tokens, which can both guarantee property order as
12     /// well as property grouping.
13     /// </summary>
14     [Fx.Tag.XamlVisible(false)]
15     sealed class PropertyOrder : OrderToken
16     {
17         private static PropertyOrder _default;
18
19         /// <summary>
20         /// Creates a PropertyOrder.  
21         /// </summary>
22         /// <param name="precedence">Precedence of this token based on the
23         /// referenced token.</param>
24         /// <param name="reference">Referenced token.</param>
25         /// <param name="conflictResolution">Conflict resolution semantics.
26         /// Winning ConflictResultion semantic should only be used
27         /// on predefined, default OrderToken instances to ensure
28         /// their correct placement in more complex chain of order
29         /// dependencies.</param>
30         private PropertyOrder(OrderTokenPrecedence precedence, OrderToken reference, OrderTokenConflictResolution conflictResolution)
31             : base(precedence, reference, conflictResolution) {
32         }
33
34         /// <summary>
35         /// Creates a PropertyOrder that comes after the passed in token.
36         /// </summary>
37         /// <param name="reference">The reference token</param>
38         /// <returns>The new PropertyOrder</returns>
39         /// <exception cref="ArgumentNullException">When reference is null</exception>
40         public static PropertyOrder CreateAfter(OrderToken reference)
41         {
42             if (reference == null)
43                 throw FxTrace.Exception.ArgumentNull("reference");
44
45             return new PropertyOrder(OrderTokenPrecedence.After, reference, OrderTokenConflictResolution.Lose);
46         }
47
48         /// <summary>
49         /// Treat equal orders as equal
50         /// </summary>
51         /// <param name="left">Left token</param>
52         /// <param name="right">Right token</param>
53         /// <returns>0</returns>
54         protected override int ResolveConflict(OrderToken left, OrderToken right) {
55             return 0;
56         }
57
58         /// <summary>
59         /// Gets the system defined Default order position.
60         /// </summary>
61         public static PropertyOrder Default {
62             get {
63                 if (_default == null) {
64                     _default = new PropertyOrder(OrderTokenPrecedence.After, null, OrderTokenConflictResolution.Win);
65                 }
66                 return _default;
67             }
68         }
69     }
70 }