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

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

Introduction

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

Prototype

String LABEL_COLORED

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

Click Source Link

Document

Colored text.

Usage

From source file:tad.grupo7.ccamistadeslargas.EventosLayout.java

/**
 * Se muestra el formulario para aadir un participante al evento.
 *
 * @param e Recoge el evento./*from  w  w w .  ja  va 2s .c o m*/
 */
private void mostrarFormularioAddParticipante(Evento e) {
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Aadir Participante");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO
    List<Participante> participantes = ParticipanteDAO.readAllFromUsuario(usuario.getId());
    ComboBox nuevoParticipante = new ComboBox("Participante Nuevo");
    nuevoParticipante.setRequired(true);
    for (Participante p : participantes) {
        nuevoParticipante.addItem(p.getNombre());
    }
    final Button add = new Button("Aadir participante");
    add.addStyleName(ValoTheme.BUTTON_PRIMARY);
    add.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    add.addClickListener(clickEvent -> {
        try {
            nuevoParticipante.validate();
            Participante p = ParticipanteDAO.read(nuevoParticipante.getValue().toString(), usuario.getId());
            if (!EventoDAO.esParticipante(e, p)) {
                EventoDAO.addParticipante(e.getId(), p.getId());
                Notification n = new Notification("Participante aadido",
                        Notification.Type.ASSISTIVE_NOTIFICATION);
                n.setPosition(Position.TOP_CENTER);
                n.show(Page.getCurrent());
                setSecondComponent(null);
                mostrarEvento(e);
            } else {
                Notification n = new Notification("El participante ya se encuentra en el evento",
                        Notification.Type.WARNING_MESSAGE);
                n.setPosition(Position.TOP_CENTER);
                n.show(Page.getCurrent());
            }

        } catch (Validator.InvalidValueException ex) {
            Notification n = new Notification("Error con los campos", Notification.Type.WARNING_MESSAGE);
            n.setPosition(Position.TOP_CENTER);
            n.show(Page.getCurrent());
        }
    });
    FormLayout form = new FormLayout(l, nuevoParticipante, add);
    form.setMargin(true);
    setSecondComponent(form);
}

From source file:tad.grupo7.ccamistadeslargas.EventosLayout.java

/**
 * Muestra el formulario para aadir un gasto al evento.
 *
 * @param e Evento al que aadir el gasto.
 *//*from  w  w w .j a  va2 s  .c o  m*/
private void mostrarFormularioAddGasto(Evento e) {
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Aadir Gasto");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO
    TextField titulo = new TextField("Ttulo");
    titulo.setRequired(true);
    TextField precio = new TextField("Precio");
    precio.setRequired(true);
    List<Participante> participantes = ParticipanteDAO.readAllFromEvento(e.getId());
    ComboBox pagador = new ComboBox("Pagador");
    List<Participante> deudores = new ArrayList<>();
    Label d = new Label("Deudores");
    FormLayout form = new FormLayout(l, titulo, precio, pagador, d);
    for (Participante p : participantes) {
        pagador.addItem(p.getNombre());
        CheckBox c = new CheckBox(p.getNombre());
        c.addValueChangeListener(evento -> {
            deudores.add(p);
        });
        form.addComponent(c);
    }
    final Button add = new Button("Aadir Gasto");
    add.addStyleName(ValoTheme.BUTTON_PRIMARY);
    add.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    //SI SE CLICA EN AADIR PAGO SE CREA EL PAGO A LA VEZ QUE SE CIERRA LA VENTANA
    add.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                titulo.validate();
                precio.validate();
                pagador.validate();
                GastoDAO.create(titulo.getValue(), Double.valueOf(precio.getValue()), e.getId(),
                        ParticipanteDAO.read(pagador.getValue().toString(), usuario.getId()).getId(), deudores);
                mostrarEvento(e);
            } catch (Validator.InvalidValueException ex) {
                Notification n = new Notification("Rellena todos los campos",
                        Notification.Type.WARNING_MESSAGE);
                n.setPosition(Position.TOP_CENTER);
                n.show(Page.getCurrent());
            }
        }
    });
    //AADIMOS LOS COMPONENTES
    form.addComponent(add);
    setSecondComponent(form);
}

From source file:tad.grupo7.ccamistadeslargas.ListadoLayout.java

/**
 * Muestra una tabla con todos los usuarios.
 *///from w  w  w . j  ava 2  s  .c o  m
private void mostrarListado() {
    removeAllComponents();
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Selecciona un usuario para eliminarlo");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //TABLA DE USUARIOS
    Table table = getTablaListado();
    //AADIMOS COMPONENTES
    addComponents(l, table);
    setMargin(true);

}

