Search in sources :

Example 6 with AnchorListItem

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);
    }
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 7 with AnchorListItem

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);
    }
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) Breadcrumbs(org.gwtbootstrap3.client.ui.Breadcrumbs) ListItem(org.gwtbootstrap3.client.ui.ListItem) AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem)

Example 8 with AnchorListItem

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);
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) DropDownHeader(org.gwtbootstrap3.client.ui.DropDownHeader) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) Divider(org.gwtbootstrap3.client.ui.Divider)

Example 9 with AnchorListItem

use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.

the class SimpleTabPanel method setActiveTab.

@Override
public void setActiveTab(Tab tab) {
    super.setActiveTab(tab);
    String title = tab.getText();
    String href = calculateHref(tab);
    for (int i = 0; i < navTabs.getWidgetCount(); i++) {
        IsWidget widget = navTabs.getWidget(i);
        if (widget instanceof AnchorListItem) {
            AnchorListItem item = (AnchorListItem) widget;
            if (item.getText().equals(title) && item.getHref().endsWith(href)) {
                item.addStyleName(Styles.ACTIVE);
            } else {
                item.removeStyleName(Styles.ACTIVE);
            }
        }
    }
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem)

Example 10 with AnchorListItem

use of org.gwtbootstrap3.client.ui.AnchorListItem in project ovirt-engine by oVirt.

the class SimpleTabPanel method addTabDefinition.

@Override
public void addTabDefinition(Tab tab, int index) {
    String href = calculateHref(tab);
    AnchorListItem item = new AnchorListItem(tab.getText());
    item.setHref(href);
    navTabs.insert(item, index);
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem)

Aggregations

AnchorListItem (org.gwtbootstrap3.client.ui.AnchorListItem)17 DropDownMenu (org.gwtbootstrap3.client.ui.DropDownMenu)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)5 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 Button (org.gwtbootstrap3.client.ui.Button)5 ApplicationScoped (javax.enterprise.context.ApplicationScoped)4 Inject (javax.inject.Inject)4 ButtonGroup (org.gwtbootstrap3.client.ui.ButtonGroup)4 ButtonSize (org.gwtbootstrap3.client.ui.constants.ButtonSize)4 IconType (org.gwtbootstrap3.client.ui.constants.IconType)4 Toggle (org.gwtbootstrap3.client.ui.constants.Toggle)4 MenuUtils (org.kie.workbench.common.stunner.client.widgets.menu.MenuUtils)4 MenuItem (org.uberfire.workbench.model.menu.MenuItem)4 Divider (org.gwtbootstrap3.client.ui.Divider)2 DropDownHeader (org.gwtbootstrap3.client.ui.DropDownHeader)2 IconPosition (org.gwtbootstrap3.client.ui.constants.IconPosition)2 Pull (org.gwtbootstrap3.client.ui.constants.Pull)2 ClientTranslationService (org.kie.workbench.common.stunner.core.client.i18n.ClientTranslationService)2 Command (org.uberfire.mvp.Command)2