use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class OvirtBreadCrumbsView method createSelectionDropDown.
// Can't make this a composite class since I can't put anything inside
// an AnchorListItem besides text using ui.xml files. But manually I can
// add widgets without issue.
private AnchorListItem createSelectionDropDown(SafeHtml currentName) {
OvirtAnchorListItem dropDown = new OvirtAnchorListItem();
Button exchangeButton = new Button();
exchangeButton.setIcon(IconType.EXCHANGE);
exchangeButton.addStyleName(QUICK_SWITCH);
exchangeButton.getElement().getStyle().setMarginLeft(10, Unit.PX);
exchangeButton.getElement().getStyle().setMarginTop(-5, Unit.PX);
Anchor anchor = dropDown.getAnchor();
anchor.getElement().setInnerHTML(currentName.asString());
anchor.getElement().getStyle().setFontSize(28, Unit.PX);
anchor.addClickHandler(e -> {
if (popover.isVisible()) {
popover.hide();
} else {
popover.show();
}
});
anchor.add(exchangeButton);
createPopover(anchor);
dropDown.add(anchor);
return dropDown;
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class ListModelSearchBox method setInternalRowData.
private void setInternalRowData(int start, List<? extends T> values) {
final int oldCount = menu.getWidgetCount();
clearMenu();
emptyMenuHandlers();
for (T model : values) {
if (model instanceof Nameable) {
final String text = getName(model).asString();
final AnchorListItem item = new SearchBoxAnchorListItem(this);
item.setText(text);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
if (StringHelper.isNotNullOrEmpty(currentSearch)) {
String newText = text.replaceAll(currentSearch, // $NON-NLS-1$
"<strong>" + currentSearch + // $NON-NLS-1$
"</strong>");
item.getWidget(0).getElement().setInnerHTML(newText);
}
}
});
menuHandlers.add(item.addClickHandler(this));
menu.add(item);
}
}
if (oldCount != menu.getWidgetCount()) {
currentFocusIndex = 0;
}
if (currentFocusIndex >= menu.getWidgetCount() - 1) {
currentFocusIndex = menu.getWidgetCount() - 1;
}
if (currentFocusIndex >= 0) {
((AnchorListItem) menu.getWidget(currentFocusIndex)).setFocus(true);
}
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class SearchPanelView method addAvailableBookmarks.
@Override
public HandlerRegistration addAvailableBookmarks(Bookmark bookmark, ClickHandler handler) {
AnchorListItem bookmarkItem = new AnchorListItem();
bookmarkItem.setText(bookmark.getName());
HandlerRegistration registration = bookmarkItem.addClickHandler(handler);
searchBoxBookmarkListDropDown.add(bookmarkItem);
searchBoxBookmarkListDropDownButton.setEnabled(searchBoxBookmarkListDropDown.getWidgetCount() > 0);
return registration;
}
Aggregations