src\com\groundside\jsf\backing\Tabular.java
src\com\groundside\jsf\backing\Tabular.java
07-Apr-2005 08:09:44
1 package com.groundside.jsf.backing;
2
3 import com.groundside.jsf.Contact;
4 import javax.faces.component.html.HtmlDataTable;
5 import javax.faces.context.FacesContext;
6 import javax.faces.el.ValueBinding;
7 public class Tabular
8 {
9 private HtmlDataTable _dataTable;
10
11 public void setDataTable(HtmlDataTable dataTable)
12 {
13 this._dataTable = dataTable;
14 }
15
16 public HtmlDataTable getDataTable()
17 {
18 return _dataTable;
19 }
20
21
22 public String newButtonAction()
23 {
24 /* Just let the managed bean facility create a new contact */
25 return "drilldown";
26 }
27
28 public String editLinkAction()
29 {
30 /* pull out the currently selected contact */
31 Contact editContact = (Contact)this.getDataTable().getRowData();
32 FacesContext ctx = FacesContext.getCurrentInstance();
33 ValueBinding binding = ctx.getApplication().createValueBinding("#{editContact}");
34 binding.setValue(ctx,editContact);
35 return "drilldown";
36 }
37
38 }
39
|