本文整理汇总了Java中com.vaadin.ui.Image.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setHeight方法的具体用法?Java Image.setHeight怎么用?Java Image.setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Image
的用法示例。
在下文中一共展示了Image.setHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDetails
import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Component getDetails(Grid.RowReference rowReference) {
rowReference.getGrid().scrollTo(rowReference.getItemId());
Customer customer = (Customer)rowReference.getItemId();
HorizontalLayout layout = new HorizontalLayout();
layout.setHeight(300, Sizeable.Unit.PIXELS);
layout.setMargin(true);
layout.setSpacing(true);
Image image = new Image("", customer.getPhoto());
image.setHeight(200, Sizeable.Unit.PIXELS);
image.setWidth(200, Sizeable.Unit.PIXELS);
layout.addComponent(image);
Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML);
layout.addComponent(nameLabel);
layout.setExpandRatio(nameLabel, 1.0f);
return layout;
}
示例2: getDetails
import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Component getDetails(Grid.RowReference rowReference) {
rowReference.getGrid().scrollTo(rowReference.getItemId());
StaticCustomer customer = (StaticCustomer)rowReference.getItemId();
HorizontalLayout layout = new HorizontalLayout();
layout.setHeight(300, Sizeable.Unit.PIXELS);
layout.setMargin(true);
layout.setSpacing(true);
Image image = new Image("", customer.getPhoto());
image.setHeight(200, Sizeable.Unit.PIXELS);
image.setWidth(200, Sizeable.Unit.PIXELS);
layout.addComponent(image);
Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML);
layout.addComponent(nameLabel);
layout.setExpandRatio(nameLabel, 1.0f);
return layout;
}
示例3: 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;
}
示例4: buildCatalogView
import com.vaadin.ui.Image; //导入方法依赖的package包/类
private Component buildCatalogView() {
CssLayout catalog = new CssLayout();
catalog.setCaption("Catalog");
catalog.addStyleName("catalog");
for (final Movie movie : DashboardUI.getDataProvider().getMovies()) {
VerticalLayout frame = new VerticalLayout();
frame.addStyleName("frame");
frame.setWidthUndefined();
Image poster = new Image(null, new ExternalResource(
movie.getThumbUrl()));
poster.setWidth(100.0f, Unit.PIXELS);
poster.setHeight(145.0f, Unit.PIXELS);
frame.addComponent(poster);
Label titleLabel = new Label(movie.getTitle());
titleLabel.setWidth(120.0f, Unit.PIXELS);
frame.addComponent(titleLabel);
frame.addLayoutClickListener(new LayoutClickListener() {
@Override
public void layoutClick(final LayoutClickEvent event) {
if (event.getButton() == MouseButton.LEFT) {
MovieDetailsWindow.open(movie, null, null);
}
}
});
catalog.addComponent(frame);
}
return catalog;
}
示例5: addImage
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public void addImage(DSImage image) {
image.setIndex(images.size());
images.add(image);
Image loadedImage = new Image();
loadedImage.setSource(image.getResource());
if (loadedImage.getWidth() > imageMaxWidth) {
loadedImage.setWidth(imageMaxWidth, Unit.PIXELS);
}
if (loadedImage.getHeight() > imageMaxHeight) {
loadedImage.setHeight(imageMaxHeight, Unit.PIXELS);
}
loadedImage.setData(image.getIndex());
loadedImage.addClickListener(event -> {
if (isSelectable()) {
DSImage clicked = images.get((int) loadedImage.getData());
// Notification.show(selectedImage.toString(), Type.HUMANIZED_MESSAGE);
setValue(clicked);
}
});
loadedImages.add(loadedImage);
if (visibleImages.size() < maxAllowed || maxAllowed < 0) {
addVisibleImage(image.getIndex(), loadedImage);
}
}
示例6: createDetailsIcons
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public static Image createDetailsIcons(Grid grid, Customer customer) {
final Image imageDown = new Image("", new ThemeResource("../demotheme/img/caret-down.png"));
final Image imageUp = new Image("", new ThemeResource("../demotheme/img/caret-up.png"));
imageDown.setCaption(null);
imageDown.setHeight(32, Sizeable.Unit.PIXELS);
imageDown.setWidth(32, Sizeable.Unit.PIXELS);
imageUp.setCaption(null);
imageUp.setHeight(32, Sizeable.Unit.PIXELS);
imageDown.setWidth(32, Sizeable.Unit.PIXELS);
imageDown.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, null) {
@Override
public void handleAction(Object sender, Object target) {
if (sender == imageDown || sender == imageUp) {
Notification.show("Shortcut captured");
grid.setDetailsVisible(customer, !grid.isDetailsVisible(customer));
}
}
});
imageDown.addClickListener(event -> grid.setDetailsVisible(customer, true));
imageUp.addClickListener(event -> grid.setDetailsVisible(customer, false));
if (grid.isDetailsVisible(customer)) {
return imageUp;
} else {
return imageDown;
}
}
示例7: getImage
import com.vaadin.ui.Image; //导入方法依赖的package包/类
private Image getImage(String imageFilename) {
String basePath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
String filePath = basePath + "/" + imageFilename;
File imageFile = new File(filePath);
BufferedImage bufferedImage;
Image image = new Image(null, new FileResource(imageFile));
if (imageFilename == BODY_IMAGE || imageFilename == BODY_IMAGE_FEMALE || imageFilename == BODY_IMAGE_MALE) {
image.setHeight(Math.round(scaleFactor*BODY_IMAGE_HEIGHT), Unit.PIXELS);
image.setWidth(Math.round(scaleFactor*BODY_IMAGE_WIDTH), Unit.PIXELS);
}
else if (imageFilename == SELECTION_INDICATOR
|| imageFilename == WOUND_INDICATOR
|| imageFilename == WOUND_HEALED_INDICATOR
|| imageFilename == WOUND_SELECTION_INDICATOR) {
image.setHeight(Math.round(scaleFactor*INDICATOR_HEIGHT), Unit.PIXELS);
image.setWidth(Math.round(scaleFactor*INDICATOR_WIDTH), Unit.PIXELS);
}
else {
// We need to load the image and get the size since Vaadin Touchkit cannot read the size itself
try {
bufferedImage = ImageIO.read(imageFile);
image.setHeight(Math.round(scaleFactor*bufferedImage.getHeight()), Unit.PIXELS);
image.setWidth(Math.round(scaleFactor*bufferedImage.getWidth()), Unit.PIXELS);
} catch (IOException e) {
// we fail silently and let Vaadin use autosizing
}
}
return image;
}
示例8: ConnectionInfo
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public ConnectionInfo(String providerName) {
super(providerName);
setSizeUndefined();
setWidth("100%");
this.providerName = providerName;
if (providerName.equals("Facebook")) {
setIcon(FontAwesome.FACEBOOK);
btnConnect = new Button("Connect to " + providerName, FontAwesome.FACEBOOK_SQUARE);
btnDisconnect = new Button("Disconnect from " + providerName, FontAwesome.FACEBOOK_SQUARE);
} else {
setIcon(FontAwesome.GOOGLE_PLUS);
btnConnect = new Button("Connect to " + providerName, FontAwesome.GOOGLE_PLUS_SQUARE);
btnDisconnect = new Button("Disconnect from " + providerName, FontAwesome.GOOGLE_PLUS_SQUARE);
}
layout = new HorizontalLayout();
layout.setWidth("100%");
layout.setSpacing(true);
layout.setMargin(true);
setContent(layout);
image = new Image();
image.setWidth("60px");
image.setHeight("60px");
info = new Label();
info.setContentMode(ContentMode.HTML);
info.setSizeUndefined();
info.addStyleName(ValoTheme.LABEL_LARGE);
layout.addComponents(image, info, btnConnect, btnDisconnect);
layout.setComponentAlignment(info, Alignment.MIDDLE_LEFT);
layout.setComponentAlignment(btnConnect, Alignment.MIDDLE_RIGHT);
layout.setComponentAlignment(btnDisconnect, Alignment.MIDDLE_RIGHT);
layout.setExpandRatio(info, 1);
btnConnect.addStyleName(ValoTheme.BUTTON_FRIENDLY);
btnDisconnect.addStyleName(ValoTheme.BUTTON_DANGER);
btnConnect.addClickListener(this);
btnDisconnect.addClickListener(this);
}
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecuritySocial,代码行数:44,代码来源:ConnectionInfo.java