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

The following examples show how to use com.vaadin.ui.ComboBox#setRequired() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPUIComboBoxDecorator.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 2
Source File: AttributeStandardSelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
@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 3
Source File: AttributeValueEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@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 4
Source File: PolicyNameEditorWindow.java    From XACML with MIT License 4 votes vote down vote up
@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 5
Source File: LDAPPIPConfigurationComponent.java    From XACML with MIT License 4 votes vote down vote up
@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");
	
	// textFieldFactory
	textFieldFactory = new TextField();
	textFieldFactory.setCaption("Initial Context Factory");
	textFieldFactory.setImmediate(false);
	textFieldFactory.setWidth("-1px");
	textFieldFactory.setHeight("-1px");
	textFieldFactory.setInvalidAllowed(false);
	textFieldFactory.setRequired(true);
	textFieldFactory.setInputPrompt("com.sun.jndi.ldap.LdapCtxFactory");
	mainLayout.addComponent(textFieldFactory);
	mainLayout.setExpandRatio(textFieldFactory, 1.0f);
	
	// textFieldProviderURL
	textFieldProviderURL = new TextField();
	textFieldProviderURL.setCaption("Provider URL");
	textFieldProviderURL.setImmediate(false);
	textFieldProviderURL.setWidth("-1px");
	textFieldProviderURL.setHeight("-1px");
	textFieldProviderURL.setInvalidAllowed(false);
	textFieldProviderURL.setRequired(true);
	textFieldProviderURL
			.setInputPrompt("Eg. ldap://localhost:389/o=JNDITutorial");
	mainLayout.addComponent(textFieldProviderURL);
	mainLayout.setExpandRatio(textFieldProviderURL, 1.0f);
	
	// comboBoxAuthentication
	comboBoxAuthentication = new ComboBox();
	comboBoxAuthentication.setCaption("Authentication");
	comboBoxAuthentication.setImmediate(false);
	comboBoxAuthentication.setWidth("-1px");
	comboBoxAuthentication.setHeight("-1px");
	comboBoxAuthentication.setRequired(true);
	mainLayout.addComponent(comboBoxAuthentication);
	mainLayout.setExpandRatio(comboBoxAuthentication, 1.0f);
	
	// textFieldPrincipal
	textFieldPrincipal = new TextField();
	textFieldPrincipal.setCaption("Principal");
	textFieldPrincipal.setImmediate(false);
	textFieldPrincipal.setWidth("-1px");
	textFieldPrincipal.setHeight("-1px");
	textFieldPrincipal.setNullSettingAllowed(true);
	mainLayout.addComponent(textFieldPrincipal);
	mainLayout.setExpandRatio(textFieldPrincipal, 1.0f);
	
	// textFieldCredentials
	textFieldCredentials = new TextField();
	textFieldCredentials.setCaption("Credentials");
	textFieldCredentials.setImmediate(false);
	textFieldCredentials.setWidth("-1px");
	textFieldCredentials.setHeight("-1px");
	textFieldCredentials.setNullSettingAllowed(true);
	mainLayout.addComponent(textFieldCredentials);
	mainLayout.setExpandRatio(textFieldCredentials, 1.0f);
	
	// textFieldScope
	textFieldScope = new TextField();
	textFieldScope.setCaption("Scope");
	textFieldScope.setImmediate(false);
	textFieldScope.setWidth("-1px");
	textFieldScope.setHeight("-1px");
	textFieldScope.setInvalidAllowed(false);
	textFieldScope.setRequired(true);
	textFieldScope.setInputPrompt("Eg. subtree");
	mainLayout.addComponent(textFieldScope);
	
	// buttonTest
	buttonTest = new Button();
	buttonTest.setCaption("Test Connection");
	buttonTest.setImmediate(true);
	buttonTest.setWidth("-1px");
	buttonTest.setHeight("-1px");
	mainLayout.addComponent(buttonTest);
	mainLayout.setComponentAlignment(buttonTest, new Alignment(48));
	
	return mainLayout;
}