Package com.alkacon.acacia.client.ui

Examples of com.alkacon.acacia.client.ui.AttributeValueView$ChangeHandler


     */
    public void setWarningMessage(int valueIndex, String message, TabbedPanel<?> tabbedPanel) {

        if (!m_attributeValueViews.isEmpty()) {
            FlowPanel parent = (FlowPanel)m_attributeValueViews.get(0).getParent();
            AttributeValueView valueView = (AttributeValueView)parent.getWidget(valueIndex);
            valueView.setWarningMessage(message);
            if (tabbedPanel != null) {
                int tabIndex = tabbedPanel.getTabIndex(valueView.getElement());
                if (tabIndex > -1) {
                    Widget tab = tabbedPanel.getTabWidget(tabIndex);
                    tab.setTitle("This tab has warnings.");
                    tab.getParent().addStyleName(I_LayoutBundle.INSTANCE.form().hasWarning());
                }
View Full Code Here


        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);
        }
        updateButtonVisisbility();

    }
View Full Code Here

            m_entity.addAttributeValue(m_attributeName, value);
        } else {
            valueIndex = reference.getValueIndex() + 1;
            m_entity.insertAttributeValue(m_attributeName, value, valueIndex);
        }
        AttributeValueView valueWidget = reference;
        if (reference.hasValue()) {
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(m_attributeName),
                m_widgetService.getAttributeHelp(m_attributeName));
            Renderer.setAttributeChoice(m_widgetService, valueWidget, getAttributeType());
            if (valueIndex == -1) {
                ((FlowPanel)reference.getParent()).add(valueWidget);
            } else {
                ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
            }
        }
        valueIndex = valueWidget.getValueIndex();
        insertHandlers(valueIndex);
        I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
        valueWidget.setValueEntity(renderer, value);
    }
View Full Code Here

     */
    private void addChoiceOption(AttributeValueView reference, String attributeChoice) {

        I_Type optionType = getAttributeType().getAttributeType(attributeChoice);
        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));
        }
        for (String choiceName : getAttributeType().getAttributeNames()) {
            valueWidget.addChoice(
                m_widgetService.getAttributeLabel(choiceName),
                m_widgetService.getAttributeHelp(choiceName),
                choiceName);
        }
        int valueIndex = reference.getValueIndex() + 1;
        if (valueIndex < m_entity.getAttribute(m_attributeName).getValueCount()) {
            m_entity.insertAttributeValue(m_attributeName, choiceEntity, valueIndex);
            ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
        } else {
            m_entity.addAttributeValue(m_attributeName, choiceEntity);
            ((FlowPanel)reference.getParent()).add(valueWidget);

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

            m_entity.addAttributeValue(m_attributeName, value);
        } else {
            valueIndex = reference.getValueIndex() + 1;
            m_entity.insertAttributeValue(m_attributeName, value, valueIndex);
        }
        AttributeValueView valueWidget = reference;
        if (reference.hasValue()) {
            valueWidget = new AttributeValueView(
                this,
                m_widgetService.getAttributeLabel(m_attributeName),
                m_widgetService.getAttributeHelp(m_attributeName));
            if (valueIndex == -1) {
                ((FlowPanel)reference.getParent()).add(valueWidget);
            } else {
                ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
            }
        }
        I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
        valueWidget.setValueEntity(renderer, value);
    }
View Full Code Here

    /**
     * @see com.alkacon.geranium.client.dnd.I_DNDController#onDrop(com.alkacon.geranium.client.dnd.I_Draggable, com.alkacon.geranium.client.dnd.I_DropTarget, com.alkacon.geranium.client.dnd.DNDHandler)
     */
    public void onDrop(I_Draggable draggable, I_DropTarget target, DNDHandler handler) {

        AttributeValueView attributeValue = (AttributeValueView)draggable;
        int targetIndex = target.getPlaceholderIndex();
        if (targetIndex > m_startPosition) {
            targetIndex--;
        }
        attributeValue.getHandler().moveAttributeValue(attributeValue, m_startPosition, targetIndex);
        removeDragOverlay();
        clearTargets(handler);
    }
