Example usage for com.vaadin.ui CheckBox getValue

List of usage examples for com.vaadin.ui CheckBox getValue

Introduction

In this page you can find the example usage for com.vaadin.ui CheckBox getValue.

Prototype

@Override
    public Boolean getValue() 

Source Link

Usage

From source file:org.jpos.qi.system.LogListenerView.java

License:Open Source License

public LogEvent log(LogEvent event) {
    String r = event.getRealm();/*from   ww  w  . ja  v a 2s. co  m*/
    CheckBox cb = realms.get(r);
    if (cb != null) {
        if (!cb.getValue())
            return event; // ignore
    } else {
        getSession().getLockInstance().lock();
        try {
            cb = new CheckBox(r);
            cb.setValue(true);
            realms.put(r, cb);
            realmsLayout.setSizeUndefined();
        } finally {
            if (getSession() != null)
                getSession().getLockInstance().unlock();
        }
        realmsLayout.addComponent(cb);
    }
    sp.out(key, new FrozenLogEvent(event), BUFFER_TIMEOUT);
    return event;
}

From source file:org.jumpmind.metl.ui.views.admin.MailServerPanel.java

License:Open Source License

public MailServerPanel(final ApplicationContext context, TabbedPanel tabbedPanel) {
    this.context = context;
    this.tabbedPanel = tabbedPanel;

    final GlobalSetting hostNameSetting = getGlobalSetting(MailSession.SETTING_HOST_NAME, "localhost");
    final GlobalSetting transportSetting = getGlobalSetting(MailSession.SETTING_TRANSPORT, "smtp");
    final GlobalSetting portSetting = getGlobalSetting(MailSession.SETTING_PORT_NUMBER, "25");
    final GlobalSetting fromSetting = getGlobalSetting(MailSession.SETTING_FROM, "metl@localhost");
    final GlobalSetting usernameSetting = getGlobalSetting(MailSession.SETTING_USERNAME, "");
    final GlobalSetting passwordSetting = getGlobalSetting(MailSession.SETTING_PASSWORD, "");
    final GlobalSetting useTlsSetting = getGlobalSetting(MailSession.SETTING_USE_TLS, "false");
    final GlobalSetting useAuthSetting = getGlobalSetting(MailSession.SETTING_USE_AUTH, "false");

    FormLayout form = new FormLayout();
    form.setSpacing(true);//  ww  w  . j  av a  2s .c  o m

    ImmediateUpdateTextField hostField = new ImmediateUpdateTextField("Host name") {
        protected void save(String value) {
            saveSetting(hostNameSetting, value);
        }
    };
    hostField.setValue(hostNameSetting.getValue());
    hostField.setWidth(25f, Unit.EM);
    form.addComponent(hostField);
    hostField.focus();

    NativeSelect transportField = new NativeSelect("Transport");
    transportField.addItem("smtp");
    transportField.addItem("smtps");
    transportField.select(transportSetting.getValue() == null ? "smtp" : transportSetting.getValue());
    transportField.setNullSelectionAllowed(false);
    transportField.setImmediate(true);
    transportField.setWidth(10f, Unit.EM);
    transportField.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            saveSetting(transportSetting, (String) event.getProperty().getValue());
        }
    });
    form.addComponent(transportField);

    ImmediateUpdateTextField portField = new ImmediateUpdateTextField("Port") {
        protected void save(String value) {
            saveSetting(portSetting, value);
        }
    };
    portField.setValue(portSetting.getValue());
    portField.setWidth(25f, Unit.EM);
    form.addComponent(portField);

    ImmediateUpdateTextField fromField = new ImmediateUpdateTextField("From Address") {
        protected void save(String value) {
            saveSetting(fromSetting, value);
        }
    };
    fromField.setValue(fromSetting.getValue());
    fromField.setWidth(25f, Unit.EM);
    form.addComponent(fromField);

    CheckBox tlsField = new CheckBox("Use TLS", Boolean.valueOf(useTlsSetting.getValue()));
    tlsField.setImmediate(true);
    tlsField.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            saveSetting(useTlsSetting, ((Boolean) event.getProperty().getValue()).toString());
        }
    });
    form.addComponent(tlsField);

    final ImmediateUpdateTextField userField = new ImmediateUpdateTextField("Username") {
        protected void save(String value) {
            saveSetting(usernameSetting, value);
        }
    };
    userField.setValue(usernameSetting.getValue());
    userField.setWidth(25f, Unit.EM);

    final ImmediateUpdatePasswordField passwordField = new ImmediateUpdatePasswordField("Password") {
        protected void save(String value) {
            saveSetting(passwordSetting, value);
        }
    };
    passwordField.setValue(passwordSetting.getValue());
    passwordField.setWidth(25f, Unit.EM);

    CheckBox authField = new CheckBox("Use Authentication", Boolean.valueOf(useAuthSetting.getValue()));
    authField.setImmediate(true);
    authField.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            Boolean isEnabled = (Boolean) event.getProperty().getValue();
            saveSetting(useAuthSetting, isEnabled.toString());
            userField.setEnabled(isEnabled);
            passwordField.setEnabled(isEnabled);
        }
    });
    form.addComponent(authField);
    userField.setEnabled(authField.getValue());
    form.addComponent(userField);
    passwordField.setEnabled(authField.getValue());
    form.addComponent(passwordField);

    Button testButton = new Button("Test Connection");
    testButton.addClickListener(new TestClickListener());
    form.addComponent(testButton);

    addComponent(form);
    setMargin(true);
}

