Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TableViewer.setInput is not setting data right
icon9.gif  TableViewer.setInput is not setting data right [message #773653] Mon, 02 January 2012 07:31 Go to next message
Jyoti Agarwal is currently offline Jyoti AgarwalFriend
Messages: 5
Registered: January 2012
Junior Member
Hi Guys,

I am developing a plugin for a desktop application. In that i m using tableviewer and want to populate my data using setInput method. But the data in each column appears as if the complete row object is getting printed. Means each column has the complete row data.

Anybody has come across this issue previously???..Please help.
Re: TableViewer.setInput is not setting data right [message #773659 is a reply to message #773653] Mon, 02 January 2012 07:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Go and checkout http://wiki.eclipse.org/JFaceSnippets to learn how to
use a JFace-Viewer.

Tom

Am 02.01.12 08:31, schrieb Jyoti Agarwal:
> Hi Guys,
>
> I am developing a plugin for a desktop application. In that i m using
> tableviewer and want to populate my data using setInput method. But the
> data in each column appears as if the complete row object is getting
> printed. Means each column has the complete row data.
>
> Anybody has come across this issue previously???..Please help.
Re: TableViewer.setInput is not setting data right [message #773677 is a reply to message #773659] Mon, 02 January 2012 09:10 Go to previous messageGo to next message
Jyoti Agarwal is currently offline Jyoti AgarwalFriend
Messages: 5
Registered: January 2012
Junior Member
Hi, I have used and see this link..this is also not helping me out....

If I am setting data making TableItem (each for each row in my table) then the data is visible but unable to perform other operations like filtering and all.

But TableViewer.setInput(Object obj) is not setting and displaying the data right.
Re: TableViewer.setInput is not setting data right [message #773681 is a reply to message #773677] Mon, 02 January 2012 09:18 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What should I say you are not using it right and you are not showing us
any code.

Use one of the snippets provided there and modify them to show your
problem and then we can help you fix it. Mostly likely your problem is
that you are not setting a labelprovider (i infer that from the first
posts statement "...appears as if the complete row object is getting
printed") which you removed when you replied to my answer.

Tom

Am 02.01.12 10:10, schrieb Jyoti Agarwal:
> Hi, I have used and see this link..this is also not helping me out....
>
> If I am setting data making TableItem (each for each row in my table)
> then the data is visible but unable to perform other operations like
> filtering and all.
>
> But TableViewer.setInput(Object obj) is not setting and displaying the
> data right.
Re: TableViewer.setInput is not setting data right [message #773690 is a reply to message #773681] Mon, 02 January 2012 09:48 Go to previous messageGo to next message
Jyoti Agarwal is currently offline Jyoti AgarwalFriend
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 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
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);
>
>
<
Previous Topic:CheckBox
Next Topic:I can't dismiss the content proposal pop-up
Goto Forum:
  


Current Time: Thu Apr 25 08:23:58 GMT 2024

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

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

Back to the top