|
7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | * you may not use this file except in compliance with the License. |
9 | 9 | * You may obtain a copy of the License at |
10 | | - * |
| 10 | + * |
11 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | | - * |
| 12 | + * |
13 | 13 | * Unless required by applicable law or agreed to in writing, software |
14 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
41 | 41 | @JavaScript("./paper-chip.js") |
42 | 42 | public class Chip extends Component { |
43 | 43 |
|
44 | | - public static final String CHIP_LABEL = "event.detail.chipLabel"; |
45 | | - private String label; |
46 | | - private boolean closable; |
47 | | - private Icon icon; |
| 44 | + public static final String CHIP_LABEL = "event.detail.chipLabel"; |
| 45 | + private String label; |
| 46 | + private boolean closable; |
| 47 | + private Icon icon; |
48 | 48 |
|
49 | | - public Chip(String label, boolean closable, Icon icon) { |
50 | | - this.setLabel(label); |
51 | | - this.setClosable(closable); |
52 | | - this.setIcon(icon); |
53 | | - } |
| 49 | + public Chip(String label, boolean closable, Icon icon) { |
| 50 | + this.setLabel(label); |
| 51 | + this.setClosable(closable); |
| 52 | + this.setIcon(icon); |
| 53 | + } |
54 | 54 |
|
55 | | - public Chip(String chipText) { |
56 | | - this(chipText, true, null); |
57 | | - } |
| 55 | + public Chip(String chipText) { |
| 56 | + this(chipText, true, null); |
| 57 | + } |
58 | 58 |
|
59 | | - public String getLabel() { |
60 | | - return label; |
61 | | - } |
| 59 | + public String getLabel() { |
| 60 | + return label; |
| 61 | + } |
62 | 62 |
|
63 | | - public void setLabel(String label) { |
64 | | - this.getElement().setAttribute("label", label); |
65 | | - this.label = label; |
66 | | - } |
| 63 | + public void setLabel(String label) { |
| 64 | + this.getElement().setAttribute("label", label); |
| 65 | + this.label = label; |
| 66 | + } |
67 | 67 |
|
68 | | - public boolean isClosable() { |
69 | | - return closable; |
70 | | - } |
| 68 | + public boolean isClosable() { |
| 69 | + return closable; |
| 70 | + } |
71 | 71 |
|
72 | | - public void setClosable(boolean closable) { |
73 | | - if (closable) { |
74 | | - this.getElement().setAttribute("closable", closable); |
75 | | - } |
76 | | - this.closable = closable; |
77 | | - } |
| 72 | + public void setClosable(boolean closable) { |
| 73 | + if (closable) { |
| 74 | + this.getElement().setAttribute("closable", closable); |
| 75 | + } |
| 76 | + this.closable = closable; |
| 77 | + } |
78 | 78 |
|
79 | | - public Icon getIcon() { |
80 | | - return icon; |
81 | | - } |
82 | | - |
83 | | - public void setIcon(Icon icon) { |
84 | | - if (icon != null) { |
85 | | - Span s = new Span(); |
86 | | - s.setClassName("chip-background"); |
87 | | - s.getElement().setAttribute("slot", "avatar"); |
88 | | - s.add(icon); |
89 | | - this.getElement().appendChild(s.getElement()); |
90 | | - } |
91 | | - this.icon = icon; |
92 | | - } |
| 79 | + public Icon getIcon() { |
| 80 | + return icon; |
| 81 | + } |
93 | 82 |
|
| 83 | + public void setIcon(Icon icon) { |
| 84 | + if (icon != null) { |
| 85 | + Span s = new Span(); |
| 86 | + s.setClassName("chip-background"); |
| 87 | + s.getElement().setAttribute("slot", "avatar"); |
| 88 | + s.add(icon); |
| 89 | + this.getElement().appendChild(s.getElement()); |
| 90 | + } |
| 91 | + this.icon = icon; |
| 92 | + } |
94 | 93 | } |
0 commit comments