From source file:org.jumpmind.metl.ui.views.deploy.EditAgentPanel.java

License:Open Source License

public EditAgentPanel(ApplicationContext context, TabbedPanel tabbedPanel, Agent agent) {
    this.context = context;
    this.tabbedPanel = tabbedPanel;
    this.agent = agent;
    this.backgroundRefresherService = context.getBackgroundRefresherService();

    HorizontalLayout editAgentLayout = new HorizontalLayout();
    editAgentLayout.setSpacing(true);//from   w  w  w  . j  av  a 2s. c o  m
    editAgentLayout.setMargin(new MarginInfo(true, false, false, true));
    editAgentLayout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    addComponent(editAgentLayout);

    final ComboBox startModeCombo = new ComboBox("Start Mode");
    startModeCombo.setImmediate(true);
    startModeCombo.setNullSelectionAllowed(false);
    AgentStartMode[] modes = AgentStartMode.values();
    for (AgentStartMode agentStartMode : modes) {
        startModeCombo.addItem(agentStartMode.name());
    }
    startModeCombo.setValue(agent.getStartMode());
    startModeCombo.addValueChangeListener(event -> {
        agent.setStartMode((String) startModeCombo.getValue());
        context.getConfigurationService().save((AbstractObject) EditAgentPanel.this.agent);
    });

    editAgentLayout.addComponent(startModeCombo);
    editAgentLayout.setComponentAlignment(startModeCombo, Alignment.BOTTOM_LEFT);

    Button parameterButton = new Button("Parameters");
    parameterButton.addClickListener(new ParameterClickListener());
    editAgentLayout.addComponent(parameterButton);
    editAgentLayout.setComponentAlignment(parameterButton, Alignment.BOTTOM_LEFT);

    HorizontalLayout buttonGroup = new HorizontalLayout();

    final TextField hostNameField = new TextField("Hostname");
    hostNameField.setImmediate(true);
    hostNameField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    hostNameField.setTextChangeTimeout(100);
    hostNameField.setWidth(20, Unit.EM);
    hostNameField.setNullRepresentation("");
    hostNameField.setValue(agent.getHost());
    hostNameField.addValueChangeListener(event -> {
        agent.setHost((String) hostNameField.getValue());
        EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent);
        EditAgentPanel.this.context.getAgentManager().refresh(agent);
    });

    buttonGroup.addComponent(hostNameField);
    buttonGroup.setComponentAlignment(hostNameField, Alignment.BOTTOM_LEFT);

    Button getHostNameButton = new Button("Get Host");
    getHostNameButton.addClickListener(event -> hostNameField.setValue(AppUtils.getHostName()));
    buttonGroup.addComponent(getHostNameButton);
    buttonGroup.setComponentAlignment(getHostNameButton, Alignment.BOTTOM_LEFT);

    editAgentLayout.addComponent(buttonGroup);
    editAgentLayout.setComponentAlignment(buttonGroup, Alignment.BOTTOM_LEFT);

    Button exportButton = new Button("Export Agent Config", event -> exportConfiguration());
    editAgentLayout.addComponent(exportButton);
    editAgentLayout.setComponentAlignment(exportButton, Alignment.BOTTOM_LEFT);

    CheckBox autoRefresh = new CheckBox("Auto Refresh", Boolean.valueOf(agent.isAutoRefresh()));
    autoRefresh.setImmediate(true);
    autoRefresh.addValueChangeListener(event -> {
        agent.setAutoRefresh(autoRefresh.getValue());
        EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent);
        EditAgentPanel.this.context.getAgentManager().refresh(agent);
    });
    editAgentLayout.addComponent(autoRefresh);
    editAgentLayout.setComponentAlignment(autoRefresh, Alignment.BOTTOM_LEFT);

    CheckBox allowTestFlowsField = new CheckBox("Allow Test Flows", Boolean.valueOf(agent.isAllowTestFlows()));
    allowTestFlowsField.setImmediate(true);
    allowTestFlowsField.addValueChangeListener(event -> {
        agent.setAllowTestFlows(allowTestFlowsField.getValue());
        EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent);
        EditAgentPanel.this.context.getAgentManager().refresh(agent);
    });
    editAgentLayout.addComponent(allowTestFlowsField);
    editAgentLayout.setComponentAlignment(allowTestFlowsField, Alignment.BOTTOM_LEFT);

    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);

    addDeploymentButton = buttonBar.addButton("Add Deployment", Icons.DEPLOYMENT);
    addDeploymentButton.addClickListener(new AddDeploymentClickListener());

    editButton = buttonBar.addButton("Edit", FontAwesome.EDIT);
    editButton.addClickListener(event -> editClicked());

    enableButton = buttonBar.addButton("Enable", FontAwesome.CHAIN);
    enableButton.addClickListener(event -> enableClicked());

    disableButton = buttonBar.addButton("Disable", FontAwesome.CHAIN_BROKEN);
    disableButton.addClickListener(event -> disableClicked());

    removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O);
    removeButton.addClickListener(event -> removeClicked());

    runButton = buttonBar.addButton("Run", Icons.RUN);
    runButton.addClickListener(event -> runClicked());

    container = new BeanItemContainer<AgentDeploymentSummary>(AgentDeploymentSummary.class);
    container.setItemSorter(new TableItemSorter());

    table = new Table();
    table.setSizeFull();
    table.setCacheRate(100);
    table.setPageLength(100);
    table.setImmediate(true);
    table.setSelectable(true);
    table.setMultiSelect(true);

    table.setContainerDataSource(container);
    table.setVisibleColumns("name", "projectName", "type", "status", "logLevel", "startType",
            "startExpression");
    table.setColumnHeaders("Deployment", "Project", "Type", "Status", "Log Level", "Start Type",
            "Start Expression");
    table.addGeneratedColumn("status", new StatusRenderer());
    table.addItemClickListener(new TableItemClickListener());
    table.addValueChangeListener(new TableValueChangeListener());
    table.setSortContainerPropertyId("type");
    table.setSortAscending(true);

    addComponent(table);
    setExpandRatio(table, 1.0f);
    refresh();
    setButtonsEnabled();
    backgroundRefresherService.register(this);
}

