示例#1
0
        public FtMetaField New(int dataType)
        {
            FtMetaField result = FieldFactory.CreateMetaField(dataType, HeadingCount);

            Add(result);
            return(result);
        }
示例#2
0
        protected internal override FtMetaField CreateCopy()
        {
            FtMetaField field = FieldFactory.CreateMetaField(DataType, HeadingCount);

            field.Assign(this);
            return(field);
        }
示例#3
0
 protected internal virtual void Assign(FtMetaField source)
 {
     Id       = source.Id;
     Name     = source.Name;
     headings = new string[source.HeadingCount];
     Array.Copy(source.Headings, headings, source.HeadingCount);
     FixedWidth      = source.FixedWidth;
     Width           = source.Width;
     Constant        = source.Constant;
     Null            = source.Null;
     ValueQuotedType = source.ValueQuotedType;
     ValueAlwaysWriteOptionalQuote = source.ValueAlwaysWriteOptionalQuote;
     ValueWritePrefixSpace         = source.ValueWritePrefixSpace;
     ValuePadAlignment             = source.ValuePadAlignment;
     ValuePadCharType                = source.ValuePadCharType;
     ValuePadChar                    = source.ValuePadChar;
     ValueTruncateType               = source.ValueTruncateType;
     ValueTruncateChar               = source.ValueTruncateChar;
     ValueEndOfValueChar             = source.ValueEndOfValueChar;
     ValueNullChar                   = source.ValueNullChar;
     HeadingConstraint               = source.HeadingConstraint;
     HeadingQuotedType               = source.HeadingQuotedType;
     HeadingAlwaysWriteOptionalQuote = source.HeadingAlwaysWriteOptionalQuote;
     HeadingWritePrefixSpace         = source.HeadingWritePrefixSpace;
     HeadingPadAlignment             = source.HeadingPadAlignment;
     HeadingPadCharType              = source.HeadingPadCharType;
     HeadingPadChar                  = source.HeadingPadChar;
     HeadingTruncateType             = source.HeadingTruncateType;
     HeadingTruncateChar             = source.HeadingTruncateChar;
     HeadingEndOfValueChar           = source.HeadingEndOfValueChar;
 }
示例#4
0
 public void RemoveField(FtMetaField field)
 {
     foreach (FtMetaSequence sequence in list)
     {
         sequence.RemoveItemsWithField(field);
     }
 }
示例#5
0
        internal protected override void LoadMeta(FtMetaField metaField, CultureInfo myCulture, int myMainHeadingIndex)
        {
            base.LoadMeta(metaField, myCulture, myMainHeadingIndex);

            FtFloatMetaField floatMetaField = metaField as FtFloatMetaField;

            formatter.Format = floatMetaField.Format;
            formatter.Styles = floatMetaField.Styles;
        }
示例#6
0
        public void Remove(FtMetaField field)
        {
            int idx = list.IndexOf(field);

            if (idx >= 0)
            {
                RemoveAt(idx);
            }
        }
示例#7
0
        protected internal override void Assign(FtMetaField source)
        {
            base.Assign(source);

            FtFloatMetaField typedSource = source as FtFloatMetaField;

            Format = typedSource.Format;
            Styles = typedSource.Styles;
        }
示例#8
0
        protected internal override void Assign(FtMetaField source)
        {
            base.Assign(source);

            FtBooleanMetaField typedSource = source as FtBooleanMetaField;

            FalseText = typedSource.FalseText;
            TrueText  = typedSource.TrueText;
            Styles    = typedSource.Styles;
        }
示例#9
0
        internal protected override void LoadMeta(FtMetaField metaField, CultureInfo myCulture, int myMainHeadingIndex)
        {
            base.LoadMeta(metaField, myCulture, myMainHeadingIndex);

            FtDateTimeMetaField dateTimeMetaField = metaField as FtDateTimeMetaField;

            formatter.Format = dateTimeMetaField.Format;
            formatter.Styles = dateTimeMetaField.Styles;
            constantValue    = dateTimeMetaField.Value;
        }
