Пример #1
0
        /// <summary>
        /// Generate the nodes that the constructor arguments indicate.
        /// </summary>
        /// <returns></returns>
        public virtual XmlNode[] Generate()
        {
            List <int> ids    = FieldIds;
            var        result = new XmlNode[ids.Count];

            for (int iresult = 0; iresult < result.Length; iresult++)
            {
                XmlNode output = m_source.Clone();
                result[iresult] = output;
                int    fieldId   = ids[iresult];
                string labelName = m_mdc.GetFieldLabel(fieldId);
                string fieldName = m_mdc.GetFieldName(fieldId);
                string className = m_mdc.GetOwnClsName(fieldId);
                if (string.IsNullOrEmpty(labelName))
                {
                    labelName = fieldName;
                }
                // generate parts for any given custom layout
                GeneratePartsFromLayouts(m_rootClassId, fieldName, fieldId, ref output);
                ReplaceParamsInAttributes(output, labelName, fieldName, fieldId, className);
                // LT-6956 : custom fields have the additional attribute "originalLabel", so add it here.
                XmlUtils.AppendAttribute(output, "originalLabel", labelName);
            }
            return(result);
        }
Пример #2
0
        private string GetFancyFieldName(int flid, IFwMetaDataCache mdc)
        {
            string f = mdc.GetFieldName(flid);
            string c = mdc.GetOwnClsName(flid);

            return(c + '_' + f);
        }
Пример #3
0
		private string GetFancyFieldName(int flid, IFwMetaDataCache mdc)
		{
			string f = mdc.GetFieldName(flid);
			string c = mdc.GetOwnClsName(flid);
			return c + '_' + f;
		}
Пример #4
0
        private void m_tvClasses_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            m_lvfields.Items.Clear();
            uint clid            = (uint)m_tvClasses.SelectedNode.Tag;
            int  countFoundFlids = m_mdc.GetFields(clid, true, (int)CellarModuleDefns.kgrfcptAll,
                                                   0, null);
            int allFlidCount = countFoundFlids;

            uint[] uIds;
            using (ArrayPtr flids = MarshalEx.ArrayToNative(allFlidCount, typeof(uint)))
            {
                countFoundFlids = m_mdc.GetFields(clid, true, (int)CellarModuleDefns.kgrfcptAll,
                                                  allFlidCount, flids);
                uIds = (uint[])MarshalEx.NativeToArray(flids, allFlidCount, typeof(uint));
            }
            m_lvfields.SuspendLayout();
            List <ListViewItem> list = new List <ListViewItem>();

            for (int i = uIds.Length - 1; i >= 0; --i)
            {
                uint flid = uIds[i];
                if (flid == 0)
                {
                    continue;                     // Keep looking for suitable flids lower in the array.
                }
                string       className = m_mdc.GetOwnClsName(flid);
                ListViewItem lvi       = new ListViewItem(className);           //m_lvfields.Items.Add(className);
                list.Add(lvi);
                // flid
                lvi.SubItems.Add(flid.ToString());
                // field name
                string fieldname = m_mdc.GetFieldName(flid);
                lvi.SubItems.Add(fieldname);
                int    flidType  = m_mdc.GetFieldType(flid);
                string type      = "Not recognized";
                string signature = "Not recognized";
                uint   dstClid;
                switch (flidType)
                {
                // Basic data types.
                case (int)CellarModuleDefns.kcptBoolean:
                    type      = "Basic";
                    signature = "Boolean";
                    break;

                case (int)CellarModuleDefns.kcptInteger:
                    type      = "Basic";
                    signature = "Integer";
                    break;

                case (int)CellarModuleDefns.kcptNumeric:
                    type      = "Basic";
                    signature = "Numeric";
                    break;

                case (int)CellarModuleDefns.kcptFloat:
                    type      = "Basic";
                    signature = "Float";
                    break;

                case (int)CellarModuleDefns.kcptTime:
                    type      = "Basic";
                    signature = "Time";
                    break;

                case (int)CellarModuleDefns.kcptGuid:
                    type      = "Basic";
                    signature = "Guid";
                    break;

                case (int)CellarModuleDefns.kcptImage:
                    type      = "Basic";
                    signature = "Image";
                    break;

                case (int)CellarModuleDefns.kcptGenDate:
                    type      = "Basic";
                    signature = "GenDate";
                    break;

                case (int)CellarModuleDefns.kcptBinary:
                    type      = "Basic";
                    signature = "Binary";
                    break;

                case (int)CellarModuleDefns.kcptString:
                    type      = "Basic";
                    signature = "String";
                    break;

                case (int)CellarModuleDefns.kcptBigString:
                    type      = "Basic";
                    signature = "String (big)";
                    break;

                case (int)CellarModuleDefns.kcptMultiString:
                    type      = "Basic";
                    signature = "MultiString";
                    break;

                case (int)CellarModuleDefns.kcptMultiBigString:
                    type      = "Basic";
                    signature = "MultiString (big)";
                    break;

                case (int)CellarModuleDefns.kcptUnicode:
                    type      = "Basic";
                    signature = "Unicode";
                    break;

                case (int)CellarModuleDefns.kcptBigUnicode:
                    type      = "Basic";
                    signature = "Unicode (big)";
                    break;

                case (int)CellarModuleDefns.kcptMultiUnicode:
                    type      = "Basic";
                    signature = "MultiUnicode";
                    break;

                case (int)CellarModuleDefns.kcptMultiBigUnicode:
                    type      = "Basic";
                    signature = "MultiUnicode (big)";
                    break;

                // CmObjects.
                case (int)CellarModuleDefns.kcptOwningAtom:
                    type      = "OA";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;

                case (int)CellarModuleDefns.kcptReferenceAtom:
                    type      = "RA";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;

                case (int)CellarModuleDefns.kcptOwningCollection:
                    type      = "OC";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;

                case (int)CellarModuleDefns.kcptReferenceCollection:
                    type      = "RC";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;

                case (int)CellarModuleDefns.kcptOwningSequence:
                    type      = "OS";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;

                case (int)CellarModuleDefns.kcptReferenceSequence:
                    type      = "RS";
                    dstClid   = m_mdc.GetDstClsId(flid);
                    signature = m_mdc.GetClassName(dstClid);
                    break;
                }
                // Type
                lvi.SubItems.Add(type);
                // Signature
                lvi.SubItems.Add(signature);
            }
            m_lvfields.Items.AddRange(list.ToArray());
            m_lvfields.ResumeLayout(true);
        }
Пример #5
0
		private string ViewNameForFlid(int flid, IFwMetaDataCache mdc)
		{
			string sField = mdc.GetFieldName((uint)flid);
			string sClass = mdc.GetOwnClsName((uint)flid);
			return sClass + "_" + sField;
		}