|
|
|
|
Re: TableViewer.setInput is not setting data right [message #773690 is a reply to message #773681] |
Mon, 02 January 2012 09:48 |
Jyoti Agarwal Messages: 5 Registered: January 2012 |
Junior Member |
|
|
Hi, Please check my code as below......
I have to populate a user detail row in a table..which contains its image, name, contact details and email ...
So, i have created a class RowData - which is object of these items....
=========================================
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.swt.graphics.Image;
public class RowData implements Serializable
{
RowData()
{
}
RowData(Image image,String name,String contactNumber,String email)
{
this.image = image;
this.name = name;
this.contactNumber = contactNumber;
this.email = email;
}
public Image image;
public String name;
public String contactNumber;
public String email;
public Image getImage() {
return image;
}
public void setImage(Image image) {
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
/**
*
*/
private static final long serialVersionUID = 1L;
public String toString()
{
StringBuilder result = new StringBuilder();
String NEW_LINE = System.getProperty("line.separator");
result.append(this.getClass().getName() + " Object {" + NEW_LINE);
result.append(" Name: " + this.getName() + NEW_LINE);
result.append(" Contact Number: " + this.getContactNumber() + NEW_LINE);
result.append(" Email: " + this.getEmail() + NEW_LINE);
result.append("}");
return result.toString();
}
}
============================================
And then, in my mail application class, I am populating data and table as follows...Please guide me...if this information is enough.
================================
RowData[] rdl;
rdl[0] = new RowData(jyoti_image,Jyoti Agarwal,82237083400324,jyoti.rajpurawala@gmail.com );
rdl[1] = new RowData(jyoti_image,Jyoti Agarwal,82237083400324,jyoti.rajpurawala@gmail.com );
EmailsTableViewer.setInput(rdl);
|
|
|
Re: TableViewer.setInput is not setting data right [message #773729 is a reply to message #773690] |
Mon, 02 January 2012 11:45 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
We are getting closer but you missed to post the most important source
which is where you are configuring the TableViewer.
Tom
Am 02.01.12 10:48, schrieb Jyoti Agarwal:
> Hi, Please check my code as below......
>
>
> I have to populate a user detail row in a table..which contains its
> image, name, contact details and email ...
>
> So, i have created a class RowData - which is object of these items....
>
>
> =========================================
>
>
> import java.io.Serializable;
> import java.util.Collection;
> import java.util.Iterator;
>
> import org.eclipse.swt.graphics.Image;
>
>
> public class RowData implements Serializable
> {
>
> RowData()
> {
>
> }
>
> RowData(Image image,String name,String contactNumber,String email)
> {
> this.image = image;
> this.name = name;
> this.contactNumber = contactNumber;
> this.email = email;
> }
>
> public Image image;
> public String name;
> public String contactNumber;
> public String email;
>
>
>
>
>
>
> public Image getImage() {
> return image;
> }
>
>
>
>
> public void setImage(Image image) {
> this.image = image;
> }
>
>
>
>
> public String getName() {
> return name;
> }
>
>
>
>
> public void setName(String name) {
> this.name = name;
> }
>
>
>
>
> public String getContactNumber() {
> return contactNumber;
> }
>
>
>
>
> public void setContactNumber(String contactNumber) {
> this.contactNumber = contactNumber;
> }
>
>
>
>
> public String getEmail() {
> return email;
> }
>
> public void setEmail(String email) {
> this.email = email;
> }
>
> /**
> * */
> private static final long serialVersionUID = 1L;
>
>
>
>
>
> public String toString()
> {
> StringBuilder result = new StringBuilder();
> String NEW_LINE = System.getProperty("line.separator");
>
> result.append(this.getClass().getName() + " Object {" + NEW_LINE);
> result.append(" Name: " + this.getName() + NEW_LINE);
> result.append(" Contact Number: " + this.getContactNumber() +
> NEW_LINE);
> result.append(" Email: " + this.getEmail() + NEW_LINE);
> result.append("}");
>
> return result.toString();
> }
>
>
>
>
> }
>
>
> ============================================
>
>
>
> And then, in my mail application class, I am populating data and table
> as follows...Please guide me...if this information is enough.
>
>
> ================================
>
> RowData[] rdl;
>
> rdl[0] = new RowData(jyoti_image,Jyoti
> Agarwal,82237083400324,mailto:jyoti.rajpurawala@gmail.com );
> rdl[1] = new RowData(jyoti_image,Jyoti
> Agarwal,82237083400324,mailto:jyoti.rajpurawala@gmail.com );
>
>
> EmailsTableViewer.setInput(rdl);
>
>
<
|
|
|
Powered by
FUDForum. Page generated in 0.04141 seconds