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


Java Field.setWidth方法代码示例

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


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

示例1: getField

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Renvoie le field construit
 * 
 * @param fieldName
 * @return
 */
private Field<?> getField(String fieldName) {
	String caption = applicationContext.getMessage("formation.table." + fieldName, null,
			UI.getCurrent().getLocale());
	Field<?> field;
	if (fieldName.equals(Formation_.motCleForm.getName())) {
		field = fieldGroup.buildAndBind(caption, fieldName, RequiredTextArea.class);
	} /*
		 * else if (fieldName.equals(Formation_.i18nInfoCompForm.getName())){ field =
		 * fieldGroup.buildAndBind(caption, fieldName, I18nField.class); }
		 */else if (fieldName.equals(Formation_.codEtpVetApoForm.getName())
			|| fieldName.equals(Formation_.codVrsVetApoForm.getName())
			|| fieldName.equals(Formation_.libApoForm.getName())) {
		if (parametreController.getIsFormCodApoOblig()) {
			field = fieldGroup.buildAndBind(caption, fieldName, true);
		} else {
			field = fieldGroup.buildAndBind(caption, fieldName);
		}
		field.setEnabled(false);
	} else {
		field = fieldGroup.buildAndBind(caption, fieldName);
	}

	field.setWidth(100, Unit.PERCENTAGE);
	return field;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:32,代码来源:CtrCandFormationWindow.java

示例2: buildAndBindField

import com.vaadin.ui.Field; //导入方法依赖的package包/类
@Override
protected Field<?> buildAndBindField(String label, String propId, Property<?> prop)
{
    Field<?> field = super.buildAndBindField(label, propId, prop);
    
    if (propId.equals(PROP_SERVLET_ROOT))
    {
        field.addValidator(new StringLengthValidator(MSG_REQUIRED_FIELD, 2, 256, false));
    }
    else if (propId.equals(PROP_HTTP_PORT))
    {
        field.setWidth(100, Unit.PIXELS);
        //((TextField)field).getConverter().
        field.addValidator(new Validator() {
            private static final long serialVersionUID = 1L;
            public void validate(Object value) throws InvalidValueException
            {
                int portNum = (Integer)value;
                if (portNum > 10000 || portNum <= 80)
                    throw new InvalidValueException("Port number must be an integer number greater than 80 and lower than 10000");
            }
        });
    }
    
    return field;
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:27,代码来源:HttpServerConfigForm.java

示例3: replaceFields

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * replace the fields in the fieldbinder in this SearchFieldManager
 */
public void replaceFields() {
    makeSearchFieldsFromFieldBinder();

    for (Map.Entry<Object, SearchPatternField<?,?>> e : getPropertyIdToSearchPatternField().entrySet()) {
        Object propertyId = e.getKey();
        Field<?> replacement = e.getValue();
        Field<?> original = fieldBinder.getPropertyIdToFieldBindings().get(propertyId);

        // this should be moved somewhere else
        replacement.setCaption(original.getCaption());
        replacement.setWidth(original.getWidth(), original.getWidthUnits());

        replace(original, replacement);
    }
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:19,代码来源:FieldBinderSearchFieldManager.java

示例4: initContent

import com.vaadin.ui.Field; //导入方法依赖的package包/类
@Override
protected Component initContent() {
	final Field<?> content = getInternalField();
	if (getWidth() > -1) {
		content.setWidth(100, Unit.PERCENTAGE);
	}
	if (getHeight() > -1) {
		content.setHeight(100, Unit.PERCENTAGE);
	}
	return content;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:12,代码来源:AbstractCustomField.java

示例5: AdresseForm

import com.vaadin.ui.Field; //导入方法依赖的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

示例6: buildAndBindField

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Method called to generate and bind the Field component corresponding to a
 * scalar property
 * @param label
 * @param propId
 * @param prop
 * @return the generated Field object
 */
protected Field<?> buildAndBindField(String label, String propId, Property<?> prop)
{
    Field<?> field = fieldGroup.buildAndBind(label, propId);
    Class<?> propType = prop.getType();
    
    if (propId.equals(PROP_ID))
        field.setReadOnly(true);
    else if (propId.endsWith("." + PROP_ID))
        field.setVisible(false);
    else if (propId.endsWith("." + PROP_NAME))
        field.setVisible(false);
    else if (propId.endsWith(PROP_ENABLED))
        field.setVisible(false);
    else if (propId.endsWith(PROP_MODULECLASS))
        field.setReadOnly(true);        
    
    if (propType.equals(String.class))
        field.setWidth(500, Unit.PIXELS);
    else if (propType.equals(int.class) || propType.equals(Integer.class) ||
            propType.equals(float.class) || propType.equals(Float.class) ||
            propType.equals(double.class) || propType.equals(Double.class))
        field.setWidth(200, Unit.PIXELS);
    else if (Enum.class.isAssignableFrom(propType))
        ((ListSelect)field).setRows(3);
    
    if (field instanceof TextField) {
        ((TextField)field).setNullSettingAllowed(true);
        ((TextField)field).setNullRepresentation("");
    }
    
    return field;
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:41,代码来源:GenericConfigForm.java

示例7: ScolTypeTraitementWindow

import com.vaadin.ui.Field; //导入方法依赖的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

示例8: PieceJustifWindow

import com.vaadin.ui.Field; //导入方法依赖的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

示例9: CtrCandPostItAddWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**Crée une fenêtre d'édition de postit
 * @param postIt
 */
public CtrCandPostItAddWindow(PostIt postIt) {		
	/* Layout */
	VerticalLayout layout = new VerticalLayout();
	layout.setWidth(600, Unit.PIXELS);
	layout.setMargin(true);
	layout.setSpacing(true);
	setContent(layout);

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

	/*Layout adresse*/		
	fieldGroup = new CustomBeanFieldGroup<PostIt>(PostIt.class,ConstanteUtils.TYP_FORM_CANDIDAT);
	fieldGroup.setItemDataSource(postIt);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	Field<?> field = fieldGroup.buildAndBind(applicationContext.getMessage("postit.table." + PostIt_.messagePostIt.getName(), null, UI.getCurrent().getLocale()), PostIt_.messagePostIt.getName(), RequiredTextArea.class); 
	field.setWidth(100, Unit.PERCENTAGE);
	formLayout.addComponent(field);
	
	layout.addComponent(formLayout);
	layout.setExpandRatio(formLayout, 1);
	
	/* 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 du cursus*/
			fieldGroup.commit();
			/* Enregistre le cursus saisi */
			postItWindowListener.btnOkClick(candidatureCtrCandController.savePostIt(postIt));
			/* 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,代码行数:58,代码来源:CtrCandPostItAddWindow.java

示例10: ScolTypeStatutWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de typeStatut
 * @param typeStatut la typeStatut à éditer
 */
public ScolTypeStatutWindow(TypeStatut typeStatut) {
	/* 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("typeStatut.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(TypeStatut.class);
	fieldGroup.setItemDataSource(typeStatut);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("typeStatut.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
		if (fieldName.equals(TypeStatut_.i18nLibTypStatut.getName()) || fieldName.equals(TypeStatut_.temCommVisible.getName())){
			field.setEnabled(true);
		}else{
			field.setEnabled(false);
		}
	}
	
	((I18nField)fieldGroup.getField(TypeStatut_.i18nLibTypStatut.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 typeStatut saisie */
			typeStatutController.saveTypeStatut(typeStatut);
			/* 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,代码来源:ScolTypeStatutWindow.java

示例11: ScolTypeStatutPieceWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de typeStatutPiece
 * @param typeStatutPiece la typeStatutPiece à éditer
 */
public ScolTypeStatutPieceWindow(TypeStatutPiece typeStatutPiece) {
	/* 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("typeStatutPiece.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(TypeStatutPiece.class);
	fieldGroup.setItemDataSource(typeStatutPiece);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("typeStatutPiece.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
		if (fieldName.equals(TypeStatutPiece_.i18nLibTypStatutPiece.getName())){
			field.setEnabled(true);
		}else{
			field.setEnabled(false);
		}
	}
	
	((I18nField)fieldGroup.getField(TypeStatutPiece_.i18nLibTypStatutPiece.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 typeStatutPiece saisie */
			typeStatutController.saveTypeStatutPiece(typeStatutPiece);
			/* 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,代码来源:ScolTypeStatutPieceWindow.java

示例12: ScolFaqWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de faq
 * @param faq la faq à éditer
 */
public ScolFaqWindow(Faq faq) {
	/* Style */
	setModal(true);
	setWidth(850,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("faq.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(Faq.class);
	fieldGroup.setItemDataSource(faq);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("faq.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
	}
	
	((I18nField)fieldGroup.getField(Faq_.i18nQuestion.getName())).addCenterListener(e-> {if(e){center();}});
	((I18nField)fieldGroup.getField(Faq_.i18nReponse.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 faq saisie */
			faqController.saveFaq(faq);
			/* 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,代码行数:70,代码来源:ScolFaqWindow.java

示例13: ScolMotivationAvisWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de motivationAvis
 * @param motivationAvis la motivationAvis à éditer
 */
public ScolMotivationAvisWindow(MotivationAvis motivationAvis) {
	/* 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("motivAvis.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(MotivationAvis.class);
	fieldGroup.setItemDataSource(motivationAvis);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("motivAvis.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
	}
	
	((I18nField)fieldGroup.getField(MotivationAvis_.i18nLibMotiv.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 (!motivationAvisController.isCodMotivUnique((String) fieldGroup.getField(MotivationAvis_.codMotiv.getName()).getValue(), motivationAvis.getIdMotiv())){
				Notification.show(applicationContext.getMessage("window.error.cod.nonuniq", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
				return;
			}				
			/* Valide la saisie */
			fieldGroup.commit();
			/* Enregistre la motivationAvis saisie */
			motivationAvisController.saveMotivationAvis(motivationAvis);
			/* 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,代码来源:ScolMotivationAvisWindow.java

示例14: CandidatAdminWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de cptMin
 * @param cptMin la cptMin à éditer
 */
public CandidatAdminWindow(CompteMinima cptMin) {
	/* 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("candidat.admin.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(CompteMinima.class);
	fieldGroup.setItemDataSource(cptMin);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("compteMinima.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);
		if (fieldName.equals(CompteMinima_.mailPersoCptMin.getName())){
			field.addValidator(new EmailValidator(applicationContext.getMessage("validation.error.mail", null, Locale.getDefault())));
		}
		formLayout.addComponent(field);
	}
	
	RequiredTextField loginField = (RequiredTextField)fieldGroup.getField(CompteMinima_.loginCptMin.getName());
	RequiredTextField etuIdField = (RequiredTextField)fieldGroup.getField(CompteMinima_.supannEtuIdCptMin.getName());

	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 existe dejà --> erreur*/				
			if (candidatController.isLoginPresent(loginField.getValue(), cptMin) || candidatController.isSupannEtuIdPresent(etuIdField.getValue(), cptMin)){
				return;
			}
	
			/* Valide la saisie */
			fieldGroup.commit();
			
			/* Enregistre la cptMin saisie */
			candidatAdminWindowListener.btnOkClick(cptMin);
			
			/* 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,代码行数:80,代码来源:CandidatAdminWindow.java

示例15: ScolMessageWindow

import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
 * Crée une fenêtre d'édition de message
 * @param message la message à éditer
 */
public ScolMessageWindow(Message message) {
	/* Style */
	setModal(true);
	setWidth(850,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("message.window", null, UI.getCurrent().getLocale()));

	/* Formulaire */
	fieldGroup = new CustomBeanFieldGroup<>(Message.class);
	fieldGroup.setItemDataSource(message);
	FormLayout formLayout = new FormLayout();
	formLayout.setWidth(100, Unit.PERCENTAGE);
	formLayout.setSpacing(true);
	for (String fieldName : FIELDS_ORDER) {
		String caption = applicationContext.getMessage("message.table." + fieldName, null, UI.getCurrent().getLocale());
		Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
		field.setWidth(100, Unit.PERCENTAGE);			
		formLayout.addComponent(field);
		if (fieldName.equals(Message_.codMsg.getName())){
			field.setEnabled(false);
		}
	}
	
	((I18nField)fieldGroup.getField(Message_.i18nValMessage.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 message saisie */
			messageController.saveMessage(message);
			/* 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,代码行数:72,代码来源:ScolMessageWindow.java


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