當前位置: 首頁>>代碼示例>>Java>>正文


Java Label.setContentMode方法代碼示例

本文整理匯總了Java中com.vaadin.ui.Label.setContentMode方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setContentMode方法的具體用法?Java Label.setContentMode怎麽用?Java Label.setContentMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.Label的用法示例。


在下文中一共展示了Label.setContentMode方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: NamedQueryResultsPanel

import com.vaadin.ui.Label; //導入方法依賴的package包/類
public NamedQueryResultsPanel(PageableList<HttpArticle> results) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);

    Label countLabel = new Label(String.format("%s documents matched", results.getTotalCount()));
    countLabel.addStyleName(ValoTheme.LABEL_LARGE);
    countLabel.setSizeFull();
    layout.addComponent(countLabel);

    for (HttpArticle article : results.getItems()) {
        String labelHtml = String.format("%s&nbsp;<a href=\"%s\" target=\"_blank\">%s</a> - <strong>%s</strong>",
                DataUtils.formatInUTC(article.getPublished()), article.getUrl(), article.getTitle(), article.getSource());
        Label articleLabel = new Label(labelHtml);
        articleLabel.setContentMode(ContentMode.HTML);
        articleLabel.setSizeFull();
        layout.addComponent(articleLabel);
    }
    setContent(layout);
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:20,代碼來源:NamedQueryResultsPanel.java

示例2: addItem

