本文整理汇总了Java中com.vaadin.shared.ui.ContentMode类的典型用法代码示例。如果您正苦于以下问题:Java ContentMode类的具体用法?Java ContentMode怎么用?Java ContentMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContentMode类属于com.vaadin.shared.ui包,在下文中一共展示了ContentMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AboutWindow
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
public AboutWindow() {
super("このアプリについて");
center();
setModal(true);
setWidth(400, Unit.PIXELS);
setHeight(300, Unit.PIXELS);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
layout.setSizeFull();
layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
setContent(layout);
layout.addComponent(new Label("<b><a href=\"https://github.com/JavaTrainingCourse/obog-manager\">" +
"obog-manager</a></b> v" + Version.OBOG_MANAGER_VERSION, ContentMode.HTML));
layout.addComponent(new Label("<b>AUTHORS</b><br/>" + String.join("<br/>", Version.INSTANCE.getAuthors()), ContentMode.HTML));
layout.addComponent(new Label("<div align=\"center\">Powered by " + VaadinIcons.VAADIN_V.getHtml() +
" Vaadin Framework<br/>(<a href=\"https://goo.gl/IIztDT\">紹介スライド</a>)</div>",
ContentMode.HTML));
Button closeButton = new Button("閉じる", e -> close());
layout.addComponent(closeButton);
layout.setComponentAlignment(closeButton, Alignment.BOTTOM_CENTER);
}
示例2: addItem
import com.vaadin.shared.ui.ContentMode; //导入依赖的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);
}
示例3: TwoLineListItem
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
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);
}
示例4: test
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
@Test
public void test() {
FLabel label = new FLabel().withCaption("<strong>My Label</strong>")
.withValue("<strong>label value</strong>")
.withCaptionAsHtml(true)
.withContentMode(ContentMode.HTML)
.withUndefinedWidth()
.withUndefinedHeight();
assertEquals("<strong>My Label</strong>", label.getCaption());
assertEquals("<strong>label value</strong>", label.getValue());
assertTrue(label.isCaptionAsHtml());
assertEquals(ContentMode.HTML, label.getContentMode());
assertEquals(-1, label.getWidth(), 0);
assertEquals(-1, label.getWidth(), 0);
}
示例5: ConfigView
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
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);
}
示例6: genInfo
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
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;
}
示例7: dummyContent
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
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;
}
示例8: WeatherPresentation
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
public WeatherPresentation(OpenWeatherMapEntry entry) {
addStyleName("weather-presentation");
String weatherStyleNames = "weather rating-" + entry.getRating().getStyleName();
Label name = new Label(entry.getName()
+ entry.getWeatherString().map(w -> " <span class=\"" + weatherStyleNames + "\">" + w + "</span>")
.orElse(""));
name.setContentMode(ContentMode.HTML);
name.addStyleName("name-and-weather");
name.setWidth(100, Unit.PERCENTAGE);
Label temperature = new Label(entry.getTemperatureString());
temperature.addStyleName("temperature");
temperature.setWidth(100, Unit.PERCENTAGE);
addComponents(name, temperature);
}
示例9: createOldWaySourceWindow
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
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;
}
示例10: init
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
private void init(){
if(!Objects.isNull(getTargetComponent())){
targetComponent = getTargetComponent();
}else{
Notification.show("EL componente target no puede ser nulo.");
return;
}
Label label = new Label(this.getExampleTitle());
label.setContentMode(ContentMode.HTML);
addComponent(new VerticalLayout(label,targetComponent));
TabSheet exmaplesTab = new TabSheet();
exmaplesTab.addTab(createNewWayCopyToClipboardUsingExtension(),"JSClipboard Extension");
exmaplesTab.addTab(createNewWayCopyToClipboardUsingWrapperButton(),"JSClipboardButton Extension");
exmaplesTab.addTab(createNewWayCopyToClipboardUsingWrapperButtonDisabled(),"JSClipboardButton Extension Disabled");
addComponent(new VerticalLayout(exmaplesTab));
}
示例11: setInfo
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
private void setInfo(HorizontalLayout info) {
info.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
Label logo = new Label(
"<b>JSClipboard Demo</b>");
logo.addStyleName(ValoTheme.LABEL_H2);
logo.setContentMode(ContentMode.HTML);
info.addComponent(logo);
Label label = new Label(
"This variant was done using the library <a href='https://clipboardjs.com/' >clipboard.js</a> as a Extension");
label.setContentMode(ContentMode.HTML);
info.addComponent(label);
Label git = new Label(
"<a href='https://github.com/vaadin4qbanos/vaadin-jsclipboard-addon'><b>GITHUB</b></a>");
git.setContentMode(ContentMode.HTML);
info.addComponent(git);
info.setComponentAlignment(git, Alignment.MIDDLE_RIGHT);
info.setComponentAlignment(logo, Alignment.MIDDLE_LEFT);
}
示例12: init
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
@PostConstruct
void init() {
LOGGER.info("I'm being created: {}", this);
setMargin(true);
setSpacing(true);
final Label label = new Label(String.format("This is a UI scoped view. The same instance is used every time this view is shown. " +
"This particular instance is <b>%s</b>. If you navigate away from this view and back, you'll notice that the instance remains the same.", this));
label.setContentMode(ContentMode.HTML);
addComponent(label);
addComponent(new Button("Invoke a UI scoped business object", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
addComponent(new Label(uiScopedBusinessObject.sayHello()));
}
}));
}
示例13: init
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
@PostConstruct
void init() {
LOGGER.info("I'm being created: {}", this);
setMargin(true);
setSpacing(true);
final Label label = new Label(String.format("This is a prototype scoped view. A new instance is created every time this view is shown. " +
"This particular instance is <b>%s</b>. If you navigate away from this view and back, you'll notice that the instance changes every time.", this));
label.setContentMode(ContentMode.HTML);
addComponent(label);
addComponent(new Button("Invoke a UI scoped business object", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
addComponent(new Label(uiScopedBusinessObject.sayHello()));
}
}));
}
示例14: init
import com.vaadin.shared.ui.ContentMode; //导入依赖的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));
}
示例15: enter
import com.vaadin.shared.ui.ContentMode; //导入依赖的package包/类
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
Label errorLabel = new Label("エラーが発生しました。");
errorLabel.setStyleName(ValoTheme.LABEL_FAILURE);
VaadinSession session = VaadinSession.getCurrent();
String paramMessage = (String) session.getAttribute(PARAM_MESSAGE);
if (paramMessage != null) {
addComponent(new Label(paramMessage));
}
session.setAttribute(PARAM_MESSAGE, null);
Throwable paramThrowable = (Throwable) session.getAttribute(PARAM_THROWABLE);
if (paramThrowable != null) {
addComponent(new Label(throwable2html(paramThrowable), ContentMode.HTML));
}
session.setAttribute(PARAM_THROWABLE, null);
log.error(paramMessage, paramThrowable);
if (paramThrowable instanceof AuthenticationException) {
Button loginButton = new Button("ログイン", click -> getUI().getNavigator().navigateTo(LoginView.VIEW_NAME));
addComponent(loginButton);
setComponentAlignment(loginButton, Alignment.MIDDLE_CENTER);
}
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}