Example usage for com.vaadin.ui Label setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:de.gedoplan.webclients.vaadin.views.CustomerDetailView.java

public void init() {
    Double discount = customerService.calculateCustomerDiscount(customer.getCustomerID()).getDiscount();
    Label name = new Label(new PropertyFormatter(form.getProperty(Customer_.companyName)) {
        @Override/*w ww  .ja  v  a2s  .  co m*/
        public String format(Object value) {
            return value + " (" + customer.getCustomerID() + ")";
        }

        @Override
        public Object parse(String formattedValue) throws Exception {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    name.setStyleName(ValoTheme.LABEL_BOLD);
    Label rabattLabel = new Label(Messages.customer_discount.value());
    rabattLabel.setStyleName(ValoTheme.LABEL_BOLD);
    rabattLabel.setSizeUndefined();
    Label rabatt = new Label(new DecimalFormat("#0.00").format(discount) + "%");
    rabatt.setSizeUndefined();
    rabatt.addStyleName(ValoTheme.LABEL_COLORED);
    rabatt.addStyleName(ValoTheme.LABEL_BOLD);
    HorizontalLayout headline = new HorizontalLayout(name, rabattLabel, rabatt);
    headline.setComponentAlignment(rabatt, Alignment.TOP_RIGHT);
    headline.setExpandRatio(name, 1);
    headline.setWidth(100, Unit.PERCENTAGE);
    headline.setSpacing(true);
    headline.setStyleName(ValoTheme.LAYOUT_WELL);
    headline.setMargin(new MMarginInfo(false, true));
    Panel panel = new Panel();
    panel.setContent(form);
    setMargin(true);
    setSpacing(true);
    addComponents(headline, panel);
}

From source file:de.gedoplan.webclients.vaadin.views.CustomerDetailView.java

public void initNoCustomer() {
    Label error = new Label("Benutzer nicht gefunden !");
    error.setSizeUndefined();//from  w w  w  .  j av  a  2 s .  c om
    error.setStyleName(ValoTheme.LABEL_FAILURE);
    setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    addComponent(error);
}

From source file:de.gedoplan.webclients.vaadin.views.ErrorView.java

@Override
public void myenter(ViewChangeListener.ViewChangeEvent event) {
    Label error = new Label("Seite konnte nicht gefunden werden !");
    error.setSizeUndefined();/*  w  w w .java2s  .  c o m*/
    error.setStyleName(ValoTheme.LABEL_FAILURE);
    setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    addComponent(error);
    setSizeFull();
}

From source file:de.gedoplan.webclients.vaadin.views.IndexView.java

@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    if (getComponentCount() > 0) {
        return;// w w  w  . j  a v a2s  . c  o  m
    }
    setSizeFull();
    setMargin(true);
    setDefaultComponentAlignment(Alignment.TOP_CENTER);
    Label text = new Label("Demo Anwendung Vaadin");
    text.setWidthUndefined();
    text.setStyleName(ValoTheme.LABEL_H1);
    addComponent(text);
}

From source file:de.openflorian.web.viewport.AlarmViewBrowser.java

License:Open Source License

/**
 * Helper: Print given {@link Operation}
 *///ww  w  .j  a  v a  2 s  .c  om
private void printAlarm(final Operation o) {

    // operationMap.setVisible(true);

    final Operation currentOperation = AlarmContextVerticle.getInstance().getCurrentOperation();

    if (currentOperation.isFireOperation())
        layout.setStyleName(Operation.FIRE_ZCLASS);
    else
        layout.setStyleName(Operation.TECHNICAL_ASSISTANCE_ZCLASS);

    currentTime.setValue(new SimpleDateFormat(WebGlobals.FORMAT_DATETIME).format(new Date()));

    if (currentOperation.getKeyword() != null)
        keyword.setValue(currentOperation.getKeyword());

    if (currentOperation.getBuzzword() != null)
        buzzword.setValue(currentOperation.getBuzzword());

    if (!StringUtils.isEmpty(currentOperation.getPriority()))
        priority.setValue(currentOperation.getPriority());

    if (currentOperation.getOperationNr() != null)
        operationNr.setValue(currentOperation.getOperationNr());

    if (currentOperation.getPositionLatitude() != 0)
        positionLatitude.setValue(String.valueOf(currentOperation.getPositionLatitude()));

    if (currentOperation.getPositionLongitude() != 0)
        positionLongitude.setValue(String.valueOf(currentOperation.getPositionLongitude()));

    if (currentOperation.getPositionLatitude() != 0 && currentOperation.getPositionLongitude() != 0) {

        map.setCenter(currentOperation.getPositionLatitude(), currentOperation.getPositionLongitude());
        final LMarker marker = new LMarker(currentOperation.getPositionLatitude(),
                currentOperation.getPositionLongitude());
        marker.setPopup("Einsatzort");
        marker.openPopup();
        map.addComponent(marker);
        map.setWidth("100%");
        map.setHeight("100%");
        map.setZoomLevel(16);
    } else {
        map.setVisible(false);
    }

    if (!StringUtils.isEmpty(currentOperation.getStreet())) {
        street.setValue(currentOperation.getStreet());
    }

    if (!StringUtils.isEmpty(currentOperation.getCity())) {
        city.setValue(currentOperation.getCity());
    }

    if (currentOperation.getResourcesRaw() != null)
        resourcesRaw.setValue(currentOperation.getResourcesRaw());

    try {
        for (final OperationResource resource : currentOperation.getResources()) {
            if (resource == null)
                continue;

            if (log.isDebugEnabled())
                log.debug("Alarmed resource: " + resource);

            final Label resourceLabel = new Label(resource.getCallName());

            if (resource.isExternal()) {
                externalResourcesBox.addComponent(resourceLabel);
                resourceLabel.setStyleName("external-operation-resource");
            } else {
                resourcesBox.addComponent(resourceLabel);
                resourceLabel.setStyleName("operation-resource");
            }
        }
    } catch (final Exception e) {
        log.error(e.getMessage(), e);
    }

    final SimpleDateFormat format = new SimpleDateFormat(WebGlobals.FORMAT_DATETIME);
    if (currentOperation.getIncurredAt() != null)
        alarmTime.setValue(format.format(currentOperation.getIncurredAt()));

    alarmsound.play();
}

From source file:de.unioninvestment.eai.portal.portlet.crud.CrudUI.java

License:Apache License

/**
 * Erzeugt ein verstecktes HTML-Element mit der PortletPresenter-Window-ID
 * fr die Akzeptanztests./* ww  w  .  j  a v  a 2s. co  m*/
 * 
 * @param container
 */
private void addHiddenPortletId(ComponentContainer container) {
    Label labelForPortletId = new Label(getPortletId());
    labelForPortletId.setStyleName("crudPortletId");
    labelForPortletId.setHeight(0, AbstractComponent.UNITS_PIXELS);

    container.addComponent(labelForPortletId);

    Label labelForCommunityId = new Label(String.valueOf(getCommunityId()));
    labelForCommunityId.setStyleName("crudPortletCommunityId");
    labelForCommunityId.setHeight(0, AbstractComponent.UNITS_PIXELS);

    container.addComponent(labelForCommunityId);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

/**
 * //  www. ja v  a2s . c  om
 * @param statusValues
 * @return
 */
public VerticalLayout createProjectStatusComponentNew(Map<String, Integer> statusValues) {
    VerticalLayout projectStatusContent = new VerticalLayout();
    projectStatusContent.setResponsive(true);
    projectStatusContent.setMargin(true);
    projectStatusContent.setSpacing(true);

    Label planned = new Label();
    Label design = new Label();
    Label raw = new Label();
    Label results = new Label();

    Iterator<Entry<String, Integer>> it = statusValues.entrySet().iterator();

    while (it.hasNext()) {
        Map.Entry<String, Integer> pairs = (Map.Entry<String, Integer>) it.next();

        if ((Integer) pairs.getValue() == 0) {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_FAILURE);
            statusLabel.setResponsive(true);
            // statusLabel.addStyleName("redicon");
            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }

        else {
            Label statusLabel = new Label(pairs.getKey());
            statusLabel.setStyleName(ValoTheme.LABEL_SUCCESS);
            statusLabel.setResponsive(true);

            // statusLabel.addStyleName("greenicon");

            if (pairs.getKey().equals("Project planned")) {
                planned = statusLabel;
            } else if (pairs.getKey().equals("Experimental design registered")) {
                design = statusLabel;
            } else if (pairs.getKey().equals("Raw data registered")) {
                raw = statusLabel;
            } else if (pairs.getKey().equals("Results registered")) {
                results = statusLabel;
            }
        }
    }

    projectStatusContent.addComponent(planned);
    projectStatusContent.addComponent(design);
    projectStatusContent.addComponent(raw);
    projectStatusContent.addComponent(results);

    // ProgressBar progressBar = new ProgressBar();
    // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size());
    // projectStatusContent.addComponent(progressBar);

    return projectStatusContent;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java

License:Open Source License

/**
 * /* w ww . java  2  s.c  o m*/
 * @param list
 * @return
 */
private Component getMembersComponent() {
    membersLayout = new HorizontalLayout();
    // membersLayout.setIcon(FontAwesome.USERS);
    // membersLayout.setCaption("Members");
    membersLayout.setWidth("100%");

    // final Button loadMembers = new Button("[+]");
    // membersLayout.addComponent(loadMembers);
    // loadMembers.setStyleName(ValoTheme.BUTTON_LINK);
    // loadMembers.addClickListener(new ClickListener() {

    // @Override
    // public void buttonClick(ClickEvent event) {
    ProgressBar progress = new ProgressBar();
    progress.setIndeterminate(true);
    Label info = new Label(
            "Searching for members. Can take several seconds on big projects. Please be patient.");
    info.setStyleName(ValoTheme.LABEL_SUCCESS);
    // membersLayout.addComponent(info);
    membersLayout.addComponent(progress);
    MemberWorker worker = new MemberWorker();
    worker.start();
    UI.getCurrent().setPollInterval(500);
    // loadMembers.setEnabled(false);

    return membersLayout;
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java

License:Open Source License

public void loadGraph() {
    // LOGGER.debug(String.valueOf(graphSectionContent.getComponentCount() == 0));
    if (graphSectionContent.getComponentCount() > 0)
        LOGGER.debug(String.valueOf(graphSectionContent.getComponent(0) instanceof Image));
    if (graphSectionContent.getComponentCount() == 0
            || !(graphSectionContent.getComponent(0) instanceof Image)) {
        ProgressBar progress = new ProgressBar();
        progress.setIndeterminate(true);
        Label info = new Label(
                "Computing the project graph can take several seconds on big projects. Please be patient.");
        info.setStyleName(ValoTheme.LABEL_SUCCESS);
        graphSectionContent.removeAllComponents();
        // graphSectionContent.addComponent(info);
        graphSectionContent.addComponent(progress);
        // graphSectionContent.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
        graphSectionContent.setComponentAlignment(progress, Alignment.MIDDLE_CENTER);

        Worker worker = new Worker(getCurrent());
        worker.start();/*from www  .ja v a 2 s. c  o  m*/
        UI.getCurrent().setPollInterval(500);
    }
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientView.java

License:Open Source License

void updateContentGraph() {
    Resource resource = getGraphResourceAndParseNewGraph();

    if (resource != null) {
        graphSectionContent.removeAllComponents();
        Image graphImage = new Image("", resource);

        graphSectionContent.addComponent(graphImage);
        graphSectionContent.setComponentAlignment(graphImage, Alignment.MIDDLE_CENTER);

    } else {/*from   w  w  w. j  a  v  a2  s . co m*/
        Label error = new Label("Project Graph can not be computed at that time for this project");
        error.setStyleName(ValoTheme.LABEL_FAILURE);
        graphSectionContent.removeAllComponents();
        graphSectionContent.addComponent(error);
        graphSectionContent.setComponentAlignment(error, Alignment.MIDDLE_CENTER);

        LOGGER.error(String.format("%s: %s", error.getValue(), currentBean.getId()));
    }
}