Пример #1
0
 public boolean canMove(Layer layer) {
   final Layer parentLayer = layer.getParent();
   if (parentLayer == null) {
     return false;
   }
   final int layerIndex = parentLayer.getChildIndex(layer.getId());
   return layerIndex > 0;
 }
Пример #2
0
 void moveUp(Layer layer) {
   if (canMove(layer)) {
     final Layer parentLayer = layer.getParent();
     final int layerIndex = layer.getParent().getChildIndex(layer.getId());
     parentLayer.getChildren().remove(layer);
     parentLayer.getChildren().add(layerIndex - 1, layer);
   }
 }