public Builder setToggleCaret(boolean toggleCaret) { button.setToggleCaret(toggleCaret); return this; }
private void createRefreshMenuButton() { dropdownButton = new Button(); dropdownButton.setToggleCaret(true); dropdownButton.setDataToggle(Toggle.DROPDOWN); }
/** * 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 initDropdownButton(IconType icon, boolean splitButton) { button = new Button(); caretButton = new Button(); caretButton.setDataToggle(Toggle.DROPDOWN); caretButton.setToggleCaret(true); if (splitButton) { caretButton.getElement().getStyle().setMarginLeft(0, Unit.PX); caretButton.getElement().getStyle().setLeft(-1, Unit.PX); textButton = button; toolTip = new WidgetTooltip(textButton); add(toolTip); add(caretButton); } else { textButton = caretButton; toolTip = new WidgetTooltip(textButton); add(toolTip); } if (icon != null) { textButton.setIcon(icon); } }
public MenuItem newExportsItem(final Command exportPNGCommand, final Command exportJPGCommand, final Command exportSVGCommand, final Command exportPDFCommand, final Command exportAsRawCommand) { final DropDownMenu menu = GWT.create(DropDownMenu.class); menu.setPull(Pull.RIGHT); menu.add(makeExportMenuItemWidget(translationService.getValue(CoreTranslationMessages.EXPORT_PNG), exportPNGCommand)); menu.add(makeExportMenuItemWidget(translationService.getValue(CoreTranslationMessages.EXPORT_JPG), exportJPGCommand)); menu.add(makeExportMenuItemWidget(translationService.getValue(CoreTranslationMessages.EXPORT_SVG), exportSVGCommand)); menu.add(makeExportMenuItemWidget(translationService.getValue(CoreTranslationMessages.EXPORT_PDF), exportPDFCommand)); menu.add(makeExportMenuItemWidget(getExportAsRawLabel(), exportAsRawCommand)); final Button button = GWT.create(Button.class); final ButtonGroup buttonGroup = GWT.create(ButtonGroup.class); buttonGroup.add(button); buttonGroup.add(menu); button.setToggleCaret(true); button.setDataToggle(Toggle.DROPDOWN); button.setIcon(IconType.DOWNLOAD); button.setSize(ButtonSize.SMALL); button.setTitle(translationService.getValue(StunnerProjectClientConstants.DOWNLOAD_DIAGRAM)); final IsWidget group = MenuUtils.buildHasEnabledWidget(buttonGroup, button); return buildItem(group); }