List of usage examples for com.vaadin.ui VerticalLayout addStyleName
@Override public void addStyleName(String style)
From source file:edu.nps.moves.security.PasswordResetUI.java
License:Open Source License
private void handleChangeTL(User user) { this.user = user; Game g = Game.getTL();// w ww .ja v a 2 s. co m String brand = g.getCurrentMove().getTitle(); Page.getCurrent().setTitle("Password reset for " + brand + " mmowgli"); HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(true); hLay.setWidth("100%"); setContent(hLay); GameLinks gl = GameLinks.getTL(); String blog = gl.getBlogLink(); Label lab; hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); VerticalLayout vl = new VerticalLayout(); hLay.addComponent(vl); vl.setWidth(bannerWidthPx); hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); vl.addStyleName("m-greyborder"); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(lab = new HtmlLabel("")); lab.addStyleName("m-font-21-bold"); lab.setSizeUndefined(); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); StringBuilder sb = new StringBuilder(); sb.append(thanksHdr1); sb.append(blog); sb.append(thanksHdr2); sb.append(brand); sb.append(thanksHdr3); lab.setValue(sb.toString()); vl.addComponent(lab = new HtmlLabel("")); lab.setHeight("15px"); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); FormLayout fLay = new FormLayout(); fLay.setSizeUndefined(); fLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) vl.addComponent(fLay); vl.setComponentAlignment(fLay, Alignment.MIDDLE_CENTER); newPw = new PasswordField("New Password"); newPw.setWidth("99%"); fLay.addComponent(newPw); newPw2 = new PasswordField("Again, please"); newPw2.setWidth("99%"); fLay.addComponent(newPw2); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vl.addComponent(buttLay); vl.setComponentAlignment(buttLay, Alignment.TOP_CENTER); NativeButton cancelButt = new NativeButton(); cancelButt.setStyleName("m-cancelButton"); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); saveButt = new NativeButton(); saveButt.setClickShortcut(ShortcutAction.KeyCode.ENTER); saveButt.setStyleName("m-continueButton"); //m-saveChangesButton"); buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); cancelButt.addClickListener(this); saveButt.addClickListener(this); }
From source file:fi.semantum.strategia.widget.NumberTrafficValuation.java
License:Open Source License
@Override public Runnable getEditor(VerticalLayout layout, final Main main, final Meter meter) { Indicator indicator = meter.getPossibleIndicator(main.getDatabase()); String unit = indicator.getUnit(); final ComboBox combo = new ComboBox("Valitse mittarin mritystapa"); combo.addItem(State.INCREASE3); combo.addItem(State.DECREASE3); combo.addItem(State.INCREASE2); combo.addItem(State.DECREASE2); combo.setInvalidAllowed(false);/* w w w . ja va 2 s . c o m*/ combo.setNullSelectionAllowed(false); combo.setWidth("100%"); combo.addStyleName(ValoTheme.COMBOBOX_TINY); layout.addComponent(combo); layout.setComponentAlignment(combo, Alignment.TOP_CENTER); layout.setExpandRatio(combo, 0.0f); final VerticalLayout vl1 = new VerticalLayout(); vl1.setHeight("50px"); vl1.setWidth("100%"); vl1.setStyleName("redBlock"); layout.addComponent(vl1); layout.setComponentAlignment(vl1, Alignment.TOP_CENTER); layout.setExpandRatio(vl1, 0.0f); final Label l1 = new Label(" > " + df.format(greenLimit.doubleValue()) + " " + unit); l1.setSizeUndefined(); l1.addStyleName(ValoTheme.LABEL_LARGE); vl1.addComponent(l1); vl1.setComponentAlignment(l1, Alignment.MIDDLE_CENTER); HorizontalLayout hl1 = new HorizontalLayout(); hl1.setSpacing(true); layout.addComponent(hl1); layout.setComponentAlignment(hl1, Alignment.TOP_LEFT); final TextField tf1 = new TextField(); tf1.setValue(df.format(greenLimit.doubleValue())); tf1.setWidth("150px"); tf1.setCaption("Suurempi raja-arvo"); tf1.setStyleName(ValoTheme.TEXTFIELD_TINY); tf1.setValidationVisible(true); hl1.addComponent(tf1); Label unit1 = new Label(); unit1.setSizeUndefined(); unit1.setCaption(""); unit1.setValue(unit); hl1.addComponent(unit1); hl1.setComponentAlignment(unit1, Alignment.MIDDLE_LEFT); final VerticalLayout vl2 = new VerticalLayout(); vl2.setHeight("50px"); vl2.setWidth("100%"); vl2.addStyleName("yellowBlock"); layout.addComponent(vl2); layout.setComponentAlignment(vl2, Alignment.TOP_CENTER); layout.setExpandRatio(vl2, 0.0f); final Label l2 = new Label(); l2.setSizeUndefined(); l2.addStyleName(ValoTheme.LABEL_LARGE); vl2.addComponent(l2); vl2.setComponentAlignment(l2, Alignment.MIDDLE_CENTER); HorizontalLayout hl2 = new HorizontalLayout(); hl2.setSpacing(true); layout.addComponent(hl2); layout.setComponentAlignment(hl2, Alignment.TOP_LEFT); final TextField tf2 = new TextField(); tf2.setWidth("150px"); tf2.setCaption("Pienempi raja-arvo"); tf2.setStyleName(ValoTheme.TEXTFIELD_TINY); tf2.setValidationVisible(true); hl2.addComponent(tf2); hl2.setComponentAlignment(tf2, Alignment.TOP_CENTER); Label unit2 = new Label(); unit2.setSizeUndefined(); unit2.setCaption(""); unit2.setValue("" + unit); hl2.addComponent(unit2); hl2.setComponentAlignment(unit2, Alignment.MIDDLE_LEFT); final VerticalLayout vl3 = new VerticalLayout(); vl3.setHeight("50px"); vl3.setWidth("100%"); vl3.addStyleName("greenBlock"); layout.addComponent(vl3); layout.setComponentAlignment(vl3, Alignment.TOP_CENTER); layout.setExpandRatio(vl3, 0.0f); final Label l3 = new Label(); l3.setSizeUndefined(); l3.addStyleName(ValoTheme.LABEL_LARGE); vl3.addComponent(l3); vl3.setComponentAlignment(l3, Alignment.MIDDLE_CENTER); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); combo.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8396168732300003038L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; State currentState = getState(); if (currentState.equals(combo.getValue())) return; if (State.DECREASE3.equals(combo.getValue())) { makeThree = true; if (State.INCREASE3.equals(currentState)) { swap(); } else if (State.INCREASE2.equals(currentState)) { redLimit = greenLimit; greenLimit = null; } } else if (State.INCREASE3.equals(combo.getValue())) { makeThree = true; if (State.DECREASE3.equals(currentState)) { swap(); } else if (State.DECREASE2.equals(currentState)) { greenLimit = redLimit; redLimit = null; } } else if (State.INCREASE2.equals(combo.getValue())) { if (State.DECREASE3.equals(currentState)) { greenLimit = redLimit; } else if (State.DECREASE2.equals(currentState)) { greenLimit = redLimit; } redLimit = null; makeThree = false; } else if (State.DECREASE2.equals(combo.getValue())) { if (State.INCREASE3.equals(currentState)) { redLimit = greenLimit; } else if (State.INCREASE2.equals(currentState)) { redLimit = greenLimit; } greenLimit = null; makeThree = false; } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); tf1.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -5484608577999300097L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; if (State.DECREASE3.equals(combo.getValue())) { if (makeThree) greenLimit = redLimit; redLimit = new BigDecimal(tf1.getValue()); } else if (State.INCREASE3.equals(combo.getValue())) { if (makeThree) redLimit = greenLimit; greenLimit = new BigDecimal(tf1.getValue()); } else if (State.INCREASE2.equals(combo.getValue())) { greenLimit = new BigDecimal(tf1.getValue()); } else if (State.DECREASE2.equals(combo.getValue())) { redLimit = new BigDecimal(tf1.getValue()); } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); tf2.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 5825320869230527588L; @Override public void valueChange(ValueChangeEvent event) { if (inApply) return; // This should not happen! if (State.INCREASE2.equals(combo.getValue()) || State.DECREASE2.equals(combo.getValue())) return; if (State.DECREASE3.equals(combo.getValue())) { greenLimit = new BigDecimal(tf2.getValue()); } else if (State.INCREASE3.equals(combo.getValue())) { redLimit = new BigDecimal(tf2.getValue()); } updateMakeThree(); applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2); } }); return null; }
From source file:fr.amapj.view.engine.collectioneditor.CollectionEditor.java
License:Open Source License
@Override protected Component initContent() { VerticalLayout vl = new VerticalLayout(); vl.addStyleName("collection-editor"); buildTable();// w w w . j av a 2s . c o m vl.addComponent(getTable()); if (hasOneButtonOrMore()) { addButtons(vl); } return vl; }
From source file:fr.amapj.view.engine.excelgenerator.TelechargerPopup.java
License:Open Source License
protected void createContent(VerticalLayout contentLayout) { contentLayout.addStyleName("popup-telecharger"); Label l = new Label("Veuillez cliquer sur le lien du fichier que vous souhaitez tlcharger"); l.addStyleName("titre"); contentLayout.addComponent(l);/*from www . j a v a 2s . co m*/ // Calcul des liens List<CoreGenerator> gs = new ArrayList<CoreGenerator>(); for (Item item : items) { if (item.generator != null) { gs.add(item.generator); } } List<FileInfoDTO> fileInfoDTOs = new CoreGeneratorService().getFileInfo(gs); // Affichage int i = 0; for (Item item : items) { if (item.generator != null) { FileInfoDTO fileInfoDTO = fileInfoDTOs.get(i); addLink(contentLayout, fileInfoDTO); i++; } else { Label lab = new Label(item.label, ContentMode.HTML); lab.addStyleName("separateur"); contentLayout.addComponent(lab); } } }
From source file:fr.amapj.view.engine.popup.corepopup.CorePopup.java
License:Open Source License
public void createPopup() { // Creation du contenu VerticalLayout contentLayout = new VerticalLayout(); createContent(contentLayout);//from www .j a v a 2 s . c o m // Construction de la barre de boutons popupButtonBarLayout = new HorizontalLayout(); popupButtonBarLayout.setMargin(false); popupButtonBarLayout.addStyleName("buttonbar"); createButtonBar(); popupButtonBarLayout.setSpacing(true); // Creation de la fenetre window.setClosable(true); window.setResizable(true); window.setModal(true); // Agencement suivant le type if (popupType == PopupType.CENTERFIT) { // contentLayout.setWidthUndefined(); // VerticalLayout mainLayout = new VerticalLayout(); mainLayout.addStyleName("corepopup"); mainLayout.setResponsive(true); mainLayout.addStyleName("centerfit-corepopup"); mainLayout.addStyleName("centerfit-corepopup-" + getWidthRange()); mainLayout.setWidth(null); // mainLayout.addComponent(contentLayout); // popupButtonBarLayout.setWidth(null); mainLayout.addComponent(popupButtonBarLayout); mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT); // window.setContent(mainLayout); window.setSizeUndefined(); } else { // contentLayout.setWidth("100%"); // VerticalLayout mainLayout = new VerticalLayout(); mainLayout.addStyleName("corepopup"); mainLayout.setResponsive(true); mainLayout.addStyleName("fill-corepopup"); mainLayout.addStyleName("fill-corepopup-" + getWidthRange()); mainLayout.setWidth("100%"); // mainLayout.addComponent(contentLayout); // popupButtonBarLayout.setWidth(null); mainLayout.addComponent(popupButtonBarLayout); mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT); // window.setContent(mainLayout); computeWindowSize(); // window.setHeight(popupHeight); } // Partie commune dans tous les cas window.center(); window.setCaption(popupTitle); window.setStyleName("opaque"); if (colorStyle == ColorStyle.RED) { window.setStyleName("corepopup-red"); } }
From source file:fr.amapj.view.engine.popup.formpopup.tab.TabFormPopup.java
License:Open Source License
protected void createContent(VerticalLayout contentLayout) { ///* w ww. ja va 2 s . c o m*/ contentLayout.addStyleName("wizard-popup"); // TODO // Vrification des conditions initiales String str = checkInitialCondition(); if (str != null) { errorInInitialCondition = true; Label label = new Label(str, ContentMode.HTML); label.setStyleName(ChameleonTheme.LABEL_BIG); contentLayout.addComponent(label); return; } // Mise en place des onglets addTabInfo(); tabSheet = new TabSheet(); for (int i = 0; i < tabInfos.size(); i++) { TabInfo tabInfo = tabInfos.get(i); tabInfo.verticalLayout = new VerticalLayout(); tabInfo.verticalLayout.setData(i); tabSheet.addTab(tabInfo.verticalLayout, tabInfo.tabName); } tabSheet.addSelectedTabChangeListener(this); contentLayout.addComponent(tabSheet); vLayout = new VerticalLayout(); contentLayout.addComponent(vLayout); // Affichage du premier onglet updateForm(tabInfos.get(0)); selectedTab = 0; }
From source file:fr.amapj.view.engine.popup.formpopup.WizardFormPopup.java
License:Open Source License
protected void createContent(VerticalLayout contentLayout) { ////from w ww . j av a2 s. co m this.contentLayout = contentLayout; contentLayout.addStyleName("wizard-popup"); EnumSet enums = EnumSet.allOf(getEnumClass()); enumArray = enums.toArray(); // Chargement de la dfinition de chaque tape configure(); // Verification de la configuration for (Object en : enumArray) { DetailStepInfo stepInfo = details.get(en); if (stepInfo == null) { throw new AmapjRuntimeException("Wizard : Pas de configuration pour la partie " + en); } } // Vrification des conditions initiales String str = checkInitialCondition(); if (str != null) { errorInInitialCondition = true; displayErrorOnInitialCondition(str); return; } // Mise en place du titre hTitre = new Label(""); hTitre.addStyleName("wizard-popup-etape"); contentLayout.addComponent(hTitre); // updateForm(); }
From source file:fr.amapj.view.engine.popup.swicthpopup.SwitchPopup.java
License:Open Source License
protected void createContent(VerticalLayout contentLayout) { contentLayout.addStyleName("popup-switch"); loadFollowingPopups();//from w w w . j a v a 2 s .com if (header != null) { contentLayout.addComponent(new Label(header, ContentMode.HTML)); } group = new OptionGroup(line1); group.setHtmlContentAllowed(true); for (SwitchPopupInfo info : infos) { group.addItem(info.lib); } contentLayout.addComponent(group); }
From source file:fr.amapj.view.views.common.gapviewer.DatePerDateViewer.java
License:Open Source License
/** * @return /*www .j ava 2 s. c om*/ * */ public VerticalLayout getComponent() { VerticalLayout vl = new VerticalLayout(); vl.setMargin(false); vl.setSpacing(false); vl.addStyleName("date-viewer"); // Bandeau avec les boutons droit / gauche HorizontalLayout hl1 = new HorizontalLayout(); hl1.setWidth("100%"); previous = addButton(false, hl1, e -> reculer()); Label empty = new Label(); hl1.addComponent(empty); hl1.setExpandRatio(empty, 1.0f); next = addButton(true, hl1, e -> avancer()); vl.addComponent(hl1); // Bandeau avec la date visualise titre = new Label(); hl1.addStyleName("titre"); titre.setSizeUndefined(); vl.addComponent(titre); vl.setComponentAlignment(titre, Alignment.MIDDLE_CENTER); updateButtonState(); return vl; }
From source file:fr.amapj.view.views.common.gapviewer.MonthViewer.java
License:Open Source License
/** * @return /*from w w w . ja va 2s . c om*/ * */ public VerticalLayout getComponent() { VerticalLayout vl = new VerticalLayout(); vl.setMargin(false); vl.setSpacing(false); vl.addStyleName("semaine-viewer"); // Bandeau avec les boutons droit / gauche HorizontalLayout hl1 = new HorizontalLayout(); hl1.setWidth("100%"); addButton(false, hl1, e -> reculer()); Label empty = new Label(); hl1.addComponent(empty); hl1.setExpandRatio(empty, 1.0f); addButton(true, hl1, e -> avancer()); vl.addComponent(hl1); // Bandeau avec la date du mois visualise titre = new Label(); hl1.addStyleName("titre"); titre.setSizeUndefined(); vl.addComponent(titre); vl.setComponentAlignment(titre, Alignment.MIDDLE_CENTER); updateTitreValue(); return vl; }