Skip to main content



      Home
Home » Newcomers » Newcomers » Databinding
Databinding [message #159234] Mon, 03 July 2006 05:23
Eclipse UserFriend
Originally posted by: remertz.sopragroup.com

Hello,
I have a problem to Bind a complex composite.
I have a shell containing two composites:
- one composite Person containing one composite Adress
- one composite Car (List of Cars for one person)

Description of my class Person:

public class Person
{

// Now a PersonList property...
private String name=""; // @jve:decl-index=0:
private String lastName=""; // @jve:decl-index=0:
private int age;
private Adress adr;
private List car = new LinkedList();
private PropertyChangeSupport propertyChangeSupport = new
PropertyChangeSupport(
this);

......

}

Description of my class Adress:

public class Adress
{
private String adr ="";
private int cp;
private String city;

private PropertyChangeSupport propertyChangeSupport = new
PropertyChangeSupport(
this);
...

}

What I need to do:
When i select one person on my TableViewer containing list of person,
I want to display the informations of the selected person:
- List of car (TableViewer)
- Age, name, ...
- Adress

I have managed to display all informations excepted Adress...

For displaying List of car, age, name ..., i have used this code:


private void bind(Control parent)
{

Table tableP = cPersonne.getTblPersonne();

DataBindingContext dbc = BindingFactory.createContext(parent);
TableViewer peopleViewer = new TableViewer(tableP);

dbc.bind(peopleViewer, new TableModelDescription(new Property(data,
"personList", Personne.class, Boolean.TRUE), new Object[] {
"nom", "prenom" }), null);

IObservable selectedPerson = dbc.createObservable(new Property(
peopleViewer, ViewersProperties.SINGLE_SELECTION));

cInfoPerson.bind(dbc,selectedPerson);
cCar.bind(dbc, selectedPerson);




}

Class Person (Composite) ----->
public void bind(DataBindingContext dbc, IObservable selectedPerson )
{

dbc.bind(txtNom, new Property(selectedPerson, "name", String.class,
Boolean.FALSE), null);
dbc.bind(txtPrenom, new Property(selectedPerson, "lastName",
String.class, Boolean.FALSE), null);
dbc.bind(txtAge,new Property(selectedPerson, "age", int.class,
Boolean.FALSE), null);

cAdresse.bind(dbc, selectedPerson); ---> error
}



Class Adress (Composite) ------>
public void bind(DataBindingContext dbc , IObservable selectedPerson)
{
dbc.bind(txtAdr, new Property(selectedPerson, "adr", String.class,
Boolean.FALSE), null);
dbc.bind(txtCP, new Property(selectedPerson, "cp", int.class,
Boolean.FALSE), null);
dbc.bind(txtVille, new Property(selectedPerson, "city", String.class,
Boolean.FALSE), null);


}

If you have an idea to help me...
thx,
Yoko
Previous Topic:I/O error during search?
Next Topic:Can I stop the namespace colapsing?
Goto Forum:
  


Current Time: Thu Jul 10 00:52:10 EDT 2025

Powered by FUDForum. Page generated in 0.09660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top