Example usage for com.vaadin.ui Label setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.rollout.rollout.AutoStartOptionGroupLayout.java

License:Open Source License

private void createOptionGroup() {
    autoStartOptionGroup = new FlexibleOptionGroup();
    autoStartOptionGroup.addItem(AutoStartOption.MANUAL);
    autoStartOptionGroup.addItem(AutoStartOption.AUTO_START);
    autoStartOptionGroup.addItem(AutoStartOption.SCHEDULED);
    selectDefaultOption();/*from  ww w  . ja v  a2  s  .  c o m*/

    final FlexibleOptionGroupItemComponent manualItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.MANUAL);
    manualItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // set Id for Forced radio button.
    manualItem.setId(UIComponentIdProvider.ROLLOUT_START_MANUAL_ID);
    addComponent(manualItem);
    final Label manualLabel = new Label();
    manualLabel.setStyleName("statusIconPending");
    manualLabel.setIcon(FontAwesome.HAND_PAPER_O);
    manualLabel.setCaption(i18n.getMessage("caption.rollout.start.manual"));
    manualLabel.setDescription(i18n.getMessage("caption.rollout.start.manual.desc"));
    manualLabel.setStyleName("padding-right-style");
    addComponent(manualLabel);

    final FlexibleOptionGroupItemComponent autoStartItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.AUTO_START);
    autoStartItem.setId(UIComponentIdProvider.ROLLOUT_START_AUTO_ID);
    autoStartItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(autoStartItem);
    final Label autoStartLabel = new Label();
    autoStartLabel.setSizeFull();
    autoStartLabel.setIcon(FontAwesome.PLAY);
    autoStartLabel.setCaption(i18n.getMessage("caption.rollout.start.auto"));
    autoStartLabel.setDescription(i18n.getMessage("caption.rollout.start.auto.desc"));
    autoStartLabel.setStyleName("padding-right-style");
    addComponent(autoStartLabel);

    final FlexibleOptionGroupItemComponent scheduledItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.SCHEDULED);
    scheduledItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // setted Id for Time Forced radio button.
    scheduledItem.setId(UIComponentIdProvider.ROLLOUT_START_SCHEDULED_ID);
    addComponent(scheduledItem);
    final Label scheduledLabel = new Label();
    scheduledLabel.setStyleName("statusIconPending");
    scheduledLabel.setIcon(FontAwesome.CLOCK_O);
    scheduledLabel.setCaption(i18n.getMessage("caption.rollout.start.scheduled"));
    scheduledLabel.setDescription(i18n.getMessage("caption.rollout.start.scheduled.desc"));
    scheduledLabel.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(scheduledLabel);

    startAtDateField = new DateField();
    startAtDateField.setInvalidAllowed(false);
    startAtDateField.setInvalidCommitted(false);
    startAtDateField.setEnabled(false);
    startAtDateField.setStyleName("dist-window-forcedtime");

    final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
    startAtDateField.setValue(Date
            .from(LocalDateTime.now().plusMinutes(30).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
    startAtDateField.setImmediate(true);
    startAtDateField.setTimeZone(tz);
    startAtDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
    startAtDateField.setResolution(Resolution.MINUTE);
    startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
    addComponent(startAtDateField);
}

From source file:org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil.java

License:Open Source License

/**
 * Get formatted label.Appends ellipses if content does not fit the label.
 *
 * @param labelContent//from   w  w  w. j  a  v a2  s .c  om
 *            content
 * @return Label
 */
public static Label getFormatedLabel(final String labelContent) {
    final Label labelValue = new Label(labelContent, ContentMode.HTML);
    labelValue.setSizeFull();
    labelValue.addStyleName(SPUIDefinitions.TEXT_STYLE);
    labelValue.addStyleName("label-style");
    return labelValue;
}

From source file:org.jdal.vaadin.ui.form.SimpleBoxFormBuilder.java

License:Apache License

public void addGlue() {
    Label label = new Label();
    label.setSizeFull();
    add(label, SIZE_FULL);
    setHeight(SIZE_FULL);
}

From source file:org.opennms.features.vaadin.dashboard.dashlets.AlarmDetailsDashlet.java

License:Open Source License

/**
 * Adds the alarms components to a {@link AbstractOrderedLayout}
 *
 * @param component the component to add alarms to
 * @param alarms    the alarms list/*  w ww . j a va 2  s  . c  o  m*/
 */
private void addComponents(AbstractOrderedLayout component, List<OnmsAlarm> alarms) {
    if (alarms.size() == 0) {
        Label label = new Label("No alarms found!");
        label.addStyleName("alert-details-noalarms-font");
        component.addComponent(label);
    } else {
        StringBuilder sb = new StringBuilder();

        sb.append("<table class='alert-details-dashlet onms-table'>");
        sb.append("<thead>");
        sb.append(
                "<th class='alert-details-dashlet onms-header-cell'>ID</th><th class='alert-details-dashlet onms-header-cell'>Severity</th><th class='alert-details-dashlet onms-header-cell'>Node</th><th class='alert-details-dashlet onms-header-cell'>Count</th><th class='alert-details-dashlet onms-header-cell'>Last Event Time</th><th class='alert-details-dashlet onms-header-cell'>Log Msg</th>");
        sb.append("</thead>");

        for (OnmsAlarm onmsAlarm : alarms) {
            OnmsNode onmsNode = null;

            if (onmsAlarm.getNodeId() != null) {
                CriteriaBuilder nodeCb = new CriteriaBuilder(OnmsNode.class);
                nodeCb.eq("id", onmsAlarm.getNodeId());

                List<OnmsNode> nodes = m_nodeDao.findMatching(nodeCb.toCriteria());

                if (nodes.size() == 1) {
                    onmsNode = nodes.get(0);
                }
            }

            sb.append("<tr class='alert-details-dashlet " + onmsAlarm.getSeverity().getLabel() + "'>");
            sb.append(
                    "<td class='alert-details-dashlet onms-cell divider bright onms' valign='middle' rowspan='1'><nobr>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
                            + onmsAlarm.getId() + "</nobr></td>");
            sb.append(
                    "<td class='alert-details-dashlet onms-cell divider onms' valign='middle' rowspan='1'><nobr>"
                            + onmsAlarm.getSeverity().getLabel() + "</nobr></td>");
            sb.append(
                    "<td class='alert-details-dashlet onms-cell divider onms' valign='middle' rowspan='1'><nobr>"
                            + (onmsNode != null ? onmsNode.getLabel() : "-") + "</nobr></td>");
            sb.append(
                    "<td class='alert-details-dashlet onms-cell divider onms' valign='middle' rowspan='1'><nobr>"
                            + onmsAlarm.getCounter() + "</nobr></td>");
            sb.append(
                    "<td class='alert-details-dashlet onms-cell divider onms' valign='middle' rowspan='1'><nobr>"
                            + onmsAlarm.getLastEventTime().toString() + "</nobr></td>");
            sb.append("<td class='alert-details-dashlet onms-cell divider onms' valign='middle' rowspan='1'>"
                    + onmsAlarm.getLogMsg().replaceAll("\\<.*?>", "") + "</td>");
            sb.append("</td></tr>");
        }
        sb.append("</table>");
        Label label = new Label(sb.toString());
        label.setSizeFull();
        label.setContentMode(ContentMode.HTML);
        component.addComponent(label);
    }
}

From source file:org.opennms.features.vaadin.dashboard.dashlets.AlarmDetailsDashlet.java

License:Open Source License

/**
 * Returns the component for visualising the alarms data.
 *
 * @param onmsAlarm an {@link OnmsAlarm} instance
 * @param onmsNode  an {@link OnmsNode} instance
 * @return component for this alarm/*  ww w.j  av a2 s.  c o m*/
 */
@Deprecated
public Component createAlarmComponent(OnmsAlarm onmsAlarm, OnmsNode onmsNode) {
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    horizontalLayout.addStyleName("alert-details");
    horizontalLayout.addStyleName("alert-details-font");
    horizontalLayout.addStyleName(onmsAlarm.getSeverity().name().toLowerCase());

    VerticalLayout verticalLayout1 = new VerticalLayout();
    VerticalLayout verticalLayout2 = new VerticalLayout();

    horizontalLayout.addComponent(verticalLayout1);
    horizontalLayout.addComponent(verticalLayout2);

    Label lastEvent = new Label();
    lastEvent.setSizeUndefined();
    lastEvent.addStyleName("alert-details-font");
    lastEvent.setCaption("Last event");
    lastEvent.setValue(onmsAlarm.getLastEventTime().toString());

    Label firstEvent = new Label();
    firstEvent.setSizeUndefined();
    firstEvent.addStyleName("alert-details-font");
    firstEvent.setCaption("First event");
    firstEvent.setValue(onmsAlarm.getFirstEventTime().toString());

    verticalLayout1.addComponent(firstEvent);
    verticalLayout1.addComponent(lastEvent);

    Label nodeId = new Label();
    nodeId.setSizeUndefined();
    nodeId.addStyleName("alert-details-font");
    nodeId.setCaption("Node Id");

    if (onmsNode != null) {
        nodeId.setValue(onmsNode.getNodeId());
    } else {
        nodeId.setValue("-");
    }

    Label nodeLabel = new Label();
    nodeLabel.setSizeUndefined();
    nodeLabel.addStyleName("alert-details-font");
    nodeLabel.setCaption("Node Label");

    if (onmsNode != null) {
        nodeLabel.setValue(onmsNode.getLabel());
    } else {
        nodeLabel.setValue("-");
    }

    Label logMessage = new Label();
    logMessage.addStyleName("alert-details-font");
    logMessage.setSizeFull();
    logMessage.setCaption("Log message");
    logMessage.setValue(onmsAlarm.getLogMsg().replaceAll("<[^>]*>", ""));

    HorizontalLayout horizontalLayout2 = new HorizontalLayout();
    horizontalLayout2.setSizeFull();
    horizontalLayout2.setSpacing(true);
    horizontalLayout2.addComponent(nodeId);
    horizontalLayout2.addComponent(nodeLabel);

    verticalLayout2.addComponent(horizontalLayout2);
    verticalLayout2.addComponent(logMessage);

    horizontalLayout.setExpandRatio(verticalLayout1, 1.0f);
    horizontalLayout.setExpandRatio(verticalLayout2, 4.0f);

    return horizontalLayout;
}

From source file:org.opennms.features.vaadin.dashboard.dashlets.BSMDashlet.java

License:Open Source License

private HorizontalLayout createRow(BusinessService service) {
    HorizontalLayout rowLayout = new HorizontalLayout();
    rowLayout.setSizeFull();//from ww w.jav a2 s  .c o  m
    rowLayout.setSpacing(true);

    final Status severity = m_businessServiceManager.getOperationalStatus(service);
    Label nameLabel = new Label(service.getName());
    nameLabel.setSizeFull();
    nameLabel.setStyleName("h3");
    nameLabel.addStyleName("bright");
    nameLabel.addStyleName("severity");
    nameLabel.addStyleName(severity.getLabel());

    rowLayout.addComponent(nameLabel);
    return rowLayout;
}

From source file:org.opennms.features.vaadin.surveillanceviews.ui.SurveillanceViewTable.java

License:Open Source License

/**
 * Constructor for instatiating this component.
 *
 * @param view                    the view to be displayed
 * @param surveillanceViewService the surveillance view service
 * @param dashboard               should the dashboard be displayed?
 * @param enabled                 should links be enabled?
 *//*from   w  ww .j a v  a2  s  .  c om*/
public SurveillanceViewTable(final View view, SurveillanceViewService surveillanceViewService,
        boolean dashboard, boolean enabled) {
    /**
     * call the super constructor
     */
    super(null);
    /**
     * set the fields
     */
    this.m_surveillanceViewService = surveillanceViewService;
    this.m_enabled = enabled;
    this.m_dashboard = dashboard;
    this.m_view = view;
    /**
     * initialize this component with the view
     */
    refresh();

    /**
     * fill the categories map
     */
    List<OnmsCategory> onmsCategories = m_surveillanceViewService.getOnmsCategories();

    for (OnmsCategory onmsCategory : onmsCategories) {
        m_onmsCategoryMap.put(onmsCategory.getName(), onmsCategory);
    }

    /**
     * initialize the table features
     */
    setSizeUndefined();
    setWidth(100, Unit.PERCENTAGE);

    setSelectable(true);
    setMultiSelect(true);
    setImmediate(true);
    setSelectable(false);

    /**
     * set the base style name
     */
    addStyleName("surveillance-view");

    /**
     * add row header column
     */
    addGeneratedColumn("", new ColumnGenerator() {
        @Override
        public Object generateCell(Table table, final Object itemId, Object columnId) {
            Label label = new Label((String) itemId);
            label.setSizeFull();
            label.addStyleName("white");
            return label;
        }
    });

    /**
     * set header title for the row header column
     */
    setColumnHeader("", view.getName());
    setColumnExpandRatio("", 1.0f);

    /**
     * create the other columns
     */
    for (ColumnDef columnDef : view.getColumns()) {
        m_allColumnCategories.addAll(getOnmsCategoriesForNames(columnDef.getCategoryNames()));

        addGeneratedColumn(columnDef.getLabel(), new Table.ColumnGenerator() {
            public Object generateCell(Table source, final Object itemId, Object columnId) {

                int rowIndex = view.getRows().indexOf(view.getRowDef((String) itemId));
                int colIndex = view.getColumns().indexOf(view.getColumnDef((String) columnId));

                SurveillanceStatus surveillanceStatus = m_cells[rowIndex][colIndex];

                Label label = new Label(surveillanceStatus.getDownEntityCount() + " of "
                        + surveillanceStatus.getTotalEntityCount());

                label.setSizeFull();
                label.addStyleName(surveillanceStatus.getStatus().toLowerCase());
                return label;
            }
        });

        setColumnExpandRatio(columnDef.getLabel(), 1.0f);
    }

    /**
     * gather all row categories
     */
    for (RowDef rowDef : view.getRows()) {
        m_allRowCategories.addAll(getOnmsCategoriesForNames(rowDef.getCategoryNames()));

        addItem(rowDef.getLabel());
        setItemCaption(rowDef.getLabel(), rowDef.getLabel());
    }
    /**
     * per default all is selected
     */
    m_selectedRowCategories = m_allRowCategories;
    m_selectedColumnCategories = m_allColumnCategories;

    /**
     * page length is equal to the row count
     */
    this.setPageLength(this.getItemIds().size());

    /**
     * if dashboard is enabled...
     */
    if (m_dashboard) {
        setCellStyleGenerator(new CellStyleGenerator() {
            @Override
            public String getStyle(Table table, Object itemId, Object propertyId) {
                /**
                 * the row header column will not be faded out
                 */
                if ("".equals(propertyId)) {
                    return null;
                }

                if (m_selectedItemId != null && m_selectedPropertyId != null && m_selectedItemId.equals(itemId)
                        && m_selectedPropertyId.equals(propertyId)) {
                    return null;
                }

                if (m_selectedPropertyId == null && m_selectedItemId == null) {
                    return null;
                }

                if (m_selectedItemId == null && m_selectedPropertyId != null
                        && m_selectedPropertyId.equals(propertyId)) {
                    return null;
                }

                if (m_selectedPropertyId == null && m_selectedItemId != null
                        && m_selectedItemId.equals(itemId)) {
                    return null;
                }

                return "marked";
            }
        });

        /**
         * ...add a click listener for cells...
         */
        addItemClickListener(new ItemClickEvent.ItemClickListener() {
            @Override
            public void itemClick(ItemClickEvent itemClickEvent) {
                String selectedColumn = (String) itemClickEvent.getPropertyId();
                if (!"".equals(selectedColumn)) {
                    /**
                     * this handles cell clicks
                     */
                    m_selectedItemId = itemClickEvent.getItemId();
                    m_selectedPropertyId = itemClickEvent.getPropertyId();

                    Notification.show(m_selectedItemId + "/" + m_selectedPropertyId + " selected");

                    m_selectedRowCategories = getOnmsCategoriesForNames(
                            view.getRowDef((String) itemClickEvent.getItemId()).getCategoryNames());
                    m_selectedColumnCategories = getOnmsCategoriesForNames(
                            view.getColumnDef((String) itemClickEvent.getPropertyId()).getCategoryNames());
                } else {
                    /**
                     * this handles row clicks
                     */
                    m_selectedItemId = itemClickEvent.getItemId();
                    m_selectedPropertyId = null;

                    Notification.show(m_selectedItemId + " selected");

                    m_selectedRowCategories = getOnmsCategoriesForNames(
                            view.getRowDef((String) itemClickEvent.getItemId()).getCategoryNames());
                    m_selectedColumnCategories = m_allColumnCategories;
                }

                updateDetailsTable();
                markAsDirtyRecursive();
            }
        });

        /**
         * ...and a header click listener...
         */
        addHeaderClickListener(new HeaderClickListener() {
            @Override
            public void headerClick(HeaderClickEvent headerClickEvent) {
                if ("".equals(headerClickEvent.getPropertyId())) {
                    /**
                     * this handles the upper-left cell
                     */
                    m_selectedRowCategories = m_allRowCategories;
                    m_selectedColumnCategories = m_allColumnCategories;

                    m_selectedItemId = null;
                    m_selectedPropertyId = null;

                    Notification.show("All entries selected");
                } else {
                    /**
                     * this handles the rest of the header cells
                     */
                    m_selectedItemId = null;
                    m_selectedPropertyId = headerClickEvent.getPropertyId();

                    m_selectedRowCategories = m_allRowCategories;
                    m_selectedColumnCategories = getOnmsCategoriesForNames(
                            view.getColumnDef((String) headerClickEvent.getPropertyId()).getCategoryNames());

                    Notification.show(m_selectedPropertyId + " selected");
                }

                updateDetailsTable();
                markAsDirtyRecursive();
            }
        });
    }
}

From source file:ru.codeinside.gses.activiti.ReadOnly.java

License:Mozilla Public License

public ReadOnly(String labelValue, String value, boolean valid) {
    this.valid = valid;
    if (value == null || value.length() < 4000) {
        setSizeFull();/*  ww w. j a  va  2s  . com*/
        Label label = new Label(labelValue);
        label.setSizeFull();
        label.setStyleName("left");
        HorizontalLayout layout = new HorizontalLayout(); //   GridLayout
        layout.setSizeFull();
        layout.addComponent(label);
        layout.setExpandRatio(label, 1f);
        setCompositionRoot(layout);
    } else {
        setSizeFull();
        TextArea area = new TextArea();
        area.setValue(value);
        area.setReadOnly(true);
        area.setSizeFull();
        area.setRows(25);
        setCompositionRoot(area);
    }
    if (valid) {
        setValue(value);
    }
}

From source file:ru.codeinside.gses.activiti.SmevRequestField.java

License:Mozilla Public License

public SmevRequestField(String text, long id) {
    final Label label = new Label(text);
    label.setSizeFull();
    setCompositionRoot(label);/*from   w  w  w .j a  va 2s. c  o m*/
    setValue(new SmevRequestValue(text, id));
}

From source file:uk.q3c.krail.testapp.view.GridViewBase.java

License:Apache License

@Override
protected void doBuild() {
    Label label = new Label("This is the " + this.getClass().getSimpleName());
    label.setHeight("100px");
    GridLayout grid = new GridLayout(3, 3);

    grid.addComponent(label, 1, 1);/*from ww w.j a va 2 s  .c  o m*/
    grid.setSizeFull();
    grid.setColumnExpandRatio(0, 0.33f);
    grid.setColumnExpandRatio(1, 0.33f);
    grid.setColumnExpandRatio(2, 0.33f);

    grid.setRowExpandRatio(0, 0.4f);
    grid.setRowExpandRatio(1, 0.2f);
    grid.setRowExpandRatio(2, 0.4f);

    label.setSizeFull();
    setRootComponent(grid);

}