From source file:org.jumpmind.metl.ui.views.design.EditDataDiffPanel.java

License:Open Source License

protected CheckBox createEntityCheckBox(final EntitySettings settings, final String key) {
    final CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);//from w w  w  . ja v a  2  s .co  m
    checkBox.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            ComponentEntitySetting setting = component.getSingleEntitySetting(settings.getEntityId(), key);

            String oldValue = setting == null ? Boolean.TRUE.toString() : setting.getValue();
            if (setting == null) {
                setting = new ComponentEntitySetting(settings.getEntityId(), component.getId(), key,
                        Boolean.TRUE.toString());
                component.addEntitySetting(setting);
            }
            setting.setValue(checkBox.getValue().toString());
            if (!oldValue.equals(setting.getValue())) {
                context.getConfigurationService().save(setting);
            }
        }
    });
    checkBox.setReadOnly(readOnly);
    return checkBox;
}

From source file:org.jumpmind.metl.ui.views.design.EditDataDiffPanel.java

License:Open Source License

protected CheckBox createAttributeCheckBox(final AttributeSettings settings, final String key) {
    final CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);// w w w.  j a va 2  s.c  om
    if (settings.isPrimaryKey()) {
        checkBox.setEnabled(false);
    }
    checkBox.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            ComponentAttributeSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(),
                    key);

            String oldValue = setting == null ? Boolean.TRUE.toString() : setting.getValue();
            if (setting == null) {
                setting = new ComponentAttributeSetting(settings.getAttributeId(), component.getId(), key,
                        Boolean.TRUE.toString());
                component.addAttributeSetting(setting);
            }
            setting.setValue(checkBox.getValue().toString());
            if (!oldValue.equals(setting.getValue())) {
                context.getConfigurationService().save(setting);
            }
        }
    });
    checkBox.setReadOnly(readOnly);
    return checkBox;
}

