public boolean hasMenuItems() { return kebabMenu.getWidgetCount() > 0; }
private void filter( final String filter ) { if ( content.getWidgetCount() - 2 > 0 ) { final Widget[] clean = new Widget[ content.getWidgetCount() - 2 ]; int index = -1; for ( int i = 1; i < ( content.getWidgetCount() - 1 ); i++ ) { clean[ ++index ] = content.getWidget( i ); } for ( final Widget widget : clean ) { widget.removeFromParent(); } } content.add( footer ); if ( filter != null && !filter.trim().isEmpty() ) { for ( final Map.Entry<String, AnchorListItem> entry : orderedUp ? upContentMap.entrySet() : downContentMap.entrySet() ) { if ( entry.getKey().startsWith( filter.trim() ) ) { content.insert( entry.getValue(), content.getWidgetCount() - 1 ); } } } else { for ( final Map.Entry<String, AnchorListItem> entry : orderedUp ? upContentMap.entrySet() : downContentMap.entrySet() ) { content.insert( entry.getValue(), content.getWidgetCount() - 1 ); } } }
protected void removeActiveStyles() { for (int i = 0; i < dropdownMenu.getWidgetCount(); i++) { dropdownMenu.getWidget(i).removeStyleName(Styles.ACTIVE); } } }
@Override public void removeDropDownOption(TerminationConfigOption option) { for (int i = 0; i < dropdownMenuList.getWidgetCount(); i++) { AnchorListItem item = (AnchorListItem) dropdownMenuList.getWidget(i); if (dropDownNameMap.get(option).equals(item.getText())) { dropdownMenuList.remove(item); break; } } }
public void addMenuItem(ActionButton actionButton, int index) { if (index > kebabMenu.getWidgetCount()) { kebabMenu.add(actionButton); } else { kebabMenu.insert(actionButton.asWidget(), index); } }
private void clearMenu() { for (int i = 0; i < menu.getWidgetCount(); i++) { SearchBoxAnchorListItem menuItem = (SearchBoxAnchorListItem) menu.getWidget(i); menuItem.cleanup(); } menu.clear(); } public void addModelSelectedCallback(ListModelSelectedCallback<T> callback) {
public static void destroyMenuItemTooltips(DropDownMenu dropdownMenu) { for (int i = 0; i < dropdownMenu.getWidgetCount(); ++i) { destroyTooltip(dropdownMenu.getWidget(i).getElement()); } }
private void incrementCurrentIndex() { currentFocusIndex += 1; if (currentFocusIndex == menu.getWidgetCount()) { searchBox.setFocus(true); currentFocusIndex = -1; } else { ((AnchorListItem)menu.getWidget(currentFocusIndex)).setFocus(true); } }
/** * Checks whether or not caret should be added/removed */ protected void addCaretToText() { if (hideOnSingleElement && dropDownMenu.getWidgetCount() == 1) { button.setToggleCaret(false); button.setDataToggle(null); this.removeStyleName("open"); toggleStyles(true); } else if ((dropDownMenu.getWidgetCount() > 1 || hideOnSingleElement == false && dropDownMenu.getWidgetCount() == 1)) { button.setToggleCaret(true); button.setDataToggle(Toggle.DROPDOWN); button.setDataTargetWidget(this); toggleStyles(false); } }
/** * Checks whether or not caret should be added/removed */ protected void addCaretToText() { if (hideOnSingleElement && dropDownMenu.getWidgetCount() == 1) { button.setToggleCaret(false); button.setDataToggle(null); this.removeStyleName("open"); toggleStyles(true); } else if ((dropDownMenu.getWidgetCount() > 1 || hideOnSingleElement == false && dropDownMenu.getWidgetCount() == 1)) { button.setToggleCaret(true); button.setDataToggle(Toggle.DROPDOWN); button.setDataTargetWidget(this); toggleStyles(false); } }
private void setInternalRowData(int start, List<? extends T> values) { final int oldCount = menu.getWidgetCount(); clearMenu(); emptyMenuHandlers(); if (oldCount != menu.getWidgetCount()) { currentFocusIndex = 0; if (currentFocusIndex >= menu.getWidgetCount() - 1) { currentFocusIndex = menu.getWidgetCount() - 1;
@Override public void addDropDownOption(TerminationConfigOption terminationConfigOption) { if (terminationConfigOption == TerminationConfigOption.NESTED) { return; } AnchorListItem li1 = new AnchorListItem(dropDownNameMap.get(terminationConfigOption)); li1.addClickHandler(h -> { presenter.onTerminationTypeSelected(terminationConfigOption.name()); }); for (int i = 0; i < dropdownMenuList.getWidgetCount(); i++) { AnchorListItem item = (AnchorListItem) dropdownMenuList.getWidget(i); TerminationConfigOption dropDownTerminationConfigOption = getDropDownOption(item.getText()); if (dropDownTerminationConfigOption == null || terminationConfigOption.ordinal() < dropDownTerminationConfigOption.ordinal()) { dropdownMenuList.insert(li1, i); break; } if (i == dropdownMenuList.getWidgetCount() - 1) { dropdownMenuList.add(li1); } } }
@Override public void setSplashScreenList(final List<SplashScreenListEntry> splashScreens) { dropdown.clear(); for (final SplashScreenListEntry entry : splashScreens) { final AnchorListItem item = new AnchorListItem(entry.getScreenName()); item.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { entry.getShowCommand().execute(); } }); dropdown.add(item); } if (dropdown.getWidgetCount() == 0) { dropdown.add(new DropDownHeader(WorkbenchConstants.INSTANCE.splashScreenNoneAvailable())); } } }
@Override public void setSplashScreenList(final List<SplashScreenListEntry> splashScreens) { dropdown.clear(); for (final SplashScreenListEntry entry : splashScreens) { final AnchorListItem item = new AnchorListItem(entry.getScreenName()); item.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { entry.getShowCommand().execute(); } }); dropdown.add(item); } if (dropdown.getWidgetCount() == 0) { dropdown.add(new DropDownHeader(WorkbenchConstants.INSTANCE.splashScreenNoneAvailable())); } } }
} else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_UP) { stopPropagation(event); currentFocusIndex = menu.getWidgetCount() - 1; getAnchorListItem(currentFocusIndex).setFocus(true); } else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB) { currentFocusIndex = 0; if (event.getNativeEvent().getShiftKey()) { currentFocusIndex = menu.getWidgetCount() - 1;