List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(float width, Unit unit)
From source file:annis.gui.flatquerybuilder.SearchBox.java
License:Apache License
public SearchBox(final String ebene, final FlatQueryBuilder sq, final VerticalNode vn, boolean isRegex, boolean negativeSearch) { this.vn = vn; this.ebene = ebene; this.sq = sq; this.vfs = new ArrayList<>(); vnframe = new VerticalLayout(); vnframe.setSpacing(true);//from w ww. ja va 2 s . c om vnframe.setImmediate(true); this.sb = new VerticalLayout(); //maybe other name? sb is "reserved" by SearchBox sb.setImmediate(true); sb.setSpacing(false); //used to be true lbl = new Label(ebene); HorizontalLayout sbtoolbar = new HorizontalLayout(); sbtoolbar.setSpacing(false); // searchbox tickbox for regex reBox = new CheckBox(CAPTION_REBOX); reBox.setImmediate(true); sbtoolbar.addComponent(reBox); reBox.addValueChangeListener(new ValueChangeListener() { // TODO make this into a nice subroutine @Override public void valueChange(ValueChangeEvent event) { if (reBox.getValue()) { for (ValueField vf : vfs) { String value = vf.getValue(); vf.setValueMode(ValueField.ValueMode.REGEX); if (value != null) { vf.setValue(sq.escapeRegexCharacters(value)); } } } else { for (ValueField vf : vfs) { String value = vf.getValue(); vf.setValueMode(ValueField.ValueMode.NORMAL); if (value != null) { vf.setValue(sq.unescape(value)); } } } } }); reBox.setValue(isRegex); reBox.setEnabled(true); reBoxSingleValue = isRegex; // searchbox tickbox for negative search negSearchBox = new CheckBox(NEGATIVE_SEARCH_LABEL); negSearchBox.setImmediate(true); negSearchBox.setValue(negativeSearch); sbtoolbar.addComponent(negSearchBox); // close the searchbox btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this); btClose.setStyleName(ValoTheme.BUTTON_SMALL); HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setWidth(vnframe.getWidth(), vnframe.getWidthUnits()); titleBar.addComponent(lbl); titleBar.setComponentAlignment(lbl, Alignment.BOTTOM_LEFT); titleBar.addComponent(btClose); titleBar.setComponentAlignment(btClose, Alignment.TOP_RIGHT); btAdd = new Button(LABEL_BUTTON_ADD); btAdd.addClickListener((Button.ClickListener) this); btAdd.setStyleName(ValoTheme.BUTTON_SMALL); vnframe.addComponent(titleBar); vnframe.addComponent(sb); vnframe.addComponent(btAdd); vnframe.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT); vnframe.addComponent(sbtoolbar); ValueField vf = new ValueField(sq, this, ebene); vf.setProtected(true); vfs.add(vf); sb.addComponent(vf); setContent(vnframe); }
From source file:annis.gui.MetaDataPanel.java
License:Apache License
public MetaDataPanel(String toplevelCorpusName, String documentName) { super("Metadata"); this.toplevelCorpusName = toplevelCorpusName; this.documentName = documentName; setSizeFull();/* w ww. j av a 2s .c om*/ layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); if (documentName == null) { docs = getAllSubcorpora(toplevelCorpusName); HorizontalLayout selectionLayout = new HorizontalLayout(); Label selectLabel = new Label("Select corpus/document: "); corpusSelection = new ComboBox(); selectionLayout.addComponents(selectLabel, corpusSelection); layout.addComponent(selectionLayout); selectLabel.setSizeUndefined(); corpusSelection.setWidth(100, Unit.PERCENTAGE); corpusSelection.setHeight("-1px"); corpusSelection.addValueChangeListener(MetaDataPanel.this); selectionLayout.setWidth(100, Unit.PERCENTAGE); selectionLayout.setHeight("-1px"); selectionLayout.setSpacing(true); selectionLayout.setComponentAlignment(selectLabel, Alignment.MIDDLE_LEFT); selectionLayout.setComponentAlignment(corpusSelection, Alignment.MIDDLE_LEFT); selectionLayout.setExpandRatio(selectLabel, 0.4f); selectionLayout.setExpandRatio(corpusSelection, 0.6f); corpusSelection.addItem(toplevelCorpusName); corpusSelection.select(toplevelCorpusName); corpusSelection.setNullSelectionAllowed(false); corpusSelection.setImmediate(true); for (Annotation c : docs) { corpusSelection.addItem(c.getName()); } } else { Map<Integer, List<Annotation>> hashMData = splitListAnnotations(); List<BeanItemContainer<Annotation>> l = putInBeanContainer(hashMData); Accordion accordion = new Accordion(); accordion.setSizeFull(); // set output to none if no metadata are available if (l.isEmpty()) { addEmptyLabel(); } else { for (BeanItemContainer<Annotation> item : l) { String corpusName = item.getIdByIndex(0).getCorpusName(); String path = toplevelCorpusName.equals(corpusName) ? "corpus: " + corpusName : "document: " + corpusName; if (item.getItemIds().isEmpty()) { accordion.addTab(new Label("none"), path); } else { accordion.addTab(setupTable(item), path); } } layout.addComponent(accordion); } } }
From source file:cb_server.SettingsWindow.java
License:Open Source License
private Component getStringView(final SettingString sB, int backgroundChanger) { com.vaadin.ui.HorizontalLayout box = new HorizontalLayout(); box.setWidth(100, Unit.PERCENTAGE); com.vaadin.ui.TextField input = new TextField(sB.getName(), String.valueOf(sB.getValue())); input.setWidth(50, Unit.PERCENTAGE); input.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = -634498493292006581L; @Override/*from w w w . j av a 2s. c o m*/ public void textChange(TextChangeEvent event) { sB.setValue(event.getText()); } }); box.addComponent(input); return box; }
From source file:cb_server.SettingsWindow.java
License:Open Source License
private Component getEncryptedStringView(final SettingEncryptedString sB, int backgroundChanger) { com.vaadin.ui.HorizontalLayout box = new HorizontalLayout(); box.setWidth(100, Unit.PERCENTAGE); com.vaadin.ui.TextField input = new TextField(sB.getName(), String.valueOf(sB.getEncryptedValue())); input.setWidth(50, Unit.PERCENTAGE); input.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = -634498493292006581L; @Override/* www.ja v a2s . c o m*/ public void textChange(TextChangeEvent event) { sB.setEncryptedValue(event.getText()); } }); box.addComponent(input); return box; }
From source file:cb_server.SettingsWindow.java
License:Open Source License
private Component getFileView(final SettingFile sB, int backgroundChanger) { com.vaadin.ui.HorizontalLayout box = new HorizontalLayout(); box.setWidth(100, Unit.PERCENTAGE); com.vaadin.ui.TextField input = new TextField(sB.getName(), String.valueOf(sB.getValue())); input.setWidth(50, Unit.PERCENTAGE); input.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = -634498493292006581L; @Override//w w w . j av a2 s .com public void textChange(TextChangeEvent event) { sB.setValue(event.getText()); } }); box.addComponent(input); return box; }
From source file:cb_server.SettingsWindow.java
License:Open Source License
private Component getFolderView(final SettingFolder sB, int backgroundChanger) { com.vaadin.ui.HorizontalLayout box = new HorizontalLayout(); box.setWidth(100, Unit.PERCENTAGE); com.vaadin.ui.TextField input = new TextField(sB.getName(), String.valueOf(sB.getValue())); input.setWidth(50, Unit.PERCENTAGE); input.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = -634498493292006581L; @Override//ww w . j av a2 s . co m public void textChange(TextChangeEvent event) { sB.setValue(event.getText()); } }); box.addComponent(input); return box; }
From source file:ch.wscr.management.ui.view.MemberView.java
/** * Header der View erstellen/*from w w w .jav a 2 s.c om*/ * * @return der Header */ private Component buidViewHeader() { HorizontalLayout header = new HorizontalLayout(); header.setWidth(100f, Unit.PERCENTAGE); header.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); header.setSpacing(true); Label title = new Label("Mitgliederverwaltung"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H1); header.addComponent(title); Label gap = new Label(); gap.setWidth(10, Unit.PIXELS); header.addComponent(gap); header.setExpandRatio(title, 1); return header; }
From source file:com.cerebro.provevaadin.SignIn.java
private VerticalLayout setFirstStep() { VerticalLayout firstStep = new VerticalLayout(); CssLayout header = new CssLayout(); Label title = new Label("Benvenuto " + u.getNomeUtente() + "!"); Label istructions = new Label("Crea il tuo personaggio"); Label step = new Label("1/*"); header.addComponents(title, istructions, step); HorizontalLayout body = new HorizontalLayout(); FormLayout datiIniziali = new FormLayout(); TextField nomePG = new TextField("Nome del Personaggio"); TextField cognomePG = new TextField("Cognome del Personaggio"); OptionGroup sessoPG = new OptionGroup("Sesso del Personaggio"); sessoPG.addItems("Maschio", "Femmina"); ComboBox razzaPG = new ComboBox("Razza"); datiIniziali.addComponents(nomePG, cognomePG, sessoPG, razzaPG); HorizontalLayout descrizioneRazza = new HorizontalLayout(); descrizioneRazza.setWidth(datiIniziali.getWidth(), datiIniziali.getWidthUnits()); // Dettagli di popolazione e comportamento ComboBox razzaPG.addItem("Essere umano"); body.addComponents(datiIniziali, descrizioneRazza); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { u.setNomePG(nomePG.getValue());//from ww w. j a v a 2 s . c o m u.setCognomePG(cognomePG.getValue()); u.setSessoPG(sessoPG.getValue().toString()); u.setRazzaPG(razzaPG.getValue().toString()); this.setContent(setSecondStep()); }); footer.addComponents(next, createCancelButton()); firstStep.addComponents(header, body, footer); return firstStep; }
From source file:com.dungnv.streetfood.ui.TwinColumnUI.java
public final void init() { setMargin(true);//from w w w . jav a 2 s. co m setSpacing(true); setWidth(100f, Unit.PERCENTAGE); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSpacing(true); hLayout.setWidth(100f, Unit.PERCENTAGE); addComponent(hLayout); msLeft = new MultiSelectUI(searchField); msLeft.setWidth(100.0f, Unit.PERCENTAGE); hLayout.addComponent(msLeft); hLayout.setExpandRatio(msLeft, .45f); VerticalLayout vButtonLayout = new VerticalLayout(); vButtonLayout.setSpacing(true); hLayout.addComponent(vButtonLayout); hLayout.setExpandRatio(vButtonLayout, .1f); hLayout.setComponentAlignment(vButtonLayout, Alignment.BOTTOM_CENTER); btnLeftAll = new Button(); btnLeftAll.setWidth(100f, Unit.PERCENTAGE); btnLeftAll.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); vButtonLayout.addComponent(btnLeftAll); btnLeft = new Button(); btnLeft.setWidth(100f, Unit.PERCENTAGE); btnLeft.setIcon(FontAwesome.ANGLE_LEFT); vButtonLayout.addComponent(btnLeft); btnRight = new Button(); btnRight.setWidth(100f, Unit.PERCENTAGE); btnRight.setIcon(FontAwesome.ANGLE_RIGHT); vButtonLayout.addComponent(btnRight); btnRightAll = new Button(); btnRightAll.setWidth(100f, Unit.PERCENTAGE); btnRightAll.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); vButtonLayout.addComponent(btnRightAll); msRight = new MultiSelectUI(searchField); msRight.setWidth(100.0f, Unit.PERCENTAGE); hLayout.addComponent(msRight); hLayout.setExpandRatio(msRight, .45f); HorizontalLayout hlButtonFooter = new HorizontalLayout(); hlButtonFooter.setSpacing(true); addComponent(hlButtonFooter); setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT); btnSave = new Button(BundleUtils.getLanguage("lbl.save"), FontAwesome.SAVE); hlButtonFooter.addComponent(btnSave); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButtonFooter.addComponent(btnCancel); }
From source file:com.expressui.core.view.menu.MainMenuBar.java
License:Open Source License
@Override public void postConstruct() { super.postConstruct(); HorizontalLayout menuBarLayout = new HorizontalLayout(); setDebugId(menuBarLayout, "menuBarLayout"); menuBarLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE); setCompositionRoot(menuBarLayout);//from ww w . j a v a 2s.c om leftMenuBarRoot = new MenuBarNode(); rightMenuBarRoot = new MenuBarNode(); }