Class VaadinIconAdapter
- All Implemented Interfaces:
Icon
Icon implementation that wraps a Vaadin
VaadinIcon glyph. The bridge
type that lets UIManager.getIcon(Object) return a Swing
Icon whose payload is a Vaadin icon — no PNG raster, no
server-side paint.
Path 2 of the icon-rendering plan: hand-picked
UIManager.getIcon(String) keys map to VaadinIcon
glyphs through this adapter, so dialog-heavy migrated code that
pre-fetches an icon by key can install it on the same emulators that
accept ImageIcon (Path 1) — JOptionPane / JLabel / JButton.
paintIcon(Component, Graphics, int, int) is intentionally a EHelper.onUnimplemented(String, String, Object...)
stub: the adapter has no server-side raster to paint into a
Graphics, and Path 3 (offscreen-paint of arbitrary
Icon impls) is permanently deferred per R_match_swing_errors sub-bucket (b). The data
path runs through EHelper.toVaadinIconComponent(String, Icon), which
recognizes this adapter and forwards a fresh
glyph.create() Icon
to the peer's setIcon slot.
getIconWidth() / getIconHeight() report 16 — the
BasicLookAndFeel small-icon convention. The actual rendered size
comes from CSS on the produced Vaadin Icon component, not these
values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.component.ComponentBuild a fresh VaadinIconcomponent for the wrapped glyph.intintcom.vaadin.flow.component.icon.VaadinIconThe wrapped Vaadin icon enum value.voidtoString()
-
Constructor Details
-
VaadinIconAdapter
public VaadinIconAdapter(com.vaadin.flow.component.icon.VaadinIcon glyph)
-
-
Method Details
-
getVaadinIcon
public com.vaadin.flow.component.icon.VaadinIcon getVaadinIcon()The wrapped Vaadin icon enum value. -
createComponent
public com.vaadin.flow.component.Component createComponent()Build a fresh VaadinIconcomponent for the wrapped glyph. A new instance per call — Vaadin components can only sit at one place in the DOM, so callers that install on multiple peers need independent components. -
getIconWidth
public int getIconWidth()- Specified by:
getIconWidthin interfaceIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeightin interfaceIcon
-
paintIcon
-
toString
-