Example usage for com.vaadin.ui Label addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.skysql.manager.ui.ErrorDialog.java

License:Open Source License

/**
 * Instantiates a new error dialog./* w ww  .ja  v a 2  s.c om*/
 *
 * @param e the exception
 * @param humanizedError the humanized error
 */
public ErrorDialog(Exception e, String humanizedError) {

    if (e != null) {
        ManagerUI.error(e.getMessage());
    }

    dialogWindow = new ModalWindow("An Error has occurred", "775px");
    dialogWindow.setHeight("340px");
    dialogWindow.addCloseListener(this);
    UI current = UI.getCurrent();
    if (current.getContent() == null) {
        current.setContent(new ErrorView(Notification.Type.ERROR_MESSAGE, null));
    }
    current.addWindow(dialogWindow);

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setSizeFull();
    wrapper.setMargin(true);

    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.setWidth("100px");
    wrapper.addComponent(iconLayout);
    Embedded image = new Embedded(null, new ThemeResource("img/error.png"));
    iconLayout.addComponent(image);

    VerticalLayout textLayout = new VerticalLayout();
    textLayout.setHeight("100%");
    textLayout.setSpacing(true);
    wrapper.addComponent(textLayout);
    wrapper.setExpandRatio(textLayout, 1.0f);

    if (humanizedError != null || e != null) {
        String error = (humanizedError != null) ? humanizedError : e.toString();
        ManagerUI.error(error);
        Label label = new Label(error, ContentMode.HTML);
        label.addStyleName("warning");
        textLayout.addComponent(label);
        textLayout.setComponentAlignment(label, Alignment.TOP_CENTER);
    }

    if (e != null) {
        TextArea stackTrace = new TextArea("Error Log");
        stackTrace.setSizeFull();
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        stackTrace.setValue(sw.toString());
        textLayout.addComponent(stackTrace);
        textLayout.setComponentAlignment(stackTrace, Alignment.TOP_LEFT);
        textLayout.setExpandRatio(stackTrace, 1.0f);
    }

    HorizontalLayout buttonsBar = new HorizontalLayout();
    buttonsBar.setStyleName("buttonsBar");
    buttonsBar.setSizeFull();
    buttonsBar.setSpacing(true);
    buttonsBar.setMargin(true);
    buttonsBar.setHeight("49px");

    Label filler = new Label();
    buttonsBar.addComponent(filler);
    buttonsBar.setExpandRatio(filler, 1.0f);

    Button cancelButton = new Button("Close");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

    cancelButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
            //UI.getCurrent().close();
        }
    });

    Button okButton = new Button("Send Error");
    okButton.setEnabled(false);
    okButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(ClickEvent event) {
            dialogWindow.close();
        }
    });
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) dialogWindow.getContent();
    windowLayout.setHeight("100%");
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.setExpandRatio(wrapper, 1.0f);
    windowLayout.addComponent(buttonsBar);

}

From source file:com.skysql.manager.ui.ErrorView.java

License:Open Source License

/**
 * Instantiates a new error view./*from w  ww.  ja  va  2 s .c  o  m*/
 *
 * @param type the notification type
 * @param errorMsg the error msg
 */
public ErrorView(Type type, String errorMsg) {

    addStyleName("loginView");
    setSizeFull();
    setMargin(true);
    setSpacing(true);

    if (errorMsg != null) {
        Notification.show(errorMsg, type);
    }

    Embedded logo = new Embedded(null, new ThemeResource("img/productlogo.png"));
    addComponent(logo);
    setComponentAlignment(logo, Alignment.TOP_CENTER);

    if (type == Notification.Type.ERROR_MESSAGE) {
        Label refreshLabel = new Label("To try again, please refresh/reload the current page.");
        refreshLabel.setSizeUndefined();
        refreshLabel.addStyleName("instructions");
        addComponent(refreshLabel);
        setComponentAlignment(refreshLabel, Alignment.TOP_CENTER);
    }
}

From source file:com.skysql.manager.ui.LoginView.java

License:Open Source License

