本文整理汇总了Java中com.vaadin.ui.Image.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Image.getWidth方法的具体用法?Java Image.getWidth怎么用?Java Image.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Image
的用法示例。
在下文中一共展示了Image.getWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addWoundAtPosition
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public void addWoundAtPosition(WoundPosition woundPosition) {
if (!markedWounds.containsKey(woundPosition)) {
Image image = getImage(WOUND_INDICATOR);
if (woundManager.getWoundAtWoundPosition(woundPosition).getEndDate() != null) {
image = getImage(WOUND_HEALED_INDICATOR);
}
image.addClickListener(woundClickListener);
image.setDescription(woundPosition.getDescription());
image.setAlternateText(woundPosition.getDescription());
// Removing half the size of the indicator to put the click position in the middle of the indicator
float correctedXPos = (float) scaleFactor*(woundPosition.getXPosition() - (image.getWidth() / 2));
float correctedYPos = (float) scaleFactor*(woundPosition.getYPosition() - (image.getHeight() / 2));
ComponentPosition imagePosition = new ComponentPosition();
imagePosition.setLeft((float)correctedXPos, Unit.PIXELS);
imagePosition.setTop((float)correctedYPos, Unit.PIXELS);
image.setData(woundPosition);
markedWounds.put(woundPosition, image);
addComponent(image);
setPosition(image, imagePosition);
}
}
示例2: 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);
}
}