Search in sources :

Example 1 with DynamicComposite

use of org.talend.repository.generic.ui.DynamicComposite in project tdi-studio-se by Talend.

the class GenericWizardService method creatDynamicComposite.

@Override
public Composite creatDynamicComposite(Composite composite, Element element, EComponentCategory sectionCategory, boolean isCompactView) {
    DynamicComposite dynamicComposite = null;
    if (element != null && element instanceof INode) {
        INode node = (INode) element;
        ComponentProperties props = null;
        if (node.getComponentProperties() == null) {
            props = ComponentsUtils.getComponentProperties(node.getComponent().getName());
        } else {
            props = node.getComponentProperties();
        }
        if (props != null) {
            Form form = props.getForm(EComponentCategory.ADVANCED.equals(sectionCategory) ? Form.ADVANCED : Form.MAIN);
            dynamicComposite = new DynamicComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, sectionCategory, element, isCompactView, composite.getBackground(), form);
            List<ElementParameter> elementParameters = (List<ElementParameter>) node.getElementParameters();
            for (ElementParameter parameter : elementParameters) {
                if (parameter instanceof GenericElementParameter) {
                    GenericElementParameter genericElementParameter = (GenericElementParameter) parameter;
                    genericElementParameter.callBeforePresent();
                    genericElementParameter.removePropertyChangeListener(dynamicComposite);
                    genericElementParameter.addPropertyChangeListener(dynamicComposite);
                }
            }
        }
    }
    return dynamicComposite;
}
Also used : INode(org.talend.core.model.process.INode) GenericElementParameter(org.talend.designer.core.generic.model.GenericElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) ComponentProperties(org.talend.components.api.properties.ComponentProperties) Form(org.talend.daikon.properties.presentation.Form) GenericElementParameter(org.talend.designer.core.generic.model.GenericElementParameter) DynamicComposite(org.talend.repository.generic.ui.DynamicComposite) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 ComponentProperties (org.talend.components.api.properties.ComponentProperties)1 INode (org.talend.core.model.process.INode)1 Form (org.talend.daikon.properties.presentation.Form)1 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)1 ElementParameter (org.talend.designer.core.model.components.ElementParameter)1 DynamicComposite (org.talend.repository.generic.ui.DynamicComposite)1