List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:org.eclipse.hawkbit.ui.rollout.rollout.AddUpdateRolloutWindowLayout.java
License:Open Source License
private Label getMandatoryLabel(final String key) { final Label mandatoryLabel = getLabel(i18n.getMessage(key)); mandatoryLabel.setContentMode(ContentMode.HTML); mandatoryLabel.setValue(mandatoryLabel.getValue().concat(" <span style='color:#ed473b'>*</span>")); return mandatoryLabel; }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
private Label createLoadingLabel() { final Label label = new LabelBuilder().visible(false).name("").buildLabel(); label.addStyleName("rollout-target-count-loading"); label.setImmediate(true);//ww w .j a v a2 s . c o m label.setSizeUndefined(); label.setValue(i18n.getMessage("label.rollout.calculating")); return label; }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a list of anonymous groups. They can't have * unassigned targets.//from ww w. ja v a2 s . com * * @param listOfTargetCountPerGroup * list of target counts */ public void populateGroupsLegendByTargetCounts(final List<Long> listOfTargetCountPerGroup) { loadingLabel.setVisible(false); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(listOfTargetCountPerGroup.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (listOfTargetCountPerGroup.size() > i) { final Long targetCount = listOfTargetCountPerGroup.get(i); label.setValue(getTargetsInGroupMessage(targetCount, i18n.getMessage("textfield.rollout.group.default.name", i + 1))); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(listOfTargetCountPerGroup); unassignedTargetsLabel.setValue(""); unassignedTargetsLabel.setVisible(false); }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a groups validation and a list of groups * that is used for resolving their names. Positions of the groups in the * groups list and the validation need to be in correct order. Can have * unassigned targets that are displayed on top of the groups list which * results in one group less to be displayed * //from w w w.j a va 2 s . c o m * @param validation * A rollout validation object that contains a list of target * counts and the total targets * @param groups * List of groups with their name */ public void populateGroupsLegendByValidation(final RolloutGroupsValidation validation, final List<RolloutGroupCreate> groups) { loadingLabel.setVisible(false); if (validation == null) { return; } final List<Long> targetsPerGroup = validation.getTargetsPerGroup(); final long unassigned = validation.getTotalTargets() - validation.getTargetsInGroups(); final int labelsToUpdate = (unassigned > 0) ? (getGroupsWithoutToBeContinuedLabel(groups.size()) - 1) : groupsLegend.getComponentCount(); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(groups.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (targetsPerGroup.size() > i && groups.size() > i && labelsToUpdate > i) { final Long targetCount = targetsPerGroup.get(i); final String groupName = groups.get(i).build().getName(); label.setValue(getTargetsInGroupMessage(targetCount, groupName)); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(groups); if (unassigned > 0) { unassignedTargetsLabel.setValue(getTargetsInGroupMessage(unassigned, "Unassigned")); unassignedTargetsLabel.setVisible(true); } else { unassignedTargetsLabel.setValue(""); unassignedTargetsLabel.setVisible(false); } }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.GroupsLegendLayout.java
License:Open Source License
/** * Populates the legend based on a list of groups. * * @param groups//w w w . j a va 2 s. co m * List of groups with their name */ public void populateGroupsLegendByGroups(final List<RolloutGroup> groups) { loadingLabel.setVisible(false); for (int i = 0; i < getGroupsWithoutToBeContinuedLabel(groups.size()); i++) { final Component component = groupsLegend.getComponent(i); final Label label = (Label) component; if (groups.size() > i) { final int targetCount = groups.get(i).getTotalTargets(); final String groupName = groups.get(i).getName(); label.setValue(getTargetsInGroupMessage((long) targetCount, groupName)); label.setVisible(true); } else { label.setValue(""); label.setVisible(false); } } showOrHideToBeContinueLabel(groups); }
From source file:org.eclipse.skalli.view.component.PeopleComponent.java
License:Open Source License
protected PeopleComponent(final User user) { addStyleName(STYLE);/*ww w . ja v a2s .c o m*/ Layout layout = new CssLayout(); layout.setSizeFull(); layout.setMargin(false); StringBuilder sb = new StringBuilder(); sb.append("<span class=\"v-img-peoplecomponent\">"); //$NON-NLS-1$ sb.append("<img src=\"/VAADIN/themes/simple/icons/people/team.png\" /> "); //$NON-NLS-1$ sb.append("</span>"); //$NON-NLS-1$ String userDetailsLink = UserDetailsUtil.getUserDetailsLink(user.getUserId()); if (userDetailsLink != null) { // user details link configured, render a link to user details dialog sb.append("<a href=\""); //$NON-NLS-1$ sb.append(userDetailsLink); sb.append("\" target=\"_blank\">"); //$NON-NLS-1$ sb.append(StringEscapeUtils.escapeHtml(user.getDisplayName())); sb.append("</a> "); //$NON-NLS-1$ } else { // not configured, just display the user name sb.append(StringEscapeUtils.escapeHtml(user.getDisplayName())); sb.append(" "); //$NON-NLS-1$ } sb.append("<span class=\"v-link-peoplecomponent\">"); //$NON-NLS-1$ if (user.hasEmail()) { sb.append("<a class=\"link\" href=\"mailto:"); //$NON-NLS-1$ sb.append(user.getEmail()); sb.append("\">"); //$NON-NLS-1$ sb.append("Mail"); sb.append("</a> "); //$NON-NLS-1$ } sb.append("<a class=\"link\" href=\""); //$NON-NLS-1$ sb.append(Consts.URL_PROJECTS_USER); sb.append(StringEscapeUtils.escapeHtml(user.getUserId())); sb.append("\">"); //$NON-NLS-1$ sb.append("Projects"); sb.append("</a> "); //$NON-NLS-1$ sb.append("</span>"); //$NON-NLS-1$ Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setValue(sb.toString()); layout.addComponent(lbl); setCompositionRoot(layout); }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectActivityBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { Layout layout = new CssLayout(); layout.addStyleName(STYLE_ACTIVITY_INFOBOX); layout.setSizeFull();/* w w w . j a v a2s . com*/ Label label; label = new Label("Latest commit activity (click for details):"); layout.addComponent(label); layout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Link imgLink = getActivityGraphicUrl(project, util.getLoggedInUserId()); Link detailsLink = getActivityDetailsUrl(project, util.getLoggedInUserId()); Label activityArea = new Label(); activityArea.setContentMode(Label.CONTENT_XHTML); if (imgLink != null) { String imgTag = "<img src=\"" + imgLink.getUrl() + "\" " + "title=\"" + imgLink.getLabel() + "\" " + "onerror=\"document.getElementById('activityBoxError').style.visibility='visible';" + "document.getElementById('activityBoxImage').style.visibility='hidden';\" " + ">"; String content; if (detailsLink != null) { content = "<a href=\"" + detailsLink.getUrl() + "\" target=\"_new\">" + imgTag + "</a>"; } else { content = imgTag; } activityArea.setValue("<span id=\"activityBoxImage\">" + content + "</span>"); layout.addComponent(activityArea); Label errorArea = new Label("<span id=\"activityBoxError\" " + "style=\"visibility:hidden\">" + "<i>Currently there is no activity information available.</i>" + "</span>"); errorArea.setContentMode(Label.CONTENT_XHTML); layout.addComponent(errorArea); } else if (detailsLink != null) { activityArea.setValue("<a href=\"" + detailsLink.getUrl() + "\" target=\"_new\">Show details</a>"); layout.addComponent(activityArea); } return layout; }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
private void setMessage(Label label, String message) { if (StringUtils.isNotEmpty(message)) { label.setValue(message); label.setVisible(true);// w w w. java 2s . c om } else { label.setVisible(false); } label.requestRepaint(); }
From source file:org.escidoc.browser.elabsmodul.views.AddNewInstrumentsWindow.java
License:Open Source License
private VerticalLayout createAvailableInsturmentsTableLayout() { VerticalLayout layout = new VerticalLayout(); addOnTable = new Table("Available instuments to choose"); addOnTable.setWidth("90%"); addOnTable.setHeight("300px"); addOnTable.setSelectable(true);//from w w w . ja v a 2s . com addOnTable.setMultiSelect(true); addOnTable.setImmediate(true); addOnTable.setEditable(false); addOnTable.setMultiSelectMode(MultiSelectMode.DEFAULT); addOnTable.setColumnReorderingAllowed(true); addOnTable.setColumnCollapsingAllowed(false); addOnTable.setContainerDataSource(fillAddOnTableData(this.rigController, rigBean.getContentList())); addOnTable.setVisibleColumns(new Object[] { property1, property2, property3 }); addOnTable.setColumnHeaders(new String[] { "Name", "Description", "Id" }); addOnTable.setColumnAlignment(property1, Table.ALIGN_LEFT); addOnTable.setColumnAlignment(property2, Table.ALIGN_LEFT); addOnTable.setColumnAlignment(property3, Table.ALIGN_CENTER); addOnTable.setColumnCollapsingAllowed(true); addOnTable.setColumnCollapsed(property1, false); addOnTable.setColumnCollapsed(property2, false); addOnTable.setColumnCollapsed(property3, false); addOnTable.setRowHeaderMode(Table.ROW_HEADER_MODE_HIDDEN); addOnTable.setWriteThrough(false); final Label selectedLabel = new Label("No selection"); addOnTable.addListener(new Table.ValueChangeListener() { private static final long serialVersionUID = 2000562132182698589L; @Override public void valueChange(final ValueChangeEvent event) { int selSize = 0; Set<?> value = (Set<?>) event.getProperty().getValue(); if (value == null || value.size() == 0) { selectedLabel.setValue("No selection"); } else { selSize = value.size(); selectedLabel.setValue("Selected: " + selSize + " element" + ((selSize > 1) ? "s" : "")); } if (selSize == 0) { okButton.setEnabled(false); } else if (selSize == 1) { okButton.setEnabled(true); okButton.setCaption(ADD_BUTTON_TEXT); } else { okButton.setEnabled(true); okButton.setCaption(ADD_ALL_BUTTON_TEXT); } } }); layout.addComponent(addOnTable); layout.addComponent(selectedLabel); return layout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndLabelData(final String labelTxt, Property dataProperty, boolean required) { Preconditions.checkNotNull(labelTxt, "Label is null"); Preconditions.checkNotNull(dataProperty, "DataSource is null"); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT); horizontalLayout.setEnabled(true);/* www . ja v a 2 s. co m*/ horizontalLayout.setSpacing(true); horizontalLayout.setHeight(HOR_PANEL_HEIGHT); Label label = new Label(); label.setWidth(LABEL_WIDTH); label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); Label textLabel = new Label(dataProperty); textLabel.setWidth(TEXT_WIDTH); textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL); horizontalLayout.addComponent(label, 0); horizontalLayout.addComponent(textLabel, 1); horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT); return horizontalLayout; }