@Override public boolean switchToTabPm(PmElement fromTab, PmElement toTab) { PmElement _fromTab = fromTab != null ? fromTab : getCurrentTabPm(); // ensure that the to-tab is initialized (was an issue in domain specific unit tests): toTab.getPmTooltip(); // Delegate to an undoable command. PmTabChangeCommand tabChangeCommand = new PmTabChangeCommand(this, _fromTab, toTab); for (CmdDecoratorDefintion d : pmCmdDecoratorDefinitions) { if (d.isDecoratorForSwitch(_fromTab, toTab)) { tabChangeCommand.addCommandDecorator(d.getDecorator()); } } PmTabChangeCommand executedCommand = (PmTabChangeCommand) tabChangeCommand.doIt(); if (LOG.isDebugEnabled() && executedCommand.getCommandState() != CommandState.EXECUTED) { String msg = "The UI logic prevented a switch from tab " + PmUtil.getPmLogString(_fromTab) + " to " + PmUtil.getPmLogString(toTab) + "."; if (executedCommand.getVetoCommandDecorator() != null) { msg += " It has been prevented by the command decorator: " + executedCommand.getVetoCommandDecorator(); } LOG.debug(msg); } // If the UI logic prevents the tab navigation, no exception will be thrown. // So we check here if the tab navigation was really successfully performed. return executedCommand.getCommandState() == CommandState.EXECUTED; }
/** * The default implementation just provides the set of all sub-elements. * * <p>Please override the implementation if that default behavior does not match. * * @return The set of tabs. */ @Override public List<PmElement> getTabPms() { return PmUtil.getPmChildrenOfType(this, PmElement.class); }