public void addNewAttributeValueToEntity(int referenceIndex) {

        // 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) {
            if (getAttributeType().isSimpleType()) {
                String defaultValue = m_widgetService.getDefaultAttributeValue(
                    m_attributeName,
                    getSimplePath(referenceIndex + 1));
                if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) {
                    m_entity.addAttributeValue(m_attributeName, defaultValue);
                } else {
                    m_entity.insertAttributeValue(m_attributeName, defaultValue, referenceIndex + 1);
                    m_widgetService.addChangedOrderPath(getSimplePath(-1));
                }
            } else {
                CmsEntity value = m_entityBackEnd.createEntity(null, m_attributeType.getId());
                if ((attribute == null) || (attribute.getValueCount() == (referenceIndex + 1))) {
                    m_entity.addAttributeValue(m_attributeName, value);
                } else {
                    m_entity.insertAttributeValue(m_attributeName, value, referenceIndex + 1);
                    m_widgetService.addChangedOrderPath(getSimplePath(-1));
                }
                insertHandlers(referenceIndex + 1);
            }
        }
    }
public void addNewAttributeValueToEntity ( int referenceIndex ) { int maxOccurrence = getEntityType ( ) . getAttributeMaxOccurrence ( m_attributeName ) ; CmsEntityAttribute attribute = m_entity . getAttribute ( m_attributeName ) ; boolean mayHaveMore = ( ( attribute == null ) || ( attribute . getValueCount ( ) < maxOccurrence ) ) ; if ( mayHaveMore ) { if ( getAttributeType ( ) . isSimpleType ( ) ) { String defaultValue = m_widgetService . getDefaultAttributeValue ( m_attributeName , getSimplePath ( referenceIndex + 1 ) ) ; if ( ( attribute == null ) || ( attribute . getValueCount ( ) == ( referenceIndex + 1 ) ) ) { m_entity . addAttributeValue ( m_attributeName , defaultValue ) ; } else { m_entity . insertAttributeValue ( m_attributeName , defaultValue , referenceIndex + 1 ) ; m_widgetService . addChangedOrderPath ( getSimplePath ( - 1 ) ) ; } } else { CmsEntity value = m_entityBackEnd . createEntity ( null , m_attributeType . getId ( ) ) ; if ( ( attribute == null ) || ( attribute . getValueCount ( ) == ( referenceIndex + 1 ) ) ) { m_entity . addAttributeValue ( m_attributeName , value ) ; } else { m_entity . insertAttributeValue ( m_attributeName , value , referenceIndex + 1 ) ; m_widgetService . addChangedOrderPath ( getSimplePath ( - 1 ) ) ; } insertHandlers ( referenceIndex + 1 ) ; } } }
Adds a new attribute value below the reference index.<p>
This will not execute any DOM manipulations.<p>

@param referenceIndex the reference value index