当前位置: 首页>>代码示例>>Java>>正文


Java Image.setSource方法代码示例

本文整理汇总了Java中com.vaadin.ui.Image.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setSource方法的具体用法?Java Image.setSource怎么用?Java Image.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.Image的用法示例。


在下文中一共展示了Image.setSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
        }
    }
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:28,代码来源:ImageSelector.java

示例2: generateCell

import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    User user = (User) itemId;
    Image image = new Image();
    image.addStyleName("users-menu-image");
    if (user.getImage() != null) {
        StreamResource.StreamSource imagesource = new UserImageSource(user.getImage().toStream());
        StreamResource resource = new StreamResource(imagesource, UUID.randomUUID().toString());
        image.setSource(resource);
    } else {
        image.setSource(new ThemeResource("img/profile-pic-300px.jpg"));
    }

    ValoUserItemButton btnUsername = new ValoUserItemButton(user, ValoUserItemButton.TYPE.USER_NAME);
    ValoUserItemButton btnFullName = new ValoUserItemButton(user, ValoUserItemButton.TYPE.FULL_NAME);

    VerticalLayout nameLayout = new VerticalLayout(btnFullName, btnUsername);
    nameLayout.setSizeFull();
    nameLayout.setComponentAlignment(btnFullName, Alignment.BOTTOM_LEFT);
    nameLayout.setComponentAlignment(btnUsername, Alignment.TOP_LEFT);

    HorizontalLayout usersHorizontalLayout = new HorizontalLayout(image, nameLayout);
    usersHorizontalLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    usersHorizontalLayout.setComponentAlignment(nameLayout, Alignment.MIDDLE_LEFT);
    usersHorizontalLayout.setExpandRatio(nameLayout, 1f);
    usersHorizontalLayout.addStyleName("users-horizontal-layout");
    usersHorizontalLayout.setWidth(100, Unit.PERCENTAGE);
    usersHorizontalLayout.setHeight(45, Unit.PIXELS);
    usersHorizontalLayout.setSpacing(true);

    return usersHorizontalLayout;
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:33,代码来源:UsersMenu.java

示例3: getMinifiedView

import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Component getMinifiedView() {
	Image img = new Image();
	img.setSource(getFilterIcon());
	img.setDescription(getFilterStateDesc());
	
	return img;
}
 
开发者ID:villeteam,项目名称:vexer,代码行数:9,代码来源:TemplateSubmissionStatisticsGiver.java


注:本文中的com.vaadin.ui.Image.setSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。