예제 #1
0
        public override void UpdateViews(object value, ITableColumns columnsProvider)
        {
            string asStr = (string)value;

            if (columnsProvider.GetColumnState(ItemIndex).CurrentlyReadOnly)
            {
                asStr += "\n<color=#00000030><size=10>Read-only</size></color>";
            }

            TextComponent.text = asStr;

            var sortType = columnsProvider.GetColumnState(ItemIndex).CurrentSortingType;

            UpdateArrowFromSortType(sortType);
        }
예제 #2
0
        public override void UpdateViews(object value, ITableColumns columnsProvider)
        {
            bool isNull = value == null;
            var  column = columnsProvider.GetColumnState(ItemIndex);

            if (isNull)
            {
                UpdateAsNullText(column);
                return;
            }

            UpdateViews(value, column);
        }
예제 #3
0
 void RebuildVHIfNeeded(TTupleValueViewsHolder vh)
 {
     if (vh.HasPendingTransversalSizeChanges)
     {
         if (_Params.ResizingMode == TableResizingMode.AUTO_FIT_TUPLE_CONTENT)
         {
             // Only rebuild strings
             if (_ColumnsProvider.GetColumnState(vh.ItemIndex).Info.ValueType == TableValueType.STRING)
             {
                 if (vh.CSF)
                 {
                     ForceRebuildViewsHolder(vh);
                 }
             }
         }
         vh.HasPendingTransversalSizeChanges = false;
     }
 }
예제 #4
0
        void GetRandomValuesIntoTuple(ITableColumns columnsModel, ITuple tuple, System.Random random)
        {
            for (int i = 0; i < columnsModel.ColumnsCount; i++)
            {
                var randInt    = random.Next();
                var randIntPos = randInt < 0 ? -randInt : randInt;

                object obj = null;
                if (randInt % 10 != 0)                 // objects can also be null
                {
                    var columnState = columnsModel.GetColumnState(i);
                    var type        = columnState.Info.ValueType;
                    var buf8        = new byte[sizeof(double)];
                    switch (type)
                    {
                    case TableValueType.RAW:
                        if (randInt % 2 == 0)
                        {
                            obj = new object();
                        }
                        else
                        {
                            obj = new Vector3((randInt % 4), (randInt % (1 + i)), (randInt % (2 + i)));
                        }
                        break;

                    case TableValueType.STRING:
                        obj = _RandomStrings[randIntPos % _RandomStrings.Length];
                        break;

                    case TableValueType.INT:
                        obj = randInt;
                        break;

                    case TableValueType.LONG_INT:
                        obj = (((long)(randInt) << 32) + (~randInt));
                        break;

                    case TableValueType.FLOAT:
                        obj = randInt / 134325.4134E+23f;
                        break;

                    case TableValueType.DOUBLE:
                        // _Random.NextDouble() is useless because it doesn't produce the entire range of doubles
                        // This also can yield NaN and Infinity, but we want that, for demo purposes
                        random.NextBytes(buf8);
                        obj = BitConverter.ToDouble(buf8, 0);
                        break;

                    case TableValueType.ENUMERATION:
                        var enumType   = columnState.Info.EnumValueType;
                        var enumValues = Enum.GetValues(enumType);
                        obj = enumValues.GetValue(randIntPos % enumValues.Length);
                        break;

                    case TableValueType.BOOL:
                        obj = randInt % 2 == 0;
                        break;

                    case TableValueType.TEXTURE:
                        obj = _SampleTextures[randIntPos % _SampleTextures.Length];
                        break;
                    }
                }
                tuple.SetValue(i, obj);
            }
        }