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;
}
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);
}
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;
}
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;
}
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();
}
Aggregations