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:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createBuildDateLayout() {
    HorizontalLayout buildDateLayout = new HorizontalLayout();
    Label labelBuildDate = new Label("Build date: " + getBuildDate());
    buildDateLayout.addComponent(labelBuildDate);
    labelBuildDate.setSizeUndefined();// www  .j  a  v a 2s. c o  m
    buildDateLayout.setSizeUndefined();
    return buildDateLayout;
}

From source file:br.com.anteros.mobileserver.app.form.ActionForm.java

License:Apache License

public ActionForm(MobileServerApplication app, ActionSynchronism actionSynchronism, Synchronism objectOwner) {
    this.app = app;
    this.actionSynchronism = actionSynchronism;
    this.objectOwner = objectOwner;
    this.setMargin(true);
    createForm();//from   w  w  w  .  j a va2s .  c  om
    createFields();
    createButtons();

    Label lblTitle = new Label("Ao");
    lblTitle.setStyleName("h2 color");
    addComponent(lblTitle);
    addComponent(actionForm);

    fldName.focus();

    loadData();
}

From source file:br.com.anteros.mobileserver.app.form.ApplicationForm.java

License:Apache License

public ApplicationForm(MobileServerApplication app, ApplicationSynchronism applicationSynchronism) {
    this.app = app;
    this.applicationSynchronism = applicationSynchronism;
    this.setMargin(true);
    createForm();//w  ww. ja v  a2 s.c  o  m
    createFields();
    createButtons();

    Label lblTitle = new Label("Aplicao");
    lblTitle.setStyleName("h2 color");
    addComponent(lblTitle);
    addComponent(applicationForm);
    fldName.focus();
    loadData();
}

From source file:br.com.anteros.mobileserver.app.form.ExecuteForm.java

License:Apache License

