本文整理汇总了Java中com.vaadin.ui.Image.addStyleName方法的典型用法代码示例。如果您正苦于以下问题:Java Image.addStyleName方法的具体用法?Java Image.addStyleName怎么用?Java Image.addStyleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Image
的用法示例。
在下文中一共展示了Image.addStyleName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: doSetValue
import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
protected void doSetValue(DSImage value) {
if (isSelectable()) {
visibleImages.values().stream().forEach(image -> image.removeStyleName("image-bordered-selected"));
if (value != null) {
Image selected = loadedImages.get(value.getIndex());
selected.addStyleName("image-bordered-selected");
}
selectedImage = value;
}
}
示例3: 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;
}
示例4: generateRow
import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleProjectMember> host, final SimpleProjectMember member, int
rowIndex) {
MHorizontalLayout mainLayout = new MHorizontalLayout().withMargin(true).withFullWidth();
Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 48);
memberAvatar.addStyleName(UIConstants.CIRCLE_BOX);
MVerticalLayout memberInfoLayout = new MVerticalLayout().withMargin(false);
mainLayout.with(memberAvatar, memberInfoLayout).expand(memberInfoLayout);
A memberLink = new A(ProjectLinkGenerator.generateProjectMemberLink(CurrentProjectVariables
.getProjectId(), member.getUsername())).appendText(member.getDisplayName());
Label memberLbl = ELabel.html(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS);
memberInfoLayout.addComponent(memberLbl);
if (Boolean.TRUE.equals(AppUI.getBillingAccount().getDisplayemailpublicly())) {
Label memberEmailLabel = ELabel.html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername()))
.withStyleName(UIConstants.META_INFO);
memberInfoLayout.addComponent(memberEmailLabel);
}
ELabel memberSinceLabel = ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getJoindate())))
.withDescription(UserUIContext.formatDateTime(member.getJoindate())).withStyleName(UIConstants.META_INFO);
memberInfoLayout.addComponent(memberSinceLabel);
ELabel lastAccessTimeLbl = ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN,
UserUIContext.formatPrettyTime(member.getLastAccessTime())))
.withDescription(UserUIContext.formatDateTime(member.getLastAccessTime())).withStyleName(UIConstants.META_INFO);
memberInfoLayout.addComponent(lastAccessTimeLbl);
String memberWorksInfo = String.format("%s %s %s %s %s %s %s %s", ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml(), new Span().appendText("" + member.getNumOpenTasks()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)), ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml(), new Span().appendText("" + member.getNumOpenBugs())
.setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)), FontAwesome.MONEY.getHtml(), new Span().appendText("" + NumberUtils.roundDouble(2,
member.getTotalBillableLogTime())).setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)), FontAwesome.GIFT.getHtml(), new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime()))
.setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)));
Label memberWorkStatus = ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO).withFullWidth();
memberInfoLayout.addComponent(new MCssLayout(memberWorkStatus).withFullWidth());
return mainLayout;
}
示例5: generateRow
import com.vaadin.ui.Image; //导入方法依赖的package包/类
@Override
public Component generateRow(IBeanList<SimpleProjectMember> host, SimpleProjectMember member, int rowIndex) {
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName("list-row");
Image userAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 48);
userAvatar.addStyleName(UIConstants.CIRCLE_BOX);
layout.addComponent(userAvatar);
VerticalLayout content = new VerticalLayout();
content.addComponent(new ELabel(buildAssigneeValue(member), ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS));
layout.with(content).expand(content);
CssLayout footer = new CssLayout();
String roleVal;
if (member.isProjectOwner()) {
roleVal = UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY);
} else {
roleVal = member.getRoleName();
}
ELabel memberRole = ELabel.html(roleVal).withDescription(UserUIContext.getMessage(ProjectRoleI18nEnum.SINGLE))
.withStyleName(UIConstants.META_INFO);
footer.addComponent(memberRole);
String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " +
new Span().appendText("" + member.getNumOpenTasks()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) +
" " +
ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " +
new Span().appendText("" + member.getNumOpenBugs()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " "
+ FontAwesome.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2,
member.getTotalBillableLogTime())).setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " +
FontAwesome.GIFT.getHtml() +
" " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime()))
.setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS));
ELabel memberWorkStatus = ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO);
footer.addComponent(memberWorkStatus);
content.addComponent(footer);
return layout;
}
示例6: ProjectMemberBlock
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public ProjectMemberBlock(String username, String userAvatarId, String displayName) {
withMargin(false).withWidth("80px");
Image userAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 48, displayName);
userAvatar.addStyleName(UIConstants.CIRCLE_BOX);
A userLink = new A().setId("tag" + TooltipHelper.TOOLTIP_ID).
setHref(ProjectLinkGenerator.generateProjectMemberLink(CurrentProjectVariables.getProjectId(),
username)).appendText(StringUtils.trim(displayName, 30, true));
userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(username));
userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
ELabel userLbl = ELabel.html(userLink.write()).withStyleName(ValoTheme.LABEL_SMALL);
with(userAvatar, userLbl);
}
示例7: UserBlock
import com.vaadin.ui.Image; //导入方法依赖的package包/类
public UserBlock(String username, String userAvatarId, String displayName) {
withMargin(false).withWidth("80px");
Image avatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(userAvatarId, 48);
avatar.addStyleName(UIConstants.CIRCLE_BOX);
A userLink = new A().setId("tag" + TooltipHelper.TOOLTIP_ID).setHref(AccountLinkGenerator.generateUserLink(username))
.appendText(StringUtils.trim(displayName, 30, true));
userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(username));
userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
with(avatar, ELabel.html(userLink.write()));
}
示例8: init
import com.vaadin.ui.Image; //导入方法依赖的package包/类
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
/* Style */
setMargin(true);
setSpacing(true);
setSizeFull();
/* Titre */
HorizontalLayout hlLangue = new HorizontalLayout();
hlLangue.setWidth(100, Unit.PERCENTAGE);
hlLangue.setSpacing(true);
/*Le titre*/
labelTitle.addStyleName(StyleConstants.VIEW_TITLE);
hlLangue.addComponent(labelTitle);
hlLangue.setExpandRatio(labelTitle, 1);
hlLangue.setComponentAlignment(labelTitle, Alignment.MIDDLE_LEFT);
if (cacheController.getLangueEnServiceWithoutDefault().size()>0){
Langue langueDef = cacheController.getLangueDefault();
Image flagDef = new Image(null, new ThemeResource("images/flags/"+langueDef.getCodLangue()+".png"));
flagDef.addClickListener(e->updateLangue(langueDef));
flagDef.addStyleName(StyleConstants.CLICKABLE);
hlLangue.addComponent(flagDef);
hlLangue.setComponentAlignment(flagDef, Alignment.MIDDLE_CENTER);
cacheController.getLangueEnServiceWithoutDefault().forEach(langue->{
Image flag = new Image(null, new ThemeResource("images/flags/"+langue.getCodLangue()+".png"));
flag.addClickListener(e->updateLangue(langue));
flag.addStyleName(StyleConstants.CLICKABLE);
hlLangue.addComponent(flag);
hlLangue.setComponentAlignment(flag, Alignment.MIDDLE_CENTER);
});
}
addComponent(hlLangue);
/*Panel scrollable de contenu*/
Panel panelContent = new Panel();
panelContent.setSizeFull();
panelContent.addStyleName(ValoTheme.PANEL_BORDERLESS);
addComponent(panelContent);
setExpandRatio(panelContent, 1);
VerticalLayout vlContent = new VerticalLayout();
vlContent.setSpacing(true);
panelContent.setContent(vlContent);
restResult.setContentMode(ContentMode.HTML);
restResult.addStyleName(StyleConstants.LABEL_MORE_BOLD);
restResult.addStyleName(ValoTheme.LABEL_COLORED);
restResult.setValue("");
vlContent.addComponent(restResult);
/* Texte */
labelAccueil.setValue("");
labelAccueil.setContentMode(ContentMode.HTML);
vlContent.addComponent(labelAccueil);
connexionLayout.addStyleName(StyleConstants.MAX_WIDTH_500);
connexionLayout.addCasListener(()->userController.connectCAS());
connexionLayout.addStudentListener((user,pwd)->userController.connectCandidatInterne(user, pwd));
connexionLayout.addForgotPasswordListener(()->{UI.getCurrent().addWindow(new CandidatIdOublieWindow(ConstanteUtils.FORGOT_MODE_ID_OUBLIE));});
connexionLayout.addForgotCodeActivationListener(()->{UI.getCurrent().addWindow(new CandidatIdOublieWindow(ConstanteUtils.FORGOT_MODE_CODE_ACTIVATION));});
vlContent.addComponent(connexionLayout);
}