List of usage examples for com.vaadin.ui Layout addComponent
public void addComponent(Component c);
From source file:fr.amapj.view.engine.tools.BaseUiTools.java
License:Open Source License
static public Label addEmptyLine(Layout layout) { Label l = new Label("<br/>", ContentMode.HTML); layout.addComponent(l); return l;//from ww w .j a v a2 s . c o m }
From source file:fr.amapj.view.engine.tools.InLineFormHelper.java
License:Open Source License
public void addIn(Layout layout) { footer = new HorizontalLayout(); footer.setWidth("100%"); form.addComponent(footer);//from w w w .ja v a 2s . c o m formInLectureMode(form); layout.addComponent(form); }
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
public void buildComponent(Layout contentLayout) { startHeader("tete", 70); for (TableColumnInfo<T> col : cols) { addHeaderBox(col.title, col.width + 13); }/*from w w w .j av a 2 s .c om*/ contentLayout.addComponent(header1); // Construction du contenu de la table t = new Table(); int index = 0; for (TableColumnInfo<T> col : cols) { String property = col.property; if (property == null) { property = "property" + index; } t.addContainerProperty(property, getClass(col.type, col.editable), null); index++; } // Remplissage des lignes index = 0; for (T bean : beans) { Object[] cells = computeCell(bean); t.addItem(cells, index); index++; } t.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); t.setSelectable(true); t.setSortEnabled(false); t.setPageLength(pageLength); contentLayout.addComponent(t); }
From source file:fr.amapj.view.views.sendmail.SendMailView.java
License:Open Source License
private void addButton(Layout layout, String str, ClickListener listener) { Button b = new Button(str); b.addStyleName("primary"); b.addClickListener(listener);/*from w w w .j av a 2 s . co m*/ layout.addComponent(b); }
From source file:fr.univlorraine.mondossierweb.uicomponents.AutoComplete.java
License:Apache License
public void showChoices(List<ResultatDeRecherche> text, Layout layout, Button btnRecherche, boolean touchkitMobileDisplay) { //Si du texte est saisi if (text.size() > 0) { //Si la popup est dj instancie, on la masque if (choicesPopup != null) { choicesPopup.setPopupVisible(false); }//from w w w .java 2 s .com //Si c'est la premire fois que l'on affiche la popup if (choices == null) { //On cr la table contenant les propositions choices = new Table(); //Ajout du libell dans la table choices.addContainerProperty("lib", String.class, ""); //Si on est en affichage bureau, on ajoute le type if (!touchkitMobileDisplay) { choices.addContainerProperty("type", String.class, ""); } //On cache les headers des colonnes choices.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); //la table fait la mme largeur que le composant textfield de saisie choices.setWidth(getWidth(), getWidthUnits()); //Ajout du style css googletable choices.setStyleName("googletable"); //Si on est en affichage bureau, on dtermine la main la taille des colonnes if (!touchkitMobileDisplay) { choices.setColumnWidth("lib", 596); choices.setColumnWidth("type", 100); } choices.setImmediate(true); //Gestion du clic sur une ligne de la table -> on met la valeut de la ligne dans le textField de saisie choices.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { Item i = event.getItem(); setValue(i.getItemProperty("lib").getValue().toString()); btnRecherche.click(); } }); } else { //On vide simplement la table de son contenu prcdent choices.removeAllItems(); } //On parcourt les rsultats pour les ajouter la table int i = 1; for (ResultatDeRecherche r : text) { Item item = choices.addItem(i); item.getItemProperty("lib").setValue(r.getLib()); //Si on est en affichage bureau, on ajoute le type if (!touchkitMobileDisplay) { item.getItemProperty("type").setValue(transcodeType(r.getType())); } i++; } selectedItem = 0; //On fixe la hauteur de la table en fonction du nombre de rsultats affichs choices.setHeight(38 * text.size() + 1, Unit.PIXELS); //la table fait la mme largeur que le composant textfield de saisie choices.setWidth(getWidth(), getWidthUnits()); // Si on n'a encore jamais affich la popup if (choicesPopup == null) { //on cr la popup choicesPopup = new PopupView(new PopupTextFieldContent()); //On lui ajoute le style css googlepopupview choicesPopup.setStyleName("googlepopupview"); //On ajoute la popup au layout layout.addComponent(choicesPopup); //la popup fait la mme largeur que le composant textfield de saisie choicesPopup.setWidth(getWidth(), getWidthUnits()); choices.setSelectable(true); choices.setImmediate(true); choicesPopup.addPopupVisibilityListener(new PopupVisibilityListener() { @Override public void popupVisibilityChange(PopupVisibilityEvent event) { if (!event.isPopupVisible()) { //On masque la popup quand on perd le focus sur le champ texte choicesPopup.setVisible(false); } } }); } //On affiche la popup choicesPopup.setVisible(true); choicesPopup.setPopupVisible(true); //La popup fait la mme hauteur que la table qu'elle contient choicesPopup.setHeight(choices.getHeight(), choices.getHeightUnits()); } else { //Aucun texte n'ai saisi if (choicesPopup != null) { //On masque la popup si elle est dj instancie choicesPopup.setVisible(false); choicesPopup.setPopupVisible(false); } } }
From source file:io.subutai.plugin.accumulo.ui.manager.Manager.java
private void addGivenComponents(Layout layout, Button... buttons) { for (Button b : buttons) { layout.addComponent(b); } }
From source file:me.uni.emuseo.view.common.form.FormBuilder.java
License:Open Source License
protected void rebuildContent() { content.removeAllComponents();/*from w w w . j av a 2 s .c om*/ BeanFieldGroup<BEANTYPE> fieldGroup = getFieldGroup(); fieldGroup.setItemDataSource(this.bean); Collection<Object> boundPropertyIds = new ArrayList<Object>(fieldGroup.getBoundPropertyIds()); for (Object propertyId : boundPropertyIds) { fieldGroup.unbind(fieldGroup.getField(propertyId)); } fieldLayoutManager.clearLayouts(); for (List<String> list : this.visibleFields) { for (String visibleField : list) { Field<?> builtField = null; for (FieldBuilder fieldBuilder : fieldBuilders) { builtField = fieldBuilder.build(visibleField); if (builtField != null) { break; } } if (builtField == null) { builtField = fieldGroup.buildAndBind(visibleField); } else { fieldGroup.bind(builtField, visibleField); } for (FieldConfigurator fieldConfigurator : fieldConfigurators) { boolean fullyConfigured = fieldConfigurator.configure(builtField, visibleField); if (fullyConfigured) { break; } } Layout layoutForField = fieldLayoutManager.getLayoutForField(visibleField); layoutForField.addComponent(builtField); } } for (Layout layout : fieldLayoutManager.getLayouts()) { content.addComponent(layout); } built = true; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getLabelPreviews() { Layout grid = getPreviewLayout("Labels"); Label label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); grid.addComponent(label); label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big"); grid.addComponent(label);//from ww w . j a va2 s .c o m label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny"); grid.addComponent(label); label = new Label("<h1>Top Level Header</h1>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h1\");<br>or<br>new Label(\"<h1>Top Level Header</h1>\", Label.CONTENT_XHTML);"); label = new Label("<h2>Second Header</h2>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h2\");<br>or<br>new Label(\"<h2>Second Header</h2>\", Label.CONTENT_XHTML);"); label = new Label("<h3>Subtitle</h3>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h3\");<br>or<br>new Label(\"<h3>Subtitle</h3>\", Label.CONTENT_XHTML);"); label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); label.setStyleName("color"); grid.addComponent(label); label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big color"); grid.addComponent(label); label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small color"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny color"); grid.addComponent(label); label = new Label("Top Level Header"); label.setSizeUndefined(); label.setStyleName("h1 color"); grid.addComponent(label); label = new Label("Second Header"); label.setSizeUndefined(); label.setStyleName("h2 color"); grid.addComponent(label); label = new Label("Subtitle"); label.setSizeUndefined(); label.setStyleName("h3 color"); grid.addComponent(label); label = new Label("Warning text, lorem ipsum dolor sit."); label.setStyleName("warning"); grid.addComponent(label); label = new Label("Error text, lorem ipsum dolor."); label.setStyleName("error"); grid.addComponent(label); label = new Label("Big warning text"); label.setStyleName("big warning"); grid.addComponent(label); label = new Label("Big error text"); label.setStyleName("big error"); grid.addComponent(label); label = new Label("Loading text..."); label.setStyleName("h3 loading"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); label.addStyleName("big"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); label.addStyleName("big"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); label.addStyleName("big"); grid.addComponent(label); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getButtonPreviews() { Layout grid = getPreviewLayout("Buttons"); Button button = new Button("Button"); grid.addComponent(button); button = new Button("Default"); button.setStyleName("default"); grid.addComponent(button);/*from w w w . j a v a 2s. c om*/ button = new Button("Small"); button.setStyleName("small"); grid.addComponent(button); button = new Button("Small Default"); button.setStyleName("small default"); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); grid.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); grid.addComponent(button); button = new Button("Disabled default"); button.setEnabled(false); button.setStyleName("default"); grid.addComponent(button); button = new Button("Link style"); button.setStyleName(BaseTheme.BUTTON_LINK); grid.addComponent(button); button = new Button("Disabled link"); button.setStyleName(BaseTheme.BUTTON_LINK); button.setEnabled(false); grid.addComponent(button); button = new Button("120px overflows out of the button"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); button.setWidth("120px"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png")); grid.addComponent(button); button = new Button("Big link"); button.setStyleName(BaseTheme.BUTTON_LINK + " big"); button.setIcon(new ThemeResource("../runo/icons/32/document.png")); grid.addComponent(button); button = new Button("Borderless"); button.setStyleName("borderless"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Borderless icon on top"); button.setStyleName("borderless icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Icon on top"); button.setStyleName("icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/users.png")); grid.addComponent(button); button = new Button("Wide Default"); button.setStyleName("wide default"); grid.addComponent(button); button = new Button("Wide"); button.setStyleName("wide"); grid.addComponent(button); button = new Button("Tall"); button.setStyleName("tall"); grid.addComponent(button); button = new Button("Wide, Tall & Big"); button.setStyleName("wide tall big"); grid.addComponent(button); button = new Button("Icon on right"); button.setStyleName("icon-on-right"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big icon"); button.setStyleName("icon-on-right big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Toggle (down)"); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("down"); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); button = new Button(); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("icon-only"); button.addStyleName("down"); button.setIcon(new ThemeResource("../runo/icons/16/user.png")); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); grid.addComponent(l); l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); l.setIcon(new ThemeResource("../runo/icons/32/globe.png")); grid.addComponent(l); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getTextFieldPreviews() { Layout grid = getPreviewLayout("Text fields"); TextField tf = new TextField(); tf.setValue("Text field"); grid.addComponent(tf); tf = new TextField(); tf.setValue("Small field"); tf.setStyleName("small"); grid.addComponent(tf);// ww w.ja v a 2 s .co m tf = new TextField(); tf.setValue("Big field"); tf.setStyleName("big"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Search field"); tf.setStyleName("search"); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Small search"); tf.setStyleName("search small"); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Big search"); tf.setStyleName("search big"); grid.addComponent(tf); tf = new TextField("Error"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Error"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); tf = new TextField(); tf.setInputPrompt("Small error"); tf.setStyleName("small"); tf.setComponentError(new UserError("Test error")); grid.addComponent(tf); TextArea ta = new TextArea(); ta.setInputPrompt("Multiline"); ta.setRows(4); grid.addComponent(ta); ta = new TextArea(); ta.setInputPrompt("Small multiline"); ta.setStyleName("small"); ta.setRows(4); grid.addComponent(ta); ta = new TextArea(); ta.setInputPrompt("Big multiline"); ta.setStyleName("big"); ta.setRows(4); grid.addComponent(ta); return grid; }