/*
  * (non-Javadoc)
  *
  * @see com.bluexml.xforms.generator.forms.Renderable#render(java.lang.String, java.util.Stack,
  * java.util.Stack)
  */
 @Override
 public Rendered render(
     String path,
     Stack<Renderable> parents,
     Stack<Rendered> renderedParents,
     boolean isInIMultRepeater) {
   if (firstRender) {
     for (List<String> line : lines) {
       RenderableLine renderableLine = new RenderableLine();
       for (String itemName : line) {
         Renderable item = items.get(itemName);
         if (item != null) {
           renderableLine.add(item);
           items.remove(itemName);
         }
       }
       add(renderableLine);
     }
     RenderableDiv renderableElse =
         new RenderableDiv(ModelTools.getCompleteNameJAXB(classe) + "Else");
     Set<String> keySet = items.keySet();
     for (String itemName : keySet) {
       renderableElse.add(items.get(itemName));
     }
     if (renderableElse.getChildrenSize() > 0) {
       add(renderableElse);
     }
     firstRender = false;
   }
   return new RenderedDiv(ModelTools.getCompleteNameJAXB(classe) + "Layout");
 }
  /**
   * Instantiates a new renderable selector.
   *
   * @param assoBean the association bean
   */
  public RenderableSelector(AssociationBean assoBean) {
    super(assoBean);

    parent = null;

    String idStr;
    if (bean.isForField()) {
      String overridingType = bean.getOverridingType();
      idStr = overridingType.replaceAll(":", "_") + bean.getName() + "ListExt";
      instanceName = XFormsGenerator.getId(idStr); // #1523
      modelElementUpdater = new ModelElementUpdaterList(overridingType, instanceName, bean);
    } else if (bean.getAssociationType() == AssociationType.clazz) {
      idStr = ModelTools.getCompleteNameJAXB(bean.getDestinationClass()) + "List";
      instanceName = XFormsGenerator.getId(idStr);
      modelElementUpdater =
          new ModelElementUpdaterList(bean.getDestinationClass(), instanceName, bean);
    } else {
      idStr =
          ModelTools.getCompleteNameJAXB(bean.getDestinationSelect().getEnumeration())
              + "EnumInstance";
      instanceName = XFormsGenerator.getId(idStr);
      modelElementUpdater = new ModelElementUpdaterEnum(bean, instanceName);
    }
    instancePath = "instance('" + instanceName + "')/";
    instanceNodePath = instancePath + MsgId.INT_INSTANCE_SELECT_ITEM;

    // bindId = new ModelElementBindSimple(instancePath + MsgId.INT_INSTANCE_SELECTEDID);
    // bindLabel = new ModelElementBindSimple(instancePath + MsgId.INT_INSTANCE_SELECTEDLABEL);
    // bindMaxResults = new ModelElementBindSimple(instancePath +
    // MsgId.INT_INSTANCE_SELECTEDMAX);
    // bindType = new ModelElementBindSimple(instancePath + MsgId.INT_INSTANCE_SELECTEDTYPE);
    //
    // // bindId.setType(new QName("string"));
    // // bindLabel.setType(new QName("string"));
    // // bindMaxResults.setType(new QName("string"));
    // bindMaxResults.setHidden(true);
    // bindType.setHidden(true);

    // for workflows, we don't want anything but the list
    RenderableSelectorSearcher searcher = new RenderableSelectorSearcher(bean, this);
    RenderableSelectorList itemList = new RenderableSelectorList(bean, this);

    if (bean.isInFeatureSearchMode() && bean.isItemSelector()) {
      add(searcher);
    }

    add(itemList);
    if (bean.isItemSelector()) {
      if (bean.isNoStatsOutput() == false) {
        RenderableSelectorCount statsOutput = new RenderableSelectorCount(bean, this);
        add(statsOutput);
      }

      if (bean.isInFeatureFilterMode()) {
        add(searcher);
      }

      if (bean.isShowingActions()
          && bean.getAssociationType() == AssociationBean.AssociationType.clazz) {
        add(new RenderableSelectorCreate(bean, this));
      }
    }
  }