List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:fr.amapj.view.engine.popup.corepopup.CorePopup.java
License:Open Source License
protected Button addDefaultButton(String title, Button.ClickListener listener) { Button saveButton = addButton(title, listener); if (colorStyle == ColorStyle.RED) { saveButton.addStyleName("danger"); } else {/*from ww w.jav a 2 s. c o m*/ saveButton.addStyleName("primary"); } return saveButton; }
From source file:fr.amapj.view.engine.popup.formpopup.AbstractFormPopup.java
License:Open Source License
protected TextField addIntegerField(String title, String propertyId, String helpContent) { TextField f = BaseUiTools.createIntegerField(null); binder.bind(f, propertyId);// w w w. j a va2 s . c o m Button aide = new Button(); aide.setIcon(FontAwesome.QUESTION_CIRCLE); aide.addStyleName("borderless-colored"); aide.addStyleName("question-mark"); aide.addClickListener(e -> handleAide(helpContent)); HorizontalLayout hl = new HorizontalLayout(); hl.setCaption(title); hl.addComponent(f); hl.addComponent(aide); form.addComponent(hl); return f; }
From source file:fr.amapj.view.engine.popup.formpopup.AbstractFormPopup.java
License:Open Source License
protected Button addHelpButton(String title, String helpContent) { Button aide = new Button(title); aide.setIcon(FontAwesome.QUESTION_CIRCLE); aide.addStyleName("borderless-colored"); aide.addStyleName("question-mark"); aide.addClickListener(e -> handleAide(helpContent)); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth(100, Unit.PERCENTAGE);//from w ww . j a v a 2s. c om hl.addComponent(aide); hl.setComponentAlignment(aide, Alignment.MIDDLE_RIGHT); form.addComponent(hl); return aide; }
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/* w w w . j a v a 2 s. c o m*/ * * @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.engine.tools.table.complex.ComplexTableBuilder.java
License:Open Source License
private Button createButton(String msg, int taille, CallBack<T> onClic, T t) { Button cb = new Button(msg); cb.addStyleName("align-center"); cb.setWidth(taille + "px"); cb.setImmediate(true);/*from w w w . ja v a2s.co m*/ cb.addClickListener(e -> onClic.onClick(t)); return cb; }
From source file:fr.amapj.view.engine.tools.TableBuilder.java
License:Open Source License
public Button createButton(String msg, int taille) { Button cb = new Button(msg); cb.addStyleName("align-center"); cb.setWidth(taille + "px"); cb.setImmediate(true);//from w w w . ja v a2 s. c o m return cb; }
From source file:fr.amapj.view.views.common.gapviewer.DatePerDateViewer.java
License:Open Source License
private Button addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;/*from w ww.j a v a2 s . co m*/ if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); return b; }
From source file:fr.amapj.view.views.common.gapviewer.MonthViewer.java
License:Open Source License
private void addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;//from w w w. j a va 2 s.c o m if (BaseUiTools.isWidthBelow(480)) { if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } } else { if (toRight) { str = "MOIS SUIVANT"; } else { str = "MOIS PRECEDENT"; } } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); }
From source file:fr.amapj.view.views.common.gapviewer.WeekViewer.java
License:Open Source License
private void addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;//from www. j a va 2 s .co m if (BaseUiTools.isWidthBelow(480)) { if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } } else { if (toRight) { str = "SEMAINE SUIVANTE"; } else { str = "SEMAINE PRECEDENTE"; } } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); }
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 w w . ja va 2 s . com // 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); } }