本文整理汇总了Java中com.vaadin.ui.Image类的典型用法代码示例。如果您正苦于以下问题:Java Image类的具体用法?Java Image怎么用?Java Image使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Image类属于com.vaadin.ui包,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: getLegendLineLayout
import com.vaadin.ui.Image; //导入依赖的package包/类
/**
* @param txtCode
* @return une ligne de légende
*/
private HorizontalLayout getLegendLineLayout(String txtCode) {
HorizontalLayout hlLineLegend = new HorizontalLayout();
hlLineLegend.setWidth(100, Unit.PERCENTAGE);
hlLineLegend.setSpacing(true);
Image flagImg = new Image(null, new ThemeResource("images/icon/Flag-" + txtCode + "-icon.png"));
Label label = new Label(applicationContext.getMessage("formation.table.flagEtat.tooltip." + txtCode, null,
UI.getCurrent().getLocale()));
hlLineLegend.addComponent(flagImg);
hlLineLegend.setComponentAlignment(flagImg, Alignment.MIDDLE_LEFT);
hlLineLegend.addComponent(label);
hlLineLegend.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
hlLineLegend.setExpandRatio(label, 1);
return hlLineLegend;
}
示例3: buildMovieDetails
import com.vaadin.ui.Image; //导入依赖的package包/类
private Component buildMovieDetails(final Movie movie,
final Date startTime, final Date endTime) {
HorizontalLayout details = new HorizontalLayout();
details.setWidth(100.0f, Unit.PERCENTAGE);
details.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
details.setMargin(true);
details.setSpacing(true);
final Image coverImage = new Image(null, new ExternalResource(
movie.getThumbUrl()));
coverImage.addStyleName("cover");
details.addComponent(coverImage);
Component detailsForm = buildDetailsForm(movie, startTime, endTime);
details.addComponent(detailsForm);
details.setExpandRatio(detailsForm, 1);
return details;
}
示例4: ImageSelector
import com.vaadin.ui.Image; //导入依赖的package包/类
public ImageSelector() {
images = new LinkedList<DSImage>();
visibleImages = new HashMap<Integer, Image>();
loadedImages = new LinkedList<Image>();
mainPanel = new Panel();
imageLayout = new HorizontalLayout();
layout = new HorizontalLayout();
imageMaxWidth = 110;
imageMaxHeight = 110;
leftButton = new Button("<", e -> scrollLeft());
rightButton = new Button(">", e -> scrollRight());
leftButton.setEnabled(false);
rightButton.setEnabled(false);
}
示例5: scrollTo
import com.vaadin.ui.Image; //导入依赖的package包/类
public void scrollTo(int index) {
if (index >= 0 && maxAllowed > 0) {
visibleImages.clear();
imageLayout.removeAllComponents();
if (index > (loadedImages.size() - maxAllowed)) {
index = loadedImages.size() - maxAllowed;
}
for (int i = index; i < (index + maxAllowed); i++) {
Image image = loadedImages.get(i);
addVisibleImage(i, image);
imageLayout.addComponent(image);
}
this.index = index;
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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);
}
}
示例10: AboutWindow
import com.vaadin.ui.Image; //导入依赖的package包/类
public AboutWindow() {
MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth();
this.setContent(content);
Image about = new Image("", new ExternalResource(StorageUtils.generateAssetRelativeLink(WebResourceIds._about)));
MVerticalLayout rightPanel = new MVerticalLayout();
ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion()));
Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"),
System.getProperty("java.runtime.version")));
Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath());
WebBrowser browser = Page.getCurrent().getWebBrowser();
Label osLbl = new Label(String.format("%s, %s", System.getProperty("os.name"),
browser.getBrowserApplication()));
osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
Div licenseDiv = new Div().appendChild(new Text("Powered by: "))
.appendChild(new A("https://www.mycollab.com")
.appendText("MyCollab")).appendChild(new Text(". Open source under GPL license"));
Label licenseLbl = ELabel.html(licenseDiv.write());
Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011",
new GregorianCalendar().get(Calendar.YEAR) + ""));
rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl)
.withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
content.with(about, rightPanel).expand(rightPanel);
}
示例11: AttachmentPreviewView
import com.vaadin.ui.Image; //导入依赖的package包/类
public AttachmentPreviewView() {
CssLayout imgWrap = new CssLayout();
imgWrap.setStyleName("image-wrap");
imgWrap.setSizeFull();
this.setStyleName("attachment-preview-view");
this.setSizeFull();
this.addComponent(imgWrap, "top: 0px left: 0px; z-index: 0;");
backBtn = new NavigationButton(UserUIContext.getMessage(GenericI18Enum.M_BUTTON_BACK));
backBtn.setStyleName("back-btn");
this.addComponent(backBtn, "top: 15px; left: 15px; z-index: 1;");
previewImage = new Image();
imgWrap.addComponent(previewImage);
}
示例12: createEmailIcon
import com.vaadin.ui.Image; //导入依赖的package包/类
private Image createEmailIcon(EmailContact emailContact)
{
final String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
final FileResource resource = new FileResource(new File(basepath + "/images/email.png"));
Image image = new Image(null, resource);
image.setDescription("Click to send an email");
image.setVisible(false);
image.addClickListener(new MouseEventLogged.ClickListener()
{
private static final long serialVersionUID = 1L;
@Override
public void clicked(final com.vaadin.event.MouseEvents.ClickEvent event)
{
showMailForm(emailContact);
}
});
return image;
}
示例13: AboutView
import com.vaadin.ui.Image; //导入依赖的package包/类
public AboutView() {
setCaption(Messages.getString("aboutTitle")); //$NON-NLS-1$
setModal(true);
setResizable(false);
center();
VerticalLayout main = new VerticalLayout();
Resource logoResource = new ThemeResource("img/omc-logo.png"); //$NON-NLS-1$
Image appLogoImage = new Image("",logoResource); //$NON-NLS-1$
Label appLabel = new Label(appName + " v." + version); //$NON-NLS-1$
Label developerLabel = new Label(developer);
Link githubLink = new Link(github, new ExternalResource(github));
main.addComponents(appLogoImage, appLabel, developerLabel, githubLink);
main.setComponentAlignment(appLabel, Alignment.MIDDLE_CENTER);
main.setComponentAlignment(developerLabel, Alignment.MIDDLE_CENTER);
main.setComponentAlignment(githubLink, Alignment.MIDDLE_CENTER);
setContent(main);
}
示例14: setIcon
import com.vaadin.ui.Image; //导入依赖的package包/类
public void setIcon(Resource source) {
if (source == null) {
this.icon.setVisible(false);
} else {
this.icon.setVisible(true);
this.icon.removeAllComponents();
if (source instanceof FontIcon) {
this.icon.addComponent(new Label(((FontIcon) source).getHtml(), ContentMode.HTML));
} else {
this.icon.addComponent(new Image(null, source));
}
}
}
示例15: init
import com.vaadin.ui.Image; //导入依赖的package包/类
@PostConstruct
void init() {
VerticalLayout encabezado = new VerticalLayout();
encabezado.setSizeUndefined();
Image logo = new Image(null,
new ThemeResource("img/Header2.jpg"));
encabezado.addComponent(logo);
encabezado.setComponentAlignment(logo, Alignment.TOP_LEFT);
addComponent(encabezado);
setComponentAlignment(encabezado, Alignment.TOP_LEFT);
contenedor.setSpacing(true);
contenedor.setSizeUndefined();
contenedor.setMargin(true);
contenedor.addComponent(txtUsuario, 1, 1);
contenedor.addComponent(txtPassword, 1, 2);
errorIngreso.setVisible(false);
contenedor.addComponent(errorIngreso, 1, 3);
btnIngresar.setImmediate(true);
btnIngresar.setClickShortcut(KeyCode.ENTER);
btnIngresar.setIcon(FontAwesome.SIGN_IN);
contenedor.addComponent(btnIngresar, 1, 4);
contenedor.setComponentAlignment(btnIngresar, Alignment.BOTTOM_CENTER);
addComponent(contenedor);
setComponentAlignment(contenedor, Alignment.MIDDLE_CENTER);
setListener();
}