How to add a tooltip to a table column header in SWT/JFace - swt

I am trying to add a tooltip to the column headers of my table. I just can't seem to find any workaround for this.
Do you have any tips?

If you are using TableColumn just call the setToolTipText("text") method.
If you are using TableViewerColumn call getColumn().setToolTipText("text")

Related

IBM Content Navigator ContentList clickable column

I'm able to render the ContentList within ICN. I have a requirement wherein I need to make the first column of the grid as clickable. In normal dojo, we use a formatter function to do this. Is there any way to do in ICN?
Thanks,
Finally, I had to change from ContentList to gridx. This way I formatted the column to be a clickable.
Regards,
Manju

RowSelectionModel shows all Column Header cells

I have created a NatTable with a RowSelectionModel and a RowSelectionProvider:
dataProvider = new ListDataProvider<>(rowData, columnAccessor);
bodyDataLayer = new DataLayer(dataProvider);
glazedListEventsLayer = new GlazedListsEventLayer<>(bodyDataLayer, rowData);
columnReorderLayer = new ColumnReorderLayer(glazedListEventsLayer);
columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
selectionLayer = new SelectionLayer(columnHideShowLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
selectionProvider = new RowSelectionProvider<>(selectionLayer, dataProvider, true);
selectionLayer.setSelectionModel(new RowSelectionModel<>(selectionLayer, dataProvider, idAccessor, false));
Basically, the table does what I want it to do. There is but one exception:
The table looks like this:
As intended, the table shows the row as selected (1). Also it highlights the actually selected cell (2), which is very nice. But, it renders the whole table column header as selected (3). I don't want that. I want either not highlight the header cells at all, or (even better:) I'd like only the column header cell of the cursor-cell (2) to be highlighted.
I thought that maybe there is a configuration label attached to the column header cells which results in the highlighting (so I could just change the style for this kind of label to get rid of the highlighting), but COLUMN_HEADER is the only configuration label, I can see when debugging.
So, I am bit stuck now. What causes the header cells to be highlighted and how can I change this behavior? Is it possible to highlight only the header of the cursor cell (as is done with the selected row's cursor cell (2))?
It is not the label you need to check, for selection it is the DisplayMode. So to not render the column header highlighted if you select a row you need to register the same style configuration for DisplayMode.SELECT as you register for DisplayMode.NORMAL.
If you only want to highlight the selection anchor in the column header you will need to register a custom IConfigLabelAccumulator to the DataLayer of the column header that is connected to the SelectionLayer and adds a custom label in case the cell in the column header is in the same column as the selection anchor.
For only highlighting the selection anchor, there is no default in NatTable itself. Although it should be easy to add. Feel free to create an enhancement ticket for this and even contribute. :)

Cannot uncheck checkbox in smartgwt listgrid

I'm breaking my head since a whole day now but cannot find a solution, I hope someone can help me.
I'm trying to create a simple SmartGWT ListGrid with checkboxes and for some reason I can only check checkboxes but not uncheck them.
Once the checkbok is checked there is no way to uncheck it.
Below the code I'm using to create the grid.
Here I first instantiate the grid that is populated later with a call to the server.
Any idea of what I'm doing wrong? Anything wrong with the initialisation maybe?
Thanks in advance!!
[...]
ListGrid hotelsGrid = new ListGrid();
hotelsGrid.enableHiliting(false);
hotelsGrid.setCanSort(false);
hotelsGrid.setCanResizeFields(false);
hotelsGrid.setShowHeader(false);
hotelsGrid.setAutoFitData(Autofit.BOTH);
hotelsGrid.setStyleName("selectGrid");
hotelsGrid.setCanEdit(false);
hotelsGrid.setShowHover(false);
hotelsGrid.setShowRollOver(false);
hotelsGrid.setShowSelectedStyle(false);
hotelsGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
[...]
private void initGrid(String[] sParams){
ListGridField flagField = new ListGridField("flagField", "Status", 40);
flagField.setAlign(Alignment.CENTER);
flagField.setType(ListGridFieldType.IMAGE);
flagField.setImageURLPrefix("flags/");
flagField.setImageURLSuffix(".png");
ListGridField textField = new ListGridField("textField", "Meaning");
hotelsGrid.setFields(flagField, textField);
hotelsGrid.setData(getSelectRecords(sParams));
}
It's not clear how your code sample above is related to a clickable checkbox - your code doesn't make any attempt to create a field with checkboxes??
All you need to do to get a clickable checkbox is declare a field of type "boolean" and setCanToggle(true). setCanToggle(true) allows it to be toggled with one click without needing to have editing enabled for any other fields.

GXT Grid Checkbox Header Select/Unselect All

Working with GXT and using a checkbox selection model. I notice that when every row is checked, the checkbox header will also be checked, but the checkbox header has no functionality of its own.
How can I tell the checkbox header to select/unselect all checker rows when clicked?
Thanks for the help!
You need to add the selection model as a plugin to the grid.
grid.addPlugin(sm);
You will need to set the selection model on the grid directly.
identityProvider = new IdentityValueProvider<DataModelProxy>();
checkboxSelectionModel = new CheckBoxSelectionModel<DataModelProxy>(identityProvider);
checkboxSelectionModel.setSelectionMode(SelectionMode.MULTI);
grid.setSelectionModel(checkboxSelectionModel);
where DataModel is your datamodel and proxy of this model.

How to hide column headers in GWT CellTable?

I really was going to go with a CellList, but the problem is I want a delete item displayed so when it is clicked that item goes away. That seems to have its own problem, so I went with a CellTable, but I don't want the headers to display.
You can find you answer there: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/fcd4ad18e2435aba
Basically, when you add the columns to the table: use table.addColumn(Column column); instead of table.addColumn(Column column, String header);