@Override public void undo() { final List<ColumnConstraints> constraintsList = columnContraintsMeta.getValue(gridPaneObject); assert columnIndex < constraintsList.size(); for (int i = 0; i < insertCount; i++) { constraintsList.remove(columnIndex); } columnContraintsMeta.setValue(gridPaneObject, constraintsList); }
@Override public void redo() { final List<ColumnConstraints> constraintsList = columnContraintsMeta.getValue(gridPaneObject); final ColumnConstraints template; if (columnIndex >= 1) { template = constraintsList.get(columnIndex - 1); } else { template = null; } for (int i = 0; i < insertCount; i++) { constraintsList.add(columnIndex, makeColumnConstraints(template)); } columnContraintsMeta.setValue(gridPaneObject, constraintsList); }
public InsertColumnConstraintsJob( FXOMObject gridPaneObject, int columnIndex, int insertCount, EditorController editorController) { super(editorController); assert gridPaneObject instanceof FXOMInstance; assert gridPaneObject.getSceneGraphObject() instanceof GridPane; assert columnIndex >= 0; assert columnIndex <= columnContraintsMeta.getValue((FXOMInstance) gridPaneObject).size(); assert insertCount >= 1; this.gridPaneObject = (FXOMInstance) gridPaneObject; this.columnIndex = columnIndex; this.insertCount = insertCount; }