Skip to content

Commit 07c935a

Browse files
committed
Deprecate IronIcon in favor of Vaadin Flow component
1 parent 3d0a9c6 commit 07c935a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/main/java/com/flowingcode/addons/applayout/IronIcon.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
* Component that renders a paper-item
3434
*
3535
* @author mlopez
36-
*
36+
* @deprecated Use {@link com.vaadin.flow.component.icon.IronIcon}
3737
*/
3838
@SuppressWarnings("serial")
3939
@HtmlImport("bower_components/iron-icon/iron-icon.html")
4040
@Tag("iron-icon")
41+
@Deprecated
4142
public class IronIcon extends Component implements HasText, HasSize {
4243

4344
public IronIcon(String icon) {

src/main/java/com/flowingcode/addons/applayout/PaperIconItem.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
@Tag("paper-icon-item")
4343
public class PaperIconItem extends Component implements HasComponents, HasText, HasSize {
4444

45-
private IronIcon ironIcon;
45+
private com.vaadin.flow.component.icon.IronIcon ironIcon;
4646
private Text text;
4747

4848
public PaperIconItem(String title, String icon) {
@@ -71,13 +71,14 @@ public PaperIconItem(String title, URL image, Command command, AppDrawer appDraw
7171

7272
private PaperIconItem(String title, String icon, URL image, Command command, AppDrawer appDrawer) {
7373
this.setText("");
74+
this.ironIcon = new com.vaadin.flow.component.icon.IronIcon("", "");
75+
ironIcon.getElement().setAttribute("slot", "item-icon");
7476
if (image!=null) {
75-
this.ironIcon = new IronIcon(image);
76-
add(ironIcon);
77+
setImage(image);
7778
} else {
78-
this.ironIcon = new IronIcon(icon);
79-
add(ironIcon);
79+
setIcon(icon);
8080
}
81+
add(ironIcon);
8182
this.text = new Text(title);
8283
add(text);
8384
if (command!=null) {
@@ -94,11 +95,13 @@ public void setTitle(String title) {
9495
}
9596

9697
public void setIcon(String icon) {
97-
this.ironIcon.setIcon(icon);
98+
ironIcon.getElement().removeAttribute("src");
99+
ironIcon.getElement().setAttribute("icon", icon);
98100
}
99101

100102
public void setImage(URL image) {
101-
this.ironIcon.setImage(image);
103+
ironIcon.getElement().removeAttribute("icon");
104+
ironIcon.getElement().setAttribute("src", image.toString());
102105
}
103106

104107
}

0 commit comments

Comments
 (0)