Package com.vaadin.server
Class GenericFontIcon
- java.lang.Object
-
- com.vaadin.server.GenericFontIcon
-
public class GenericFontIcon extends java.lang.Object implements FontIcon
A generic implementation ofFontIconinterface.- Since:
- 7.5.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericFontIcon(java.lang.String fontFamily, int codepoint)Creates a new instance of GenericFontIcon with given font family and codepoint.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetCodepoint()Returns the unicode codepoint (character location) for this icon within the font given inFontIcon.getFontFamily().java.lang.StringgetFontFamily()Returns the name (font family) of the font from which this icon comes.java.lang.StringgetHtml()Returns HTML that can be used to display the icon in places where HTML can be used, such as aLabelwithContentMode.HTML.static java.lang.StringgetHtml(java.lang.String fontFamily, int codePoint)Utility method for generating HTML that displays an icon from specific fontFamiliy with a given codePoint in the font.java.lang.StringgetMIMEType()Gets the MIME type of the resource.inthashCode()
-
-
-
Constructor Detail
-
GenericFontIcon
public GenericFontIcon(java.lang.String fontFamily, int codepoint)Creates a new instance of GenericFontIcon with given font family and codepoint.- Parameters:
fontFamily- Name of the type face that is used to display iconscodepoint- Numerical code point in the font
-
-
Method Detail
-
getFontFamily
public java.lang.String getFontFamily()
Description copied from interface:FontIconReturns the name (font family) of the font from which this icon comes. The name is used to apply the correct font where the icon is used.- Specified by:
getFontFamilyin interfaceFontIcon- Returns:
-
getMIMEType
public java.lang.String getMIMEType()
Description copied from interface:ResourceGets the MIME type of the resource.- Specified by:
getMIMETypein interfaceResource- Returns:
- the MIME type of the resource.
-
getCodepoint
public int getCodepoint()
Description copied from interface:FontIconReturns the unicode codepoint (character location) for this icon within the font given inFontIcon.getFontFamily().For example, 0x0021 would in a regular font be the codepoint for the exclamation-point character.
When constructing icon fonts, it might be a good idea to use the codepoints in the "Private use area", from 0xE000 0xF8FF.- Specified by:
getCodepointin interfaceFontIcon- Returns:
-
getHtml
public java.lang.String getHtml()
Description copied from interface:FontIconReturns HTML that can be used to display the icon in places where HTML can be used, such as aLabelwithContentMode.HTML.
-
getHtml
public static java.lang.String getHtml(java.lang.String fontFamily, int codePoint)Utility method for generating HTML that displays an icon from specific fontFamiliy with a given codePoint in the font.- Parameters:
fontFamily- Name of the font familycodePoint- Icon's character code point in the font- Returns:
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-