Hello Guys,
I have the following model which makes an element a parent of the element that follows it. For example i get data from a server in an array of arrays like this:
net Person age
net Person height
net Address streetname
org Company name
org Company location
com School color
com School number
please kindly read the link below for the message yesterday and see the model classes and the structure. The question i asked in this link is not what i want now. I just want you to see the data model and the structure.
http://stackoverflow.com/questions/1230164/comparing-linked-objects
MY QUESTION NOW IS::
I want to create a table from the model but am finding it difficult to implement the Content and Label providers. So am asking how i can do it. Each column will contain the children of the previous column and etc..
Thanks for your help.
I tried this in the content provider but its not working:
public Object[] getElements(Object parentElement) {
if(parentElement instanceof cPackage) {
cPackage pack = (cPackage)parentElement;
return pack.getChildren().toArray();
}else if(parentElement instanceof cClass) {
cClass klas = (cClass)parentElement;
return klas.getChildren().toArray();
}else if(parentElement instanceof cMethod) {
cMethod met = (cMethod)parentElement;
return met.getChildren().toArray();
}
return EMPTY_ARRAY;
}
Thanks for your help.