/// <summary> /// Initializes a new instance of the <see cref="UPCombinedResultField"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="position"> /// The position. /// </param> public UPCombinedResultField(FieldControl fieldControl, int position) { var first = true; var count = fieldControl?.NumberOfFields ?? 0; List <int> fieldArray = null; for (var i = 0; i < count; i++) { var field = fieldControl?.FieldAtIndex(i); if (field?.TargetFieldNumber != position) { continue; } if (first) { first = false; this.FirstField = field; this.Attributes = field.Attributes; } if (fieldArray == null) { fieldArray = new List <int>(); } fieldArray.Add(field.TabIndependentFieldIndex); } this.FieldIndices = fieldArray; }
/// <summary> /// Initializes a new instance of the <see cref="FieldControlTab"/> class. /// </summary> /// <param name="source"> /// The source. /// </param> /// <param name="offset"> /// The offset. /// </param> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="rootLinkId"> /// The root link identifier. /// </param> public FieldControlTab(FieldControlTab source, int offset, FieldControl fieldControl, int rootLinkId) { this.FieldControl = fieldControl; this.Label = source?.Label; this.Type = source?.Type; var count = source?.NumberOfFields ?? 0; if (count > 0) { this.AllFields = new List <UPConfigFieldControlField>(count); for (var i = 0; i < count; i++) { this.AllFields.Add( new UPConfigFieldControlField( source.FieldAtIndex(i), offset + i, this, fieldControl.InfoAreaId, rootLinkId)); } } this.attributes = source?.AttributeArray; this.attributeDictionary = source?.AttributeDictionary; }
/// <summary> /// Initializes a new instance of the <see cref="FieldControlTab"/> class. /// </summary> /// <param name="definition"> /// The definition. /// </param> /// <param name="offset"> /// The offset. /// </param> /// <param name="fieldControl"> /// The field control. /// </param> public FieldControlTab(List <object> definition, int offset, FieldControl fieldControl) { this.FieldControl = fieldControl; this.Label = (string)definition[0]; this.Type = (string)definition[1]; var fielddefs = (definition[2] as JArray)?.ToObject <List <object> >(); if (fielddefs == null) { this.AllFields = null; } else { var count = fielddefs.Count; this.AllFields = new List <UPConfigFieldControlField>(count); for (var i = 0; i < count; i++) { var def = (fielddefs[i] as JArray)?.ToObject <List <object> >(); if (def == null) { continue; } this.AllFields.Add(new UPConfigFieldControlField(def, offset + i, this)); } } this.FieldOffset = offset; if (definition.Count > 3) { var attributeDefs = definition[3] as List <List <object> >; if (attributeDefs != null && attributeDefs.Count > 0) { var attributes = new List <object>(attributeDefs.Count); var attributeDictionary = new Dictionary <string, List <ConfigFieldControlTabAttribute> >(attributeDefs.Count); foreach (var attributeDef in attributeDefs) { var attribute = new ConfigFieldControlTabAttribute(attributeDef); attributes.Add(attribute); var arrayForKey = attributeDictionary[attribute.Key]; if (arrayForKey != null) { arrayForKey.Add(attribute); attributeDictionary[attribute.Key] = arrayForKey; } else { attributeDictionary[attribute.Key] = new List <ConfigFieldControlTabAttribute> { attribute }; } } this.attributeDictionary = attributeDictionary; this.attributes = attributes; } } }
/// <summary> /// Initializes a new instance of the <see cref="SearchAndList"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> public SearchAndList(FieldControl fieldControl) { this.UnitName = fieldControl.FieldGroupName; this.InfoAreaId = fieldControl.InfoAreaId; this.FieldGroupName = fieldControl.FieldGroupName; this.HeaderGroupName = fieldControl.InfoAreaId; this.MenuLabel = string.Empty; this.DefaultAction = string.Empty; this.FilterName = string.Empty; }
/// <summary> /// Initializes a new instance of the <see cref="FieldControl"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="mode"> /// The mode. /// </param> public FieldControl(FieldControl fieldControl, FieldDetailsMode mode) { this.UnitName = fieldControl.UnitName; this.InfoAreaId = fieldControl.InfoAreaId; this.ControlName = fieldControl.ControlName; var _tabArray = new List <FieldControlTab>(fieldControl.NumberOfTabs); _tabArray.AddRange(fieldControl.Tabs.Select(tab => new FieldControlTab(tab, (int)mode, this))); this.Tabs = _tabArray; this.sortFields = fieldControl.SortFields(); this.Attributes = fieldControl.Attributes; }
/// <summary> /// Initializes a new instance of the <see cref="FieldControl"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="sortConfiguration"> /// The sort configuration. /// </param> public FieldControl(FieldControl fieldControl, FieldControl sortConfiguration) { this.UnitName = "CombinedWithSort"; this.InfoAreaId = fieldControl.InfoAreaId; this.ControlName = fieldControl.ControlName; this.Tabs = new List <FieldControlTab>(fieldControl.Tabs); this.sortFields = new List <FieldControlSortField>(sortConfiguration.SortFields()); if (fieldControl?.Attributes != null) { this.Attributes = new Dictionary <string, string>(fieldControl.Attributes); } else { this.Attributes = new Dictionary <string, string>(); } }
/// <summary> /// Initializes a new instance of the <see cref="FieldControlTab"/> class. /// </summary> /// <param name="source"> /// The source. /// </param> /// <param name="mode"> /// The mode. /// </param> /// <param name="fieldControl"> /// The field control. /// </param> public FieldControlTab(FieldControlTab source, int mode, FieldControl fieldControl) { this.FieldControl = fieldControl; this.Label = source?.Label; this.Type = source?.Type; if (source != null && source.NumberOfFields > 0) { var fieldArray = new List <UPConfigFieldControlField>(source.NumberOfFields); fieldArray.AddRange(source.Fields.Select(field => new UPConfigFieldControlField(field, mode, this))); this.AllFields = fieldArray; } else { this.AllFields = new List <UPConfigFieldControlField>(); } }
/// <summary> /// Initializes a new instance of the <see cref="FieldControl"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="tabNr"> /// The tab nr. /// </param> /// <param name="infoAreaId"> /// The information area identifier. /// </param> /// <param name="rootLinkId"> /// The root link identifier. /// </param> public FieldControl(FieldControl fieldControl, int tabNr, string infoAreaId, int rootLinkId) { this.UnitName = fieldControl.UnitName; this.InfoAreaId = string.IsNullOrWhiteSpace(infoAreaId) ? fieldControl.InfoAreaId : infoAreaId; this.ControlName = fieldControl.ControlName; this.Tabs = new List <FieldControlTab> { new FieldControlTab( fieldControl.TabAtIndex(tabNr), 0, this, rootLinkId) }; this.sortFields = fieldControl.SortFields(); this.Attributes = fieldControl.Attributes; }
/// <summary> /// Initializes a new instance of the <see cref="FieldControl"/> class. /// </summary> /// <param name="fieldControl"> /// The field control. /// </param> /// <param name="tabNr"> /// The tab nr. /// </param> /// <param name="infoAreaId"> /// The information area identifier. /// </param> public FieldControl(FieldControl fieldControl, int tabNr, string infoAreaId) : this(fieldControl, tabNr, infoAreaId, -1) { }