Java Code Examples for com.vaadin.ui.FormLayout#addComponent()

The following examples show how to use com.vaadin.ui.FormLayout#addComponent() . 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: SoftwareModuleAddUpdateWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private CommonDialogWindow createWindow() {
    final Label madatoryStarLabel = new Label("*");
    madatoryStarLabel.setStyleName("v-caption v-required-field-indicator");
    madatoryStarLabel.setWidth(null);
    addStyleName("lay-color");
    setSizeUndefined();

    formLayout = new FormLayout();
    formLayout.setCaption(null);
    if (editSwModule) {
        formLayout.addComponent(softwareModuleType);
    } else {
        formLayout.addComponent(typeComboBox);
        typeComboBox.focus();
    }

    formLayout.addComponent(nameTextField);
    formLayout.addComponent(versionTextField);
    formLayout.addComponent(vendorTextField);
    formLayout.addComponent(descTextArea);

    setCompositionRoot(formLayout);

    final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
            .caption(i18n.getMessage("caption.create.new", i18n.getMessage("caption.software.module")))
            .id(UIComponentIdProvider.SW_MODULE_CREATE_DIALOG).content(this).layout(formLayout).i18n(i18n)
            .saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
    nameTextField.setEnabled(!editSwModule);
    versionTextField.setEnabled(!editSwModule);

    return window;
}
 
Example 2
Source File: DistributionAddUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    addStyleName("lay-color");
    setSizeUndefined();

    formLayout = new FormLayout();
    formLayout.addComponent(distsetTypeNameComboBox);
    formLayout.addComponent(distNameTextField);
    formLayout.addComponent(distVersionTextField);
    formLayout.addComponent(descTextArea);
    formLayout.addComponent(reqMigStepCheckbox);

    setCompositionRoot(formLayout);
    distNameTextField.focus();
}
 
Example 3
Source File: TargetAddUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    setSizeUndefined();
    formLayout = new FormLayout();
    formLayout.addComponent(controllerIDTextField);
    formLayout.addComponent(nameTextField);
    formLayout.addComponent(descTextArea);

    controllerIDTextField.focus();
}
 
Example 4
Source File: FormFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends Serializable> void addRequestInputFormFields(final FormLayout panelContent, final T item,
		final Class<T> beanType, final List<String> displayProperties,final String buttonLabel,final ClickListener buttonListener) {
	final BeanValidationBinder<T> binder = new BeanValidationBinder<>(beanType);
	binder.setBean(item);
	binder.setReadOnly(true);

	for (final String property : displayProperties) {

		final AbstractField buildAndBind = createField(property);
		binder.bind(buildAndBind,property);
		buildAndBind.setCaption(property);
		buildAndBind.setId(MessageFormat.format("{0}.{1}", buttonLabel, property));
		buildAndBind.setReadOnly(false);
		buildAndBind.setWidth(ContentSize.HALF_SIZE);

		panelContent.addComponent(buildAndBind);
	}

	final VerticalLayout verticalLayout = new VerticalLayout();
	verticalLayout.setWidth("50%");

	final Button button = new Button(buttonLabel,new CommitFormWrapperClickListener(binder,buttonListener));
	button.setId(buttonLabel);
	button.setWidth("25%");
	button.setIcon(VaadinIcons.BULLSEYE);
	button.setEnabled(false);
	binder.addStatusChangeListener(event -> button.setEnabled(event.getBinder().isValid()));
	
	
	verticalLayout.addComponent(button);
	verticalLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT);

	panelContent.addComponent(verticalLayout);
}
 
Example 5
Source File: SubDomainEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private FormLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new FormLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// textFieldSubdomain
	textFieldSubdomain = new TextField();
	textFieldSubdomain.setCaption("Enter Sub Domain");
	textFieldSubdomain.setImmediate(false);
	textFieldSubdomain
			.setDescription("You can enter sub domain name - do not use spaces or wildcard characters.");
	textFieldSubdomain.setWidth("-1px");
	textFieldSubdomain.setHeight("-1px");
	textFieldSubdomain.setInvalidAllowed(false);
	textFieldSubdomain
			.setInputPrompt("Examples: sales hr business marketing.");
	mainLayout.addComponent(textFieldSubdomain);
	mainLayout.setExpandRatio(textFieldSubdomain, 1.0f);
	
	// 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 6
Source File: ChartLayout.java    From usergrid with Apache License 2.0 5 votes vote down vote up
protected void addParamsItems() {

        testNameCombo = UIUtil.createCombo( "Test Name:", null );
        testNameCombo.setWidth( "155px" );

        metricCombo = UIUtil.createCombo( "Metric:", Metric.values() );
        metricCombo.setWidth( "155px" );

        percentileCombo = UIUtil.createCombo( "Percentile:",
                new String[] { "100", "90", "80", "70", "60", "50", "40", "30", "20", "10" } );
        percentileCombo.setWidth( "155px" );

        failureCombo = UIUtil.createCombo( "Points to Plot:", FailureType.values() );
        failureCombo.setWidth( "155px" );

        Button submitButton = new Button("Submit");
        submitButton.addClickListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                loadChart();
            }
        });

        FormLayout formLayout = addFormLayout();
        formLayout.addComponent( testNameCombo );
        formLayout.addComponent( metricCombo );
        formLayout.addComponent( percentileCombo );
        formLayout.addComponent( failureCombo );
        formLayout.addComponent( submitButton );
    }
 
