List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java
License:Open Source License
protected void createContent(VerticalLayout mainLayout) { setType(PopupType.CENTERFIT);//from w ww . j a va 2s . c o m loadParam(); param.initialize(); if (param.messageSpecifique != null) { Label messageSpeLabel = new Label(param.messageSpecifique); messageSpeLabel.addStyleName("popup-integer-grid-message"); mainLayout.addComponent(messageSpeLabel); } // Construction des headers for (GridHeaderLine line : param.headerLines) { constructHeaderLine(mainLayout, line); } // Construction de la table de saisie table = new Table(); table.addStyleName("no-vertical-lines"); table.addStyleName("no-horizontal-lines"); table.addStyleName("no-stripes"); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); // Colonne de gauche contenant un libell table.addContainerProperty(new Integer(-1), Label.class, null); table.setColumnWidth(new Integer(-1), param.leftPartLineLargeur); // Les autres colonnes correspondant la saisie des quantites for (int i = 0; i < param.nbCol; i++) { Class clzz; if (param.readOnly) { clzz = Label.class; } else { clzz = TextField.class; } table.addContainerProperty(new Integer(i), clzz, null); table.setColumnWidth(new Integer(i), param.largeurCol); } // if (param.readOnly == false) { shortCutManager = new ShortCutManager(param.nbLig, param.nbCol, param.excluded); shortCutManager.addShorcut(this.getWindow()); } // Creation de toutes les cellules pour la saisie for (int i = 0; i < param.nbLig; i++) { addRow(i); } if (param.readOnly) { table.setEditable(false); } else { table.setEditable(true); } table.setSelectable(true); table.setSortEnabled(false); table.setPageLength(getPageLength()); // Footer 0 pour avoir un espace HorizontalLayout footer0 = new HorizontalLayout(); footer0.setWidth("200px"); footer0.setHeight("20px"); // Footer 1 avec le prix total HorizontalLayout footer1 = new HorizontalLayout(); Label dateLabel = new Label(param.libPrixTotal); dateLabel.addStyleName("libprix"); footer1.addComponent(dateLabel); prixTotal = new Label(""); displayMontantTotal(); prixTotal.addStyleName("prix"); prixTotal.setWidth("100px"); footer1.addComponent(prixTotal); // Construction globale mainLayout.addComponent(table); mainLayout.addComponent(footer0); mainLayout.addComponent(footer1); // Message spcifique en bas de popup if (param.messageSpecifiqueBottom != null) { labelMessageSpecifiqueBottom = new Label(param.messageSpecifiqueBottom); labelMessageSpecifiqueBottom.addStyleName("popup-integer-grid-message"); mainLayout.addComponent(labelMessageSpecifiqueBottom); } }
From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java
License:Open Source License
private void constructHeaderLine(VerticalLayout mainLayout, GridHeaderLine line) { HorizontalLayout header1 = new HorizontalLayout(); if (line.height != -1) { header1.setHeight(line.height + "px"); }/*from w w w.j a v a2 s .c o m*/ int index = 0; for (String str : line.cells) { Label dateLabel = new Label(str); dateLabel.setSizeFull(); if (line.styleName != null) { dateLabel.addStyleName(line.styleName); } if (index == 0) { dateLabel.setWidth((param.leftPartLineLargeur + 5) + "px"); } else { dateLabel.setWidth((param.largeurCol + 2) + "px"); } header1.addComponent(dateLabel); index++; } mainLayout.addComponent(header1); }
From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java
License:Open Source License
private void addRow(int lig) { List<Object> cells = new ArrayList<Object>(); Label dateLabel = new Label(param.leftPartLine.get(lig), ContentMode.HTML); dateLabel.addStyleName(param.leftPartLineStyle); cells.add(dateLabel);/*from www . ja va2 s . c om*/ for (int j = 0; j < param.nbCol; j++) { int qte = param.qte[lig][j]; boolean isExcluded = isExcluded(lig, j); // En lecture simple if (param.readOnly) { // String txt; if (isExcluded) { txt = "XXXXXX"; } else if (qte == 0) { txt = ""; } else { txt = "" + qte; } Label tf = new Label(txt); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } // En mode normal else { // Si la cellule est exclue if (isExcluded) { TextField tf = new TextField(); tf.setValue("XXXXXX"); tf.setEnabled(false); tf.addStyleName("cell-voir"); tf.setWidth((param.largeurCol - 10) + "px"); cells.add(tf); } else { // final TextField tf = BaseUiTools.createQteField(""); tf.setData(new GridIJData(lig, j)); if (qte == 0) { tf.setConvertedValue(null); } else { tf.setConvertedValue(new Integer(qte)); } tf.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { GridIJData ij = (GridIJData) tf.getData(); int qte = readValueInCell(tf); param.updateQte(ij.i(), ij.j(), qte); displayMontantTotal(); } catch (ErreurSaisieException e) { NotificationHelper.displayNotificationQte(); } } }); tf.addStyleName("cell-saisie"); tf.setWidth((param.largeurCol - 10) + "px"); shortCutManager.registerTextField(tf); cells.add(tf); } } } table.addItem(cells.toArray(), new Integer(lig)); }
From source file:fr.amapj.view.engine.listpart.StandardListPart.java
License:Open Source License
private void buildMainArea() { // Lecture dans la base de donnes mcInfos = new BeanItemContainer<T>(beanClazz); // Bind it to a component cdesTable = createTable(mcInfos);// www .j a v a 2 s . c om drawTable(); cdesTable.setSelectable(true); cdesTable.setMultiSelect(multiSelect); cdesTable.setImmediate(true); // Activation ou desactivation des boutons delete et edit cdesTable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (multiSelect) { Set s = (Set) event.getProperty().getValue(); buttonBarEditMode(s.size() > 0); } else { buttonBarEditMode(event.getProperty().getValue() != null); } } }); cdesTable.setSizeFull(); cdesTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { cdesTable.select(event.getItemId()); } } }); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("buttonbar"); Label title2 = new Label(getTitle()); title2.setSizeUndefined(); title2.addStyleName("title"); drawButton(); for (ButtonHandler handler : buttons) { toolbar.addComponent(handler.button); } if (searchField != null) { toolbar.addComponent(searchField); toolbar.setWidth("100%"); toolbar.setExpandRatio(searchField, 1); toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT); } addComponent(title2); addSelectorComponent(); addComponent(toolbar); addExtraComponent(); addComponent(cdesTable); setExpandRatio(cdesTable, 1); refreshTable(); }
From source file:fr.amapj.view.engine.menu.MenuPart.java
License:Open Source License
private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus, Navigator navigator, AmapUI ui) { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top);//from w w w.j a va2 s . c o m final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); String nomAmap = new ParametresService().getParametres().nomAmap; Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); SessionParameters p = SessionManager.getSessionParameters(); MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null); settingsItem.addItem("Se dconnecter", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { new PasswordManager().disconnect(); ui.buildLoginView(null, null, null); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); boolean first = true; String firstEntry = null; Button firstButton = null; for (MenuDescription menuDescription : allMenus) { final String view = menuDescription.getMenuName().name().toLowerCase(); final String titleView = menuDescription.getMenuName().getTitle(); if (menuDescription.getCategorie() != null) { Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML); l.setPrimaryStyleName("valo-menu-subtitle"); l.addStyleName("h4"); l.setSizeUndefined(); menuItemsLayout.addComponent(l); } final Button b = new Button(titleView, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { setSelected(event.getButton(), menuItemsLayout); navigator.navigateTo("/" + view); } }); b.setId("amapj.menu." + view); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(menuDescription.getMenuName().getFont()); menuItemsLayout.addComponent(b); viewNameToMenuButton.put("/" + view, b); if (first) { first = false; firstButton = b; firstEntry = view; } } // Gestion de l'url String f = Page.getCurrent().getUriFragment(); if (f != null && f.startsWith("!")) { f = f.substring(1); } if (f == null || f.equals("") || f.equals("/")) { navigateWithProtect(navigator, "/" + firstEntry); setSelected(firstButton, menuItemsLayout); } else { navigateWithProtect(navigator, f); setSelected(viewNameToMenuButton.get(f), menuItemsLayout); } return menu; }
From source file:fr.amapj.view.engine.tools.BaseUiTools.java
License:Open Source License
static public Label addStdLabel(Layout layout, String content, String styleName) { Label tf = new Label(content); tf.addStyleName(styleName); layout.addComponent(tf);/*from w ww.jav a 2s .c o m*/ return tf; }
From source file:fr.amapj.view.engine.tools.BaseUiTools.java
License:Open Source License
static public Label addHtmlLabel(Layout layout, String content, String styleName) { Label tf = new Label(content, ContentMode.HTML); tf.addStyleName(styleName); layout.addComponent(tf);/* w w w. ja v a 2 s.c o m*/ return tf; }
From source file:fr.amapj.view.engine.tools.InLineFormHelper.java
License:Open Source License
public InLineFormHelper(String sectionName, String libModifier, PopupListener refreshListener, ClickListener saveListener) {// w w w. j a va 2 s .c o m super(); this.libModifier = libModifier; this.saveListener = saveListener; this.refreshListener = refreshListener; form = new FormLayout(); form.setMargin(false); Label section = new Label(sectionName); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); }
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private Label createLabel(String msg, int taille) { Label l = new Label(msg); l.addStyleName("align-center"); l.setWidth(taille + "px"); return l;// w w w . jav a 2s . com }
From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private void addHeaderBox(String msg, int taille) { Label hLabel = new Label(msg); hLabel.setWidth((taille + 13) + "px"); hLabel.setHeight(height + "px"); hLabel.addStyleName(styleName); header1.addComponent(hLabel);//from ww w . j a v a 2s. c o m }