コード例 #1
0
ファイル: LayoutFinder.cs プロジェクト: sillsdev/WorldPad
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Answer true if they are the 'same' finder (will find the same strings).
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public virtual bool SameFinder(IStringFinder other)
        {
            CheckDisposed();

            LayoutFinder otherLf = other as LayoutFinder;

            if (otherLf == null)
            {
                return(false);
            }
            string colSpecLabel  = XmlUtils.GetManditoryAttributeValue(m_colSpec, "label");
            string otherLfLabel  = XmlUtils.GetManditoryAttributeValue(otherLf.m_colSpec, "label");
            string colSpecLabel2 = XmlUtils.GetOptionalAttributeValue(m_colSpec, "headerlabel");
            string otherLfLabel2 = XmlUtils.GetOptionalAttributeValue(otherLf.m_colSpec, "headerlabel");

            return(SameStrings(otherLf.m_layoutName, this.m_layoutName) &&
                   otherLf.m_sda == this.m_sda
                   // XmlUtils.NodesMatch() is too strict a comparison for identifying column configurations that will
                   // display the same value (e.g. we don't care about differences in width), causing us to
                   // lose the sort arrow when switching between tools sharing common columns (LT-2858).
                   // For now, just assume that columns with the same label will display the same value.
                   // If this proves too loose for a particular column, try implementing a sortmethod instead.
//				&& XmlUtils.NodesMatch(m_colSpec, otherLf.m_colSpec);
                   && (colSpecLabel == otherLfLabel ||
                       colSpecLabel == otherLfLabel2 ||
                       colSpecLabel2 == otherLfLabel ||
                       (colSpecLabel2 == otherLfLabel2) && otherLfLabel2 != null));
        }
コード例 #2
0
ファイル: LayoutFinder.cs プロジェクト: vkarthim/FieldWorks
        private bool SameData(LayoutFinder otherLf)
        {
            if (otherLf.m_sda == m_sda)
            {
                return(true);
            }
            ISilDataAccessManaged first  = RootSdaOf(m_sda);
            ISilDataAccessManaged second = RootSdaOf(otherLf.m_sda);

            return(first == second && first != null);
        }
コード例 #3
0
ファイル: LayoutFinder.cs プロジェクト: vkarthim/FieldWorks
        private bool SameConfiguration(LayoutFinder otherLf)
        {
            // XmlUtils.NodesMatch() is too strict a comparison for identifying column configurations that will
            // display the same value (e.g. we don't care about differences in width), causing us to
            // lose the sort arrow when switching between tools sharing common columns (LT-2858).
            // For now, just assume that columns with the same label will display the same value.
            // If this proves too loose for a particular column, try implementing a sortmethod instead.
            string colSpecLabel  = XmlUtils.GetManditoryAttributeValue(m_colSpec, "label");
            string otherLfLabel  = XmlUtils.GetManditoryAttributeValue(otherLf.m_colSpec, "label");
            string colSpecLabel2 = XmlUtils.GetOptionalAttributeValue(m_colSpec, "headerlabel");
            string otherLfLabel2 = XmlUtils.GetOptionalAttributeValue(otherLf.m_colSpec, "headerlabel");

            return(colSpecLabel == otherLfLabel ||
                   colSpecLabel == otherLfLabel2 ||
                   colSpecLabel2 == otherLfLabel ||
                   (colSpecLabel2 == otherLfLabel2 && otherLfLabel2 != null));
        }
コード例 #4
0
ファイル: LayoutFinder.cs プロジェクト: vkarthim/FieldWorks
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Make a finder appropriate to the given column specification
        /// </summary>
        /// <param name="cache">FdoCache</param>
        /// <param name="colSpec">column specification</param>
        /// <param name="vc">The vc.</param>
        /// <param name="app">The application.</param>
        /// <returns>finder for colSpec</returns>
        /// ------------------------------------------------------------------------------------
        static public IStringFinder CreateFinder(FdoCache cache, XmlNode colSpec,
                                                 XmlBrowseViewBaseVc vc, IApp app)
        {
            string       layoutName  = XmlUtils.GetOptionalAttributeValue(colSpec, "layout");
            string       sSortMethod = XmlUtils.GetOptionalAttributeValue(colSpec, "sortmethod");
            string       sortType    = XmlUtils.GetOptionalAttributeValue(colSpec, "sortType", null);
            LayoutFinder result;

            if (sSortMethod != null)
            {
                result = new SortMethodFinder(cache, sSortMethod, layoutName, colSpec, app);
            }
            else if (sortType != null)
            {
                switch (sortType)
                {
                case "integer":
                    result = new IntCompareFinder(cache, layoutName, colSpec, app);
                    break;

                case "date":
                case "YesNo":
                case "stringList":
                case "genDate":
                    // no special action needed here for sorting dates or date that shows as 'yes" or "no";
                    // Using a SortCollectorEnv triggers special
                    // action in case "datetime"/"gendate" of XmlVc.ProcessFrag().
                    result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl, app);
                    break;

                default:
                    throw new ConfigurationException("unexpected sort type: " + sortType, colSpec);
                }
            }
            else
            {
                result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl, app);
            }
            result.Vc = vc;
            return(result);
        }
