List of usage examples for com.vaadin.ui Label addStyleName
@Override public void addStyleName(String style)
From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java
License:Open Source License
private HorizontalLayout createHeader() { final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setMargin(true);/*from w w w . j a v a 2 s . c o m*/ layout.setSpacing(true); final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven"); title.addStyleName(Reindeer.LABEL_H1); layout.addComponent(title); layout.setExpandRatio(title, 1.0f); Label currentUser = new Label(); currentUser.setSizeUndefined(); layout.addComponent(currentUser); layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT); Button logout = new Button("Logout"); logout.addStyleName(Reindeer.BUTTON_SMALL); // logout.addListener(createLogoutButtonListener()); layout.addComponent(logout); layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:nl.amc.biolab.nsg.display.component.MainUI.java
License:Open Source License
private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false);/* w ww.j ava 2s. co m*/ mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); mainLayout.setSpacing(true); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // topPanel topPanel = buildTopPanel(); mainLayout.addComponent(topPanel); mainLayout.setExpandRatio(topPanel, 1.0f); mainLayout.setComponentAlignment(topPanel, new Alignment(33)); // horizontal rule Label hr = new Label("<hr/>", Label.CONTENT_XHTML); hr.addStyleName("horizontal-separator"); hr.setWidth("100%"); hr.setHeight("2px"); mainLayout.addComponent(hr); mainLayout.setComponentAlignment(hr, new Alignment(33)); // mainSplitPanel mainSplitPanel = buildMainSplitPanel(); mainLayout.addComponent(mainSplitPanel); mainLayout.setExpandRatio(mainSplitPanel, 1.0f); return mainLayout; }
From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java
License:Open Source License
protected Component createSolrServerInformationSection() { FormLayout layout = new FormLayout(); Label serverInformationSectionTitle = new Label(i18n.translate("solr.app.serverInformation.label.title")); serverInformationSectionTitle.addStyleName(STYLE_SECTION_TITLE); // build and bind fields Component solrServerStatus = buildAndBind(SolrManagementSubApp.SOLR_SERVER_STATUS, i18n.translate("solr.app.serverInformation.serverStatus")); Component nrDocumentsInIndex = buildAndBind(SolrManagementSubApp.SOLR_SERVER_NUMBER_OF_DOCUMENTS, i18n.translate("solr.app.serverInformation.numberOfDocsInIndex")); Button refreshSolrServerStatusButton = new Button( i18n.translate("solr.app.serverInformation.button.refreshSolrServerStatus.caption"), event -> listener.refreshView()); refreshSolrServerStatusButton.addStyleName(STYLE_V_BUTTON_SMALLAPP); refreshSolrServerStatusButton.addStyleName(STYLE_COMMIT); VerticalLayout buttons = new VerticalLayout(); buttons.addStyleName(STYLE_BUTTONS); buttons.setSpacing(true);/*from w w w .j av a 2 s . co m*/ buttons.addComponent(refreshSolrServerStatusButton); layout.addComponent(serverInformationSectionTitle); layout.addComponent(solrServerStatus); layout.addComponent(nrDocumentsInIndex); layout.addComponent(buttons); return layout; }
From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java
License:Open Source License
protected Component createSolrIndexManagementSection() { FormLayout layout = new FormLayout(); Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrIndex.label.intro")); manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE); layout.addComponent(manageSolrSectionTitle); layout.addComponent(new Label(i18n.translate("solr.app.manageSolrIndex.label.description"))); Button clearSolrIndexButton = new Button( i18n.translate("solr.app.management.button.clearSolrIndex.caption"), event -> listener.clearSolrIndex()); clearSolrIndexButton.addStyleName(STYLE_V_BUTTON_SMALLAPP); clearSolrIndexButton.addStyleName(STYLE_COMMIT); VerticalLayout buttons = new VerticalLayout(); buttons.addStyleName(STYLE_BUTTONS); buttons.setSpacing(true);/*from w w w .ja va 2s . co m*/ buttons.addComponent(clearSolrIndexButton); layout.addComponent(buttons); return layout; }
From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java
License:Open Source License
protected Component createSolrCrawlerManagementSection() { FormLayout layout = new FormLayout(); Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrCrawlers.label.intro")); manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE); layout.addComponent(manageSolrSectionTitle); Map<String, CrawlerConfig> crawlers = contentIndexerModule.getCrawlers(); if (crawlers.isEmpty()) { layout.addComponent(/*from www . j ava2 s . c o m*/ new Label(i18n.translate("solr.app.manageSolrCrawlers.noCrawlers.label.description"))); } else { layout.addComponent(new Label(i18n.translate("solr.app.manageSolrCrawlers.label.description"))); VerticalLayout buttons = new VerticalLayout(); buttons.addStyleName(STYLE_BUTTONS); buttons.setSpacing(true); // only create buttons for crawlers that have been configured and are enabled in the content-indexer module. for (Map.Entry<String, CrawlerConfig> crawler : crawlers.entrySet()) { CrawlerConfig crawlerConfig = crawler.getValue(); Button runSolrCrawlerButton = new Button( i18n.translate("solr.app.management.button.runSolrCrawler.caption") + " " + crawlerConfig.getName(), event -> listener.runSolrCrawlerCommand(crawlerConfig.getName())); runSolrCrawlerButton.addStyleName(STYLE_V_BUTTON_SMALLAPP); runSolrCrawlerButton.addStyleName(STYLE_COMMIT); buttons.addComponent(runSolrCrawlerButton); } layout.addComponent(buttons); } return layout; }
From source file:nl.kpmg.lcm.ui.Application.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("Local Catalog Manager"); final VerticalLayout root = new VerticalLayout(); root.setSizeFull();/* www . j a v a 2s .co m*/ root.setMargin(true); root.setSpacing(true); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); Label logo = new Label("LCM"); logo.addStyleName("logo"); logo.setWidthUndefined(); navigationBar.addComponent(logo); navigationBar.addComponent(createNavigationButton("Metadata", MetadataOverviewViewImpl.VIEW_NAME)); navigationBar.addComponent(createNotImplementedButton("Analytics")); navigationBar.addComponent(createNavigationButton("Transfer", TransferViewImpl.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("Administration", AdministrationViewImpl.VIEW_NAME)); navigationBar.addComponent(createLogoutButton("Logout")); root.addComponent(navigationBar); final Panel viewContainer = new Panel(); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); navigator.navigateTo("login"); }
From source file:org.accelerators.activiti.admin.ui.MainView.java
License:Open Source License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);/*from www . j av a 2 s .c o m*/ setSpacing(false); setSizeFull(); // Add header GridLayout header = new GridLayout(2, 1); header.setWidth("100%"); header.setHeight("34px"); addComponent(header); // Add header styles header.addStyleName(Consts.HEADER); header.addStyleName("header"); header.setSpacing(true); // Add title to header GridLayout logoGrid = new GridLayout(1, 1); header.addComponent(logoGrid, 0, 0); header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT); Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png")); logoImage.setType(Embedded.TYPE_IMAGE); logoImage.addStyleName("header-image"); logoGrid.addComponent(logoImage, 0, 0); logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER); // Add logout button to header GridLayout logoutGrid = new GridLayout(2, 1); Label userLabel = new Label("Signed in as: " + app.getUser().toString()); userLabel.addStyleName("user"); logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logoutGrid.addComponent(userLabel, 0, 0); logoutGrid.addComponent(logout, 1, 0); header.addComponent(logoutGrid, 1, 0); header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }
From source file:org.activiti.administrator.AdminApp.java
License:Apache License
/** * Switch view/*w w w. j a v a 2s .c om*/ * * @param name * the name of the view class * @param view * the view to switch to */ public void switchView(String name, Layout view) { // Add view to main layout mainLayout.addComponent(view, Consts.CONTENT); // Add logout button if user is authenticated if ((getUser() != null) && !getUser().toString().isEmpty()) { // Create logout grid with user icon, user id and logout button GridLayout logoutGrid = new GridLayout(3, 1); logoutGrid.setStyleName("logout"); // Add user icon Embedded userIcon = new Embedded(null, new ThemeResource("img/user-icon.png")); userIcon.setType(Embedded.TYPE_IMAGE); userIcon.addStyleName("icon"); // Add user id Label userLabel = new Label(getUser().toString()); userLabel.addStyleName("user"); // Add logout button logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logout.setIcon(new ThemeResource("img/divider-white.png")); // Add to logout grid logoutGrid.addComponent(userIcon, 0, 0); logoutGrid.addComponent(userLabel, 1, 0); logoutGrid.addComponent(logout, 2, 0); // Add logout grid to header mainLayout.addComponent(logoutGrid, Consts.LOGOUT); } else { // Remove logout button mainLayout.removeComponent(Consts.LOGOUT); } // Switch to new view viewManager.switchScreen(name, mainLayout); }
From source file:org.activiti.administrator.ui.LoginView.java
License:Apache License
@SuppressWarnings("serial") public LoginView(AdminApp application) { // Set application reference this.app = application; // Init window caption app.getMainWindow().setCaption(app.getMessage(Messages.Title)); // Set style//from w ww . java2 s. co m setStyleName(Reindeer.LAYOUT_WHITE); // Set layout to full size setSizeFull(); // Create main layout VerticalLayout mainLayout = new VerticalLayout(); // Add layout styles mainLayout.setStyleName(Reindeer.LAYOUT_WHITE); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); mainLayout.setSpacing(false); // Add layout addComponent(mainLayout); setComponentAlignment(mainLayout, Alignment.TOP_LEFT); // Add field and button layout VerticalLayout buttonLayout = new VerticalLayout(); buttonLayout.setSpacing(true); buttonLayout.setMargin(true); buttonLayout.setWidth("200px"); buttonLayout.setStyleName("login-form"); // Add username field username = new TextField(app.getMessage(Messages.Username)); username.setWidth("100%"); buttonLayout.addComponent(username); // Add password field password = new PasswordField(app.getMessage(Messages.Password)); password.setWidth("100%"); buttonLayout.addComponent(password); // Add Login button buttonLayout.addComponent(login); buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_LEFT); // Add button layout mainLayout.addComponent(buttonLayout); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); footerText.addStyleName("footer"); mainLayout.addComponent(footerText); mainLayout.setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); // Set focus to this component username.focus(); // Add shortcut to login button login.setClickShortcut(KeyCode.ENTER); login.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { try { // Athenticate the user authenticate((String) username.getValue(), (String) password.getValue()); // Switch to the main view app.switchView(MainView.class.getName(), new MainView(app)); } catch (Exception e) { getWindow().showNotification(e.toString()); } } }); }
From source file:org.activiti.administrator.ui.MainView.java
License:Apache License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);/*from w ww.j ava 2 s . com*/ setSpacing(false); setSizeFull(); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); footerText.addStyleName("footer"); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }