/**
   * Returns a <code>Command</code> that set both the sorting and filtering for this particular list
   * compartment.
   *
   * @return the command
   */
  public Command getApplyCommand() {
    Command cmd = UnexecutableCommand.INSTANCE;
    if (CHILD_PAGE.equals(pageType)) {
      List newSortedObjects = Collections.EMPTY_LIST;
      if (_sorting.equals(Sorting.MANUAL_LITERAL)) {
        newSortedObjects = new ArrayList();
        for (Iterator itr = elementCollection.iterator(); itr.hasNext(); ) {
          SortFilterElement element = (SortFilterElement) itr.next();
          newSortedObjects.add(element.getData());
        }
      }

      List newFilteredObjects = Collections.EMPTY_LIST;
      if (_filtering.equals(Filtering.MANUAL_LITERAL)) {
        newFilteredObjects = new ArrayList();
        for (Iterator itr = elementCollection.iterator(); itr.hasNext(); ) {
          SortFilterElement element = (SortFilterElement) itr.next();
          if (!element.isVisible()) {
            newFilteredObjects.add(element.getData());
          }
        }
        if (_filtering.equals(Filtering.MANUAL_LITERAL) && newFilteredObjects.size() == 0) {
          _filtering = Filtering.NONE_LITERAL;
        }
      }

      // Add the objects filtered otherwise.
      if (!_shownAsAlternateViewItems.isEmpty()
          && Collections.EMPTY_LIST.equals(newFilteredObjects)) {
        newFilteredObjects = new ArrayList();
      }
      newFilteredObjects.addAll(_shownAsAlternateViewItems);

      ChangeSortFilterRequest request =
          new ChangeSortFilterRequest(
              _filtering,
              newFilteredObjects,
              _filteringKeys,
              _sorting,
              newSortedObjects,
              _sortingKeys);

      cmd = editPart.getCommand(request);
    }
    return cmd;
  }