/**
 * Instantiates a new login view./*from www  .  j a  v a 2 s  .  c  o  m*/
 *
 * @param aboutRecord the about record
 */
public LoginView() {

    setSizeFull();
    setMargin(true);
    setSpacing(true);
    addStyleName("loginView");

    VerticalLayout logoLayout = new VerticalLayout();
    addComponent(logoLayout);
    setComponentAlignment(logoLayout, Alignment.BOTTOM_CENTER);
    setExpandRatio(logoLayout, 1.0f);

    Embedded logo = new Embedded(null, new ThemeResource("img/loginlogo.png"));
    logoLayout.addComponent(logo);
    logoLayout.setComponentAlignment(logo, Alignment.BOTTOM_CENTER);

    Label releaseInfo = new Label("Version " + ManagerUI.GUI_RELEASE);
    releaseInfo.setSizeUndefined();
    releaseInfo.addStyleName("releaseInfo");
    logoLayout.addComponent(releaseInfo);
    logoLayout.setComponentAlignment(releaseInfo, Alignment.TOP_CENTER);

    VerticalLayout spacer = new VerticalLayout();
    spacer.setHeight("20px");
    logoLayout.addComponent(spacer);

    VerticalLayout loginBox = new VerticalLayout();
    loginBox.addStyleName("loginBox");
    loginBox.setSizeUndefined();
    loginBox.setMargin(true);
    loginBox.setSpacing(true);
    addComponent(loginBox);
    setComponentAlignment(loginBox, Alignment.MIDDLE_CENTER);

    VerticalLayout loginFormLayout = new VerticalLayout();
    loginFormLayout.addStyleName("loginForm");
    loginFormLayout.setMargin(true);
    loginFormLayout.setSpacing(true);
    loginBox.addComponent(loginFormLayout);

    // userName.focus();
    userName.setStyleName("loginControl");
    userName.setInputPrompt("Username");
    userName.setImmediate(true);
    userName.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            password.focus();
            login.setClickShortcut(KeyCode.ENTER);
        }
    });
    loginFormLayout.addComponent(userName);
    loginFormLayout.setComponentAlignment(userName, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(""));

    password.setStyleName("loginControl");
    password.setInputPrompt("Password");
    password.setImmediate(true);
    password.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            login.focus();
        }
    });
    loginFormLayout.addComponent(password);
    loginFormLayout.setComponentAlignment(password, Alignment.MIDDLE_CENTER);

    // spacer
    loginFormLayout.addComponent(new Label(" "));

    login.setStyleName("loginControl");
    login.setEnabled(false);

    loginFormLayout.addComponent(login);
    loginFormLayout.setComponentAlignment(login, Alignment.BOTTOM_CENTER);

    VerticalLayout filler = new VerticalLayout();
    addComponent(filler);
    setExpandRatio(filler, 1.0f);

    preload();

}

From source file:com.skysql.manager.ui.PanelControl.java

License:Open Source License

/**
 * Creates the logs layout.//w ww . j  a  va 2  s .c o  m
 */
private void createLogsLayout() {
    Label separator = new Label();
    separator.addStyleName("separator");
    //separator.setHeight(Sizeable.SIZE_UNDEFINED, Unit.PIXELS);
    addComponent(separator);

    logsLayout = new HorizontalLayout();
    logsLayout.addStyleName("logsLayout");
    logsLayout.setSpacing(true);
    logsLayout.setMargin(true);
    addComponent(logsLayout);
    setExpandRatio(logsLayout, 1.0f);

    logsTable = new Table("Previously run Commands");
    logsTable.setPageLength(10);
    logsTable.addContainerProperty("Command", String.class, null);
    logsTable.addContainerProperty("State", String.class, null);
    logsTable.addContainerProperty("Info", Embedded.class, null);
    logsTable.addContainerProperty("Started", String.class, null);
    logsTable.addContainerProperty("Completed", String.class, null);
    logsTable.addContainerProperty("Steps", String.class, null);
    logsTable.addContainerProperty("Parameters", String.class, null);
    logsTable.addContainerProperty("User", String.class, null);

    logsLayout.addComponent(logsTable);
    logsLayout.setComponentAlignment(logsTable, Alignment.MIDDLE_CENTER);

}

