/** * Constructeur, initialisation du champs * @param listeLangueEnService * @param langueParDefaut * @param libelleBtnPlus */ public I18nField(Langue langueParDefaut, List<Langue> listeLangueEnService, String libelleBtnPlus) { super(); setRequired(false); this.langueParDefaut = langueParDefaut; this.listeLangueEnService = listeLangueEnService; listLayoutTraductions = new ArrayList<HorizontalLayout>(); listeTraduction = new ArrayList<I18nTraduction>(); layoutComplet = new VerticalLayout(); layoutComplet.setSpacing(true); layoutLangue = new VerticalLayout(); layoutLangue.setSpacing(true); layoutComplet.addComponent(layoutLangue); btnAddLangue = new OneClickButton(libelleBtnPlus,FontAwesome.PLUS_SQUARE_O); btnAddLangue.setVisible(false); btnAddLangue.addStyleName(ValoTheme.BUTTON_TINY); layoutComplet.addComponent(btnAddLangue); btnAddLangue.addClickListener(e->{ layoutLangue.addComponent(getLangueLayout(null)); checkVisibleAddLangue(); centerWindow(); }); }
public SimplyAsAnImageOrIcon() { setCaption("Image and icon"); addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth()); Image image = new Image(null, new ClassResource("/pull.svg")); image.setWidth("300px"); addComponent(image); addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth()); Button button = new Button(); button.setIcon(new ClassResource("/vaadin-logo.svg")); button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE); addComponent(button); }
@Override protected void init(VaadinRequest vaadinRequest) { setNavigator(new Navigator(this, (View view) -> { tabs.setSelectedTab((Component) view); })); registerExample(SvgInVaadin.class); registerExample(SimplyAsAnImageOrIcon.class); registerExample(FileExample.class); registerExample(AnimationExample.class); registerExample(Java2DExample.class); registerExample(JungExample.class); getNavigator().setErrorView(SvgInVaadin.class); tabs.addSelectedTabChangeListener(e -> { if (e.isUserOriginated()) { getNavigator().navigateTo(e.getTabSheet().getSelectedTab().getClass().getSimpleName()); } }); String state = getNavigator().getState(); getNavigator().navigateTo(state); tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); setContent(tabs); }
public NamedQueryResultsPanel(PageableList<HttpArticle> results) { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); Label countLabel = new Label(String.format("%s documents matched", results.getTotalCount())); countLabel.addStyleName(ValoTheme.LABEL_LARGE); countLabel.setSizeFull(); layout.addComponent(countLabel); for (HttpArticle article : results.getItems()) { String labelHtml = String.format("%s <a href=\"%s\" target=\"_blank\">%s</a> - <strong>%s</strong>", DataUtils.formatInUTC(article.getPublished()), article.getUrl(), article.getTitle(), article.getSource()); Label articleLabel = new Label(labelHtml); articleLabel.setContentMode(ContentMode.HTML); articleLabel.setSizeFull(); layout.addComponent(articleLabel); } setContent(layout); }
@Override protected void buildActions(HorizontalLayout actionsContainer) { actionsContainer.setSpacing(true); // yes final Button btnYes = Components.button().styleName(ValoTheme.BUTTON_PRIMARY) .caption(Localizable.builder().message(DEFAULT_YES_BUTTON_MESSAGE) .messageCode(DEFAULT_YES_BUTTON_MESSAGE_CODE).build()) .onClick(e -> onDialogYesButtonClick(e.getButton())).build(); getYesButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnYes))); actionsContainer.addComponent(btnYes); actionsContainer.setComponentAlignment(btnYes, Alignment.MIDDLE_LEFT); if (getWidth() > -1) { btnYes.setWidth("100%"); } // no final Button btnNo = Components.button() .caption(Localizable.builder().message(DEFAULT_NO_BUTTON_MESSAGE) .messageCode(DEFAULT_NO_BUTTON_MESSAGE_CODE).build()) .onClick(e -> onDialogNoButtonClick(e.getButton())).build(); getNoButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btnNo))); actionsContainer.addComponent(btnNo); actionsContainer.setComponentAlignment(btnNo, Alignment.MIDDLE_RIGHT); if (getWidth() > -1) { btnNo.setWidth("100%"); } }
@PostConstruct public void init() { Components.configure(this) // set full to view content .fullSize().spacing() .add(Components.button().caption("Add new").styleName(ValoTheme.BUTTON_PRIMARY) // navigate to "manage" view .onClick(e -> ViewNavigator.require().toView("manage").navigate()).build()) // build and add listing .addAndExpandFull(listing = Components.listing.properties(PRODUCT) // setup data source using Datastore with 'products' table name target and product ID as pk .dataSource(datastore, TARGET, ID) // froze the ID column .frozenColumns(1) // set the ID column width and style .width(ID, 120).style(ID, "id-column") // when user clicks on a row, open the 'view' named View providing product id parameter .withItemClickListener((i, p, e) -> ViewNavigator.require().toView("view") .withParameter("id", i.getValue(ID)).navigate()) // set full size and build .fullSize().build()); }
/** * @param container * @param size * @return une table pour formatter les données */ private TableFormating getTable(BeanItemContainer<SimpleTablePresentation> container, Integer size){ TableFormating table = new TableFormating(null, container); table.addBooleanColumn(SimpleTablePresentation.CHAMPS_VALUE,false); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setPageLength(size); table.setWidth(100, Unit.PERCENTAGE); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 300); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); return table; }
/** * Met a jour le panel d'info * * @param listePresentation */ private void updateCandidaturePresentation(final List<SimpleTablePresentation> listePresentation) { int i = 0; gridInfoLayout.removeAllComponents(); gridInfoLayout.setRows(listePresentation.size()); for (SimpleTablePresentation e : listePresentation) { Label title = new Label(e.getTitle()); title.addStyleName(ValoTheme.LABEL_BOLD); title.setSizeUndefined(); gridInfoLayout.addComponent(title, 0, i); Label value = new Label((String) e.getValue(), ContentMode.HTML); if ((e.getCode().equals("candidature." + ConstanteUtils.CANDIDATURE_LIB_LAST_DECISION) && e.getShortValue() != null && !e.getShortValue().equals(NomenclatureUtils.TYP_AVIS_ATTENTE)) || (e.getCode().equals("candidature." + ConstanteUtils.CANDIDATURE_LIB_STATUT) && e.getShortValue() != null && !e.getShortValue().equals(NomenclatureUtils.TYPE_STATUT_ATT))) { title.addStyleName(ValoTheme.LABEL_COLORED); value.addStyleName(ValoTheme.LABEL_COLORED); value.addStyleName(ValoTheme.LABEL_BOLD); } value.setWidth(100, Unit.PERCENTAGE); gridInfoLayout.addComponent(value, 1, i); i++; } }
/** * Met à jour le panel de dates * * @param listePresentation */ private void updateCandidatureDatePresentation(final List<SimpleTablePresentation> listePresentation) { int i = 0; gridDateLayout.removeAllComponents(); if (listePresentation.size() > 0) { gridDateLayout.setRows(listePresentation.size()); for (SimpleTablePresentation e : listePresentation) { Label title = new Label(e.getTitle()); title.addStyleName(ValoTheme.LABEL_BOLD); title.setSizeUndefined(); gridDateLayout.addComponent(title, 0, i); Label value = new Label((String) e.getValue()); if (e.getCode().equals( "candidature." + Candidature_.formation.getName() + "." + Formation_.datRetourForm.getName())) { title.addStyleName(ValoTheme.LABEL_COLORED); value.addStyleName(ValoTheme.LABEL_COLORED); value.addStyleName(ValoTheme.LABEL_BOLD); } value.setWidth(100, Unit.PERCENTAGE); gridDateLayout.addComponent(value, 1, i); i++; } } }
/** * ajoute la mention CNIL */ private void addMentionCnil() { panelCnil.setWidth(100, Unit.PERCENTAGE); panelCnil.setHeight(100, Unit.PIXELS); addComponent(panelCnil); setComponentAlignment(panelCnil, Alignment.BOTTOM_LEFT); VerticalLayout vlContentLabelCnil = new VerticalLayout(); vlContentLabelCnil.setSizeUndefined(); vlContentLabelCnil.setWidth(100, Unit.PERCENTAGE); vlContentLabelCnil.setMargin(true); labelCnil.setContentMode(ContentMode.HTML); labelCnil.addStyleName(ValoTheme.LABEL_TINY); labelCnil.addStyleName(StyleConstants.LABEL_JUSTIFY); labelCnil.addStyleName(StyleConstants.LABEL_SAUT_LIGNE); vlContentLabelCnil.addComponent(labelCnil); panelCnil.setContent(vlContentLabelCnil); }
@PostConstruct public void init() { Components.configure(this) // set full to view content .fullSize().spacing() .add(Components.button().caption("Add new").styleName(ValoTheme.BUTTON_PRIMARY) // navigate to "manage" view .onClick(e -> ViewNavigator.require().toView("manage").navigate()).build()) // build and add listing .addAndExpandFull(listing = Components.listing.properties(MProduct.PRODUCT) // setup data source using Datastore with 'products' table name target and product ID as pk .dataSource(datastore, DataTarget.named("products"), MProduct.ID) // disable auto refresh: will be triggered on view enter .autoRefresh(false) // when user clicks on a row, open the 'view' named View providing product id parameter .withItemClickListener((i, p, e) -> ViewNavigator.require().toView("view") .withParameter("id", i.getValue(MProduct.ID)).navigate()) // set full size and build .fullSize().build()); }
/** * Construit le menu */ private void buildMenu() { menu.addStyleName(ValoTheme.MENU_PART); final OneClickButton showMenu = new OneClickButton(applicationContext.getMessage("mainUi.menu", null, getLocale()), FontAwesome.LIST); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(StyleConstants.VALO_MENU_TOGGLE); showMenu.addClickListener(e -> { if (menu.getStyleName().contains(StyleConstants.VALO_MENU_VISIBLE)) { menu.removeStyleName(StyleConstants.VALO_MENU_VISIBLE); } else { menu.addStyleName(StyleConstants.VALO_MENU_VISIBLE); } }); menu.addComponent(showMenu); menuButtonLayout.setPrimaryStyleName(StyleConstants.VALO_MENUITEMS); menu.addComponent(menuButtonLayout); constructMainMenu(); }
/** Construit le bouton de recherche de centre * @param libelle le libelle du bouton * @return le bouton de recherche */ private OneClickButton constructCtrCandChangeBtn(String libelle){ OneClickButton ctrCandBtn = new OneClickButton(libelle); ctrCandBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); ctrCandBtn.addClickListener(e->{ SearchCtrCandWindow win = new SearchCtrCandWindow(); win.addCentreCandidatureListener(centre->{ userController.setCentreCandidature(centre); buildMenuCtrCand(); navigateToView(AccueilView.NAME); idCtrCandEnCours = centre.getIdCtrCand(); }); getCurrent().addWindow(win); }); return ctrCandBtn; }
/** Construit le bouton de recherche de commission * @param libelle le libellé du bouton * @return le bouton de recherche */ private OneClickButton constructCommissionChangeBtn(String libelle){ OneClickButton commissionBtn = new OneClickButton(libelle); commissionBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); commissionBtn.addClickListener(e->{ SearchCommissionWindow win = new SearchCommissionWindow(null); win.addCommissionListener(comm->{ userController.setCommission(comm); buildMenuCommission(); navigateToView(AccueilView.NAME); idCommissionEnCours = comm.getIdComm(); }); getCurrent().addWindow(win); }); return commissionBtn; }
/** * @param toolbar * HorizontalLayout which contains all the action Buttons * @param toolbarButton * Which Tool bar button to create (Provided using ENUM constant) * @param listner * Click listener called when this button is clicked * @return */ public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton, ClickListener listner) { Button button = new Button(toolbarButton.getText()); button.addStyleName(StyleConstants.BUTTON_TOOLBAR); button.setDescription(toolbarButton.getTooltip()); button.setStyleName(ValoTheme.BUTTON_LINK); if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) { button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString()); } button.setEnabled(false); button.setId(toolbarButton.getId()); button.addClickListener(listner); toolbar.addComponent(button); return button; }
private void addCommonTableItems(Table statusTable) { statusTable.setImmediate(true); statusTable.setStyleName(ValoTheme.TABLE_COMPACT); statusTable.addContainerProperty("Property", String.class, ""); statusTable.addContainerProperty("Value", String.class, ""); statusTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); statusTable.setPageLength(0); statusTable.setReadOnly(true); statusTable.addItem(new Object[] { "Name: ", "" }, new Integer(1)); statusTable.addItem(new Object[] { "Local IP: ", "" }, new Integer(2)); statusTable.addItem(new Object[] { "Public IP: ", "" }, new Integer(3)); statusTable.addItem(new Object[] { "V.Server: ", "" }, new Integer(4)); statusTable.addItem(new Object[] { "Manager IP: ", "" }, new Integer(5)); }
@Override protected Component createComponent() { final CssLayout contentLayout = new CssLayout(new Label("Content")); contentLayout.setSizeFull(); contentLayout.setId(cssLayoutID().apply(MainUI.class, "Content")); final VerticalLayout menuLayout = new VerticalLayout(); menuLayout.setId(verticalLayoutID().apply(MainUI.class, "MenuLayout")); menuLayout.setStyleName(ValoTheme.MENU_ROOT); menuLayout.setWidth(100, Unit.PERCENTAGE); menuLayout.setHeight(100, Unit.PERCENTAGE); menuLayout.setSizeFull(); // to hard bound menuLayout.addComponent(new MenuComponent(contentLayout)); final HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setId(horizontalLayoutID().apply(MainUI.class, "MainLayout")); mainLayout.setSizeFull(); mainLayout.addComponent(menuLayout); mainLayout.addComponent(contentLayout); mainLayout.setExpandRatio(menuLayout, 0.20f); mainLayout.setExpandRatio(contentLayout, 0.80f); return mainLayout; }
TermSelectLayout(String caption, int initialValue) { super(); setCaption(caption); textField = new TextField(); textField.setWidth(MainUI.FIELD_WIDTH_SHORT, Unit.PIXELS); textField.setStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER); radioGroup = new RadioButtonGroup<>(); radioGroup.setItemCaptionGenerator(t -> t.label); radioGroup.setStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); radioGroup.setItems(TermSelect.values()); switch (initialValue) { case -1: radioGroup.setValue(TermSelect.NOT_A_MEMBER); textField.setValue("0"); textField.setEnabled(false); break; case 0: radioGroup.setValue(TermSelect.FORGOT); textField.setValue("0"); textField.setEnabled(false); break; default: radioGroup.setValue(TermSelect.INPUT); textField.setValue(String.valueOf(initialValue)); textField.setEnabled(true); break; } radioGroup.addValueChangeListener(e -> textField.setEnabled(e.getValue() == TermSelect.INPUT)); addComponents(textField, radioGroup); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { Label errorLabel = new Label("エラーが発生しました。"); errorLabel.setStyleName(ValoTheme.LABEL_FAILURE); VaadinSession session = VaadinSession.getCurrent(); String paramMessage = (String) session.getAttribute(PARAM_MESSAGE); if (paramMessage != null) { addComponent(new Label(paramMessage)); } session.setAttribute(PARAM_MESSAGE, null); Throwable paramThrowable = (Throwable) session.getAttribute(PARAM_THROWABLE); if (paramThrowable != null) { addComponent(new Label(throwable2html(paramThrowable), ContentMode.HTML)); } session.setAttribute(PARAM_THROWABLE, null); log.error(paramMessage, paramThrowable); if (paramThrowable instanceof AuthenticationException) { Button loginButton = new Button("ログイン", click -> getUI().getNavigator().navigateTo(LoginView.VIEW_NAME)); addComponent(loginButton); setComponentAlignment(loginButton, Alignment.MIDDLE_CENTER); } Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME)); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
public Step3() { VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label feedbackTitle = new Label("Step Feedback"); feedbackTitle.addStyleName(ValoTheme.LABEL_H2); Label stepFeedbackLabel = new Label("The stepper provides the possibility to show a " + "feedback message for long running operations.<br>Just " + "click next to see an example.", ContentMode.HTML); content.addComponent(feedbackTitle); content.addComponent(stepFeedbackLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); addStepBackListener(StepperActions::back); addStepNextListener(event -> { Stepper stepper = event.getSource(); stepper.showFeedbackMessage("Long loading operation is being performed"); UI currentUi = UI.getCurrent(); new Timer().schedule(new TimerTask() { @Override public void run() { currentUi.access(() -> { stepper.hideFeedbackMessage(); stepper.next(); }); } }, 2000); }); setCaption("Step 3"); setDescription("Long running Operations"); setContent(content); }
public HttpSourceAllTestsWindow() { setCaption("All Tests"); setModal(true); center(); setWidth(80, Unit.PERCENTAGE); setHeight(80, Unit.PERCENTAGE); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true); List<HttpSourceTest> tests = ElasticSearch.getHttpSourceTestOperations().all(); for (HttpSourceTest test : tests) { HttpSource source = ElasticSearch.getHttpSourceOperations().get(test.getSource()); if (source == null) { Label noSourceLabel = new Label(String.format("Source configuration '%s' not found", test.getSource())); noSourceLabel.addStyleName(ValoTheme.LABEL_FAILURE); noSourceLabel.setSizeFull(); mainLayout.addComponent(noSourceLabel); } else { mainLayout.addComponent(new TestResultsPanel(source, test)); } } HorizontalLayout actions = new HorizontalLayout(cancelButton); actions.setSpacing(true); setContent(mainLayout); }
/** * Constructor */ public AbstractDialog() { super(); // defaults setModal(true); setResizable(false); setDraggable(false); setClosable(false); // style name addStyleName("h-dialog"); // build content = new Panel(); content.setWidth("100%"); content.addStyleName(ValoTheme.PANEL_BORDERLESS); content.addStyleName("h-dialog-content"); actions = new HorizontalLayout(); actions.setWidth("100%"); actions.setSpacing(true); actions.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); actions.addStyleName("h-dialog-actions"); root = new VerticalLayout(); root.addComponent(content); root.addComponent(actions); setContent(root); }
/** * Constructor with form content * @param content Form composition content */ public AbstractComposableForm(C content) { super(); if (content != null) { setContent(content); } addStyleName(ValoTheme.PANEL_BORDERLESS); // default style name addStyleName("h-form"); }
@Override protected void buildActions(HorizontalLayout actionsContainer) { Button btn = Components.button().styleName(ValoTheme.BUTTON_PRIMARY) .fullWidth().caption(Localizable.builder().message(DEFAULT_BUTTON_MESSAGE) .messageCode(DEFAULT_BUTTON_MESSAGE_CODE).build()) .onClick(e -> onDialogButtonClick(e.getButton())).build(); // configurator getOkButtonConfigurator().ifPresent(c -> c.configureDialogButton(Components.configure(btn))); actionsContainer.addComponent(btn); }
private void configureComponents() { /* Highlight primary actions. * * With Vaadin built-in styles you can highlight the primary save button * and give it a keyboard shortcut for a better UX. */ save.setStyleName(ValoTheme.BUTTON_PRIMARY); save.setClickShortcut(ShortcutAction.KeyCode.ENTER); setVisible(false); }
public OtherView() { final Label title = new Label("Other View"); title.setStyleName(ValoTheme.LABEL_H2); rootLayout.addComponent(title); rootLayout.addComponent(label); }
@Override protected Component createComponent() { final CssLayout menuButtons = new CssLayout(); menuButtons.setSizeFull(); menuButtons.addStyleName(ValoTheme.MENU_PART); menuButtons.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS); menuButtons.addComponents(getComponents()); return menuButtons; }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatAdresseView.NAME, (parametreController.getIsGetCursusInterne()?CandidatCursusInterneView.NAME:CandidatCursusExterneView.NAME)); /*Edition des donneés*/ OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnSaisir", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL); btnEdit.addClickListener(e -> { candidatParcoursController.editBac(candidat, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel = new Label(applicationContext.getMessage("infobac.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*Table de présentation*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER_BAC); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
public Step1() { super(true); // Use default actions VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label basicInformationTitle = new Label("Basic Information"); basicInformationTitle.addStyleName(ValoTheme.LABEL_H2); Label basicInformationLabel = new Label("The stepper component can be used to iterate " + "through the single steps of a process. Depending on " + "whether the stepper is declared linear or not, " + "the provided steps have to be completed in order - " + "or not."); Label demoUsageTitle = new Label("Demo Usage"); demoUsageTitle.addStyleName(ValoTheme.LABEL_H3); Label demoUsageLabel = new Label("You can use the panel on the left side to change and " + "try out different attributes of the stepper.<br>" + "Additionally, the demo will show the various possibilities " + "to use the stepper and its steps when you progress through " + "the single steps.", ContentMode.HTML); content.addComponent(basicInformationTitle); content.addComponent(basicInformationLabel); content.addComponent(demoUsageTitle); content.addComponent(demoUsageLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); setCaption("Step 1"); setDescription("Basic Stepper Features"); setContent(content); }
/** * @param btn * @return le layout de bouton conditionnel */ private HorizontalLayout getLayoutBtnConditionnel(final OneClickButton btn) { btn.addStyleName(ValoTheme.BUTTON_TINY); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.addComponent(btn); layout.setComponentAlignment(btn, Alignment.MIDDLE_CENTER); return layout; }
/** * Modifie l'etat des boutons de transmission */ private void updateBtnTransmettre() { if (!isAutorizedToUpdate || !isDematerialise || !isAutorizedToUpdateCandidature() || !candidaturePieceController .isOkToTransmettreCandidatureStatutDossier(candidature.getTypeStatut().getCodTypStatut(), false)) { btnTransmettre.setVisible(false); } else { btnTransmettre.setVisible(true); if (candidaturePieceController.isOkToTransmettreCandidatureStatutPiece(pjContainer.getItemIds(), false)) { btnTransmettre.addStyleName(ValoTheme.BUTTON_FRIENDLY); } else { btnTransmettre.removeStyleName(ValoTheme.BUTTON_FRIENDLY); } } }
/** Affiche les erreurs * @param erreur */ private void displayError(String erreur){ error = true; uploaderComponent.interruptUpload(); infoLabel.setValue(erreur); infoLayout.setVisible(true); infoLabel.setStyleName(ValoTheme.LABEL_FAILURE); }
/** * Créé la popup d'astuce */ private Content createPopUpAstuce() { VerticalLayout vlAstuce = new VerticalLayout(); vlAstuce.setMargin(true); vlAstuce.setSpacing(true); Label labelTitle = new Label(applicationContext.getMessage("candidature.change.commission.astuce.title", null, UI.getCurrent().getLocale())); labelTitle.addStyleName(ValoTheme.LABEL_LARGE); labelTitle.addStyleName(ValoTheme.LABEL_BOLD); vlAstuce.addComponent(labelTitle); vlAstuce.addComponent(new Label(applicationContext.getMessage("candidature.change.commission.astuce.content", null, UI.getCurrent().getLocale()), ContentMode.HTML)); return new Content() { /** serialVersionUID **/ private static final long serialVersionUID = -4599757106887300854L; @Override public String getMinimizedValueAsHTML() { return applicationContext.getMessage("candidature.change.commission.astuce.link", null, UI.getCurrent().getLocale()); } @Override public Component getPopupComponent() { return vlAstuce; } }; }
/** * Créé la popup SVA * * @param listeAlerteSva * @param dateSva * @return le contenu de la popup SVA */ private Content createPopUpContent(final List<AlertSva> listeAlerteSva, final String dateSva) { VerticalLayout vlAlert = new VerticalLayout(); vlAlert.setMargin(true); vlAlert.setSpacing(true); Label labelTitle = new Label(applicationContext.getMessage("alertSva.popup.title", new Object[] {alertSvaController.getLibelleDateSVA(dateSva)}, UI.getCurrent().getLocale())); labelTitle.addStyleName(ValoTheme.LABEL_LARGE); labelTitle.addStyleName(ValoTheme.LABEL_BOLD); vlAlert.addComponent(labelTitle); listeAlerteSva.forEach(alert -> { vlAlert.addComponent( new Label( "<div style='display:inline-block;border:1px solid;width:20px;height:20px;background:" + alert.getColorSva() + ";'></div><div style='height:100%;display: inline-block;vertical-align: super;'>" + applicationContext.getMessage("alertSva.popup.alert", new Object[] {alert.getNbJourSva()}, UI.getCurrent().getLocale()) + "</div>", ContentMode.HTML)); }); return new Content() { /** serialVersionUID **/ private static final long serialVersionUID = -4599757106887300854L; @Override public String getMinimizedValueAsHTML() { return applicationContext.getMessage("alertSva.popup.link", null, UI.getCurrent().getLocale()); } @Override public Component getPopupComponent() { return vlAlert; } }; }
private Pair<String, Button> createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) { final Button button = new Button(caption, (e) -> { contentLayout.removeAllComponents(); contentLayout.addComponent(content.get()); }); button.setIcon(icon); button.addStyleName(ValoTheme.BUTTON_HUGE); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.MENU_ITEM); button.setWidth("100%"); button.setId(buttonID().apply(this.getClass(), caption)); return new Pair<>(mapToShiroRole(caption), button); }
/** * Initialise la vue */ @PostConstruct public void init() { /* Style */ setSizeFull(); setSpacing(true); /*Layout des mails*/ VerticalLayout layoutMailModel = new VerticalLayout(); layoutMailModel.setSizeFull(); layoutMailModel.setSpacing(true); layoutMailModel.setMargin(true); /*Layout des typ decision*/ VerticalLayout layoutMailTypeDec = new VerticalLayout(); layoutMailTypeDec.setSizeFull(); layoutMailTypeDec.setSpacing(true); layoutMailTypeDec.setMargin(true); /*Le layout a onglet*/ TabSheet sheet = new TabSheet(); sheet.setImmediate(true); sheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); addComponent(sheet); sheet.setSizeFull(); sheet.addTab(layoutMailModel, applicationContext.getMessage("mail.model.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE_O); sheet.addTab(layoutMailTypeDec, applicationContext.getMessage("mail.typdec.title", null, UI.getCurrent().getLocale()),FontAwesome.ENVELOPE); /*Populate le layoutMailModel*/ populateMailModelLayout(layoutMailModel); /*Populate le layoutMailModel*/ populateMailTypeDecLayout(layoutMailTypeDec); /* Inscrit la vue aux mises à jour de mail */ mailEntityPusher.registerEntityPushListener(this); }
/** * Initialise la vue */ @PostConstruct public void init() { super.init(); setNavigationButton(CandidatInfoPersoView.NAME, CandidatBacView.NAME); /*Edition des donneés d'adresse*/ OneClickButton btnEdit = new OneClickButton(FontAwesome.PENCIL); btnEdit.setCaption(applicationContext.getMessage("adresse.edit.btn", null, UI.getCurrent().getLocale())); btnEdit.addClickListener(e -> { candidatController.editAdresse(cptMin, this); }); addGenericButton(btnEdit, Alignment.MIDDLE_LEFT); noInfoLabel.setValue(applicationContext.getMessage("adresse.noinfo", null, UI.getCurrent().getLocale())); addGenericComponent(noInfoLabel); /*L'adresse*/ table.setSizeFull(); table.setVisibleColumns((Object[]) FIELDS_ORDER); table.setColumnCollapsingAllowed(false); table.setColumnReorderingAllowed(false); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setSelectable(false); table.setImmediate(true); table.setColumnWidth(SimpleTablePresentation.CHAMPS_TITLE, 250); table.setCellStyleGenerator((components, itemId, columnId)->{ if (columnId!=null && columnId.equals(SimpleTablePresentation.CHAMPS_TITLE)){ return (ValoTheme.LABEL_BOLD); } return null; }); addGenericComponent(table); setGenericExpandRatio(table); }
/** * @param caption * @param bwo * @param icon * @return un bouton pour l'assistance */ private OneClickButton getButton(String caption, String bwo, com.vaadin.server.Resource icon){ BrowserWindowOpener browser = new BrowserWindowOpener(new ExternalResource(bwo)); OneClickButton btn = new OneClickButton(caption, icon); btn.addStyleName(ValoTheme.BUTTON_LINK); browser.extend(btn); return btn; }