List of usage examples for com.vaadin.ui CssLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CustomLayout boxWrapper = CustomLayoutExt.createLayout("legendBox"); final CssLayout mainLayout = new CssLayout(); mainLayout.setSizeUndefined(); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { final HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(new MarginInfo(false, false, false, true)); layout.addStyleName("inline-block"); final Comparable key = (Comparable) keys.get(i); final String color = "<div style = \" width:8px;height:8px;border-radius:5px;background: #" + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length] + "\" />"; final Label lblCircle = new Label(color); lblCircle.setContentMode(ContentMode.HTML); String btnCaption;//from www . j a va 2 s .c o m if (enumKeyCls == null) { btnCaption = String.format("%s(%d)", key, pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } final Button btnLink = new Button(btnCaption, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { PieChartWrapper.this.onClickedDescription(key.toString()); } }); btnLink.addStyleName("link"); layout.addComponent(lblCircle); layout.setComponentAlignment(lblCircle, Alignment.MIDDLE_CENTER); layout.addComponent(btnLink); layout.setComponentAlignment(btnLink, Alignment.MIDDLE_CENTER); layout.setSizeUndefined(); mainLayout.addComponent(layout); } boxWrapper.setWidth("100%"); boxWrapper.addComponent(mainLayout, "legendBoxContent"); return boxWrapper; }
From source file:com.esofthead.mycollab.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CssLayout mainLayout = new CssLayout(); mainLayout.addStyleName("legendBoxContent"); mainLayout.setSizeUndefined(); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(false, false, false, true)); layout.addStyleName("inline-block"); layout.setSizeUndefined();/*from ww w. jav a2 s. c o m*/ layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final Comparable key = (Comparable) keys.get(i); int colorIndex = i % CHART_COLOR_STR.size(); final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />"; final Label lblCircle = new Label(color); lblCircle.setContentMode(ContentMode.HTML); String btnCaption; if (enumKeyCls == null) { if (key instanceof Key) { btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true), pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue()); } } else { btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } final Button btnLink = new Button(StringUtils.trim(btnCaption, 25, true), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (key instanceof Key) { clickLegendItem(((Key) key).getKey()); } else { clickLegendItem(key.toString()); } } }); btnLink.setDescription(btnCaption); btnLink.addStyleName(UIConstants.BUTTON_LINK); layout.with(lblCircle, btnLink); mainLayout.addComponent(layout); } mainLayout.setWidth("100%"); return mainLayout; }
From source file:com.mycollab.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CssLayout mainLayout = new CssLayout(); mainLayout.addStyleName("legendBoxContent"); mainLayout.setSizeUndefined(); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)) .withStyleName("inline-block").withWidthUndefined(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final Comparable key = (Comparable) keys.get(i); int colorIndex = i % CHART_COLOR_STR.size(); final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />"; final ELabel lblCircle = ELabel.html(color); String btnCaption;// w w w . ja v a 2s. c om if (enumKeyCls == null) { if (key instanceof Key) { btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true), pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue()); } } else { btnCaption = String.format("%s(%d)", UserUIContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } MButton btnLink = new MButton(StringUtils.trim(btnCaption, 25, true), clickEvent -> { if (key instanceof Key) { clickLegendItem(((Key) key).getKey()); } else { clickLegendItem(key.toString()); } }).withStyleName(WebThemes.BUTTON_LINK).withDescription(btnCaption); layout.with(lblCircle, btnLink); mainLayout.addComponent(layout); } mainLayout.setWidth("100%"); return mainLayout; }
From source file:de.symeda.sormas.ui.SubMenu.java
License:Open Source License
public void addView(final String name, String caption, String params, boolean isBackNavigation) { String target = "#!" + name + (params != null ? "/" + params : ""); CssLayout tabItemCell = new CssLayout(); tabItemCell.setSizeUndefined(); tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell"); CssLayout tabItem = new CssLayout(); tabItem.setSizeUndefined();// w w w.j a v a 2 s . c o m tabItem.setPrimaryStyleName("v-tabsheet-tabitem"); if (isBackNavigation) { tabItem.addStyleName("back"); } tabItemCell.addComponent(tabItem); Link link = new Link(caption, new ExternalResource(target)); link.addStyleName("v-caption"); if (isBackNavigation) link.setIcon(VaadinIcons.ARROW_CIRCLE_LEFT); tabItem.addComponent(link); menuItemsLayout.addComponent(tabItemCell); viewMenuItemMap.put(name, tabItem); }
From source file:de.symeda.sormas.ui.SubMenu.java
License:Open Source License
public void addView(final String name, String caption, LayoutClickListener onClick) { CssLayout tabItemCell = new CssLayout(); tabItemCell.setSizeUndefined(); tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell"); CssLayout tabItem = new CssLayout(); tabItem.setSizeUndefined();// w ww.j a va2 s.c om tabItem.setPrimaryStyleName("v-tabsheet-tabitem"); tabItemCell.addComponent(tabItem); Link link = new Link(caption, null); link.addStyleName("v-caption"); tabItem.addComponent(link); tabItem.addLayoutClickListener(onClick); tabItem.addLayoutClickListener((e) -> { this.setActiveView(name); }); menuItemsLayout.addComponent(tabItemCell); viewMenuItemMap.put(name, tabItem); }
From source file:fr.univlorraine.mondossierweb.MainUI.java
License:Apache License
/** * Construction du menu tudiant/* w ww . j a v a 2s . c om*/ */ private void buildMainMenuEtudiant() { //Si l'tudiant dont on affiche le dossier est renseign if (etudiant != null) { //Ajout du style au menu mainMenu.setPrimaryStyleName(ValoTheme.MENU_PART); //On fixe la largeur du menu mainMenu.setWidth("233px"); //Si on a une url pour la photo de l'tudiant if (etudiant.getPhoto() != null) { //Layout contenant la photo HorizontalLayout photoLayout = new HorizontalLayout(); //Ajout du style au layout photoLayout.addStyleName(ValoTheme.MENU_SUBTITLE); //On fixe la largeur du layout photoLayout.setWidth(213, Unit.PIXELS); //La layout a des marges photoLayout.setMargin(true); //Bouton qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours. Par dfaut, icone indiquant que l'tudiant est inscrit Button etuInscritBtn = new Button("", FontAwesome.CHECK_CIRCLE); //Ajout du style au bouton etuInscritBtn.setPrimaryStyleName(ValoTheme.BUTTON_BORDERLESS); //Si l'tudiant est inscrit pour l'anne en cours if (etudiant.isInscritPourAnneeEnCours()) { //On fixe la description du bouton etuInscritBtn.setDescription("Inscrit pour l'anne universitaire " + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this))); } else { //On change l'icone du bouton pour indiquer que l'tudiant n'est pas inscrit etuInscritBtn.setIcon(FontAwesome.EXCLAMATION_CIRCLE); //On fixe la description du bouton etuInscritBtn.setDescription("Non Inscrit pour l'anne universitaire " + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this))); } //Ajout d'un lment vide dans le layout photoLayout.addComponent(new HorizontalLayout()); //Cration de l'image contenant la photo Image fotoEtudiant = new Image(null, new ExternalResource(etudiant.getPhoto())); fotoEtudiant.setWidth("120px"); //Ajout de la photo au layout photoLayout.addComponent(fotoEtudiant); //Alignement de la photo photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER); //La photo prend toute la place disponible dans son layout photoLayout.setExpandRatio(fotoEtudiant, 1); //Ajout au layout du bouton, qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours photoLayout.addComponent(etuInscritBtn); //Ajout du layout de la photo au menu mainMenu.addComponent(photoLayout); } //Ajout du Prnom/Nom et codetu de l'tudiant dans le menu Label usernameLabel = new Label(etudiant.getNom() + "<br />" + etudiant.getCod_etu(), ContentMode.HTML); usernameLabel.addStyleName(ValoTheme.MENU_SUBTITLE); usernameLabel.addStyleName("retourALaLigneAutomatique"); usernameLabel.setSizeUndefined(); mainMenu.addComponent(usernameLabel); /* Etat Civil */ addItemMenu("Etat-civil", EtatCivilView.NAME, FontAwesome.USER); //info annuelles visibles que si tudiant inscrit pour l'anne en cours if (etudiant.isInscritPourAnneeEnCours()) { addItemMenu("Informations annuelles", InformationsAnnuellesView.NAME, FontAwesome.INFO_CIRCLE); } /* Adresses */ addItemMenu(applicationContext.getMessage(AdressesView.NAME + ".title", null, getLocale()), AdressesView.NAME, FontAwesome.HOME); /* Inscriptions */ addItemMenu("Inscriptions", InscriptionsView.NAME, FontAwesome.FILE_TEXT); /* Calendrier */ addItemMenu("Calendrier des preuves", CalendrierView.NAME, FontAwesome.CALENDAR); /* Notes et Rsultats */ addItemMenu(applicationContext.getMessage(NotesView.NAME + ".title", null, getLocale()), NotesView.NAME, FontAwesome.LIST); /* Sparation avant Bouton "Aide" */ CssLayout bottomMainMenu1 = new CssLayout(); bottomMainMenu1.setStyleName(ValoTheme.MENU_SUBTITLE); bottomMainMenu1.setSizeUndefined(); mainMenu.addComponent(bottomMainMenu1); /* Aide */ Button helpBtn = new Button(applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()), FontAwesome.SUPPORT); helpBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); helpBtn.addClickListener(e -> { UI.getCurrent() .addWindow(new HelpBasicWindow( applicationContext.getMessage("helpWindow.text.etudiant", null, getLocale()), applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()), true)); }); mainMenu.addComponent(helpBtn); /* Deconnexion */ //Voir si on peut accder l'appli hors ENT, le dtecter, et afficher le bouton dconnexion if (configController.isLogoutCasPropose() && userController.isEtudiant()) { Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT); decoBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); decoBtn.addClickListener(e -> { getUI().getPage().setLocation("j_spring_security_logout"); }); mainMenu.addComponent(decoBtn); } /* Sparation */ CssLayout bottomMainMenu = new CssLayout(); bottomMainMenu.setStyleName(ValoTheme.MENU_SUBTITLE); bottomMainMenu.setSizeUndefined(); mainMenu.addComponent(bottomMainMenu); } }
From source file:org.semanticsoft.vaaclipse.presentation.renderers.PartRenderer.java
License:Open Source License
@Override public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) { VerticalLayout pane = new VerticalLayout(); pane.setSizeFull();/*from w w w . ja va2 s . co m*/ final MPart part = (MPart) element; CssLayout toolbarArea = new CssLayout(); toolbarArea.setStyleName("mparttoolbararea"); toolbarArea.setSizeUndefined(); toolbarArea.setWidth("100%"); pane.addComponent(toolbarArea); //create toolbar MToolBar toolbar = part.getToolbar(); if (toolbar != null && toolbar.isToBeRendered()) { Component toolbarWidget = (Component) renderingEngine.createGui(toolbar); ((AbstractLayout) toolbarWidget).setSizeUndefined(); toolbarWidget.setStyleName("mparttoolbar"); toolbarArea.addComponent(toolbarWidget); } VerticalLayout contributionArea = new VerticalLayout(); contributionArea.setSizeFull(); pane.addComponent(contributionArea); pane.setExpandRatio(contributionArea, 100); pane.setStyleName("part"); element.setWidget(pane); IEclipseContext localContext = part.getContext(); localContext.set(Component.class, contributionArea); localContext.set(ComponentContainer.class, contributionArea); localContext.set(VerticalLayout.class, contributionArea); localContext.set(MPart.class, part); SavePromptSetup savePromptProvider = new SavePromptSetup(); savePrompts.put(part, savePromptProvider); localContext.set(SavePromptSetup.class, savePromptProvider); if (part instanceof MInputPart) localContext.set(MInputPart.class, (MInputPart) part); IContributionFactory contributionFactory = (IContributionFactory) localContext .get(IContributionFactory.class.getName()); Object newPart = contributionFactory.create(part.getContributionURI(), localContext); part.setObject(newPart); }
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
private ComponentContainer getSearchFilter(final Entity entity, final UserAction ua, final OpenGroupsApplication app, final ActionContext ac) { final ComboBox select = new ComboBox(); select.setImmediate(true);//from w w w. jav a2 s.c om select.setNullSelectionAllowed(true); select.setNewItemsAllowed(true); String stringToBigError = OpenGroupsResources.getMessage("search.string.to.big.error"); select.addValidator(new StringLengthValidator(stringToBigError, 0, 1000, true)); select.setWidth("350px"); final String paramName = "searchString"; String searchValue = (String) entity.getFilterValue(paramName); if (searchValue != null) { select.addItem(searchValue); select.setValue(searchValue); } // HorizontalLayout layout = new HorizontalLayout(); // layout.setSpacing(true); // layout.setSizeUndefined(); // final String searchCaption = OpenGroupsResources.getMessage("search"); // Button searchButton = new Button(searchCaption); // searchButton.addListener(new ClickListener() { // // @Override // public void buttonClick(ClickEvent event) { // select.validate(); // String value = (String) select.getValue(); // if (value != null && "".equals(value.trim())) { // value = null; // } // FilterOption fo = new FilterOption(searchCaption, paramName, value); // entity.setFilter(fo); // refreshList(entity, ua, app, entity.getState().getLastUsedContainer()); // } // }); select.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { select.validate(); String value = (String) select.getValue(); if (value != null && "".equals(value.trim())) { value = null; } FilterOption fo = new FilterOption(null, paramName, value); entity.setFilter(fo); /* set current page to 1 */ entity.getState().resetPageInfoForCurrentAction(); refreshList(entity, ua, app, entity.getState().getLastUsedContainer(), ac); } }); CssLayout container = new CssLayout(); container.setSizeUndefined(); Embedded eicon = new Embedded(null, OpenGroupsResources.getIcon(OpenGroupsIconsSet.SEARCH, OpenGroupsIconsSet.MEDIUM)); eicon.setDescription(getMessage("search")); eicon.addStyleName("middle-left right-margin-10"); select.addStyleName("middle-left"); // Label label = new Label(getMessage("search")); // container.addComponent(label); container.addComponent(eicon); container.addComponent(select); return container; }