當前位置: 首頁>>代碼示例>>Java>>正文


Java FormLayout.setSpacing方法代碼示例

本文整理匯總了Java中com.vaadin.ui.FormLayout.setSpacing方法的典型用法代碼示例。如果您正苦於以下問題:Java FormLayout.setSpacing方法的具體用法?Java FormLayout.setSpacing怎麽用?Java FormLayout.setSpacing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.FormLayout的用法示例。


在下文中一共展示了FormLayout.setSpacing方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PluginRepositoryEditPanel

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public PluginRepositoryEditPanel(ApplicationContext context, PluginRepository pluginRepository) {
    this.context = context;
    this.pluginRepository = pluginRepository;

    FormLayout form = new FormLayout();
    form.setSpacing(true);

    TextField field = new TextField("Name", StringUtils.trimToEmpty(pluginRepository.getName()));
    field.setWidth(20, Unit.EM);
    form.addComponent(field);
    field.addValueChangeListener(new NameChangeListener());
    field.focus();

    field = new TextField("Url", StringUtils.trimToEmpty(pluginRepository.getUrl()));
    field.setWidth(45, Unit.EM);
    field.addValueChangeListener(new UrlChangeListener());
    form.addComponent(field);

    addComponent(form);
    setMargin(true);
}
 
開發者ID:JumpMind,項目名稱:metl,代碼行數:22,代碼來源:PluginRepositoryEditPanel.java

示例2: AdresseForm

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'édition d'adresse
 * @param fieldGroupAdresse l'adresse à éditer
 */
public AdresseForm(CustomBeanFieldGroup<Adresse> fieldGroupAdresse, Boolean withCedex) {
	setSpacing(true);
	setSizeFull();
	
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		if (withCedex || (!withCedex && !fieldName.equals(Adresse_.cedexAdr.getName()))){
			String caption = applicationContext.getMessage("adresse." + fieldName, null, UI.getCurrent().getLocale());
			Field<?> field;
			if (fieldName.equals(Adresse_.codBdiAdr.getName())){
				field = fieldGroupAdresse.buildAndBind(caption, fieldName,RequiredIntegerField.class);
				((RequiredIntegerField)field).setNullRepresentation("");
				((RequiredIntegerField)field).setMaxLength(5);
			}else{
				field = fieldGroupAdresse.buildAndBind(caption, fieldName);
			}
			field.setWidth(100, Unit.PERCENTAGE);
			formLayout.addComponent(field);
		}
		
	}
	
	
	initForm(fieldGroupAdresse);
	
	addComponent(formLayout);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:34,代碼來源:AdresseForm.java

示例3: addForm

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private void addForm() {
    FormLayout loginForm = new FormLayout();
    MessageProvider mp = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
    username = new TextField(mp.getMessage("default.label.username"));
    password = new PasswordField(mp.getMessage("default.label.password"));
    loginForm.addComponents(username, password);
    addComponent(loginForm);
    loginForm.setSpacing(true);
    for(Component component:loginForm){
        component.setWidth("100%");
    }
    username.focus();
}
 
開發者ID:apache,項目名稱:incubator-tamaya-sandbox,代碼行數:14,代碼來源:LoginBox.java

示例4: NewPasswordWindow

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public NewPasswordWindow(LoginView parentView, LoginPresenter loginPresenter) {
    super("Set Password");
    this.handler = loginPresenter;
    this.parentView = parentView;
    setIcon(FontAwesome.LOCK);
    setModal(true);
    center();
    setClosable(false);

    setWidth(400, Unit.PIXELS);

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.setSpacing(true);

    formLayout.addComponent(password);
    formLayout.addComponent(verifyPassword);
    formLayout.addComponent(save);

    password.focus();

    save.addClickListener((Button.ClickListener) clickEvent -> {
        if (password.isEmpty()) {
            parentView.notify("Password can not be empty");
            password.focus();
        } else if (password.getValue().toLowerCase().equals("password")) {
            parentView.notify("Password can't be \"password\"");
            password.selectAll();
        } else if (!password.getValue().equals(verifyPassword.getValue())) {
            parentView.notify("Password and Verification do not match");
            verifyPassword.selectAll();
        } else {
            handler.setNewPassword(this.parentView, password.getValue());
            close();
        }
    });
    setContent(formLayout);
    save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
}
 
