use of org.gwtbootstrap3.client.ui.AnchorListItem in project kie-wb-common by kiegroup.
the class MenuDevCommandsBuilder method buildDevMenuItem.
private MenuItem buildDevMenuItem() {
final DropDownMenu menu = new DropDownMenu() {
{
addStyleName("pull-right");
}
};
for (final MenuDevCommand command : devCommands) {
menu.add(new AnchorListItem(command.getText()) {
{
setIcon(command.getIcon());
addClickHandler(event -> command.execute());
}
});
}
final IsWidget group = new ButtonGroup() {
{
add(new Button() {
{
setToggleCaret(false);
setDataToggle(Toggle.DROPDOWN);
setIcon(IconType.COG);
setSize(ButtonSize.SMALL);
setTitle("Development");
}
});
add(menu);
}
};
return MenuUtils.buildItem(group);
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class AbstractActionTable method updateContextMenu.
/**
* Rebuilds context menu items to match the action button list.
* @param dropDownMenu The menu bar to populate.
* @param actions A list of {@code ActionButtonDefinition}s used to populate the {@code MenuBar}.
* @param popupPanel The pop-up panel containing the {@code MenuBar}.
* @param removeOldItems A flag to indicate if we should remove old items.
* @return A {@code MenuBar} containing all the action buttons as menu items.
*/
private DropDownMenu updateContextMenu(DropDownMenu dropDownMenu, List<ActionButtonDefinition<T>> actions, boolean removeOldItems) {
if (removeOldItems) {
ElementTooltipUtils.destroyMenuItemTooltips(dropDownMenu);
dropDownMenu.clear();
// Close any other open popups as well.
closeOtherPopups();
}
for (final ActionButtonDefinition<T> buttonDef : actions) {
if (buttonDef instanceof UiMenuBarButtonDefinition) {
UiMenuBarButtonDefinition<T> menuBarDef = (UiMenuBarButtonDefinition<T>) buttonDef;
DropDownHeader subMenuHeader = new DropDownHeader(buttonDef.getText());
dropDownMenu.add(new Divider());
subMenuHeader.setVisible(buttonDef.isVisible(getSelectedItems()));
dropDownMenu.add(subMenuHeader);
updateContextMenu(dropDownMenu, menuBarDef.getSubActions(), false);
} else {
AnchorListItem item = new AnchorListItem(buttonDef.getText());
item.addClickHandler(e -> buttonDef.onClick(getSelectedItems()));
updateMenuItem(item, buttonDef);
dropDownMenu.add(item);
}
}
return dropDownMenu;
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class RefreshPanel method createDropdownMenu.
private void createDropdownMenu() {
dropdownMenu = new DropDownMenu();
dropdownMenu.setPull(Pull.LEFT);
Set<Integer> refreshRates = AbstractRefreshManager.getRefreshRates();
for (Integer refreshRate : refreshRates) {
AnchorListItem refreshRateItem = new AnchorListItem();
refreshRateItem.setText(MillisecondRenderer.getInstance().render(refreshRate));
refreshRateItem.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
refreshManager.setCurrentRefreshRate(refreshRate);
removeActiveStyles();
refreshRateItem.addStyleName(Styles.ACTIVE);
}
});
if (refreshManager.getCurrentRefreshRate() == refreshRate) {
refreshRateItem.addStyleName(Styles.ACTIVE);
}
dropdownMenu.add(refreshRateItem);
}
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class OvirtBreadCrumbsView method buildCrumbs.
@Override
public void buildCrumbs(String modelTitle, String modelHref) {
// Clear the existing path.
container.clear();
breadCrumbs = new Breadcrumbs();
container.add(breadCrumbs);
// Add primary menu label.
String primaryLabel = menuDetailsProvider.getLabelFromHref(modelHref);
if (primaryLabel != null) {
breadCrumbs.add(new ListItem(primaryLabel));
}
menuDetailsProvider.setMenuActive(modelHref);
// Add main model name.
AnchorListItem mainModelAnchor = new AnchorListItem(modelTitle);
// $NON-NLS-1$
mainModelAnchor.setHref("#" + modelHref);
breadCrumbs.add(mainModelAnchor);
if (currentSelectedItemWidget != null && !hideSelectedWidget) {
breadCrumbs.add(currentSelectedItemWidget);
}
}
use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.
the class DropdownActionButton method initMenuPopup.
private void initMenuPopup(List<ActionButtonDefinition<T>> actions) {
if (menuPopup == null) {
menuPopup = new DropDownMenu();
}
for (final ActionButtonDefinition<T> buttonDef : actions) {
if (buttonDef instanceof UiMenuBarButtonDefinition) {
UiMenuBarButtonDefinition<T> menuBarDef = (UiMenuBarButtonDefinition<T>) buttonDef;
DropDownHeader subMenuHeader = new DropDownHeader(buttonDef.getText());
menuPopup.add(new Divider());
menuPopup.add(subMenuHeader);
initMenuPopup(menuBarDef.getSubActions());
} else {
AnchorListItem menuItem = new AnchorListItem(buttonDef.getText());
menuItem.addClickHandler(e -> {
buttonDef.onClick(selectedItemsProvider.getSelectedItems());
});
updateMenuItem(menuItem, buttonDef, selectedItemsProvider.getSelectedItems());
menuPopup.add(menuItem);
items.add(new Pair<>(menuItem, buttonDef));
}
}
add(menuPopup);
}
Aggregations