List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:fi.semantum.strategia.widget.Tag.java
License:Open Source License
public static void updateRelatedTags(final Main main, boolean canWrite) { final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; Collection<Tag> tags = base.getRelatedTags(database); if (!tags.isEmpty() || canWrite) { HorizontalLayout tagHeader = new HorizontalLayout(); tagHeader.setSpacing(true);//from www .j a va2 s .co m Label header2 = new Label("Aihetunnisteet"); header2.setHeight("32px"); header2.addStyleName(ValoTheme.LABEL_HUGE); header2.addStyleName(ValoTheme.LABEL_BOLD); tagHeader.addComponent(header2); tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editTags = new Image("", new ThemeResource("tag_blue_edit.png")); editTags.setHeight("24px"); editTags.setWidth("24px"); editTags.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = -6140867347404571880L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editTags); Utils.editTags(main, "Muokkaa aihetunnisteita", main.getUIState().currentItem); } }); tagHeader.addComponent(editTags); tagHeader.setComponentAlignment(editTags, Alignment.BOTTOM_CENTER); } main.properties.addComponent(tagHeader); main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER); HorizontalLayout divider = new HorizontalLayout(); main.properties.addComponent(divider); main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER); VerticalLayout left = new VerticalLayout(); left.setSpacing(true); left.setWidth("400px"); left.setMargin(true); divider.addComponent(left); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setWidth("400px"); right.setMargin(true); divider.addComponent(right); Set<Tag> monitoredTags = getMonitoredTags(database, base); int i = 0; for (final Tag tag : tags) { final boolean monitor = base.hasMonitorTag(database, tag); String tagId = tag.getId(database); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setHeight("37px"); Button tagButton = Utils.tagButton(database, "list", tagId, i++); left.addComponent(tagButton); left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT); if (canWrite) { Button b = new Button(); b.addStyleName(ValoTheme.BUTTON_BORDERLESS); b.setIcon(FontAwesome.TIMES_CIRCLE); b.addClickListener(new ClickListener() { private static final long serialVersionUID = -4473258383318654850L; @Override public void buttonClick(ClickEvent event) { base.removeRelatedTags(database, tag); Utils.loseFocus(main.properties); Updates.update(main, true); } }); hl.addComponent(b); hl.setComponentAlignment(b, Alignment.MIDDLE_LEFT); } if (base instanceof Strategiakartta) { Button tagButton2 = new Button(); tagButton2.setCaption(monitor ? "Seurataan toteutuksessa" : "Ei seurata toteutuksessa"); tagButton2.addStyleName(monitor ? "greenButton" : "redButton"); tagButton2.addStyleName(ValoTheme.BUTTON_SMALL); tagButton2.setWidth("200px"); if (canWrite) { tagButton2.addClickListener(new ClickListener() { private static final long serialVersionUID = -1769769368034323594L; @Override public void buttonClick(ClickEvent event) { if (monitor) { base.removeMonitorTags(database, tag); } else { base.assertMonitorTags(database, tag); } Utils.loseFocus(main.properties); Updates.update(main, true); } }); tagButton2.setEnabled(true); } else { tagButton2.setEnabled(false); } hl.addComponent(tagButton2); hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT); } else { if (monitoredTags.contains(tag)) { Label l = new Label(" toteuttaa seurattavaa aihetta "); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); } } right.addComponent(hl); right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); } } }
From source file:fi.semantum.strategia.widget.Tag.java
License:Open Source License
public static void updateMonitoredTags(final Main main, boolean canWrite) { final Database database = main.getDatabase(); final Base base = main.getUIState().currentItem; if (!(base instanceof Tavoite || base instanceof Painopiste)) return;/* w w w . j a va2 s.c o m*/ Set<Tag> monitoredTags = getMonitoredTags(database, base); monitoredTags.removeAll(base.getRelatedTags(database)); Map<String, Base> implementors = new HashMap<String, Base>(); for (Base impl : Utils.getImplementationSet(database, base)) { for (Tag i : impl.getRelatedTags(database)) { if (monitoredTags.contains(i)) { implementors.put(i.uuid, impl); } } } if (!monitoredTags.isEmpty() || canWrite) { HorizontalLayout tagHeader = new HorizontalLayout(); tagHeader.setSpacing(true); Label header2 = new Label("Seurattavat aihetunnisteet"); header2.setHeight("32px"); header2.addStyleName(ValoTheme.LABEL_HUGE); header2.addStyleName(ValoTheme.LABEL_BOLD); tagHeader.addComponent(header2); tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER); main.properties.addComponent(tagHeader); main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER); HorizontalLayout divider = new HorizontalLayout(); main.properties.addComponent(divider); main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER); VerticalLayout left = new VerticalLayout(); left.setSpacing(true); left.setWidth("400px"); left.setMargin(true); divider.addComponent(left); VerticalLayout right = new VerticalLayout(); right.setSpacing(true); right.setWidth("400px"); right.setMargin(true); divider.addComponent(right); int i = 0; for (final Tag tag : monitoredTags) { String tagId = tag.getId(database); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setHeight("37px"); Button tagButton = Utils.tagButton(database, "inferred", tagId, i++); left.addComponent(tagButton); left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT); Base implementor = implementors.get(tag.uuid); if (implementor != null) { String desc = implementor.getId(database); if (desc.isEmpty()) desc = implementor.getText(database); Label tagLabel = new Label("Toteutetaan ylemmll tasolla: " + desc); hl.addComponent(tagLabel); hl.setComponentAlignment(tagLabel, Alignment.MIDDLE_LEFT); } else { Button tagButton2 = new Button(); tagButton2.setCaption("Merkitse toteuttajaksi"); tagButton2.addStyleName("redButton"); tagButton2.addStyleName(ValoTheme.BUTTON_SMALL); tagButton2.setWidth("200px"); if (canWrite) { tagButton2.addClickListener(new ClickListener() { private static final long serialVersionUID = -1769769368034323594L; @Override public void buttonClick(ClickEvent event) { base.assertRelatedTags(database, tag); Utils.loseFocus(main.properties); Updates.update(main, true); } }); tagButton2.setEnabled(true); } else { tagButton2.setEnabled(false); } hl.addComponent(tagButton2); hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT); } right.addComponent(hl); right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT); } } }
From source file:foo.MyVaadinApplication.java
License:Apache License
/** * Initializes the middle banner/*from ww w.j ava2 s .c om*/ * * @return initialized middle banner */ private Panel initMiddlePanel() { HorizontalLayout h = new HorizontalLayout(); SidePanel sidePanel = new SidePanel(this); h.addComponent(sidePanel); h.setComponentAlignment(sidePanel, Alignment.MIDDLE_LEFT); contentPanel = new ContentPanel(this); h.addComponent(contentPanel); h.setComponentAlignment(contentPanel, Alignment.TOP_CENTER); Panel middlePanel = new Panel(); middlePanel.setContent(h); return middlePanel; }
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 va 2 s . c om*/ 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.popup.formpopup.tab.TabFormPopup.java
License:Open Source License
/** * Construction de la form/*from ww w. j a va 2s .c om*/ */ private void updateForm(TabInfo tabInfo) { vLayout.removeAllComponents(); // Construction de la forme form = new FormLayout(); form.setWidth("100%"); form.setImmediate(true); // binder = new FieldGroup(); binder.setBuffered(true); binder.setItemDataSource(item); // validatorManager.reset(); // tabInfo.tabDraw.drawTab(); // vLayout.addComponent(form); vLayout.setComponentAlignment(form, Alignment.MIDDLE_LEFT); }
From source file:fr.amapj.view.engine.popup.formpopup.WizardFormPopup.java
License:Open Source License
private void updateForm() { if (form != null) { contentLayout.removeComponent(form); }//from w ww . j ava2 s. c o m // Construction de la forme form = new FormLayout(); form.setWidth("100%"); form.setImmediate(true); // binder = new FieldGroup(); binder.setBuffered(true); binder.setItemDataSource(item); // validatorManager.reset(); // Dclaration des proprits et construction des champs Enum current = (Enum) enumArray[pageNumber]; DetailStepInfo stepInfo = details.get(current); stepInfo.drawScreen.action(); // Dessin de l'cran contentLayout.addComponent(form); contentLayout.setComponentAlignment(form, Alignment.MIDDLE_LEFT); }
From source file:fr.amapj.view.engine.tools.InLineFormHelper.java
License:Open Source License
/** * Permet de positionner une form en mode Edition, avec un bouton cancel et * save/*from ww w . ja v a2 s . c om*/ * * @param footer * @param canceListener * @param saveListener * @param form */ private void formInCancelSaveMode(FormLayout form) { // form.removeStyleName("light"); // Iterator<Component> i = form.iterator(); while (i.hasNext()) { Component c = i.next(); if (c instanceof com.vaadin.ui.AbstractField) { AbstractField field = (AbstractField) c; field.setReadOnly(false); } } // footer.removeAllComponents(); footer.setMargin(false); footer.setSpacing(true); Label l = new Label(); footer.addComponent(l); footer.setExpandRatio(l, 1.0f); Button cancel = new Button("Annuler"); cancel.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { refreshListener.onPopupClose(); formInLectureMode(form); } }); footer.addComponent(cancel); Button save = new Button("Sauvegarder"); save.addStyleName("primary"); save.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> msg = validatorManager.validate(); if (msg.size() > 0) { msg.add(0, "Merci de corriger les points suivants :"); MessagePopup.open(new MessagePopup("Notification", msg)); return; } saveListener.buttonClick(null); refreshListener.onPopupClose(); formInLectureMode(form); } }); footer.addComponent(save); footer.setComponentAlignment(save, Alignment.MIDDLE_LEFT); }
From source file:fr.amapj.view.views.mescontrats.MesContratsView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesContratsService().getMesContrats(SessionManager.getUserId()); layout = this; layout.removeAllComponents();/*from w ww . java 2 s . c om*/ // Information sur le renouvellement de l'adhsion adhesionPart.addAhesionInfo(layout); // Le titre addLabel(layout, "Les nouveaux contrats disponibles"); // la liste des nouveaux contrats List<ContratDTO> newContrats = mesContratsDTO.getNewContrats(); for (ContratDTO c : newContrats) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, true); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); Button b = addButtonInscription("S'inscrire", c); b.setWidth("100%"); b.addStyleName(BUTTON_PRINCIPAL); vl2.addComponent(b); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } // Le titre addLabel(layout, "Mes contrats existants"); // la liste des contrats existants List<ContratDTO> existingContrats = mesContratsDTO.getExistingContrats(); for (ContratDTO c : existingContrats) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, false); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); if (c.isModifiable) { Button b = addButtonInscription("Modifier", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isSupprimable) { Button b = addButtonSupprimer("Supprimer", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isJoker) { Button b = addButtonJoker("Grer jokers", c); b.setWidth("100%"); vl2.addComponent(b); } Button v = addButtonVoir("Voir", c); v.addStyleName(BUTTON_PRINCIPAL); v.setWidth("100%"); vl2.addComponent(v); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } // Le bouton pour tlcharger les contrats if (existingContrats.size() > 0) { Button telechargerButton = new Button("Imprimer mes contrats ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); layout.addComponent(telechargerButton); layout.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); } }
From source file:fr.amapj.view.views.meslivraisons.MesLivraisonsView.java
License:Open Source License
/** * //from www . jav a 2 s . c o m */ @Override public void enter() { PEMesLivraisons peMesLivraisons = (PEMesLivraisons) new ParametresService() .loadParamEcran(MenuList.MES_LIVRAISONS); semaineViewer = GapViewerUtil.createGapWiever(peMesLivraisons.modeAffichage, this); addComponent(semaineViewer.getComponent()); VerticalLayout central = new VerticalLayout(); addComponent(central); planning = new VerticalLayout(); central.addComponent(planning); livraison = new VerticalLayout(); central.addComponent(livraison); // Le bouton pour tlcharger les livraisons Button telechargerButton = new Button("Imprimer mes livraisons ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); addComponent(telechargerButton); setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); onPopupClose(); }
From source file:fr.amapj.view.views.permanence.mespermanences.MesPermanencesView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesPermanencesService().getMesPermanenceDTO(SessionManager.getUserId()); layout = this; layout.removeAllComponents();/*from ww w . j av a 2s .c om*/ if (mesContratsDTO.mesPeriodesPermanences.size() > 0) { // Le titre addLabel(layout, "S'inscrire aux permanences"); // la liste des inscriptions possibles for (UnePeriodePermanenceDTO c : mesContratsDTO.mesPeriodesPermanences) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, true); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); String libButton = getLibButton(c); Button b = addButtonInscription(libButton, c); b.setWidth("100%"); b.addStyleName(BUTTON_PRINCIPAL); vl2.addComponent(b); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } } // addLabel(layout, "Les dates de mes permanences"); VerticalLayout vl1 = BaseUiTools.addPanel(this, "mes-permanences"); String mesPermanences = getLibMesPermanences(); BaseUiTools.addHtmlLabel(vl1, mesPermanences, "ligne"); addLabel(layout, "Consulter les plannings de permanence"); VerticalLayout vl2 = BaseUiTools.addPanel(this, "mes-permanences"); // Le bouton pour visualiser les permanences en ligne Button onLineButton = new Button("Visualiser les plannings de permanence ..."); onLineButton.setIcon(FontAwesome.EYE); onLineButton.addStyleName("borderless"); onLineButton.addStyleName("large"); onLineButton.addClickListener(e -> handleVisualiser()); vl2.addComponent(onLineButton); vl2.setComponentAlignment(onLineButton, Alignment.MIDDLE_LEFT); // Le bouton pour tlcharger les permanences Button telechargerButton = new Button("Tlcharger les plannings de permanence au format tableur ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); vl2.addComponent(telechargerButton); vl2.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); }