Example usage for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY.

Prototype

String BUTTON_FRIENDLY

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_FRIENDLY.

Click Source Link

Document

A prominent button that can be used instead of the #BUTTON_PRIMARY for primary actions when the action is considered safe for the user (i.e.

Usage

From source file:de.fatalix.bookery.view.admin.BatchJobCard.java

private FormLayout createContent() {
    batchJobTypeCombo = new ComboBox("Batch Type");
    for (BatchJobType type : BatchJobType.values()) {
        batchJobTypeCombo.addItem(type);
    }/*from w w w  .ja  va 2  s .  c om*/
    batchJobTypeCombo.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (!noUpdate) {
                BatchJobType newType = ((BatchJobType) batchJobTypeCombo.getValue());

                batchJobConfiguration.setValue(newType.getDefaultConfig());

                updateBean();
                setFields();
            }
        }
    });

    description = new Label("description");
    nextRuntime = new Label("---");
    batchJobActive = new CheckBox("active", false);
    cronjobExpression = new TextField("Cronjob", "*******");
    status = new TextField("Status", "-");
    batchJobConfiguration = new TextArea("Configuration");

    Button updateButton = new Button("update", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateBean();
            jobConfig = presenter.updateBatchJob(jobConfig);
            setFields();
            logger.debug("Updated Batch Job...");
        }
    });
    updateButton.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    FormLayout batchJobCardContent = new FormLayout(batchJobTypeCombo, description, cronjobExpression,
            batchJobActive, batchJobConfiguration, nextRuntime, status, updateButton);
    batchJobCardContent.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    batchJobCardContent.setMargin(true);
    return batchJobCardContent;
}

From source file:de.fatalix.bookery.view.admin.ServerSettingsLayout.java

License:Open Source License

@PostConstruct
private void postInit() {
    addStyleName("bookery-content");
    formLayout = new FormLayout();
    formLayout.addStyleName("light");
    formLayout.addComponents(generateFields());
    formLayout.addComponents(generateStatusFields());

    Button checkSolr = new Button("check", new Button.ClickListener() {

        @Override//ww w .j  av  a 2s. c om
        public void buttonClick(Button.ClickEvent event) {
            checkSolr();
        }
    });
    checkSolr.addStyleName(ValoTheme.BUTTON_SMALL);
    checkSolr.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    formLayout.addComponent(checkSolr);

    Label titleLabel = new Label("General Settings");
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    addComponents(titleLabel, formLayout);
}

From source file:de.fatalix.bookery.view.common.BookDetailLayout.java

License:Open Source License

private HorizontalLayout createImageLayout() {
    image = new Image();
    image.setImmediate(true);/*w  w  w .  j  a v a  2s .c o  m*/
    image.setHeight("200px");
    image.setWidth("130px");

    downloadButton = new Button("download", FontAwesome.DOWNLOAD);
    downloadButton.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    downloadButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                loadData(presenter.updateShared(bookEntry,
                        SecurityUtils.getSubject().getPrincipal().toString()));
            } catch (SolrServerException | IOException ex) {
                Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE);
                logger.error(ex, ex);
            }
        }
    });

    fileDownloader = new FileDownloader(new StreamResource(new BookStreamSource(null), "blbla.epub"));
    fileDownloader.extend(downloadButton);

    sendToKindleButton = new Button("Kindle", FontAwesome.BOOK);
    sendToKindleButton.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    sendToKindleButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.shareBookWithKindle(bookEntry, SecurityUtils.getSubject().getPrincipal().toString());
                Notification.show("Book is sent to kindle", Notification.Type.HUMANIZED_MESSAGE);
                loadData(presenter.updateShared(bookEntry,
                        SecurityUtils.getSubject().getPrincipal().toString()));
            } catch (SolrServerException | IOException | MessagingException ex) {
                Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE);
                logger.error(ex, ex);
            }
        }
    });

    likeButton = new Button("0 likes", FontAwesome.THUMBS_O_UP);
    likeButton.addStyleName(ValoTheme.BUTTON_LINK);
    likeButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                BookEntry updatedEntry = presenter.updateLike(bookEntry,
                        SecurityUtils.getSubject().getPrincipal().toString());
                loadData(updatedEntry);
            } catch (SolrServerException | IOException ex) {
                Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE);
                logger.error(ex, ex);
            }
        }
    });

    watchListButton = new Button("merken", FontAwesome.STAR_O);
    watchListButton.addStyleName(ValoTheme.BUTTON_LINK);
    watchListButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString());
            loadData(bookEntry);
        }
    });
    downloadCount = new Label("0 downloads");

    VerticalLayout rightLayout = new VerticalLayout(sendToKindleButton, downloadButton, watchListButton,
            likeButton, downloadCount);
    rightLayout.setComponentAlignment(downloadCount, Alignment.MIDDLE_CENTER);
    rightLayout.setSpacing(true);

    HorizontalLayout layout = new HorizontalLayout(image, rightLayout);
    layout.setSpacing(true);
    return layout;
}

