Is it possible to get multiline (say 2-line) row in JFace tableViewer? I want my long text part spreaded between two lines, and my short lines aligner vertically in the cell. How can I achive that result?
The table control itself does not support this. You will have to paint the content of those cells yourself. There's an official example (Snippet006TableMultiLineCells) on how to do that.
Related
How can I add summary row in TableViewer (or different Viewer from SWT), which (row) will be containing sum of all rows in proper column?
And by the way, the next question. Is it possible to set multiline header in TableViewer?
Thanks
There is no special way to do this.
Your table Content Provider will have to return an object containing the summary data.
I want to be able to do two things:
set colors of rows based on index, so first row is red, second blue,
third green
be able to set color of columns also based on something, be it index
or their names etc, whatever is possible.
I do not need to detect selection change or anything. Could someone tell me how to do that? What methods would help etc? In case the title wasn't read, this is regarding DefaultTableModel in JTables.
set colors of rows based on index,
Table Row Rendering might give you some ideas.
be able to set color of columns also based on something
You can provide a custom render for any column. Then you can add you logic to color the column based on something. Read the JTable API and follow the link to the Swing tutorial on How to Use Table and you will find a section on creating a custom renderer.
I'd like to display informations about a book in a CellTable in GWT. For example its content.
How can i create a TextColumn that displays that much text. Multiple lines or a scrollbar is what i'm looking for.
Thanks in advance
If your content is plain text, you can put it in TextColumn. It will wrap within a cell, unless some CSS prevents wrapping.
If you want to set a limit on how high a cell can be, add a CSS rule to this table:
.myTable tr {
max-height: 100px;
}
If you have formatted text, you will need to create your own Cell by extending AbstractCell:
https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCustomCells
How can I add "row headers" to a Jface TableViewer?
Have a look at the Grid widget from the Nebula Project.
It does support "row headers".
A TableViewer does not by default provide this capability. But you can have a look at this snippet to achieve something similar to a row header. This example uses two tables to make the first column fixed and rest of the columns horizontally scrollable. If you do not want fixed columns than you can just use different colors for columns to achieve the look and feel of a row header.
I'm using the Netbeans RCP and want to make cell selection in a jtable more visible.
Therefore I like to draw red lines like the following:
See screenshot: http://i.stack.imgur.com/WRRyq.png
I only used GIMP to draw the lines on the screenshot ;-)
When selection increases and more cells are selected, the red lines should be the borders of the selection and should mark the whole width in the columnheader and the whole height in the row header.
My table will be much larger with a fixed columncount of ~35 and undefined count of rows.
Does anyone tried something like this before??
Thanks a lot in advance!
- Michael
Those may direct you to helpful information. Sorry I cannot provide exact answer to your case.
Outline view is a big fat JTable, so basically searching for information on parent components will give you more information on internal things.
org.openide.explorer.view.OutlineView outlineView;
To enable row selection:
outlineView.getOutline().setRowSelectionAllowed(true);
To define row selection mode: outlineView.getOutline().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
To disable cell selection: outlineView.getOutline().setCellSelectionEnabled(false);