}
}
private boolean updateModel(int fromColumnIndex, int toColumnIndex,
String leftEdgeGroupName, String rightEdgeGroupName) {
ColumnGroup fromColumnGroup = model
.getColumnGroupByIndex(fromColumnIndex);
ColumnGroup toColumnGroup = model.getColumnGroupByIndex(toColumnIndex);
// If moved to the RIGHT edge of a group - remove from group
if (rightEdgeGroupName != null) {
return (model.isPartOfAGroup(fromColumnIndex)) ? fromColumnGroup
.removeColumn(fromColumnIndex) : true;
}
// If moved to the LEFT edge of a column group - include in the group
if (leftEdgeGroupName != null) {
boolean removed = true;
if (model.isPartOfAGroup(fromColumnIndex)) {
removed = fromColumnGroup.removeColumn(fromColumnIndex);
}
return removed
&& model.insertColumnIndexes(leftEdgeGroupName,
fromColumnIndex);
}
// Move column INTO a group
if (model.isPartOfAGroup(toColumnIndex)
&& !model.isPartOfAGroup(fromColumnIndex)) {
String groupName = toColumnGroup.getName();
return model.insertColumnIndexes(groupName, fromColumnIndex);
}
// Move column OUT of a group
if (model.isPartOfAGroup(fromColumnIndex)
&& !model.isPartOfAGroup(toColumnIndex)) {
return fromColumnGroup.removeColumn(fromColumnIndex);
}
// Move column BETWEEN groups
if (model.isPartOfAGroup(toColumnIndex)
&& model.isPartOfAGroup(fromColumnIndex)) {
String toGroupName = toColumnGroup.getName();
String fromGroupName = fromColumnGroup.getName();
if (fromGroupName.equals(toGroupName)) {
return true;
} else {