void handleChildAddition(MPerspectiveStack parent, MPerspective element) {
    if (element.isToBeRendered() && element.isVisible()) {
      int idx = getRenderedIndex(parent, element);

      AbstractRenderer<MPerspective, ?> renderer = factory.getRenderer(element);
      WPerspectiveStack<N, I, IC> stack = getWidget(parent);
      WStackItem<I, IC> item = createStackItem(getWidget(parent), element, renderer);

      stack.addItems(idx, Collections.singletonList(item));
    }
  }
  @Override
  public void childRendered(MPerspectiveStack parentElement, MUIElement element) {
    if (inLazyInit || inContentProcessing(parentElement) || !element.isVisible()) {
      return;
    }

    WPerspectiveStack<N, I, IC> stack = getWidget(parentElement);
    for (WStackItem<I, IC> i : stack.getItems()) {
      if (i.getDomElement() == element) {
        return;
      }
    }

    int idx = getRenderedIndex(parentElement, element);
    AbstractRenderer<MPerspective, ?> renderer = factory.getRenderer(element);
    stack.addItems(
        idx, Collections.singletonList(createStackItem(stack, (MPerspective) element, renderer)));
  }
  @Override
  public void doProcessContent(MPerspectiveStack element) {
    WPerspectiveStack<N, I, IC> stack = getWidget(element);
    List<WStackItem<I, IC>> items = new ArrayList<WStackItem<I, IC>>();
    WStackItem<I, IC> initalItem = null;

    for (MPerspective e : element.getChildren()) {
      // Precreate the rendering context for the subitem
      AbstractRenderer<MPerspective, ?> renderer = factory.getRenderer(e);
      if (renderer != null && e.isToBeRendered() && e.isVisible()) {
        WStackItem<I, IC> item = createStackItem(stack, e, renderer);
        items.add(item);

        if (e == element.getSelectedElement()) {
          initalItem = item;
        }
      }
    }

    if (!items.isEmpty()) {
      if (initalItem == null || items.size() == 1 || items.get(0) == initalItem) {
        stack.addItems(items);
      } else {
        stack.addItem(initalItem);
        if (items.get(items.size() - 1) == initalItem) {
          stack.addItems(0, items.subList(0, items.size() - 1));
        } else {
          int idx = items.indexOf(initalItem);
          stack.addItems(0, items.subList(0, idx));
          stack.addItems(items.subList(idx + 1, items.size()));
        }
      }
    }

    if (element.getSelectedElement() != null) {
      handleSelectedElement(element, null, element.getSelectedElement());
    } else if (!element.getChildren().isEmpty()) {
      // TODO Should this be done through the part service????
      element.setSelectedElement(element.getChildren().get(0));
    }
  }