return 0;
}
}
public static List<String> orderByMemberGroups(ObjectSpecification objSpec, Set<String> groupNamesToOrder, MemberGroupLayoutHint memberGroupLayoutHint) {
final MemberGroupLayoutFacet facet = objSpec.getFacet(MemberGroupLayoutFacet.class);
final List<String> leftColumnGroupNames = Lists.newArrayList(groupNamesToOrder);
// not expected to happen
if(facet == null) {
return leftColumnGroupNames;
}
if(memberGroupLayoutHint == MemberGroupLayoutHint.MIDDLE) {
return facet.getColumnSpans().getMiddle()>0? facet.getMiddle(): Collections.<String>emptyList();
}
if(memberGroupLayoutHint == MemberGroupLayoutHint.RIGHT) {
return facet.getColumnSpans().getRight()>0? facet.getRight(): Collections.<String>emptyList();
}
// else left; per the requested order, including any groups not mentioned in either list,
// but excluding any groups in the middle or right columns
final List<String> groupNamedInRequiredOrder = facet.getLeft();
final List<String> order = order(leftColumnGroupNames, groupNamedInRequiredOrder);
if(facet.getColumnSpans().getMiddle() > 0) {
order.removeAll(facet.getMiddle());
}
if(facet.getColumnSpans().getRight() > 0) {
order.removeAll(facet.getRight());
}
return order;
}