@Override public void modifyCommandCallTree(CommandCall element, List<ExampleCommandCall> examples, List<CommandCall> beforeExamples) { super.modifyCommandCallTree(element, examples, beforeExamples); CommandCall oldParent = element.getParent(); element.transferToParent(null); // we have to pull the example command to be the parent of the execute command // on the TR element if (element.getElement().isNamed("td")) { oldParent.transferToParent(element); } if (this.isBeforeExample(element)) { beforeExamples.add(element); } else { examples.add(new ExampleCommandCall(this.getExampleName(element), element)); } }
@Override public void modifyCommandCallTree(CommandCall element, List<ExampleCommandCall> examples, List<CommandCall> beforeExamples) { super.modifyCommandCallTree(element, examples, beforeExamples); CommandCall oldParent = element.getParent(); element.transferToParent(null); // we have to pull the example command to be the parent of the execute command // on the TR element if (element.getElement().isNamed("td")) { oldParent.transferToParent(element); } if (this.isBeforeExample(element)) { beforeExamples.add(element); } else { examples.add(new ExampleCommandCall(this.getExampleName(element), element)); } }
Element cellElement = cells[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.transferToParent(rowCommand); rowCommand.transferToParent(commandCall); rowCommand.modifyTree(examples, beforeExamples); call.transferToParent(null);
Element cellElement = cells[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.transferToParent(rowCommand); rowCommand.transferToParent(commandCall); rowCommand.modifyTree(examples, beforeExamples); call.transferToParent(null);
@Override public void performModification(CommandCall commandCall, List<ExampleCommandCall> examples, List<CommandCall> beforeExamples) { /* We set the bypass flag on the main <table> node so it's not executed anymore. We can't really remove it because if we remove it, we'll have to add all the new children to this node's parent node. However, the 'modify' method is currently processing the parent node and has made a copy of the list of children (to avoid a concurrent modification exception). This means that any children added to the parent node won't have 'modify' called on them. And if any of the children are examples, then they won't be processed properly. */ commandCall.setBypassExecution(true); ListSupport listSupport = new ListSupport(commandCall); for (ListEntry listEntry : listSupport.getListEntries()) { commandCall.setElement(listEntry.getElement()); if (listEntry.isItem()) { CommandCall itemCommand = duplicateCommandForDifferentElement(commandCall, listEntry.getElement()); itemCommand.setConstantForExecution(LEVEL_VARIABLE, getLevel(commandCall)); itemCommand.transferToParent(commandCall); } if (listEntry.isList()) { // recursive call CommandCall itemCommand = duplicateCommandForDifferentElement(commandCall, listEntry.getElement()); itemCommand.setConstantForExecution(LEVEL_VARIABLE, getLevel(commandCall) + 1); itemCommand.transferToParent(commandCall); } } }
@Override public void performModification(CommandCall commandCall, List<ExampleCommandCall> examples, List<CommandCall> beforeExamples) { /* We set the bypass flag on the main <table> node so it's not executed anymore. We can't really remove it because if we remove it, we'll have to add all the new children to this node's parent node. However, the 'modify' method is currently processing the parent node and has made a copy of the list of children (to avoid a concurrent modification exception). This means that any children added to the parent node won't have 'modify' called on them. And if any of the children are examples, then they won't be processed properly. */ commandCall.setBypassExecution(true); ListSupport listSupport = new ListSupport(commandCall); for (ListEntry listEntry : listSupport.getListEntries()) { commandCall.setElement(listEntry.getElement()); if (listEntry.isItem()) { CommandCall itemCommand = duplicateCommandForDifferentElement(commandCall, listEntry.getElement()); itemCommand.setConstantForExecution(LEVEL_VARIABLE, getLevel(commandCall)); itemCommand.transferToParent(commandCall); } if (listEntry.isList()) { // recursive call CommandCall itemCommand = duplicateCommandForDifferentElement(commandCall, listEntry.getElement()); itemCommand.setConstantForExecution(LEVEL_VARIABLE, getLevel(commandCall) + 1); itemCommand.transferToParent(commandCall); } } }