예제 #1
0
  @Inject
  @Optional
  private void whenCaseIsRemoved(
      @UIEventTopic(RobotModelEvents.ROBOT_CASE_REMOVED) final RobotSuiteFileSection section) {
    if (section.getSuiteFile() == fileModel) {
      selectionLayerAccessor.preserveSelectionWhen(
          tableInputIsReplaced(),
          new Function<PositionCoordinate, PositionCoordinate>() {

            @Override
            public PositionCoordinate apply(final PositionCoordinate coordinate) {
              if (section.getChildren().isEmpty()) {
                return null;
              } else if (dataProvider.getRowObject(coordinate.getRowPosition())
                  instanceof AddingToken) {
                final RobotFileInternalElement lastCase =
                    section.getChildren().get(section.getChildren().size() - 1);
                return new PositionCoordinate(
                    coordinate.getLayer(),
                    coordinate.getColumnPosition(),
                    dataProvider.indexOfRowObject(lastCase));
              }
              return coordinate;
            }
          });
    }
  }
예제 #2
0
 @Inject
 @Optional
 private void whenCaseIsMoved(
     @UIEventTopic(RobotModelEvents.ROBOT_CASE_MOVED) final RobotSuiteFileSection section) {
   if (section.getSuiteFile() == fileModel) {
     sortModel.clear();
     selectionLayerAccessor.preserveElementSelectionWhen(tableInputIsReplaced());
   }
 }