I am using a jface tableviewer with a tablecolumnlayout (for it's parent composite) in my eclipse RCP application.
I see that, in my view, the columns are equally spaced out to cover the entire width of the table.. So far so good.
We have a functionality where we need to save & load the table layout . Basically user can hide/ re-order any number of columns and he wishes to save that particular layout..
I am using the eclipse preferences API to save/retrieve the table layout.
The view opens with a default layout (with all columns & with the default ordering ) when the view is opened for the 1st time. Hence, I would save a DEFAULT layout(with the default ordering & column widths) whenever the view loads so that user can come back to the original layout at any time.
But, the problem here is when I try to load the default layout, I see that the columns are NOT equally spaced out and there is an empty column at the end.
What can i possibly do to achieve the default behaviour where columns get equally spaced out to cover the width of the table?
Note: I tried invoking the layout() of table's parent composite or calling the redraw of both table as well as composite but it did not work out.
I solved the above mentioned issue.
SWT increases the given width of the columns during view rendering so that the entire table width is occupied.
I was able to get the increased width of each column only when the view was about to be rendered (during part Activation ).
If I asked for the column width just after using the tablecolumnlayout, I was still getting the predefined width.
As a solution to this, I moved my code to save the default layout during part activation so that the actual increased width is obtained.
Related
We have an existing RCP app which uses the property view from org.eclipse.ui.views (version 3.6.0-SDK-3.7.2). I am wondering if there is a way to pack the columns of the PropertySheetViewer?
I am new to the RCP world and am not clear about how our app leverages this class. All I can see is an implementation of IPropertySourceProvider which seems to be used for populating the property view.
No, you can't pack the columns.
PropertySheetViewer uses a control resize listener and adjusts the first column to 40% of the width and the second column to the rest of the width.
I need to make table view for large table. There are about 20 columns and it is the problem for me because I do not know how to make some kind of a slider to make possible looking at any column I want.
Now I am not able to see all column because my screen is to small. I would like to have "resaizable" tableview.
I've build an application in Java with the help of JFace/SWT. I am using mainly the TableViewer of JFace and sometime the SWT table behind with myTableViewer.getTable().
My table has a header (filled with the column names) and the first row is rendered with CCombos in CellEditors (drop down menus for filters).
Now I want to fix this first row ("filter-row") in the table, so it is always shown, independently if I am scrolling down or not..
Do you know any opportunity to do this (instead of splitting one table in two tables, as I found it in the internet)?
The SWT Table does not support fixed rows or columns.
If the combos were inteded to hold a limited number of choices you may use context menus on the column headers instead.
There are also alternative Table-like implementations in varying degrees of maturity that you may consider:
Nebula Grid
XViewer
NatTable
If non of the above fits your requirements you will have to either use a distinct table that holds the combo widgets or implement a custom 'header' control.
I have a table view whose size is more than my screen size.
To view that table I have 2 solutions
1-I have to provide a scrollbar by which user can scroll to the end of the table
2-Or warp the table when it meet the end of the screen.
First solution-I don't want to provide any scroll bar as I want user to view the table at one shot. so I want to wrap the table.
I searched and came to know that I could warp table header but I could'nt find any hack to wrap the whole table. Any help on this will be great help for me
Is there a way to make, let say first 3 out of 7, columns fixed in Cell table. I want to be able to see always first three columns and have horizontal scroll on others.
You will have to create a custom widget that consists of a ScrollPanel, which includes two CellTable widgets set side by side. The right table should be wrapped in a FlowPanel with overflow-x property set to AUTO (overflow-y should remain at HIDDEN).
You can use the same DataProvider for both tables to synchronize all changes. Be careful with the SelectionModel though, if you need it. I would limit selection to the first column of checkboxes and disable selection by clicking on a row.
Make sure that your widget fits into its space, or you may end up with two horizontal scrollbars - one for the ScrollPanel and one for the right table. Finally, remember to set sizes on both tables so that they have the same height.