예제 #1
0
 /// <summary>
 /// Allows to delegate all the comparison operations to a custom resource comparer.
 /// </summary>
 /// <param name="owner">Reserved. This value is ignored when sorting against a custom comparer.</param>
 /// <param name="customComparer">The custom comparer that handles all the comparison operations for this object.
 /// Property IDs are converted to resources before getting into the custom comparer.</param>
 /// <param name="dontReverse"><c>True</c> if you would like to accept the sorting direction of the custom comparer,
 /// and <c>False</c> if you'd like to reverse it.</param>
 public ResourceComparer(IResourceList owner, IResourceComparer customComparer, bool dontReverse)
 {
     _owner               = (ResourceList)owner;
     _sortSettings        = _emptySortSettings;
     _propTypes           = _emptyPropTypes;
     _customComparer      = customComparer;
     _customSortAscending = dontReverse;
 }
예제 #2
0
 /// <summary>
 /// Creates a column descriptor for displaying multiple properties with default flags.
 /// </summary>
 /// <param name="propNames">The names of the properties displayed in the column.</param>
 /// <param name="width">The width of the column in pixels.</param>
 /// <param name="flags">The flags of the column.</param>
 public ColumnDescriptor(string[] propNames, int width, ColumnDescriptorFlags flags)
 {
     PropNames        = propNames;
     Width            = width;
     Flags            = flags;
     CustomComparer   = null;
     GroupProvider    = null;
     SortMenuAscText  = null;
     SortMenuDescText = null;
 }
예제 #3
0
        private static void LoadColumn(string resourceType, int index, XmlNode node)
        {
            int         width         = XmlTools.GetRequiredIntAttribute(node, "width");
            XmlNodeList propNameNodes = node.SelectNodes("prop");

            ArrayList propNameList = new ArrayList();

            for (int i = 0; i < propNameNodes.Count; i++)
            {
                string propName = XmlTools.GetRequiredAttribute(propNameNodes [i], "name");
                if (XmlTools.GetIntAttribute(propNameNodes [i], "ifExist", 0) == 1)
                {
                    string propRealName = propName;
                    if (propRealName.StartsWith("-"))
                    {
                        propRealName = propRealName.Substring(1);
                    }
                    if (!Core.ResourceStore.PropTypes.Exist(propRealName))
                    {
                        continue;
                    }
                }
                propNameList.Add(propName);
            }
            string[] propNames = (string[])propNameList.ToArray(typeof(string));

            ColumnDescriptorFlags flags = 0;

            if (XmlTools.GetIntAttribute(node, "fixedSize", 0) == 1)
            {
                flags |= ColumnDescriptorFlags.FixedSize;
            }
            if (XmlTools.GetIntAttribute(node, "showIfNotEmpty", 0) == 1)
            {
                flags |= ColumnDescriptorFlags.ShowIfNotEmpty;
            }
            if (XmlTools.GetIntAttribute(node, "showIfDistinct", 0) == 1)
            {
                flags |= ColumnDescriptorFlags.ShowIfDistinct;
            }
            if (XmlTools.GetIntAttribute(node, "autoSize", 0) == 1)
            {
                flags |= ColumnDescriptorFlags.AutoSize;
            }

            ColumnDescriptor descriptor = new ColumnDescriptor(propNames, width, flags);

            XmlNode comparerNode = node.SelectSingleNode("comparer");

            if (comparerNode != null)
            {
                IResourceComparer comparer = LoadComparer(comparerNode);
                descriptor.CustomComparer = comparer;
                if (comparer is IResourceGroupProvider)
                {
                    descriptor.GroupProvider = comparer as IResourceGroupProvider;
                }
            }

            XmlNode sortMenuTextNode = node.SelectSingleNode("sortmenutext");

            if (sortMenuTextNode != null)
            {
                descriptor.SortMenuAscText  = XmlTools.GetRequiredAttribute(sortMenuTextNode, "asc");
                descriptor.SortMenuDescText = XmlTools.GetRequiredAttribute(sortMenuTextNode, "desc");
            }

            Core.DisplayColumnManager.RegisterDisplayColumn(resourceType, index, descriptor);

            XmlNode multiLineNode = node.SelectSingleNode("multiline");

            if (multiLineNode != null)
            {
                LoadMultiLineColumn(resourceType, propNames, multiLineNode);
            }
        }
예제 #4
0
 public void Sort(IResourceComparer customComparer, bool ascending)
 {
     throw new NotImplementedException();
 }
예제 #5
0
파일: ResourceList.cs 프로젝트: mo5h/omeo
 public void Sort(IResourceComparer customComparer, bool ascending)
 {
     DoSort(new ResourceComparer(this, customComparer, ascending), false);
 }