IJobTreeView.h 4.53 KB
Newer Older
1
2
3
4
5
6
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
//     NScD Oak Ridge National Laboratory, European Spallation Source
//     & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
7
#pragma once
Gemma Guest's avatar
Gemma Guest committed
8
9
#include "MantidQtWidgets/Common/Batch/Cell.h"
#include "MantidQtWidgets/Common/Batch/Row.h"
10
11
12
#include "MantidQtWidgets/Common/Batch/RowLocation.h"
#include "MantidQtWidgets/Common/Batch/RowLocationAdapter.h"
#include "MantidQtWidgets/Common/Batch/RowPredicate.h"
13
#include "MantidQtWidgets/Common/Batch/Subtree.h"
14
#include "MantidQtWidgets/Common/DllOption.h"
Gemma Guest's avatar
Gemma Guest committed
15
#include "MantidQtWidgets/Common/HintStrategy.h"
16
17
18
19
20
21
22
23
24
25
26
#include <boost/optional.hpp>

namespace MantidQt {
namespace MantidWidgets {
namespace Batch {

class EXPORT_OPT_MANTIDQT_COMMON JobTreeViewSubscriber {
public:
  virtual void notifyCellTextChanged(RowLocation const &itemIndex, int column,
                                     std::string const &oldValue,
                                     std::string const &newValue) = 0;
27
  virtual void notifySelectionChanged() = 0;
28
  virtual void notifyRowInserted(RowLocation const &newRowLocation) = 0;
29
30
31
  virtual void notifyAppendAndEditAtChildRowRequested() = 0;
  virtual void notifyAppendAndEditAtRowBelowRequested() = 0;
  virtual void notifyEditAtRowAboveRequested() = 0;
32
33
  virtual void notifyRemoveRowsRequested(
      std::vector<RowLocation> const &locationsOfRowsToRemove) = 0;
34
  virtual void notifyCutRowsRequested() = 0;
35
36
37
38
39
40
41
42
43
44
45
46
47
  virtual void notifyCopyRowsRequested() = 0;
  virtual void notifyPasteRowsRequested() = 0;
  virtual void notifyFilterReset() = 0;
  virtual ~JobTreeViewSubscriber() = default;
};

class EXPORT_OPT_MANTIDQT_COMMON IJobTreeView {
public:
  virtual void filterRowsBy(std::unique_ptr<RowPredicate> predicate) = 0;
  virtual void filterRowsBy(RowPredicate *predicate) = 0;
  virtual void resetFilter() = 0;
  virtual bool hasFilter() const = 0;

Edward Brown's avatar
Edward Brown committed
48
49
50
  virtual void
  setHintsForColumn(int column, std::unique_ptr<HintStrategy> hintStrategy) = 0;
  virtual void setHintsForColumn(int column, HintStrategy *hintStrategy) = 0;
51

52
  virtual void subscribe(JobTreeViewSubscriber *subscriber) = 0;
53

54
55
56
57
58
59
60
  virtual RowLocation insertChildRowOf(RowLocation const &parent, int beforeRow,
                                       std::vector<Cell> const &rowText) = 0;
  virtual RowLocation insertChildRowOf(RowLocation const &parent,
                                       int beforeRow) = 0;
  virtual RowLocation appendChildRowOf(RowLocation const &parent) = 0;
  virtual RowLocation appendChildRowOf(RowLocation const &parentLocation,
                                       std::vector<Cell> const &rowText) = 0;
61
62
63
  virtual void appendAndEditAtChildRow() = 0;
  virtual void appendAndEditAtRowBelow() = 0;
  virtual void editAtRowAbove() = 0;
64
65
66

  virtual void removeRowAt(RowLocation const &location) = 0;
  virtual void removeRows(std::vector<RowLocation> rowsToRemove) = 0;
Matthew Andrew's avatar
Matthew Andrew committed
67
68
  virtual void removeAllRows() = 0;

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  virtual bool isOnlyChildOfRoot(RowLocation const &location) const = 0;

  virtual void replaceRows(std::vector<RowLocation> replacementPoints,
                           std::vector<Subtree> replacements) = 0;

  virtual void appendSubtreesAt(RowLocation const &parent,
                                std::vector<Subtree> subtrees) = 0;
  virtual void appendSubtreeAt(RowLocation const &parent,
                               Subtree const &subtree) = 0;

  virtual void replaceSubtreeAt(RowLocation const &rootToRemove,
                                Subtree const &toInsert) = 0;
  virtual void insertSubtreeAt(RowLocation const &parent, int index,
                               Subtree const &subtree) = 0;

  virtual std::vector<Cell> cellsAt(RowLocation const &location) const = 0;
  virtual void setCellsAt(RowLocation const &location,
                          std::vector<Cell> const &rowText) = 0;

  virtual Cell cellAt(RowLocation location, int column) const = 0;
  virtual void setCellAt(RowLocation location, int column,
                         Cell const &cellText) = 0;

92
93
94
95
  virtual void clearSelection() = 0;
  virtual void expandAll() = 0;
  virtual void collapseAll() = 0;

96
97
98
99
  virtual std::vector<RowLocation> selectedRowLocations() const = 0;
  virtual boost::optional<std::vector<Subtree>> selectedSubtrees() const = 0;
  virtual boost::optional<std::vector<RowLocation>>
  selectedSubtreeRoots() const = 0;
Samuel Jones's avatar
Samuel Jones committed
100
  virtual int currentColumn() const = 0;
101
102
103
  virtual Cell deadCell() const = 0;
  virtual ~IJobTreeView() = default;
};
104
105
} // namespace Batch
} // namespace MantidWidgets
106
} // namespace MantidQt