use of org.jboss.errai.common.client.dom.EventListener in project kie-wb-common by kiegroup.
the class CustomGroupItem method createAnchor.
@JsOverlay
public static CustomGroupItem createAnchor(final String text, final IconType iconType, final Command command) {
final CustomGroupItem anchor = (CustomGroupItem) Window.getDocument().createElement("a");
anchor.setClassName(Styles.LIST_GROUP_ITEM);
if (iconType != null) {
final HTMLElement icon = Window.getDocument().createElement("i");
icon.getClassList().add("fa");
icon.getClassList().add(iconType.getCssName());
anchor.setInnerHTML(icon.getOuterHTML() + " " + text);
} else {
anchor.setTextContent(checkNotEmpty("text", text));
}
anchor.setHref("#");
// can't use lambda here; GWT limitation (bug!)!
anchor.setOnclick(new EventListener() {
@Override
public void call(final Event event) {
command.execute();
}
});
return anchor;
}
Aggregations