Java Code Examples for com.vaadin.ui.ComboBox.setRequired()

The following are Jave code examples for showing how to use setRequired() of the com.vaadin.ui.ComboBox class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: osc-core   File: BindSecurityGroupWindow.java   Source Code and License Vote up 6 votes
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;
}
 
Example 2
Project: SecureBPMN   File: EnumFormPropertyRenderer.java   Source Code and License Vote up 6 votes
@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;
}
 
Example 3
Project: FiWare-Template-Handler   File: EnumFormPropertyRenderer.java   Source Code and License Vote up 6 votes
@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;
}
 
Example 4
Project: osc-core   File: BindSecurityGroupWindow.java   Source Code and License Vote up 5 votes
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;
}
 
Example 5
Project: incubator-openaz   File: AttributeStandardSelectorComponent.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 6
Project: hawkbit   File: SPUIComboBoxDecorator.java   Source Code and License Vote up 5 votes
/**
 * 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;
}
 
Example 7
Project: KrishnasSpace   File: EditableGrid.java   Source Code and License Vote up 5 votes
/**
 * @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;
}
 
Example 8
Project: XACML   File: AttributeStandardSelectorComponent.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 9
Project: extacrm   File: LoanCalculatorForm.java   Source Code and License Vote up 5 votes
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);
}
 
Example 10
Project: konekti   File: EmployeeAgentViewForm.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 11
Project: konekti   File: CalendarViewForm.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 12
Project: osc-core   File: BindSecurityGroupWindow.java   Source Code and License Vote up 4 votes
@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());
	}
}
 
Example 13
Project: incubator-openaz   File: AttributeValueEditorWindow.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 14
Project: incubator-openaz   File: PolicyNameEditorWindow.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 15
Project: flightservice   File: FlightMaintenanceView.java   Source Code and License Vote up 4 votes
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);
}
 
Example 16
Project: XACML   File: AttributeValueEditorWindow.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 17
Project: XACML   File: PolicyNameEditorWindow.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 18
Project: extacrm   File: InstallmentInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <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;
}
 
Example 19
Project: extacrm   File: InsuranceInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <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;
}
 
Example 20
Project: extacrm   File: HirePurchaseInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

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

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

    form.addComponent(new FormGroupHeader("Сопутствующие расходы"));
    expendituresField = new ProductExpendituresField("Статьи расходов",
            "Список дополнительных расходов сопровождающих продукт", (ProductInstance) getEntity());
    form.addComponent(expendituresField);

    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);

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

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

    return form;
}
 
Example 21
Project: konekti   File: AreaViewForm.java   Source Code and License Vote up 4 votes
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new AbsoluteLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("560px");
	mainLayout.setHeight("280px");
	mainLayout.setMargin(true);
	
	// top-level component properties
	setWidth("560px");
	setHeight("280px");
	
	// activeField
	activeField = new CheckBox();
	activeField.setCaption("Activo");
	activeField.setImmediate(false);
	activeField.setWidth("-1px");
	activeField.setHeight("-1px");
	activeField.setTabIndex(2);
	activeField.setRequired(true);
	mainLayout.addComponent(activeField, "top:20.0px;left:486.0px;");
	
	// codeField
	codeField = new TextField();
	codeField.setCaption("Código");
	codeField.setImmediate(false);
	codeField.setWidth("120px");
	codeField.setHeight("-1px");
	codeField.setRequired(true);
	mainLayout.addComponent(codeField, "top:20.0px;left:20.0px;");
	
	// commentField
	commentField = new TextField();
	commentField.setCaption("Comentarios");
	commentField.setImmediate(false);
	commentField.setWidth("520px");
	commentField.setHeight("120px");
	commentField.setTabIndex(6);
	mainLayout.addComponent(commentField, "top:140.0px;left:20.0px;");
	
	// descriptionField
	descriptionField = new TextField();
	descriptionField.setCaption("Descripción");
	descriptionField.setImmediate(false);
	descriptionField.setWidth("520px");
	descriptionField.setHeight("-1px");
	descriptionField.setTabIndex(3);
	mainLayout.addComponent(descriptionField, "top:60.0px;left:20.0px;");
	
	// nameField
	nameField = new TextField();
	nameField.setCaption("Nombre");
	nameField.setImmediate(false);
	nameField.setWidth("320px");
	nameField.setHeight("-1px");
	nameField.setTabIndex(1);
	nameField.setRequired(true);
	mainLayout.addComponent(nameField, "top:20.0px;left:160.0px;");
	
	// areaTypeField
	areaTypeField = new ComboBox();
	areaTypeField.setCaption("Tipo Area");
	areaTypeField.setImmediate(false);
	areaTypeField.setWidth("-1px");
	areaTypeField.setHeight("-1px");
	areaTypeField.setTabIndex(4);
	areaTypeField.setRequired(true);
	mainLayout.addComponent(areaTypeField, "top:100.0px;left:19.0px;");
	
	return mainLayout;
}
 
Example 22
Project: konekti   File: PermissionViewForm.java   Source Code and License Vote up 4 votes
@AutoGenerated
private AbsoluteLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new AbsoluteLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("580px");
	mainLayout.setHeight("280px");
	mainLayout.setMargin(true);
	
	// top-level component properties
	setWidth("580px");
	setHeight("280px");
	
	// activeField
	activeField = new CheckBox();
	activeField.setCaption("Activo");
	activeField.setImmediate(false);
	activeField.setWidth("-1px");
	activeField.setHeight("-1px");
	activeField.setRequired(true);
	mainLayout.addComponent(activeField, "top:14.0px;left:507.0px;");
	
	// commentField
	commentField = new TextField();
	commentField.setCaption("Comentario");
	commentField.setImmediate(true);
	commentField.setWidth("540px");
	commentField.setHeight("160px");
	mainLayout.addComponent(commentField, "top:100.0px;left:20.0px;");
	
	// codeField
	codeField = new TextField();
	codeField.setCaption("Código");
	codeField.setImmediate(false);
	codeField.setWidth("160px");
	codeField.setHeight("-1px");
	codeField.setRequired(true);
	mainLayout.addComponent(codeField, "top:17.0px;left:20.0px;");
	
	// descriptionField
	descriptionField = new TextField();
	descriptionField.setCaption("Descripción");
	descriptionField.setImmediate(false);
	descriptionField.setWidth("541px");
	descriptionField.setHeight("-1px");
	descriptionField.setRequired(true);
	mainLayout.addComponent(descriptionField, "top:56.0px;left:20.0px;");
	
	// menuCommandResourceField
	menuCommandResourceField = new ComboBox();
	menuCommandResourceField.setCaption("Módulo:");
	menuCommandResourceField.setImmediate(true);
	menuCommandResourceField.setWidth("280px");
	menuCommandResourceField.setHeight("-1px");
	menuCommandResourceField.setRequired(true);
	mainLayout.addComponent(menuCommandResourceField,
			"top:17.0px;left:200.0px;");
	
	return mainLayout;
}
 
Example 23
Project: scoutmaster   File: GroupDetailStep.java   Source Code and License Vote up 4 votes
@Override
public Component getContent()
{
	if (form == null)
	{
		form = new SimpleFormLayout();
		form.setMargin(true);

		final Label label = new Label("<h1>Please enter your Group's details.</h1>", ContentMode.HTML);
		label.setContentMode(ContentMode.HTML);

		form.addComponent(label);

		groupName = new TextField("Group Name");
		form.addComponent(groupName);

		groupTypeField = new ComboBox("Group Type");
		groupTypeField.setItemCaptionMode(ItemCaptionMode.ID_TOSTRING);
		groupTypeField.setTextInputAllowed(false);
		groupTypeField.setRequired(true);
		loadGroupTypes();
		form.addComponent(groupTypeField);

		phoneNo = new TextField("Phone No.");
		form.addComponent(phoneNo);
		street = new TextField("Street");
		form.addComponent(street);
		city = new TextField("City/Suburb");
		form.addComponent(city);
		state = new TextField("State");
		form.addComponent(state);
		postcode = new TextField("Postcode/Zip Code");
		form.addComponent(postcode);

		countries = new ComboBox("Country");
		loadCountries(countries);
		form.addComponent(countries);

		groupName.addValidator(
				new StringLengthValidator("Group Name must be between 6 and 255 characters long.", 6, 255, false));
		groupName.addValidator(value -> {
			// tell the user if their group name is unique.
			GroupDao groupDao = new DaoFactory().getGroupDao();
			String groupNameString = ((String) value).trim();
			if (groupNameString.length() > 0)
			{
				if (groupDao.findByName(groupNameString) != null)
					throw new Validator.InvalidValueException("Group name already exists. Please choose another.");
			}

		});
	}

	return form;
}