示例#10
0
        internal protected override void LoadMeta(FtMetaField metaField, CultureInfo myCulture, int myMainHeadingIndex)
        {
            base.LoadMeta(metaField, myCulture, myMainHeadingIndex);

            if (metaField.Constant && !metaField.Null)
            {
                FtGenericMetaField <T> genericMetaField = metaField as FtGenericMetaField <T>;
                value = genericMetaField.Value;
            }
        }
示例#11
0
 public void RemoveItemsWithField(FtMetaField field)
 {
     for (int i = itemList.Count - 1; i >= 0; i--)
     {
         if (itemList[i].Field == field)
         {
             itemList.RemoveAt(i);
         }
     }
 }
示例#12
0
        internal protected override void LoadMeta(FtMetaField metaField, CultureInfo myCulture, int myMainHeadingIndex)
        {
            base.LoadMeta(metaField, myCulture, myMainHeadingIndex);

            FtBooleanMetaField booleanMetaField = metaField as FtBooleanMetaField;

            formatter.FalseText = booleanMetaField.FalseText;
            formatter.TrueText  = booleanMetaField.TrueText;
            formatter.Styles    = booleanMetaField.Styles;
        }
示例#13
0
        public void Assign(FtMetaFieldList source)
        {
            list.Clear();
            list.Capacity = source.Count;

            for (int i = 0; i < source.Count; i++)
            {
                FtMetaField field = source[i].CreateCopy();
                Add(field);
            }
        }
示例#14
0
 private void UnbindFieldEvents(FtMetaField field)
 {
     field.DefaultHeadingConstraintRequiredEvent -= HandleDefaultHeadingConstraintRequiredEvent;
     field.DefaultHeadingQuotedTypeRequiredEvent -= HandleDefaultHeadingQuotedTypeRequiredEvent;
     field.DefaultHeadingAlwaysWriteOptionalQuoteRequiredEvent -= HandleDefaultHeadingAlwaysWriteOptionalQuoteRequiredEvent;
     field.DefaultHeadingWritePrefixSpaceRequiredEvent         -= HandleDefaultHeadingWritePrefixSpaceRequiredEvent;
     field.DefaultHeadingPadAlignmentRequiredEvent             -= HandleDefaultHeadingPadAlignmentRequiredEvent;
     field.DefaultHeadingPadCharTypeRequiredEvent    -= HandleDefaultHeadingPadCharTypeRequiredEvent;
     field.DefaultHeadingPadCharRequiredEvent        -= HandleDefaultHeadingPadCharRequiredEvent;
     field.DefaultHeadingTruncateTypeRequiredEvent   -= HandleDefaultHeadingTruncateTypeRequiredEvent;
     field.DefaultHeadingTruncateCharRequiredEvent   -= HandleDefaultHeadingTruncateCharRequiredEvent;
     field.DefaultHeadingEndOfValueCharRequiredEvent -= HandleDefaultHeadingEndOfValueCharRequiredEvent;
 }
示例#15
0
 public void MoveItemToBefore(int fromIdx, int beforeIdx)
 {
     if ((beforeIdx != fromIdx) && (beforeIdx != (fromIdx + 1)))
     {
         FtMetaField field = list[fromIdx];
         list.RemoveAt(fromIdx);
         int insertIdx;
         if (beforeIdx < fromIdx)
         {
             insertIdx = beforeIdx;
         }
         else
         {
             insertIdx = --beforeIdx;
         }
         list.Insert(insertIdx, field);
     }
 }
示例#16
0
 public void MoveItemToAfter(int fromIdx, int afterIdx)
 {
     if ((afterIdx != fromIdx) && (afterIdx != (fromIdx - 1)))
     {
         FtMetaField field = list[fromIdx];
         list.RemoveAt(fromIdx);
         int insertIdx;
         if (afterIdx > fromIdx)
         {
             insertIdx = afterIdx;
         }
         else
         {
             insertIdx = ++afterIdx;
         }
         list.Insert(insertIdx, field);
     }
 }
