本文整理匯總了Java中com.vaadin.ui.VerticalLayout.setSpacing方法的典型用法代碼示例。如果您正苦於以下問題:Java VerticalLayout.setSpacing方法的具體用法?Java VerticalLayout.setSpacing怎麽用?Java VerticalLayout.setSpacing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.VerticalLayout
的用法示例。
在下文中一共展示了VerticalLayout.setSpacing方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: I18nField
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Constructeur, initialisation du champs
* @param listeLangueEnService
* @param langueParDefaut
* @param libelleBtnPlus
*/
public I18nField(Langue langueParDefaut, List<Langue> listeLangueEnService, String libelleBtnPlus) {
super();
setRequired(false);
this.langueParDefaut = langueParDefaut;
this.listeLangueEnService = listeLangueEnService;
listLayoutTraductions = new ArrayList<HorizontalLayout>();
listeTraduction = new ArrayList<I18nTraduction>();
layoutComplet = new VerticalLayout();
layoutComplet.setSpacing(true);
layoutLangue = new VerticalLayout();
layoutLangue.setSpacing(true);
layoutComplet.addComponent(layoutLangue);
btnAddLangue = new OneClickButton(libelleBtnPlus,FontAwesome.PLUS_SQUARE_O);
btnAddLangue.setVisible(false);
btnAddLangue.addStyleName(ValoTheme.BUTTON_TINY);
layoutComplet.addComponent(btnAddLangue);
btnAddLangue.addClickListener(e->{
layoutLangue.addComponent(getLangueLayout(null));
checkVisibleAddLangue();
centerWindow();
});
}
示例2: init
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
setContent(root);
MHorizontalLayout horizontalLayout = new MHorizontalLayout();
for (MenuEntry menuEntry : menuEntries) {
horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
navigator.navigateTo(menuEntry.getNavigationTarget());
}));
}
root.addComponent(horizontalLayout);
springViewDisplay = new Panel();
springViewDisplay.setSizeFull();
root.addComponent(springViewDisplay);
root.setExpandRatio(springViewDisplay, 1.0f);
}
示例3: getLegendLayout
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* @return le layout de légende
*/
private VerticalLayout getLegendLayout() {
VerticalLayout vlLegend = new VerticalLayout();
// vlLegend.setWidth(300, Unit.PIXELS);
vlLegend.setMargin(true);
vlLegend.setSpacing(true);
Label labelTitle = new Label(
applicationContext.getMessage("formation.table.flagEtat.tooltip", null, UI.getCurrent().getLocale()));
labelTitle.addStyleName(StyleConstants.VIEW_TITLE);
vlLegend.addComponent(labelTitle);
vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_GREEEN));
vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_RED));
vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_YELLOW));
vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_BLUE));
return vlLegend;
}
示例4: createPopUpContent
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Créé la popup SVA
*
* @param listeAlerteSva
* @param dateSva
* @return le contenu de la popup SVA
*/
private Content createPopUpContent(final List<AlertSva> listeAlerteSva, final String dateSva) {
VerticalLayout vlAlert = new VerticalLayout();
vlAlert.setMargin(true);
vlAlert.setSpacing(true);
Label labelTitle = new Label(applicationContext.getMessage("alertSva.popup.title",
new Object[] {alertSvaController.getLibelleDateSVA(dateSva)}, UI.getCurrent().getLocale()));
labelTitle.addStyleName(ValoTheme.LABEL_LARGE);
labelTitle.addStyleName(ValoTheme.LABEL_BOLD);
vlAlert.addComponent(labelTitle);
listeAlerteSva.forEach(alert -> {
vlAlert.addComponent(
new Label(
"<div style='display:inline-block;border:1px solid;width:20px;height:20px;background:"
+ alert.getColorSva()
+ ";'></div><div style='height:100%;display: inline-block;vertical-align: super;'>"
+ applicationContext.getMessage("alertSva.popup.alert",
new Object[] {alert.getNbJourSva()}, UI.getCurrent().getLocale())
+ "</div>",
ContentMode.HTML));
});
return new Content() {
/** serialVersionUID **/
private static final long serialVersionUID = -4599757106887300854L;
@Override
public String getMinimizedValueAsHTML() {
return applicationContext.getMessage("alertSva.popup.link", null, UI.getCurrent().getLocale());
}
@Override
public Component getPopupComponent() {
return vlAlert;
}
};
}
示例5: init
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setSpacing(true);
/*Layout des mails*/
VerticalLayout layoutMailModel = new VerticalLayout();
layoutMailModel.setSizeFull();
layoutMailModel.setSpacing(true);
layoutMailModel.setMargin(true);
/*Layout des typ decision*/
VerticalLayout layoutMailTypeDec = new VerticalLayout();
layoutMailTypeDec.setSizeFull();
layoutMailTypeDec.setSpacing(true);
layoutMailTypeDec.setMargin(true);
/*Le layout a onglet*/
TabSheet sheet = new TabSheet();
sheet.setImmediate(true);
sheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
addComponent(sheet);
sheet.setSizeFull();
sheet.addTab(layoutMailModel, applicationContext.getMessage("mail.model.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE_O);
sheet.addTab(layoutMailTypeDec, applicationContext.getMessage("mail.typdec.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE);
/*Populate le layoutMailModel*/
populateMailModelLayout(layoutMailModel);
/*Populate le layoutMailModel*/
populateMailTypeDecLayout(layoutMailTypeDec);
/* Inscrit la vue aux mises à jour de mail */
mailEntityPusher.registerEntityPushListener(this);
}
示例6: ScolTagWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Crée une fenêtre d'édition de tag
* @param tag la tag à éditer
*/
public ScolTagWindow(Tag tag) {
/* 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("tag.window", null, UI.getCurrent().getLocale()));
/* Formulaire */
fieldGroup = new CustomBeanFieldGroup<>(Tag.class);
fieldGroup.setItemDataSource(tag);
FormLayout formLayout = new FormLayout();
formLayout.setWidth(100, Unit.PERCENTAGE);
formLayout.setSpacing(true);
for (String fieldName : FIELDS_ORDER) {
String caption = applicationContext.getMessage("tag.table." + fieldName, null, UI.getCurrent().getLocale());
Field<?> field;
if (fieldName.equals(Tag_.colorTag.getName())){
field = fieldGroup.buildAndBind(caption, fieldName, RequiredColorPickerField.class);
}else{
field = fieldGroup.buildAndBind(caption, fieldName);
}
field.setWidth(100, Unit.PERCENTAGE);
formLayout.addComponent(field);
}
RequiredColorPickerField fieldColor = (RequiredColorPickerField)fieldGroup.getField(Tag_.colorTag.getName());
if (tag.getColorTag()!=null){
fieldColor.changeFieldColor(tag.getColorTag());
}
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 tag saisie */
tagController.saveTag(tag);
/* Ferme la fenêtre */
close();
} catch (CommitException ce) {
}
});
buttonsLayout.addComponent(btnEnregistrer);
buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例7: init
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setMargin(true);
layout.setSizeFull();
Grid<DemoPerson> grid = new Grid("<b>Demo Grid</b>", new ListDataProvider(DemoPerson.getPersonList()));
grid.setCaptionAsHtml(true);
grid.setSizeFull();
grid.setSelectionMode(Grid.SelectionMode.NONE);
Grid.Column<DemoPerson, String> idColumn = grid.addColumn(DemoPerson::getId).setCaption("Id");
Grid.Column<DemoPerson, String> firstNameColumn = grid.addColumn(DemoPerson::getFirstName).setCaption("Firstname");
Grid.Column<DemoPerson, String> surNameColumn = grid.addColumn(DemoPerson::getSurName).setCaption("Surname");
Grid.Column<DemoPerson, String> companyColumn = grid.addColumn(DemoPerson::getCompany,
new ClickableTextRenderer(getCompanyClickListener())).setCaption("Company");
Grid.Column<DemoPerson, String> companyTypeColumn = grid.addColumn(DemoPerson::getCompanyType).setCaption("Company Type");
Grid.Column<DemoPerson, String> cityColumn = grid.addColumn(DemoPerson::getCity).setCaption("City");
// Use the advanced form of the Clickable Text Renderer on
// column "city". This will require a value provider where the PRESENTATION
// class is of type ClickableText. Because the city is of type String
// the value provider must convert from String to ClickableText.
cityColumn.setRenderer((String source) -> {
ClickableText ct = new ClickableText();
ct.description = "Will take you to " + source; // Sets the HTML title attribute, aka tooltip
// I want a space between the underlined text and the icon. To avoid the
// space being underlined (because of the link styling) I use a
// a different style for the space itself.
ct.value = source + "<span class=\"v-icon\"> </span>" + VaadinIcons.EXTERNAL_LINK.getHtml();
ct.isHTML = true;
return ct;
}, new ClickableTextRendererAdv<>(getCityClickListener()));
layout.addComponent(grid);
setContent(layout);
}
示例8: 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();
}
示例9: AdminBatchImmediatWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Crée une fenêtre de confirmation de lancement
* @param message
* @param titre
*/
public AdminBatchImmediatWindow(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);
buttonsLayout.addComponent(btnOui);
buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例10: AdminBatchHistoWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例11: AdminLangueWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例12: StepLabel
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/**
* Construct a new label with the given caption, description and icon.
*
* @param caption
* The caption to show
* @param description
* The description to show
* @param icon
* The icon to show
*/
public StepLabel(String caption, String description, FontIcon icon) {
active = false;
nexted = false;
skipped = false;
editable = false;
clickable = false;
iconLabel = new Label();
iconLabel.setWidthUndefined();
iconLabel.setContentMode(ContentMode.HTML);
iconLabel.addStyleName(STYLE_STEP_ICON);
captionLabel = new Label();
captionLabel.setWidth(100, Unit.PERCENTAGE);
captionLabel.addStyleName(STYLE_STEP_CAPTION);
descriptionLabel = new Label();
descriptionLabel.setWidth(100, Unit.PERCENTAGE);
descriptionLabel.addStyleName(ValoTheme.LABEL_LIGHT);
descriptionLabel.addStyleName(ValoTheme.LABEL_SMALL);
descriptionLabel.addStyleName(STYLE_STEP_DESCRIPTION);
captionWrapper = new VerticalLayout();
captionWrapper.setSpacing(false);
captionWrapper.setMargin(false);
captionWrapper.setSizeFull();
captionWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
captionWrapper.addComponent(captionLabel);
captionWrapper.addComponent(descriptionLabel);
rootLayout = new HorizontalLayout();
rootLayout.setSpacing(false);
rootLayout.setMargin(false);
rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
rootLayout.setWidth(100, Unit.PERCENTAGE);
rootLayout.addComponent(iconLabel);
rootLayout.addComponent(captionWrapper);
rootLayout.setExpandRatio(captionWrapper, 1);
setCompositionRoot(rootLayout);
addStyleName(STYLE_ROOT_LAYOUT);
setIcon(icon);
setCaption(caption);
setDescription(description);
setIconNexted(DEFAULT_ICON_NEXTED);
setIconSkipped(DEFAULT_ICON_SKIPPED);
setIconEditable(DEFAULT_ICON_EDITABLE);
setIconError(DEFAULT_ICON_ERROR);
}
示例13: VerticalLayout
import com.vaadin.ui.VerticalLayout; //導入方法依賴的package包/類
/** Layout pour les variables
* @param varMail
* @return
*/
/*private VerticalLayout getVarLegendSpecificLayout(String varMail){
VerticalLayout vl = new VerticalLayout();
vl.setWidth(300, Unit.PIXELS);
vl.setMargin(true);
vl.setSpacing(true);
Label labelTitle = new Label(applicationContext.getMessage("mail.window.var", null, UI.getCurrent().getLocale()));
labelTitle.addStyleName(StyleConstants.VIEW_SUBTITLE);
vl.addComponent(labelTitle);
String txt = "<ul>";
String[] tabSplit = varMail.split(";");
for (String property : tabSplit){
String propRegEx = "${"+property+"}";
txt += "<li><input type='text' value='"+propRegEx+"'></li>";
}
txt += "</ul>";
Label labelSearch = new Label(txt,ContentMode.HTML);
vl.addComponent(labelSearch);
return vl;
}*/
private VerticalLayout getVarLegendGeneralLayout(String varMail, Boolean withTitle){
VerticalLayout vl = new VerticalLayout();
vl.setMargin(true);
vl.setSpacing(true);
Label labelTitle = new Label(applicationContext.getMessage("mail.window.var", null, UI.getCurrent().getLocale()));
labelTitle.addStyleName(StyleConstants.VIEW_SUBTITLE);
vl.addComponent(labelTitle);
HorizontalLayout hlContent = new HorizontalLayout();
hlContent.setSpacing(true);
vl.addComponent(hlContent);
List<String> listeGen = new ArrayList<String>();
List<String> listeCandidat = new ArrayList<String>();
List<String> listeFormation = new ArrayList<String>();
List<String> listeCommission = new ArrayList<String>();
List<String> listeDossier = new ArrayList<String>();
String[] tabSplit = varMail.split(";");
for (String property : tabSplit){
if (property.startsWith("candidat.")){
listeCandidat.add(property);
}else if (property.startsWith("formation.")){
listeFormation.add(property);
}else if (property.startsWith("commission.")){
listeCommission.add(property);
}else if (property.startsWith("dossier.")){
listeDossier.add(property);
}else{
listeGen.add(property);
}
}
String titleGen = null;
if (withTitle){
titleGen = applicationContext.getMessage("mail.window.var.title.general", null, UI.getCurrent().getLocale());
}else{
titleGen = applicationContext.getMessage("mail.window.var.title.specifique", null, UI.getCurrent().getLocale());
}
getVarLayout(titleGen,listeGen,hlContent);
getVarLayout(applicationContext.getMessage("mail.window.var.title.candidat", null, UI.getCurrent().getLocale()),listeCandidat,hlContent);
getVarLayout(applicationContext.getMessage("mail.window.var.title.formation", null, UI.getCurrent().getLocale()),listeFormation,hlContent);
getVarLayout(applicationContext.getMessage("mail.window.var.title.commission", null, UI.getCurrent().getLocale()),listeCommission,hlContent);
getVarLayout(applicationContext.getMessage("mail.window.var.title.dossier", null, UI.getCurrent().getLocale()), listeDossier, hlContent);
return vl;
}
示例14: ScolTypeStatutPieceWindow
import com.vaadin.ui.VerticalLayout; //導入方法依賴的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();
}
示例15: 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();
}