Beispiel #1
0
		/// <summary>
		/// Make a part generator for the specified "generate" element, interpreting names
		/// using the specified metadatacache, using vc and rootClassId for handling generate nodes
		/// that refer to layouts.
		/// </summary>
		/// <param name="mdc"></param>
		/// <param name="input"></param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">class of root object from which column layouts can be computed</param>
		public PartGenerator(IFwMetaDataCache mdc, XmlNode input, XmlVc vc, int rootClassId)
		{
			m_mdc = mdc;
			m_vc = vc;
			m_rootClassId = rootClassId;
			m_input = input;
			InitMemberVariablesFromInput(mdc, input);
		}
Beispiel #2
0
 /// <summary>
 /// Make a part generator for the specified "generate" element, interpreting names
 /// using the specified metadatacache, using vc and rootClassId for handling generate nodes
 /// that refer to layouts.
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="input"></param>
 /// <param name="vc">for parts/layouts</param>
 /// <param name="rootClassId">class of root object from which column layouts can be computed</param>
 public PartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
 {
     m_cache       = cache;
     m_mdc         = cache.MetaDataCacheAccessor;
     m_vc          = vc;
     m_rootClassId = rootClassId;
     m_input       = input;
     InitMemberVariablesFromInput(cache.MetaDataCacheAccessor, input);
 }
Beispiel #3
0
		/// <summary>
		/// Make a part generator for the specified "generate" element, interpreting names
		/// using the specified metadatacache, using vc and rootClassId for handling generate nodes
		/// that refer to layouts.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="input"></param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">class of root object from which column layouts can be computed</param>
		public PartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
		{
			m_cache = cache;
			m_mdc = cache.MetaDataCacheAccessor;
			m_vc = vc;
			m_rootClassId = rootClassId;
			m_input = input;
			InitMemberVariablesFromInput(cache.MetaDataCacheAccessor, input);
		}
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="root"></param>
        /// <param name="cache"></param>
        /// <param name="keyAttrNames"></param>
        /// <param name="vc">for parts/layouts</param>
        /// <param name="rootClassId">class of the root object used to compute parts/layouts</param>
        /// <returns></returns>
        static private List <XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, string[] keyAttrNames,
                                                           XmlVc vc, int rootClassId)
        {
            List <XmlNode> result = new List <XmlNode>();
            string         generateModeForColumns = XmlUtils.GetOptionalAttributeValue(root, "generate");
            bool           m_fGenerateChildPartsForParentLayouts = (generateModeForColumns == "childPartsForParentLayouts");

            // childPartsForParentLayouts
            foreach (XmlNode child in root.ChildNodes)
            {
                if (child is XmlComment)
                {
                    continue;
                }
                if (m_fGenerateChildPartsForParentLayouts)
                {
                    ChildPartGenerator cpg = new ChildPartGenerator(cache, child, vc, rootClassId);
                    cpg.GenerateChildPartsIfNeeded();
                }
                if (child.Name != "generate")
                {
                    result.Add(child);
                    continue;
                }

                PartGenerator generator;
                if (generateModeForColumns == "objectValuePartsForParentLayouts")
                {
                    generator = new ObjectValuePartGenerator(cache, child, vc, rootClassId);
                }
                else
                {
                    generator = new PartGenerator(cache, child, vc, rootClassId);
                }
                foreach (XmlNode genNode in generator.Generate())
                {
                    bool match = false;
                    if (keyAttrNames != null)
                    {
                        foreach (XmlNode matchNode in root.ChildNodes)
                        {
                            if (MatchNodes(matchNode, genNode, keyAttrNames))
                            {
                                match = true;
                                break;
                            }
                        }
                    }
                    if (!match)                     // not already present, or not checking; add it.
                    {
                        result.Add(genNode);
                    }
                }
            }
            return(result);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override this method in your subclass.
        /// It should make a root box and initialize it with appropriate data and
        /// view constructor, etc.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            base.MakeRoot();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            IVwRootBox rootb = VwRootBoxClass.Create();

            rootb.SetSite(this);

            bool   fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true);
            string toolName  = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);

            m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false);
            //m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach?
            // Note: we want to keep this logic similar to RecordDocView.GetLayoutName(), except that here
            // we do NOT want to use the layoutSuffix, though it may be specified so that it can be
            // used when the configure dialog handles a shared view.
            string sLayout = null;
            string sProp   = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null);

            if (!String.IsNullOrEmpty(sProp))
            {
                sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
            }
            if (String.IsNullOrEmpty(sLayout))
            {
                sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout");
            }
            ISilDataAccess sda = GetSda();

            m_xmlVc = new XmlVc(StringTbl, sLayout, fEditable, this, m_app,
                                m_fShowFailingItems ? null : ItemDisplayCondition, sda)
            {
                IdentifySource = true
            };
            ReadOnlyView = !fEditable;
            if (!fEditable)
            {
                rootb.MaxParasToScan = 0;
            }
            m_xmlVc.Cache       = m_fdoCache;
            m_xmlVc.MainSeqFlid = m_mainFlid;

            rootb.DataAccess   = sda;
            m_xmlVc.DataAccess = sda;

            rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet);
            m_rootb = rootb;
        }
Beispiel #6
0
        private string GetChildObjKey(XmlNode layout, int hvo, ManyOnePathSortItem item, int pathIndex, bool sortedFromEnd)
        {
            ICmObject childObj   = CmObject.CreateFromDBObject(m_cache, hvo);
            string    layoutName = XmlUtils.GetManditoryAttributeValue(layout, "layout");
            XmlNode   part       = XmlVc.GetNodeForPart(hvo, layoutName, true, m_sda, m_layouts);
            string    key        = GetKey(part, childObj, item, pathIndex, sortedFromEnd);

            if (key != null)
            {
                return(key);
            }
            return(CallSortMethod(childObj, sortedFromEnd));
        }