View Full Code Here

     * @see com.google.gwt.event.dom.client.MouseOverHandler#onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent)
     */
    public void onMouseOver(MouseOverEvent event) {

        if (!(event.getSource() instanceof AttributeValueView)) {
            AttributeValueView parentView = null;
            Widget source = ((Widget)event.getSource()).getParent();
            while (parentView == null) {
                if (source instanceof AttributeValueView) {
                    parentView = (AttributeValueView)source;
                } else {
View Full Code Here

                    if ((attribute == null) && (minOccurrence > 0)) {
                        attribute = createEmptyAttribute(entity, attributeName, minOccurrence);
                    }
                    if (attribute != null) {
                        for (int i = 0; i < attribute.getValueCount(); i++) {
                            AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
                            attributeElement.add(valueWidget);
                            if (attribute.isSimpleValue()) {
                                valueWidget.setValueWidget(
                                    m_widgetService.getAttributeFormWidget(attributeName),
                                    attribute.getSimpleValues().get(i),
                                    true);
                            } else {
                                valueWidget.setValueEntity(renderer, attribute.getComplexValues().get(i));

                            }
                            setAttributeChoice(valueWidget, attributeType);
                        }
                    } else {
                        AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
                        attributeElement.add(valueWidget);
                        if (attributeType.isSimpleType()) {
                            // create a deactivated widget, to add the attribute on click
                            valueWidget.setValueWidget(
                                m_widgetService.getAttributeFormWidget(attributeName),
                                m_widgetService.getDefaultAttributeValue(attributeName),
                                false);
                        }
                        setAttributeChoice(valueWidget, attributeType);
View Full Code Here

                    choiceAttribute.getAttributeName(),
                    attributeType);
                String label = m_widgetService.getAttributeLabel(choiceAttribute.getAttributeName());
                String help = m_widgetService.getAttributeHelp(choiceAttribute.getAttributeName());
                context.add(attributeElement);
                AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
                attributeElement.add(valueWidget);
                if (choiceAttribute.isSimpleValue()) {
                    valueWidget.setValueWidget(
                        m_widgetService.getAttributeFormWidget(choiceAttribute.getAttributeName()),
                        choiceAttribute.getSimpleValue(),
                        true);
                } else {
                    valueWidget.setValueEntity(renderer, choiceAttribute.getComplexValue());
                }
                setAttributeChoice(valueWidget, entityType);
            }
            handler.updateButtonVisisbility();
        } else {
            List<String> attributeNames = entityType.getAttributeNames();
            for (String attributeName : attributeNames) {
                int minOccurrence = entityType.getAttributeMinOccurrence(attributeName);
                I_EntityAttribute attribute = entity.getAttribute(attributeName);
                if ((attribute == null) && (minOccurrence > 0)) {
                    attribute = createEmptyAttribute(entity, attributeName, minOccurrence);
                }
                I_Type attributeType = entityType.getAttributeType(attributeName);
                I_EntityRenderer renderer = m_widgetService.getRendererForAttribute(attributeName, attributeType);
                String label = m_widgetService.getAttributeLabel(attributeName);
                String help = m_widgetService.getAttributeHelp(attributeName);
                ValuePanel attributeElement = new ValuePanel();
                context.add(attributeElement);
                AttributeHandler handler = new AttributeHandler(m_vie, entity, attributeName, m_widgetService);
                if (attribute != null) {
                    for (int i = 0; i < attribute.getValueCount(); i++) {
                        AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
                        attributeElement.add(valueWidget);
                        if (attribute.isSimpleValue()) {
                            valueWidget.setValueWidget(
                                m_widgetService.getAttributeFormWidget(attributeName),
                                attribute.getSimpleValues().get(i),
                                true);
                        } else {
                            valueWidget.setValueEntity(renderer, attribute.getComplexValues().get(i));
                        }
                        setAttributeChoice(valueWidget, attributeType);
                    }
                } else {
                    AttributeValueView valueWidget = new AttributeValueView(handler, label, help);
                    attributeElement.add(valueWidget);
                    if (attributeType.isSimpleType()) {
                        // create a deactivated widget, to add the attribute on click
                        valueWidget.setValueWidget(
                            m_widgetService.getAttributeFormWidget(attributeName),
                            m_widgetService.getDefaultAttributeValue(attributeName),
                            false);
                    }
                    setAttributeChoice(valueWidget, attributeType);
View Full Code Here

                } else {
                    valueIndex = reference.getValueIndex() + 1;
                    m_entity.insertAttributeValue(m_attributeName, value, valueIndex);

                }
                AttributeValueView valueWidget = reference;
                if (reference.hasValue()) {
                    valueWidget = new AttributeValueView(
                        this,
                        m_widgetService.getAttributeLabel(m_attributeName),
                        m_widgetService.getAttributeHelp(m_attributeName));
                    if (valueIndex == -1) {
                        ((FlowPanel)reference.getParent()).add(valueWidget);
                    } else {
                        ((FlowPanel)reference.getParent()).insert(valueWidget, valueIndex);
                    }

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

TOP

Related Classes of com.alkacon.acacia.client.ui.AttributeValueView$ChangeHandler

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.