Example 7
Source File: Login.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private void addItems() {
    // Set default values
    FormLayout formLayout = addFormLayout();
    formLayout.addComponent( title );
    formLayout.addComponent( usernameField );
    formLayout.addComponent( passwordField );
    formLayout.addComponent( loginButton );
    formLayout.addComponent( addButtonLayout() );
}
 
Example 8
Source File: UserLayout.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private void addItems() {

        FormLayout formLayout = addFormLayout( 300, 350);
        formLayout.addComponent( formTitle );
        formLayout.addComponent( usernameField );
        formLayout.addComponent( passwordField );
        formLayout.addComponent( accessKeyField );
        formLayout.addComponent( imageField );
        formLayout.addComponent( instanceTypeField );
        formLayout.addComponent( secretKeyField );
        formLayout.addComponent( keyPairNameField );
        formLayout.addComponent( addButtonLayout() );

        addComponent( keyListLayout, "left: 650px; top: 50px;" );
    }
 
Example 9
Source File: WinLoadBalancerConfigListener.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    // メインフォーム
    Form mainForm = new Form();
    Layout mainLayout = mainForm.getLayout();
    addComponent(mainForm);

    // ロードバランサ名
    nameField = new TextField(ViewProperties.getCaption("field.loadBalancerName"));
    nameField.setReadOnly(true);
    mainLayout.addComponent(nameField);

    // サービス名
    serviceField = new TextField(ViewProperties.getCaption("field.loadBalancerService"));
    serviceField.setReadOnly(true);
    mainLayout.addComponent(serviceField);

    // ロードバランサ設定パネル
    Panel panel = new Panel(ViewProperties.getCaption("field.loadBalancerConfig"));
    ((Layout) panel.getContent()).setMargin(false, false, false, true);
    mainLayout.addComponent(panel);

    // サブフォーム
    subForm = new Form();
    FormLayout sublayout = (FormLayout) this.subForm.getLayout();
    sublayout.setMargin(false);
    sublayout.setSpacing(false);
    panel.getContent().addComponent(subForm);
    subForm.setHeight("200px");

    // ロードバランサポート
    loadBalancerPortField = new TextField(ViewProperties.getCaption("field.loadBalancerPort"));
    loadBalancerPortField.setWidth(TEXT_WIDTH);
    sublayout.addComponent(loadBalancerPortField);

    // サービスポート
    servicePortField = new TextField(ViewProperties.getCaption("field.loadBalancerServicePort"));
    servicePortField.setWidth(TEXT_WIDTH);
    sublayout.addComponent(servicePortField);

    // プロトコル
    protocolSelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerProtocol"));
    protocolSelect.setWidth(TEXT_WIDTH);
    protocolSelect.setImmediate(true);
    sublayout.addComponent(protocolSelect);
    protocolSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            protocolValueChange(event);
        }
    });

    // SSLキー
    sslKeySelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerSSLKey"));
    sslKeySelect.setWidth(TEXT_WIDTH);
    sslKeySelect.addContainerProperty(SSLKEY_CAPTION_ID, String.class, null);
    sslKeySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    sslKeySelect.setItemCaptionPropertyId(SSLKEY_CAPTION_ID);
    sublayout.addComponent(sslKeySelect);

    initValidation();
}
 
Example 10
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 11
Source File: DocumentDataPageModContentFactoryImpl.java    From cia with Apache License 2.0 2 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout panelContent = createPanelContent();

	final String pageId = getPageId(parameters);

	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, DOCUMENT_DATA);

	final DataContainer<DocumentContentData, String> documentContentDataDataContainer = getApplicationManager()
			.getDataContainer(DocumentContentData.class);

	final List<DocumentContentData> documentContentlist = documentContentDataDataContainer
			.getAllBy(DocumentContentData_.id, pageId);

	if (!documentContentlist.isEmpty()) {

		final Panel formPanel = new Panel();
		formPanel.setSizeFull();

		panelContent.addComponent(formPanel);

		final FormLayout formContent = new FormLayout();
		formPanel.setContent(formContent);

		final String cleanContent = Jsoup.clean(documentContentlist.get(0).getContent(), "", Whitelist.simpleText(),
				new OutputSettings().indentAmount(4));

		final Label htmlContent = new Label(cleanContent, ContentMode.PREFORMATTED);

		formContent.addComponent(htmlContent);

		final DocumentWordCountRequest documentWordCountRequest = new DocumentWordCountRequest();
		documentWordCountRequest.setDocumentId(pageId);
		documentWordCountRequest.setMaxResults(MAX_RESULTS);
		documentWordCountRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
		final DocumentWordCountResponse resp = (DocumentWordCountResponse) getApplicationManager()
				.service(documentWordCountRequest);

		if (resp.getWordCountMap() != null) {
			final Label wordCloud = new Label(createWordCloud(resp.getWordCountMap()), ContentMode.HTML);
			formContent.addComponent(wordCloud);
		}

		panelContent.setExpandRatio(formPanel, ContentRatio.GRID);

	}

	panel.setContent(panelContent);
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);

	return panelContent;

}