Beispiel #7
0
        private string[] GetChildObjKey(XmlNode layout, int hvo, IManyOnePathSortItem item, int pathIndex, bool sortedFromEnd)
        {
            ICmObject childObj   = m_cache.ServiceLocator.ObjectRepository.GetObject(hvo);
            string    layoutName = XmlUtils.GetOptionalAttributeValue(layout, "layout");
            XmlNode   part       = XmlVc.GetNodeForPart(hvo, layoutName, true, m_sda, m_layouts);
            var       key        = GetKey(part, childObj, item, pathIndex, sortedFromEnd);

            if (key != null)
            {
                return(key);
            }
            return(CallSortMethod(childObj, sortedFromEnd));
        }
Beispiel #8
0
		/// <summary>
		/// The method object's constructor.
		/// </summary>
		/// <param name="vc">The view constructor</param>
		/// <param name="vwenv">The view environment</param>
		/// <param name="hvo">A handle on the root object</param>
		/// <param name="flid">The field ID</param>
		/// <param name="frag">A code identifying the current part of the display</param>
		public XmlVcDisplayVec(XmlVc vc, IVwEnv vwenv, int hvo, int flid, int frag)
		{
			m_viewConstructor = vc;
			m_vwEnv = vwenv;
			m_hvo = hvo;
			m_flid = flid;
			m_frag = frag;
			m_cache = m_viewConstructor.Cache;
			m_sda = m_viewConstructor.DataAccess;
			if (vwenv.DataAccess != null)
				m_sda = vwenv.DataAccess;
			m_objRepo = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>();
			m_stringTable = m_viewConstructor.StringTbl;
		}
Beispiel #9
0
        // Display the first child (item in the vector) in a special mode which suppresses everything except the child
        // marked singlegraminfofirst, to show the POS.
        private void DisplayFirstChildPOS(int firstChildHvo, int childFrag)
        {
            var    dispCommand = (MainCallerDisplayCommand)m_viewConstructor.m_idToDisplayCommand[childFrag];
            string layoutName;
            var    parent = dispCommand.GetNodeForChild(out layoutName, childFrag, m_viewConstructor, firstChildHvo);

            foreach (XmlNode gramInfoPartRef in parent.ChildNodes)
            {
                if (XmlUtils.GetOptionalBooleanAttributeValue(gramInfoPartRef, "singlegraminfofirst", false))
                {
                    // It really is the gram info part ref we want.
                    //m_viewConstructor.ProcessPartRef(gramInfoPartRef, firstChildHvo, m_vwEnv); no! the sense is not on the stack.
                    var sVisibility = XmlUtils.GetOptionalAttributeValue(gramInfoPartRef, "visibility", "always");
                    if (sVisibility == "never")
                    {
                        return;                         // user has configured gram info first, but turned off gram info.
                    }
                    string morphLayoutName = XmlUtils.GetManditoryAttributeValue(gramInfoPartRef, "ref");
                    var    part            = m_viewConstructor.GetNodeForPart(firstChildHvo, morphLayoutName, false);
                    if (part == null)
                    {
                        throw new ArgumentException("Attempt to display gram info of first child, but part for " + morphLayoutName + " does not exist");
                    }
                    var objNode = XmlUtils.GetFirstNonCommentChild(part);
                    if (objNode == null || objNode.Name != "obj")
                    {
                        throw new ArgumentException("Attempt to display gram info of first child, but part for " + morphLayoutName + " does not hav a single <obj> child");
                    }
                    int flid      = XmlVc.GetFlid(objNode, firstChildHvo, m_viewConstructor.DataAccess);
                    int hvoTarget = m_viewConstructor.DataAccess.get_ObjectProp(firstChildHvo, flid);
                    if (hvoTarget == 0)
                    {
                        return;                         // first sense has no category.
                    }
                    int fragId = m_viewConstructor.GetSubFragId(objNode, gramInfoPartRef);
                    if (m_vwEnv is ConfiguredExport)
                    {
                        (m_vwEnv as ConfiguredExport).BeginCssClassIfNeeded(gramInfoPartRef);
                    }
                    m_vwEnv.AddObj(hvoTarget, m_viewConstructor, fragId);
                    if (m_vwEnv is ConfiguredExport)
                    {
                        (m_vwEnv as ConfiguredExport).EndCssClassIfNeeded(gramInfoPartRef);
                    }
                    return;
                }
            }
            throw new ArgumentException("Attempt to display gram info of first child, but template has no singlegraminfofirst");
        }
Beispiel #10
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override this method in your subclass.
        /// It should make a root box and initialize it with appropriate data and
        /// view constructor, etc.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            base.MakeRoot();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            IVwRootBox rootb = VwRootBoxClass.Create();

            rootb.SetSite(this);

            bool   fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true);
            string toolName  = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);

            m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false);
            //m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach?
            string sLayout = null;
            string sProp   = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null);

            if (!String.IsNullOrEmpty(sProp))
            {
                sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
            }
            if (String.IsNullOrEmpty(sLayout))
            {
                sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout");
            }
            m_xmlVc = new XmlVc(StringTbl, sLayout,
                                fEditable, this, m_fShowFailingItems ? null : ItemDisplayCondition);
            this.ReadOnlyView = !fEditable;
            if (!fEditable)
            {
                rootb.MaxParasToScan = 0;
            }
            m_xmlVc.Cache       = m_fdoCache;
            m_xmlVc.MainSeqFlid = m_mainFlid;

            ISilDataAccess sda = GetSda();

            rootb.DataAccess   = sda;
            m_xmlVc.DataAccess = sda;

            rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet);
            m_rootb = rootb;
        }
