// Get the SeparatorManager to use to render the separators.
MenuBuffer menuBuffer = bufferLocator.getMenuBuffer(group);
// This check is necessary in case the menuBuffer does not exist
if (menuBuffer != null) {
SeparatorManager separatorManager =
menuBuffer.getSeparatorManager();
// Render the separator before.
final SeparatorRenderer before =
separatorRendererSelector.selectMenuItemGroupSeparator(
group, true);
if (before != null) {
separatorManager.queueSeparator(before);
}
// We always render the items in the menu group
renderChildren(group);
// Render the separator after.
final SeparatorRenderer after =
separatorRendererSelector.selectMenuItemGroupSeparator(
group, false);
if (after != null) {
separatorManager.queueSeparator(after);
}
}
}