From source file:com.skysql.manager.ui.PanelTools.java

License:Open Source License

/**
 * Instantiates a new panel tools.//from  w  w  w.  j av a2 s  .  co m
 */
PanelTools() {

    // thisTab.setSizeFull();
    // thisTab.setWidth(Sizeable.SIZE_UNDEFINED, 0); // Default
    setHeight("200px");
    setSpacing(true);

    // External Tools Vertical Module
    SystemInfo systemInfo = getSession().getAttribute(SystemInfo.class);
    LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties();
    if (properties != null) {
        VerticalLayout externalsLayout = new VerticalLayout();
        externalsLayout.setWidth("150px");
        externalsLayout.addStyleName("externalsLayout");
        externalsLayout.setSpacing(true);

        String EIP = properties.get(SystemInfo.PROPERTY_EIP);
        String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG);
        if (EIP != null && MONyog != null) {
            String url = "http://" + EIP + MONyog;
            monyogLink = new Link("MONyog", new ExternalResource(url));
            monyogLink.setTargetName("_blank");
            monyogLink.setDescription("Open MONyog for the whole system");
            monyogLink.setIcon(new ThemeResource("img/externalLink.png"));
            monyogLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(monyogLink);
            externalsLayout.setComponentAlignment(monyogLink, Alignment.BOTTOM_CENTER);
        }

        phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN);
        if (phpUrl != null) {
            phpLink = new Link("phpMyAdmin", null);
            phpLink.setTargetName("_blank");
            phpLink.setDescription("Open phpMyAdmin for the selected node");
            phpLink.setIcon(new ThemeResource("img/externalLink.png"));
            phpLink.addStyleName("icon-after-caption");
            externalsLayout.addComponent(phpLink);
            externalsLayout.setComponentAlignment(phpLink, Alignment.BOTTOM_CENTER);
        }

        addComponent(externalsLayout);
        setComponentAlignment(externalsLayout, Alignment.MIDDLE_CENTER);

    }

    {
        Label spacer = new Label();
        spacer.setWidth("40px");
        addComponent(spacer);
    }

    // Scripting layout placeholder
    VerticalLayout placeholderLayout = new VerticalLayout();
    placeholderLayout.addStyleName("placeholderLayout");
    placeholderLayout.setSizeUndefined();

    Label placeholderLabel = new Label("Links to external tools");
    placeholderLabel.addStyleName("instructions");
    placeholderLayout.addComponent(placeholderLabel);

    addComponent(placeholderLayout);
    setComponentAlignment(placeholderLayout, Alignment.MIDDLE_CENTER);

}

From source file:com.skysql.manager.ui.WarningWindow.java

License:Open Source License

/**
 * Instantiates a new warning window.//from   w w  w .j  a  v a2 s  . c  o  m
 *
 * @param caption the caption
 * @param message the message
 * @param label the label
 * @param okListener the ok listener
 */
public WarningWindow(String caption, String message, String label, Button.ClickListener okListener) {
    super(caption, "60%");

    HorizontalLayout wrapper = new HorizontalLayout();
    wrapper.setWidth("100%");
    wrapper.setMargin(true);
    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.setWidth("100px");
    wrapper.addComponent(iconLayout);
    Embedded image = new Embedded(null, new ThemeResource("img/warning.png"));
    iconLayout.addComponent(image);
    VerticalLayout textLayout = new VerticalLayout();
    textLayout.setSizeFull();
    wrapper.addComponent(textLayout);
    wrapper.setExpandRatio(textLayout, 1.0f);

    Label msgLabel = new Label(message);
    msgLabel.addStyleName("warning");
    textLayout.addComponent(msgLabel);
    textLayout.setComponentAlignment(msgLabel, Alignment.MIDDLE_CENTER);

    HorizontalLayout buttonsBar = new HorizontalLayout();
    buttonsBar.setStyleName("buttonsBar");
    buttonsBar.setSizeFull();
    buttonsBar.setSpacing(true);
    buttonsBar.setMargin(true);
    buttonsBar.setHeight("49px");

    Label filler = new Label();
    buttonsBar.addComponent(filler);
    buttonsBar.setExpandRatio(filler, 1.0f);

    Button cancelButton = new Button("Cancel");
    buttonsBar.addComponent(cancelButton);
    buttonsBar.setComponentAlignment(cancelButton, Alignment.MIDDLE_RIGHT);

    cancelButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void buttonClick(Button.ClickEvent event) {
            warningWindow.close();
        }
    });

    Button okButton = new Button(label);
    okButton.addClickListener(okListener);
    buttonsBar.addComponent(okButton);
    buttonsBar.setComponentAlignment(okButton, Alignment.MIDDLE_RIGHT);

    VerticalLayout windowLayout = (VerticalLayout) this.getContent();
    windowLayout.setSpacing(false);
    windowLayout.setMargin(false);
    windowLayout.addComponent(wrapper);
    windowLayout.addComponent(buttonsBar);

}