Beispiel #11
0
 /// <summary>
 /// The method object's constructor.
 /// </summary>
 /// <param name="vc">The view constructor</param>
 /// <param name="vwenv">The view environment</param>
 /// <param name="hvo">A handle on the root object</param>
 /// <param name="flid">The field ID</param>
 /// <param name="frag">A code identifying the current part of the display</param>
 public XmlVcDisplayVec(XmlVc vc, IVwEnv vwenv, int hvo, int flid, int frag)
 {
     m_viewConstructor = vc;
     m_vwEnv           = vwenv;
     m_hvo             = hvo;
     m_flid            = flid;
     m_frag            = frag;
     m_cache           = m_viewConstructor.Cache;
     m_sda             = m_viewConstructor.DataAccess;
     if (vwenv.DataAccess != null)
     {
         m_sda = vwenv.DataAccess;
     }
     m_objRepo = m_cache.ServiceLocator.GetInstance <ICmObjectRepository>();
 }
Beispiel #12
0
 public ObjectValuePartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
     : base(cache, input, vc, rootClassId)
 {
     m_objectPath = XmlUtils.GetAttributeValue(input, "objectPath");
     if (m_objectPath == null)
     {
         throw new ArgumentException("ObjectValuePartGenerator expects input to have objectPath attribute.");
     }
     // Enhance: generalize this
     if (m_objectPath == "PhFeatureSystem.Features")
     {
         m_collectionToGeneratePartsFrom = cache.LangProject.PhFeatureSystemOA.FeaturesOC;
         m_sortedCollection = from s in m_collectionToGeneratePartsFrom
                              orderby s.Abbreviation.BestAnalysisAlternative.Text
                              select s;
     }
 }
Beispiel #13
0
        public void SenseOutlineIsObtainedUsingVirtual()
        {
            // For this test we need a real entry and sense.
            var entry = Cache.ServiceLocator.GetInstance <ILexEntryFactory>().Create();
            var sense = Cache.ServiceLocator.GetInstance <ILexSenseFactory>().Create();

            entry.SensesOS.Add(sense);
            var sda = new MockDecorator(Cache);
            var vc  = new XmlVc("root", true, null, null, sda);

            vc.SetCache(Cache);
            var sut = new XmlVcDisplayVec(vc, new MockEnv(), entry.Hvo, LexEntryTags.kflidSenses, 1);

            Assert.That(sut.CalculateAndFormatSenseLabel(sense.Hvo, 0, "%O)"), Is.EqualTo("77)"),
                        "CalculateAndFormatSenseLabel should have used the decorator method");
            Assert.That(sda.Tag, Is.EqualTo(Cache.MetaDataCacheAccessor.GetFieldId2(LexSenseTags.kClassId, "LexSenseOutline", false)),
                        "CalculateAndFormatSenseLabel should have used the right property");
        }
Beispiel #14
0
            internal override void PerformDisplay(XmlVc vc, int fragId, int hvo, IVwEnv vwenv)
            {
                int level = vwenv.EmbeddingLevel;
                int hvoDum, tag, ihvo;

                vwenv.GetOuterObject(level - 2, out hvoDum, out tag, out ihvo);
                m_creator.SetupParagraph(m_paraStyle, m_tssBefore, m_listDelimitNode);
                m_creator.AddItemEmbellishments(m_listDelimitNode, m_numberItems, hvo, ihvo, m_xaNum, m_ttpNum, m_delayNumber, ref DelayedNumber);

                // This is the display of the object we wanted to wrap the paragraph etc around.
                // We want to produce an effect rather like
                // vwenv.AddObj(hvo, m_creator.m_viewConstructor, WrappedFragId);
                // except we do NOT want to open/close an object in the VC, since we are already inside the addition of this object.
                m_creator.m_viewConstructor.Display(vwenv, hvo, WrappedFragId);

                // Close Paragraph if displaying paragraphs
                vwenv.CloseParagraph();
            }
Beispiel #15
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
            }
            m_xmlVc    = null;
            m_mdc      = null;
            m_sXmlSpec = null;
            m_docSpec  = null;
            m_xnSpec   = null;
        }
Beispiel #16
0
 public void StringPropIsMarked()
 {
     using (var view = new XmlView(m_hvoLexDb, "root", null, true, m_sda))
     {
         var vc = new XmlVc(null, "root", true, view, null, m_sda);
         vc.IdentifySource = true;
         vc.SetCache(Cache);
         vc.m_layouts  = m_layouts;
         vc.DataAccess = m_sda;
         var testEnv = new MockEnv()
         {
             DataAccess = m_sda, OpenObject = m_hvoLexDb
         };
         vc.Display(testEnv, m_hvoLexDb, XmlVc.kRootFragId);
         VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, "Entry:basic:Headword:HeadwordL");
         VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, 1, ")", "Entry:basic:Headword:HeadwordL");
         VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, -2, "head(", "Entry:basic:Headword:HeadwordL");
         VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Summary, "Entry:basic:Summary:Sum.");
     }
 }
Beispiel #17
0
        /// <summary>
        /// Get a key from the item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="sortedFromEnd">if set to <c>true</c> [sorted from end].</param>
        /// <returns></returns>
        public override string[] SortStrings(IManyOnePathSortItem item, bool sortedFromEnd)
        {
            if (item.KeyObject == 0)
            {
                return(new string[0]);
            }

            // traverse the part tree from the root, the root object and the root layout node should
            // be compatible
            XmlNode layout     = XmlVc.GetNodeForPart(item.RootObjectHvo, m_layoutName, true, m_sda, m_layouts);
            var     rootObject = item.RootObjectUsing(m_cache);
            var     key        = GetKey(layout, rootObject, item, 0, sortedFromEnd);

            if (key == null)
            {
                // the root object sort method is not tried in GetKey
                key = CallSortMethod(rootObject, sortedFromEnd);

                if (key == null)
                {
                    // try calling the sort method on the key object
                    var keyCmObjectUsing = item.KeyObjectUsing(m_cache);
                    key = CallSortMethod(keyCmObjectUsing, sortedFromEnd);

                    if (key == null)
                    {
                        // Try the default fallback if we can't find the method.
                        var firstKey = keyCmObjectUsing.SortKey ?? "";
                        if (sortedFromEnd)
                        {
                            firstKey = TsStringUtils.ReverseString(firstKey);
                        }

                        return(new [] { firstKey, keyCmObjectUsing.SortKey2Alpha });
                    }
                }
            }

            return(key);
        }
