}
public FlatGroupSectionStrategy deriveForStorage(final RenderBox clonedParent)
{
final FlatGroupSectionStrategy clone = (FlatGroupSectionStrategy) clone();
final InstanceID groupBoxInstanceId = groupBox.getInstanceId();
final RenderBox groupBoxClone;
if (clonedParent == null)
{
groupBoxClone = (RenderBox) clone.groupBox.derive(true);
}
else
{
groupBoxClone = (RenderBox) clonedParent.findNodeById(groupBoxInstanceId);
if (groupBoxClone == null)
{
throw new IllegalStateException("The pagebox did no longer contain the stored node.");
}
if (groupBoxClone == groupBox)
{
throw new IllegalStateException("Thought you wanted a groupBoxClone");
}
}
final RenderBox addBox = getAddBox();
final RenderBox addBoxClone;
if (addBox == groupBox)
{
addBoxClone = groupBoxClone;
}
else
{
final InstanceID addBoxInstanceId = addBox.getInstanceId();
addBoxClone = (RenderBox) groupBoxClone.findNodeById(addBoxInstanceId);
if (addBoxClone == null)
{
throw new IllegalStateException("The pagebox did no longer contain the stored node.");
}