From source file:com.squadd.chat.ChatController.java

public static Panel createDatePanel(ChatMessage mess) {
    Panel datePanel = new Panel();
    //FormLayout form = new FormLayout();
    //form.setMargin(false);
    Label dateLabel = new Label(mess.getFormattedDate());
    dateLabel.addStyleName("dateLabel");
    dateLabel.setValue("YrMOOOm");
    //form.addComponent(dateLabel);
    //datePanel.setContent(form);
    datePanel.setContent(dateLabel);//  ww w  . ja  va2s .c  om
    datePanel.setWidth("100px");
    datePanel.setHeight("50px");
    return datePanel;
}

From source file:com.squadd.chat.ChatController.java

public static HorizontalLayout createDateLayout(ChatMessage mess) {
    HorizontalLayout dateLayout = new HorizontalLayout();
    Label dateLabel = new Label(mess.getFormattedDate());
    dateLabel.addStyleName("dateLabel");
    dateLayout.addComponent(dateLabel);//from  ww w  .j  a  va2 s.c o m
    dateLayout.setWidth("100px");
    dateLayout.setHeight("50px");
    return dateLayout;
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildAppointmentHeader() {
    //        Label section = new Label("Objetivo");
    //        section.addStyleName(ValoTheme.LABEL_H4);
    //        section.addStyleName(ValoTheme.LABEL_COLORED);
    //        rootLayout.addComponent(section);

    appointmentType = new OptionGroup("Tipo");
    appointmentType.setContainerDataSource(containerTypes);
    appointmentType.addStyleName("horizontal");
    appointmentType.setWidth("100%");
    //<editor-fold defaultstate="collapsed" desc="Enable customer and addresses combobox according to the selected appointment type">
    appointmentType.addValueChangeListener(new ValueChangeListener() {

        @Override/*from  ww  w .ja va2s.c  o  m*/
        public void valueChange(Property.ValueChangeEvent event) {

            try {
                AppointmentType appType = (AppointmentType) event.getProperty().getValue();

                if (appType.getCode().equals("VIS")) {
                    //customer.setEnabled(true);
                    //address.setEnabled(true);
                    //contactNotes.setEnabled(false);

                    //contactNotes.setValue("");
                }
                if (appType.getCode().equals("COM")) {
                    //customer.setEnabled(true);
                    //address.setEnabled(false);
                    //contactNotes.setEnabled(false);

                    //address.setValue(null);
                    //contactNotes.setValue("");
                }
                if (appType.getCode().equals("CON")) {
                    //customer.setEnabled(false);
                    //address.setEnabled(false);
                    //contactNotes.setEnabled(true);

                    //customer.setValue(null);
                    //address.setValue(null);
                }
            } catch (Exception e) {
            }

        }

    });
    //</editor-fold>
    rootLayout.addComponent(appointmentType);

    reason = new ComboBox("Motivo");
    reason.setContainerDataSource(containerReasons);
    reason.setTextInputAllowed(false);
    reason.setWidth("100%");
    rootLayout.addComponent(reason);

    Label customerSection = new Label("Cliente");
    customerSection.addStyleName(ValoTheme.LABEL_H4);
    customerSection.addStyleName(ValoTheme.LABEL_COLORED);
    rootLayout.addComponent(customerSection);
    buildCustomer();
    buildAddress();
    buildContactInfo();

    contactNotes = new TextField("Otro");
    contactNotes.setWidth("100%");
    contactNotes.setInputPrompt("Introduzca contacto o direccin...");
    rootLayout.addComponent(contactNotes);

    Label scheduleSection = new Label("Programacin");
    scheduleSection.addStyleName(ValoTheme.LABEL_H4);
    scheduleSection.addStyleName(ValoTheme.LABEL_COLORED);
    rootLayout.addComponent(scheduleSection);

    startTime = new PopupDateField("Fecha");
    startTime.setTextFieldEnabled(false);
    startTime.setLocale(new Locale("es", "ES"));
    startTime.setResolution(Resolution.MINUTE);
    startTime.setDateFormat("dd/MM/yyyy HH:mm");
    startTime.setConverter(new DateToCalendarConverter());
    //startTime.setWidth(15, Unit.EM);
    rootLayout.addComponent(startTime);

    //        aqui los comerciales
    trades = new OptionGroup("Comerciales");
    trades.setContainerDataSource(containerTrades);
    trades.setConverter(new SetToListConverter());
    trades.setNullSelectionAllowed(false);
    trades.setMultiSelect(true);
    trades.setImmediate(true);
    rootLayout.addComponent(trades);

    //        // Los propositos de la visita
    //        purpose = new OptionGroup("Propsito");
    //        purpose.setContainerDataSource(containerPurpose);
    //        purpose.setConverter(new SetToListConverter());
    //        purpose.setNullSelectionAllowed(false);
    //        purpose.setMultiSelect(true);
    //        purpose.setImmediate(true);
    //        rootLayout.addComponent(purpose);

    //        HorizontalLayout wrapper = new HorizontalLayout();
    //        wrapper.setCaption("Fecha");
    //        wrapper.addComponent(startTime);
    //        wrapper.addComponent(timeLapse);
    //        //wrapper.setComponentAlignment(timeLapse, Alignment.TOP_LEFT);
    //        wrapper.setWidth("100%");
    //        wrapper.setExpandRatio(startTime, 1);
    //        wrapper.setExpandRatio(timeLapse, 1);
    //        rootLayout.addComponent(wrapper);
    //        contactInfo = new ComboBox();
    //        contactInfo.setTextInputAllowed(false);
    //        contactInfo.setInputPrompt("Seleccione un contacto...");
    //        contactInfo.setWidth("100%");
    //        rootLayout.addComponent(contactInfo);

    //        reasonNotes = new TextArea("Notas previas");
    //        reasonNotes.setWidth("100%");
    //        reasonNotes.setInputPrompt("Anotaciones del motivo...");
    //        rootLayout.addComponent(reasonNotes);

}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentView.java

private void buildAppointmentContent() {
    Label section = new Label("Resultado");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    rootLayout.addComponent(section);/*  ww w . ja v  a 2 s .  c om*/

    //Duracin de la cita
    timeLapse = new ComboBox("Duracin");
    timeLapse.setContainerDataSource(containerTimeLapses);
    timeLapse.setTextInputAllowed(false);
    timeLapse.setInputPrompt("Duracin...");
    rootLayout.addComponent(timeLapse);

    //Kilometraje
    distance = new TextField("Kms");
    distance.setNullRepresentation("");
    rootLayout.addComponent(distance);

    //Notas
    notes = new TextArea("Resumen");
    //notes.setSizeFull();
    notes.setInputPrompt("Introduzca notas...");
    rootLayout.addComponent(notes);

    // Los resultados de la visita
    purposes = new OptionGroup("Resultados");
    purposes.setContainerDataSource(containerPurposes);
    purposes.setConverter(new SetToListConverter());
    purposes.setNullSelectionAllowed(true);
    purposes.setMultiSelect(true);
    purposes.setImmediate(true);
    rootLayout.addComponent(purposes);

    //Quejas registradas
    buildAppointmentComplaints();
}