Beispiel #18
0
        /// <summary>
        /// Get a key from the item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="sortedFromEnd">if set to <c>true</c> [sorted from end].</param>
        /// <returns></returns>
        public override string[] SortStrings(ManyOnePathSortItem item, bool sortedFromEnd)
        {
            CheckDisposed();

            if (item.KeyCmObject == null)
            {
                return(new string[0]);
            }

            // traverse the part tree from the root, the root object and the root layout node should
            // be compatible
            XmlNode layout = XmlVc.GetNodeForPart(item.RootObject.Hvo, m_layoutName, true, m_sda, m_layouts);
            string  key    = GetKey(layout, item.RootObject, item, 0, sortedFromEnd);

            if (key == null)
            {
                // the root object sort method is not tried in GetKey
                key = CallSortMethod(item.RootObject, sortedFromEnd);

                if (key == null)
                {
                    // try calling the sort method on the key object
                    key = CallSortMethod(item.KeyCmObject, sortedFromEnd);

                    if (key == null)
                    {
                        // Try the default fallback if we can't find the method.
                        key = item.KeyCmObject.SortKey ?? "";
                        if (sortedFromEnd)
                        {
                            key = StringUtils.ReverseString(key);
                        }

                        key = key + " " + item.KeyCmObject.SortKey2Alpha;
                    }
                }
            }

            return(new string[] { key });
        }
Beispiel #19
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            m_xmlVc      = null;
            m_layoutName = null;
            m_xnSpec     = null;
            m_mdc        = null;
        }
Beispiel #20
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Override this method in your subclass.
        /// It should make a root box and initialize it with appropriate data and
        /// view constructor, etc.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public override void MakeRoot()
        {
            CheckDisposed();

            base.MakeRoot();

            if (m_fdoCache == null || DesignMode)
            {
                return;
            }

            IVwRootBox rootb = VwRootBoxClass.Create();

            rootb.SetSite(this);

            if (m_sda == null)
            {
                m_sda = m_fdoCache.DomainDataByFlid;
            }

            Debug.Assert(m_layoutName != null, "No layout name.");
            IApp app = null;

            if (m_mediator != null && m_mediator.PropertyTable != null)
            {
                app = m_mediator.PropertyTable.GetValue("App") as IApp;
            }
            m_xmlVc            = new XmlVc(StringTbl, m_layoutName, m_fEditable, this, app, m_sda);
            m_xmlVc.Cache      = m_fdoCache;
            m_xmlVc.DataAccess = m_sda;             // let it use the decorator if any.

            rootb.DataAccess = m_sda;
            //if (this.EditingHelper != null)
            //    this.EditingHelper.Editable = m_fEditable;
            m_rootb       = rootb;
            RootObjectHvo = m_hvoRoot;
        }
		/// <summary>
		/// Answer the class of objects for which we are collecting fields.
		/// By default this is the destination class of the field that contains them.
		/// We override this in a subclass for certain virtual and phony properties.
		/// </summary>
		/// <param name="vc"></param>
		/// <returns></returns>
		internal int TargetClass(XmlVc vc)
		{
			return TargetClass(vc.DataAccess);
		}
Beispiel #22
0
		public void StringPropIsMarked()
		{
			using (var view = new XmlView(m_hvoLexDb, "root", null, true, m_sda))
			{
				var vc = new XmlVc(null, "root", true, view, null, m_sda);
				vc.IdentifySource = true;
				vc.SetCache(Cache);
				vc.m_layouts = m_layouts;
				vc.DataAccess = m_sda;
				var testEnv = new MockEnv() {DataAccess = m_sda, OpenObject = m_hvoLexDb};
				vc.Display(testEnv, m_hvoLexDb, XmlVc.kRootFragId);
				VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, "Entry:basic:Headword:HeadwordL");
				VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, 1, ")", "Entry:basic:Headword:HeadwordL");

				VerifyLabel(testEnv.EventHistory, m_hvoKick, kflidEntry_Form, m_wsVern, -3, "head(", "Entry:basic:Headword:HeadwordL");
				VerifySourceIdentified(testEnv.EventHistory, m_hvoKick, kflidEntry_Summary, "Entry:basic:Summary:Sum.");
			}
		}
Beispiel #23
0
 /// <summary>
 /// Answer the class of objects for which we are collecting fields.
 /// By default this is the destination class of the field that contains them.
 /// We override this in a subclass for certain virtual and phony properties.
 /// </summary>
 /// <param name="vc"></param>
 /// <returns></returns>
 internal int TargetClass(XmlVc vc)
 {
     return(TargetClass(vc.DataAccess));
 }
Beispiel #24
0
		public void SenseOutlineIsObtainedUsingVirtual()
		{
			// For this test we need a real entry and sense.
			var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create();
			var sense = Cache.ServiceLocator.GetInstance<ILexSenseFactory>().Create();
			entry.SensesOS.Add(sense);
			var sda = new MockDecorator(Cache);
			var vc = new XmlVc(null, "root", true, null, null, sda);
			vc.SetCache(Cache);
			var sut = new XmlVcDisplayVec(vc, new MockEnv(), entry.Hvo, LexEntryTags.kflidSenses, 1);

			Assert.That(sut.CalculateAndFormatSenseLabel(sense.Hvo, 0, "%O)"), Is.EqualTo("77)"),
				"CalculateAndFormatSenseLabel should have used the decorator method");
			Assert.That(sda.Tag, Is.EqualTo(Cache.MetaDataCacheAccessor.GetFieldId2(LexSenseTags.kClassId, "LexSenseOutline", false)),
				"CalculateAndFormatSenseLabel should have used the right property");
		}
