本文整理汇总了Java中com.vaadin.ui.Image.setAlternateText方法的典型用法代码示例。如果您正苦于以下问题:Java Image.setAlternateText方法的具体用法?Java Image.setAlternateText怎么用?Java Image.setAlternateText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Image
的用法示例。
在下文中一共展示了Image.setAlternateText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: addLogo
import com.vaadin.ui.Image; //导入方法依赖的package包/类
private void addLogo(final VerticalLayout viewLayout)
{
final VerticalLayout layout = new VerticalLayout();
HorizontalLayout buttons = getLoginAccountButtons();
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setWidth("100%");
buttonLayout.addComponent(buttons);
buttonLayout.setComponentAlignment(buttons, Alignment.TOP_RIGHT);
layout.addComponent(buttonLayout);
// So the logo
final HorizontalLayout logoLayout = new HorizontalLayout();
logoLayout.setWidth("100%");
final String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
final FileResource resource = new FileResource(new File(basepath + "/images/scoutmaster-logo.png"));
final Image image = new Image(null, resource);
image.setAlternateText("Scoutmaster Logo");
logoLayout.addComponent(image);
layout.addComponent(logoLayout);
layout.setComponentAlignment(logoLayout, Alignment.TOP_LEFT);
viewLayout.addComponent(layout);
}
示例3: LoginView
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public LoginView()
{
setSizeFull();
// The view root layout
final VerticalLayout viewLayout = new VerticalLayout();
viewLayout.setSizeFull();
// viewLayout.setStyleName(ValoTheme.LAYOUT_BLACK);
final HorizontalLayout logo = new HorizontalLayout();
logo.setWidth("100%");
final String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
final FileResource resource = new FileResource(new File(basepath + "/images/scoutmaster-logo.png"));
final Image image = new Image(null, resource);
image.setAlternateText("Scoutmaster Logo");
logo.addComponent(image);
logo.setComponentAlignment(image, Alignment.TOP_RIGHT);
viewLayout.addComponent(logo);
final VerticalLayout fields = new VerticalLayout();
fields.setSpacing(true);
fields.setMargin(new MarginInfo(true, true, true, true));
fields.setSizeUndefined();
// Add both to a panel
final Label label = new Label("<H1>Login to Scoutmaster</H1>");
label.setContentMode(ContentMode.HTML);
fields.addComponent(label);
// Create the user input field
this.usernameField = new TextField("Username:");
this.usernameField.setWidth("300px");
this.usernameField.setRequired(true);
this.usernameField.setInputPrompt("Your username");
this.usernameField.setImmediate(true);
this.usernameField.setInvalidAllowed(false);
fields.addComponent(this.usernameField);
// Create the password input field
this.passwordField = new PasswordField("Password:");
this.passwordField.setWidth("300px");
this.passwordField.setRequired(true);
this.passwordField.setNullRepresentation("");
fields.addComponent(this.passwordField);
// Buttons
final HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
// Create login button
this.loginButton = new Button("Login", new ClickEventLogged.ClickAdaptor(this));
this.loginButton.setClickShortcut(KeyCode.ENTER);
this.loginButton.addStyleName(Reindeer.BUTTON_DEFAULT);
buttons.addComponent(this.loginButton);
buttons.setComponentAlignment(this.loginButton, Alignment.MIDDLE_LEFT);
this.forgottenButton = new Button("Forgotten Password", new ClickEventLogged.ClickAdaptor(this));
buttons.addComponent(this.forgottenButton);
buttons.setComponentAlignment(this.forgottenButton, Alignment.MIDDLE_RIGHT);
fields.addComponent(buttons);
viewLayout.addComponent(fields);
viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
setCompositionRoot(viewLayout);
viewLayout.addComponent(fields);
}