Package com.alkacon.vie.shared

Examples of com.alkacon.vie.shared.I_Entity


     * @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

     * @param value the value
     */
    private void changeEntityValue(String value, int valueIndex) {

        if (getEntityType().isChoice()) {
            I_Entity choice = m_entity.getAttribute(Type.CHOICE_ATTRIBUTE_NAME).getComplexValues().get(valueIndex);
            String attributeName = getChoiceName(valueIndex);
            if (attributeName != null) {
                choice.setAttributeValue(attributeName, value, 0);
            }
        } else {
            m_entity.setAttributeValue(m_attributeName, value, valueIndex);
        }
    }
View Full Code Here

     * @return the attribute choice name
     */
    private String getChoiceName(int valueIndex) {

        if (isChoiceHandler()) {
            I_Entity choice = m_entity.getAttribute(Type.CHOICE_ATTRIBUTE_NAME).getComplexValues().get(valueIndex);
            if (choice != null) {
                for (String option : getAttributeType().getAttributeNames()) {
                    if (choice.hasAttribute(option)) {
                        return option;

                    }
                }
            }
View Full Code Here

        I_LayoutBundle.INSTANCE.form().ensureInjected();

        I_Vie vie = Vie.getInstance();
        ContentDefinition definition = generateContentDefinition();
        I_Entity person = register(vie, definition);

        WidgetService service = new WidgetService();
        service.init(definition);
        service.addWidgetFactory("string", new I_WidgetFactory() {
View Full Code Here

        I_LayoutBundle.INSTANCE.form().ensureInjected();

        I_Vie vie = Vie.getInstance();
        ContentDefinition definition = generateContentDefinition();
        I_Entity person = register(vie, definition);

        WidgetService service = new WidgetService();
        service.init(definition);
        service.addWidgetFactory("string", new I_WidgetFactory() {
View Full Code Here

                    }

                }
                valueWidget.setValueWidget(widget, value, true);
            } else {
                I_Entity value = m_vie.createEntity(null, m_attributeType.getId());
                insertValueAfterReference(value, reference);
            }
        }
        updateButtonVisisbility();
    }
View Full Code Here

        HighlightingHandler.getInstance().clearFocusHighlighting();
        if (isChoiceHandler()) {
            addChoiceOption(reference, attributeChoice);
        } else {
            I_Entity value = m_vie.createEntity(null, getAttributeType().getId());
            I_Type choiceType = getAttributeType().getAttributeType(Type.CHOICE_ATTRIBUTE_NAME);
            I_Entity choice = m_vie.createEntity(null, choiceType.getId());
            value.addAttributeValue(Type.CHOICE_ATTRIBUTE_NAME, choice);
            // create the attribute choice
            I_Type choiceOptionType = choiceType.getAttributeType(attributeChoice);
            if (choiceOptionType.isSimpleType()) {
                String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice);
                choice.addAttributeValue(attributeChoice, choiceValue);
            } else {
                I_Entity choiceValue = m_vie.createEntity(null, choiceOptionType.getId());
                choice.addAttributeValue(attributeChoice, choiceValue);
            }
            insertValueAfterReference(value, reference);
        }
        updateButtonVisisbility();
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.