本文整理汇总了Java中com.vaadin.ui.Image.setStyleName方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setStyleName方法的具体用法?Java Image.setStyleName怎么用?Java Image.setStyleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Image
的用法示例。
在下文中一共展示了Image.setStyleName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildHeader
import com.vaadin.ui.Image; //导入方法依赖的package包/类
protected Component buildHeader()
{
HorizontalLayout header = new HorizontalLayout();
header.setMargin(false);
header.setHeight(100.0f, Unit.PIXELS);
header.setWidth(100.0f, Unit.PERCENTAGE);
Image img = new Image(null, LOGO_ICON);
img.setHeight(90, Unit.PIXELS);
img.setStyleName(STYLE_LOGO);
header.addComponent(img);
Label title = new Label("SensorHub");
title.addStyleName(UIConstants.STYLE_H1);
title.addStyleName(STYLE_LOGO);
title.setWidth(null);
header.addComponent(title);
header.setExpandRatio(img, 0);
header.setExpandRatio(title, 1);
header.setComponentAlignment(img, Alignment.MIDDLE_LEFT);
header.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);
return header;
}
示例2: Menu
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public Menu(Navigator navigator) {
this.navigator = navigator;
setPrimaryStyleName(ValoTheme.MENU_ROOT);
menuPart = new CssLayout();
menuPart.addStyleName(ValoTheme.MENU_PART);
// header of the menu
final HorizontalLayout top = new HorizontalLayout();
top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
top.addStyleName(ValoTheme.MENU_TITLE);
top.setSpacing(true);
Label title = new Label("My CRUD");
title.addStyleName(ValoTheme.LABEL_H3);
title.setSizeUndefined();
Image image = new Image(null, new ThemeResource("img/table-logo.png"));
image.setStyleName("logo");
top.addComponent(image);
top.addComponent(title);
menuPart.addComponent(top);
// logout menu item
MenuBar logoutMenu = new MenuBar();
logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() {
@Override
public void menuSelected(MenuItem selectedItem) {
VaadinSession.getCurrent().getSession().invalidate();
Page.getCurrent().reload();
}
});
logoutMenu.addStyleName("user-menu");
menuPart.addComponent(logoutMenu);
// button for toggling the visibility of the menu when on a small screen
final Button showMenu = new Button("Menu", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
menuPart.removeStyleName(VALO_MENU_VISIBLE);
} else {
menuPart.addStyleName(VALO_MENU_VISIBLE);
}
}
});
showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
showMenu.addStyleName(VALO_MENU_TOGGLE);
showMenu.setIcon(FontAwesome.NAVICON);
menuPart.addComponent(showMenu);
// container for the navigation buttons, which are added by addView()
menuItemsLayout = new CssLayout();
menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
menuPart.addComponent(menuItemsLayout);
addComponent(menuPart);
}