Beispiel #25
0
		/// <summary>
		/// Return an array list of the non-comment children of root,
		/// except that any "generate" elements are replaced with what they generate.
		/// </summary>
		/// <param name="root">The root.</param>
		/// <param name="cache">The FDO cache.</param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">the class of the rootObject used to generate the part</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		static internal List<XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, XmlVc vc, int rootClassId)
		{
			return GetGeneratedChildren(root, cache, null, vc, rootClassId);
		}
Beispiel #26
0
 /// <summary>
 /// Return an array list of the non-comment children of root,
 /// except that any "generate" elements are replaced with what they generate.
 /// </summary>
 /// <param name="root">The root.</param>
 /// <param name="mdc">The MDC.</param>
 /// <param name="vc">for parts/layouts</param>
 /// <param name="rootClassId">the class of the rootObject used to generate the part</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 static internal List <XmlNode> GetGeneratedChildren(XmlNode root, IFwMetaDataCache mdc, XmlVc vc, int rootClassId)
 {
     return(GetGeneratedChildren(root, mdc, null, vc, rootClassId));
 }
Beispiel #27
0
 internal ChildPartGenerator(IFwMetaDataCache mdc, XmlNode input, XmlVc vc, int rootClassId)
     : base(mdc, input, vc, rootClassId)
 {
 }
Beispiel #28
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override this method in your subclass.
		/// It should make a root box and initialize it with appropriate data and
		/// view constructor, etc.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			base.MakeRoot();

			if (m_fdoCache == null || DesignMode)
				return;

			IVwRootBox rootb = VwRootBoxClass.Create();
			rootb.SetSite(this);

			bool fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true);
			string toolName = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);
			m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false);
			//m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach?
			// Note: we want to keep this logic similar to RecordDocView.GetLayoutName(), except that here
			// we do NOT want to use the layoutSuffix, though it may be specified so that it can be
			// used when the configure dialog handles a shared view.
			string sLayout = null;
			string sProp = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null);
			if (!String.IsNullOrEmpty(sProp))
				sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
			if (String.IsNullOrEmpty(sLayout))
				sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout");
			ISilDataAccess sda = GetSda();
			m_xmlVc = new XmlVc(StringTbl, sLayout, fEditable, this, m_app,
				m_fShowFailingItems ? null : ItemDisplayCondition, sda) {IdentifySource = true};
			ReadOnlyView = !fEditable;
			if (!fEditable)
				rootb.MaxParasToScan = 0;
			m_xmlVc.Cache = m_fdoCache;
			m_xmlVc.MainSeqFlid = m_mainFlid;

			rootb.DataAccess = sda;
			m_xmlVc.DataAccess = sda;

			rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet);
			m_rootb = rootb;
		}
Beispiel #29
0
		/// <summary>
		/// Return an array list of the non-comment children of root,
		/// except that any "generate" elements are replaced with what they generate.
		/// </summary>
		/// <param name="root">The root.</param>
		/// <param name="mdc">The MDC.</param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">the class of the rootObject used to generate the part</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		static internal List<XmlNode> GetGeneratedChildren(XmlNode root, IFwMetaDataCache mdc, XmlVc vc, int rootClassId)
		{
			return GetGeneratedChildren(root, mdc, null, vc, rootClassId);
		}
Beispiel #30
0
		internal ChildPartGenerator(IFwMetaDataCache mdc, XmlNode input, XmlVc vc, int rootClassId)
			: base(mdc, input, vc, rootClassId)
		{
		}
Beispiel #31
0
			internal override void PerformDisplay(XmlVc vc, int fragId, int hvo, IVwEnv vwenv)
			{
				int level = vwenv.EmbeddingLevel;
				int hvoDum, tag, ihvo;
				vwenv.GetOuterObject(level - 2, out hvoDum, out tag, out ihvo);
				m_creator.SetupParagraph(m_paraStyle, m_tssBefore, m_listDelimitNode);
				m_creator.AddItemEmbellishments(m_listDelimitNode, m_numberItems, hvo, ihvo, m_xaNum, m_ttpNum, m_delayNumber, ref DelayedNumber);

				// This is the display of the object we wanted to wrap the paragraph etc around.
				// We want to produce an effect rather like
				// vwenv.AddObj(hvo, m_creator.m_viewConstructor, WrappedFragId);
				// except we do NOT want to open/close an object in the VC, since we are already inside the addition of this object.
				m_creator.m_viewConstructor.Display(vwenv, hvo, WrappedFragId);

				// Close Paragraph if displaying paragraphs
				vwenv.CloseParagraph();
			}
Beispiel #32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override this method in your subclass.
		/// It should make a root box and initialize it with appropriate data and
		/// view constructor, etc.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			base.MakeRoot();

			if (m_fdoCache == null || DesignMode)
				return;

			IVwRootBox rootb = VwRootBoxClass.Create();
			rootb.SetSite(this);

			Debug.Assert(m_layoutName != null, "No layout name.");
			m_xmlVc = new XmlVc(StringTbl, m_layoutName, m_fEditable, this);
			m_xmlVc.LoadFlexLayouts = m_fLoadFlexLayouts;	// set before setting Cache.
			m_xmlVc.Cache = m_fdoCache;

			rootb.DataAccess = m_fdoCache.MainCacheAccessor;
			//if (this.EditingHelper != null)
			//    this.EditingHelper.Editable = m_fEditable;
			m_rootb = rootb;
			RootObjectHvo = m_hvoRoot;
		}
Beispiel #33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override this method in your subclass.
		/// It should make a root box and initialize it with appropriate data and
		/// view constructor, etc.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			base.MakeRoot();

			if (m_fdoCache == null || DesignMode)
				return;

			IVwRootBox rootb = VwRootBoxClass.Create();
			rootb.SetSite(this);

			bool fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true);
			string toolName = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);
			m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false);
			//m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach?
			string sLayout = null;
			string sProp = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null);
			if (!String.IsNullOrEmpty(sProp))
				sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
			if (String.IsNullOrEmpty(sLayout))
				sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout");
			m_xmlVc = new XmlVc(StringTbl, sLayout,
				fEditable, this, m_fShowFailingItems ? null : ItemDisplayCondition);
			this.ReadOnlyView = !fEditable;
			if (!fEditable)
				rootb.MaxParasToScan = 0;
			m_xmlVc.Cache = m_fdoCache;
			m_xmlVc.MainSeqFlid = m_mainFlid;

			ISilDataAccess sda = GetSda();
			rootb.DataAccess = sda;
			m_xmlVc.DataAccess = sda;

			rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet);
			m_rootb = rootb;
		}
