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


Java Label類代碼示例

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


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

示例1: row

import com.vaadin.ui.Label; //導入依賴的package包/類
@Test
void row() {
    assertThrows(IllegalArgumentException.class, () -> new Form().row(null).add());
    assertThrows(IllegalArgumentException.class, () -> new Form().row(new TextFieldGroup(), null).add());
    assertThrows(IllegalArgumentException.class, () -> new Form().row(null, null, new TextFieldGroup()).add());
    assertEquals(true, ((TextFieldGroup) new Form(true).row(new TextFieldGroup()).add()
            .getRows().get(0).getComponents().get(0)).isFeedbackHeightReservedIfEmpty());
    assertEquals(false, ((TextFieldGroup) new Form(true, false).row(new TextFieldGroup()).add()
            .getRows().get(0).getComponents().get(0)).isDescriptionHeightReservedIfEmpty());
    assertThrows(IllegalArgumentException.class, () -> new Form().row(null).add());

    assertThrows(IllegalArgumentException.class, () -> new Form().row(new Label(), null).add());
    assertThrows(IllegalArgumentException.class, () -> new Form().row(null, null, new Label()).add());
    assertEquals("123", ((Label) new Form(true).row(new Label("123")).add()
            .getRows().get(0).getComponents().get(0)).getValue());
    assertEquals("321", ((Label) new Form(true, false).row(new Label("321")).add()
            .getRows().get(0).getComponents().get(0)).getValue());

}
 
開發者ID:knoobie,項目名稱:bootstrap-formgroup,代碼行數:20,代碼來源:FormTest.java

示例2: enter

import com.vaadin.ui.Label; //導入依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    addComponent(new HeadingLabel("參加登録完了", VaadinIcons.CHECK));
    addComponent(new Label("參加登録が完了し、確認メールを送信しました。"));
    Label addressLabel = new Label("しばらく待ってもメールが來ない場合は、お手數ですが " + appReply + " までご連絡ください。");
    addressLabel.setCaption("お願い");
    addressLabel.setIcon(VaadinIcons.LIGHTBULB);
    addComponent(addressLabel);
    Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
    homeButton.setIcon(VaadinIcons.HOME);
    addComponent(homeButton);
    setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
 
開發者ID:JavaTrainingCourse,項目名稱:obog-manager,代碼行數:14,代碼來源:ThanksView.java

示例3: init

import com.vaadin.ui.Label; //導入依賴的package包/類
@Override
protected void init(VaadinRequest request) {
  rootLayout = getRootLayout();
  setContent(rootLayout);

  Label title = getTitleLabel();

  StepperPropertiesLayout layout = new StepperPropertiesLayout();
  layout.addStepperCreateListener(this);
  layout.setWidth(300, Unit.PIXELS);

  Spacer spacer = new Spacer();
  spacer.setWidth(100, Unit.PIXELS);

  rootLayout.addComponent(title, 0, 0, 2, 0);
  rootLayout.addComponent(spacer, 1, 1);
  rootLayout.addComponent(layout, 0, 1);
  rootLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);

  layout.start();
}
 
開發者ID:Juchar,項目名稱:md-stepper,代碼行數:22,代碼來源:DemoUI.java

示例4: SimpleDialog

import com.vaadin.ui.Label; //導入依賴的package包/類
public SimpleDialog(String title, String message, boolean lightTheme) {
    super(title);
    addStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK);

    label = new Label(message);
    label.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.SECONDARY : Typography.Light.Subheader.SECONDARY);
    label.addStyleName(Paddings.Horizontal.LARGE + " " + Paddings.Bottom.LARGE);

    // Footer
    cancel = new Button("Cancel");
    cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
    cancel.addClickListener(e -> close());

    ok = new Button("OK");
    ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK);
    ok.addClickListener(e -> close());

    footer = new FlexLayout(cancel, ok);
    footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END);
    footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0);
    footer.setWidth(100, Unit.PERCENTAGE);

    // Content wrapper
    content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, label, footer);
    setContent(content);
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:27,代碼來源:SimpleDialog.java

示例5: init

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * Initialise la vue
 */