From source file:tad.grupo7.ccamistadeslargas.PerfilLayout.java

private void mostrarPerfil() {
    //T?TULO//from  ww  w.j a  v a  2 s.  c  o  m
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Perfil");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO
    TextField nombre = new TextField("Nombre");
    nombre.setValue(usuario.getNombre());
    nombre.setRequired(true);
    TextField password = new TextField("Password");
    password.setValue(usuario.getPassword());
    password.setRequired(true);
    TextField email = new TextField("Email");
    email.setValue(usuario.getEmail());
    email.setEnabled(false);
    Button actualizar = new Button("Actualizar");
    //BOTN ACTUALIZAR
    actualizar.addClickListener(clickEvent -> {
        UsuarioDAO.update(usuario.getId(), nombre.getValue(), password.getValue(), usuario.getEmail());
        Notification n = new Notification("Usuario actualizado", Notification.Type.ASSISTIVE_NOTIFICATION);
        n.setPosition(Position.TOP_CENTER);
        n.show(Page.getCurrent());
        usuario.setNombre(nombre.getValue());
        usuario.setPassword(password.getValue());
    });
    //AADIR COMPONENTES
    FormLayout form = new FormLayout(l, nombre, password, email, actualizar);
    form.setMargin(true);
    addComponents(form);
}

From source file:tad.grupo7.ccamistadeslargas.RegistrarView.java

public RegistrarView() {
    setMargin(true);//from  w  w  w. ja  v a2s. c  o  m
    setSpacing(true);
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Registro");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO
    TextField nombre = new TextField("Nombre");
    nombre.setRequired(true);
    PasswordField password = new PasswordField("Contrasea");
    password.setRequired(true);
    TextField email = new TextField("Email");
    email.setRequired(true);
    final Button registrar = new Button("Sign Up");
    registrar.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    registrar.addStyleName(ValoTheme.BUTTON_PRIMARY);
    FormLayout form = new FormLayout(nombre, password, email, registrar);
    //BOTN PARA REGISTRARSE
    registrar.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            try {
                nombre.validate();
                password.validate();
                email.validate();
                UsuarioDAO.create(nombre.getValue(), password.getValue(), email.getValue());
                Usuario u = UsuarioDAO.read(email.getValue(), password.getValue());
                Session.setAttribute("usuario", u);
                UI.getCurrent().getNavigator().navigateTo("index");
            } catch (Validator.InvalidValueException ex) {

            }
        }

    });
    //AADIR COMPONENTES
    addComponents(l, form);
    setComponentAlignment(form, Alignment.MIDDLE_CENTER);
}

From source file:uk.co.intec.keyDatesApp.components.DateSelector.java

License:Apache License

/**
 * Constructor, passing the Vaadin Calendar component this selector is tied
 * to/*from w  ww  . j  av  a 2  s.  c  o m*/
 *
 * @param cal
 */
public DateSelector(Calendar cal) {
    try {
        setLocale(Locale.getDefault());
        setCalLayout(cal);
        calendar = new GregorianCalendar(getLocale());
        calendar.setTime(getCalLayout().getStartDate());
        currentMonthsFirstDate = calendar.getTime();

        addCalendarEventListeners();
        initNavigationButtons();
        updateCaptionLabel();

        final HorizontalLayout hl = new HorizontalLayout();
        hl.setWidth("100%");
        hl.setSpacing(true);
        hl.setMargin(new MarginInfo(false, false, true, false));
        hl.addComponent(prevButton);
        hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);

        final HorizontalLayout monthButtonPanel = new HorizontalLayout();
        monthButtonPanel.addComponent(monthButton);
        hl.addComponent(monthButtonPanel);
        hl.setComponentAlignment(monthButtonPanel, Alignment.MIDDLE_CENTER);

        captionLabel.addStyleName(ValoTheme.LABEL_COLORED);
        captionLabel.setWidth(null);
        hl.addComponent(captionLabel);
        hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);

        final HorizontalLayout weekButtonPanel = new HorizontalLayout();
        weekButtonPanel.addComponent(weekButton);
        hl.addComponent(weekButtonPanel);
        hl.setComponentAlignment(weekButtonPanel, Alignment.MIDDLE_CENTER);

        hl.addComponent(nextButton);
        hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

        monthButton.setVisible(viewMode == Mode.WEEK);
        weekButton.setVisible(viewMode == Mode.DAY);
        addComponent(hl);
    } catch (final Throwable t) {
        KeyDateDatabaseUtils.handleException(t);
    }
}