Esempio n. 1
0
        public object getData(VirtualGridHeaderColumn header)
        {
            if (header == null)
            {
                return(null);                //is this correct ??
            }

            if (dataCache.ContainsKey(header.ColumnName.ToLower()))
            {
                return(dataCache[header.ColumnName.ToLower()]);
            }

            VirtualGridCell cell = getCell(header);

            if (cell != null)
            {
                //DL rempixbuf
//				if (Grid.OnGetData != null)
//				{
//					object o;
//					Grid.OnGetData(header.ColumnName,cell.Data,out o);
//					if (o != null)
//					{
//						return o;
//					}
//				}

                return(cell.Data);
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Sets or updates the data for this row
        /// </summary>
        /// <param name='columnName'>
        /// Column name.
        /// </param>
        /// <param name='data'>
        /// Data.
        /// </param>
        /// <param name='changed'>
        /// Changed.
        /// </param>
        public virtual void setData(String columnName, object data, bool changed)
        {
            object dt;

            dt = data;

            if (Grid.OnGetData != null)
            {
                Grid.OnGetData(columnName, data, out dt);
            }

            VirtualGridCell cell = getCell(columnName);

            if (cell != null)
            {
                cell.Data    = dt;
                cell.Changed = changed;
                if (dataCache.ContainsKey(columnName.ToLower()))
                {
                    dataCache.Remove(columnName.ToLower());
                    dataCache.Add(columnName.ToLower(), dt);
                }
                else
                {
                    dataCache.Add(columnName.ToLower(), dt);
                }
                Grid.afterSetData(this, columnName, dt);
                return;
            }
            else
            {
                addGridColumn(columnName, dt);
                Grid.afterSetData(this, columnName, dt);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// load data from inputdocumet
        /// </summary>
        /// <param name="inputdocument"></param>
        public virtual void loadData(XmlDocument inputdocument)
        {
            XmlNodeList rows = inputdocument.SelectNodes("//row");

            foreach (XmlNode nd in rows)
            {
                VirtualGridRow row = this.newRow(); //TODO rename to NewRow ?

                if ((nd.Attributes["customoption"] != null) && (!String.IsNullOrEmpty(nd.Attributes["customoption"].Value)))
                {
                    row.CustomOption = nd.Attributes["customoption"].Value;
                }

                XmlNodeList columns = nd.SelectNodes(".//column");
                foreach (XmlNode nd2 in columns)
                {
                    object data       = null;
                    String columnname = nd2.SelectSingleNode("name").InnerText;
                    String columndata = nd2.SelectSingleNode("data").InnerText;

                    if (columnname == null)
                    {
                        throw new Exception("columnname is null");
                    }

                    //Console.WriteLine("col" + columnname);
                    VirtualGridHeaderColumn header = getHeaderByName(columnname);
                    if ((OnGetData == null) && (header != null) && (!String.IsNullOrEmpty(header.ColumnType)))
                    {
                        Type tp = Type.GetType(header.ColumnType);
                        data = Convert.ChangeType(columndata, tp);
                    }
                    else
                    {
                        if (OnGetData != null)
                        {
                            OnGetData(columnname, columndata, out data);
                        }
                        else
                        {
                            data = columndata;
                        }
                    }
                    if (data == null)                     //TODO correct ??
                    {
                        throw new Exception("data is null");
                    }

                    VirtualGridCell cell = row.addGridColumn(columnname, data);
                    if (cell != null)
                    {
                        cell.CustomOption = XmlHelper.getAttributeValue(nd2, "customoption");
                    }
                }
            }
        }
Esempio n. 4
0
        public virtual VirtualGridCell addGridColumn(String headername, object data)
        {
            VirtualGridHeaderColumn hc = Grid.getHeaderByName(headername);

            if (hc != null)
            {
                VirtualGridCell cell = new VirtualGridCell(Grid, this, hc, null);
                //dataCache.Add(headername.ToLower(),cell.Data);
                addCell(cell);

                setData(headername, data, false);               //??

                return(cell);
                //hc.addRow(this);
            }
            return(null);
        }
Esempio n. 5
0
 public virtual void addCell(VirtualGridCell column)
 {
     Cells.Add(column);
 }
Esempio n. 6
0
        public virtual VirtualGridCell addGridColumn(String headername, object data)
        {
            VirtualGridHeaderColumn hc = Grid.getHeaderByName(headername);
            if (hc != null)
            {
                VirtualGridCell cell = new VirtualGridCell(Grid,this,hc,null);
                //dataCache.Add(headername.ToLower(),cell.Data);
                addCell(cell);

                setData(headername,data,false); //??

                return cell;
                //hc.addRow(this);
            }
            return null;
        }
Esempio n. 7
0
 public virtual void addCell(VirtualGridCell column)
 {
     Cells.Add(column);
 }