@PostConstruct
public void init() {
	/*Récupération du centre de canidature en cours*/
	SecurityCtrCandFonc securityCtrCandFonc = userController.getCtrCandFonctionnalite(NomenclatureUtils.FONCTIONNALITE_GEST_FORMULAIRE);
	if (securityCtrCandFonc.hasNoRight()){	
		setSizeFull();
		setMargin(true);
		setSpacing(true);
		addComponent(new Label(applicationContext.getMessage("erreurView.title", null, UI.getCurrent().getLocale())));
		return;
	}
	super.init();

	titleParam.setValue(applicationContext.getMessage("formulaire.commun.title", null, UI.getCurrent().getLocale()));
	
	container.addAll(formulaireController.getFormulairesCommunScolEnService());
	buttonsLayout.setVisible(false);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:22,代碼來源:CtrCandFormulaireCommunView.java

示例6: getRestGrid

import com.vaadin.ui.Label; //導入依賴的package包/類
private Component getRestGrid(Collection<MetricsRest> metrics, Series httpSerie) {

		List<MetricsRest> metricsItems = metrics.stream()
													.filter(m -> m.valid() && m.getStatus().series() == httpSerie)
													.collect(Collectors.toList());

		if(metricsItems.isEmpty()) {
			return new Label("No requests");
		} else {
			Grid<MetricsRest> gridCache = new Grid<>(MetricsRest.class);
			gridCache.removeAllColumns();
			gridCache.addColumn(MetricsRest::getName).setCaption("Path").setExpandRatio(1);
			gridCache.addColumn(m -> m.getStatus() + " " + m.getStatus().getReasonPhrase()).setCaption("HTTP Status");
			gridCache.addColumn(MetricsRest::getValue).setCaption("Hits");
			gridCache.addColumn(MetricsRest::getLastResponseTime).setCaption("Last Response Time (ms)");

			gridCache.setItems(metricsItems);
			if(metricsItems.size() < 10) {
				gridCache.setHeightByRows(metricsItems.size());
			}
			gridCache.setWidth(100, Unit.PERCENTAGE);

			return gridCache;
		}
	}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:26,代碼來源:MetricsPage.java

示例7: getVarLayout

import com.vaadin.ui.Label; //導入依賴的package包/類
private void getVarLayout(String title, List<String> liste, HorizontalLayout hlContent){
	if (liste==null || liste.size()==0){
		return;
	}
	
	VerticalLayout vl = new VerticalLayout();
	if (title!=null){
		Label labelTitle = new Label(title);
		vl.addComponent(labelTitle);
		vl.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER);
	}
	
	StringBuilder txt = new StringBuilder("<ul>");
	liste.forEach(e->txt.append("<li><input type='text' value='${"+e+"}'></li>"));
	txt.append("</ul>");
	Label labelSearch = new Label(txt.toString(),ContentMode.HTML);
	
	vl.addComponent(labelSearch);
	hlContent.addComponent(vl);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:21,代碼來源:ScolMailWindow.java

示例8: updateCandidaturePresentation

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * Met a jour le panel d'info
 * 
 * @param listePresentation
 */
private void updateCandidaturePresentation(final List<SimpleTablePresentation> listePresentation) {
	int i = 0;
	gridInfoLayout.removeAllComponents();
	gridInfoLayout.setRows(listePresentation.size());
	for (SimpleTablePresentation e : listePresentation) {
		Label title = new Label(e.getTitle());
		title.addStyleName(ValoTheme.LABEL_BOLD);
		title.setSizeUndefined();
		gridInfoLayout.addComponent(title, 0, i);
		Label value = new Label((String) e.getValue(), ContentMode.HTML);
		if ((e.getCode().equals("candidature." + ConstanteUtils.CANDIDATURE_LIB_LAST_DECISION)
				&& e.getShortValue() != null && !e.getShortValue().equals(NomenclatureUtils.TYP_AVIS_ATTENTE))
				|| (e.getCode().equals("candidature." + ConstanteUtils.CANDIDATURE_LIB_STATUT)
						&& e.getShortValue() != null
						&& !e.getShortValue().equals(NomenclatureUtils.TYPE_STATUT_ATT))) {
			title.addStyleName(ValoTheme.LABEL_COLORED);
			value.addStyleName(ValoTheme.LABEL_COLORED);
			value.addStyleName(ValoTheme.LABEL_BOLD);
		}
		value.setWidth(100, Unit.PERCENTAGE);
		gridInfoLayout.addComponent(value, 1, i);
		i++;
	}
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:30,代碼來源:CandidatureWindow.java

示例9: updateCandidatureDatePresentation

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * Met à jour le panel de dates
 * 
 * @param listePresentation
 */
private void updateCandidatureDatePresentation(final List<SimpleTablePresentation> listePresentation) {
	int i = 0;
	gridDateLayout.removeAllComponents();
	if (listePresentation.size() > 0) {
		gridDateLayout.setRows(listePresentation.size());
		for (SimpleTablePresentation e : listePresentation) {
			Label title = new Label(e.getTitle());
			title.addStyleName(ValoTheme.LABEL_BOLD);
			title.setSizeUndefined();
			gridDateLayout.addComponent(title, 0, i);
			Label value = new Label((String) e.getValue());
			if (e.getCode().equals(
					"candidature." + Candidature_.formation.getName() + "." + Formation_.datRetourForm.getName())) {
				title.addStyleName(ValoTheme.LABEL_COLORED);
				value.addStyleName(ValoTheme.LABEL_COLORED);
				value.addStyleName(ValoTheme.LABEL_BOLD);
			}
			value.setWidth(100, Unit.PERCENTAGE);
			gridDateLayout.addComponent(value, 1, i);
			i++;
		}
	}
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:29,代碼來源:CandidatureWindow.java

示例10: getLegendLayout

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * @return le layout de légende
 */
private VerticalLayout getLegendLayout() {
	VerticalLayout vlLegend = new VerticalLayout();
	// vlLegend.setWidth(300, Unit.PIXELS);
	vlLegend.setMargin(true);
	vlLegend.setSpacing(true);

	Label labelTitle = new Label(
			applicationContext.getMessage("formation.table.flagEtat.tooltip", null, UI.getCurrent().getLocale()));
	labelTitle.addStyleName(StyleConstants.VIEW_TITLE);

	vlLegend.addComponent(labelTitle);

	vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_GREEEN));
	vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_RED));
	vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_YELLOW));
	vlLegend.addComponent(getLegendLineLayout(ConstanteUtils.FLAG_BLUE));
	return vlLegend;
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:22,代碼來源:CtrCandFormationView.java

