本文整理汇总了Java中com.vaadin.shared.ui.ContentMode.HTML属性的典型用法代码示例。如果您正苦于以下问题:Java ContentMode.HTML属性的具体用法?Java ContentMode.HTML怎么用?Java ContentMode.HTML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vaadin.shared.ui.ContentMode
的用法示例。
在下文中一共展示了ContentMode.HTML属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TwoLineListItem
public TwoLineListItem(String primaryText, String secondaryText, boolean verticalPadding) {
super(verticalPadding);
addStyleName("two-line");
setHeight(Metrics.List.TWO_LINE_HEIGHT, Unit.PIXELS);
primary = new Label(primaryText, ContentMode.HTML);
primary.addStyleName(Typography.Dark.Subheader.PRIMARY);
secondary = new Label(secondaryText, ContentMode.HTML);
secondary.addStyleName(Typography.Dark.Body1.SECONDARY);
content.addComponents(primary, secondary);
actionPrimary.addComponents(iconPrimary, content);
actionSecondary.addComponent(iconSecondary);
addComponents(actionPrimary, actionSecondary, divider);
}
示例2: ConfigView
public ConfigView() {
Label caption = new Label("Raw Configuration");
Label description = new Label(
"This view shows the overall <b>raw</b> configuration configArea. Dependening on your access rights you" +
"may see partial or masked data. Similarly configuration can be <i>read-only</i> or <i>mutable</i>.",
ContentMode.HTML);
TabSheet tabPane = new TabSheet();
tabPane.setHeight("100%");
tabPane.setWidth("100%");
tabPane.addTab(createConfigTab(), "Configuration");
tabPane.addTab(createEnvTab(), "Environment Properties");
tabPane.addTab(createSysPropsTab(), "System Properties");
tabPane.addTab(createRuntimeTab(), "Runtime Properties");
addComponents(caption, description, tabPane);
caption.addStyleName(UIConstants.LABEL_HUGE);
description.addStyleName(UIConstants.LABEL_LARGE);
}
示例3: genInfo
private Component genInfo() {
VerticalLayout info = new VerticalLayout();
info.setMargin(true);
info.setWidth("320px");
info.setHeight("100%");
info.addStyleName("black-bg");
Label details = new Label("<h3>Vaadin SliderPanel</h3>"
+ "<p>Developed by Marten Prieß<br/>"
+ "<a href=\"http://www.rocketbase.io\">www.rocketbase.io</a><p>"
+ "<p>Sample & Sourcecode:<br/><a href=\"https://github.com/melistik/vaadin-sliderpanel/\">github.com</a><br/>"
+ "Vaadin Addon-Site:<br/><a href=\"https://vaadin.com/directory#!addon/sliderpanel\">vaadin.com</a></p>", ContentMode.HTML);
details.setSizeFull();
info.addComponentsAndExpand(details);
info.addComponent(new Label("<p class=\"version\">Version: " + buildVersion + "</p>", ContentMode.HTML));
return info;
}
示例4: dummyContent
private VerticalLayout dummyContent(final String title, final int length) {
String text = "";
for (int x = 0; x <= length; x++) {
text += LOREM_IPSUM + " ";
}
Label htmlDummy = new Label(String.format("<h3>%s</h3>%s", title, text.trim()), ContentMode.HTML);
VerticalLayout component = new VerticalLayout(htmlDummy);
component.setExpandRatio(htmlDummy, 1);
component.addComponent(new Button(title, new Button.ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
Notification.show("clicked: " + title, Type.HUMANIZED_MESSAGE);
}
}));
component.setMargin(true);
component.setSpacing(true);
return component;
}
示例5: createOldWaySourceWindow
private Window createOldWaySourceWindow() {
Window sourceWindow = new Window("Example");
VerticalLayout content = new VerticalLayout();
content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
Label sourceCode = new Label("<pre><code>" + " final TextArea anotherArea = new TextArea();\n"
+ " anotherArea.setId(\"clipboardTarget\");\n"
+ " anotherArea.setValue(\"Another example to copy to clipboard\");\n" + "\n"
+ " ClipboardButton clipboardButton = new ClipboardButton(\"clipboardTarget\");\n"
+ " clipboardButton.addSuccessListener(new ClipboardButton.SuccessListener() {\n" + "\n"
+ " @Override\n" + " public void onSuccess() {\n"
+ " Notification.show(\"Copy to clipboard successful\");\n" + " }\n"
+ " });\n" + " clipboardButton.addErrorListener(new ClipboardButton.ErrorListener() {\n"
+ "\n" + " @Override\n" + " public void onError() {\n"
+ " Notification.show(\"Copy to clipboard unsuccessful\", Notification.Type.ERROR_MESSAGE);\n"
+ " }\n" + " });</code></pre>", ContentMode.HTML);
content.addComponent(new HorizontalLayout(sourceCode));
sourceWindow.setContent(content);
sourceWindow.setHeight("400px");
return sourceWindow;
}
示例6: SingleLineListItem
public SingleLineListItem(String primaryText, boolean verticalPadding) {
super(verticalPadding);
addStyleName("single-line");
setHeight(Metrics.List.SINGLE_LINE_HEIGHT, Unit.PIXELS);
primary = new Label(primaryText, ContentMode.HTML);
primary.addStyleName(Typography.Dark.Subheader.PRIMARY);
content.addComponent(primary);
actionPrimary.addComponents(iconPrimary, content);
actionSecondary.addComponent(iconSecondary);
addComponents(actionPrimary, actionSecondary, divider);
}
示例7: Step2
public Step2() {
super(true); // Use default actions
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label stepAttributesTitle = new Label("Step Attributes");
stepAttributesTitle.addStyleName(ValoTheme.LABEL_H2);
Label stepAttributesLabel = new Label("You can change various attributes on a single step:" +
"<ul>" +
"<li>caption</li>" +
"<li>description</li>" +
"<li>icon</li>" +
"<li>optional (to be able to skip it)</li>" +
"<li>editable (come back if skipped or next, show edit " +
"icon)" +
"</li>" +
"</ul>", ContentMode.HTML);
content.addComponent(stepAttributesTitle);
content.addComponent(stepAttributesLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
setCaption("Step 2");
setDescription("Step Attributes");
setContent(content);
setIcon(VaadinIcons.BAR_CHART);
setOptional(true);
setEditable(true);
}
示例8: Step3
public Step3() {
VerticalLayout content = new VerticalLayout();
content.setWidth(100, Sizeable.Unit.PERCENTAGE);
content.setSpacing(true);
content.setMargin(true);
Label feedbackTitle = new Label("Step Feedback");
feedbackTitle.addStyleName(ValoTheme.LABEL_H2);
Label stepFeedbackLabel = new Label("The stepper provides the possibility to show a " +
"feedback message for long running operations.<br>Just " +
"click next to see an example.", ContentMode.HTML);
content.addComponent(feedbackTitle);
content.addComponent(stepFeedbackLabel);
content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE));
addStepBackListener(StepperActions::back);
addStepNextListener(event -> {
Stepper stepper = event.getSource();
stepper.showFeedbackMessage("Long loading operation is being performed");
UI currentUi = UI.getCurrent();
new Timer().schedule(new TimerTask() {
@Override
public void run() {
currentUi.access(() -> {
stepper.hideFeedbackMessage();
stepper.next();
});
}
}, 2000);
});
setCaption("Step 3");
setDescription("Long running Operations");
setContent(content);
}
示例9: Step4
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);
}
示例10: Step1
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);
}
示例11: Card
private Card(String title) {
Label titleLabel = new Label(String.format("%s", title), ContentMode.HTML);
titleLabel.setStyleName("persephone-card-title");
this.addComponent(titleLabel);
this.setStyleName("persephone-card");
}
示例12: init
@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));
}
示例13: setDescription
void setDescription(String description, ContentMode contentMode) {
Element element = getInput();
if (description == null || description.isEmpty() || description.trim().isEmpty()) {
if (hasFeedback) {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(this.feedback));
} else {
Roles.getTextboxRole().removeAriaDescribedbyProperty(element);
}
small.setInnerHTML(isDescriptionHeightReservedIfEmpty ? " " : "");
hasDescription = false;
return;
}
if (!hasDescription) {
if (hasFeedback) {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(small), Id.of(this.feedback));
} else {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(small));
}
hasDescription = true;
}
if (ContentMode.HTML == contentMode) {
small.setInnerHTML(description);
} else {
small.setInnerText(description);
}
}
示例14: setFeedback
void setFeedback(String feedback, ContentMode contentMode) {
Element element = getInput();
if (feedback == null || feedback.isEmpty() || feedback.trim().isEmpty()) {
if (hasDescription) {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(small));
} else {
Roles.getTextboxRole().removeAriaDescribedbyProperty(element);
}
this.feedback.setInnerHTML(isFeedbackHeightReservedIfEmpty ? " " : "");
hasFeedback = false;
return;
}
if (!hasFeedback) {
if (hasDescription) {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(small), Id.of(this.feedback));
} else {
Roles.getTextboxRole().setAriaDescribedbyProperty(element, Id.of(this.feedback));
}
hasFeedback = true;
}
if (ContentMode.HTML == contentMode) {
this.feedback.setInnerHTML(feedback);
} else {
this.feedback.setInnerText(feedback);
}
}
示例15: FormGroupAlert
public FormGroupAlert(String text, BootstrapAlertMode mode, BootstrapTextAlign textAlign) {
super(text, ContentMode.HTML);
// apply a new primary style name
setPrimaryStyleName(BootstrapCss.ALERT);
// set 100% as default width, so bootstrap can handle all sizing
setWidth(100, Unit.PERCENTAGE);
// apply mode to the Label
setMode(mode);
// apply textAlign to the Label
setTextAlign(textAlign);
}