List of usage examples for com.vaadin.ui.themes ValoTheme LABEL_FAILURE
String LABEL_FAILURE
To view the source code for com.vaadin.ui.themes ValoTheme LABEL_FAILURE.
Click Source Link
From source file:org.vaadin.mqtt.ui.MqttComponent.java
/** * Show a message instead of the content. * * @param message//www . j a va2 s . c o m * @param isSucsess Error messages are formatted differently from success * messages. */ public final void showUserMessage(final String message, boolean isSucsess) { removeAllComponents(); Label l = new Label(message); l.setStyleName(isSucsess ? ValoTheme.LABEL_SUCCESS : ValoTheme.LABEL_FAILURE); addComponents(title, l); }
From source file:org.vaadin.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/*from www . ja v a 2 s . co m*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:trader.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { setLocale(Locale.ENGLISH);//from w w w .j av a2s.c om FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); loginForm.addComponent(passwordField = new PasswordField("Password")); loginForm.addComponent(rememberMe = new CheckBox("Remember me")); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 7813011112417170727L; @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:uk.co.intec.keyDatesApp.pages.HomeView.java
License:Apache License
/** * Loads the main content for the page. Only called on first entry to the * page, because calling method sets <i>isLoaded</i> to true after * successfully completing./*from w ww . j a v a2 s . c om*/ */ public void loadContent() { if ("Anonymous".equals(GenericDatabaseUtils.getUserName())) { final Label warning = new Label(); warning.setStyleName(ValoTheme.LABEL_H2); warning.setStyleName(ValoTheme.LABEL_FAILURE); warning.setValue("Anonymous access is not allowed on this application!"); addComponent(warning); } else { if (GenericDatabaseUtils.doesDbExist()) { final Label intro = new Label(); intro.setStyleName(ValoTheme.LABEL_H2); intro.setValue("Welcome to Key Dates OSGi Application"); addComponent(intro); } else { final Label warning = new Label(); warning.setStyleName(ValoTheme.LABEL_H2); warning.setStyleName(ValoTheme.LABEL_FAILURE); warning.setContentMode(ContentMode.HTML); warning.setValue( "We cannot open the data database. Most likely reasons are:<ul><li>You don't have access to the database, in which case you should contact IT.</li>" + "<li>The Key Dates database has not been set up at the filepath " + AppUtils.getDataDbFilepath() + ". Create the data database at that location or amend the 'dataDbFilePath' context parameter in WebContent > WEB-INF > web.xml of the application and issue 'restart task http' to the Domino server</li></ul>"); addComponent(warning); } } }
From source file:uk.co.intec.keyDatesApp.pages.MainView.java
License:Apache License
/** * Removes any existing row data loaded to the page and loads * ViewEntryWrappers passed to this method. If no entries were passed to the * method, the message "No entries found matching criteria" is displayed. * Otherwise writes the entries to the page, grouped under the date each Key * Date is for.//from w w w. ja v a 2s .c o m * * @param data * Map of data where key is a java.sql.Date (so does not include * a time element) and value is the wrapped ViewEntries for that * date. */ public void loadRowData(final Map<Object, List<ViewEntryWrapper>> data) { body.removeAllComponents(); if (null == data || data.isEmpty()) { final Label msg = new Label("No entries found matching criteria"); msg.setStyleName(ValoTheme.LABEL_FAILURE); body.addComponent(msg); } else { for (final Object key : data.keySet()) { if (key instanceof java.sql.Date) { // It will be! // Add the header final VerticalLayout catContainer = new VerticalLayout(); catContainer.addStyleName(ValoTheme.MENU_TITLE); catContainer.addStyleName("category-header"); final Label category = new Label(); final java.sql.Date sqlDate = (java.sql.Date) key; category.setValue(DATE_ONLY.format(sqlDate)); catContainer.addComponent(category); body.addComponent(catContainer); // Load the entries for (final ViewEntryWrapper veWrapped : data.get(key)) { final VerticalLayout entryRow = new VerticalLayout(); final KeyDateEntryWrapper entry = (KeyDateEntryWrapper) veWrapped; final StringBuilder suffixTitle = new StringBuilder(""); if (getViewWrapper().getViewName().equals(KeyDateViewWrapper.ViewType.BY_DATE)) { if (StringUtils.isNotEmpty(entry.getCustomer())) { suffixTitle.append(" (" + entry.getCustomer()); if (StringUtils.isNotEmpty(entry.getContact())) { suffixTitle.append(" - " + entry.getContact()); } suffixTitle.append(")"); } } else { if (StringUtils.isNotEmpty(entry.getContact())) { suffixTitle.append(" - " + entry.getContact()); } } final Button title = new Button(entry.getTitle() + suffixTitle.toString()); title.addStyleName(ValoTheme.BUTTON_LINK); // Add click event title.addClickListener(new DocLinkListener(KeyDateView.VIEW_NAME, entry.getNoteId())); entryRow.addComponent(title); // Add summary, if appropriate if (StringUtils.isNotEmpty(entry.getDescription())) { final Label summary = new Label(entry.getDescription()); summary.setContentMode(ContentMode.HTML); summary.addStyleName(ValoTheme.LABEL_SMALL); summary.addStyleName("view-desc"); entryRow.addComponent(summary); } body.addComponent(entryRow); } } } } }