Skip to main content



      Home
Home » Eclipse Projects » JFace » [Databinding] TableViewer (rows vs columns)
[Databinding] TableViewer (rows vs columns) [message #649001] Mon, 17 January 2011 03:06 Go to next message
Eclipse UserFriend
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 12:42] by Moderator

Re: [Databinding] TableViewer (rows vs columns) [message #649915 is a reply to message #649001] Thu, 20 January 2011 18:24 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 14:26:19 EDT 2025

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

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

Back to the top