開發者ID:kumoregdev,項目名稱:kumoreg,代碼行數:41,代碼來源:NewPasswordWindow.java

示例5: CreditCardAuthWindow

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public CreditCardAuthWindow(OrderView parentView, OrderPresenter orderPresenter) {
    super("Authorization Number");
    this.handler = orderPresenter;
    this.parentView = parentView;
    setIcon(FontAwesome.CREDIT_CARD);
    setModal(true);
    center();

    setWidth(600, Unit.PIXELS);

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.setSpacing(true);

    formLayout.addComponent(authNumber);
    formLayout.addComponent(save);

    authNumber.setMaxLength(7);
    authNumber.focus();

    save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    save.addClickListener((Button.ClickListener) clickEvent -> {
        if (authNumber.getValue().trim().length() >= 6) {
            handler.saveAuthNumberClicked(this.parentView, authNumber.getValue());
            close();
        } else {
            authNumber.selectAll();
        }
    });

    setContent(formLayout);

    save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
}
 
開發者ID:kumoregdev,項目名稱:kumoreg,代碼行數:36,代碼來源:CreditCardAuthWindow.java

示例6: buildContents

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private void buildContents() {

        FormLayout verticalLayout = new FormLayout();
        verticalLayout.setMargin(true);
        verticalLayout.setSpacing(true);

        paymentType.setNullSelectionAllowed(false);
        for (Payment.PaymentType p : Payment.PaymentType.values()) {
            // Don't show the PREREG payment type unless the record is already set to PREREG.
            // IE - the order was imported with prereg payment type)
            if (p != Payment.PaymentType.PREREG) {
                paymentType.addItem(p);
            }
        }
        paymentType.setValue(Payment.PaymentType.CASH);
        verticalLayout.addComponent(paymentType);
        verticalLayout.addComponent(amount);
        verticalLayout.addComponent(authNumber);
        verticalLayout.addComponent(paymentTakenBy);
        verticalLayout.addComponent(paymentTakenAt);
        verticalLayout.addComponent(paymentLocation);

        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSpacing(true);
        horizontalLayout.addComponent(save);
        horizontalLayout.addComponent(cancel);
        horizontalLayout.addComponent(delete);
        delete.addStyleName(ValoTheme.BUTTON_DANGER);

        save.addClickListener((Button.ClickListener) clickEvent -> saveClicked());
        cancel.addClickListener((Button.ClickListener) clickEvent -> close());
        delete.addClickListener((Button.ClickListener) clickEvent -> deleteClicked());

        verticalLayout.addComponent(horizontalLayout);
        save.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        save.addStyleName(ValoTheme.BUTTON_PRIMARY);
        amount.focus();
        setContent(verticalLayout);

    }
 
開發者ID:kumoregdev,項目名稱:kumoreg,代碼行數:41,代碼來源:PaymentWindow.java

示例7: ViewInstructionsWindow

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
public ViewInstructionsWindow(String instructions) {
    super(" Instructions");

    setIcon(FontAwesome.BOOK);
    setModal(true);
    setClosable(true);
    center();
    setWidth("70%");

    FormLayout verticalLayout = new FormLayout();
    verticalLayout.setMargin(true);
    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(labelInstructionText);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSpacing(true);
    horizontalLayout.addComponent(btnClose);

    btnClose.addClickListener((Button.ClickListener) clickEvent -> close());

    verticalLayout.addComponent(horizontalLayout);
    setContent(verticalLayout);

    labelInstructionText.setContentMode(ContentMode.HTML);
    labelInstructionText.setSizeFull();
    labelInstructionText.setValue(instructions);

    btnClose.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    btnClose.addClickListener((Button.ClickListener) clickEvent -> {
        this.close();
    });
}
 
開發者ID:kumoregdev,項目名稱:kumoreg,代碼行數:33,代碼來源:ViewInstructionsWindow.java

示例8: buildMainLayout

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@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;
}
 
