List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:com.mycollab.vaadin.web.ui.AbstractBeanPagedList.java
License:Open Source License
protected MHorizontalLayout createPageControls() { controlBarWrapper = new MHorizontalLayout().withFullWidth() .withMargin(new MarginInfo(false, true, false, true)).withStyleName(listControlStyle); pageManagement = new MHorizontalLayout(); // defined layout here --------------------------- if (currentPage > 1) { MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging"); pageManagement.addComponent(firstLink); }// w ww .j a va 2 s .c om if (currentPage >= 5) { final Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2)) .withStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1)) .withStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage)) .withStyleName("buttonPaging", "current"); pageManagement.addComponent(current); final int range = this.totalPage - currentPage; if (range >= 1) { MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1)) .withStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2)) .withStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { MButton last = new MButton("" + this.totalPage, clickEvent -> pageChange(totalPage)) .withStyleName("buttonPaging"); pageManagement.addComponent(last); } controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT); return controlBarWrapper; }
From source file:com.mycollab.vaadin.web.ui.table.AbstractPagedBeanTable.java
License:Open Source License
private ComponentContainer createPagingControls() { controlBarWrapper = new HorizontalLayout(); controlBarWrapper.setWidth("100%"); controlBarWrapper.setStyleName("listControl"); pageManagement = new MHorizontalLayout(); // defined layout here --------------------------- if (currentPage > 1) { MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging"); pageManagement.addComponent(firstLink); }/* w w w. j a va 2 s. co m*/ if (currentPage >= 5) { Label ss1 = new Label("..."); ss1.addStyleName("buttonPaging"); pageManagement.addComponent(ss1); } if (currentPage > 3) { MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2)) .withStyleName("buttonPaging"); pageManagement.addComponent(previous2); } if (currentPage > 2) { MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1)) .withStyleName("buttonPaging"); pageManagement.addComponent(previous1); } // Here add current ButtonLinkLegacy MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage)) .withStyleName("buttonPaging", "current"); pageManagement.addComponent(current); final int range = totalPage - currentPage; if (range >= 1) { MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1)) .withStyleName("buttonPaging"); pageManagement.addComponent(next1); } if (range >= 2) { MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2)) .withStyleName("buttonPaging"); pageManagement.addComponent(next2); } if (range >= 4) { final Label ss2 = new Label("..."); ss2.addStyleName("buttonPaging"); pageManagement.addComponent(ss2); } if (range >= 3) { MButton last = new MButton("" + totalPage, clickEvent -> pageChange(totalPage)) .withStyleName("buttonPaging"); pageManagement.addComponent(last); } pageManagement.setWidth(null); controlBarWrapper.addComponent(pageManagement); controlBarWrapper.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT); return controlBarWrapper; }
From source file:com.neatresults.mgnltweaks.app.status.ConfigStatusViewImpl.java
License:Open Source License
@Override public void build() { Component totalExtends = buildAndBind(ConfigStatusView.EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.extendscount")); Component absoluteExtends = buildAndBind(ConfigStatusView.ABS_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.absoluteextendscount")); Component relativeExtends = buildAndBind(ConfigStatusView.REL_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.relativeextendscount")); Component overrideExtends = buildAndBind(ConfigStatusView.OVR_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.overrideextendscount")); Component unresolvedExtends = buildAndBind(ConfigStatusView.EXTENDS_FAIL_COUNT, translator.translate("neatconfiguration.app.status.extendsfailcount")); Component unresolvedExtendsList = buildAndBindList(ConfigStatusView.EXTENDS_FAIL_LIST, translator.translate("neatconfiguration.app.status.extendsfaillist")); unresolvedExtendsList.addStyleName("neat-extends-list"); // top title//from ww w . jav a 2 s.c o m FormLayout layout = new FormLayout(); Label sectionTitle = new Label(translator.translate("neatconfiguration.app.status.top.title")); sectionTitle.addStyleName("section-title"); layout.addComponent(sectionTitle); root.addSection(layout); // extends layout = new FormLayout(); layout.addComponent( createFieldsetTitle(translator.translate("neatconfiguration.app.status.extends.title"))); layout.addComponent(totalExtends); layout.addComponent(absoluteExtends); layout.addComponent(relativeExtends); layout.addComponent(overrideExtends); layout.addComponent(unresolvedExtends); layout.addComponent(unresolvedExtendsList); root.addSection(layout); // refresh layout = new FormLayout(); Button refreshButton = new Button(translator.translate("neatconfiguration.app.status.refresh.caption")); refreshButton.addStyleName("v-button-smallapp"); refreshButton.addStyleName("commit"); refreshButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getListener().refreshData(); refresh(); } }); layout.addComponent(refreshButton); root.addSection(layout); }
From source file:com.neatresults.mgnltweaks.app.status.ConfigStatusViewImpl.java
License:Open Source License
protected Component createFieldsetTitle(String title) { Label fieldsetTitle = new Label(title); fieldsetTitle.addStyleName("fieldset-title"); return fieldsetTitle; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.header.HeaderViewImpl.java
License:Open Source License
@Override public void update(HeaderInfo update) { header.removeAllComponents();/* w w w . j a v a 2 s .co m*/ Label title = new Label("<span id='story'>STORY:</span><span id='title'>" + update.getTitle() + "</span>", ContentMode.HTML); title.addStyleName("header-story"); header.addComponent(title); Label metaData = new Label( "<span id='created-by'>Created by [" + update.getCreatedBy() + "] on " + update.getCreated() + "</span>" + "<div id='last-opened-by'>Last Opened by [" + update.getLastOpenedBy() + "] on " + update.getLastSaved() + "</div>" + "<div id='modified-by'>Modified by [" + update.getLastModifiedBy() + "] on " + update.getLastSaved() + "</div>", ContentMode.HTML); metaData.addStyleName("header-metadata"); header.addComponent(metaData); createButtons(); Label lastSaved = new Label( "<div id='title'>LAST SAVED:</div><span id='time'>" + update.getLastSaved() + "</span>", ContentMode.HTML); lastSaved.addStyleName("last-saved"); header.addComponent(lastSaved); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.layouteditor.LayoutEditorPresenter.java
License:Open Source License
public LayoutEditorView start(JcrNodeAdapter articleItem) { final String title = "LAYOUT EDITOR"; Label previewLabel = new Label(title, ContentMode.HTML); previewLabel.setSizeUndefined();/* w w w. j a va 2s . c o m*/ previewLabel.addStyleName("navigation-label"); previewLabel.addStyleName("ax-shape"); eventBus.fireEvent(new PreviewChangedEvent(previewLabel, ViewType.LayoutEditor)); try { server = MgnlContext.getWebContext().getRequest().getRequestURL().toString(); server = server.substring(0, server.indexOf("/.magnolia")) + "/article?contentPath="; view.setArticleUrl(server + articleItem.getJcrItem().getName()); } catch (RepositoryException e) { e.printStackTrace(); } return view; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionPresenter.java
License:Open Source License
public ArticlePromotionView start(JcrNodeAdapter articleItem) { this.articleItem = articleItem; String title = "PROMOTE"; Label previewLabel = new Label(title, ContentMode.HTML); previewLabel.setSizeUndefined();//from www . jav a 2 s. co m previewLabel.addStyleName("navigation-label"); previewLabel.addStyleName("ax-shape"); view.setListener(this); view.construct(); eventBus.fireEvent(new PreviewChangedEvent(previewLabel, ViewType.Promote)); return view; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createAlert() { VerticalLayout alertTextLayout = new VerticalLayout(); alertTextLayout.setSpacing(true);/* w w w. ja v a2 s . co m*/ alertTextLayout.setCaption("Alert Text"); MagnoliaRichTextField textField = (MagnoliaRichTextField) listener.createRichTextField(); textField.setSizeFull(); HorizontalLayout periodLayout = new HorizontalLayout(); periodLayout.setSpacing(true); // periodLayout.setWidth("100%"); DateField startDate = new DateField(); // startDate.setWidth("100%"); DateField endDate = new DateField(); // endDate.setWidth("100%"); periodLayout.addComponent(new Label("START")); periodLayout.addComponent(startDate); periodLayout.addComponent(new Label("END")); periodLayout.addComponent(endDate); alertTextLayout.addComponent(textField); alertTextLayout.addComponent(periodLayout); HorizontalLayout alertLayout = new HorizontalLayout(); alertLayout.setSpacing(true); alertLayout.setWidth("100%"); alertLayout.addComponent(alertTextLayout); final Label alertPreview = new Label("", ContentMode.HTML); alertPreview.setCaption("Alert Preview"); alertPreview.addStyleName("preview-label"); textField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { alertPreview.setValue(String.valueOf(event.getProperty().getValue())); } }); alertPreview.setSizeUndefined(); alertLayout.addComponent(alertPreview); alert.setContent(alertLayout); textField.setValue( "<b>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</b>"); }
From source file:com.peergreen.example.webconsole.extensions.ConfirmDialogExtension.java
License:Open Source License
public ConfirmDialogExtension() { setSizeFull();/* w ww. j av a 2 s . co m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Label title = new Label("Drag and drop components from a panel to another"); title.addStyleName("h1"); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setSpacing(true); row.setMargin(true); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setSpacing(true); leftPanel.addStyleName("dashed-area"); leftPanel.addComponent(getDraggableComponent(new Label("Label"))); leftPanel.addComponent(getDraggableComponent(new Button("Button"))); DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel); row.addComponent(leftPanelWrapper); row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setSpacing(true); rightPanel.addStyleName("dashed-area"); DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel); row.addComponent(rightPanelWrapper); row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT); leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel)); rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel)); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.example.webconsole.extensions.NavigatorExtension.java
License:Open Source License
@PostConstruct public void init() { Label guide = new Label( "The path of a navigable extension is the path of its parent concatenated with the string " + "inside the class annotation @Navigable(\"alias\")"); guide.addStyleName("h2"); addComponent(guide);/*from w w w .j a va 2 s. c om*/ HorizontalLayout row = new HorizontalLayout(); row.setSpacing(true); row.setMargin(true); row.setCaption("Type the alias of an extension you want to navigate to"); final ComboBox comboBox = new ComboBox(); comboBox.setWidth("400px"); comboBox.setNullSelectionAllowed(false); comboBox.addItem("/example/simple"); comboBox.addItem("/example/notifier"); comboBox.addItem("/example/window"); comboBox.addItem("/example/confirm"); row.addComponent(comboBox); Button navigate = new Button("Navigate"); navigate.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (comboBox.getValue() != null && !"".equals(comboBox.getValue())) { uiContext.getViewNavigator().navigateTo(comboBox.getValue().toString()); } } }); row.addComponent(navigate); addComponent(row); setExpandRatio(row, 1.5f); }