@Test public void testMoveLayer2Right() { layerRightAction.moveRight(layer2); Assert.assertEquals(3, layer0.getChildren().size()); Assert.assertEquals(0, layer1.getChildIndex("layer2")); }
void moveRight(Layer layer) { if (canMove(layer)) { final Layer parentLayer = layer.getParent(); final int layerIndex = parentLayer.getChildIndex(layer.getId()); final Layer targetLayer = parentLayer.getChildren().get(layerIndex - 1); parentLayer.getChildren().remove(layer); targetLayer.getChildren().add(layer); } }
MoveLayerRightAction extends AbstractAction { void moveRight(Layer layer) { if (canMove(layer)) { final Layer parentLayer = layer.getParent(); final int layerIndex = parentLayer.getChildIndex(layer.getId()); final Layer targetLayer = parentLayer.getChildren().get(layerIndex - 1); parentLayer.getChildren().remove(layer); targetLayer.getChildren().add(layer); } } }
MoveLayerRightAction extends AbstractAction { void moveRight(Layer layer) { if (canMove(layer)) { final Layer parentLayer = layer.getParent(); final int layerIndex = parentLayer.getChildIndex(layer.getId()); final Layer targetLayer = parentLayer.getChildren().get(layerIndex - 1); parentLayer.getChildren().remove(layer); targetLayer.getChildren().add(layer); } } MoveLayerRightAction(AppContext appContext); }
MoveLayerRightAction extends AbstractAction { void moveRight(Layer layer) { if (canMove(layer)) { final Layer parentLayer = layer.getParent(); final int layerIndex = parentLayer.getChildIndex(layer.getId()); final Layer targetLayer = parentLayer.getChildren().get(layerIndex - 1); parentLayer.getChildren().remove(layer); targetLayer.getChildren().add(layer); } } MoveLayerRightAction(AppContext appContext); @Override void actionPerformed(ActionEvent e); boolean canMove(Layer layer); }
MoveLayerRightAction extends AbstractAction { void moveRight(Layer layer) { if (canMove(layer)) { final Layer parentLayer = layer.getParent(); final int layerIndex = parentLayer.getChildIndex(layer.getId()); final Layer targetLayer = parentLayer.getChildren().get(layerIndex - 1); parentLayer.getChildren().remove(layer); targetLayer.getChildren().add(layer); } } MoveLayerRightAction(AppContext appContext); @Override void actionPerformed(ActionEvent e); boolean canMove(Layer layer);  }