開發者ID:apache,項目名稱:incubator-openaz,代碼行數:40,代碼來源:SubDomainEditorWindow.java

示例9: buildDialogLayout

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@Override
protected void buildDialogLayout() {
    FormLayout mainLayout = new FormLayout();

    // top-level component properties
    setWidth("100%");
    setHeight("100%");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    encodingSelect = new NativeSelect(ctx.tr("dialog.tlfs.encoding"));
    for (Encoding encoding : Encoding.values()) {
        encodingSelect.addItem(encoding);
        encodingSelect.setItemCaption(encoding, encoding.getCharset());
    }
    encodingSelect.setNullSelectionAllowed(false);
    encodingSelect.setImmediate(true);
    TextField txtSearch = new TextField(this.ctx.tr("dialog.tlfs.search"), search);
    txtSearch.setWidth("100%");
    TextField txtReplace = new TextField(this.ctx.tr("dialog.tlfs.replace"), replace);
    txtReplace.setWidth("100%");

    mainLayout.addComponent(encodingSelect);
    mainLayout.addComponent(txtSearch);
    mainLayout.addComponent(txtReplace);

    setCompositionRoot(mainLayout);
}
 
開發者ID:UnifiedViews,項目名稱:Plugins,代碼行數:29,代碼來源:FilesFindAndReplaceVaadinDialog.java

示例10: postConstruct

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
@Override
public void postConstruct() {
	super.postConstruct();		
	setSizeFull();
	
	layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);
	setCompositionRoot(layout);
	
	infoLabel = new Label("Vaadin4Spring Security Demo - SignUp");
	infoLabel.addStyleName(ValoTheme.LABEL_H2);
	infoLabel.setSizeUndefined();
	layout.addComponent(infoLabel);
	layout.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
	
	container = new VerticalLayout();
	container.setSizeUndefined();
	container.setSpacing(true);
	layout.addComponent(container);
	layout.setComponentAlignment(container, Alignment.MIDDLE_CENTER);
	layout.setExpandRatio(container, 1);
					
	form = new FormLayout();
	form.setWidth("400px");
	form.setSpacing(true);
	container.addComponent(form);
	buildForm();
				
	btnSignUp = new Button("Signup", FontAwesome.FLOPPY_O);
	btnSignUp.addStyleName(ValoTheme.BUTTON_FRIENDLY);
	btnSignUp.addClickListener(this);
	container.addComponent(btnSignUp);
	container.setComponentAlignment(btnSignUp, Alignment.MIDDLE_CENTER);

}
 
開發者ID:markoradinovic,項目名稱:Vaadin4Spring-MVP-Sample-SpringSecurity,代碼行數:37,代碼來源:SignUpViewImpl.java

