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:org.vaadin.addon.twitter.demo.ButtonDemo.java

License:Apache License

private Component makeButtonContainer(TweetButton tweetButton, String caption) {
    return new MVerticalLayout(
            new MLabel(caption).withWidth("-1").withStyleName("centered-caption")
                    .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED),
            tweetButton.withStyleName("tw-widget", "tw-button", "centered-caption")).withSpacing(false)
                    .withMargin(false).alignAll(Alignment.TOP_CENTER).withWidth("-1");
}

From source file:org.vaadin.addon.twitter.demo.TimelineDemo.java

License:Apache License

private VerticalLayout createTimeline(String caption, Timeline timeline) {
    MVerticalLayout verticalLayout = new MVerticalLayout().withSpacing(false).withMargin(false);
    timeline.addStyleName("tw-timeline");
    timeline.addStyleName("tw-widget");
    timeline.setHeight("400px");
    verticalLayout.add(new MLabel(caption).withStyleName("centered-caption")
            .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED), timeline)
            .alignAll(Alignment.TOP_CENTER);
    verticalLayout.setWidthUndefined();//w  ww. jav  a 2 s. com
    return verticalLayout;
}

From source file:org.vaadin.addon.twitter.demo.TweetDemo.java

License:Apache License

private VerticalLayout createTweet(String caption, Consumer<Tweet> customizer) {
    MVerticalLayout verticalLayout = new MVerticalLayout()
            //.withFullWidth()
            .withSpacing(false).withMargin(false);
    Tweet tweet = new Tweet(tweetId);
    tweet.addStyleName("tw-widget");
    tweet.addStyleName("tw-single-tweet");
    customizer.accept(tweet);//from   w  w  w  .j  a  va2 s  .  c  o m
    verticalLayout.add(new MLabel(caption).withStyleName("centered-caption")
            .withStyleName(ValoTheme.LABEL_LARGE).withStyleName(ValoTheme.LABEL_COLORED), tweet

    ).alignAll(Alignment.TOP_CENTER); //.expand(tweet);
    verticalLayout.setWidthUndefined();
    return verticalLayout;
}

From source file:org.vaadin.spring.samples.navigation.ViewScopedComponent.java

License:Apache License

@PostConstruct
void init() {//  ww  w  .j  a va 2s. c  o  m
    LOGGER.info("I'm being created: {}", this);
    setValue(
            "I'm a view scoped component. This is the result from invoking the view scoped business object: <b>"
                    + viewScopedBusinessObject.sayHello() + "</b>. "
                    + "Try invoking the same business object by clicking the button below. You'll see the output is the same, which means the same instance has been injected into both this component and the view.");
    setStyleName(ValoTheme.LABEL_COLORED);
    setContentMode(ContentMode.HTML);
}

From source file:org.vaadin.spring.samples.security.ui.login.views.LoginView.java

License:Apache License

private Component buildLabels() {
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");

    Label welcome = new Label("Welcome");
    welcome.setSizeUndefined();/*w ww. ja v a 2  s  .c om*/
    welcome.addStyleName(ValoTheme.LABEL_H4);
    welcome.addStyleName(ValoTheme.LABEL_COLORED);
    labels.addComponent(welcome);

    Label title = new Label("Security-Sample");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H3);
    title.addStyleName(ValoTheme.LABEL_LIGHT);
    labels.addComponent(title);
    return labels;
}

From source file:qbic.vaadincomponents.MaxQuantComponent.java

License:Open Source License

/**
 * creates the global parameter component
 * /*w  w w  . j  a  v  a  2  s .co  m*/
 * @return
 */
private Component globalParameters() {
    FormLayout globalparameters = new FormLayout();
    globalparameters.setCaption("Global parameters");
    fastaFiles = new SelectFileComponent("", FASTA_FILES_INFO, AVAILABLE_FASTAS_CAPTION,
            SELECTED_FASTAS_CAPTION, model.getFastaBeans(), model.getSelectedFastaBeans());
    globalparameters.addComponent(fastaFiles);
    // fixed modifications
    // fixedModifications = new TwinColSelect("fixed modifications");
    fixedModifications = new TwinColSelect();

    Label fixedInfo = new Label("Fixed Modifications");
    fixedInfo.addStyleName(ValoTheme.LABEL_COLORED);

    globalparameters.addComponent(fixedInfo);
    fixedModifications.addItems("Acetyl (Protein N-term)", "Acetyl (K)", "Oxidation (M)", "Ala->Arg",
            "Carbamidomethyl (C)");
    globalparameters.addComponent(fixedModifications);
    reQuantify = new CheckBox("Requantify");
    globalparameters.addComponent(reQuantify);
    matchBetweenRuns = new CheckBox("Match Between Runs");
    globalparameters.addComponent(matchBetweenRuns);
    return globalparameters;
}

From source file:qbic.vaadincomponents.SelectFileComponent.java

License:Open Source License

