@Test void row() { assertThrows(IllegalArgumentException.class, () -> new Form().row(null).add()); assertThrows(IllegalArgumentException.class, () -> new Form().row(new TextFieldGroup(), null).add()); assertThrows(IllegalArgumentException.class, () -> new Form().row(null, null, new TextFieldGroup()).add()); assertEquals(true, ((TextFieldGroup) new Form(true).row(new TextFieldGroup()).add() .getRows().get(0).getComponents().get(0)).isFeedbackHeightReservedIfEmpty()); assertEquals(false, ((TextFieldGroup) new Form(true, false).row(new TextFieldGroup()).add() .getRows().get(0).getComponents().get(0)).isDescriptionHeightReservedIfEmpty()); assertThrows(IllegalArgumentException.class, () -> new Form().row(null).add()); assertThrows(IllegalArgumentException.class, () -> new Form().row(new Label(), null).add()); assertThrows(IllegalArgumentException.class, () -> new Form().row(null, null, new Label()).add()); assertEquals("123", ((Label) new Form(true).row(new Label("123")).add() .getRows().get(0).getComponents().get(0)).getValue()); assertEquals("321", ((Label) new Form(true, false).row(new Label("321")).add() .getRows().get(0).getComponents().get(0)).getValue()); }
@PostConstruct public void init() { applications = this.appService.findAll(); // Title Label title = new Label("<h2>Applications</h2>", ContentMode.HTML); initApplicationsGrid(); // Build layout VerticalLayout leftLayout = new VerticalLayout(title, grid); leftLayout.setMargin(false); this.addComponent(leftLayout); // Center align layout this.setWidth("100%"); this.setMargin(new MarginInfo(false, true)); }
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { addComponent(new HeadingLabel("参加登録完了", VaadinIcons.CHECK)); addComponent(new Label("参加登録が完了し、確認メールを送信しました。")); Label addressLabel = new Label("しばらく待ってもメールが来ない場合は、お手数ですが " + appReply + " までご連絡ください。"); addressLabel.setCaption("お願い"); addressLabel.setIcon(VaadinIcons.LIGHTBULB); addComponent(addressLabel); Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME)); homeButton.setIcon(VaadinIcons.HOME); addComponent(homeButton); setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER); }
@Override protected void init(VaadinRequest request) { rootLayout = getRootLayout(); setContent(rootLayout); Label title = getTitleLabel(); StepperPropertiesLayout layout = new StepperPropertiesLayout(); layout.addStepperCreateListener(this); layout.setWidth(300, Unit.PIXELS); Spacer spacer = new Spacer(); spacer.setWidth(100, Unit.PIXELS); rootLayout.addComponent(title, 0, 0, 2, 0); rootLayout.addComponent(spacer, 1, 1); rootLayout.addComponent(layout, 0, 1); rootLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER); layout.start(); }
public SimpleDialog(String title, String message, boolean lightTheme) { super(title); addStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK); label = new Label(message); label.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.SECONDARY : Typography.Light.Subheader.SECONDARY); label.addStyleName(Paddings.Horizontal.LARGE + " " + Paddings.Bottom.LARGE); // Footer cancel = new Button("Cancel"); cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); cancel.addClickListener(e -> close()); ok = new Button("OK"); ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); ok.addClickListener(e -> close()); footer = new FlexLayout(cancel, ok); footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END); footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0); footer.setWidth(100, Unit.PERCENTAGE); // Content wrapper content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, label, footer); setContent(content); }
/** * Initialise la vue */ @PostConstruct public void init() { /*Récupération du centre de canidature en cours*/ SecurityCtrCandFonc securityCtrCandFonc = userController.getCtrCandFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_FORMULAIRE); if (securityCtrCandFonc.hasNoRight()){ setSizeFull(); setMargin(true); setSpacing(true); addComponent(new Label(applicationContext.getMessage("erreurView.title", null, UI.getCurrent().getLocale()))); return; } super.init(); titleParam.setValue(applicationContext.getMessage("formulaire.commun.title", null, UI.getCurrent().getLocale())); container.addAll(formulaireController.getFormulairesCommunScolEnService()); buttonsLayout.setVisible(false); }
private Component getRestGrid(Collection<MetricsRest> metrics, Series httpSerie) { List<MetricsRest> metricsItems = metrics.stream() .filter(m -> m.valid() && m.getStatus().series() == httpSerie) .collect(Collectors.toList()); if(metricsItems.isEmpty()) { return new Label("No requests"); } else { Grid<MetricsRest> gridCache = new Grid<>(MetricsRest.class); gridCache.removeAllColumns(); gridCache.addColumn(MetricsRest::getName).setCaption("Path").setExpandRatio(1); gridCache.addColumn(m -> m.getStatus() + " " + m.getStatus().getReasonPhrase()).setCaption("HTTP Status"); gridCache.addColumn(MetricsRest::getValue).setCaption("Hits"); gridCache.addColumn(MetricsRest::getLastResponseTime).setCaption("Last Response Time (ms)"); gridCache.setItems(metricsItems); if(metricsItems.size() < 10) { gridCache.setHeightByRows(metricsItems.size()); } gridCache.setWidth(100, Unit.PERCENTAGE); return gridCache; } }
private void getVarLayout(String title, List<String> liste, HorizontalLayout hlContent){ if (liste==null || liste.size()==0){ return; } VerticalLayout vl = new VerticalLayout(); if (title!=null){ Label labelTitle = new Label(title); vl.addComponent(labelTitle); vl.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER); } StringBuilder txt = new StringBuilder("<ul>"); liste.forEach(e->txt.append("<li><input type='text' value='${"+e+"}'></li>")); txt.append("</ul>"); Label labelSearch = new Label(txt.toString(),ContentMode.HTML); vl.addComponent(labelSearch); hlContent.addComponent(vl); }
/** * 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++; } } }
/** * @return le layout de légende */ private VerticalLayout getLegendLayout() { VerticalLayout vlLegend = new VerticalLayout(); // vlLegend.setWidth(300, Unit.PIXELS); vlLegend.setMargin(true); vlLegend.setSpacing(true); Label labelTitle = new Label( applicationContext.getMessage("formation.table.flagEtat.tooltip", null, UI.getCurrent().getLocale())); labelTitle.addStyleName(StyleConstants.VIEW_TITLE); vlLegend.addComponent(labelTitle); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_GREEEN)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_RED)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_YELLOW)); vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_BLUE)); return vlLegend; }
@Override protected void init(VaadinRequest request) { // The root of the component hierarchy VerticalLayout content = new VerticalLayout(); content.setSizeFull(); // Use entire window setContent(content); // Attach to the UI // Add some component content.addComponent(new Label("<b>Hello!</b> - How are you?", ContentMode.HTML)); }
private Component createTitle(String text) { Label lbl = new Label(text); lbl.addStyleName(Typography.Dark.Table.Title.PRIMARY); FlexLayout layout = new FlexLayout(lbl); layout.setAlignItems(AlignItems.CENTER); layout.setHeight(Metrics.Table.TITLE_HEIGHT, Unit.PIXELS); return layout; }
/** * Constructor * @param label Status label (not null) * @param hideWhenValid <code>true</code> to hide the Label when the validation status is not invalid */ public LabelValidationStatusHandler(Label label, boolean hideWhenValid) { super(); ObjectUtils.argumentNotNull(label, "Status label must be not null"); this.label = label; this.hideWhenValid = hideWhenValid; }
/** * Constructor * @param type Concrete value type */ public LabelViewComponent(Class<? extends T> type) { super(type, new Label()); getLabel().setContentMode(ContentMode.HTML); // default converter stringConverter = (v) -> StringValuePresenter.getDefault().present(null, v, null); }
@Test public void test() { Label label = new Label("Popup"); FPopupView popup = new FPopupView("My Popup", label).withPopupVisible(true).withHideOnMouseOut(false); assertTrue(popup.isPopupVisible()); assertFalse(popup.isHideOnMouseOut()); assertEquals(label, popup.getContent().getPopupComponent()); }
public void setHeaders(String... headers) { for (String header : headers) { Label lbl = new Label(header); lbl.setContentMode(ContentMode.HTML); lbl.setPrimaryStyleName(Typography.Dark.Table.Header.SECONDARY); this.headers.addComponent(lbl); } }
@Override protected void localize(Label instance) { super.localize(instance); if (content != null) { instance.setValue(LocalizationContext.translate(content, true)); } }
public Step(int step, String name, String info) { setFlexDirection(ROW); setAlignItems(AlignItems.CENTER); setOverflow(Overflow.HIDDEN); this.step = step; this.stepLabel = new Label(Integer.toString(step)); this.stepLabel.setPrimaryStyleName(Typography.Light.Caption.PRIMARY); this.stepLabel.addStyleName(FLEXLAYOUT); this.stepLabel.addStyleName(AlignItems.CENTER.getStyleName()); this.stepLabel.addStyleName(JustifyContent.CENTER.getStyleName()); this.stepLabel.addStyleName(Styles.Misc.BORDER_RADIUS_FULL); this.stepLabel.addStyleName(MaterialColor.DARK_DISABLED.getBackgroundColorStyle()); this.stepLabel.addStyleName(FlexItem.FlexShrink.SHRINK_0); this.stepLabel.addStyleName(Margins.Right.SMALL); this.stepLabel.setContentMode(ContentMode.HTML); this.stepLabel.setHeight(CIRCLE_SIZE, Unit.PIXELS); this.stepLabel.setWidth(CIRCLE_SIZE, Unit.PIXELS); this.nameLabel = new Label(name); this.nameLabel.setPrimaryStyleName(Typography.Dark.Body1.PRIMARY); this.infoLabel = new Label(info); this.infoLabel.setPrimaryStyleName(Typography.Dark.Caption.SECONDARY); FlexLayout column = new FlexLayout(COLUMN, nameLabel, infoLabel); addComponents(stepLabel, column); }
private Label createCaption(String text) { Label lbl = new Label(text); lbl.setPrimaryStyleName(Typography.Dark.Caption.SECONDARY); lbl.addStyleName(FlexItem.FlexShrink.SHRINK_0); lbl.setWidth(120, Unit.PIXELS); return lbl; }
public void setIcon(Resource source) { if (source == null) { this.icon.setVisible(false); } else { this.icon.setVisible(true); this.icon.removeAllComponents(); if (source instanceof FontIcon) { this.icon.addComponent(new Label(((FontIcon) source).getHtml(), ContentMode.HTML)); } else { this.icon.addComponent(new Image(null, source)); } } }
private Label createBody1Label(String text) { Label lbl = new Label(text); lbl.setContentMode(HTML); lbl.addStyleName(Typography.Dark.Body1.PRIMARY); lbl.addStyleName(Margins.Bottom.LARGE); return lbl; }
private VerticalLayout getHealth(Health health) { HorizontalLayout cards = new HorizontalLayout(); if(health.getDiskSpace().isPresent()) { long diskFree = health.getDiskSpace().get().getFree(); long diskTotal = health.getDiskSpace().get().getTotal(); long percentageFree = (diskFree * 100) / diskTotal; cards.addComponent(new Card("Disk", health.getDiskSpace().get().getStatus(), String.format("Free diskspace: %s %%", percentageFree))); } if(health.getDb().isPresent()) { cards.addComponent(new Card("Database", health.getDb().get().getStatus(), String.format("Vendor: %s", health.getDb().get().getDatabase()))); } VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label(String.format("Application is %s", health.getStatus()))); if(cards.getComponentCount() == 0) { layout.addComponent(new Label("No additional data to display")); } else { layout.addComponent(cards); } layout.setMargin(false); return layout; }
/** * Returns a simple window with the specified caption and content(which can be HTML) with an OK and Cancel Buttons. * The cancel button defaults to closing the window. * This behaviour can be modified by calling @link {@link VmidcWindow#getComponentModel()} and setting a different * listener to the cancel button * * @param caption * the caption * @param content * the content * @return the handle to window object */ public static VmidcWindow<OkCancelButtonModel> createAlertWindow(String caption, String content) { final VmidcWindow<OkCancelButtonModel> alertWindow = new VmidcWindow<OkCancelButtonModel>( new OkCancelButtonModel()); alertWindow.setCaption(caption); alertWindow.getComponentModel().setCancelClickedListener(new ClickListener() { /** * */ private static final long serialVersionUID = 98853982893459323L; @Override public void buttonClick(ClickEvent event) { alertWindow.close(); } }); Label contentLabel = new Label(content); contentLabel.setContentMode(ContentMode.HTML); FormLayout form = new FormLayout(); form.setMargin(true); form.setSizeUndefined(); form.addComponent(contentLabel); alertWindow.setContent(form); return alertWindow; }
private void startServer(String stripeName, String serverName, Button startBT, Button stopBT, Label stateLBL, Label pidLBL) { File stripeconfig = tcConfigLocationPerStripe.get(stripeName); if (stripeconfig == null) { generateXML(false); stripeconfig = tcConfigLocationPerStripe.get(stripeName); } File workDir = new File(settings.getKitPath()); String key = stripeName + "-" + serverName; TextArea console = getConsole(key); RunningServer runningServer = new RunningServer( workDir, stripeconfig, serverName, console, 500, () -> { runningServers.remove(key); access(() -> { stopBT.setEnabled(false); startBT.setEnabled(true); pidLBL.setValue(""); stateLBL.setValue("STOPPED"); }); }, newState -> access(() -> stateLBL.setValue("STATE: " + newState)), newPID -> access(() -> pidLBL.setValue("PID: " + newPID)) ); if (runningServers.put(key, runningServer) != null) { Notification.show("ERROR", "Server is running: " + serverName, Notification.Type.ERROR_MESSAGE); return; } consoles.setSelectedTab(console); stateLBL.setValue("STARTING"); runningServer.start(); startBT.setEnabled(false); stopBT.setEnabled(true); runningServer.refreshConsole(); }
private Label getNoLogsText(Application app, Environment env, String loggingPath, String loggingFile) { String loggingPathUnavailable; if(StringUtils.isEmpty(loggingPath)) { loggingPathUnavailable = "- Property 'logging.path' is not set"; } else { loggingPathUnavailable = String.format("- Property 'logging.path' is set to '%s'", loggingPath); } String loggingFileUnavailable; if(StringUtils.isEmpty(loggingFile)) { loggingFileUnavailable = "- Property 'logging.file' is not set"; } else { loggingFileUnavailable = String.format("- Property 'logging.file' is set to '%s'", loggingFile); } String noLogsText = new StringBuilder() .append(String.format("Endpoint %s is not available because:", app.endpoints().logfile())) .append("\n") .append(loggingPathUnavailable) .append("\n") .append(loggingFileUnavailable) .append("\n") .append("(at least one of those properties have to be properly set)") .append("\n\n") .append(String.format("Generated value for LOG_FILE property: %s", env.get("LOG_FILE"))) .toString(); return new Label(noLogsText, ContentMode.PREFORMATTED); }
public SingleLineListItem(String primaryText, boolean verticalPadding) { super(verticalPadding); addStyleName("single-line"); setHeight(Metrics.List.SINGLE_LINE_HEIGHT, Unit.PIXELS); primary = new Label(primaryText, ContentMode.HTML); primary.addStyleName(Typography.Dark.Subheader.PRIMARY); content.addComponent(primary); actionPrimary.addComponents(iconPrimary, content); actionSecondary.addComponent(iconSecondary); addComponents(actionPrimary, actionSecondary, divider); }
@Override public void populateForm() { Label delete = new Label(this.CAPTION + " - " + this.userView.getParentContainer().getItem(this.userView.getParentItemId()) .getItemProperty("loginName").getValue().toString()); this.form.addComponent(delete); }
private Component createHeadline(String text) { Label lbl = new Label(text); lbl.addStyleName(Typography.Dark.DatePicker.Title.PRIMARY + " " + MaterialColor.BLUE_500.getFontColorStyle()); FlexLayout layout = new FlexLayout(lbl); layout.setAlignItems(FlexLayout.AlignItems.CENTER); layout.setHeight(Metrics.DatePicker.HEADER_HEIGHT, Unit.PIXELS); return layout; }
private void showTransitionLabel(String message) { Label feedbackLabel = new Label(message); feedbackLabel.addStyleName(STYLE_FEEDBACK_MESSAGE); labelBar.removeAllComponents(); labelBar.addComponent(feedbackLabel); }
private void initNavigationItems() { addNavItem(null, "Bottom navigation", new Label("Todo implement")); addNavItem(null, "Bottom sheets", new Label("Todo implement")); addNavItem(MaterialIcons.FILE_DOWNLOAD, "Buttons", new ButtonsView()); addNavItem(null, "Buttons: Floating Action Button", new Label("Todo implement")); addNavItem(null, "Cards", new Label("Todo implement")); addNavItem(null, "Chips", new Label("Todo implement")); addNavItem(MaterialIcons.PALETTE, "Colors", new ColorsView()); addNavItem(MaterialIcons.GRID_ON, "Data tables", new DataTablesView()); addNavItem(MaterialIcons.DESKTOP_WINDOWS, "Dialogs", new DialogsView()); addNavItem(null, "Dividers", new Label("Todo implement")); addNavItem(null, "Expansion panels", new Label("Todo implement")); addNavItem(null, "Grid lists", new Label("Todo implement")); addNavItem(MaterialIcons.LIST, "Lists", new ListsView()); addNavItem(null, "Lists: Controls", new Label("Todo implement")); addNavItem(MaterialIcons.MENU, "Menus", new MenusView()); addNavItem(MaterialIcons.EVENT, "Pickers", new PickersView()); addNavItem(null, "Progress & activity", new Label("Todo implement")); addNavItem(MaterialIcons.CHECK_BOX, "Selection controls", new SelectionControlsView()); addNavItem(null, "Sliders", new Label("Todo implement")); addNavItem(MaterialIcons.DESKTOP_WINDOWS, "Snackbars & toasts", new SnackbarsToastsView()); addNavItem(MaterialIcons.DIRECTIONS_WALK, "Steppers", new SteppersView()); addNavItem(null, "Subheaders", new Label("Todo implement")); addNavItem(MaterialIcons.TAB, "Tabs", new TabsView()); addNavItem(MaterialIcons.TEXT_FIELDS, "Text fields", new TextFieldsView()); addNavItem(null, "Toolbars", new Label("Todo implement")); addNavItem(MaterialIcons.HELP, "Tooltips", new TooltipsView()); addNavItem(MaterialIcons.TEXT_FORMAT, "Typography", new TypographyView()); addNavItem(null, "Widgets", new Label("Todo implement")); }
private Component createHeadline(String text) { Label lbl = new Label(text); lbl.addStyleName(Typography.Dark.DatePicker.Title.PRIMARY + " " + MaterialColor.BLUE_500.getFontColorStyle()); FlexLayout layout = new FlexLayout(lbl); layout.setAlignItems(AlignItems.CENTER); layout.setHeight(Metrics.DatePicker.HEADER_HEIGHT, Unit.PIXELS); return layout; }
public LocalTimeField() { hourNs = new NativeSelect(); minuteNs = new NativeSelect(); hlContent = new HorizontalLayout(); //hlContent.setSizeFull(); hlContent.setSpacing(true); for (Integer i = 0; i<24; i++){ hourNs.addItem(i); hourNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } hourNs.setNullSelectionAllowed(false); hourNs.setImmediate(true); for (Integer i = 0; i<60; i++){ minuteNs.addItem(i); minuteNs.setItemCaption(i, MethodUtils.getLabelMinuteHeure(i)); } minuteNs.setNullSelectionAllowed(false); minuteNs.setImmediate(true); hlContent.addComponent(hourNs); hlContent.setComponentAlignment(hourNs, Alignment.MIDDLE_LEFT); Label label1 = new Label(":"); hlContent.addComponent(label1); hlContent.setComponentAlignment(label1, Alignment.MIDDLE_LEFT); hlContent.addComponent(minuteNs); hlContent.setComponentAlignment(minuteNs, Alignment.MIDDLE_LEFT); Label label2 = new Label("(HH:MM)"); hlContent.addComponent(label2); hlContent.setComponentAlignment(label2, Alignment.MIDDLE_LEFT); }
/** * Ajout du listener du sous menu */ private void addTabSheetListener(Navigator navigator){ this.addSelectedTabChangeListener(e -> { if (e.getTabSheet().getSelectedTab()!=null){ navigator.navigateTo((String) ((Label)e.getTabSheet().getSelectedTab()).getData()); } }); }
/** * Constructeur * * @param title * @param parent */ public AccordionItemMenu(String title, AccordionMenu parent, Boolean isExpandable) { super(); setWidth(100, Unit.PERCENTAGE); /* * Les labels n'etant pas cliquable, on passe par un layout * intermediaire */ VerticalLayout layoutClickable = new VerticalLayout(); layoutClickable.setWidth(100, Unit.PERCENTAGE); /* Label */ Label label = new Label(title); label.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); label.setSizeUndefined(); layoutClickable.addComponent(label); layoutClickable.addStyleName(StyleConstants.VALO_MENUACCORDEON); addComponent(layoutClickable); if (isExpandable) { layoutClickable.addStyleName(StyleConstants.CLICKABLE); layoutClickable.addLayoutClickListener(e -> { parent.changeItem((String) getData()); }); } vlButton = new VerticalLayout(); vlButton.addStyleName(StyleConstants.VALO_MENUACCORDEON); vlButton.setWidth(100, Unit.PERCENTAGE); addComponent(vlButton); }
public SubMenu(String vue, FontAwesome icon) { super(); this.vue = vue; this.icon = icon; this.label = new Label(); this.label.setData(this.vue); }
public OnDemandFileLayout(String fileName){ setSpacing(true); setWidth(100, Unit.PERCENTAGE); addStyleName(StyleConstants.ON_DEMAND_FILE_LAYOUT); btnDel.setDescription(applicationContext.getMessage("file.btnDel", null, UI.getCurrent().getLocale())); btnDel.setVisible(false); addComponent(btnDel); setComponentAlignment(btnDel, Alignment.MIDDLE_CENTER); btnViewer.setDescription(applicationContext.getMessage("img.viewer.btn", null, UI.getCurrent().getLocale())); btnViewer.setVisible(false); addComponent(btnViewer); setComponentAlignment(btnViewer, Alignment.MIDDLE_CENTER); btnDownload.setDescription(applicationContext.getMessage("file.btnDownload", null, UI.getCurrent().getLocale())); btnDownload.setVisible(false); addComponent(btnDownload); setComponentAlignment(btnDownload, Alignment.MIDDLE_CENTER); btnAdmin.setDescription(applicationContext.getMessage("pj.admin.btn", null, UI.getCurrent().getLocale())); btnAdmin.setVisible(false); addComponent(btnAdmin); setComponentAlignment(btnAdmin, Alignment.MIDDLE_CENTER); Label label = new Label(fileName); addComponent(label); setComponentAlignment(label, Alignment.MIDDLE_LEFT); setExpandRatio(label, 1.0f); }
public Step2() { super(true); // Use default actions VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label stepAttributesTitle = new Label("Step Attributes"); stepAttributesTitle.addStyleName(ValoTheme.LABEL_H2); Label stepAttributesLabel = new Label("You can change various attributes on a single step:" + "<ul>" + "<li>caption</li>" + "<li>description</li>" + "<li>icon</li>" + "<li>optional (to be able to skip it)</li>" + "<li>editable (come back if skipped or next, show edit " + "icon)" + "</li>" + "</ul>", ContentMode.HTML); content.addComponent(stepAttributesTitle); content.addComponent(stepAttributesLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); setCaption("Step 2"); setDescription("Step Attributes"); setContent(content); setIcon(VaadinIcons.BAR_CHART); setOptional(true); setEditable(true); }