示例11: init

import com.vaadin.ui.Label; //導入依賴的package包/類
@Override
protected void init(VaadinRequest request) {
	// The root of the component hierarchy
	VerticalLayout content = new VerticalLayout();
	content.setSizeFull(); // Use entire window
	setContent(content); // Attach to the UI

	// Add some component
	content.addComponent(new Label("<b>Hello!</b> - How are you?", ContentMode.HTML));

}
 
開發者ID:commsen,項目名稱:EM,代碼行數:12,代碼來源:MainUI.java

示例12: init

import com.vaadin.ui.Label; //導入依賴的package包/類
@PostConstruct
public void init() {

	applications = this.appService.findAll();

	// Title
	Label title = new Label("<h2>Applications</h2>", ContentMode.HTML);

	initApplicationsGrid();

	// Build layout
	VerticalLayout leftLayout = new VerticalLayout(title, grid);
	leftLayout.setMargin(false);
	this.addComponent(leftLayout);

	// Center align layout
	this.setWidth("100%");
	this.setMargin(new MarginInfo(false, true));
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:20,代碼來源:ApplicationsPage.java

示例13: createTitle

import com.vaadin.ui.Label; //導入依賴的package包/類
private Component createTitle(String text) {
    Label lbl = new Label(text);
    lbl.addStyleName(Typography.Dark.Table.Title.PRIMARY);

    FlexLayout layout = new FlexLayout(lbl);
    layout.setAlignItems(AlignItems.CENTER);
    layout.setHeight(Metrics.Table.TITLE_HEIGHT, Unit.PIXELS);

    return layout;
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:11,代碼來源:ButtonsView.java

示例14: LabelValidationStatusHandler

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * Constructor
 * @param label Status label (not null)
 * @param hideWhenValid <code>true</code> to hide the Label when the validation status is not invalid
 */
public LabelValidationStatusHandler(Label label, boolean hideWhenValid) {
	super();
	ObjectUtils.argumentNotNull(label, "Status label must be not null");
	this.label = label;
	this.hideWhenValid = hideWhenValid;
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:12,代碼來源:LabelValidationStatusHandler.java

示例15: LabelViewComponent

import com.vaadin.ui.Label; //導入依賴的package包/類
/**
 * Constructor
 * @param type Concrete value type
 */
public LabelViewComponent(Class<? extends T> type) {
	super(type, new Label());
	getLabel().setContentMode(ContentMode.HTML);

	// default converter
	stringConverter = (v) -> StringValuePresenter.getDefault().present(null, v, null);
}
 
開發者ID:holon-platform,項目名稱:holon-vaadin7,代碼行數:12,代碼來源:LabelViewComponent.java


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