use of org.jboss.hal.core.finder.Finder.DATA_BREADCRUMB in project console by hal.
the class FinderRow method drawItem.
private void drawItem() {
Elements.removeChildrenFrom(root);
root.id = id;
root.dataset.set(DATA_BREADCRUMB, display.getTitle());
// TODO getFilterData() causes a ReferenceError in SuperDevMode WTF?
if (display.getFilterData() != null) {
root.dataset.set(DATA_FILTER, display.getFilterData());
}
HTMLElement icon = display.getIcon();
if (icon != null) {
icon.classList.add(itemIcon);
root.appendChild(icon);
}
HTMLElement itemElement;
if (display.element() != null) {
itemElement = display.element();
} else if (display.getTitle() != null) {
itemElement = span().css(itemText).textContent(display.getTitle()).element();
} else {
itemElement = span().css(itemText).textContent(NOT_AVAILABLE).element();
}
if (display.getTooltip() != null && itemElement != null) {
itemElement.title = display.getTooltip();
itemElement.dataset.set(UIConstants.TOGGLE, UIConstants.TOOLTIP);
itemElement.dataset.set(UIConstants.PLACEMENT, "top");
}
root.appendChild(itemElement);
// oder: 1) pin/unpin icon, 2) folder icon, 3) button(s)
if (column.isPinnable()) {
root.appendChild(span().css(CSS.unpin, pfIcon("close")).title(CONSTANTS.unpin()).on(click, e -> column.unpin(FinderRow.this)).data(PREVENT_SET_ITEMS, UIConstants.TRUE).element());
root.appendChild(span().css(CSS.pin, pfIcon("thumb-tack-o")).title(CONSTANTS.pin()).on(click, e -> column.pin(FinderRow.this)).data(PREVENT_SET_ITEMS, UIConstants.TRUE).element());
}
if (display.nextColumn() != null) {
folderElement = span().css(folder, fontAwesome("angle-right")).element();
root.appendChild(folderElement);
}
if (!actions.isEmpty()) {
if (actions.size() == 1) {
ItemAction<T> action = actions.get(0);
buttonContainer = actionLink(action, false);
} else {
HTMLUListElement ul = null;
boolean firstAction = true;
boolean ulCreated = false;
buttonContainer = div().css(btnGroup, pullRight).data(PREVENT_SET_ITEMS, UIConstants.TRUE).element();
for (ItemAction<T> action : actions) {
if (firstAction) {
buttonContainer.appendChild(actionLink(action, false));
buttonContainer.appendChild(button().css(btn, btnFinder, dropdownToggle).data(UIConstants.TOGGLE, UIConstants.DROPDOWN).data(PREVENT_SET_ITEMS, UIConstants.TRUE).aria(UIConstants.HAS_POPUP, UIConstants.TRUE).aria(UIConstants.EXPANDED, UIConstants.FALSE).add(span().css(caret).data(PREVENT_SET_ITEMS, UIConstants.TRUE)).add(span().css(srOnly).data(PREVENT_SET_ITEMS, UIConstants.TRUE).textContent(CONSTANTS.toggleDropdown())).element());
firstAction = false;
} else {
if (!ulCreated) {
buttonContainer.appendChild(ul = ul().css(dropdownMenu).data(PREVENT_SET_ITEMS, UIConstants.TRUE).element());
ulCreated = true;
}
if (action == ItemAction.SEPARATOR) {
ul.appendChild(li().css(divider).attr(UIConstants.ROLE, UIConstants.SEPARATOR).element());
} else {
ul.appendChild(li().data(PREVENT_SET_ITEMS, UIConstants.TRUE).add(actionLink(action, true)).element());
}
}
}
}
root.appendChild(buttonContainer);
Elements.setVisible(buttonContainer, isSelected());
}
PatternFly.initComponents(HASH + id);
}
Aggregations