本文整理匯總了Java中com.vaadin.ui.VerticalLayout.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java VerticalLayout.setWidth方法的具體用法?Java VerticalLayout.setWidth怎麽用?Java VerticalLayout.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.VerticalLayout
的用法示例。
在下文中一共展示了VerticalLayout.setWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addMentionCnil
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* ajoute la mention CNIL
*/
private void addMentionCnil() {
panelCnil.setWidth(100, Unit.PERCENTAGE);
panelCnil.setHeight(100, Unit.PIXELS);
addComponent(panelCnil);
setComponentAlignment(panelCnil, Alignment.BOTTOM_LEFT);
VerticalLayout vlContentLabelCnil = new VerticalLayout();
vlContentLabelCnil.setSizeUndefined();
vlContentLabelCnil.setWidth(100, Unit.PERCENTAGE);
vlContentLabelCnil.setMargin(true);
labelCnil.setContentMode(ContentMode.HTML);
labelCnil.addStyleName(ValoTheme.LABEL_TINY);
labelCnil.addStyleName(StyleConstants.LABEL_JUSTIFY);
labelCnil.addStyleName(StyleConstants.LABEL_SAUT_LIGNE);
vlContentLabelCnil.addComponent(labelCnil);
panelCnil.setContent(vlContentLabelCnil);
}
示例2: mainLayout
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private HorizontalLayout mainLayout() {
menuLayout = new VerticalLayout();
menuLayout.setStyleName(ValoTheme.MENU_ROOT);
menuLayout.setWidth(100, Unit.PERCENTAGE);
menuLayout.setHeight(100, Unit.PERCENTAGE);
menuLayout.setSizeFull();
final CssLayout menuButtons = new CssLayout();
menuButtons.setSizeFull();
menuButtons.addStyleName(ValoTheme.MENU_PART);
menuButtons.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);
menuButtons.addComponents(
createMenuButton(VaadinIcons.VIEWPORT, "Dashboard", DashboardComponent::new),
createMenuButton(VaadinIcons.SITEMAP, "Sitemap", DashboardComponent::new),
createMenuButton(VaadinIcons.CALC_BOOK, "Calculate", CalcComponent::new),
createMenuButton(VaadinIcons.NOTEBOOK, "Write", WriteComponent::new),
createMenuButtonForNotification(VaadinIcons.EXIT, "Logout", "You want to go?")
);
menuLayout.addComponent(menuButtons);
contentLayout = new CssLayout(new Label("Content"));
contentLayout.setSizeFull();
final HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();
layout.addComponent(menuLayout);
layout.addComponent(contentLayout);
layout.setExpandRatio(menuLayout, 0.20f);
layout.setExpandRatio(contentLayout, 0.80f);
return layout;
}
示例3: buildSidebar
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
private VerticalLayout buildSidebar() {
VerticalLayout sideBar = new VerticalLayout();
sideBar.addStyleName("sidebar");
sideBar.addComponent(buildMainMenu());
sideBar.setExpandRatio(this.menu, 1);
sideBar.setWidth(null);
sideBar.setHeight("100%");
return sideBar;
}
示例4: Step1
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step1() {
super(true); // Use default actions
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label basicInformationTitle = new Label("Basic Information");
basicInformationTitle.addStyleName(ValoTheme.LABEL_H2);
Label basicInformationLabel = new Label("The stepper component can be used to iterate " +
"through the single steps of a process. Depending on " +
"whether the stepper is declared linear or not, " +
"the provided steps have to be completed in order - " +
"or not.");
Label demoUsageTitle = new Label("Demo Usage");
demoUsageTitle.addStyleName(ValoTheme.LABEL_H3);
Label demoUsageLabel = new Label("You can use the panel on the left side to change and " +
"try out different attributes of the stepper.<br>" +
"Additionally, the demo will show the various possibilities " +
"to use the stepper and its steps when you progress through " +
"the single steps.", ContentMode.HTML);
content.addComponent(basicInformationTitle);
content.addComponent(basicInformationLabel);
content.addComponent(demoUsageTitle);
content.addComponent(demoUsageLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
setCaption("Step 1");
setDescription("Basic Stepper Features");
setContent(content);
}
示例5: Step2
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step2() {
super(true); // Use default actions
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label stepAttributesTitle = new Label("Step Attributes");
stepAttributesTitle.addStyleName(ValoTheme.LABEL_H2);
Label stepAttributesLabel = new Label("You can change various attributes on a single step:" +
"<ul>" +
"<li>caption</li>" +
"<li>description</li>" +
"<li>icon</li>" +
"<li>optional (to be able to skip it)</li>" +
"<li>editable (come back if skipped or next, show edit " +
"icon)" +
"</li>" +
"</ul>", ContentMode.HTML);
content.addComponent(stepAttributesTitle);
content.addComponent(stepAttributesLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
setCaption("Step 2");
setDescription("Step Attributes");
setContent(content);
setIcon(VaadinIcons.BAR_CHART);
setOptional(true);
setEditable(true);
}
示例6: createComponent
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected Component createComponent() {
final CssLayout contentLayout = new CssLayout(new Label("Content"));
contentLayout.setSizeFull();
contentLayout.setId(cssLayoutID().apply(MainUI.class, "Content"));
final VerticalLayout menuLayout = new VerticalLayout();
menuLayout.setId(verticalLayoutID().apply(MainUI.class, "MenuLayout"));
menuLayout.setStyleName(ValoTheme.MENU_ROOT);
menuLayout.setWidth(100, Unit.PERCENTAGE);
menuLayout.setHeight(100, Unit.PERCENTAGE);
menuLayout.setSizeFull();
// to hard bound
menuLayout.addComponent(new MenuComponent(contentLayout));
final HorizontalLayout mainLayout = new HorizontalLayout();
mainLayout.setId(horizontalLayoutID().apply(MainUI.class, "MainLayout"));
mainLayout.setSizeFull();
mainLayout.addComponent(menuLayout);
mainLayout.addComponent(contentLayout);
mainLayout.setExpandRatio(menuLayout, 0.20f);
mainLayout.setExpandRatio(contentLayout, 0.80f);
return mainLayout;
}
示例7: Step4
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
public Step4() {
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label errorTitle = new Label("Step Validation");
errorTitle.addStyleName(ValoTheme.LABEL_H2);
Label errorLabel = new Label("You can validate the contents of your step and show an " +
"error message.<br>Try it out using the text field below " +
"(it should not be empty).", ContentMode.HTML);
TextField textField = new TextField("Please enter a value");
content.addComponent(errorTitle);
content.addComponent(errorLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
content.addComponent(textField);
addStepBackListener(StepperActions::back);
addStepNextListener(event -> {
Stepper stepper = event.getSource();
stepper.hideError();
String value = textField.getValue();
if (StringUtils.isBlank(value)) {
stepper.showError(new RuntimeException("Field should not be empty"));
} else {
stepper.next();
}
});
setCaption("Step 4");
setDescription("Step Validation");
setContent(content);
}
示例8: AccordionItemMenu
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Constructeur
*
* @param title
* @param parent
*/
public AccordionItemMenu(String title, AccordionMenu parent,
Boolean isExpandable) {
super();
setWidth(100, Unit.PERCENTAGE);
/*
* Les labels n'etant pas cliquable, on passe par un layout
* intermediaire
*/
VerticalLayout layoutClickable = new VerticalLayout();
layoutClickable.setWidth(100, Unit.PERCENTAGE);
/* Label */
Label label = new Label(title);
label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE);
label.setSizeUndefined();
layoutClickable.addComponent(label);
layoutClickable.addStyleName(StyleConstants.VALO_MENUACCORDEON);
addComponent(layoutClickable);
if (isExpandable) {
layoutClickable.addStyleName(StyleConstants.CLICKABLE);
layoutClickable.addLayoutClickListener(e -> {
parent.changeItem((String) getData());
});
}
vlButton = new VerticalLayout();
vlButton.addStyleName(StyleConstants.VALO_MENUACCORDEON);
vlButton.setWidth(100, Unit.PERCENTAGE);
addComponent(vlButton);
}
示例9: ScolTypeTraitementWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例10: PieceJustifWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例11: ScolAlertSvaParametreWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/** Crée une fenêtre d'édition de date d'alerte SVA
* @param parametreDate
* @param parametreDefinitif
*/
public ScolAlertSvaParametreWindow(Parametre parametreDate, Parametre parametreDefinitif) {
/* Style */
setModal(true);
setWidth(600,Unit.PIXELS);
setResizable(true);
setClosable(true);
ParametreSvaPresentation parametre = new ParametreSvaPresentation(parametreDate.getValParam(),parametreDefinitif.getValParam());
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setWidth(100, Unit.PERCENTAGE);
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("alertSva.date.window", null, UI.getCurrent().getLocale()));
/* Formulaire */
fieldGroup = new CustomBeanFieldGroup<>(ParametreSvaPresentation.class);
fieldGroup.setItemDataSource(parametre);
FormLayout formLayout = new FormLayout();
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
ComboBoxPresentation field = fieldGroup.buildAndBind(applicationContext.getMessage("alertSva.date.title", null, UI.getCurrent().getLocale()),
ParametreSvaPresentation.CHAMPS_DATE, ComboBoxPresentation.class);
field.setListe(alertSvaController.getListeDateSVA());
field.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(field);
RequiredStringCheckBox fieldDefinitif = fieldGroup.buildAndBind(applicationContext.getMessage("alertSva.definitif.title", null, UI.getCurrent().getLocale()),
ParametreSvaPresentation.CHAMPS_DEFINITF, RequiredStringCheckBox.class);
fieldDefinitif.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(fieldDefinitif);
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 alertSva saisie */
changeAlertSVAWindowListener.btnOkClick(parametre);
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例12: CandidatAdresseWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Crée une fenêtre d'édition d'adresse
* @param adresse l'adresse à éditer
*/
public CandidatAdresseWindow(Adresse adresse) {
/* 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("adresse.window", null, UI.getCurrent().getLocale()));
/*Layout adresse*/
fieldGroupAdresse = new CustomBeanFieldGroup<Adresse>(Adresse.class,ConstanteUtils.TYP_FORM_ADR);
fieldGroupAdresse.setItemDataSource(adresse);
AdresseForm adresseForm = new AdresseForm(fieldGroupAdresse, false);
layout.addComponent(adresseForm);
layout.setExpandRatio(adresseForm, 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 de l'adresse*/
fieldGroupAdresse.commit();
/* Enregistre la commission saisie */
adresseWindowListener.btnOkClick(fieldGroupAdresse.getItemDataSource().getBean());
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例13: ScolFaqWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例14: ScolMotivationAvisWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例15: ScolGestCandidatWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Crée une fenêtre d'édition de date d'alerte SVA
* @param parametre le parametre à éditer
*/
public ScolGestCandidatWindow(Parametre parametre, String title) {
/* Style */
setModal(true);
setWidth(600,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(title);
/* Formulaire */
fieldGroup = new CustomBeanFieldGroup<>(Parametre.class);
fieldGroup.setItemDataSource(parametre);
FormLayout formLayout = new FormLayout();
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
ComboBoxPresentation field = fieldGroup.buildAndBind(applicationContext.getMessage("droitprofilind.gestCandidat.title", null, UI.getCurrent().getLocale()),
Parametre_.valParam.getName(), ComboBoxPresentation.class);
field.setListe(parametreController.getListeGestionnaireCandidat());
field.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(field);
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 alertSva saisie */
changeGestCandidatWindowListener.btnOkClick(parametre);
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}