use of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup in project nebula.widgets.nattable by eclipse.
the class ColumnGroupGroupHeaderLayer 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 {
if (rowPosition != 0) {
rowPosition--;
}
return this.columnGroupHeaderLayer.getConfigLabelsByPosition(columnPosition, rowPosition);
}
}
use of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup in project nebula.widgets.nattable by eclipse.
the class ColumnGroupGroupHeaderLayer method setGroupUnbreakable.
/**
* @see ColumnGroup#setUnbreakable(boolean)
*/
public void setGroupUnbreakable(int columnIndex) {
ColumnGroup columnGroup = this.model.getColumnGroupByIndex(columnIndex);
columnGroup.setUnbreakable(true);
}
use of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup in project nebula.widgets.nattable by eclipse.
the class ColumnGroupGroupHeaderLayer method setGroupAsCollapsed.
public void setGroupAsCollapsed(int columnIndex) {
ColumnGroup columnGroup = this.model.getColumnGroupByIndex(columnIndex);
columnGroup.setCollapsed(true);
}
use of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayer method getColumnSpan.
/**
* Calculates the span of a cell in a Column Group. Takes into account
* collapsing and hidden columns in the group.
*
* @param columnPosition
* position of any column belonging to the group
*
* @since 1.6
*/
public int getColumnSpan(int columnPosition) {
int columnIndex = getColumnIndexByPosition(columnPosition);
ColumnGroup columnGroup = this.model.getColumnGroupByIndex(columnIndex);
int sizeOfGroup = columnGroup.getSize();
if (columnGroup.isCollapsed()) {
int sizeOfStaticColumns = columnGroup.getStaticColumnIndexes().size();
if (sizeOfStaticColumns == 0) {
return 1;
} else {
sizeOfGroup = sizeOfStaticColumns;
}
}
int startPositionOfGroup = getStartPositionOfGroup(columnPosition);
int endPositionOfGroup = startPositionOfGroup + sizeOfGroup;
List<Integer> columnIndexesInGroup = columnGroup.getMembers();
for (int i = startPositionOfGroup; i < endPositionOfGroup; i++) {
int index = getColumnIndexByPosition(i);
if (!columnIndexesInGroup.contains(Integer.valueOf(index))) {
sizeOfGroup--;
}
}
return sizeOfGroup;
}
use of org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel.ColumnGroup in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayer method getStartPositionOfGroup.
/**
* Figures out the start position of the group.
*
* @param columnPosition
* of any column belonging to the group
* @return first position of the column group
*
* @since 1.6
*/
public int getStartPositionOfGroup(int columnPosition) {
int bodyColumnIndex = getColumnIndexByPosition(columnPosition);
ColumnGroup columnGroup = this.model.getColumnGroupByIndex(bodyColumnIndex);
int leastPossibleStartPositionOfGroup = columnPosition - (columnGroup.getSize() - 1);
int i = 0;
for (i = leastPossibleStartPositionOfGroup; i < columnPosition; i++) {
if (ColumnGroupUtils.isInTheSameGroup(getColumnIndexByPosition(i), bodyColumnIndex, this.model)) {
break;
}
}
return i;
}
Aggregations