本文整理匯總了Java中com.vaadin.ui.HorizontalLayout.addComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java HorizontalLayout.addComponent方法的具體用法?Java HorizontalLayout.addComponent怎麽用?Java HorizontalLayout.addComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.HorizontalLayout
的用法示例。
在下文中一共展示了HorizontalLayout.addComponent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLegendLineLayout
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
/**
* @param txtCode
* @return une ligne de légende
*/
private HorizontalLayout getLegendLineLayout(String txtCode) {
HorizontalLayout hlLineLegend = new HorizontalLayout();
hlLineLegend.setWidth(100, Unit.PERCENTAGE);
hlLineLegend.setSpacing(true);
Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png"));
Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null,
UI.getCurrent().getLocale()));
hlLineLegend.addComponent(flagImg);
hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT);
hlLineLegend.addComponent(label);
hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
hlLineLegend.setExpandRatio(label, 1);
return hlLineLegend;
}
示例2: buildToolbarButton
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
/**
* @param toolbar
* HorizontalLayout which contains all the action Buttons
* @param toolbarButton
* Which Tool bar button to create (Provided using ENUM constant)
* @param listner
* Click listener called when this button is clicked
* @return
*/
public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
ClickListener listner) {
Button button = new Button(toolbarButton.getText());
button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
button.setDescription(toolbarButton.getTooltip());
button.setStyleName(ValoTheme.BUTTON_LINK);
if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
}
button.setEnabled(false);
button.setId(toolbarButton.getId());
button.addClickListener(listner);
toolbar.addComponent(button);
return button;
}
示例3: SummaryLayout
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
public SummaryLayout(ServerApi server, BackupServiceApi backupService,
ArchiveApi archiver) {
super();
this.server = server;
this.backupService = backupService;
this.archiver = archiver;
this.summarytable = createTable();
// creating Server table
this.summarytable.addItem(new Object[] { "DNS Name: ", getHostName() }, new Integer(1));
this.summarytable.addItem(new Object[] { "IP Address: ", getIpAddress() }, new Integer(2));
this.summarytable.addItem(new Object[] { "Version: ", getVersion() }, new Integer(3));
this.summarytable.addItem(new Object[] { "Uptime: ", server.uptimeToString() }, new Integer(4));
this.summarytable.addItem(new Object[] { "Current Server Time: ", new Date().toString() }, new Integer(5));
VerticalLayout tableContainer = new VerticalLayout();
tableContainer.addComponent(this.summarytable);
addComponent(tableContainer);
addComponent(createCheckBox());
HorizontalLayout actionContainer = new HorizontalLayout();
actionContainer.addComponent(createDownloadButton());
addComponent(actionContainer);
}
示例4: buttonsLayout
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
private Layout buttonsLayout(Button... buttons) {
HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();
List<Component> components = new ArrayList<>(Arrays.asList(buttons));
// Set HTML id for each button
for(Component b : components) {
b.setId(b.getCaption().replace(' ', '-')+"-btn");
}
// Split components into sublists of 5 elements
int partitionSize = 5;
List<List<Component>> partitions = new ArrayList<>();
for (int i = 0; i < components.size(); i += partitionSize) {
partitions.add(components.subList(i, Math.min(i + partitionSize, components.size())));
}
// Create vertical layouts for each list of buttons
for(List<Component> sublist : partitions) {
VerticalLayout vLayout = new VerticalLayout();
vLayout.setMargin(false);
sublist.stream().forEach(btn -> {
btn.setSizeFull();
vLayout.addComponent(btn);
});
layout.addComponent(vLayout);
}
return layout;
}
示例5: createComponent
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的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;
}
示例6: mainLayout
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的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;
}
示例7: getButtons
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
private HorizontalLayout getButtons(Component... components) {
Button backButton = new Button("Go Back", VaadinIcons.BACKSPACE_A);
backButton.setId("back-btn");
backButton.addClickListener(e -> getUI().getNavigator().navigateTo(PersephoneViews.APPLICATIONS));
HorizontalLayout layout = new HorizontalLayout();
layout.addComponent(backButton);
layout.addComponents(components);
return layout;
}
示例8: addDataGrid
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
private void addDataGrid() {
grid = streamDataGrid.get();
grid.setWidth("100%");
HorizontalLayout bottomLayout = new HorizontalLayout();
bottomLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
bottomLayout.addComponent(grid);
bottomLayout.setWidth("100%");
addComponent(bottomLayout);
}
示例9: getLangueLayout
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
/** Renvoie un layout contenant un choix de langue et une traduction
* @param traductionOther
* @return le layout
*/
private HorizontalLayout getLangueLayout(I18nTraduction traductionOther){
/*Le layout renvoyé*/
HorizontalLayout hlLangueOther = new HorizontalLayout();
listLayoutTraductions.add(hlLangueOther);
hlLangueOther.setSpacing(true);
hlLangueOther.setWidth(100, Unit.PERCENTAGE);
/*La combobox avec les icones de drapeaux*/
ComboBoxLangue cbLangue = new ComboBoxLangue(listeLangueEnService,false);
cbLangue.selectLangue((traductionOther==null?null:traductionOther.getLangue()));
cbLangue.setWidth(75, Unit.PIXELS);
hlLangueOther.addComponent(cbLangue);
/*Le textField... ou */
AbstractField<String> tfValOther = getNewValueComponent();
tfValOther.setWidth(100, Unit.PERCENTAGE);
if (traductionOther!=null){
tfValOther.setValue(traductionOther.getValTrad());
}
hlLangueOther.addComponent(tfValOther);
hlLangueOther.setExpandRatio(tfValOther,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(hlLangueOther);listLayoutTraductions.remove(hlLangueOther);checkVisibleAddLangue();centerWindow();});
hlLangueOther.addComponent(removeLangue);
return hlLangueOther;
}
示例10: createSubHeader
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
/**
* @param caption
* Caption Text Representing Header
* @param guid
* Help GUID for caller view
* @return
* Horizontal Layout containing Caption text and Help button
*/
public static HorizontalLayout createSubHeader(String caption, String guid) {
HorizontalLayout subHeader = new HorizontalLayout();
subHeader.setWidth("100%");
subHeader.setHeight("35px");
subHeader.setSpacing(true);
subHeader.addStyleName("toolbar");
final Label title = new Label(caption);
title.setSizeUndefined();
subHeader.addComponent(title);
subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
subHeader.setExpandRatio(title, 1);
// create help button if we have some GUID else do not add this button
if (guid != null) {
Button helpButton = new Button();
helpButton.setImmediate(true);
helpButton.setStyleName(Reindeer.BUTTON_LINK);
helpButton.setDescription("Help");
helpButton.setIcon(new ThemeResource("img/Help.png"));
subHeader.addComponent(helpButton);
helpButton.addClickListener(new HelpButtonListener(guid));
}
return subHeader;
}
示例11: 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();
}
示例12: 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();
}
示例13: addHeaderAndButtons
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
private void addHeaderAndButtons() {
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("80%");
Label header = new Label("Streaming Console");
header.addStyleName(ValoTheme.LABEL_H2);
Button showButton = new Button("");
showButton.setCaption("Stream");
showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
showButton.addClickListener(click -> {
System.out.println("[x] Show button clicked ...");
// Start the data feed thread
new FeederThread().start();
});
Button sendButton = new Button("");
sendButton.setCaption("Send");
sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
sendButton.setIcon(VaadinIcons.PLUS);
sendButton.addClickListener(click -> {
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("[x] Send button clicked ...");
sender.stream();
}
};
new Thread(r).start();
});
topLayout.addComponent(header);
topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
topLayout.addComponent(showButton);
topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
topLayout.addComponent(sendButton);
topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);
addComponent(topLayout);
}
示例14: SearchCtrCandWindow
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的package包/類
/**
* Crée une fenêtre de recherche de centre de candidature
*/
public SearchCtrCandWindow() {
/* Style */
setWidth(740, Unit.PIXELS);
setHeight(480, Unit.PIXELS);
setModal(true);
setResizable(true);
/* Layout */
VerticalLayout layout = new VerticalLayout();
setContent(layout);
layout.setSizeFull();
layout.setMargin(true);
layout.setSpacing(true);
/* Titre */
setCaption(applicationContext.getMessage("ctrCand.window.search.title", null, Locale.getDefault()));
/* Table de Resultat de recherche*/
grid.addItems(centreCandidatureController.getListCentreCandidature());
grid.initColumn(FIELDS_ORDER, "ctrCand.table.", CentreCandidature_.codCtrCand.getName());
grid.addSelectionListener(e->{
// Le bouton d'enregistrement est actif seulement si un ctrCand est sélectionnée.
boolean isSelected = grid.getSelectedItem() instanceof CentreCandidature;
btnValider.setEnabled(isSelected);
});
grid.addItemClickListener(e->{
if (e.isDoubleClick()) {
grid.select(e.getItemId());
btnValider.click();
}
});
grid.setColumnWidth(CentreCandidature_.codCtrCand.getName(), 180);
grid.setExpendColumn(CentreCandidature_.libCtrCand.getName());
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: ScolAlertSvaParametreWindow
import com.vaadin.ui.HorizontalLayout; //導入方法依賴的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();
}