use of net.sourceforge.nattable.group.ColumnGroupModel in project translationstudio8 by heartsome.
the class ColumnGroupExpandCollapseCommandHandler method doCommand.
@Override
protected boolean doCommand(ColumnGroupExpandCollapseCommand command) {
int columnIndex = columnGroupExpandCollapseLayer.getColumnIndexByPosition(command.getColumnPosition());
ColumnGroupModel model = columnGroupExpandCollapseLayer.getModel();
boolean wasCollapsed = model.isCollapsed(columnIndex);
ColumnGroup columnGroup = model.toggleColumnGroupExpandCollapse(columnIndex);
List<Integer> columnPositions = new ArrayList<Integer>(columnGroup.getMembers());
columnPositions.remove(0);
ILayerEvent event;
if (wasCollapsed) {
event = new ShowColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions);
} else {
event = new HideColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions);
}
columnGroupExpandCollapseLayer.fireLayerEvent(event);
return true;
}
use of net.sourceforge.nattable.group.ColumnGroupModel in project translationstudio8 by heartsome.
the class GroupMultiColumnReorderCommandHandler method doCommand.
@Override
protected boolean doCommand(MultiColumnReorderCommand command) {
int toColumnPosition = command.getToColumnPosition();
ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer();
int toColumnIndex = underlyingLayer.getColumnIndexByPosition(toColumnPosition);
List<Integer> fromColumnPositions = command.getFromColumnPositions();
ColumnGroupModel model = columnGroupReorderLayer.getModel();
if (updateModel(underlyingLayer, toColumnIndex, fromColumnPositions, model)) {
return underlyingLayer.doCommand(command);
} else {
return false;
}
}
use of net.sourceforge.nattable.group.ColumnGroupModel in project translationstudio8 by heartsome.
the class ReorderColumnsAndGroupsCommandHandler method doCommand.
/**
* Check if any column belongs to a group. If yes, add all columns in that group.
* Assumes that the 'toLocation' is not inside another group
*/
@Override
protected boolean doCommand(ReorderColumnsAndGroupsCommand command) {
final ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer();
List<String> groupsProcessed = new ArrayList<String>();
List<Integer> fromColumnPositions = command.getFromColumnPositions();
List<Integer> fromColumnPositionsWithGroupColumns = new ArrayList<Integer>();
for (Integer fromColumnPosition : fromColumnPositions) {
int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition.intValue());
ColumnGroupModel model = columnGroupReorderLayer.getModel();
if (model.isPartOfAGroup(fromColumnIndex)) {
String groupName = model.getColumnGroupNameForIndex(fromColumnIndex);
if (!groupsProcessed.contains(groupName)) {
groupsProcessed.add(groupName);
fromColumnPositionsWithGroupColumns.addAll(columnGroupReorderLayer.getColumnGroupPositions(fromColumnIndex));
}
} else {
fromColumnPositionsWithGroupColumns.add(fromColumnPosition);
}
}
return underlyingLayer.doCommand(new MultiColumnReorderCommand(columnGroupReorderLayer, fromColumnPositionsWithGroupColumns, command.getToColumnPosition()));
}
Aggregations