From source file:org.jumpmind.metl.ui.views.design.EditDeduperPanel.java

License:Open Source License

protected CheckBox createAttributeCheckBox(final AttributeSettings settings, final String key) {
    final CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);/*from   w w  w. ja va2  s  . c om*/
    checkBox.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            ComponentAttributeSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(),
                    key);

            String oldValue = setting == null ? Boolean.FALSE.toString() : setting.getValue();
            if (setting == null) {
                setting = new ComponentAttributeSetting(settings.getAttributeId(), component.getId(), key,
                        Boolean.TRUE.toString());
                component.addAttributeSetting(setting);
            }
            setting.setValue(checkBox.getValue().toString());
            if (!oldValue.equals(setting.getValue())) {
                context.getConfigurationService().save(setting);
            }
        }
    });
    checkBox.setReadOnly(readOnly);
    return checkBox;
}

From source file:org.jumpmind.metl.ui.views.design.EditMergerPanel.java

License:Open Source License

private CheckBox createCheckBox(final AttributeSettings settings, final String key) {
    final CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);/*w w  w .  j  a  v a  2s.c o m*/
    checkBox.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            ComponentAttributeSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(),
                    key);

            String oldValue = setting == null ? Boolean.FALSE.toString() : setting.getValue();
            if (setting == null) {
                setting = new ComponentAttributeSetting(settings.getAttributeId(), component.getId(), key,
                        Boolean.TRUE.toString());
                component.addAttributeSetting(setting);
            }
            setting.setValue(checkBox.getValue().toString());
            if (!oldValue.equals(setting.getValue())) {
                context.getConfigurationService().save(setting);
            }
        }
    });
    checkBox.setReadOnly(readOnly);
    return checkBox;

}

From source file:org.jumpmind.metl.ui.views.design.EditRdbmsWriterPanel.java

License:Open Source License

private CheckBox createCheckBox(final AttributeSettings settings, final String key) {
    final CheckBox checkBox = new CheckBox();
    checkBox.setImmediate(true);//from   w  w w .  j  a  v  a2  s  .c om
    if (!readOnly) {
        checkBox.addValueChangeListener((event) -> {
            ComponentAttributeSetting setting = component.getSingleAttributeSetting(settings.getAttributeId(),
                    key);

            String oldValue = setting == null ? Boolean.TRUE.toString() : setting.getValue();
            if (setting == null) {
                setting = new ComponentAttributeSetting(settings.getAttributeId(), component.getId(), key,
                        Boolean.TRUE.toString());
                component.addAttributeSetting(setting);
            }
            setting.setValue(checkBox.getValue().toString());
            if (!oldValue.equals(setting.getValue())) {
                context.getConfigurationService().save(setting);
            }
        });
    }
    checkBox.setReadOnly(readOnly);
    return checkBox;
}

From source file:org.jumpmind.metl.ui.views.design.PropertySheet.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void addCommonComponentSettings(FormLayout formLayout, Object obj) {
    List<Object> list = (List<Object>) obj;
    List<Component> components = new ArrayList<Component>(list.size());

    // Check if all selected components support the enabled property
    // TODO: Support more than the enable component.
    // Look for all common parameters.
    boolean supportEnable = true;
    boolean enabled = true;
    for (Object o : list) {
        if (o instanceof FlowStep) {
            Component component = ((FlowStep) o).getComponent();
            if (!hasSetting(component, AbstractComponentRuntime.ENABLED)) {
                supportEnable = false;/*from   w w w  .  ja  v a  2  s.c  o  m*/
                break;
            }
            if (enabled && !component.getBoolean(AbstractComponentRuntime.ENABLED, true)) {
                enabled = false;
            }
            components.add(component);
        } else {
            supportEnable = false;
            break;
        }
    }

    // Create the enabled field if all selected components support the
    // enabled setting.
    if (components.size() != 0 && supportEnable) {
        final CheckBox checkBox = new CheckBox("Enabled");
        checkBox.setImmediate(true);
        checkBox.setRequired(true);
        checkBox.setValue(enabled);
        checkBox.addValueChangeListener((event) -> {
            for (final Component component : components) {
                saveSetting(AbstractComponentRuntime.ENABLED, checkBox.getValue().toString(), component);
            }
            if (listener != null) {
                listener.componentChanged(components);
            }
        });
        checkBox.setReadOnly(readOnly);
        formLayout.addComponent(checkBox);
    }
}