public SelectFileComponent(String mainCaption, String info, String sourceCaption, String destinationCaption,
        BeanItemContainer<?> source, BeanItemContainer<?> destination) {
    setCaption(mainCaption);// w w  w  .ja  v a 2 s.c om

    VerticalLayout files = new VerticalLayout();
    files.setSpacing(true);

    // info label
    Label rawFilesInfo = new Label(info);
    rawFilesInfo.addStyleName(ValoTheme.LABEL_COLORED);
    files.addComponent(rawFilesInfo);
    files.setWidth("100%");

    // available files in openbis
    available = new Grid(source);
    available.setCaption(sourceCaption);
    available.setSelectionMode(SelectionMode.MULTI);

    // selected files for anaylsis
    selected = new Grid(destination);

    if (mainCaption.equals("Raw files")) {
        available.removeColumn("fullPath");
        available.removeColumn("openbisCode");
    }

    else if (mainCaption.equals("")) {
        available.removeColumn("name");
        available.removeColumn("path");
        selected.removeColumn("name");
        selected.removeColumn("path");
    }

    selected.setCaption(destinationCaption);
    selected.setSelectionMode(SelectionMode.MULTI);

    for (Grid.Column col : available.getColumns()) {
        col.setWidthUndefined();
    }

    // selectedFiles.set
    // buttons to add or remove files
    VerticalLayout buttons = new VerticalLayout();
    toLeft = new Button();
    toLeft.setIcon(FontAwesome.ARROW_LEFT);

    toRight = new Button();
    toRight.setIcon(FontAwesome.ARROW_RIGHT);
    buttons.addComponent(toRight);
    buttons.addComponent(toLeft);

    GridLayout grids = new GridLayout(3, 1);
    grids.setWidth("100%");

    // grids.setSpacing(true);
    grids.addComponent(available, 0, 0);

    available.setWidth("100%");
    grids.addComponent(buttons, 1, 0);
    grids.addComponent(selected, 2, 0);
    grids.setColumnExpandRatio(0, 0.45f);
    grids.setColumnExpandRatio(1, 0.029f);
    grids.setColumnExpandRatio(2, 0.45f);
    grids.setSpacing(false);
    grids.setComponentAlignment(buttons, com.vaadin.ui.Alignment.MIDDLE_CENTER);

    selected.setWidth("100%");

    files.addComponent(grids);

    this.setCompositionRoot(files);
    files.setMargin(new MarginInfo(true, true, true, false));
    this.setWidth("100%");

}

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

/**
 * Se muestra el evento en el vertical layout derecho del splitpanel.
 *
 * @param e Recoge el evento que se quiere mostrar.
 *///w w w  . ja v a2s  . c om
