@Override public void addProviderType(final ProviderTypeKey providerTypeKey, final String name, final Command select) { final CustomGroupItem providerTypeItem = CustomGroupItem.createAnchor(name, IconType.FOLDER_O, select); itemsMap.put(providerTypeKey, providerTypeItem); providerTypeItems.appendChild(providerTypeItem); }
@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; }
@JsOverlay public final void setActive(boolean active) { if (active) { getClassList().add("active"); } else { getClassList().remove("active"); } } }
@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; }
@JsOverlay public final void setActive(boolean active) { if (active) { getClassList().add("active"); } else { getClassList().remove("active"); } } }
@Override public void addProviderType(final ProviderTypeKey providerTypeKey, final String name, final Command select) { final CustomGroupItem providerTypeItem = CustomGroupItem.createAnchor(name, IconType.FOLDER_O, select); itemsMap.put(providerTypeKey, providerTypeItem); providerTypeItems.appendChild(providerTypeItem); }
@Override public void addProvider(final String providerId, final String providerName, final Command onSelect) { if (providerItems.containsKey(providerId)) { return; } final CustomGroupItem groupItem = createAnchor(providerId, IconType.FOLDER_O, onSelect); providerItems.put(providerId, groupItem); providersListGroup.appendChild(groupItem); }
@Override public void addProvider(final String providerId, final String providerName, final Command onSelect) { if (providerItems.containsKey(providerId)) { return; } final CustomGroupItem groupItem = createAnchor(providerId, IconType.FOLDER_O, onSelect); providerItems.put(providerId, groupItem); providersListGroup.appendChild(groupItem); }