Package com.alkacon.vie.shared

Examples of com.alkacon.vie.shared.I_Entity


    /**
    * @see com.alkacon.vie.client.I_Vie#registerEntity(com.alkacon.vie.shared.I_Entity)
    */
    public I_Entity registerEntity(I_Entity entity) {

        I_Entity result = createEntity(entity.getId(), entity.getTypeName());
        for (I_EntityAttribute attribute : entity.getAttributes()) {
            if (attribute.isSimpleValue()) {
                for (String value : attribute.getSimpleValues()) {
                    result.addAttributeValue(attribute.getAttributeName(), value);
                }
            } else {
                for (I_Entity value : attribute.getComplexValues()) {
                    result.addAttributeValue(attribute.getAttributeName(), registerEntity(value));
                }
            }
        }
        return result;
    }
View Full Code Here


    /**
     * @see com.alkacon.vie.shared.I_Entity#createDeepCopy(java.lang.String)
     */
    public I_Entity createDeepCopy(String entityId) {

        I_Entity result = Vie.getInstance().createEntity(entityId, getTypeName());
        for (I_EntityAttribute attribute : getAttributes()) {
            if (attribute.isSimpleValue()) {
                List<String> values = attribute.getSimpleValues();
                for (String value : values) {
                    result.addAttributeValue(attribute.getAttributeName(), value);
                }
            } else {
                List<I_Entity> values = attribute.getComplexValues();
                for (I_Entity value : values) {
                    I_Entity valueCopy = ((Entity)value).createDeepCopy(null);
                    result.addAttributeValue(attribute.getAttributeName(), valueCopy);
                }
            }
        }
        return result;
View Full Code Here

    /**
     * @see com.alkacon.vie.client.I_Vie#registerEntity(com.alkacon.vie.shared.I_Entity)
     */
    public I_Entity registerEntity(I_Entity entity) {

        I_Entity result = createEntity(entity.getId(), entity.getTypeName());
        for (I_EntityAttribute attribute : entity.getAttributes()) {
            if (attribute.isSimpleValue()) {
                for (String value : attribute.getSimpleValues()) {
                    result.addAttributeValue(attribute.getAttributeName(), value);
                }
            } else {
                for (I_Entity value : attribute.getComplexValues()) {
                    result.addAttributeValue(attribute.getAttributeName(), registerEntity(value));
                }
            }
        }
        return result;
    }
View Full Code Here

    /**
     * @see com.alkacon.vie.shared.I_Entity#createDeepCopy(java.lang.String)
     */
    public I_Entity createDeepCopy(String entityId) {

        I_Entity result = Vie.getInstance().createEntity(entityId, getTypeName());
        for (I_EntityAttribute attribute : getAttributes()) {
            if (attribute.isSimpleValue()) {
                List<String> values = attribute.getSimpleValues();
                for (String value : values) {
                    result.addAttributeValue(attribute.getAttributeName(), value);
                }
            } else {
                List<I_Entity> values = attribute.getComplexValues();
                for (I_Entity value : values) {
                    result.addAttributeValue(attribute.getAttributeName(), value.createDeepCopy(null));
                }
            }
        }
        return result;
    }
View Full Code Here

                    }

                }
                valueWidget.setValueWidget(widget, defaultValue, defaultValue, true);
            } else {
                I_Entity value = m_vie.createEntity(null, getAttributeType().getId());
                insertValueAfterReference(value, reference);
            }
            UndoRedoHandler handler = UndoRedoHandler.getInstance();
            if (handler.isIntitalized()) {
                handler.addChange(m_entity.getId(), m_attributeName, reference.getValueIndex() + 1, ChangeType.add);
View Full Code Here

                } else {
                    m_entity.insertAttributeValue(m_attributeName, defaultValue, referenceIndex + 1);

                }
            } else {
                I_Entity value = m_vie.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);
                }
View Full Code Here

     * @param value the entity into which the new entities for the given path should be inserted
     * @param choicePath the path of choice attributes
     */
    public void createNestedEntitiesForChoicePath(I_Entity value, List<String> choicePath) {

        I_Entity parentValue = value;
        for (String attributeChoice : choicePath) {
            I_Type choiceType = m_vie.getType(parentValue.getTypeName()).getAttributeType(Type.CHOICE_ATTRIBUTE_NAME);
            I_Entity choice = m_vie.createEntity(null, choiceType.getId());
            parentValue.addAttributeValue(Type.CHOICE_ATTRIBUTE_NAME, choice);
            I_Type choiceOptionType = choiceType.getAttributeType(attributeChoice);
            if (choiceOptionType.isSimpleType()) {
                String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice);
                choice.addAttributeValue(attributeChoice, choiceValue);
                break;
            } else {
                I_Entity choiceValue = m_vie.createEntity(null, choiceOptionType.getId());
                choice.addAttributeValue(attributeChoice, choiceValue);
                parentValue = choiceValue;
            }
        }
    }