From source file:de.fatalix.bookery.view.common.BookSearchLayout.java

License:Open Source License

private VerticalLayout createSearchResultLayout() {
    resultText = new Label(" 0 Ergebnisse gefunden");
    resultText.addStyleName(ValoTheme.LABEL_BOLD);
    resultLayout = new HorizontalLayout();
    resultLayout.setSpacing(true);/*from  w w w. java 2  s . co m*/
    resultLayout.addStyleName("wrapping");
    showMore = new Button("show more", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            searchBooks(query, false);

        }
    });
    showMore.setWidth(100, Unit.PERCENTAGE);
    showMore.addStyleName(ValoTheme.BUTTON_HUGE);
    showMore.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    VerticalLayout root = new VerticalLayout();
    root.addStyleName("bookery-view");
    root.setSpacing(true);
    root.setMargin(true);
    root.addComponents(resultText, resultLayout, showMore);
    return root;
}

From source file:de.fatalix.bookery.view.login.LoginView.java

License:Open Source License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();//  ww  w .  j a va  2s.c  o m
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField("Username", "admin"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField("Password"));
    password.setWidth(15, Unit.EM);
    password.setDescription("");

    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);
    login = new Button("login");
    buttons.addComponent(login);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            } finally {
                login.setEnabled(true);
            }
        }
    });
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    buttons.addComponent(forgotPassword = new Button("Forgot password?"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            showNotification(new Notification("Hint: Ask me", Notification.Type.HUMANIZED_MESSAGE),
                    ValoTheme.NOTIFICATION_SUCCESS);
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    Panel loginPanel = new Panel(loginForm);
    loginPanel.setWidthUndefined();
    loginPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    loginPanel.addAction(new ShortcutListener("commit", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            try {
                presenter.doLogin(username.getValue(), password.getValue());
            } catch (AuthenticationException ex) {
                LoginView.this.showNotification(
                        new Notification("Wrong login", Notification.Type.ERROR_MESSAGE),
                        ValoTheme.NOTIFICATION_FAILURE);
            }
        }
    });
    return loginPanel;
}

From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();/*from w ww  .j  a v a2s .c  om*/
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField(translate("login.name.caption")));
    username.setDescription(translate("login.name.description"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField(translate("login.password.caption")));
    password.setWidth(15, Unit.EM);
    password.setDescription(translate("login.password.description"));
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    login = new Button(translate("login.login-button.caption"));
    buttons.addComponent(login);
    login.setDescription(translate("login.login-button.description"));
    login.setDisableOnClick(true);
    login.addClickListener(event -> {
        try {
            login();
        } finally {
            login.setEnabled(true);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    Button forgotPassword;
    buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption")));
    forgotPassword.setDescription(translate("login.password-forgotten.description"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            NotificationPayload notification = new NotificationPayload("login.password-forgotten.text");
            bus.post(new NotificationEvent(this, notification));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.AddPatientView.java

License:Open Source License

/**
 * // w  ww.  j  a  v a2  s . c  o m
 * @return
 */
VerticalLayout initButtonLayout() {
    registerPatients = new Button("Register Patients");
    // registerPatients.setWidth("100%");
    registerPatients.setStyleName(ValoTheme.BUTTON_FRIENDLY);
    registerPatients.setVisible(false);

    registerPatients.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            callPatientRegistration();
        }
    });

    buttonLayoutSection = new VerticalLayout();
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setMargin(new MarginInfo(true, false, true, false));
    buttonLayout.setHeight(null);
    buttonLayout.setWidth("100%");
    buttonLayoutSection.setWidth("100%");

    buttonLayoutSection.addComponent(buttonLayout);
    buttonLayout.addComponent(registerPatients);

    return buttonLayoutSection;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeExperimentMetadataComponent.java

License:Open Source License

public void updateUI(final String id, String type) {
    propLayout.removeAllComponents();//from  ww  w.  j av a2 s.  c  o m
    Button saveButton = new Button("Submit Changes");
    saveButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);

    completeProperties = datahandler.getOpenBisClient()
            .listPropertiesForType(datahandler.getOpenBisClient().getExperimentTypeByString(type));

    assignedProperties = datahandler.getOpenBisClient().getExperimentById2(id).get(0).getProperties();

    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            HashMap<String, Object> props = new HashMap<String, Object>();
            Collection<Field<?>> registeredFields = fieldGroup.getFields();
            XMLParser xmlParser = new XMLParser();

            List<Property> factors = new ArrayList<Property>();

            boolean qpropertiesDefined = false;

            for (Field<?> field : registeredFields) {
                if (field.getDescription().equals("Q_PROPERTIES")) {
                    TextField tf = (TextField) field;
                    qpropertiesDefined = true;
                    String label = tf.getCaption();
                    String val = (String) tf.getValue();
                    String[] splt = label.split(" in ");
                    Property f = null;
                    PropertyType type = (PropertyType) tf.getData();
                    if (splt.length > 1) {
                        label = splt[0];
                        properties.Unit unit = properties.Unit.valueOf(splt[1]);
                        f = new Property(label, val, unit, type);
                    } else {
                        f = new Property(label, val, type);
                    }
                    factors.add(f);
                }

                else {
                    props.put(field.getDescription(), field.getValue());
                }
            }

            if (qpropertiesDefined) {
                String qProperties = "";

                try {
                    qProperties = xmlParser.toString(xmlParser.createXMLFromProperties(factors));
                    props.put("Q_PROPERTIES", qProperties);
                } catch (JAXBException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            HashMap<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("user", LiferayAndVaadinUtils.getUser().getScreenName());
            parameters.put("identifier", id);
            parameters.put("properties", props);

            datahandler.getOpenBisClient().triggerIngestionService("update-experiment-metadata", parameters);
            Utils.Notification("Metadata changed succesfully",
                    String.format("Metadata values of experiment %s have been commited successfully.", id),
                    "success");
        }
    });
    buildFormLayout();
    propLayout.addComponent(new Label(String.format(
            "This view shows metadata connected to this experiment and can be used to change the corresponding values. \nIdentifier: %s",
            id), Label.CONTENT_PREFORMATTED));

    propLayout.addComponent(this.form);
    propLayout.addComponent(saveButton);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeProjectMetadataComponent.java

License:Open Source License

public void updateUI(final ProjectBean projectBean) {
    properties.removeAllComponents();//  w  w  w  .  ja  v  a 2s .  co m
    Button saveButton = new Button("Submit Changes");
    saveButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);

    currentDescription = projectBean.getDescription();

    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            HashMap<String, Object> parameters = new HashMap<String, Object>();
            Collection<Field<?>> registeredFields = fieldGroup.getFields();

            // List<Property> factors = new ArrayList<Property>();

            for (Field<?> field : registeredFields) {
                parameters.put("description", field.getValue());
            }

            parameters.put("identifier", projectBean.getId());
            parameters.put("user", LiferayAndVaadinUtils.getUser().getScreenName());
            datahandler.getOpenBisClient().triggerIngestionService("update-project-metadata", parameters);
            Utils.Notification("Project details changed succesfully", String.format(
                    "Details of project %s have been commited successfully.", projectBean.getId()), "success");
        }
    });

    buildFormLayout();
    Label desc = new Label(String.format(
            "This view shows project details and can be used to change the corresponding values. \nIdentifier: %s",
            projectBean.getId()), Label.CONTENT_PREFORMATTED);
    desc.setWidth("50%");
    properties.addComponent(desc);

    properties.addComponent(this.form);
    properties.addComponent(saveButton);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeSampleMetadataComponent.java

