// ============================================================================
//
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.components.processing.definition.fieldselector;

import org.talend.components.api.component.Connector;
import org.talend.components.api.component.PropertyPathConnector;
import org.talend.components.common.FixedConnectorsComponentProperties;
import org.talend.daikon.properties.PropertiesList;
import org.talend.daikon.properties.presentation.Form;
import org.talend.daikon.properties.presentation.Widget;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

public class FieldSelectorProperties extends FixedConnectorsComponentProperties implements Serializable {

    public PropertiesList<SelectorProperties> selectors =
            new PropertiesList<>("selectors", new PropertiesList.NestedPropertiesFactory<SelectorProperties>() {

                @Override
                public SelectorProperties createAndInit(String name) {
                    return (SelectorProperties) new SelectorProperties(name).init();
                }
            });

    public transient PropertyPathConnector INCOMING_CONNECTOR =
            new PropertyPathConnector(Connector.MAIN_NAME, "incoming");

    public transient PropertyPathConnector OUTGOING_CONNECTOR =
            new PropertyPathConnector(Connector.MAIN_NAME, "outgoing");

    public FieldSelectorProperties(String name) {
        super(name);
    }

    @Override
    protected Set<PropertyPathConnector> getAllSchemaPropertiesConnectors(boolean isOutputConnection) {
        HashSet<PropertyPathConnector> connectors = new HashSet<PropertyPathConnector>();
        if (isOutputConnection) {
            connectors.add(OUTGOING_CONNECTOR);
        } else {
            // input schema
            connectors.add(INCOMING_CONNECTOR);
        }
        return connectors;
    }

    @Override
    public void setupLayout() {
        super.setupLayout();
        Form mainForm = new Form(this, Form.MAIN);
        mainForm.addRow(Widget.widget(selectors).setWidgetType(Widget.NESTED_PROPERTIES).setConfigurationValue(
                Widget.NESTED_PROPERTIES_TYPE_OPTION, "selector"));
    }

    @Override
    public void setupProperties() {
        super.setupProperties();
        setupLayout();
        // Add a default converter
        selectors.init();
        selectors.createAndAddRow();
    }
}

@@ -584,16 +584,94 @@
 ector;%0A%0A
+import java.io.Serializable;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 import o
@@ -1023,86 +1023,8 @@
 t;%0A%0A
-import java.io.Serializable;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 publ
@@ -1122,24 +1122,74 @@
 alizable %7B%0A%0A
+    public static final int MAX_SELECTORS = 100;%0A%0A
     public P
@@ -2411,32 +2411,94 @@
 .setupLayout();%0A
+        selectors.setMaxItems(String.valueOf(MAX_SELECTORS));%0A
         Form mai

Set field selectors to 100 maxItems. (#1247)