25 lines
571 B
Java
25 lines
571 B
Java
package org.gcube.portlets.user.shareupdates.client.elements;
|
|
|
|
import com.google.gwt.user.client.ui.TextBox;
|
|
|
|
/**
|
|
*
|
|
* @author Massimiliano Assante, ISTI-CNR
|
|
*
|
|
*/
|
|
public class TagBox extends TextBox {
|
|
|
|
public TagBox() {
|
|
}
|
|
|
|
public TagBox(String text) {
|
|
super();
|
|
this.setStylePrimaryName("user-token");
|
|
getElement().setAttribute("value", text);
|
|
//random heuristic, the "i" and "l" char occupies very few px :)
|
|
int iCounter = 14 - 2*(text.split("i").length + (text.split("l").length));
|
|
setWidth((text.length()*6+iCounter)+"px");
|
|
setReadOnly(true);
|
|
}
|
|
}
|