License:Open Source License

public void updateUI(final String id, String type) {
    propLayout.removeAllComponents();//from   ww w. j a  v  a2s . c  om
    Button saveButton = new Button("Submit Changes");
    saveButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);

    completeProperties = datahandler.getOpenBisClient()
            .listPropertiesForType(datahandler.getOpenBisClient().getSampleTypeByString(type));

    assignedProperties = datahandler.getOpenBisClient().getSampleByIdentifier(id).getProperties();

    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            HashMap<String, Object> props = new HashMap<String, Object>();
            Collection<Field<?>> registeredFields = fieldGroup.getFields();
            XMLParser xmlParser = new XMLParser();

            List<Property> factors = new ArrayList<Property>();

            boolean qpropertiesDefined = false;

            for (Field<?> field : registeredFields) {
                if (field.getDescription().equals("Q_PROPERTIES")) {
                    TextField tf = (TextField) field;
                    qpropertiesDefined = true;
                    String label = tf.getCaption();
                    String val = (String) tf.getValue();
                    String[] splt = label.split(" in ");
                    Property f = null;
                    properties.PropertyType type = (properties.PropertyType) tf.getData();
                    if (splt.length > 1) {
                        label = splt[0];
                        properties.Unit unit = properties.Unit.valueOf(splt[1]);
                        f = new Property(label, val, unit, type);
                    } else {
                        f = new Property(label, val, type);
                    }
                    factors.add(f);
                }

                else {
                    props.put(field.getDescription(), field.getValue());
                }
            }

            if (qpropertiesDefined) {
                String qProperties = "";

                try {
                    qProperties = xmlParser.toString(xmlParser.createXMLFromProperties(factors));
                    props.put("Q_PROPERTIES", qProperties);
                } catch (JAXBException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            HashMap<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("user", LiferayAndVaadinUtils.getUser().getScreenName());
            parameters.put("identifier", id);
            parameters.put("properties", props);

            datahandler.getOpenBisClient().triggerIngestionService("update-single-sample-metadata", parameters);
            Utils.Notification("Metadata changed succesfully",
                    String.format("Metadata values of sample %s have been commited successfully.", id),
                    "success");
        }
    });
    buildFormLayout();
    propLayout.addComponent(new Label(String.format(
            "This view shows metadata connected to this sample and can be used to change the corresponding values. \nIdentifier: %s",
            id), Label.CONTENT_PREFORMATTED));

    propLayout.addComponent(this.form);
    propLayout.addComponent(saveButton);
}