use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class RowHeaderLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition);
if (this.selectionLayer.length > 0) {
final int selectionLayerRowPosition = LayerUtil.convertRowPosition(this, rowPosition, this.selectionLayer[0]);
boolean fullySelected = true;
for (SelectionLayer sl : this.selectionLayer) {
if (!sl.isRowPositionFullySelected(selectionLayerRowPosition)) {
fullySelected = false;
break;
}
}
if (fullySelected) {
labelStack.addLabel(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
}
}
return labelStack;
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
int columnIndex = getColumnIndexByPosition(columnPosition);
if (rowPosition == 0 && this.model.isPartOfAGroup(columnIndex)) {
LabelStack stack = new LabelStack();
if (getConfigLabelAccumulator() != null) {
getConfigLabelAccumulator().accumulateConfigLabels(stack, columnPosition, rowPosition);
}
stack.addLabel(GridRegion.COLUMN_GROUP_HEADER);
if (this.model.isPartOfACollapseableGroup(columnIndex)) {
ColumnGroup group = this.model.getColumnGroupByIndex(columnIndex);
if (group.isCollapsed()) {
stack.addLabelOnTop(DefaultColumnGroupHeaderLayerConfiguration.GROUP_COLLAPSED_CONFIG_TYPE);
} else {
stack.addLabelOnTop(DefaultColumnGroupHeaderLayerConfiguration.GROUP_EXPANDED_CONFIG_TYPE);
}
}
return stack;
} else {
return this.columnHeaderLayer.getConfigLabelsByPosition(columnPosition, rowPosition);
}
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class RowGroupHeaderLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
int rowIndex = getRowIndexByPosition(rowPosition);
if (columnPosition == 0 && RowGroupUtils.isPartOfAGroup(this.model, rowIndex)) {
LabelStack stack = new LabelStack(GridRegion.ROW_GROUP_HEADER);
IRowGroup<T> group = RowGroupUtils.getRowGroupForRowIndex(this.model, rowIndex);
if (RowGroupUtils.isCollapsed(this.model, group)) {
stack.addLabelOnTop(DefaultRowGroupHeaderLayerConfiguration.GROUP_COLLAPSED_CONFIG_TYPE);
} else {
stack.addLabelOnTop(DefaultRowGroupHeaderLayerConfiguration.GROUP_EXPANDED_CONFIG_TYPE);
}
List<Integer> selectedRowIndexes = convertToRowIndexes(this.selectionLayer.getFullySelectedRowPositions());
if (selectedRowIndexes.contains(rowIndex)) {
stack.addLabelOnTop(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE);
}
return stack;
} else {
return this.rowHeaderLayer.getConfigLabelsByPosition(columnPosition - 1, rowPosition);
}
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ColumnHeaderLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition);
if (this.selectionLayer.length > 0) {
final int selectionLayerColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, this.selectionLayer[0]);
boolean fullySelected = true;
for (SelectionLayer sl : this.selectionLayer) {
if (!sl.isColumnPositionFullySelected(selectionLayerColumnPosition)) {
fullySelected = false;
break;
}
}
if (fullySelected) {
labelStack.addLabel(SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE);
}
}
return labelStack;
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class HierarchicalTreeLayer method getConfigLabelsByPosition.
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
// for level header we do not need to call super
if (isLevelHeaderColumn(columnPosition)) {
return new LabelStack(LEVEL_HEADER_CELL);
}
LabelStack configLabels = super.getConfigLabelsByPosition(columnPosition, rowPosition);
if (isTreeColumn(columnPosition)) {
configLabels.addLabelOnTop(TreeLayer.TREE_COLUMN_CELL);
ILayerCell cell = getCellByPosition(columnPosition, rowPosition);
if (cell != null) {
// always level 0 as we do not show all levels in one column and
// therefore we do not need indentation
configLabels.addLabelOnTop(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0);
if (cell.getRowSpan() > 1) {
configLabels.addLabelOnTop(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE);
} else if (isCollapsed(columnPosition, rowPosition)) {
configLabels.addLabelOnTop(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE);
} else {
// we get here for example if handleCollapsedChildren is
// false and the parent is collapsed
// we can not show a handle to expand/collapse the child if
// the parent is collapsed
configLabels.addLabelOnTop(DefaultTreeLayerConfiguration.TREE_LEAF_CONFIG_TYPE);
}
}
}
if (this.handleCollapsedChildren) {
boolean directLevelHeader = true;
boolean headerCollapsed = false;
for (int i = this.levelHeaderPositions.length - 1; i >= 0; i--) {
int pos = this.levelHeaderPositions[i];
if (pos < columnPosition) {
int firstLevelColumnPosition = pos + (isShowTreeLevelHeader() ? 1 : 0);
// the first header we find is the direct one
if (directLevelHeader) {
directLevelHeader = false;
} else if (isCollapsed(firstLevelColumnPosition, rowPosition)) {
headerCollapsed = true;
}
}
}
if (headerCollapsed) {
configLabels.addLabelOnTop(COLLAPSED_CHILD);
// remove tree labels to avoid specialized handling and
// rendering
configLabels.removeLabel(TreeLayer.TREE_COLUMN_CELL);
configLabels.removeLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0);
configLabels.removeLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE);
configLabels.removeLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE);
configLabels.removeLabel(DefaultTreeLayerConfiguration.TREE_LEAF_CONFIG_TYPE);
}
}
return configLabels;
}
Aggregations