public void ColumnChangedType(ColumnModel model, string typeS)
        {
            int index = columns.IndexOf(model);

            if (index > -1)
            {
                ColumnModel newmodel;
                if (Enum.TryParse <ColumnController.ColumnType>(typeS, out ColumnController.ColumnType type))
                {
                    switch (type)
                    {
                    case ColumnController.ColumnType.TEXT:
                        newmodel = new ColumnModelText();
                        break;

                    case ColumnController.ColumnType.NUMBER:
                        newmodel = new ColumnModelNumber();
                        break;

                    case ColumnController.ColumnType.CHOICE:
                        newmodel = new ColumnModelChoice();
                        break;

                    case ColumnController.ColumnType.IMAGE:
                        newmodel = new ColumnModelImage();
                        break;

                    case ColumnController.ColumnType.DATE:
                        newmodel = new ColumnModelDate();
                        break;

                    default:
                        newmodel = new ColumnModelText();
                        break;
                    }
                }
                else
                {
                    newmodel = new ColumnModelText();
                }

                newmodel.Type     = model.Type;
                newmodel.Name     = model.Name;
                newmodel.ColumnId = model.ColumnId;
                newmodel.Data     = model.Data;
                newmodel.Primary  = model.Primary;
                newmodel.SetTypeChangeListener(this);
                newmodel.SetReference(database.GetReferenceFromUrl(columnsRef.ToString()).Child(newmodel.ColumnId).Ref.ToString());

                columns[index] = newmodel;
                columnsEditView.RemoveViewAt(index);
                columnsEditView.AddView(newmodel.GetEditView(this).GetView(), index);
            }
        }
        void AddNewColumn()
        {
            ColumnModel newModel = new ColumnModelText
            {
                Type     = "TEXT",
                Name     = "new column",
                ColumnId = newColumnid
            };

            newModel.SetTypeChangeListener(this);

            newModel.SetReference(columnsRef.Child("columns").Child(newColumnid).Ref.ToString());

            string[] keyParts = newColumnid.Split('_');
            string   newKey   = keyParts[0] + "_" + (System.Int64.Parse(keyParts[1]) + 1);


            columns.Add(newModel);
            columnsEditView.AddView(newModel.GetEditView(this).GetView(), columns.Count - 1);

            columnsData.Child("new_column_id").SetValue(newKey);
        }
 public CellModelText(ColumnModelText parent) : base(parent)
 {
     text       = "";
     controller = new CellControllerText(this);
 }