protected void initComponent(CubaButton component) { component.setClickHandler(this::buttonClicked); // The default description value is empty string, // that prevents obtaining a description value from an action component.setDescription(null); }
protected void setContextMenuButtonAction(CubaButton button, Action action) { setContextMenuButtonIcon(button, showIconsForPopupMenuActions ? action.getIcon() : null); setContextMenuButtonCaption(button, action.getCaption(), action.getShortcutCombination()); button.setDescription(action.getDescription()); button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(event -> { beforeContextMenuButtonHandlerPerformed(); action.actionPerform(WebAbstractActionsHolderComponent.this); }); }
protected void setPickerButtonAction(CubaButton button, Action action) { String description = action.getDescription(); if (description == null && action.getShortcutCombination() != null) { description = action.getShortcutCombination().format(); } if (description != null) { button.setDescription(description); } button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); if (action.getIcon() != null) { setPickerButtonIcon(button, action.getIcon()); } AppUI ui = AppUI.getCurrent(); if (ui != null && ui.isTestMode()) { button.setCubaId(action.getId()); } action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(event -> { this.focus(); action.actionPerform(this); }); }
protected void setPopupButtonAction(CubaButton button, Action action) { button.setCaption(action.getCaption()); String description = action.getDescription(); if (description == null && action.getShortcutCombination() != null) { description = action.getShortcutCombination().format(); } if (description != null) { button.setDescription(description); } button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); if (showActionIcons) { setPopupButtonIcon(button, action.getIcon()); } else { setPopupButtonIcon(button, null); } action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(mouseEventDetails -> { this.focus(); if (isAutoClose()) { this.component.setPopupVisible(false); } action.actionPerform(this); }); }
for (Action action : actions) { CubaButton button = createButton(action); button.setClickHandler(mouseEventDetails -> { try { action.actionPerform(ui.getTopLevelWindow());
closeBtn.setClickHandler(this::onCloseWindowButtonClick); closeBtn.setIcon(resolveIcon(beanLocator, CubaIcon.CLOSE)); closeBtn.setStyleName("c-closetab-button");
public MessageDialogBuilderImpl() { window = new CubaWindow(); window.setModal(true); window.setResizable(false); layout = new VerticalLayout(); layout.setStyleName("c-app-message-dialog"); layout.setMargin(false); layout.setSpacing(true); messageLabel = new CubaLabel(); messageLabel.setStyleName("c-app-message-dialog-text"); messageLabel.setWidth(100, Sizeable.Unit.PERCENTAGE); DialogAction action = new DialogAction(DialogAction.Type.OK); okButton = createButton(action); okButton.setClickHandler(me -> { try { action.actionPerform(ui.getTopLevelWindow()); } finally { ui.removeWindow(window); } }); layout.addComponent(messageLabel); layout.addComponent(okButton); layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT); window.setContent(layout); ThemeConstants theme = ui.getApp().getThemeConstants(); window.setWidth(theme.get("cuba.web.WebWindowManager.messageDialog.width")); }