/** * Re-arranges the execution order such that the specified operators immediately follow <code> * insertAfter</code>. */ public void bringToFront(Collection<Operator> movedOperators, Operator insertAfter) { this.operators.removeAll(movedOperators); int index = this.operators.indexOf(insertAfter) + 1; for (Operator op : movedOperators) { this.operators.add(index++, op); } updateExecutionOrder(); fireUpdate(); }
/** * Moves an operator to the given index. (If the old index is smaller than the new one, the new * one will automatically be reduced by one.) */ public void moveToIndex(Operator op, int newIndex) { int oldIndex = operators.indexOf(op); Process process = getEnclosingOperator().getProcess(); if (oldIndex != -1) { operators.remove(op); if (process != null) { int oldIndexAmongEnabled = getEnabledOperators().indexOf(op); process.fireOperatorRemoved(op, oldIndex, oldIndexAmongEnabled); } if (oldIndex < newIndex) { newIndex--; } operators.add(newIndex, op); if (process != null) { process.fireOperatorAdded(op); } fireUpdate(); updateExecutionOrder(); } }