Beispiel #34
0
		public ExportDialog(Mediator mediator)
		{
			m_mediator = mediator;
			m_cache = (FdoCache)mediator.PropertyTable.GetValue("cache");

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			m_helpTopic = "khtpExportLexicon";

			this.helpProvider = new System.Windows.Forms.HelpProvider();
			this.helpProvider.HelpNamespace = FwApp.App.HelpFile;
			this.helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(m_helpTopic, 0));
			this.helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);

			// Determine whether we can support "configured" type export by trying to obtain
			// the XmlVc for an XmlDocView.  Also obtain the database id and class id of the
			// root object.

			object objCurrentControl;
			objCurrentControl = m_mediator.PropertyTable.GetValue("currentContentControlObject", null);
			//XmlDocView docView = objCurrentControl as XmlDocView;
			//if (docView == null)
			//{
			//    XCore.MultiPane xmp = objCurrentControl as XCore.MultiPane;
			//    if (xmp != null)
			//        docView = xmp.FirstVisibleControl as XmlDocView;
			//}
			XmlDocView docView = FindXmlDocView(objCurrentControl as Control);
			if (docView != null)
				m_seqView = docView.Controls[0] as XmlSeqView;
			if (m_seqView != null)
				m_xvc = m_seqView.Vc;

			CmObject cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null)
				as CmObject;
			if (cmo != null)
			{
				m_hvoRootObj = cmo.OwnerHVO;
				if (m_hvoRootObj != 0)
					m_clidRootObj = m_cache.GetClassOfObject(m_hvoRootObj);
			}

			m_chkExportPictures.Checked = false;
			m_chkExportPictures.Visible = false;
			m_chkExportPictures.Enabled = false;
			m_fExportPicturesAndMedia = false;
		}
Beispiel #35
0
        private void InitFromMainControl(object objCurrentControl)
        {
            XmlDocView docView = FindXmlDocView(objCurrentControl as Control);
            if (docView != null)
                m_seqView = docView.Controls[0] as XmlSeqView;
            if (m_seqView != null)
            {
                m_xvc = m_seqView.Vc;
                m_sda = m_seqView.RootBox.DataAccess;
            }
            var cmo = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject", null) as ICmObject;
            if (cmo != null)
            {
                int clidRoot;
                var newHvoRoot = SetRoot(cmo, out clidRoot);
                if (newHvoRoot > 0)
                {
                    m_hvoRootObj = newHvoRoot;
                    m_clidRootObj = clidRoot;
                }
            }

            XmlBrowseView browseView = FindXmlBrowseView(objCurrentControl as Control);
            if (browseView != null)
                m_sda = browseView.RootBox.DataAccess;
        }
