/** * Called by nested models when a group is added to them. All * positions in all groups of a nested model have to fit inside a * single position in the parent model. * * @param group the group of the nested model to be adopted. * @param model the model to check against * @return <code>false</code> if it failed to enforce nestability */ private boolean enforceNestability(LinkedPositionGroup group, LinkedModeModel model) { Assert.isNotNull(model); Assert.isNotNull(group); try { for (LinkedPositionGroup pg : model.fGroups) { LinkedPosition pos; pos= pg.adopt(group); if (pos != null && fParentPosition != null && fParentPosition != pos) return false; // group does not fit into one parent position, which is illegal else if (fParentPosition == null && pos != null) fParentPosition= pos; } } catch (BadLocationException e) { return false; } // group must fit into exactly one of the parent's positions return fParentPosition != null; }
/** * Called by nested models when a group is added to them. All * positions in all groups of a nested model have to fit inside a * single position in the parent model. * * @param group the group of the nested model to be adopted. * @param model the model to check against * @return <code>false</code> if it failed to enforce nestability */ private boolean enforceNestability(LinkedPositionGroup group, LinkedModeModel model) { Assert.isNotNull(model); Assert.isNotNull(group); try { for (Iterator<LinkedPositionGroup> it= model.fGroups.iterator(); it.hasNext(); ) { LinkedPositionGroup pg= it.next(); LinkedPosition pos; pos= pg.adopt(group); if (pos != null && fParentPosition != null && fParentPosition != pos) return false; // group does not fit into one parent position, which is illegal else if (fParentPosition == null && pos != null) fParentPosition= pos; } } catch (BadLocationException e) { return false; } // group must fit into exactly one of the parent's positions return fParentPosition != null; }