View Full Code Here

        valueView.removeFromParent();
        m_attributeValueViews.remove(valueView);
        AttributeValueView valueWidget = null;
        if (isChoiceHandler()) {
            removeHandlers(currentPosition);
            I_Entity value = m_entity.getAttribute(m_attributeName).getComplexValues().get(currentPosition);
            m_entity.removeAttributeValue(m_attributeName, currentPosition);
            m_entity.insertAttributeValue(m_attributeName, value, targetPosition);
            String attributeChoice = getChoiceName(targetPosition);
            I_Type optionType = getAttributeType().getAttributeType(attributeChoice);
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(attributeChoice),
                m_widgetService.getAttributeHelp(attributeChoice));
            if (optionType.isSimpleType() && m_widgetService.isDisplaySingleLine(attributeChoice)) {
                valueWidget.setCompactMode(AttributeValueView.COMPACT_MODE_SINGLE_LINE);
            }
            parent.insert(valueWidget, targetPosition);
            insertHandlers(targetPosition);
            if (optionType.isSimpleType()) {
                valueWidget.setValueWidget(
                    m_widgetService.getAttributeFormWidget(attributeChoice),
                    value.getAttribute(attributeChoice).getSimpleValue(),
                    m_widgetService.getDefaultAttributeValue(attributeChoice),
                    true);
            } else {
                valueWidget.setValueEntity(
                    m_widgetService.getRendererForAttribute(attributeChoice, getAttributeType()),
                    value.getAttribute(attributeChoice).getComplexValue());
            }

            List<ChoiceMenuEntryBean> menuEntries = Renderer.getChoiceEntries(getAttributeType(), true);
            for (ChoiceMenuEntryBean menuEntry : menuEntries) {
                valueWidget.addChoice(m_widgetService, menuEntry);
            }
        } else if (getAttributeType().isSimpleType()) {
            String value = m_entity.getAttribute(m_attributeName).getSimpleValues().get(currentPosition);
            m_entity.removeAttributeValue(m_attributeName, currentPosition);
            m_entity.insertAttributeValue(m_attributeName, value, targetPosition);
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(m_attributeName),
                m_widgetService.getAttributeHelp(m_attributeName));
            if (m_widgetService.isDisplaySingleLine(m_attributeName)) {
                valueWidget.setCompactMode(AttributeValueView.COMPACT_MODE_SINGLE_LINE);
            }
            parent.insert(valueWidget, targetPosition);
            valueWidget.setValueWidget(
                m_widgetService.getAttributeFormWidget(m_attributeName),
                value,
                m_widgetService.getDefaultAttributeValue(m_attributeName),
                true);
        } else {
            removeHandlers(currentPosition);
            I_Entity value = m_entity.getAttribute(m_attributeName).getComplexValues().get(currentPosition);
            m_entity.removeAttributeValue(m_attributeName, currentPosition);
            m_entity.insertAttributeValue(m_attributeName, value, targetPosition);
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(m_attributeName),
View Full Code Here

    private void addChoiceOption(AttributeValueView reference, List<String> choicePath) {

        String attributeChoice = choicePath.get(0);
        I_Type optionType = getAttributeType().getAttributeType(attributeChoice);
        int valueIndex = reference.getValueIndex() + 1;
        I_Entity choiceEntity = m_vie.createEntity(null, getAttributeType().getId());
        AttributeValueView valueWidget = reference;
        if (reference.hasValue()) {
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(attributeChoice),
                m_widgetService.getAttributeHelp(attributeChoice));
            if (optionType.isSimpleType() && m_widgetService.isDisplaySingleLine(attributeChoice)) {
                valueWidget.setCompactMode(AttributeValueView.COMPACT_MODE_SINGLE_LINE);
            }
        }

        List<ChoiceMenuEntryBean> menuEntries = Renderer.getChoiceEntries(getAttributeType(), true);
        for (ChoiceMenuEntryBean menuEntry : menuEntries) {
            valueWidget.addChoice(m_widgetService, menuEntry);
        }

        m_entity.insertAttributeValue(m_attributeName, choiceEntity, valueIndex);
        ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
        insertHandlers(valueWidget.getValueIndex());

        if (optionType.isSimpleType()) {
            String defaultValue = m_widgetService.getDefaultAttributeValue(attributeChoice);
            I_FormEditWidget widget = m_widgetService.getAttributeFormWidget(attributeChoice);
            choiceEntity.addAttributeValue(attributeChoice, defaultValue);
            valueWidget.setValueWidget(widget, defaultValue, defaultValue, true);
        } else {
            I_Entity value = m_vie.createEntity(null, optionType.getId());
            choiceEntity.addAttributeValue(attributeChoice, value);
            List<String> remainingAttributeNames = tail(choicePath);
            createNestedEntitiesForChoicePath(value, remainingAttributeNames);
            I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeChoice, optionType);
            valueWidget.setValueEntity(renderer, value);
View Full Code Here

     * @param reference the reference view 
     * @param choicePath the path of choice attribute names
     */
    private void addComplexChoiceValue(AttributeValueView reference, List<String> choicePath) {

        I_Entity value = m_vie.createEntity(null, getAttributeType().getId());
        I_Entity parentValue = value;
        for (String attributeChoice : choicePath) {
            I_Type choiceType = m_vie.getType(parentValue.getTypeName()).getAttributeType(Type.CHOICE_ATTRIBUTE_NAME);
            I_Entity choice = m_vie.createEntity(null, choiceType.getId());
            parentValue.addAttributeValue(Type.CHOICE_ATTRIBUTE_NAME, choice);
            I_Type choiceOptionType = choiceType.getAttributeType(attributeChoice);
            if (choiceOptionType.isSimpleType()) {
                String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice);
                choice.addAttributeValue(attributeChoice, choiceValue);
                break;
            } else {
                I_Entity choiceValue = m_vie.createEntity(null, choiceOptionType.getId());
                choice.addAttributeValue(attributeChoice, choiceValue);
                parentValue = choiceValue;
            }
        }
        insertValueAfterReference(value, reference);
View Full Code Here

TOP

Related Classes of com.alkacon.vie.shared.I_Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.