code: private void insertValueAfterReference(CmsEntity value, CmsAttributeValueView reference) {
  
          int valueIndex = -1;
          if (reference.getElement().getNextSiblingElement() == null) {
              m_entity.addAttributeValue(m_attributeName, value);
          } else {
              valueIndex = reference.getValueIndex() + 1;
              m_entity.insertAttributeValue(m_attributeName, value, valueIndex);
          }
          CmsAttributeValueView valueWidget = reference;
          if (reference.hasValue()) {
              valueWidget = new CmsAttributeValueView(
                  this,
                  m_widgetService.getAttributeLabel(m_attributeName),
                  m_widgetService.getAttributeHelp(m_attributeName));
              CmsRenderer.setAttributeChoice(m_widgetService, valueWidget, getAttributeType());
              if (valueIndex == -1) {
                  ((FlowPanel)reference.getParent()).add(valueWidget);
                  m_attributeValueViews.remove(valueWidget);
                  m_attributeValueViews.add(valueWidget);
              } else {
                  ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
                  m_attributeValueViews.remove(valueWidget);
                  m_attributeValueViews.add(valueIndex, valueWidget);
                  m_widgetService.addChangedOrderPath(getSimplePath(-1));
              }
  
          }
          valueIndex = valueWidget.getValueIndex();
          insertHandlers(valueIndex);
          I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
          valueWidget.setValueEntity(renderer, value);
      }
docs: Inserts an entity value after the given reference.<p>
  
  @param value the entity value
  @param reference the reference