Search in sources :

Example 1 with Divider

use of org.gwtbootstrap3.client.ui.Divider 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;
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) DropDownHeader(org.gwtbootstrap3.client.ui.DropDownHeader) Divider(org.gwtbootstrap3.client.ui.Divider) UiMenuBarButtonDefinition(org.ovirt.engine.ui.common.widget.action.UiMenuBarButtonDefinition)

Example 2 with Divider

use of org.gwtbootstrap3.client.ui.Divider 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 3 with Divider

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

the class HostNetworkInterfaceListViewItem method createRxColumn.

private IsWidget createRxColumn(HostInterface hostInterface) {
    Column rxCol = new Column(ColumnSize.SM_3);
    DListElement dl = Document.get().createDLElement();
    addReverseDetailItem(templates.sub(constants.rxRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { hostInterface.getRxRate(), hostInterface.getSpeed().doubleValue() })), dl);
    dl.addClassName(Styles.PULL_LEFT);
    rxCol.getElement().appendChild(dl);
    FlowPanel divider = new FlowPanel();
    divider.addStyleName(RATE_DIVIDER);
    rxCol.add(divider);
    dl = Document.get().createDLElement();
    addReverseDetailItem(templates.sub(constants.rxTotal(), constants.bytes()), SafeHtmlUtils.fromString(totalRenderer.render(hostInterface.getRxTotal())), dl);
    dl.addClassName(Styles.PULL_LEFT);
    rxCol.getElement().appendChild(dl);
    return rxCol;
}
Also used : Column(org.gwtbootstrap3.client.ui.Column) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) DListElement(com.google.gwt.dom.client.DListElement)

Example 4 with Divider

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

the class HostNetworkInterfaceListViewItem method createTxColumn.

private IsWidget createTxColumn(HostInterface hostInterface) {
    Column txCol = new Column(ColumnSize.SM_3);
    DListElement dl = Document.get().createDLElement();
    addReverseDetailItem(templates.sub(constants.txRate(), constants.mbps()), SafeHtmlUtils.fromString(rateRenderer.render(new Double[] { hostInterface.getTxRate(), hostInterface.getSpeed().doubleValue() })), dl);
    dl.addClassName(Styles.PULL_LEFT);
    txCol.getElement().appendChild(dl);
    FlowPanel divider = new FlowPanel();
    divider.addStyleName(RATE_DIVIDER);
    txCol.add(divider);
    dl = Document.get().createDLElement();
    addReverseDetailItem(templates.sub(constants.txTotal(), constants.bytes()), SafeHtmlUtils.fromString(totalRenderer.render(hostInterface.getTxTotal())), dl);
    dl.addClassName(Styles.PULL_LEFT);
    txCol.getElement().appendChild(dl);
    return txCol;
}
Also used : Column(org.gwtbootstrap3.client.ui.Column) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) DListElement(com.google.gwt.dom.client.DListElement)

Example 5 with Divider

use of org.gwtbootstrap3.client.ui.Divider in project kie-wb-common by kiegroup.

the class ExplorerMenuViewImpl method asMenu.

@Override
public Menus asMenu() {
    return MenuFactory.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {

        @Override
        public void push(MenuFactory.CustomMenuBuilder element) {
        }

        @Override
        public MenuItem build() {
            return new BaseMenuCustom() {

                @Override
                public Widget build() {
                    return new ButtonGroup() {

                        {
                            add(new Button() {

                                {
                                    setToggleCaret(false);
                                    setDataToggle(Toggle.DROPDOWN);
                                    setIcon(IconType.COG);
                                    setSize(ButtonSize.SMALL);
                                    setTitle(ProjectExplorerConstants.INSTANCE.customizeView());
                                }
                            });
                            add(new DropDownMenu() {

                                {
                                    addStyleName("pull-right");
                                    add(businessView);
                                    add(techView);
                                    add(new Divider());
                                    add(breadcrumbExplorer);
                                    add(treeExplorer);
                                    add(new Divider());
                                    add(showTagFilter);
                                    add(new Divider());
                                    add(archiveProject);
                                }
                            });
                        }
                    };
                }
            };
        }
    }).endMenu().newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {

        @Override
        public void push(MenuFactory.CustomMenuBuilder element) {
        }

        @Override
        public MenuItem build() {
            return new BaseMenuCustom() {

                @Override
                public Widget build() {
                    return new Button() {

                        {
                            setIcon(IconType.REFRESH);
                            setSize(ButtonSize.SMALL);
                            setTitle(ProjectExplorerConstants.INSTANCE.refresh());
                            addClickHandler(new ClickHandler() {

                                @Override
                                public void onClick(ClickEvent event) {
                                    presenter.onRefresh();
                                }
                            });
                        }
                    };
                }
            };
        }
    }).endMenu().build();
}
Also used : MenuFactory(org.uberfire.workbench.model.menu.MenuFactory) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ButtonGroup(org.gwtbootstrap3.client.ui.ButtonGroup) Button(org.gwtbootstrap3.client.ui.Button) BaseMenuCustom(org.uberfire.workbench.model.menu.impl.BaseMenuCustom) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Widget(com.google.gwt.user.client.ui.Widget) MenuItem(org.uberfire.workbench.model.menu.MenuItem) Divider(org.gwtbootstrap3.client.ui.Divider)

Aggregations

Divider (org.gwtbootstrap3.client.ui.Divider)3 DListElement (com.google.gwt.dom.client.DListElement)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 TextColumn (com.google.gwt.user.cellview.client.TextColumn)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 AnchorListItem (org.gwtbootstrap3.client.ui.AnchorListItem)2 Button (org.gwtbootstrap3.client.ui.Button)2 Column (org.gwtbootstrap3.client.ui.Column)2 DropDownHeader (org.gwtbootstrap3.client.ui.DropDownHeader)2 DropDownMenu (org.gwtbootstrap3.client.ui.DropDownMenu)2 AbstractIconTypeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn)2 HTML (com.google.gwt.user.client.ui.HTML)1 Widget (com.google.gwt.user.client.ui.Widget)1 HashSet (java.util.HashSet)1 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)1 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)1 ConnectiveConstraint (org.drools.workbench.models.datamodel.rule.ConnectiveConstraint)1 FieldConstraint (org.drools.workbench.models.datamodel.rule.FieldConstraint)1 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)1