From source file:org.jumpmind.metl.ui.views.design.PropertySheet.java

License:Open Source License

protected void addSettingField(final XMLSetting definition, final AbstractObjectWithSettings obj,
        FormLayout formLayout) {//from www. ja v  a 2  s  .  c o  m
    boolean required = definition.isRequired();
    if (definition.isVisible()) {
        Component component = null;
        if (obj instanceof Component) {
            component = (Component) obj;
        }
        String description = definition.getDescription();
        Type type = definition.getType();
        FlowStep step = null;
        switch (type) {
        case BOOLEAN:
            final CheckBox checkBox = new CheckBox(definition.getName());
            checkBox.setImmediate(true);
            boolean defaultValue = false;
            if (isNotBlank(definition.getDefaultValue())) {
                defaultValue = Boolean.parseBoolean(definition.getDefaultValue());
            }
            checkBox.setValue(obj.getBoolean(definition.getId(), defaultValue));
            checkBox.setRequired(required);
            checkBox.setDescription(description);

            checkBox.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    saveSetting(definition.getId(), checkBox.getValue().toString(), obj);
                    if (listener != null) {
                        List<Component> components = new ArrayList<Component>(1);
                        components.add((Component) obj);
                        listener.componentChanged(components);
                    }
                }
            });
            checkBox.setReadOnly(readOnly);
            formLayout.addComponent(checkBox);
            break;
        case CHOICE:
            final AbstractSelect choice = new ComboBox(definition.getName());
            choice.setImmediate(true);
            List<String> choices = definition.getChoices() != null ? definition.getChoices().getChoice()
                    : new ArrayList<String>(0);
            for (String c : choices) {
                choice.addItem(c);
            }
            choice.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            choice.setDescription(description);
            choice.setNullSelectionAllowed(false);
            choice.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 1L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    saveSetting(definition.getId(), (String) choice.getValue(), obj);
                }
            });
            choice.setReadOnly(readOnly);
            formLayout.addComponent(choice);
            break;
        case PASSWORD:
            ImmediateUpdatePasswordField passwordField = new ImmediateUpdatePasswordField(
                    definition.getName()) {
                private static final long serialVersionUID = 1L;

                protected void save(String text) {
                    saveSetting(definition.getId(), text, obj);
                };
            };
            passwordField.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            passwordField.setRequired(required);
            passwordField.setDescription(description);
            passwordField.setReadOnly(readOnly);
            formLayout.addComponent(passwordField);
            break;
        case INTEGER:
            ImmediateUpdateTextField integerField = new ImmediateUpdateTextField(definition.getName()) {
                private static final long serialVersionUID = 1L;

                protected void save(String text) {
                    saveSetting(definition.getId(), text, obj);
                };
            };
            integerField.setConverter(Integer.class);
            integerField.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            integerField.setRequired(required);
            integerField.setDescription(description);
            integerField.setReadOnly(readOnly);
            formLayout.addComponent(integerField);
            break;
        case TEXT:
            ImmediateUpdateTextField textField = new ImmediateUpdateTextField(definition.getName()) {
                private static final long serialVersionUID = 1L;

                protected void save(String text) {
                    saveSetting(definition.getId(), text, obj);
                };
            };
            textField.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            textField.setRequired(required);
            textField.setDescription(description);
            textField.setReadOnly(readOnly);
            formLayout.addComponent(textField);
            break;
        case SOURCE_STEP:
            step = getSingleFlowStep();
            if (step != null) {
                Flow flow = context.getConfigurationService().findFlow(step.getFlowId());
                final AbstractSelect sourceStepsCombo = new ComboBox(definition.getName());
                sourceStepsCombo.setImmediate(true);

                List<FlowStepLink> sourceSteps = flow.findFlowStepLinksWithTarget(step.getId());
                for (FlowStepLink flowStepLink : sourceSteps) {
                    FlowStep sourceStep = flow.findFlowStepWithId(flowStepLink.getSourceStepId());
                    sourceStepsCombo.addItem(sourceStep.getId());
                    sourceStepsCombo.setItemCaption(sourceStep.getId(), sourceStep.getName());
                }
                sourceStepsCombo.setValue(obj.get(definition.getId()));
                sourceStepsCombo.setDescription(description);
                sourceStepsCombo.setNullSelectionAllowed(false);
                sourceStepsCombo.addValueChangeListener(new ValueChangeListener() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        saveSetting(definition.getId(), (String) sourceStepsCombo.getValue(), obj);
                    }
                });
                sourceStepsCombo.setReadOnly(readOnly);
                formLayout.addComponent(sourceStepsCombo);
            }
            break;
        case FLOW:
            step = getSingleFlowStep();
            if (step != null) {
                String projectVersionId = step.getComponent().getProjectVersionId();
                List<FlowName> flows = context.getConfigurationService().findFlowsInProject(projectVersionId,
                        false);
                final AbstractSelect combo = new ComboBox(definition.getName());
                combo.setImmediate(true);
                for (FlowName name : flows) {
                    if (!step.getFlowId().equals(name.getId())) {
                        combo.addItem(name.getId());
                        combo.setItemCaption(name.getId(), name.getName());
                    }
                }
                combo.setValue(obj.get(definition.getId()));
                combo.setDescription(description);
                combo.setNullSelectionAllowed(false);
                combo.addValueChangeListener(new ValueChangeListener() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        saveSetting(definition.getId(), (String) combo.getValue(), obj);
                    }
                });
                combo.setReadOnly(readOnly);
                formLayout.addComponent(combo);
            }
            break;
        case STREAMABLE_RESOURCE:
            formLayout.addComponent(createResourceCombo(definition, obj, ResourceCategory.STREAMABLE));
            break;
        case DATASOURCE_RESOURCE:
            formLayout.addComponent(createResourceCombo(definition, obj, ResourceCategory.DATASOURCE));
            break;
        case ENTITY_COLUMN:
            if (component != null) {
                List<ModelEntity> entities = new ArrayList<ModelEntity>();
                Model model = component.getInputModel();
                if (model != null) {
                    model.sortAttributes();
                    entities.addAll(model.getModelEntities());
                }
                model = component.getOutputModel();
                if (model != null) {
                    model.sortAttributes();
                    entities.addAll(model.getModelEntities());
                }
                AbstractObjectNameBasedSorter.sort(entities);

                final AbstractSelect entityColumnCombo = new ComboBox(definition.getName());
                entityColumnCombo.setImmediate(true);

                for (ModelEntity modelEntity : entities) {
                    for (ModelAttribute attribute : modelEntity.getModelAttributes()) {
                        entityColumnCombo.addItem(attribute.getId());
                        entityColumnCombo.setItemCaption(attribute.getId(),
                                modelEntity.getName() + "." + attribute.getName());
                    }
                }
                String currentValue = obj.get(definition.getId());
                if (currentValue != null) {
                    entityColumnCombo.setValue(obj.get(definition.getId()));
                }
                entityColumnCombo.setDescription(description);
                entityColumnCombo.setNullSelectionAllowed(definition.isRequired());
                entityColumnCombo.addValueChangeListener(new ValueChangeListener() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        saveSetting(definition.getId(), (String) entityColumnCombo.getValue(), obj);
                    }
                });
                entityColumnCombo.setReadOnly(readOnly);
                formLayout.addComponent(entityColumnCombo);
            }
            break;
        case SCRIPT:
            final AceEditor editor = CommonUiUtils.createAceEditor();
            editor.setTextChangeEventMode(TextChangeEventMode.LAZY);
            editor.setTextChangeTimeout(200);
            editor.setMode(AceMode.java);
            editor.setHeight(10, Unit.EM);
            editor.setCaption(definition.getName());
            editor.setShowGutter(false);
            editor.setShowPrintMargin(false);
            editor.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            editor.addTextChangeListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    Setting data = obj.findSetting(definition.getId());
                    data.setValue(event.getText());
                    context.getConfigurationService().save(data);
                }
            });
            editor.setReadOnly(readOnly);
            formLayout.addComponent(editor);
            break;
        case MULTILINE_TEXT:
        case XML:
            ImmediateUpdateTextArea area = new ImmediateUpdateTextArea(definition.getName()) {
                private static final long serialVersionUID = 1L;

                protected void save(String text) {
                    saveSetting(definition.getId(), text, obj);
                };
            };
            area.setValue(obj.get(definition.getId(), definition.getDefaultValue()));
            area.setRows(5);
            area.setRequired(required);
            area.setDescription(description);
            area.setReadOnly(readOnly);
            formLayout.addComponent(area);
            break;
        default:
            break;

        }
    }
}