private void createForm() {
    if (actionSynchronism.getItems() != null) {

        Label lblTitle = new Label("Parmetros de execuo Ao " + actionSynchronism.getName() + " ("
                + actionSynchronism.getId() + ")");
        lblTitle.setStyleName("h2 color");
        lblTitle.setImmediate(false);/*from  www.j ava2s.c om*/
        addComponent(lblTitle);
        setComponentAlignment(lblTitle, Alignment.TOP_LEFT);

        Synchronism synchronism = actionSynchronism.getItems().iterator().next();
        executeForm = new Form();
        fields.clear();
        ParameterSynchronism[] parameters = null;
        if (synchronism instanceof TableSynchronism)
            parameters = ((TableSynchronism) synchronism).getParameters();
        if (synchronism instanceof ProcedureSynchronism)
            parameters = ((ProcedureSynchronism) synchronism).getParameters();
        for (ParameterSynchronism param : parameters) {
            if (param.getParameterType().intValue() == ParameterSynchronism.INPUT
                    || param.getParameterType().intValue() == ParameterSynchronism.SUBSTITUITION) {
                String value = FieldTypes.getFieldTypes().get(param.getParameterDataType().intValue() + "");
                if (value != null) {
                    if (FieldTypes.UNKNOW.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("400px");
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.INTEGER.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.VARCHAR.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("400px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.FLOAT.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.NUMERIC.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.DATE.equalsIgnoreCase(value)) {
                        PopupDateField field = new PopupDateField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        field.setResolution(PopupDateField.RESOLUTION_DAY);
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.TIME.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.TIMESTAMP.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    }
                }
            }
        }

        panelForm = new Panel();
        panelForm.setHeight("100%");
        panelForm.setWidth("100%");
        panelForm.setScrollable(true);
        addComponent(panelForm);
        executeForm.setImmediate(true);
        executeForm.setWidth("100%");
        panelForm.addComponent(executeForm);

        executeCommit = new CheckBox("Executar COMMIT no final do processo?");
        addComponent(executeCommit);

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.setImmediate(false);
        buttons.setWidth("600px");
        buttons.setHeight("-1px");
        buttons.setMargin(false);
        buttons.setSpacing(true);
        addComponent(buttons);

        btnExecute = new Button();
        btnExecute.setCaption("Executar");
        btnExecute.setIcon(new ThemeResource("icons/16/run.png"));
        btnExecute.addListener(clickListener);
        buttons.addComponent(btnExecute);
        buttons.setComponentAlignment(btnExecute, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(btnExecute, 1);

        btnClose = new Button();
        btnClose.setCaption("Fechar");
        btnClose.setIcon(new ThemeResource("icons/16/doorOut.png"));
        btnClose.addListener(clickListener);
        buttons.addComponent(btnClose);

        buttons.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(true, false, true, false);
        addComponent(buttons);

        pageControl = new TabSheet();
        pageControl.setImmediate(true);
        pageControl.setWidth("100.0%");
        pageControl.setHeight("100.0%");

        textPanel = new Panel();
        textPanel.setImmediate(true);
        textPanel.setWidth("100%");
        textPanel.setHeight("100%");
        pageControl.addTab(textPanel, "Resultado", null);
        addComponent(pageControl);
        setExpandRatio(pageControl, 1.0f);
    }
}

From source file:br.com.anteros.mobileserver.app.form.FieldForm.java

License:Apache License

public FieldForm(MobileServerApplication app, FieldSynchronism fieldSynchronism, Window win,
        Synchronism objectOwner, boolean isFields) {

    this.app = app;
    this.fieldSynchronism = fieldSynchronism;
    this.objectOwner = objectOwner;
    this.win = win;
    this.isFields = isFields;
    this.setMargin(true);
    createForm();//from  w w  w  .  jav a  2 s  .co  m
    createFields();
    createButtons();

    Label lblTitle = new Label("Campo");
    lblTitle.setStyleName("h2 color");
    addComponent(lblTitle);
    addComponent(fieldForm);
    fldName.focus();

    loadData();
}

From source file:br.com.anteros.mobileserver.app.form.ParameterForm.java

License:Apache License

public ParameterForm(MobileServerApplication app, ParameterSynchronism parameterSynchronism, Window win,
        Synchronism objectOwner, boolean isParameters) {
    this.setMargin(true);
    this.app = app;
    this.parameterSynchronism = parameterSynchronism;
    this.win = win;
    this.isParameters = isParameters;
    this.objectOwner = objectOwner;

    createForm();/*  www.j  a  va  2 s. c o m*/
    createFields();
    createButtons();

    Label lblTitle = new Label("Parmetro");
    lblTitle.setStyleName("h2 color");
    addComponent(lblTitle);
    addComponent(parameterForm);
    fldName.focus();

    loadData();
}

From source file:br.com.anteros.mobileserver.app.form.ProcedureForm.java

License:Apache License

public ProcedureForm(MobileServerApplication app, ProcedureSynchronism procedureSynchronism,
        Synchronism objectOwner) {/*from ww  w . j  ava2  s.  c  om*/
    this.setMargin(true);
    this.procedureSynchronism = procedureSynchronism;
    this.app = app;
    this.objectOwner = objectOwner;

    createForm();
    createFields();
    createButtons();
    createGrid();
    createPageControl();

    Label lblTitle = new Label("Procedimento");
    lblTitle.setStyleName("h2 color");

    addComponent(lblTitle);
    addComponent(procedureForm);
    addComponent(pageControl);
    addComponent(buttons);
    fldName.focus();
    enableActions();
    loadData();
}

From source file:br.com.anteros.mobileserver.app.form.TableForm.java

License:Apache License

public TableForm(MobileServerApplication app, TableSynchronism tableSynchronism, Synchronism objectOwner) {
    this.setMargin(true);
    this.app = app;
    this.tableSynchronism = tableSynchronism;
    this.objectOwner = objectOwner;
    this.itensDeleted = new ArrayList<Synchronism>();

    createForm();//w  ww  . j  a  v a2 s.c  o  m
    createFields();
    createGrids();
    createButtons();

    createPageControl();

    Label lblTitle = new Label("Tabela");
    lblTitle.setStyleName("h2 color");
    addComponent(lblTitle);
    addComponent(tableForm);
    addComponent(pageControl);
    addComponent(buttons);
    fldName.focus();

    loadData();
    enableActions();
}

From source file:br.com.anteros.mobileserver.util.UserMessages.java

License:Apache License

public Window confirm(String title, String message, String okTitle, String cancelTitle,
        Button.ClickListener listener) {

    if (title == null) {
        title = CONFIRM_OK_TITLE;//from   w w  w.  ja  v a  2s .  c om
    }
    if (cancelTitle == null) {
        cancelTitle = CONFIRM_CANCEL_TITLE;
    }
    if (okTitle == null) {
        okTitle = CONFIRM_OK_TITLE;
    }

    final Window confirm = new Window(title);
    this.confirm = confirm;
    win.addWindow(confirm);

    confirm.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1971800928047045825L;

        public void windowClose(CloseEvent ce) {
            Object data = ce.getWindow().getData();
            if (data != null) {
                try {
                } catch (Exception exception) {
                    error("Unhandled Exception", exception);
                }
            }
        }
    });

    int chrW = 5;
    int chrH = 15;
    int txtWidth = Math.max(250, Math.min(350, message.length() * chrW));
    int btnHeight = 25;
    int vmargin = 100;
    int hmargin = 40;

    int txtHeight = 2 * chrH * (message.length() * chrW) / txtWidth;

    confirm.setWidth((txtWidth + hmargin) + "px");
    confirm.setHeight((vmargin + txtHeight + btnHeight) + "px");
    confirm.getContent().setSizeFull();

    confirm.center();
    confirm.setModal(true);

    Label text = new Label(message);
    text.setWidth("100%");
    text.setHeight("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setHeight(btnHeight + 5 + "px");
    buttons.setWidth("100%");
    buttons.setSpacing(true);
    buttons.setMargin(false);

    Button cancel = new Button(cancelTitle, listener);
    cancel.setIcon(new ThemeResource("icons/16/no.png"));
    cancel.setData(USER_CONFIRM_CANCEL);
    cancel.setClickShortcut(KeyCode.ESCAPE);
    Button ok = new Button(okTitle, listener);
    ok.setIcon(new ThemeResource("icons/16/yes.png"));
    ok.setData(USER_CONFIRM_OK);
    ok.setClickShortcut(KeyCode.ENTER);
    buttons.addComponent(ok);
    buttons.setExpandRatio(ok, 1);
    buttons.setComponentAlignment(ok, Alignment.MIDDLE_RIGHT);

    buttons.addComponent(cancel);
    buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT);

    confirm.addComponent(text);
    confirm.addComponent(buttons);
    ((VerticalLayout) confirm.getContent()).setExpandRatio(text, 1f);
    confirm.setResizable(false);
    return confirm;
}

From source file:by.bigvova.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 w ww . j av  a 2s.  c om*/

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    Label label = new Label("Name: User / Password: password");
    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(label);
    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();
}