import com.vaadin.ui.Label; //導入方法依賴的package包/類
public void addItem(Object... values) {
    FlexLayout item = new FlexLayout();
    item.setPrimaryStyleName("md-datatable-row");
    item.addStyleName(Spacings.Right.LARGE);
    item.addStyleName(Paddings.Vertical.TABLE);
    for (Object value : values) {
        if (value instanceof String) {
            Label lbl = new Label((String) value);
            lbl.setContentMode(ContentMode.HTML);
            lbl.setPrimaryStyleName(Typography.Dark.Table.Row.PRIMARY);
            item.addComponent(lbl);
        } else if (value instanceof Component) {
            item.addComponent((Component) value);
        }
    }
    items.addComponent(item);
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:18,代碼來源:MDDataTableLayout.java

示例3: ResultPanel

import com.vaadin.ui.Label; //導入方法依賴的package包/類
public ResultPanel(HighlightedSearchResult searchResult) {
    HttpArticle article  = searchResult.getArticle();
    String highlights = searchResult.getHighlights().stream().collect(Collectors.joining("<br/>...<br/>"));
    String text = String.format(RESULTS_TEMPLATE,
            DataUtils.formatInUTC(article.getPublished()).replace("T", " "),
            article.getUrl(), article.getTitle(), article.getSource(), highlights);
    Label content = new Label(text);
    content.setContentMode(ContentMode.HTML);
    VerticalLayout component = new VerticalLayout(content);
    component.setMargin(true);
    setContent(component);
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:13,代碼來源:ResultPanel.java

示例4: createValidateWindow

import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
 *
 * Returns a Delete window using provided Content and Caption.It will have a Force Delete check box along with
 * Cancel and Ok Buttons.
 * The cancel button defaults to closing the window. You can customize behavior of OK,Cancel and Force Delete
 * components by calling @link {@link VmidcWindow#getComponentModel()} and setting a different
 * listener to that component
 *
 * @param caption
 *            Window's Caption
 * @param content
 *            Window's Content
 * @return
 *         Window Object
 */
public static VmidcWindow<OkCancelValidateButtonModel> createValidateWindow(String caption, String content) {
    final VmidcWindow<OkCancelValidateButtonModel> validateWindow = new VmidcWindow<OkCancelValidateButtonModel>(
            new OkCancelValidateButtonModel());
    validateWindow.setCaption(caption);
    validateWindow.getComponentModel().setCancelClickedListener(new ClickListener() {
        /**
         *
         */
        private static final long serialVersionUID = -1166844267835596823L;

        @Override
        public void buttonClick(ClickEvent event) {
            validateWindow.close();
        }
    });
    Label contentLabel = new Label(content);
    contentLabel.setContentMode(ContentMode.HTML);

    FormLayout form = new FormLayout();
    form.setMargin(true);
    form.setSizeUndefined();
    form.addComponent(contentLabel);

    validateWindow.setContent(form);
    return validateWindow;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:42,代碼來源:WindowUtil.java

示例5: createAlertWindow

import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
 * Returns a simple window with the specified caption and content(which can be HTML) with an OK and Cancel Buttons.
 * The cancel button defaults to closing the window.
 * This behaviour can be modified by calling @link {@link VmidcWindow#getComponentModel()} and setting a different
 * listener to the cancel button
 *
 * @param caption
 *            the caption
 * @param content
 *            the content
 * @return the handle to window object
 */
public static VmidcWindow<OkCancelButtonModel> createAlertWindow(String caption, String content) {
    final VmidcWindow<OkCancelButtonModel> alertWindow = new VmidcWindow<OkCancelButtonModel>(
            new OkCancelButtonModel());
    alertWindow.setCaption(caption);
    alertWindow.getComponentModel().setCancelClickedListener(new ClickListener() {

        /**
         *
         */
        private static final long serialVersionUID = 98853982893459323L;

        @Override
        public void buttonClick(ClickEvent event) {
            alertWindow.close();
        }
    });
    Label contentLabel = new Label(content);
    contentLabel.setContentMode(ContentMode.HTML);

    FormLayout form = new FormLayout();
    form.setMargin(true);
    form.setSizeUndefined();
    form.addComponent(contentLabel);

    alertWindow.setContent(form);
    return alertWindow;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:40,代碼來源:WindowUtil.java

示例6: setHeaders

import com.vaadin.ui.Label; //導入方法依賴的package包/類
public void setHeaders(String... headers) {
    for (String header : headers) {
        Label lbl = new Label(header);
        lbl.setContentMode(ContentMode.HTML);
        lbl.setPrimaryStyleName(Typography.Dark.Table.Header.SECONDARY);
        this.headers.addComponent(lbl);
    }
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:9,代碼來源:MDDataTableLayout.java

示例7: createBody1Label

import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Label createBody1Label(String text) {
    Label lbl = new Label(text);
    lbl.setContentMode(HTML);
    lbl.addStyleName(Typography.Dark.Body1.PRIMARY);
    lbl.addStyleName(Margins.Bottom.LARGE);
    return lbl;
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:8,代碼來源:ColorsView.java

示例8: StepLabel

import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
 * Construct a new label with the given caption, description and icon.
 *
 * @param caption
 *     The caption to show
 * @param description
 *     The description to show
 * @param icon
 *     The icon to show
 */
public StepLabel(String caption, String description, FontIcon icon) {
  active = false;
  nexted = false;
  skipped = false;
  editable = false;
  clickable = false;

  iconLabel = new Label();
  iconLabel.setWidthUndefined();
  iconLabel.setContentMode(ContentMode.HTML);
  iconLabel.addStyleName(STYLE_STEP_ICON);

  captionLabel = new Label();
  captionLabel.setWidth(100, Unit.PERCENTAGE);
  captionLabel.addStyleName(STYLE_STEP_CAPTION);

  descriptionLabel = new Label();
  descriptionLabel.setWidth(100, Unit.PERCENTAGE);
  descriptionLabel.addStyleName(ValoTheme.LABEL_LIGHT);
  descriptionLabel.addStyleName(ValoTheme.LABEL_SMALL);
  descriptionLabel.addStyleName(STYLE_STEP_DESCRIPTION);

  captionWrapper = new VerticalLayout();
  captionWrapper.setSpacing(false);
  captionWrapper.setMargin(false);
  captionWrapper.setSizeFull();
  captionWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  captionWrapper.addComponent(captionLabel);
  captionWrapper.addComponent(descriptionLabel);

  rootLayout = new HorizontalLayout();
  rootLayout.setSpacing(false);
  rootLayout.setMargin(false);
  rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
  rootLayout.setWidth(100, Unit.PERCENTAGE);
  rootLayout.addComponent(iconLabel);
  rootLayout.addComponent(captionWrapper);
  rootLayout.setExpandRatio(captionWrapper, 1);

  setCompositionRoot(rootLayout);
  addStyleName(STYLE_ROOT_LAYOUT);
  setIcon(icon);
  setCaption(caption);
  setDescription(description);

  setIconNexted(DEFAULT_ICON_NEXTED);
  setIconSkipped(DEFAULT_ICON_SKIPPED);
  setIconEditable(DEFAULT_ICON_EDITABLE);
  setIconError(DEFAULT_ICON_ERROR);
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:61,代碼來源:StepLabel.java


注:本文中的com.vaadin.ui.Label.setContentMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。