Exemplo n.º 1
0
 CustomListModel GetListModel(IListDataSource source)
 {
     CustomListModel model;
     if (!modelCache.TryGetValue (source, out model))
         modelCache [new DataSourceRef (source)] = model = new CustomListModel (source, CellRendererTarget.EventRootWidget);
     return model;
 }
Exemplo n.º 2
0
		public void SetSource (IListDataSource source, IBackend sourceBackend)
		{
			var dataSource = sourceBackend as ListDataSource;
			if (dataSource != null)
				ComboBox.ItemsSource = dataSource;
			else
				ComboBox.ItemsSource = new ListSourceNotifyWrapper (source);
		}
Exemplo n.º 3
0
		public override void SetSource (IListDataSource source, IBackend sourceBackend)
		{
			base.SetSource (source, sourceBackend);

			source.RowInserted += HandleColumnSizeChanged;
			source.RowDeleted += HandleColumnSizeChanged;
			source.RowChanged += HandleColumnSizeChanged;
			ResetColumnSize (source);
		}
Exemplo n.º 4
0
 public void SetSource(IListDataSource source, IBackend sourceBackend)
 {
     ListStoreBackend b = sourceBackend as ListStoreBackend;
     if (b == null) {
         CustomListModel model = new CustomListModel (source, Widget);
         Widget.Model = model.Store;
     } else
         Widget.Model = b.Store;
 }
Exemplo n.º 5
0
		public CustomListModel (IListDataSource source, Gtk.Widget w)
		{
			parent = w;
			this.source = source;
			adapter = new Gtk.TreeModelAdapter (this);
			colTypes = source.ColumnTypes;
			source.RowChanged += HandleRowChanged;
			source.RowDeleted += HandleRowDeleted;
			source.RowInserted += HandleRowInserted;
			source.RowsReordered += HandleRowsReordered;
		}
Exemplo n.º 6
0
        public DataSourceNotifyWrapper(IListDataSource source)
        {
            if (source == null)
                throw new ArgumentNullException ("source");

            this.source = source;
            this.source.RowInserted += OnRowsUpdated;
            this.source.RowChanged += OnRowsUpdated;
            this.source.RowsReordered += OnRowsUpdated;
            this.source.RowDeleted += OnRowsUpdated;
        }
Exemplo n.º 7
0
		/// <summary>
		/// Updates and returns the value of the DataParameter object.
		/// </summary>
		/// <param name="context">The current System.Web.HttpContext of the request.</param>
		/// <param name="control">The System.Web.UI.Control that the parameter is bound to.</param>
		/// <returns>A System.Object that represents the updated and current value of the parameter.</returns>
		protected override Object Evaluate(HttpContext context, Control control)
		{
			String value = String.Empty;

			if ( _dataSource == null && control != null )
			{
				_dataSource = control.FindControl(DataSourceID) as IListDataSource;
			}
			if ( _dataSource != null )
			{
				IEnumerable entityList = _dataSource.GetEntityList();

				if ( entityList != null )
				{
					CommaDelimitedStringCollection values = new CommaDelimitedStringCollection();
					String propertyName = PropertyName ?? EntityKeyName;
					IList list = EntityUtil.GetEntityList(entityList);
					Object temp;

					foreach ( Object item in list )
					{
						temp = EntityUtil.GetPropertyValue(item, EntityKeyName);

						if ( temp != null )
						{
							values.Add(String.Format("'{0}'", temp));
						}
					}

					if ( values.Count > 0 )
					{
						value = String.Format("{0} IN ({1})", propertyName, values.ToString());
					}
				}
			}

			return value;
		}
Exemplo n.º 8
0
 void ResetColumnSize(IListDataSource source)
 {
     // Calculate size of column
     // This is how Apple implements it; unfortunately, they don't expose this functionality in the API.
     // https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSTableViewDelegate/tableView:sizeToFitWidthOfColumn:
     nfloat w = 0;
     for (var row = 0; row < source.RowCount; row++) {
         using (var cell = Table.GetCell (0, row)) {
             var size = cell.CellSize;
             w = (nfloat)Math.Max (w, size.Width);
         }
     }
     columnHandle.MinWidth = (nfloat)Math.Ceiling (w);
     columnHandle.Width = (nfloat)Math.Ceiling (w);
 }
Exemplo n.º 9
0
 public void SetSource(IListDataSource source, IBackend sourceBackend)
 {
     ComboBox.ItemsSource = new DataSourceNotifyWrapper (source);
 }
Exemplo n.º 10
0
 public ListView(IListDataSource source)
     : this()
 {
     DataSource = source;
 }
Exemplo n.º 11
0
 public DataSourceRef(IListDataSource dataSource)
 {
     hash = dataSource.GetHashCode ();
     source = new WeakReference (dataSource);
 }