示例#17
0
 public void Add(FtMetaField field)
 {
     list.Add(field);
     field.HeadingCount = headingCount;
     BindFieldEvents(field);
 }
示例#18
0
        internal protected virtual void LoadMeta(FtMetaField metaField, CultureInfo myCulture, int myMainHeadingIndex)
        {
            dataType         = metaField.DataType;
            id               = metaField.Id;
            metaName         = metaField.Name;
            metaHeadings     = metaField.Headings;
            mainHeadingIndex = myMainHeadingIndex;
            culture          = myCulture;
            fixedWidth       = metaField.FixedWidth;
            width            = metaField.Width;
            constant         = metaField.Constant;
            _null            = metaField.Null;
            valueQuotedType  = metaField.ValueQuotedType;
            valueAlwaysWriteOptionalQuote = metaField.ValueAlwaysWriteOptionalQuote;
            valueWritePrefixSpace         = metaField.ValueWritePrefixSpace;
            valuePadAlignment             = metaField.ValuePadAlignment;
            valuePadCharType                = metaField.ValuePadCharType;
            valuePadChar                    = metaField.ValuePadChar;
            valueTruncateType               = metaField.ValueTruncateType;
            valueTruncateChar               = metaField.ValueTruncateChar;
            valueEndOfValueChar             = metaField.ValueEndOfValueChar;
            valueNullChar                   = metaField.ValueNullChar;
            headingConstraint               = metaField.HeadingConstraint;
            headingQuotedType               = metaField.HeadingQuotedType;
            headingAlwaysWriteOptionalQuote = metaField.HeadingAlwaysWriteOptionalQuote;
            headingWritePrefixSpace         = metaField.HeadingWritePrefixSpace;
            headingPadAlignment             = metaField.HeadingPadAlignment;
            headingPadCharType              = metaField.HeadingPadCharType;
            headingPadChar                  = metaField.HeadingPadChar;
            headingTruncateType             = metaField.HeadingTruncateType;
            headingTruncateChar             = metaField.HeadingTruncateChar;
            headingEndOfValueChar           = metaField.HeadingEndOfValueChar;

            formatter.Culture = culture;

            if (
                ((headingConstraint == FtHeadingConstraint.NameIsMain) || (headingConstraint == FtHeadingConstraint.NameConstant))
                &&
                (mainHeadingIndex >= 0)
                &&
                (mainHeadingIndex < MetaHeadingCount)
                )
            {
                metaHeadings[mainHeadingIndex] = metaName;
            }

            switch (headingPadAlignment)
            {
            case FtPadAlignment.Left:
                headingLeftPad = true;
                break;

            case FtPadAlignment.Right:
                headingLeftPad = false;
                break;

            case FtPadAlignment.Auto:
                headingLeftPad = autoLeftPad;
                break;

            default: throw FtInternalException.Create(InternalError.FtFieldFieldDefinition_LoadMeta_UnsupportedHeadingPadAlignment, headingPadAlignment.ToString());
            }

            switch (valuePadAlignment)
            {
            case FtPadAlignment.Left:
                valueLeftPad = true;
                break;

            case FtPadAlignment.Right:
                valueLeftPad = false;
                break;

            case FtPadAlignment.Auto:
                valueLeftPad = autoLeftPad;
                break;

            default: throw FtInternalException.Create(InternalError.FtFieldFieldDefinition_LoadMeta_UnsupportedValuePadAlignment, headingPadAlignment.ToString());
            }

            if (fixedWidth)
            {
                fixedWidthNullValueText = new string(ValueNullChar, Width);
            }
        }
示例#19
0
 public int IndexOf(FtMetaField field)
 {
     return(list.IndexOf(field));
 }