@Override protected void addAction(Action action) { ActionsHolder actionsHolder = (ActionsHolder) component; List<Action> existingActions = new ArrayList<>(actionsHolder.getActions()); for (Action existingAction : existingActions) { // Comparing the id of an existing action with the full Id (including path) of the action to be added if (Objects.equals(existingAction.getId(), actionId)) { int index = existingActions.indexOf(existingAction); actionsHolder.removeAction(existingAction); actionsHolder.addAction(action, index); break; } } } }
@Override protected boolean hasOwnAction(String id) { ActionsHolder actionsHolder = (ActionsHolder) component; return actionsHolder.getAction(id) != null; }
@Override public void collectionChanged(CollectionDatasource.CollectionChangeEvent e) { for (Action action : actionsHolder.getActions()) { action.refreshState(); } }
protected void loadActions(ActionsHolder actionsHolder, Element element) { Element actionsEl = element.element("actions"); if (actionsEl == null) return; for (Element actionEl : actionsEl.elements("action")) { actionsHolder.addAction(loadDeclarativeAction(actionsHolder, actionEl)); } }
if (StringUtils.isEmpty(id)) { throw new GuiDevelopmentException("No action id provided", context.getFullFrameId(), "ActionsHolder ID", actionsHolder.getId());
@Override public void itemPropertyChanged(Datasource.ItemPropertyChangeEvent e) { for (Action action : actionsHolder.getActions()) { action.refreshState(); } }
@Override protected void loadActions(ActionsHolder actionsHolder, Element element) { Element actionsEl = element.element("actions"); if (actionsEl == null) return; for (Element actionEl : Dom4j.elements(actionsEl, "action")) { actionsHolder.addAction(loadDeclarativeAction(actionsHolder, actionEl)); String actionId = actionEl.attributeValue("id"); context.addPostInitTask(new ActionHolderAssignActionPostInitTask(actionsHolder, actionId, context.getFrame())); } }
@Nullable @Override default Object getSubPart(String name) { return getAction(name); } }
@Override public void stateChanged(Datasource.StateChangeEvent e) { for (Action action : actionsHolder.getActions()) { action.refreshState(); } }
/** * @return an action by its ID * @throws java.lang.IllegalArgumentException if not found */ @Nonnull default Action getActionNN(String id) { Action action = getAction(id); if (action == null) { throw new IllegalStateException("Unable to find action with id " + id); } return action; }
@Override public void itemChanged(Datasource.ItemChangeEvent e) { for (Action action : actionsHolder.getActions()) { action.refreshState(); } }
if (component != null) { if (component instanceof ActionsHolder) { return ((ActionsHolder) component).getAction(id); } else { throw new IllegalArgumentException(
Action action = ((ActionsHolder) holder).getAction(id); if (action == null) { throw new GuiDevelopmentException(String.format(