コード例 #5
0
ファイル: LayoutFinder.cs プロジェクト: vkarthim/FieldWorks
 bool SameLayoutName(LayoutFinder otherLf)
 {
     return(otherLf.m_layoutName == m_layoutName ||
            (String.IsNullOrEmpty(otherLf.m_layoutName) && String.IsNullOrEmpty(m_layoutName)));
 }
コード例 #6
0
ファイル: LayoutFinder.cs プロジェクト: sillsdev/WorldPad
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make a finder appropriate to the given column specification
		/// </summary>
		/// <param name="cache">FdoCache</param>
		/// <param name="colSpec">column specification</param>
		/// <param name="vc">The vc.</param>
		/// <returns>finder for colSpec</returns>
		/// ------------------------------------------------------------------------------------
		static public IStringFinder CreateFinder(FdoCache cache, XmlNode colSpec, XmlBrowseViewBaseVc vc)
		{
			string layoutName = XmlUtils.GetOptionalAttributeValue(colSpec, "layout");
			string sSortMethod = XmlUtils.GetOptionalAttributeValue(colSpec, "sortmethod");
			string sortType = XmlUtils.GetOptionalAttributeValue(colSpec, "sortType", null);
			LayoutFinder result;
			if (sSortMethod != null)
			{
				result = new SortMethodFinder(cache, sSortMethod, layoutName, colSpec);
			}
			else if (sortType != null)
			{
				switch (sortType)
				{
					case "integer":
						result = new IntCompareFinder(cache, layoutName, colSpec);
						break;
					case "date":
					case "YesNo":
					case "stringList":
						// no special action needed here for sorting dates or date that shows as 'yes" or "no";
						// Using a SortCollectorEnv triggers special
						// action in case "datetime" of XmlVc.ProcessFrag().
						result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl);
						break;
					default:
						throw new ConfigurationException("unexpected sort type: " + sortType, colSpec);
				}
			}
			else
			{
				result = new LayoutFinder(cache, layoutName, colSpec, vc.StringTbl);
			}
			result.Vc = vc;
			return result;
		}
コード例 #7
0
ファイル: LayoutFinder.cs プロジェクト: bbriggs/FieldWorks
		private bool SameConfiguration(LayoutFinder otherLf)
		{
			// XmlUtils.NodesMatch() is too strict a comparison for identifying column configurations that will
			// display the same value (e.g. we don't care about differences in width), causing us to
			// lose the sort arrow when switching between tools sharing common columns (LT-2858).
			// For now, just assume that columns with the same label will display the same value.
			// If this proves too loose for a particular column, try implementing a sortmethod instead.
			string colSpecLabel = XmlUtils.GetManditoryAttributeValue(m_colSpec, "label");
			string otherLfLabel = XmlUtils.GetManditoryAttributeValue(otherLf.m_colSpec, "label");
			string colSpecLabel2 = XmlUtils.GetOptionalAttributeValue(m_colSpec, "headerlabel");
			string otherLfLabel2 = XmlUtils.GetOptionalAttributeValue(otherLf.m_colSpec, "headerlabel");
			return (colSpecLabel == otherLfLabel ||
					colSpecLabel == otherLfLabel2 ||
					colSpecLabel2 == otherLfLabel ||
					(colSpecLabel2 == otherLfLabel2 && otherLfLabel2 != null));
		}
コード例 #8
0
ファイル: LayoutFinder.cs プロジェクト: bbriggs/FieldWorks
		private bool SameData(LayoutFinder otherLf)
		{
			if (otherLf.m_sda == m_sda)
				return true;
			ISilDataAccessManaged first = RootSdaOf(m_sda);
			ISilDataAccessManaged second = RootSdaOf(otherLf.m_sda);
			return (first == second && first != null);
		}
コード例 #9
0
ファイル: LayoutFinder.cs プロジェクト: bbriggs/FieldWorks
		bool SameLayoutName(LayoutFinder otherLf)
		{
			return otherLf.m_layoutName == m_layoutName ||
				(String.IsNullOrEmpty(otherLf.m_layoutName) && String.IsNullOrEmpty(m_layoutName));
		}