Womb.Gtk : Womb.Gtk Namespace
AtomTab

A widget for displaying and editing the contents of a table

[System.Reflection.DefaultMember(MemberName="Item")]
public class AtomTab : Gtk.TreeView, IHtmlizable


Remarks

bla

C# Example
using System;
using Gtk;
using Womb;
using Womb.Gtk;

void
DisplayEmployees (DB db)
{
	Employee emp;
	Window   win;
	AtomTab   emp_tab;

	win = new Window ();

	emp = new Employee (db);

	emp_tab = new AtomTab (emp, true);

	win.Add (emp_tab);

	emp_tab.Refresh ();

	win.ShowAll ();
}
	
  
Members

See Also: Inherited members from Gtk.TreeView.

Constructors
Creates a new tab
Properties
AutoCommit
bool . Whether to automatically save changes to database
Item [string] [read-only]
AtomTabColumn . Returns a column
Item [Womb.Atom] [read-only]
ArrayList . Get a list of atoms matching an example
Item [string, object] [read-only]
ArrayList . Get a list of atoms matching a single criteria
Item [string, string, bool] [read-only]
ArrayList . Get a list of atoms with a tag matching a substring
Item [Womb.Atom, bool, bool] [read-only]
ArrayList . Get a list of atoms matching an example
NumColumns [read-only]
int . Number of columns
NumRows [read-only]
int . Number of rows
SelectedAtom [read-only]
Womb.Atom . Currently selected atom
SelectedRow [read-only]
AtomTabRow . Currently selected row
Methods
AppendAtom (Womb.Atom)
Appends an atom to the view and writes it to database immediately
AppendAtom (Womb.Atom, bool)
Appends an atom to the view
Clear ()
Clear the view
CreateFinder () : TabFinder
Create a table finder object
GetEnumerator () : IEnumerator
To be added.
Refresh ()
Refresh contents of table
Refresh (string)
Refresh contents of table
RemoveAtom (Womb.Atom)
Remove an atom from table
SelectFirst () : bool
Select first row in the table
ToHtml () : string
Emit HTML for table contents
WipeAtom (Womb.Atom)
Remove an atom from table and database
Events
AtomActivated
A row has been activated
DataChanged
Data has changed in the table
RefreshDone
Asynchronous refresh has finished.
RefreshStart
Asynchronous refresh has started
Member Details
AtomTab Constructor
public AtomTab (Womb.Atom ref_atom, bool editable)

Creates a new tab

Parameters
ref_atom
An instance of the type of atom the table will use
editable
Whether the table will allow changes
Remarks
The atom passed must be already connected to the database

RefreshStart
public event EventHandler RefreshStart

Asynchronous refresh has started

Remarks
To be added.

RefreshDone
public event EventHandler RefreshDone

Asynchronous refresh has finished.

Remarks
To be added.

AtomActivated
public event AtomActivatedHandler AtomActivated

A row has been activated

Remarks
To be added.

DataChanged
public event DataChangedHandler DataChanged

Data has changed in the table

Remarks
To be added.

Refresh
public void Refresh ()

Refresh contents of table

Remarks
To be added.

Refresh
public void Refresh (string constraint)

Refresh contents of table

Parameters
constraint
Constraint to pass to refresh query to restrict dataset.
Remarks
Refreshing is done asynchronously to prevent user interface from locking up during a long refresh. You cannot access the tab while refreshing. You must listen to the events Womb.Gtk.AtomTab.RefreshStart, which is fired when refresh starts, and Womb.Gtk.AtomTab.RefreshDone, which is fired when refresh is done.

AppendAtom
public void AppendAtom (Womb.Atom atom)

Appends an atom to the view and writes it to database immediately

Parameters
atom
Atom to append
Remarks
This method is equivalent to calling Womb.Gtk.AtomTab.AppendAtom(Womb.Atom,bool) with true

AppendAtom
public void AppendAtom (Womb.Atom atom, bool commit)

Appends an atom to the view

Parameters
atom
Atom to append
commit
Whether to write the atom to database immediately
Remarks
To be added.

