private void selectAfterClear(int index) {
   if (mySource.isEmpty()) {
     getOnLastItemDeleted().run();
   } else {
     if (index < mySource.size()) {
       Cell target = getChildCells().get(index);
       CellActions.toFirstFocusable(target).run();
     } else {
       Cell target = getChildCells().get(index - 1);
       CellActions.toLastFocusable(target).run();
     }
   }
 }
コード例 #2
0
    private Runnable replaceWith(final BinaryExpression newExpr) {
      final Mapper<?, ?> root = Mappers.getRoot(myMapper);

      BinaryExpression oldExpr = myMapper.getSource();
      oldExpr.replaceWith(newExpr);

      Expression left = oldExpr.left.get();
      if (left != null) {
        left.removeFromParent();
      }
      Expression right = oldExpr.right.get();
      if (right != null) {
        right.removeFromParent();
      }

      newExpr.left.set(left);
      newExpr.right.set(right);

      new ExprBinOpTransformer().balanceOnOperationChange(newExpr).parent().get();

      return CellActions.toEnd(
          ((BinaryExpressionMapper) root.getDescendantMapper(newExpr)).getTarget().sign);
    }