示例11: addFormLayout

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private FormLayout addFormLayout() {

        FormLayout formLayout = new FormLayout();
        formLayout.setWidth( "250px" );
        formLayout.setHeight( "250px" );
        formLayout.addStyleName( "outlined" );
        formLayout.setSpacing( true );

        addComponent( formLayout, "left: 10px; top: 10px;" );

        return formLayout;
    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:13,代碼來源:ChartLayout.java

示例12: addFormLayout

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private FormLayout addFormLayout() {

        FormLayout formLayout = new FormLayout();
        formLayout.setWidth( "300px" );
        formLayout.setHeight( "200px" );
        formLayout.addStyleName( "outlined" );
        formLayout.setSpacing( true );
        mainLayout.addComponent( formLayout );
        mainLayout.setComponentAlignment( formLayout, Alignment.MIDDLE_CENTER );
        return formLayout;
    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:12,代碼來源:Login.java

示例13: addFormLayout

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
private FormLayout addFormLayout( int x, int y ) {

        FormLayout formLayout = new FormLayout();
        formLayout.setWidth( String.format( "%spx", x ) );
        formLayout.setHeight( String.format( "%spx", y ) );
        formLayout.addStyleName( "outlined" );
        formLayout.setSpacing( true );

        addComponent( formLayout, "left: 350px; top: 50px;" );

        return formLayout;
    }
 
開發者ID:apache,項目名稱:usergrid,代碼行數:13,代碼來源:UserLayout.java

示例14: ScolTypeTraitementWindow

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'édition de typeTraitement
 * @param typeTraitement la typeTraitement à éditer
 */
public ScolTypeTraitementWindow(TypeTraitement typeTraitement) {
	/* Style */
	setModal(true);
	setWidth(550,Unit.PIXELS);
	setResizable(true);
	setClosable(true);

	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setWidth(100, Unit.PERCENTAGE);
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

	/* Titre */
	setCaption(applicationContext.getMessage("typeTraitement.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(TypeTraitement.class);
	fieldGroup.setItemDataSource(typeTraitement);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("typeTraitement.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
		if (fieldName.equals(TypeTraitement_.i18nLibTypTrait.getName())){
			field.setEnabled(true);
		}else{
			field.setEnabled(false);
		}
	}
	
	((I18nField)fieldGroup.getField(TypeTraitement_.i18nLibTypTrait.getName())).addCenterListener(e-> {if(e){center();}});

	layout.addComponent(formLayout);

	/* Ajoute les boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layout.addComponent(buttonsLayout);

	btnAnnuler = new OneClickButton(applicationContext.getMessage("btnAnnuler", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
	btnAnnuler.addClickListener(e -> close());
	buttonsLayout.addComponent(btnAnnuler);
	buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

	btnEnregistrer = new OneClickButton(applicationContext.getMessage("btnSave", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
	btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);		
	btnEnregistrer.addClickListener(e -> {
		try {
			/* Valide la saisie */
			fieldGroup.commit();
			/* Enregistre la typeTraitement saisie */
			nomenclatureTypeController.saveTypeTraitement(typeTraitement);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:74,代碼來源:ScolTypeTraitementWindow.java

示例15: PieceJustifWindow

import com.vaadin.ui.FormLayout; //導入方法依賴的package包/類
/**
 * Crée une fenêtre d'édition de pieceJustif
 * @param pieceJustif la pieceJustif à éditer
 */
public PieceJustifWindow(PieceJustif pieceJustif) {
	/* Style */
	setModal(true);
	setWidth(550,Unit.PIXELS);
	setResizable(true);
	setClosable(true);

	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setWidth(100, Unit.PERCENTAGE);
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

	/* Titre */
	setCaption(applicationContext.getMessage("pieceJustif.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(PieceJustif.class);
	fieldGroup.setItemDataSource(pieceJustif);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("pieceJustif.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
	}
	
	((I18nField)fieldGroup.getField(PieceJustif_.i18nLibPj.getName())).addCenterListener(e-> {if(e){center();}});	

	layout.addComponent(formLayout);

	/* Ajoute les boutons */
	HorizontalLayout buttonsLayout = new HorizontalLayout();
	buttonsLayout.setWidth(100, Unit.PERCENTAGE);
	buttonsLayout.setSpacing(true);
	layout.addComponent(buttonsLayout);

	btnAnnuler = new OneClickButton(applicationContext.getMessage("btnAnnuler", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
	btnAnnuler.addClickListener(e -> close());
	buttonsLayout.addComponent(btnAnnuler);
	buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

	btnEnregistrer = new OneClickButton(applicationContext.getMessage("btnSave", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
	btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);		
	btnEnregistrer.addClickListener(e -> {
		try {
			/*Si le code de profil existe dejà --> erreur*/
			if (!pieceJustifController.isCodPjUnique((String) fieldGroup.getField(PieceJustif_.codPj.getName()).getValue(), pieceJustif.getIdPj())){
				Notification.show(applicationContext.getMessage("window.error.cod.nonuniq", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
				return;
			}	
			/* Valide la saisie */
			fieldGroup.commit();
			/* Enregistre la pieceJustif saisie */
			pieceJustifController.savePieceJustif(pieceJustif);
			/* Ferme la fenêtre */
			close();
		} catch (CommitException ce) {
		}
	});
	buttonsLayout.addComponent(btnEnregistrer);
	buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

	/* Centre la fenêtre */
	center();
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:74,代碼來源:PieceJustifWindow.java


注:本文中的com.vaadin.ui.FormLayout.setSpacing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。