Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Databinding] TableViewer (rows vs columns)
[Databinding] TableViewer (rows vs columns) [message #649001] Mon, 17 January 2011 08:06 Go to next message
AJ  is currently offline AJ Friend
Messages: 77
Registered: July 2009
Member
My model or class contains only 4 attributes so can I represent an instance of my class using a fix TableViewer where the name and values of the x, y, and z attributes are displayed as rows and the values of the attribute a are the columns?

public class MyModel {
String x;
String y;
String z;
String a;
....
.....
}

----------------------------
| a | C1 | C2 | C3 |
----------------------------
| x | A1 | A2 | A3 |
----------------------------
| y | B1 | B2 | B3 |
----------------------------
| z | Z1 | Z2 | Z3 |
----------------------------

[Updated on: Mon, 17 January 2011 17:42]

Report message to a moderator

Re: [Databinding] TableViewer (rows vs columns) [message #649915 is a reply to message #649001] Thu, 20 January 2011 23:24 Go to previous message
Carsten Habicht is currently offline Carsten HabichtFriend
Messages: 14
Registered: January 2011
Junior Member
Does this mean, that your table grows to the right? Adding an object would mean that column C4 is created?
In this case, maybe you could create an intermediate model of the form
public class Line {
  String labelColumnA; // Holds X for the first row, Y for the second, etc.
  List<String> otherColumns; // Holds An, Bn, Cn for each column n
...
}


Then you can use a label provider that shows the right label according to the column index (index==0 --> labelCol, index>0 --> otherColumns.get(index-1) ).
I'm not sure how Table and TableViewer behave, if you add columns dynamically, but probably it works with some tableViewer.refresh() fiddling.
Previous Topic:dialog java package
Next Topic:No selection in TableViewer on right mouse-click
Goto Forum:
  


Current Time: Thu Mar 28 20:58:05 GMT 2024

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

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

Back to the top