@Override public void performAction(String actionId, Map<String, String> parameters) { final Action action; if (actionId != null && (action = getAction(actionId)) != null) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent actionEvent = new ActionEvent(presentation, this, parameters); action.update(actionEvent); if (presentation.isEnabled() && presentation.isVisible()) { action.actionPerformed(actionEvent); } } }
public final Presentation getPresentation(@NotNull Action action) { Presentation presentation = myAction2Presentation.get(action); if (presentation == null) { presentation = action.getTemplatePresentation().clone(); myAction2Presentation.put(action, presentation); } return presentation; } }
Action response = Dialogs.create() .owner( null) .title("Confirmation") .masthead("Are you sure to delete UserLevel: '"+ul.getLevelname()+"' ?") .message(entry) .showConfirm(); System.out.println("response: " + response); if (response.toString().equals("YES")){ if(!Main.db.em.getTransaction().isActive()) Main.db.em.getTransaction().begin(); Main.db.em.remove(ul); Main.db.em.getTransaction().commit(); tbvMain.getItems().remove(tbvMain.getSelectionModel().getSelectedIndex()); }
private void expandActionGroup( List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) { final Action[] children = mainActionGroup.getChildren(null); for (final Action action : children) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent e = new ActionEvent(presentation, actionManager); action.update(e); if (presentation.isVisible()) { // add only visible items newVisibleActions.add(action); } if (action2barItem.containsKey(action)) { action2barItem.get(action).update(); } } }
@Override public void handleEvent(Event evt) { ActionEvent event = new ActionEvent(presentation, actionManager); action.actionPerformed(event); } },
private void expandActionGroup( List<Action> newVisibleActions, ActionManager actionManager, ActionGroup mainActionGroup) { final Action[] children = mainActionGroup.getChildren(null); for (final Action action : children) { final Presentation presentation = presentationFactory.getPresentation(action); final ActionEvent e = new ActionEvent(presentation, actionManager); action.update(e); if (presentation.isVisible()) { // add only visible items newVisibleActions.add(action); } if (action2barItem.containsKey(action)) { action2barItem.get(action).update(); } } }
/** * Returns promise returned by PromisableAction or already resolved promise for * non-PromisableAction. */ private Promise<Void> promiseAction(final Action action, final ActionEvent event) { if (action instanceof PromisableAction) { return ((PromisableAction) action).promise(event); } else { action.actionPerformed(event); return Promises.resolve(null); } }
@Override public void onActionSelected(Action action) { ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled() && e.getPresentation().isVisible()) { view.hide(); action.actionPerformed(e); } }
@Override public int compare(Action o1, Action o2) { int compare = compare( o1.getTemplatePresentation().getText(), o2.getTemplatePresentation().getText()); if (compare == 0 && !o1.equals(o2)) { return o1.hashCode() - o2.hashCode(); } return compare; }
final int time = calculateTimeForDeceleration(distance); if (time > 0) { action.update(-dx, -dy, time, mDecelerateInterpolator);
/** Mouse Click handler. */ @Override public void onClick(ClickEvent event) { if (!enabled) { return; } // todo handle popup group ActionEvent e = new ActionEvent(presentation, actionManager); if (action instanceof ActionGroup && !(action instanceof CustomComponentAction) && ((ActionGroup) action).isPopup()) { } else { action.actionPerformed(e); } }
Action response = dialog.showConfirm(); System.out.println("RESPONSE = "+ response.toString());
/** * Finds and runs an action cancelling original key event * * @param actionIds list containing action ids * @param keyEvent original key event */ private void runActions(List<String> actionIds, Event keyEvent) { for (String actionId : actionIds) { Action action = actionManager.getAction(actionId); if (action == null) { continue; } ActionEvent e = new ActionEvent(presentationFactory.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled()) { /** Stop handling the key event */ keyEvent.preventDefault(); keyEvent.stopPropagation(); /** Perform the action */ action.actionPerformed(e); } } }
@Override protected ActionGroup updateActions() { ActionGroup actionGroup = super.updateActions(); for (Action action : actionGroup.getChildren(null)) { Presentation presentation = action.getTemplatePresentation(); presentation.putClientProperty(BREAKPOINT, breakpoint); } return actionGroup; } }
child.update(new ActionEvent(presentation, actionManager));
@Override public void onMenuItemSelected(MenuItem menuItem) { final Object data = menuItem.getData(); if (data instanceof Tab) { final WidgetToShow widget = tabs2Widgets.get(data); if (widget != null) { activateWidget(widget); delegate.onWidgetFocused(widget.getWidget()); } } else if (data instanceof BaseAction) { ((Action) data).actionPerformed(null); } }
private void handleKey(NativeEvent event) { SignalEvent signalEvent = SignalEventUtils.create((Event) event, false); CharCodeWithModifiers keyBinding = keyBindingAgent.getKeyBinding(JavaExtension.JAVA_CLASS_STRUCTURE); if (signalEvent == null || keyBinding == null) { return; } int digest = CharCodeWithModifiers.computeKeyDigest(signalEvent); if (digest == keyBinding.getKeyDigest()) { Action action = actionManager.getAction(JavaExtension.JAVA_CLASS_STRUCTURE); if (action != null) { ActionEvent e = new ActionEvent(presentationFactor.getPresentation(action), actionManager); action.update(e); if (e.getPresentation().isEnabled()) { event.preventDefault(); event.stopPropagation(); action.actionPerformed(e); } } } } }
Presentation presentation = action.getTemplatePresentation(); String text = presentation.getText(); if (text != null && regExp.test(text)) { Presentation presentation = action.getTemplatePresentation(); String text = presentation.getText(); if (text != null && regExp.test(text)) {
anAction.update(new ActionEvent(presentation, actionManager)); if (anAction instanceof ActionGroup) { ActionGroup childGroup = (ActionGroup) anAction;
/** Handle Mouse Click */ private void onRowClicked(Element tr) { if (isRowDisabled(tr) || tr == subPopupAnchor) { return; } int itemIndex = Integer.parseInt(tr.getAttribute("item-index")); Action menuItem = list.get(itemIndex); if (menuItem instanceof ActionGroup && (!((ActionGroup) menuItem).canBePerformed() && Utils.hasVisibleChildren( (ActionGroup) menuItem, presentationFactory, actionManager))) { openSubPopup(tr); } else { if (actionSelectedHandler != null) { actionSelectedHandler.onActionSelected(menuItem); } ActionEvent e = new ActionEvent(presentationFactory.getPresentation(menuItem), actionManager); menuItem.actionPerformed(e); } }