RemoveAtom
public void RemoveAtom (Womb.Atom atom)

Remove an atom from table

Parameters
atom
To be added.
Remarks
To be added.

WipeAtom
public void WipeAtom (Womb.Atom atom)

Remove an atom from table and database

Parameters
atom
To be added.
Remarks
To be added.

Clear
public void Clear ()

Clear the view

Remarks
To be added.

SelectFirst
public bool SelectFirst ()

Select first row in the table

Returns
To be added.
Remarks
To be added.

CreateFinder
public TabFinder CreateFinder ()

Create a table finder object

Returns
Remarks
Any Womb.Gtk.AtomTab can only have one Womb.Gtk.TabFinder associated with it, so calling this method multiple times on a tab will keep returning the same reference.

GetEnumerator
public IEnumerator GetEnumerator ()

To be added.

Returns
To be added.
Remarks
To be added.

ToHtml
public string ToHtml ()

Emit HTML for table contents

Returns
A string with an HTML dump of the contents of the table
Remarks
See Womb.Gtk.IHtmlizable for details on generated HTML customisation

NumRows
public int NumRows { get; }

Number of rows

Value
Number of rows in the table
Remarks
This property uses foreach to count rows, so you cannot use it within a foreach loop

NumColumns
public int NumColumns { get; }

Number of columns

Value
Number of columns in the table
Remarks
To be added.

SelectedAtom
public Womb.Atom SelectedAtom { get; }

Currently selected atom

Value
The atom contained in the currently selected row, or null
Remarks
To be added.

SelectedRow
public AtomTabRow SelectedRow { get; }

Currently selected row

Value
Remarks

Because Womb.Gtk.AtomTabRow is a value type, getting this property when there are no selected rows will throw a Exception

You can prevent this by wrapping the call, in a try block, like:

C# Example
	AtomTabRow  row;
	bool                 have_row = true;

	try
	{
		row = view.SelectedRow;
	}
	catch
	{
		have_row = false;
	}

	if (have_row)
		// do stuff here
  

FIXME: make this method return AtomTabRow? instead and get rid of this workaround


AutoCommit
public bool AutoCommit { set; get; }

Whether to automatically save changes to database

Value
To be added.
Remarks
To be added.

Item
public AtomTabColumn Item [string tagname] { get; }

Returns a column

Parameters
tagname
Name of column
Value
Remarks

Use this indexer to set properties on columns directly

C# Example
  tab ["id"].Editable = false;
  tab ["salary"].BgColor = "yellow";
  


Item
public ArrayList Item [string pkey, object pkey_value] { get; }

Get a list of atoms matching a single criteria

Parameters
pkey
Name of tag to use as criteria
pkey_value
Value of tag
Value
Remarks
To be added.

Item
public ArrayList Item [string pkey, string substring, bool case_sensitive] { get; }

Get a list of atoms with a tag matching a substring

Parameters
pkey
Name of tag to use as criteria
substring
Substring to match against
case_sensitive
Whether to match case
Value
To be added.
Remarks
To be added.

Item
public ArrayList Item [Womb.Atom example, bool case_sensitive, bool match_time] { get; }

Get a list of atoms matching an example

Parameters
example
Example atom
case_sensitive
Whether to match strings case-sensitively
match_time
If true, date tags will be compared including the time part; if false, only the date part will be compared
Value
Remarks

This method does a Query-by-Example search on all atoms in the table. You provide an example atom with some fields set to the values you want to match, and this method will return a list of all atoms that match the values in those fields.

C# Example
	void
	DoSearch (AtomTab tab)
	{
		MyAtom    example = new MyAtom (db);
		ArrayList   result;

		example.id = 7;
		example.salary = 4;

		result = tab [example, false, false];

		// now result contains references to all atoms whose id is 7 and salary is 4
 
	}		
		
  


Item
public ArrayList Item [Womb.Atom example] { get; }

Get a list of atoms matching an example

Parameters
example
Example atom
Value
A ArrayList containing all atoms in the view matching the example.
Remarks
This method is equivalent to calling Womb.Gtk.AtomTab.Item(Womb.Atom,bool,bool) with values true, true