当前位置: 首页>>代码示例>>Java>>正文


Java ComboBox.setRequired方法代码示例

本文整理汇总了Java中com.vaadin.ui.ComboBox.setRequired方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setRequired方法的具体用法?Java ComboBox.setRequired怎么用?Java ComboBox.setRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPolicyComboBox

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getPolicyComboBox(List<PolicyDto> policyDtoList) {
	ComboBox policy = new ComboBox("Select Policy");
	policy.setTextInputAllowed(false);
	policy.setNullSelectionAllowed(false);
	policy.setImmediate(true);
	policy.setRequired(true);
	policy.setRequiredError("Policy cannot be empty");

	BeanItemContainer<PolicyDto> policyListContainer = new BeanItemContainer<>(PolicyDto.class,
			policyDtoList);
	policy.setContainerDataSource(policyListContainer);
	policy.setItemCaptionPropertyId("policyName");

	if (policyListContainer.size() > 0) {
		policy.select(policyListContainer.getIdByIndex(0));
	}

	policy.setEnabled(false);

	return policy;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:22,代码来源:BindSecurityGroupWindow.java

示例2: getPropertyField

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Field getPropertyField(FormProperty formProperty) {
  ComboBox comboBox = new ComboBox(getPropertyLabel(formProperty));
  comboBox.setRequired(formProperty.isRequired());
  comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
  comboBox.setEnabled(formProperty.isWritable());

  Map<String, String> values = (Map<String, String>) formProperty.getType().getInformation("values");
  if (values != null) {
    for (Entry<String, String> enumEntry : values.entrySet()) {
      // Add value and label (if any)
      comboBox.addItem(enumEntry.getKey());
      if (enumEntry.getValue() != null) {
        comboBox.setItemCaption(enumEntry.getKey(), enumEntry.getValue());
      }
    }
  }
  return comboBox;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:EnumFormPropertyRenderer.java

示例3: getFailurePolicyComboBox

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getFailurePolicyComboBox() {
	ComboBox failurePolicy = new ComboBox("Select Failure Policy");
	failurePolicy.setTextInputAllowed(false);
	failurePolicy.setNullSelectionAllowed(false);
	failurePolicy.setImmediate(true);
	failurePolicy.setRequired(true);
	failurePolicy.setRequiredError("Failure Policy cannot be empty");

	failurePolicy.addItems(FailurePolicyType.FAIL_OPEN, FailurePolicyType.FAIL_CLOSE);
	failurePolicy.select(FailurePolicyType.FAIL_OPEN);
	failurePolicy.setEnabled(false);

	return failurePolicy;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:15,代码来源:BindSecurityGroupWindow.java

示例4: buildMainLayout

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(false);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// comboBoxCategories
	comboBoxCategories = new ComboBox();
	comboBoxCategories.setCaption("Select A Category");
	comboBoxCategories.setImmediate(false);
	comboBoxCategories.setWidth("-1px");
	comboBoxCategories.setHeight("-1px");
	comboBoxCategories.setInvalidAllowed(false);
	comboBoxCategories.setRequired(true);
	mainLayout.addComponent(comboBoxCategories);
	mainLayout.setExpandRatio(comboBoxCategories, 1.0f);
	
	// horizontalLayout_2
	horizontalLayout_2 = buildHorizontalLayout_2();
	mainLayout.addComponent(horizontalLayout_2);
	mainLayout.setExpandRatio(horizontalLayout_2, 1.0f);
	
	return mainLayout;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:33,代码来源:AttributeStandardSelectorComponent.java

示例5: decorate

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * Decorate.
 * 
 * @param caption
 *            caption of the combobox
 * @param height
 *            as H
 * @param width
 *            as W
 * @param style
 *            as style
 * @param styleName
 *            as style name
 * @param required
 *            as T|F
 * @param data
 *            as data
 * @param prompt
 *            as promt
 * @return ComboBox as comp
 */
public static ComboBox decorate(final String caption, final String width, final String style,
        final String styleName, final boolean required, final String data, final String prompt) {
    final ComboBox spUICombo = new ComboBox();
    // Default settings
    spUICombo.setRequired(required);
    spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);

    if (!StringUtils.isEmpty(caption)) {
        spUICombo.setCaption(caption);
    }
    // Add style
    if (!StringUtils.isEmpty(style)) {
        spUICombo.setStyleName(style);
    }
    // Add style Name
    if (!StringUtils.isEmpty(styleName)) {
        spUICombo.addStyleName(styleName);
    }
    // AddWidth
    if (!StringUtils.isEmpty(width)) {
        spUICombo.setWidth(width);
    }
    // Set prompt
    if (!StringUtils.isEmpty(prompt)) {
        spUICombo.setInputPrompt(prompt);
    }
    // Set Data
    if (!StringUtils.isEmpty(data)) {
        spUICombo.setData(data);
    }

    return spUICombo;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:55,代码来源:SPUIComboBoxDecorator.java

示例6: getComboBox

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * @return
 */
private Field<?> getComboBox(String requiredErrorMsg, Collection<?> items) {
	ComboBox comboBox = new ComboBox();
	comboBox.setNullSelectionAllowed(true);
	IndexedContainer container = new IndexedContainer(items);
	comboBox.setContainerDataSource(container);
	comboBox.setRequired(true);
	comboBox.setRequiredError(requiredErrorMsg);
	return comboBox;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:13,代码来源:EditableGrid.java

示例7: LoanCalculatorForm

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public LoanCalculatorForm() {
    super("Рассчет кредита и подбор кредитного продукта");

    final VerticalLayout mainLayout = new VerticalLayout();

    final ExtaFormLayout paramForm = new ExtaFormLayout();
    paramForm.addComponent(new FormGroupHeader("Параметры кредита"));
    priceField = new EditField("Стоимость техники", "Введите стоимость техники");
    priceField.setRequired(true);
    downpaymentField = new PercentOfField("Первоначальный взнос", "Введите сумму первоначального взноса по кредиту");
    downpaymentField.setRequired(true);
    paramForm.addComponent(downpaymentField);

    periodField = new ComboBox("Срок кредитования");
    periodField.setDescription("Введите период кредитования (срок кредита)");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками кредита
    fillPeriodFieldItems();
    paramForm.addComponent(periodField);

    summField = new EditField("Сумма кредита", "Введите сумму кредита (Также может рассчитываться автоматически)");
    summField.setRequired(true);
    paramForm.addComponent(summField);


    mainLayout.addComponent(paramForm);

    setContent(mainLayout);
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:33,代码来源:LoanCalculatorForm.java

示例8: buildHorizontalLayoutHeader

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private HorizontalLayout buildHorizontalLayoutHeader() {
	// common part: create layout
	horizontalLayoutHeader = new HorizontalLayout();
	horizontalLayoutHeader.setImmediate(false);
	horizontalLayoutHeader.setWidth("100.0%");
	horizontalLayoutHeader.setHeight("-1px");
	horizontalLayoutHeader.setMargin(true);
	horizontalLayoutHeader.setSpacing(true);
	
	// workNumberField
	workNumberField = new TextField();
	workNumberField.setCaption("Número Trabajador");
	workNumberField.setImmediate(false);
	workNumberField.setWidth("110px");
	workNumberField.setHeight("-1px");
	workNumberField.setRequired(true);
	horizontalLayoutHeader.addComponent(workNumberField);
	
	// employeeAgentStatusField
	employeeAgentStatusField = new ComboBox();
	employeeAgentStatusField.setCaption("Estado");
	employeeAgentStatusField.setImmediate(false);
	employeeAgentStatusField.setWidth("-1px");
	employeeAgentStatusField.setHeight("-1px");
	employeeAgentStatusField.setRequired(true);
	horizontalLayoutHeader.addComponent(employeeAgentStatusField);
	horizontalLayoutHeader.setExpandRatio(employeeAgentStatusField, 1.0f);
	horizontalLayoutHeader.setComponentAlignment(employeeAgentStatusField,
			new Alignment(6));
	
	return horizontalLayoutHeader;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:34,代码来源:EmployeeAgentViewForm.java

示例9: buildHorizontalLayout_2

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_2() {
	// common part: create layout
	horizontalLayout_2 = new HorizontalLayout();
	horizontalLayout_2.setImmediate(false);
	horizontalLayout_2.setWidth("100.0%");
	horizontalLayout_2.setHeight("-1px");
	horizontalLayout_2.setMargin(false);
	horizontalLayout_2.setSpacing(true);
	
	// nameField
	nameField = new TextField();
	nameField.setCaption("Nombre");
	nameField.setImmediate(false);
	nameField.setWidth("100.0%");
	nameField.setHeight("-1px");
	nameField.setTabIndex(1);
	nameField.setRequired(true);
	horizontalLayout_2.addComponent(nameField);
	horizontalLayout_2.setExpandRatio(nameField, 1.0f);
	
	// calendarTypeField
	calendarTypeField = new ComboBox();
	calendarTypeField.setCaption("Tipo calendario");
	calendarTypeField.setImmediate(false);
	calendarTypeField.setWidth("-1px");
	calendarTypeField.setHeight("-1px");
	calendarTypeField.setTabIndex(3);
	calendarTypeField.setRequired(true);
	horizontalLayout_2.addComponent(calendarTypeField);
	
	return horizontalLayout_2;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:34,代码来源:CalendarViewForm.java

示例10: populateServiceTable

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void populateServiceTable() throws Exception {
	// TODO: Future. Convert this table into Bean container and add DTOs in
	// it.
	// creating Virtual System Table
	this.serviceTable.addContainerProperty(PROPERTY_ID_CHAIN_ORDER, Long.class, null);
	this.serviceTable.addContainerProperty(PROPERTY_ID_ENABLED, Boolean.class, false);
	this.serviceTable.addContainerProperty(PROPERTY_ID_DA, String.class, null);
	this.serviceTable.addContainerProperty(PROPERTY_ID_POLICY, ComboBox.class, null);
	this.serviceTable.addContainerProperty(PROPERTY_ID_FAILURE_POLICY, ComboBox.class, null);

	this.serviceTable.removeAllItems();

	this.allBindings = this.listSecurityGroupBindingsBySgService
			.dispatch(new BaseIdRequest(this.currentSecurityGroup.getId())).getMemberList();

	for (VirtualSystemPolicyBindingDto binding : this.allBindings) {
		List<PolicyDto> policies = binding.getPolicies();
		ComboBox policyComboBox = getPolicyComboBox(policies);
		policyComboBox.setRequired(policies != null && policies.size() > 0);

		ComboBox failurePolicyComboBox = getFailurePolicyComboBox();

		this.serviceTable.addItem(
				new Object[] { binding.getOrder(), binding.getName(), policyComboBox, failurePolicyComboBox },
				binding.getVirtualSystemId());

		if (binding.isBinded() && !binding.getPolicyIds().isEmpty()) {
			// For any existing bindings, set enabled and set the order
			// value
			this.serviceTable.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_ENABLED)
					.setValue(true);

			ComboBox comboBoxPolicy = (ComboBox) this.serviceTable
					.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_POLICY).getValue();
			comboBoxPolicy.setEnabled(policies != null && !isBindedWithMultiplePolicies(binding));
			for (Object comboBoxItemId : comboBoxPolicy.getContainerDataSource().getItemIds()) {
				if (comboBoxPolicy.getItem(comboBoxItemId).getItemProperty("id").getValue()
						.equals(binding.getPolicyIds().iterator().next())) {
					comboBoxPolicy.select(comboBoxItemId);
					break;
				}
			}
		}

		ComboBox comboBoxFailurePolicy = (ComboBox) this.serviceTable
				.getContainerProperty(binding.getVirtualSystemId(), PROPERTY_ID_FAILURE_POLICY).getValue();
		if (binding.getFailurePolicyType() != FailurePolicyType.NA) {
			if (binding.isBinded()) {
				comboBoxFailurePolicy.setEnabled(true);
			}
			comboBoxFailurePolicy.setData(binding.getFailurePolicyType());
			comboBoxFailurePolicy.select(binding.getFailurePolicyType());
		} else {
			comboBoxFailurePolicy.setData(null);
			comboBoxFailurePolicy.setEnabled(false);
		}
	}

	sortByChainOrder();
	if (this.serviceTable.getItemIds().size() > 0) {
		this.serviceTable.select(this.serviceTable.getItemIds().iterator().next());
	}
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:65,代码来源:BindSecurityGroupWindow.java

示例11: buildMainLayout

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// comboBoxDatatype
	comboBoxDatatype = new ComboBox();
	comboBoxDatatype.setCaption("Select Datatype");
	comboBoxDatatype.setImmediate(false);
	comboBoxDatatype.setWidth("-1px");
	comboBoxDatatype.setHeight("-1px");
	comboBoxDatatype.setInvalidAllowed(false);
	comboBoxDatatype.setRequired(true);
	mainLayout.addComponent(comboBoxDatatype);
	
	// textFieldValue
	textFieldValue = new TextField();
	textFieldValue.setCaption("Attribute Value");
	textFieldValue.setImmediate(false);
	textFieldValue.setWidth("100.0%");
	textFieldValue.setHeight("-1px");
	textFieldValue.setInvalidAllowed(false);
	textFieldValue.setRequired(true);
	mainLayout.addComponent(textFieldValue);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));
	
	return mainLayout;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:46,代码来源:AttributeValueEditorWindow.java

示例12: buildMainLayout

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@AutoGenerated
private FormLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new FormLayout();
	mainLayout.setImmediate(false);
	
	// textFieldPolicyName
	textFieldPolicyName = new TextField();
	textFieldPolicyName.setCaption("Policy File Name");
	textFieldPolicyName.setImmediate(true);
	textFieldPolicyName.setWidth("-1px");
	textFieldPolicyName.setHeight("-1px");
	textFieldPolicyName.setInputPrompt("Enter filename eg. foobar.xml");
	textFieldPolicyName.setRequired(true);
	mainLayout.addComponent(textFieldPolicyName);
	
	// textAreaDescription
	textAreaDescription = new TextArea();
	textAreaDescription.setCaption("Description");
	textAreaDescription.setImmediate(false);
	textAreaDescription.setWidth("100%");
	textAreaDescription.setHeight("-1px");
	textAreaDescription
			.setInputPrompt("Enter a description for the Policy/PolicySet.");
	textAreaDescription.setNullSettingAllowed(true);
	mainLayout.addComponent(textAreaDescription);
	
	// optionPolicySet
	optionPolicySet = new OptionGroup();
	optionPolicySet.setCaption("Policy or PolicySet?");
	optionPolicySet.setImmediate(true);
	optionPolicySet
			.setDescription("Is the root level a Policy or Policy Set.");
	optionPolicySet.setWidth("-1px");
	optionPolicySet.setHeight("-1px");
	optionPolicySet.setRequired(true);
	mainLayout.addComponent(optionPolicySet);
	
	// comboAlgorithms
	comboAlgorithms = new ComboBox();
	comboAlgorithms.setCaption("Combining Algorithm");
	comboAlgorithms.setImmediate(false);
	comboAlgorithms.setDescription("Select the combining algorithm.");
	comboAlgorithms.setWidth("-1px");
	comboAlgorithms.setHeight("-1px");
	comboAlgorithms.setRequired(true);
	mainLayout.addComponent(comboAlgorithms);
	
	// buttonSave
	buttonSave = new Button();
	buttonSave.setCaption("Save");
	buttonSave.setImmediate(true);
	buttonSave.setWidth("-1px");
	buttonSave.setHeight("-1px");
	mainLayout.addComponent(buttonSave);
	mainLayout.setComponentAlignment(buttonSave, new Alignment(48));

	return mainLayout;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:60,代码来源:PolicyNameEditorWindow.java

示例13: createForm

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private FormLayout createForm() {
	TextField numberTextField = new TextField("Number");
	numberTextField.setRequired(true);
	numberTextField.setRequiredError("Please enter a flight number!");
	numberTextField.setNullRepresentation("");
	numberTextField.addValidator(new RegexpValidator("\\w\\w\\d\\d\\d", "Please enter a valid flight number!"));

	TextField airlineTextField = new TextField("Airline");
	airlineTextField.setRequired(true);
	airlineTextField.setRequiredError("Please enter an airline!");
	airlineTextField.setNullRepresentation("");

	ComboBox departureAirportField = new ComboBox("Departure Airport");
	departureAirportField.setTextInputAllowed(false);
	departureAirportField.setRequired(true);
	departureAirportField.setRequiredError("Please select a depature airport!");
	departureAirportField.setItemCaptionPropertyId("name");
	departureAirportField.setContainerDataSource(airportContainer);

	ComboBox destinationAirportField = new ComboBox("Destination Airport");
	destinationAirportField.setTextInputAllowed(false);
	destinationAirportField.setRequired(true);
	destinationAirportField.setRequiredError("Please select a destination airport!");
	destinationAirportField.setItemCaptionPropertyId("name");
	destinationAirportField.setContainerDataSource(airportContainer);

	TextField priceField = new TextField("Price");
	priceField.setRequired(true);
	priceField.setRequiredError("Please enter a price!");
	priceField.setNullRepresentation("");
	priceField.setConverter(new StringToBigDecimalConverter());
	priceField.addValidator(new BigDecimalRangeValidator("Please enter a valid price!", new BigDecimal("0.01"), null));

	DateField departureField = new DateField("Departure Date");
	departureField.setDateFormat("dd.MM.yyyy");
	departureField.setRequired(true);
	departureField.setRequiredError("Please enter a departure date!");
	departureField.addValidator(new DateRangeValidator("Please enter departure date in the future!", new Date(), null, Resolution.DAY));

	flightFieldGroup.bind(numberTextField, "number");
	flightFieldGroup.bind(airlineTextField, "airline");
	flightFieldGroup.bind(departureAirportField, "departureAirport");
	flightFieldGroup.bind(destinationAirportField, "destinationAirport");
	flightFieldGroup.bind(priceField, "price");
	flightFieldGroup.bind(departureField, "date");

	return new FormLayout(numberTextField, airlineTextField, departureAirportField, destinationAirportField, priceField, departureField);
}
 
开发者ID:sboe0705,项目名称:flightservice,代码行数:49,代码来源:FlightMaintenanceView.java

示例14: createEditFields

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link com.vaadin.ui.ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

    form.addComponent(new FormGroupHeader("Продукт"));
    productField = new ProdInstallmentsField("Продукт", "Введите название продукта");
    productField.setRequired(true);
    productField.addValueChangeListener(e -> refreshProductFields());
    form.addComponent(productField);

    stateField = new ProdInstanceStateSelect("Статус рассмотрения", "Укажите статус рассмотрения заявки на продукт");
    form.addComponent(stateField);

    form.addComponent(new FormGroupHeader("Характеристики продукта"));
    vendorLabel = new Label();
    vendorLabel.setCaption("Эммитент");
    form.addComponent(vendorLabel);

    downpaymentLabel = new Label();
    downpaymentLabel.setCaption("Первоначальный взнос");
    form.addComponent(downpaymentLabel);

    periodLabel = new Label();
    periodLabel.setCaption("Период рассрочки");
    form.addComponent(periodLabel);

    form.addComponent(new FormGroupHeader("Параметры рассрочки"));
    downpaymentField = new PercentOfField("Первоначальный взнос", "Введите сумму первоначального взноса по рассрочке");
    downpaymentField.setRequired(true);
    form.addComponent(downpaymentField);

    periodField = new ComboBox("Срок рассрочки");
    periodField.setDescription("Введите период рассрочки (длительность рассрочки)");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками кредита
    fillPeriodFieldItems();
    form.addComponent(periodField);

    summField = new EditField("Сумма рассрочки", "Введите сумму рассрочки (Также может рассчитываться автоматически)");
    summField.setRequired(true);
    form.addComponent(summField);

    // Размер ежемесячного платежа
    monthlyPayLabel = new Label();
    monthlyPayLabel.setCaption("Ежемесячный платеж");
    form.addComponent(monthlyPayLabel);

    // Ответственный со стороны банка
    responsibleField = new EmployeeField("Ответственный сотрудник", "Укажите ответственного со стороны эммитента рассрочки");
    responsibleField.setCompanySupplier(() -> {
        final ProdInstallments product = productField.getValue();
        if (product != null) {
            return product.getVendor();
        } else
            return null;
    });
    form.addComponent(responsibleField);

    // Инициализация валидаторов
    initValidators();
    // Обновление рассчетных полей
    refreshProductFields();
    refreshInstCosts();
    // Инициализация взаимосвязей
    initRelations();

    return form;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:77,代码来源:InstallmentInSaleEditForm.java

示例15: createEditFields

import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link com.vaadin.ui.ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

    form.addComponent(new FormGroupHeader("Продукт"));
    productField = new ProdInsuranceField("Продукт", "Введите название продукта");
    productField.setRequired(true);
    productField.addValueChangeListener(e -> refreshProductFields());
    form.addComponent(productField);

    form.addComponent(new FormGroupHeader("Характеристики продукта"));
    vendorLabel = new Label();
    vendorLabel.setCaption("Страховщик");
    form.addComponent(vendorLabel);

    tariffLabel = new Label();
    tariffLabel.setCaption("Тариф");
    tariffLabel.setConverter(lookup(StringToPercentConverter.class));
    form.addComponent(tariffLabel);

    form.addComponent(new FormGroupHeader("Параметры страховки"));
    periodField = new ComboBox("Период страхования");
    periodField.setDescription("Введите период страхования");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками страховки
    fillPeriodFieldItems();
    form.addComponent(periodField);

    // Ответственный за оформление страховки
    responsibleField = new EmployeeField("Ответственный", "Укажите ответственного за оформление страховки");
    responsibleField.setCompanySupplier(() -> {
        final ProdInsurance product = productField.getValue();
        if (product != null) {
            return product.getVendor();
        } else
            return null;
    });
    form.addComponent(responsibleField);

    form.addComponent(new FormGroupHeader("Стоимость страховки"));
    // Размер страховой премии
    premiumLabel = new Label();
    premiumLabel.setCaption("Страховая премия");
    form.addComponent(premiumLabel);

    // Обновление рассчетных полей
    refreshProductFields();
    refreshInsCosts();
    // Инициализация взаимосвязей
    initRelations();

    return form;
}
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:62,代码来源:InsuranceInSaleEditForm.java


注:本文中的com.vaadin.ui.ComboBox.setRequired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。