0

I want to implement text wrapping in heading titles.I also have group by layer added on top column header layer Text wrapping is not working in group by header region with below configuration.How to implement text wrapping in this scenario

// Column header layer
this.colGrpModel = new ColumnGroupModel();

this.colHeaderLayr =
    new ColumnHeaderLayer(this.colHeaderDataLayr, this.bodyLayr, this.bodyLayr.getSelectionLayer());

this.colGrpHeaderLayer =
    new ColumnGroupHeaderLayer(this.colHeaderLayr, 
this.bodyLayr.getSelectionLayer(), this.colGrpModel, false);

this.colGrpHeaderLayer.setCalculateHeight(true);

// Composite layer
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);

//Group by header layer
this.groupByHeaderLayer = new GroupByHeaderLayer(groupByModel, this.paramFilterGridLayer,
this.filterGridLayer.getColumnHeaderDataProvider());   

compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, this.groupByHeaderLayer, 0, 0);

compositeGridLayer.setChildLayer("Grid", this.filterGridLayer, 0, 1);

This is the groupBy configuration:

configRegstry.registerConfigAttribute(
    GroupByConfigAttributes.GROUP_BY_CHILD_COUNT_PATTERN, "[{0}] - ({1})");

configRegstry.registerConfigAttribute(
    GroupByConfigAttributes.GROUP_BY_HINT, "Drag columns here");

// To implement text wrapping in  group by header region  
configRegstry.registerConfigAttribute(
    CellConfigAttributes.CELL_PAINTER, 
    new TextPainter(true, true, 2), 
    DisplayMode.NORMAL, 
    GroupByHeaderLayer.GROUP_BY_REGION);
greg-449
  • 109,219
  • 232
  • 102
  • 145
User134
  • 1
  • 2

1 Answers1

2

Short answer: This is currently not supported.

Long answer: You are misunderstanding several things.

  1. Text wrapping means that a new line is added dynamically if there is not enough space in a cell. Since the GroupByHeader is actually one cell that spans the whole width, the cell width will never exceed to force text wrapping.
  2. The TextPainter is a ICellPainter, so it is used to render cells.
  3. The GroupByHeader (although a spanned cell) does not use the default cell painter. It uses the special GroupByHeaderPainter as it needs to inspect the GroupByModeland render fragments for each entry. That painter does currently not support line wrapping. And it does not use other ICellPainter internally.

That means, if you need to support line wrapping in the GroupByHeader you need to extend the GroupByHeaderPainter. As an open source project we like contributions. :)

If you want to add some sort of text wrapping in the GroupByHeader, you somehow need to specify when a text should be wrapped.

Dirk Fauth
  • 4,128
  • 2
  • 13
  • 23