Example usage for com.vaadin.ui Label Label

List of usage examples for com.vaadin.ui Label Label

Introduction

In this page you can find the example usage for com.vaadin.ui Label Label.

Prototype

public Label(String text) 

Source Link

Document

Creates a new instance with text content mode and the given text.

Usage

From source file:com.coatl.pruebas.cloudstorage.CloudStorageUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    this.layout = new VerticalLayout();
    layout.addComponent(new Label("Pruebas de DataStore"));

    setContent(layout);/*  w ww.  j  av a 2s . c  o m*/
    //this.listarCubeta();
}

From source file:com.coatl.pruebas.datastore.DataStoreUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    this.principal = new VerticalLayout();
    {/*from   ww  w  . j  av  a2s  .  c  om*/
        principal.addComponent(new Label("Pruebas de DataStore"));
        HorizontalLayout superior = new HorizontalLayout();
        principal.addComponent(superior);

        this.forma = new FormLayout();
        superior.addComponent(forma);
        {
            this.tabla = new TextField("Tabla");
            tabla.setValue("iq3_usuarios");
            forma.addComponents(tabla);

            this.nombre = new TextField("Nombre");
            forma.addComponents(nombre);
            this.ap1 = new TextField("Apellido Paterno");
            forma.addComponents(ap1);
            this.ap2 = new TextField("Apellido Materno");
            forma.addComponents(ap2);
            this.renglones = new Label("Renglones");
            forma.addComponents(renglones);

        }

        FormLayout botones = new FormLayout();
        /*
        botones.addComponent(new Label(" "));
        botones.addComponent(new Label("Acciones:"));
         */
        superior.addComponent(botones);

        Button recargar = new Button("Recargar");
        botones.addComponent(recargar);
        recargar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                listarObjetos();
            }
        });

        Button guardar = new Button("Guardar");
        botones.addComponent(guardar);
        guardar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                Map m = new HashMap();
                m.put("nombre", nombre.getValue());
                m.put("ap1", ap1.getValue());
                m.put("ap2", ap2.getValue());
                m.put("id", nombre.getValue());

                IU7.ds.guardar(tabla.getValue(), m);
                System.out.println("Objeto guardado");
                listarObjetos();
            }
        });

        Button borrar = new Button("Borrar");
        botones.addComponent(borrar);
        borrar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                borrar();
            }
        });

        Button mil = new Button("Hacer 1,000");
        botones.addComponent(mil);
        mil.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                for (int i = 0; i < 1000; i++) {
                    Map m = new HashMap();
                    String id = "ID_" + i + "_" + Math.random();
                    m.put("id", id);
                    m.put("nombre", "Nombre_" + id + "_" + Math.random());
                    m.put("ap1", "Ap1_" + id + "_" + Math.random());
                    m.put("ap2", "Ap2_" + id + "_" + Math.random());
                    IU7.ds.guardar(tabla.getValue(), m);
                    System.out.println(" >" + id);
                }
            }
        });

    }

    VerticalSplitPanel vsl = new VerticalSplitPanel();
    setContent(vsl);
    vsl.setFirstComponent(principal);

    grid.setSizeFull();
    grid.setComponenteSuperior(new Label("primer panel"));
    //grid.setComponenteMedio(new Label("segundo panel"));
    //grid.setComponenteInferior(new Label("tercer panel"));
    grid.setNombreTabla(tabla.getValue());
    grid.setColumnas("id,nombre,ap1,ap2");
    grid.setColumnasVisibles("nombre,ap1,ap2");

    vsl.setSecondComponent(grid);
    //grid.setComponenteMedio(grid);
    this.listarObjetos();
}

