本文整理汇总了Java中com.vaadin.ui.HorizontalLayout.setComponentAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java HorizontalLayout.setComponentAlignment方法的具体用法?Java HorizontalLayout.setComponentAlignment怎么用?Java HorizontalLayout.setComponentAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.HorizontalLayout
的用法示例。
在下文中一共展示了HorizontalLayout.setComponentAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildActions
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
@Override
protected void buildActions(HorizontalLayout actionsContainer) {
actionsContainer.setSpacing(true);
// yes
final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY)
.caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE)
.messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build())
.onClick(e -> onDialogYesButtonClick(e.getButton())).build();
getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes)));
actionsContainer.addComponent(btnYes);
actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT);
if (getWidth() > -1) {
btnYes.setWidth("100%");
}
// no
final Button btnNo = Components.button()
.caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE)
.messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build())
.onClick(e -> onDialogNoButtonClick(e.getButton())).build();
getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo)));
actionsContainer.addComponent(btnNo);
actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT);
if (getWidth() > -1) {
btnNo.setWidth("100%");
}
}
示例2: getLayoutBtnConditionnel
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* @param btn
* @return le layout de bouton conditionnel
*/
private HorizontalLayout getLayoutBtnConditionnel(final OneClickButton btn) {
btn.addStyleName(ValoTheme.BUTTON_TINY);
HorizontalLayout layout = new HorizontalLayout();
layout.setWidth(100, Unit.PERCENTAGE);
layout.addComponent(btn);
layout.setComponentAlignment(btn, Alignment.MIDDLE_CENTER);
return layout;
}
示例3: CtrCandActionPjWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre d'action sur une ou plusieurs pièces justif
* @param listePj la liste des pièces à manipuler
*/
@SuppressWarnings("unchecked")
public CtrCandActionPjWindow(List<PjPresentation> listePj) {
/* Style */
setModal(true);
setWidth(550,Unit.PIXELS);
setResizable(true);
setClosable(true);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("pj.action.window", null, UI.getCurrent().getLocale()));
/*Le field group pour la decision*/
fieldGroup = new CustomBeanFieldGroup<>(PjCand.class);
fieldGroup.setItemDataSource(new PjCand());
formLayout = new FormLayout();
formLayout.setCaption(applicationContext.getMessage("pj.action.label", new Object[]{listePj.size()}, UI.getCurrent().getLocale()));
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
for (String fieldName : FIELDS_ORDER) {
Field<?> field = fieldGroup.buildAndBind(applicationContext.getMessage("pj.action." + fieldName, null, UI.getCurrent().getLocale()), fieldName);
field.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(field);
}
layout.addComponent(formLayout);
RequiredTextField tf = (RequiredTextField)fieldGroup.getField(PjCand_.commentPjCand.getName());
RequiredComboBox<TypeStatutPiece> cb = (RequiredComboBox<TypeStatutPiece>)fieldGroup.getField(PjCand_.typeStatutPiece.getName());
cb.setRequired(true);
cb.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
if (listePj.size()==1){
cb.setValue(new TypeStatutPiece(listePj.get(0).getCodStatut(),""));
tf.setValue(listePj.get(0).getCommentaire());
}
/* Ajoute les boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
btnClose = new OneClickButton(applicationContext.getMessage("btnClose", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
btnClose.addClickListener(e -> close());
buttonsLayout.addComponent(btnClose);
buttonsLayout.setComponentAlignment(btnClose, Alignment.MIDDLE_LEFT);
btnValid = new OneClickButton(applicationContext.getMessage("btnValid", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
btnValid.addClickListener(e -> {
try {
/* Valide la saisie */
fieldGroup.commit();
/* Enregistre la typeStatutPiece saisie */
changeStatutPieceWindowListener.btnOkClick((TypeStatutPiece)cb.getValue(),tf.getValue());
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnValid);
buttonsLayout.setComponentAlignment(btnValid, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例4: ConfirmWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre de confirmation
* @param message
* @param titre
*/
public ConfirmWindow(String message, String titre) {
/* Style */
setWidth(400, Unit.PIXELS);
setModal(true);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
if (titre == null) {
titre = applicationContext.getMessage("confirmWindow.defaultTitle", null, UI.getCurrent().getLocale());
}
setCaption(titre);
/* Texte */
if (message == null) {
message = applicationContext.getMessage("confirmWindow.defaultQuestion", null, UI.getCurrent().getLocale());
}
Label textLabel = new Label(message);
layout.addComponent(textLabel);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
btnNon.setCaption(applicationContext.getMessage("confirmWindow.btnNon", null, UI.getCurrent().getLocale()));
btnNon.setIcon(FontAwesome.TIMES);
btnNon.addClickListener(e -> close());
buttonsLayout.addComponent(btnNon);
buttonsLayout.setComponentAlignment(btnNon, Alignment.MIDDLE_LEFT);
btnOui.setCaption(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()));
btnOui.setIcon(FontAwesome.CHECK);
btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnOui.addClickListener(e -> close());
buttonsLayout.addComponent(btnOui);
buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例5: init
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("typeTraitement.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.setEnabled(false);
btnEdit.addClickListener(e -> {
if (typeTraitementTable.getValue() instanceof TypeTraitement) {
nomenclatureTypeController.editTypeTraitement((TypeTraitement) typeTraitementTable.getValue());
}
});
buttonsLayout.addComponent(btnEdit);
buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_LEFT);
/* Table des typeTraitements */
typeTraitementTable.setContainerDataSource(new BeanItemContainer<TypeTraitement>(TypeTraitement.class, nomenclatureTypeController.getTypeTraitements()));
typeTraitementTable.addGeneratedColumn(TypeTraitement_.i18nLibTypTrait.getName(), new ColumnGenerator() {
/*** serialVersionUID*/
private static final long serialVersionUID = 2101119091378513475L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final TypeTraitement typeTraitement = (TypeTraitement) itemId;
return i18nController.getI18nTraductionLibelle(typeTraitement.getI18nLibTypTrait());
}
});
typeTraitementTable.setSizeFull();
typeTraitementTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
typeTraitementTable.setColumnHeader(fieldName, applicationContext.getMessage("typeTraitement.table." + fieldName, null, UI.getCurrent().getLocale()));
}
typeTraitementTable.setSortContainerPropertyId(TypeTraitement_.codTypTrait.getName());
typeTraitementTable.setColumnCollapsingAllowed(true);
typeTraitementTable.setColumnReorderingAllowed(true);
typeTraitementTable.setSelectable(true);
typeTraitementTable.setImmediate(true);
typeTraitementTable.addItemSetChangeListener(e -> typeTraitementTable.sanitizeSelection());
typeTraitementTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de typeTraitement sont actifs seulement si une typeTraitement est sélectionnée. */
boolean typeTraitementIsSelected = typeTraitementTable.getValue() instanceof TypeTraitement;
btnEdit.setEnabled(typeTraitementIsSelected);
});
typeTraitementTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
typeTraitementTable.select(e.getItemId());
btnEdit.click();
}
});
addComponent(typeTraitementTable);
setExpandRatio(typeTraitementTable, 1);
/* Inscrit la vue aux mises à jour de typeTraitement */
typeTraitementEntityPusher.registerEntityPushListener(this);
}
示例6: getLangueLayoutInactive
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/** Renvoie un layout contenant un choix de langue et une traduction
* @param traductionInactive
* @return le layout
*/
private HorizontalLayout getLangueLayoutInactive(I18nTraduction traductionInactive){
Langue langueInactive = traductionInactive.getLangue();
/*Ajout de la langue par defaut*/
HorizontalLayout hlLangueInactive = new HorizontalLayout();
listLayoutTraductions.add(hlLangueInactive);
hlLangueInactive.setSpacing(true);
hlLangueInactive.setWidth(100, Unit.PERCENTAGE);
layoutLangue.addComponent(hlLangueInactive);
Image flag = new Image(null, new ThemeResource("images/flags/"+langueInactive.getCodLangue()+".png"));
HorizontalLayout hlFlag = new HorizontalLayout();
hlFlag.setWidth(75,Unit.PIXELS);
hlFlag.addComponent(flag);
hlFlag.setComponentAlignment(flag, Alignment.MIDDLE_CENTER);
hlLangueInactive.addComponent(hlFlag);
/*La valeur de la traduction*/
AbstractField<String> tfVal = getNewValueComponent();
tfVal.setId(langueInactive.getCodLangue());
tfVal.setWidth(100, Unit.PERCENTAGE);
/*Recuperation de la valeur de la traduction par defaut dans la liste des traductions*/
if (listeTraduction.size() != 0){
Optional<I18nTraduction> opt = listeTraduction.stream().filter(l->l.getLangue().getCodLangue().equals(langueInactive.getCodLangue())).findFirst();
if (opt.isPresent()){
tfVal.setValue(opt.get().getValTrad());
}
}
hlLangueInactive.addComponent(tfVal);
hlLangueInactive.setExpandRatio(tfVal,1);
/*Le bouton de suppression de la langue*/
OneClickButton removeLangue = new OneClickButton(FontAwesome.MINUS_SQUARE_O);
removeLangue.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
removeLangue.addStyleName(ValoTheme.BUTTON_BORDERLESS);
removeLangue.addClickListener(e->{layoutLangue.removeComponent(hlLangueInactive);listLayoutTraductions.remove(hlLangueInactive);checkVisibleAddLangue();centerWindow();});
hlLangueInactive.addComponent(removeLangue);
return hlLangueInactive;
}
示例7: ScolGestCandidatWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的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();
}
示例8: init
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("lock.candidat.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
Label subTitleParam = new Label(applicationContext.getMessage("lock.candidat.subtitle", null, UI.getCurrent().getLocale()), ContentMode.HTML);
subTitleParam.addStyleName(StyleConstants.VIEW_SUBTITLE);
addComponent(subTitleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
LockCandidatListener listener = this;
btnDelete.setCaption(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()));
btnDelete.setEnabled(false);
btnDelete.addClickListener(e -> {
if (table.getValue() instanceof LockCandidat) {
lockCandidatController.deleteLock((LockCandidat) table.getValue(), listener);
}
});
buttonsLayout.addComponent(btnDelete);
buttonsLayout.setComponentAlignment(btnDelete, Alignment.MIDDLE_LEFT);
btnDeleteAll.setCaption(applicationContext.getMessage("lock.candidat.all.btn", null, UI.getCurrent().getLocale()));
btnDeleteAll.setEnabled(false);
btnDeleteAll.addClickListener(e -> {
lockCandidatController.deleteAllLock(container.getItemIds(), listener);
});
buttonsLayout.addComponent(btnDeleteAll);
buttonsLayout.setComponentAlignment(btnDeleteAll, Alignment.MIDDLE_RIGHT);
/* Table des locks */
container.addNestedContainerProperty(LockCandidat_.id.getName()+"."+LockCandidatPK_.numDossierOpiCptMin.getName());
container.addNestedContainerProperty(LockCandidat_.id.getName()+"."+LockCandidatPK_.ressourceLock.getName());
table.setSizeFull();
table.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
table.setColumnHeader(fieldName, applicationContext.getMessage("lock.candidat.table." + fieldName, null, UI.getCurrent().getLocale()));
}
table.setSortContainerPropertyId(LockCandidat_.datLock.getName());
table.setColumnCollapsingAllowed(true);
table.setColumnReorderingAllowed(true);
table.setSelectable(true);
table.setImmediate(true);
table.addItemSetChangeListener(e -> table.sanitizeSelection());
table.addValueChangeListener(e -> {
if (table.getValue()==null){
btnDelete.setEnabled(false);
}else{
btnDelete.setEnabled(true);
}
});
table.addItemClickListener(e -> {
if (e.isDoubleClick()) {
table.select(e.getItemId());
btnDelete.click();
}
});
addComponent(table);
setExpandRatio(table, 1);
}
示例9: populateMailModelLayout
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**Rempli le layout de mail modele
* @param layoutMailModel
*/
private void populateMailModelLayout(VerticalLayout layoutMailModel) {
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layoutMailModel.addComponent(buttonsLayout);
OneClickButton btnEditMailModel = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEditMailModel.setEnabled(false);
btnEditMailModel.addClickListener(e -> {
if (mailModelTable.getValue() instanceof Mail) {
mailController.editMail((Mail) mailModelTable.getValue());
}
});
buttonsLayout.addComponent(btnEditMailModel);
buttonsLayout.setComponentAlignment(btnEditMailModel, Alignment.MIDDLE_LEFT);
/* Table des mails */
BeanItemContainer<Mail> container = new BeanItemContainer<Mail>(Mail.class, mailController.getMailsModels());
container.addNestedContainerProperty(Mail_.typeAvis.getName()+"."+TypeAvis_.libelleTypAvis.getName());
mailModelTable.setContainerDataSource(container);
mailModelTable.addBooleanColumn(Mail_.tesMail.getName());
mailModelTable.setSizeFull();
mailModelTable.setVisibleColumns((Object[]) MAIL_FIELDS_ORDER);
for (String fieldName : MAIL_FIELDS_ORDER) {
mailModelTable.setColumnHeader(fieldName, applicationContext.getMessage("mail.table." + fieldName, null, UI.getCurrent().getLocale()));
}
mailModelTable.setSortContainerPropertyId(Mail_.codMail.getName());
mailModelTable.setColumnCollapsingAllowed(true);
mailModelTable.setColumnReorderingAllowed(true);
mailModelTable.setSelectable(true);
mailModelTable.setImmediate(true);
mailModelTable.addItemSetChangeListener(e -> mailModelTable.sanitizeSelection());
mailModelTable.addValueChangeListener(e -> {
/* Les boutons d'édition de mail sont actifs seulement si un mail est sélectionnée. */
boolean mailIsSelected = mailModelTable.getValue() instanceof Mail;
btnEditMailModel.setEnabled(mailIsSelected);
});
mailModelTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
mailModelTable.select(e.getItemId());
btnEditMailModel.click();
}
});
layoutMailModel.addComponent(mailModelTable);
layoutMailModel.setExpandRatio(mailModelTable, 1);
}
示例10: CandidatIdOublieWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre de demande d'envoie d'identifiant ou de code d'activation
*/
public CandidatIdOublieWindow(String mode) {
/* 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 */
if (mode.equals(ConstanteUtils.FORGOT_MODE_ID_OUBLIE)){
setCaption(applicationContext.getMessage("compteMinima.id.oublie.title", null, UI.getCurrent().getLocale()));
layout.addComponent(new Label(applicationContext.getMessage("compteMinima.id.oublie", null, UI.getCurrent().getLocale())));
}else{
setCaption(applicationContext.getMessage("compteMinima.code.oublie.title", null, UI.getCurrent().getLocale()));
layout.addComponent(new Label(applicationContext.getMessage("compteMinima.code.oublie", null, UI.getCurrent().getLocale())));
}
/* Formulaire */
FormLayout formLayout = new FormLayout();
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
RequiredTextField rtf = new RequiredTextField();
rtf.setRequiredError(applicationContext.getMessage("validation.obigatoire", null, UI.getCurrent().getLocale()));
rtf.setNullRepresentation("");
rtf.setRequired(true);
rtf.setCaption(applicationContext.getMessage("compteMinima.table.mailPersoCptMin", null, UI.getCurrent().getLocale()));
rtf.addValidator(new EmailValidator(applicationContext.getMessage("validation.error.mail", null, Locale.getDefault())));
rtf.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(rtf);
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("btnSend", null, UI.getCurrent().getLocale()), FontAwesome.SEND);
btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnEnregistrer.addClickListener(e -> {
rtf.preCommit();
if (rtf.isValid()){
if (candidatController.initPasswordOrActivationCode(rtf.getValue(), mode)){
close();
}
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例11: PieceJustifWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的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();
}
示例12: AdminLangueWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre d'édition de langue
* @param langue la langue à éditer
*/
public AdminLangueWindow(Langue langue) {
/* Style */
setModal(true);
setWidth(350,Unit.PIXELS);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("langue.window", null, UI.getCurrent().getLocale()));
/* Formulaire */
fieldGroup = new CustomBeanFieldGroup<>(Langue.class);
fieldGroup.setItemDataSource(langue);
FormLayout formLayout = new FormLayout();
formLayout.setSpacing(true);
formLayout.setSizeUndefined();
for (String fieldName : LANGUE_FIELDS_ORDER) {
formLayout.addComponent(fieldGroup.buildAndBind(applicationContext.getMessage("langue.table." + fieldName, null, UI.getCurrent().getLocale()), fieldName));
}
fieldGroup.getField(Langue_.codLangue.getName()).setReadOnly(true);
fieldGroup.getField(Langue_.libLangue.getName()).setReadOnly(true);
if (langue.getCodLangue().equals(NomenclatureUtils.LANGUE_FR)){
fieldGroup.getField(Langue_.tesLangue.getName()).setEnabled(false);
}
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 langue saisie */
langueController.saveLangue(langue);
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例13: AdminBatchHistoWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre de visu de l'histo d'un batch
* @param batch le batch à visualiser
*/
public AdminBatchHistoWindow(Batch batch) {
/* Style */
setModal(true);
setWidth(700,Unit.PIXELS);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("batchHisto.window", new Object[]{batch.getCodBatch()}, UI.getCurrent().getLocale()));
/* Table */
container = new BeanItemContainer<BatchHisto>(BatchHisto.class, batchController.getBatchHisto(batch));
batchHistoTable = new TableFormating(null,container);
batchHistoTable.addGeneratedColumn("duree", new ColumnGenerator() {
/*** serialVersionUID*/
private static final long serialVersionUID = 7461290324017459118L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final BatchHisto batchHisto = (BatchHisto) itemId;
if (batchHisto.getDateFinBatchHisto()!=null)
{
LocalDateTime dateDeb = LocalDateTime.from(batchHisto.getDateDebBatchHisto());
Long minutes = dateDeb.until(batchHisto.getDateFinBatchHisto(), ChronoUnit.MINUTES);
dateDeb = dateDeb.plusMinutes(minutes);
Long secondes = dateDeb.until(batchHisto.getDateFinBatchHisto(), ChronoUnit.SECONDS);
return new Label(applicationContext.getMessage("batch.histo.duree", new Object[]{minutes,secondes}, UI.getCurrent().getLocale()));
}
return null;
}
});
batchHistoTable.setSizeFull();
batchHistoTable.setVisibleColumns((Object[]) BATCH_HISTO_FIELDS_ORDER);
for (String fieldName : BATCH_HISTO_FIELDS_ORDER) {
batchHistoTable.setColumnHeader(fieldName, applicationContext.getMessage("batchHisto.table." + fieldName, null, UI.getCurrent().getLocale()));
}
batchHistoTable.setSortContainerPropertyId(Batch_.codBatch.getName());
batchHistoTable.setColumnCollapsingAllowed(true);
batchHistoTable.setColumnReorderingAllowed(true);
batchHistoTable.setSelectable(true);
layout.addComponent(batchHistoTable);
/* Ajoute les boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
btnFermer = new OneClickButton(applicationContext.getMessage("btnClose", null, UI.getCurrent().getLocale()), FontAwesome.TIMES);
btnFermer.addClickListener(e -> close());
buttonsLayout.addComponent(btnFermer);
buttonsLayout.setComponentAlignment(btnFermer, Alignment.MIDDLE_LEFT);
btnRefresh = new OneClickButton(applicationContext.getMessage("btnRefresh", null, UI.getCurrent().getLocale()), FontAwesome.REFRESH);
btnRefresh.addClickListener(e -> {
container.removeAllItems();
container.addAll(batchController.getBatchHisto(batch));
});
buttonsLayout.addComponent(btnRefresh);
buttonsLayout.setComponentAlignment(btnRefresh, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例14: SearchCommissionWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**Crée une fenêtre de recherche de commission
* @param ctrCand
*/
public SearchCommissionWindow(CentreCandidature ctrCand) {
/* Style */
setWidth(850, Unit.PIXELS);
setHeight(480, Unit.PIXELS);
setModal(true);
setResizable(true);
/* Layout */
VerticalLayout layout = new VerticalLayout();
setContent(layout);
layout.setHeight(100, Unit.PERCENTAGE);
layout.setMargin(true);
layout.setSpacing(true);
/* Titre */
setCaption(applicationContext.getMessage("commission.window.search.title", null, Locale.getDefault()));
/* Table de Resultat de recherche*/
List<Commission> listeCommission;
if (ctrCand != null){
listeCommission = commissionController.getCommissionsByCtrCand(ctrCand);
}else{
listeCommission = commissionController.getCommissionsGestionnaire();
}
grid.addItems(listeCommission);
grid.initColumn(FIELDS_ORDER, "commission.table.", Commission_.codComm.getName());
grid.addSelectionListener(e->{
// Le bouton d'enregistrement est actif seulement si une commission est sélectionnée.
boolean isSelected = grid.getSelectedItem() instanceof Commission;
btnValider.setEnabled(isSelected);
});
grid.addItemClickListener(e->{
if (e.isDoubleClick()) {
grid.select(e.getItemId());
btnValider.click();
}
});
layout.addComponent(grid);
layout.setExpandRatio(grid, 1.0f);
/* 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);
btnValider = new OneClickButton(applicationContext.getMessage("btnValid", null, UI.getCurrent().getLocale()), FontAwesome.SAVE);
btnValider.setEnabled(false);
btnValider.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnValider.addClickListener(e -> {
performAction();
});
buttonsLayout.addComponent(btnValider);
buttonsLayout.setComponentAlignment(btnValider, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例15: CtrCandOdfCandidatureWindow
import com.vaadin.ui.HorizontalLayout; //导入方法依赖的package包/类
/**
* Crée une fenêtre de choix pour le gestionnaire : proposition ou candidature simple
* @param message
*/
public CtrCandOdfCandidatureWindow(String message) {
/* Style */
setWidth(630, Unit.PIXELS);
setModal(true);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("candidature.gest.window", null, UI.getCurrent().getLocale()));
/* Texte */
layout.addComponent(new Label(message));
layout.addComponent(new Label(applicationContext.getMessage("candidature.gest.window.choice", null, UI.getCurrent().getLocale())));
/*Le container d'options*/
BeanItemContainer<SimpleTablePresentation> optContainer = new BeanItemContainer<SimpleTablePresentation>(SimpleTablePresentation.class);
SimpleTablePresentation optionClassique = new SimpleTablePresentation(ConstanteUtils.OPTION_CLASSIQUE,applicationContext.getMessage("candidature.gest.window.choice.classique", null, UI.getCurrent().getLocale()),null);
SimpleTablePresentation optionProposition = new SimpleTablePresentation(ConstanteUtils.OPTION_PROP,applicationContext.getMessage("candidature.gest.window.choice.proposition", null, UI.getCurrent().getLocale()),null);
optContainer.addItem(optionClassique);
optContainer.addItem(optionProposition);
optionGroupAction.setContainerDataSource(optContainer);
optionGroupAction.addStyleName(StyleConstants.OPTION_GROUP_HORIZONTAL);
optionGroupAction.setItemCaptionPropertyId(SimpleTablePresentation.CHAMPS_TITLE);
optionGroupAction.setItemCaptionMode(ItemCaptionMode.PROPERTY);
optionGroupAction.setValue(optionClassique);
layout.addComponent(optionGroupAction);
layout.setComponentAlignment(optionGroupAction, Alignment.MIDDLE_CENTER);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
OneClickButton btnNon = new OneClickButton(applicationContext.getMessage("confirmWindow.btnNon", null, UI.getCurrent().getLocale()),FontAwesome.TIMES);
btnNon.addClickListener(e -> close());
buttonsLayout.addComponent(btnNon);
buttonsLayout.setComponentAlignment(btnNon, Alignment.MIDDLE_LEFT);
OneClickButton btnOui = new OneClickButton(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()),FontAwesome.CHECK);
btnOui.setIcon(FontAwesome.CHECK);
btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnOui.addClickListener(e -> {
SimpleTablePresentation option = (SimpleTablePresentation)optionGroupAction.getValue();
odfCandidatureListener.btnOkClick(option.getCode());
close();
});
buttonsLayout.addComponent(btnOui);
buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}