Beispiel #36
0
        private static void StoreChildNodeInfo(XmlNode xn, string className, XmlDocConfigureDlg.LayoutTreeNode ltn, ILayoutConverter converter)
        {
            string  sField   = XmlUtils.GetMandatoryAttributeValue(xn, "field");
            XmlNode xnCaller = converter.LayoutLevels.PartRef;

            if (xnCaller == null)
            {
                xnCaller = ltn.Configuration;
            }
            bool hideConfig = xnCaller == null ? false : XmlUtils.GetOptionalBooleanAttributeValue(xnCaller, "hideConfig", false);

            // Insert any special configuration appropriate for this property...unless the caller is hidden, in which case,
            // we don't want to configure it at all.
            if (!ltn.IsTopLevel && !hideConfig)
            {
                if (sField == "Senses" && (ltn.ClassName == "LexEntry" || ltn.ClassName == "LexSense"))
                {
                    ltn.ShowSenseConfig = true;
                }
                else if (sField == "ReferringSenses" && ltn.ClassName == "ReversalIndexEntry")
                {
                    ltn.ShowSenseConfig = true;
                }
                if (sField == "MorphoSyntaxAnalysis" && ltn.ClassName == "LexSense")
                {
                    ltn.ShowGramInfoConfig = true;
                }
                if (sField == "VisibleComplexFormBackRefs" || sField == "ComplexFormsNotSubentries")
                {
                    //The existence of the attribute is important for this setting, not its value!
                    var sShowAsIndentedPara = XmlUtils.GetAttributeValue(ltn.Configuration, "showasindentedpara");
                    ltn.ShowComplexFormParaConfig = !String.IsNullOrEmpty(sShowAsIndentedPara);
                }
            }
            bool fRecurse = XmlUtils.GetOptionalBooleanAttributeValue(ltn.Configuration, "recurseConfig", true);

            if (!fRecurse)
            {
                // We don't want to recurse forever just because senses have subsenses, which
                // can have subsenses, which can ...
                // Or because entries have subentries (in root type layouts)...
                ltn.UseParentConfig = true;
                return;
            }
            var    sLayout        = XmlVc.GetLayoutName(xn, xnCaller);
            var    clidDst        = 0;
            string sClass         = null;
            string sTargetClasses = null;

            try
            {
                // Failure should be fairly unusual, but, for example, part MoForm-Jt-FormEnvPub attempts to display
                // the property PhoneEnv inside an if that checks that the MoForm is one of the subclasses that has
                // the PhoneEnv property. MoForm itself does not.
                if (!((IFwMetaDataCacheManaged)converter.Cache.DomainDataByFlid.MetaDataCache).FieldExists(className, sField, true))
                {
                    return;
                }
                var flid = converter.Cache.DomainDataByFlid.MetaDataCache.GetFieldId(className, sField, true);
                var type = (CellarPropertyType)converter.Cache.DomainDataByFlid.MetaDataCache.GetFieldType(flid);
                Debug.Assert(type >= CellarPropertyType.MinObj);
                if (type >= CellarPropertyType.MinObj)
                {
                    var mdc = converter.Cache.MetaDataCacheAccessor;
                    sTargetClasses = XmlUtils.GetOptionalAttributeValue(xn, "targetclasses");
                    clidDst        = mdc.GetDstClsId(flid);
                    if (clidDst == 0)
                    {
                        sClass = XmlUtils.GetOptionalAttributeValue(xn, "targetclass");
                    }
                    else
                    {
                        sClass = mdc.GetClassName(clidDst);
                    }
                    if (clidDst == StParaTags.kClassId)
                    {
                        string sClassT = XmlUtils.GetOptionalAttributeValue(xn, "targetclass");
                        if (!String.IsNullOrEmpty(sClassT))
                        {
                            sClass = sClassT;
                        }
                    }
                }
            }
            catch
            {
                return;
            }
            if (clidDst == MoFormTags.kClassId && !sLayout.StartsWith("publi"))
            {
                return;                 // ignore the layouts used by the LexEntry-Jt-Headword part.
            }
            if (String.IsNullOrEmpty(sLayout) || String.IsNullOrEmpty(sClass))
            {
                return;
            }
            if (sTargetClasses == null)
            {
                sTargetClasses = sClass;
            }
            string[] rgsClasses = sTargetClasses.Split(new[] { ',', ' ' },
                                                       StringSplitOptions.RemoveEmptyEntries);
            XmlNode subLayout = null;

            if (rgsClasses.Length > 0)
            {
                subLayout = converter.GetLayoutElement(rgsClasses[0], sLayout);
            }

            if (subLayout != null)
            {
                int iStart = ltn.Nodes.Count;
                int cNodes = subLayout.ChildNodes.Count;
                AddChildNodes(subLayout, ltn, iStart, converter);

                bool fRepeatedConfig = XmlUtils.GetOptionalBooleanAttributeValue(xn, "repeatedConfig", false);
                if (fRepeatedConfig)
                {
                    return;                             // repeats an earlier part element (probably as a result of <if>s)
                }
                for (int i = 1; i < rgsClasses.Length; i++)
                {
                    XmlNode mergedLayout = converter.GetLayoutElement(rgsClasses[i], sLayout);
                    if (mergedLayout != null && mergedLayout.ChildNodes.Count == cNodes)
                    {
                        AddChildNodes(mergedLayout, ltn, iStart, converter);
                    }
                }
            }
            else
            {
                // The "layout" in a part node can actually refer directly to another part, so check
                // for that possibility.
                var subPart = converter.GetPartElement(rgsClasses[0], sLayout) ?? converter.GetPartElement(className, sLayout);
                if (subPart == null && !sLayout.EndsWith("-en"))
                {
                    // Complain if we can't find either a layout or a part, and the name isn't tagged
                    // for a writing system.  (We check only for English, being lazy.)
                    var msg = String.Format("Missing jtview layout for class=\"{0}\" name=\"{1}\"",
                                            rgsClasses[0], sLayout);
                    converter.LogConversionError(msg);
                }
            }
        }
Beispiel #37
0
        /// <summary>
        /// Gets the sort key by traversing the part tree, calling the sort method at the leaves.
        /// </summary>
        /// <param name="layout">The layout.</param>
        /// <param name="cmo">The object.</param>
        /// <param name="item">The item.</param>
        /// <param name="pathIndex">Index of the path.</param>
        /// <param name="sortedFromEnd">if set to <c>true</c> [sorted from end].</param>
        /// <returns></returns>
        private string[] GetKey(XmlNode layout, ICmObject cmo, IManyOnePathSortItem item, int pathIndex, bool sortedFromEnd)
        {
            if (layout == null)
            {
                return(null);
            }

            switch (layout.Name)
            {
            case "obj":
            {
                int flid = GetFlid(layout, cmo.Hvo);
                if (pathIndex != -1 && (pathIndex == item.PathLength || flid != item.PathFlid(pathIndex)))
                {
                    // we are now off of the path
                    pathIndex = -1;
                }

                int objHvo = m_cache.MainCacheAccessor.get_ObjectProp(cmo.Hvo, flid);
                if (objHvo != 0)
                {
                    if (pathIndex != -1 &&
                        (pathIndex < item.PathLength - 1 && objHvo == item.PathObject(pathIndex + 1)) ||
                        (pathIndex == item.PathLength - 1 && objHvo == item.KeyObject))
                    {
                        return(GetChildObjKey(layout, objHvo, item, pathIndex + 1, sortedFromEnd));
                    }

                    // we are off of the path
                    return(GetChildObjKey(layout, objHvo, item, -1, sortedFromEnd));
                }
            }
            break;

            case "seq":
            {
                int flid = GetFlid(layout, cmo.Hvo);
                if (pathIndex != -1 && (pathIndex == item.PathLength || flid != item.PathFlid(pathIndex)))
                {
                    // we are now off of the path
                    pathIndex = -1;
                }

                int           size = m_cache.MainCacheAccessor.get_VecSize(cmo.Hvo, flid);
                StringBuilder sb   = null;
                for (int i = 0; i < size; i++)
                {
                    int objHvo = m_cache.MainCacheAccessor.get_VecItem(cmo.Hvo, flid, i);
                    if (pathIndex != -1 &&
                        (pathIndex < item.PathLength - 1 && objHvo == item.PathObject(pathIndex + 1)) ||
                        (pathIndex == item.PathLength - 1 && objHvo == item.KeyObject))
                    {
                        return(GetChildObjKey(layout, objHvo, item, pathIndex + 1, sortedFromEnd));
                    }

                    // if we are off of the path, we concatenate all vector keys to create an
                    // aggregate key
                    var childObjKey = GetChildObjKey(layout, objHvo, item, -1, sortedFromEnd);
                    if (childObjKey != null)
                    {
                        if (sb == null)
                        {
                            sb = new StringBuilder();
                        }
                        foreach (var subKey in childObjKey)
                        {
                            sb.Append(subKey);
                        }
                    }
                }
                if (sb != null)
                {
                    return new [] { sb.ToString() }
                }
                ;
            }
            break;

            case "layout":
            case "part":
            {
                string partref = XmlUtils.GetOptionalAttributeValue(layout, "ref");
                if (partref != null)
                {
                    XmlNode part = XmlVc.GetNodeForPart(cmo.Hvo, partref, true, m_sda, m_layouts);

                    return(GetKey(part, cmo, item, pathIndex, sortedFromEnd));
                }

                foreach (XmlNode child in layout.ChildNodes)
                {
                    if (child is XmlComment)
                    {
                        continue;
                    }

                    var key = GetKey(child, cmo, item, pathIndex, sortedFromEnd);
                    if (key != null)
                    {
                        return(key);
                    }
                }
            }
            break;
            }
            return(null);
        }