From source file:com.coatl.pruebas.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Escribe algo aqu:");

    Button button = new Button("Dime que escrib");

    button.addClickListener(new Button.ClickListener() {
        @Override//ww  w  . j  a  v  a  2s .com
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("Click!");
            layout.addComponent(new Label("Usted escribi> " + name.getValue()));
        }
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:com.coatl.vaadin.abc.ixABCDialogos.java

ixDefinicionDeForma getForma(String forma, String tipo) {
    Stack<AbstractComponent> pila = new Stack();
    Map<String, AbstractComponent> componentes = new HashMap();
    AbstractComponent ultimo = null;// w  ww  .j a va  2  s.c  o  m

    String[] cmds = forma.split(" ");

    for (String cmd : cmds) {
        cmd = cmd.trim();
        if (!cmd.equals("")) {
            //System.out.println("CMD> [" + cmd + "]");
            if (cmd.equals("bConfBorrar")) {
                agregar(pila, getbConfBorrar());

            } else if (cmd.equals("bBorrar")) {
                agregar(pila, getbBorrar());

            } else if (cmd.equals("bGuardar")) {
                agregar(pila, getbGuardar());

            } else if (cmd.equals("bCrear")) {
                agregar(pila, getbCrear());
            } else if (cmd.startsWith("H")) {
                HorizontalLayout hl = new HorizontalLayout();
                if (cmd.contains("m")) {
                    hl.setMargin(true);
                }
                agregar(pila, hl);
            } else if (cmd.startsWith("V")) {
                VerticalLayout vl = new VerticalLayout();
                if (cmd.contains("m")) {
                    vl.setMargin(true);
                }
                agregar(pila, vl);
            } else if (cmd.startsWith("F")) {
                FormLayout fl = new FormLayout();
                if (cmd.contains("m")) {
                    fl.setMargin(true);
                }
                agregar(pila, fl);
            } else if (cmd.equals(".")) {
                ultimo = pila.pop();
                //System.out.println("Sacando de pila a " + ultimo);
            } else if (cmd.startsWith("'")) {
                String txt = cmd.substring(1);
                while (txt.contains("~")) {
                    txt = txt.replace("~", " ");
                }
                Label l = new Label(txt);

                agregar(pila, l);
            } else {
                //System.out.println("Buscando columna [" + cmd + "]");
                ixDefinicionDeColumna columna = columnas.get(cmd);
                String claseControl = columna.getClaseControl();
                if (claseControl == null) {
                    claseControl = "com.vaadin.ui.TextField";
                }

                AbstractComponent con = null;

                try {
                    con = (AbstractComponent) this.getClass().getClassLoader().loadClass(claseControl)
                            .newInstance();
                } catch (Exception ex) {
                    System.out.println("ERROR INSTANCIANDO> [" + claseControl + "], " + ex);
                }
                con.setCaption(this.getTituloColumna(cmd));
                if (con != null) {
                    agregar(pila, con);
                    componentes.put(cmd, con);
                }

                if (tipo != null) {
                    if (tipo.toLowerCase().equals("c")) {
                        if (columna.isSoloLecturaCrear() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("e") || tipo.toLowerCase().equals("g")) {
                        if (columna.isSoloLecturaGuardar() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("b")) {

                        con.setReadOnly(true);
                    }
                }

            }
        }
    }

    while (pila.size() > 0) {
        ultimo = pila.pop();
    }

    ixDefinicionDeForma res = new ixDefinicionDeForma();
    res.setComponente(ultimo);
    res.setComponentes(componentes);

    return res;
}

From source file:com.concur.ui.WebApp.java

License:Apache License

private void submit() {
    String action = (String) actionField.getValue();
    String token = (String) tokenField.getValue();
    String tupleKey = (String) tupleKeyField.getValue();
    String tupleData = (String) tupleDataArea.getValue();

    if (!"Authenticate".equals(action) && "".equals(token.trim())) // if not logging in & not logged in
    {//  w  ww . jav  a2s  . co m
        w.showNotification("Authentication Required");
        return;
    }

    String xml = WsXml.cmd(action, token, tupleKey, tupleData);
    String responseXml = Http.post(Config.getWsUrl(), xml);
    XmlMap xmlMap = XmlHandler.parse(responseXml).get("response");

    final XmlMap status = xmlMap.get("status");
    if (!"0".equals(status.getText("statuscode"))) {
        w.showNotification("Web Service call failed -- " + status.getText("statusmsg"));
        return;
    }

    if ("Authenticate".equals(action)) {
        tokenField.setValue(xmlMap.getText("token"));
    } else if ("GetTuple".equals(action)) {
        tupleDataArea.setValue(xmlMap.getText("tupledata"));
    } else if ("PutTuple".equals(action)) {
        w.showNotification("OK");
    } else if ("GetConfigurations".equals(action)) {
        List<XmlMap> tuples = xmlMap.get("config").getAll("tuple");

        Window subWin = new Window("Configurations");
        subWin.setHeight("400px");
        subWin.setWidth("400px");
        subWin.center();
        subWin.setModal(true);

        for (XmlMap tuple : tuples) {
            String text = tuple.getText("key") + " ==> " + tuple.getText("data");
            subWin.addComponent(new Label(text));
        }

        w.addWindow(subWin);
    }
}

From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java

private Component buildMessage() {
    String messageText = presenter.getMessage();
    if (StringUtils.isEmpty(messageText)) {
        return null;
    }/*from www.j a va2  s .c  o  m*/
    Label message = new Label(messageText);
    message.addStyleName("footer-warning");
    message.addStyleName(ValoTheme.LABEL_LARGE);
    message.addStyleName(ValoTheme.LABEL_BOLD);
    return message;
}

From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java

protected Component buildLicense() {
    boolean showFooter = !"true".equals(System.getProperty("no_footer_message"));
    Label licenseLabel = new Label($("MainLayout.footerLicense"));
    licenseLabel.addStyleName(ValoTheme.LABEL_TINY);
    licenseLabel.setContentMode(ContentMode.HTML);
    licenseLabel.setVisible(showFooter);
    return licenseLabel;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildInfoItem(String caption, Object value) {
    Label captionLabel = new Label(caption);
    captionLabel.addStyleName(ValoTheme.LABEL_BOLD);

    Label valueLabel = value instanceof LocalDate ? new LocalDateLabel((LocalDate) value)
            : new Label(value.toString());

    HorizontalLayout layout = new HorizontalLayout(captionLabel, valueLabel);
    layout.setSpacing(true);/* www  .  ja v a  2 s. c o  m*/

    return layout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildAvailableUpdateLayout() {
    Label message = new Label($("UpdateManagerViewImpl.updateAvailable", presenter.getUpdateVersion()));
    message.addStyleName(ValoTheme.LABEL_BOLD);

    Button update = new LinkButton($("UpdateManagerViewImpl.updateButton")) {
        @Override//from w  w  w .j av a 2 s .c  o m
        protected void buttonClick(ClickEvent event) {
            UI.getCurrent().access(new Thread(UpdateManagerViewImpl.class.getName() + "-updateFromServer") {
                @Override
                public void run() {
                    presenter.updateFromServer();
                }
            });
        }
    };
    update.setVisible(presenter.isUpdateEnabled());

    HorizontalLayout updater = new HorizontalLayout(message, update);
    updater.setComponentAlignment(message, Alignment.MIDDLE_LEFT);
    updater.setComponentAlignment(update, Alignment.MIDDLE_LEFT);
    updater.setSpacing(true);

    Label changelog = new Label(presenter.getChangelog(), ContentMode.HTML);

    VerticalLayout layout = new VerticalLayout(updater, changelog);
    layout.setSpacing(true);
    layout.setWidth("100%");

    return layout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildUpToDateUpdateLayout() {
    Label message = new Label($("UpdateManagerViewImpl.upToDate"));
    message.addStyleName(ValoTheme.LABEL_BOLD);
    return message;
}