use of org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelProvider in project nebula.widgets.nattable by eclipse.
the class ColumnHeaderLayerSelectionTest method shouldReturnProvidedLabels.
@Test
public void shouldReturnProvidedLabels() {
ColumnHeaderLayer columnHeaderLayer = (ColumnHeaderLayer) this.gridLayer.getChildLayerByLayoutCoordinate(1, 0);
columnHeaderLayer.setConfigLabelAccumulator(new IConfigLabelProvider() {
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
if (columnPosition == 2) {
configLabels.addLabel("test");
}
}
@Override
public Collection<String> getProvidedLabels() {
Set<String> result = new HashSet<String>();
result.add("test");
return result;
}
});
Collection<String> labels = columnHeaderLayer.getProvidedLabels();
assertEquals(1, labels.size());
assertEquals("test", labels.iterator().next());
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelProvider in project nebula.widgets.nattable by eclipse.
the class CompositeLayer method getProvidedLabels.
@Override
public Collection<String> getProvidedLabels() {
Collection<String> labels = super.getProvidedLabels();
for (int layoutX = 0; layoutX < this.layoutXCount; layoutX++) {
for (int layoutY = 0; layoutY < this.layoutYCount; layoutY++) {
ILayer childLayer = this.childLayerLayout[layoutX][layoutY];
String regionName = this.childLayerToRegionNameMap.get(childLayer);
labels.add(regionName);
IConfigLabelAccumulator accumulator = this.regionNameToConfigLabelAccumulatorMap.get(regionName);
if (accumulator != null && accumulator instanceof IConfigLabelProvider) {
labels.addAll(((IConfigLabelProvider) accumulator).getProvidedLabels());
}
if (childLayer instanceof AbstractLayer) {
labels.addAll(((AbstractLayer) childLayer).getProvidedLabels());
}
}
}
return labels;
}
use of org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelProvider in project nebula.widgets.nattable by eclipse.
the class ColumnHeaderLayerSelectionTest method shouldReturnAdditionalLabels.
@Test
public void shouldReturnAdditionalLabels() {
ColumnHeaderLayer columnHeaderLayer = (ColumnHeaderLayer) this.gridLayer.getChildLayerByLayoutCoordinate(1, 0);
columnHeaderLayer.setConfigLabelAccumulator(new IConfigLabelProvider() {
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
if (columnPosition == 2) {
configLabels.addLabel("test");
}
}
@Override
public Collection<String> getProvidedLabels() {
Set<String> result = new HashSet<String>();
result.add("test");
return result;
}
});
LabelStack labelStack = this.gridLayer.getConfigLabelsByPosition(3, 0);
assertEquals(2, labelStack.getLabels().size());
assertTrue(labelStack.hasLabel("test"));
assertTrue(labelStack.hasLabel(GridRegion.COLUMN_HEADER));
}
Aggregations