本文整理汇总了Java中com.vaadin.server.FontIcon类的典型用法代码示例。如果您正苦于以下问题:Java FontIcon类的具体用法?Java FontIcon怎么用?Java FontIcon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontIcon类属于com.vaadin.server包,在下文中一共展示了FontIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ToolbarButton
import com.vaadin.server.FontIcon; //导入依赖的package包/类
private ToolbarButton(ToolbarButtonBuilder builder) {
FontIcon icon = builder.icon;
if (icon != null) {
contentFA = icon.getHtml();
if (builder.iconText != null) {
contentFA += builder.iconText;
}
}
contentDefault = builder.iconFallback;
if (builder.customTranslation) {
aria = builder.aria;
} else {
// get buildin translations
aria = builder.toolbarBuilder.getOptionsBuilder().getTranslation(builder.aria);
}
name = builder.name;
action = builder.action;
if (action == null) {
action = name;
}
tagNames = builder.tagNames;
style = builder.style;
useQueryState = builder.useQueryState;
classList = builder.classList;
attrs = builder.attrs;
}
示例2: convertToPresentation
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public String convertToPresentation(FontIcon value, Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
if (value != null) {
return value.getHtml();
}
return null;
}
示例3: getDefaultPropertyConverter
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Optional<Converter<?, ?>> getDefaultPropertyConverter(final P property) {
Converter<?, ?> converter = null;
Class<?> type = getPropertyColumnType(property);
// FontIcons
if (type != null && FontIcon.class.isAssignableFrom(type)) {
converter = new FontIconPresentationConverter();
} else {
// Use default property presentation converter
if (Property.class.isAssignableFrom(property.getClass())) {
converter = new PropertyPresentationConverter<>((Property) property);
}
}
return Optional.ofNullable(converter);
}
示例4: getDefaultPropertyRenderer
import com.vaadin.server.FontIcon; //导入依赖的package包/类
/**
* Get the default {@link Renderer} for given <code>property</code>.
* @param property Property
* @return The default {@link Renderer}, if available
*/
protected Optional<Renderer<?>> getDefaultPropertyRenderer(P property) {
Class<?> type = getPropertyColumnType(property);
// Images
if (type != null
&& (ExternalResource.class.isAssignableFrom(type) || ThemeResource.class.isAssignableFrom(type))) {
return Optional.of(new ImageRenderer());
}
if (type != null && FontIcon.class.isAssignableFrom(type)) {
return Optional.of(new HtmlRenderer(""));
}
return Optional.empty();
}
示例5: setIcon
import com.vaadin.server.FontIcon; //导入依赖的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));
}
}
}
示例6: setIcon
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public void setIcon(Resource icon) {
if (icon != null && !(icon instanceof FontIcon)) {
throw new IllegalArgumentException("Only FontIcons are allowed");
}
this.icon = (FontIcon) icon;
markAsDirty();
}
示例7: convertToPresentation
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public String convertToPresentation(FontIcon value, ValueContext context) {
if (value != null) {
return value.getHtml();
}
return null;
}
示例8: getDefaultPropertyPresenter
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected Optional<ValueProvider<?, ?>> getDefaultPropertyPresenter(Property property) {
if (property != null) {
if (Component.class.isAssignableFrom(property.getType())) {
return Optional.empty();
}
if (FontIcon.class.isAssignableFrom(property.getType())) {
return Optional.of(v -> ((FontIcon) v).getHtml());
}
return Optional.of(v -> property.present(v));
}
return super.getDefaultPropertyPresenter(property);
}
示例9: getDefaultPropertyRenderer
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
protected Optional<Renderer<?>> getDefaultPropertyRenderer(Property property) {
if (Component.class.isAssignableFrom(property.getType())) {
return Optional.of(new ComponentRenderer());
}
if (FontIcon.class.isAssignableFrom(property.getType())) {
return Optional.of(new HtmlRenderer(""));
}
if (ExternalResource.class.isAssignableFrom(property.getType())
|| ThemeResource.class.isAssignableFrom(property.getType())) {
return Optional.of(new ImageRenderer());
}
return super.getDefaultPropertyRenderer(property);
}
示例10: convertToPresentation
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public String convertToPresentation(FontIcon value, ValueContext context) {
if (value == null) {
return null;
}
return value.getHtml();
}
示例11: getFileIconByMime
import com.vaadin.server.FontIcon; //导入依赖的package包/类
public static FontIcon getFileIconByMime(final String mimeType) {
// TODO: Move to map
if (!isNullOrEmpty(mimeType)) {
if (mimeType.startsWith("image/"))
return Fontello.FILE_IMAGE;
else if (mimeType.equals("application/pdf"))
return Fontello.FILE_PDF;
else if (mimeType.equals("application/vnd.ms-excel")
|| mimeType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))
return Fontello.FILE_EXCEL;
else if (mimeType.equals("application/msword")
|| mimeType.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
return Fontello.FILE_WORD;
else if (mimeType.equals("application/vnd.ms-powerpoint")
|| mimeType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation"))
return Fontello.FILE_POWERPOINT;
else if (mimeType.equals("application/zip")
|| mimeType.equals("application/x-rar-compressed")
|| mimeType.equals("application/x-gzip"))
return Fontello.FILE_ARCHIVE;
else if (mimeType.startsWith("audio/"))
return Fontello.FILE_AUDIO;
else if (mimeType.startsWith("video/"))
return Fontello.FILE_VIDEO;
}
return Fontello.FILE_CODE;
}
示例12: getModelType
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public Class<FontIcon> getModelType() {
return FontIcon.class;
}
示例13: convertToModel
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public FontIcon convertToModel(String value, Class<? extends FontIcon> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return null;
}
示例14: StepLabel
import com.vaadin.server.FontIcon; //导入依赖的package包/类
/**
* Construct a new label with the given caption, description and icon.
*
* @param caption
* The caption to show
* @param description
* The description to show
* @param icon
* The icon to show
*/
public StepLabel(String caption, String description, FontIcon icon) {
active = false;
nexted = false;
skipped = false;
editable = false;
clickable = false;
iconLabel = new Label();
iconLabel.setWidthUndefined();
iconLabel.setContentMode(ContentMode.HTML);
iconLabel.addStyleName(STYLE_STEP_ICON);
captionLabel = new Label();
captionLabel.setWidth(100, Unit.PERCENTAGE);
captionLabel.addStyleName(STYLE_STEP_CAPTION);
descriptionLabel = new Label();
descriptionLabel.setWidth(100, Unit.PERCENTAGE);
descriptionLabel.addStyleName(ValoTheme.LABEL_LIGHT);
descriptionLabel.addStyleName(ValoTheme.LABEL_SMALL);
descriptionLabel.addStyleName(STYLE_STEP_DESCRIPTION);
captionWrapper = new VerticalLayout();
captionWrapper.setSpacing(false);
captionWrapper.setMargin(false);
captionWrapper.setSizeFull();
captionWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
captionWrapper.addComponent(captionLabel);
captionWrapper.addComponent(descriptionLabel);
rootLayout = new HorizontalLayout();
rootLayout.setSpacing(false);
rootLayout.setMargin(false);
rootLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
rootLayout.setWidth(100, Unit.PERCENTAGE);
rootLayout.addComponent(iconLabel);
rootLayout.addComponent(captionWrapper);
rootLayout.setExpandRatio(captionWrapper, 1);
setCompositionRoot(rootLayout);
addStyleName(STYLE_ROOT_LAYOUT);
setIcon(icon);
setCaption(caption);
setDescription(description);
setIconNexted(DEFAULT_ICON_NEXTED);
setIconSkipped(DEFAULT_ICON_SKIPPED);
setIconEditable(DEFAULT_ICON_EDITABLE);
setIconError(DEFAULT_ICON_ERROR);
}
示例15: getIcon
import com.vaadin.server.FontIcon; //导入依赖的package包/类
@Override
public FontIcon getIcon() {
return icon;
}