private void mostrarEvento(Evento e) {
    removeAllComponents();
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Evento " + e.getNombre());
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO POR SI SE QUIERE EDITAR EL EVENTO
    TextField nombre = new TextField("Nombre");
    nombre.setValue(e.getNombre());
    nombre.setRequired(true);
    ComboBox divisa = new ComboBox("Divisa");
    divisa.setNullSelectionAllowed(false);
    divisa.setRequired(true);
    divisa.addItem("");
    divisa.addItem("$");

    HorizontalLayout layouth = new HorizontalLayout();
    HorizontalLayout layouth2 = new HorizontalLayout();
    layouth.setSpacing(true);
    layouth2.setSpacing(true);

    final Button actualizar = new Button("Actualizar Evento");
    final Button eliminar = new Button("Eliminar Evento");
    final Button addPago = new Button("Aadir Pago");
    final Button addParticipante = new Button("Aadir Participante");
    layouth.addComponents(actualizar, eliminar);
    layouth2.addComponents(addPago, addParticipante);
    final Button hacerCuentas = new Button("Hacer las cuentas");
    //BOTN PARA ACTUALIZAR EL EVENTO
    actualizar.addClickListener(clickEvent -> {
        try {
            nombre.validate();
            divisa.validate();
            if (EventoDAO.readDBObject(nombre.getValue(), usuario.getId()) == null) {
                EventoDAO.update(e.getId(), nombre.getValue(), divisa.getValue().toString());
                Notification n = new Notification("Evento actualizado",
                        Notification.Type.ASSISTIVE_NOTIFICATION);
                n.setPosition(Position.TOP_CENTER);
                n.show(Page.getCurrent());
                mostrarEventos();
            } else {
                Notification n = new Notification("Ya existe un evento con ese nombre",
                        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());
        }

    });
    //BOTN PARA QUE SALGA UNA VENTANA EMERGENTE PARA AADIR UN GASTO AL EVENTO
    addPago.addClickListener(clickEvent -> {
        mostrarFormularioAddGasto(e);
    });
    //BOTN PARA ELIMINAR EL EVENTO
    eliminar.addClickListener(clickEvent -> {
        EventoDAO.delete(e.getId());
        removeAllComponents();
        mostrarEventos();
    });
    //BOTN PARA AADIR PARTICIPANTES
    addParticipante.addClickListener(clickEvent -> {
        mostrarFormularioAddParticipante(e);
    });
    //BOTN PARA HACER LAS CUENTAS
    hacerCuentas.addClickListener(clickEvent -> {
        removeAllComponents();
        VerticalLayout vl = new VerticalLayout();
        Table tablaResumenPlusvalia = getTablaResumenPlusvalia(e);
        HorizontalLayout hl1 = new HorizontalLayout(tablaResumenPlusvalia);
        hl1.setMargin(true);
        hl1.setSpacing(true);
        vl.addComponent(hl1);
        for (Participante p : ParticipanteDAO.readAllFromEvento(e.getId())) {
            HorizontalLayout hl = new HorizontalLayout(getTablaResumenGastosPorPersona(e, p));
            hl.setMargin(true);
            hl.setSpacing(true);
            vl.addComponent(hl);
        }
        setSplitPosition(100, Sizeable.UNITS_PERCENTAGE);
        setFirstComponent(vl);
    });
    //TABLA CON TODOS LOS GASTOS DEL EVENTO
    Table tablaGastos = getTablaGastos(e);
    //TABLA CON TODOS LOS PARTICIPANTES DEL EVENTO
    Table tablaParticipantes = getTablaParticipantes(e);
    //AADIMOS LOS COMPONENTES
    FormLayout form = new FormLayout(nombre, divisa, layouth, layouth2, hacerCuentas);
    VerticalLayout vl = new VerticalLayout(l, form, tablaGastos, tablaParticipantes);
    vl.setMargin(true);
    setFirstComponent(vl);
}

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

/**
 * Se muestra un gasto para poder actualizarlo o eliminarlo.
 *
 * @param e Recoge el evento al que pertenece el gasto.
 *//*from  w ww. ja va 2 s .c o  m*/
private void mostrarGasto(Gasto g, Evento e) {
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Gasto " + g.getNombre());
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO POR SI SE QUIERE EDITAR EL GASTO
    TextField nombre = new TextField("Titulo");
    nombre.setValue(g.getNombre());
    nombre.setRequired(true);
    TextField precio = new TextField("Precio");
    precio.setValue(g.getPrecio().toString());
    precio.setRequired(true);
    final Button actualizar = new Button("Actualizar Gasto");
    final Button eliminar = new Button("Eliminar Gasto");
    //BOTN PARA ACTUALIZAR EL GASTO
    actualizar.addClickListener(clickEvent -> {
        try {
            nombre.validate();
            precio.validate();
            GastoDAO.update(g.getId(), nombre.getValue(), Double.valueOf(precio.getValue()), g.getIdEvento(),
                    g.getIdPagador(), g.getDeudores());
            Notification n = new Notification("Gasto actualizado", Notification.Type.ASSISTIVE_NOTIFICATION);
            n.setPosition(Position.TOP_CENTER);
            n.show(Page.getCurrent());
            setSecondComponent(null);
            mostrarEvento(e);
        } 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());
        }
    });
    //BOTN PARA ELIMINAR EL GASTO
    eliminar.addClickListener(clickEvent -> {
        GastoDAO.delete(g.getId());
        removeAllComponents();
        mostrarEvento(e);
    });
    //AADIMOS LOS COMPONENTES
    FormLayout form = new FormLayout(nombre, precio, actualizar, eliminar);
    VerticalLayout vl = new VerticalLayout(l, form);
    vl.setMargin(true);
    setSecondComponent(vl);
}

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

/**
 * Se muestra el formulario de aadir un nuevo evento.
 *///  ww  w.  j ava 2s.c  o  m
private void mostrarFormularioAddEvento() {
    //T?TULO
    CssLayout labels = new CssLayout();
    labels.addStyleName("labels");
    Label l = new Label("Aadir Evento");
    l.setSizeUndefined();
    l.addStyleName(ValoTheme.LABEL_H2);
    l.addStyleName(ValoTheme.LABEL_COLORED);
    //FORMULARIO
    TextField nombre = new TextField("Nombre");
    nombre.setRequired(true);
    ComboBox divisa = new ComboBox("Divisa");
    divisa.setRequired(true);
    divisa.addItem("");
    divisa.addItem("$");
    final Button add = new Button("Crear evento");
    add.addStyleName(ValoTheme.BUTTON_PRIMARY);
    add.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    FormLayout form = new FormLayout(nombre, divisa, add);
    //BOTN PARA AADIR EVENTO
    add.addClickListener(clickEvent -> {
        try {
            nombre.validate();
            divisa.validate();
            if (EventoDAO.readDBObject(nombre.getValue(), usuario.getId()) == null) {
                EventoDAO.create(nombre.getValue(), divisa.getValue().toString(), usuario);
                mostrarEventos();
            } else {
                Notification n = new Notification("Ya existe un evento con ese nombre",
                        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());
        }
    });
    //AADIMOS COMPONENTES
    form.setMargin(true);
    setSecondComponent(form);
}