File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/main/java/gwt/material/design/client/ui Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public class MaterialLink extends FocusPanel {
3030
3131 protected HTMLPanel panel = new HTMLPanel ("" );
3232 private String text = "" ;
33+ private String href ;
3334 private String icon = "" ;
3435 private String iconPosition = "" ;
3536 private String textColor = "" ;
@@ -98,6 +99,15 @@ public void setText(String text) {
9899 generateLink ();
99100 }
100101
102+ public String getHref () {
103+ return href ;
104+ }
105+
106+ public void setHref (String href ) {
107+ this .href = href ;
108+ generateLink ();
109+ }
110+
101111 public String getFontSize () {
102112 return fontSize ;
103113 }
@@ -119,10 +129,14 @@ public void setIconPosition(String iconPosition) {
119129 public void generateLink () {
120130 this .clear ();
121131 String iconMarkup = "" ;
132+ String hrefMarkup = "" ;
122133 if (!icon .isEmpty ()) {
123134 iconMarkup = "<i class='" + icon + " " + iconPosition + "'></i>" ;
124135 }
125- panel = new HTMLPanel ("<a class='" + textColor + "-text'>" + iconMarkup + " " + text + "</a>" );
136+ if (this .href != null ) {
137+ hrefMarkup = "href='" + href + "' " ;
138+ }
139+ panel = new HTMLPanel ("<a " + hrefMarkup + "class='" + textColor + "-text'>" + iconMarkup + text + "</a>" );
126140 panel .getElement ().getStyle ().setCursor (Cursor .POINTER );
127141 this .add (panel );
128142 }
You can’t perform that action at this time.
0 commit comments