code: public void insertNewAttributeValue(CmsEntity value, int index, Panel container) {
  
          // make sure not to add more values than allowed
          int maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName);
          CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName);
          boolean mayHaveMore = ((attribute == null) || (attribute.getValueCount() < maxOccurrence));
          if (mayHaveMore && value.getTypeName().equals(m_attributeType.getId())) {
              m_entity.insertAttributeValue(m_attributeName, value, index);
              int valueIndex = index;
              CmsAttributeValueView valueView = null;
              if ((m_attributeValueViews.size() == 1) && !m_attributeValueViews.get(0).hasValue()) {
                  valueView = m_attributeValueViews.get(0);
              } else {
                  valueView = new CmsAttributeValueView(
                      this,
                      m_widgetService.getAttributeLabel(m_attributeName),
                      m_widgetService.getAttributeHelp(m_attributeName));
              }
              CmsRenderer.setAttributeChoice(m_widgetService, valueView, getAttributeType());
              m_attributeValueViews.remove(valueView);
              m_attributeValueViews.add(index, valueView);
  
              ((FlowPanel)container).insert(valueView, index);
  
              insertHandlers(valueIndex);
  
              I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
              valueView.setValueEntity(renderer, value);
  
              CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance();
              if (handler.isIntitalized()) {
                  handler.addChange(m_entity.getId(), m_attributeName, valueIndex, ChangeType.add);
              }
          }
      }
docs: Adds a new attribute value and adds the required widgets to the editor DOM.<p>
  
  @param value the value entity
  @param index the position in which to insert the new value
  @param container the widget containing the attribute value views