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


Java Image.setWidth方法代码示例

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


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

示例1: SimplyAsAnImageOrIcon

import com.vaadin.ui.Image; //导入方法依赖的package包/类
public SimplyAsAnImageOrIcon() {
    setCaption("Image and icon");
    addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth());
    Image image = new Image(null, new ClassResource("/pull.svg"));
    image.setWidth("300px");
    addComponent(image);
    
    addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth());
    
    Button button = new Button();
    button.setIcon(new ClassResource("/vaadin-logo.svg"));
    button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE);
    addComponent(button);
}
 
开发者ID:mstahv,项目名称:svgexamples,代码行数:15,代码来源:SimplyAsAnImageOrIcon.java

示例2: 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;
}
 
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:19,代码来源:CustomerDetailsGenerator.java

示例3: 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;
}
 
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:19,代码来源:StaticCustomerDetailsGenerator.java

示例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;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:33,代码来源:ScheduleView.java

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

示例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;
    }
}
 
开发者ID:datenhahn,项目名称:componentrenderer,代码行数:29,代码来源:ViewComponents.java

示例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;
}
 
开发者ID:fau-amos-2014-team-2,项目名称:root,代码行数:32,代码来源:WoundSelector.java

示例8: addImage

import com.vaadin.ui.Image; //导入方法依赖的package包/类
private void addImage(final File imageFile) {
    FileResource imageResource = new FileResource(imageFile);

    // Frame list
    Image image = new Image(null, imageResource);
    image.setWidth("104px");
    final CssLayout wrapper = new CssLayout();
    wrapper.addComponent(image);
    image.addClickListener(new ClickListener() {

        @Override
        public void click(ClickEvent event) {
            framesLayout.removeComponent(wrapper);
            preview.removeImage(imageFiles.indexOf(imageFile));
            imageFiles.remove(imageFile);
            downloadButton.setEnabled(!imageFiles.isEmpty());
        }
    });
    framesLayout.addComponent(wrapper);

    // Add to preview animation
    preview.addImage(imageResource);

    // Add to our internal list
    imageFiles.add(imageFile);
    if (imageFiles.size() > 1) {
        webcamAndGif.replaceComponent(gifImage, preview);
        downloadButton.setEnabled(true);
    }
}
 
开发者ID:tehapo,项目名称:webcam,代码行数:31,代码来源:GifBoothUI.java

示例9: 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


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