Beispiel #38
0
 /// <summary>
 /// Return an array list of the non-comment children of root,
 /// except that any "generate" elements are replaced with what they generate.
 /// </summary>
 /// <param name="root">The root.</param>
 /// <param name="cache">The FDO cache.</param>
 /// <param name="vc">for parts/layouts</param>
 /// <param name="rootClassId">the class of the rootObject used to generate the part</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 static internal List <XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, XmlVc vc, int rootClassId)
 {
     return(GetGeneratedChildren(root, cache, null, vc, rootClassId));
 }
Beispiel #39
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override this method in your subclass.
		/// It should make a root box and initialize it with appropriate data and
		/// view constructor, etc.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void MakeRoot()
		{
			CheckDisposed();

			base.MakeRoot();

			if (m_fdoCache == null || DesignMode)
				return;

			IVwRootBox rootb = VwRootBoxClass.Create();
			rootb.SetSite(this);

			if (m_sda == null)
				m_sda = m_fdoCache.DomainDataByFlid;

			Debug.Assert(m_layoutName != null, "No layout name.");
			IApp app = null;
			if (m_mediator != null && m_mediator.PropertyTable != null)
				app = m_mediator.PropertyTable.GetValue("App") as IApp;
			m_xmlVc = new XmlVc(StringTbl, m_layoutName, m_fEditable, this, app, m_sda);
			m_xmlVc.Cache = m_fdoCache;
			m_xmlVc.DataAccess = m_sda; // let it use the decorator if any.

			rootb.DataAccess = m_sda;
			//if (this.EditingHelper != null)
			//    this.EditingHelper.Editable = m_fEditable;
			m_rootb = rootb;
			RootObjectHvo = m_hvoRoot;
		}
Beispiel #40
0
 internal ChildPartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
     : base(cache, input, vc, rootClassId)
 {
 }
Beispiel #41
0
		/// <summary>
		///
		/// </summary>
		/// <param name="root"></param>
		/// <param name="cache"></param>
		/// <param name="keyAttrNames"></param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">class of the root object used to compute parts/layouts</param>
		/// <returns></returns>
		static private List<XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, string[] keyAttrNames,
			XmlVc vc, int rootClassId)
		{
			List<XmlNode> result = new List<XmlNode>();
			string generateModeForColumns = XmlUtils.GetOptionalAttributeValue(root, "generate");
			bool m_fGenerateChildPartsForParentLayouts = (generateModeForColumns == "childPartsForParentLayouts");

			// childPartsForParentLayouts
			foreach(XmlNode child in root.ChildNodes)
			{
				if (child is XmlComment)
					continue;
				if (m_fGenerateChildPartsForParentLayouts)
				{
					ChildPartGenerator cpg = new ChildPartGenerator(cache, child, vc, rootClassId);
					cpg.GenerateChildPartsIfNeeded();
				}
				if (child.Name != "generate")
				{
					result.Add(child);
					continue;
				}

				PartGenerator generator;
				if (generateModeForColumns == "objectValuePartsForParentLayouts")
					generator = new ObjectValuePartGenerator(cache, child, vc, rootClassId);
				else
					generator = new PartGenerator(cache, child, vc, rootClassId);
				foreach (XmlNode genNode in generator.Generate())
				{
					bool match = false;
					if (keyAttrNames != null)
					{
						foreach (XmlNode matchNode in root.ChildNodes)
						{
							if (MatchNodes(matchNode, genNode, keyAttrNames))
							{
								match = true;
								break;
							}
						}
					}
					if (!match) // not already present, or not checking; add it.
						result.Add(genNode);
				}
			}
			return result;
		}
Beispiel #42
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			base.Dispose(disposing);

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
				if (m_xmlVc != null)
					m_xmlVc.Dispose();
			}
			m_xmlVc = null;
			m_stringTable = null;
			m_mdc = null;
			m_sXmlSpec = null;
			m_docSpec = null;
			m_xnSpec = null;
		}
Beispiel #43
0
		internal ChildPartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
			: base(cache, input, vc, rootClassId)
		{
		}
Beispiel #44
0
 private void view_Display(object sender, VwEnvEventArgs e)
 {
     XmlVc.ProcessProperties(this.ConfigurationNode, e.Environment);
 }
Beispiel #45
0
		public ObjectValuePartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
			: base(cache, input, vc, rootClassId)
		{
			m_objectPath = XmlUtils.GetAttributeValue(input, "objectPath");
			if (m_objectPath == null)
				throw new ArgumentException("ObjectValuePartGenerator expects input to have objectPath attribute.");
			// Enhance: generalize this
			if (m_objectPath == "PhFeatureSystem.Features")
			{
				m_collectionToGeneratePartsFrom = cache.LangProject.PhFeatureSystemOA.FeaturesOC;
				m_sortedCollection = from s in m_collectionToGeneratePartsFrom
								 orderby s.Abbreviation.BestAnalysisAlternative.Text
								 select s;
			}
		}