本文整理匯總了Java中com.vaadin.ui.Label.addStyleName方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.addStyleName方法的具體用法?Java Label.addStyleName怎麽用?Java Label.addStyleName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Label
的用法示例。
在下文中一共展示了Label.addStyleName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: createHintsLabel
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Label createHintsLabel() {
Label label
= new Label("* Changing the stepper type or the linearity will recreate the stepper.");
label.setWidth(100, Unit.PERCENTAGE);
label.addStyleName(ValoTheme.LABEL_LIGHT);
label.addStyleName(ValoTheme.LABEL_SMALL);
return label;
}
示例3: showTransitionMessage
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public void showTransitionMessage(String message) {
if (rootLayout.getComponent(1, 0) != null) {
rootLayout.removeComponent(1, 0);
}
if (rootLayout.getComponent(0, 0) != null) {
rootLayout.removeComponent(0, 0);
}
label.setCaptionVisible(message == null);
label.setDescriptionVisible(message == null);
if (message != null) {
Label feedbackLabel = new Label(message);
feedbackLabel.addStyleName(STYLE_FEEDBACK_MESSAGE);
feedbackLabel.setWidth(100, Unit.PERCENTAGE);
rootLayout.addComponent(label, 0, 0);
rootLayout.addComponent(feedbackLabel, 1, 0);
rootLayout.setComponentAlignment(feedbackLabel, Alignment.MIDDLE_LEFT);
contentContainer.setContent(new CenteredLayout(new Spinner()));
buttonBar.forEach(c -> c.setVisible(false));
} else {
rootLayout.addComponent(label, 0, 0, 1, 0);
contentContainer.setContent(step);
}
}
示例4: init
import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setMargin(true);
setSpacing(true);
/* Titre */
Label title = new Label(applicationContext.getMessage(NAME + ".title", null, UI.getCurrent().getLocale()));
title.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(title);
/* Texte */
addComponent(new Label(applicationContext.getMessage(NAME + ".text", null, UI.getCurrent().getLocale()), ContentMode.HTML));
}
示例5: createHeadline
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Component createHeadline(String text) {
Label lbl = new Label(text);
lbl.addStyleName(Typography.Dark.DatePicker.Title.PRIMARY + " " + MaterialColor.BLUE_500.getFontColorStyle());
FlexLayout layout = new FlexLayout(lbl);
layout.setAlignItems(FlexLayout.AlignItems.CENTER);
layout.setHeight(Metrics.DatePicker.HEADER_HEIGHT, Unit.PIXELS);
return layout;
}
示例6: Step4
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public Step4() {
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label errorTitle = new Label("Step Validation");
errorTitle.addStyleName(ValoTheme.LABEL_H2);
Label errorLabel = new Label("You can validate the contents of your step and show an " +
"error message.<br>Try it out using the text field below " +
"(it should not be empty).", ContentMode.HTML);
TextField textField = new TextField("Please enter a value");
content.addComponent(errorTitle);
content.addComponent(errorLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
content.addComponent(textField);
addStepBackListener(StepperActions::back);
addStepNextListener(event -> {
Stepper stepper = event.getSource();
stepper.hideError();
String value = textField.getValue();
if (StringUtils.isBlank(value)) {
stepper.showError(new RuntimeException("Field should not be empty"));
} else {
stepper.next();
}
});
setCaption("Step 4");
setDescription("Step Validation");
setContent(content);
}
示例7: createSubheader
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Component createSubheader(String text) {
Label lbl = new Label(text);
lbl.addStyleName(Typography.Dark.Body2.SECONDARY + " " + MaterialColor.BLUE_500.getFontColorStyle());
FlexLayout subheader = new FlexLayout(lbl);
subheader.setAlignItems(FlexLayout.AlignItems.CENTER);
subheader.setHeight(Metrics.Subheader.HEIGHT, Unit.PIXELS);
return subheader;
}
示例8: Step1
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public Step1() {
super(true); // Use default actions
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label basicInformationTitle = new Label("Basic Information");
basicInformationTitle.addStyleName(ValoTheme.LABEL_H2);
Label basicInformationLabel = new Label("The stepper component can be used to iterate " +
"through the single steps of a process. Depending on " +
"whether the stepper is declared linear or not, " +
"the provided steps have to be completed in order - " +
"or not.");
Label demoUsageTitle = new Label("Demo Usage");
demoUsageTitle.addStyleName(ValoTheme.LABEL_H3);
Label demoUsageLabel = new Label("You can use the panel on the left side to change and " +
"try out different attributes of the stepper.<br>" +
"Additionally, the demo will show the various possibilities " +
"to use the stepper and its steps when you progress through " +
"the single steps.", ContentMode.HTML);
content.addComponent(basicInformationTitle);
content.addComponent(basicInformationLabel);
content.addComponent(demoUsageTitle);
content.addComponent(demoUsageLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
setCaption("Step 1");
setDescription("Basic Stepper Features");
setContent(content);
}
示例9: 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;
}
示例10: createHeadline
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private Component createHeadline(String text) {
Label lbl = new Label(text);
lbl.addStyleName(Typography.Dark.DatePicker.Title.PRIMARY + " " + MaterialColor.BLUE_500.getFontColorStyle());
FlexLayout layout = new FlexLayout(lbl);
layout.setAlignItems(AlignItems.CENTER);
layout.setHeight(Metrics.DatePicker.HEADER_HEIGHT, Unit.PIXELS);
return layout;
}
示例11: Subheader
import com.vaadin.ui.Label; //導入方法依賴的package包/類
public Subheader(String value, boolean light) {
addStyleName(FlexItem.FlexShrink.SHRINK_0);
setAlignItems(AlignItems.CENTER);
setHeight(Metrics.Subheader.HEIGHT, Unit.PIXELS);
label = new Label(value);
label.addStyleName(light ? Typography.Light.Body2.SECONDARY : Typography.Dark.Body2.SECONDARY);
addComponent(label);
}
示例12: 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;
}
示例13: addHeaderAndButtons
import com.vaadin.ui.Label; //導入方法依賴的package包/類
private void addHeaderAndButtons() {
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("80%");
Label header = new Label("Streaming Console");
header.addStyleName(ValoTheme.LABEL_H2);
Button showButton = new Button("");
showButton.setCaption("Stream");
showButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
// showButton.setIcon(VaadinIcons.PLUS_CIRCLE);
showButton.addClickListener(click -> {
System.out.println("[x] Show button clicked ...");
// Start the data feed thread
new FeederThread().start();
});
Button sendButton = new Button("");
sendButton.setCaption("Send");
sendButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
sendButton.setIcon(VaadinIcons.PLUS);
sendButton.addClickListener(click -> {
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("[x] Send button clicked ...");
sender.stream();
}
};
new Thread(r).start();
});
topLayout.addComponent(header);
topLayout.setComponentAlignment(header, Alignment.BOTTOM_CENTER);
topLayout.addComponent(showButton);
topLayout.setComponentAlignment(showButton, Alignment.MIDDLE_CENTER);
topLayout.addComponent(sendButton);
topLayout.setComponentAlignment(sendButton, Alignment.MIDDLE_CENTER);
addComponent(topLayout);
}
示例14: init
import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("typeTraitement.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.setEnabled(false);
btnEdit.addClickListener(e -> {
if (typeTraitementTable.getValue() instanceof TypeTraitement) {
nomenclatureTypeController.editTypeTraitement((TypeTraitement) typeTraitementTable.getValue());
}
});
buttonsLayout.addComponent(btnEdit);
buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_LEFT);
/* Table des typeTraitements */
typeTraitementTable.setContainerDataSource(new BeanItemContainer<TypeTraitement>(TypeTraitement.class, nomenclatureTypeController.getTypeTraitements()));
typeTraitementTable.addGeneratedColumn(TypeTraitement_.i18nLibTypTrait.getName(), new ColumnGenerator() {
/*** serialVersionUID*/
private static final long serialVersionUID = 2101119091378513475L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final TypeTraitement typeTraitement = (TypeTraitement) itemId;
return i18nController.getI18nTraductionLibelle(typeTraitement.getI18nLibTypTrait());
}
});
typeTraitementTable.setSizeFull();
typeTraitementTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
typeTraitementTable.setColumnHeader(fieldName, applicationContext.getMessage("typeTraitement.table." + fieldName, null, UI.getCurrent().getLocale()));
}
typeTraitementTable.setSortContainerPropertyId(TypeTraitement_.codTypTrait.getName());
typeTraitementTable.setColumnCollapsingAllowed(true);
typeTraitementTable.setColumnReorderingAllowed(true);
typeTraitementTable.setSelectable(true);
typeTraitementTable.setImmediate(true);
typeTraitementTable.addItemSetChangeListener(e -> typeTraitementTable.sanitizeSelection());
typeTraitementTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de typeTraitement sont actifs seulement si une typeTraitement est sélectionnée. */
boolean typeTraitementIsSelected = typeTraitementTable.getValue() instanceof TypeTraitement;
btnEdit.setEnabled(typeTraitementIsSelected);
});
typeTraitementTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
typeTraitementTable.select(e.getItemId());
btnEdit.click();
}
});
addComponent(typeTraitementTable);
setExpandRatio(typeTraitementTable, 1);
/* Inscrit la vue aux mises à jour de typeTraitement */
typeTraitementEntityPusher.registerEntityPushListener(this);
}
示例15: init
import com.vaadin.ui.Label; //導入方法依賴的package包/類
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setSizeFull();
setMargin(true);
setSpacing(true);
/* Titre */
Label titleParam = new Label(applicationContext.getMessage("typeStatutPiece.title", null, UI.getCurrent().getLocale()));
titleParam.addStyleName(StyleConstants.VIEW_TITLE);
addComponent(titleParam);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
addComponent(buttonsLayout);
OneClickButton btnEdit = new OneClickButton(applicationContext.getMessage("btnEdit", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEdit.setEnabled(false);
btnEdit.addClickListener(e -> {
if (typeStatutPieceTable.getValue() instanceof TypeStatutPiece) {
typeStatutController.editTypeStatutPiece((TypeStatutPiece) typeStatutPieceTable.getValue());
}
});
buttonsLayout.addComponent(btnEdit);
buttonsLayout.setComponentAlignment(btnEdit, Alignment.MIDDLE_LEFT);
/* Table des typeStatutPieces */
BeanItemContainer<TypeStatutPiece> container = new BeanItemContainer<TypeStatutPiece>(TypeStatutPiece.class, typeStatutController.getTypeStatutPieces());
typeStatutPieceTable.setContainerDataSource(container);
typeStatutPieceTable.addGeneratedColumn(TypeStatutPiece_.i18nLibTypStatutPiece.getName(), new ColumnGenerator() {
/*** serialVersionUID*/
private static final long serialVersionUID = 2101119091378513475L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final TypeStatutPiece type = (TypeStatutPiece) itemId;
return i18nController.getI18nTraductionLibelle(type.getI18nLibTypStatutPiece());
}
});
typeStatutPieceTable.setSizeFull();
typeStatutPieceTable.setVisibleColumns((Object[]) FIELDS_ORDER);
for (String fieldName : FIELDS_ORDER) {
typeStatutPieceTable.setColumnHeader(fieldName, applicationContext.getMessage("typeStatutPiece.table." + fieldName, null, UI.getCurrent().getLocale()));
}
typeStatutPieceTable.setSortContainerPropertyId(TypeStatutPiece_.codTypStatutPiece.getName());
typeStatutPieceTable.setColumnCollapsingAllowed(true);
typeStatutPieceTable.setColumnReorderingAllowed(true);
typeStatutPieceTable.setSelectable(true);
typeStatutPieceTable.setImmediate(true);
typeStatutPieceTable.addItemSetChangeListener(e -> typeStatutPieceTable.sanitizeSelection());
typeStatutPieceTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de typeStatutPiece sont actifs seulement si une typeStatutPiece est sélectionnée. */
boolean typeStatutPieceIsSelected = typeStatutPieceTable.getValue() instanceof TypeStatutPiece;
btnEdit.setEnabled(typeStatutPieceIsSelected);
});
typeStatutPieceTable.addItemClickListener(e -> {
if (e.isDoubleClick()) {
typeStatutPieceTable.select(e.getItemId());
btnEdit.click();
}
});
addComponent(typeStatutPieceTable);
setExpandRatio(typeStatutPieceTable, 1);
/* Inscrit la vue aux mises à jour de typeStatutPiece */
typeStatutPieceEntityPusher.registerEntityPushListener(this);
}