Skip to content
Snippets Groups Projects
Commit dc31fb7d authored by Edward Brown's avatar Edward Brown
Browse files

Added RowLocation class.

- Added RowLocation class for storing paths to nodes in the BatchWidget.
- Added description as a concept in new dev-docs page for BatchWidget.

Re #22263
parent 475f554d
No related branches found
No related tags found
No related merge requests found
.. _BatchWidget:
=============================
Batch Widget Developer Manual
=============================
.. contents:: Contents
:local:
The Batch Widget is a hierarchical grid-based widget designed for interfaces which need a
spreadsheet-like interface for configuring and indicating the status of multiple (batch) reduction
jobs.
========
Concepts
========
Row Location
^^^^^^^^^^^^
A row location is the notion of an individual table row's position within the table. Since the
table is unlike a traditional spreadsheet in that it is hierarchical the table is more like a tree
of rows where all non-leaf nodes can have any number of children.
In practice some interfaces, such as Reflectometry are likely to want to constrain the
number of children or depth of the tree, and the batch widget has mechanisms for performing this.
Currently a row location is represented as a path from the root node to the row node in question,
this is actualised in the code as an ordered list of integers where each element represents the index
of the next node in the path relative to it's predecessor in the path. Some example nodes, their
corresponding paths, and their representations are illustrated in the diagram below.
......@@ -77,6 +77,7 @@ set ( SRC_FILES
src/DataProcessorUI/QDataProcessorWidget.cpp
src/DataProcessorUI/QtDataProcessorOptionsDialog.cpp
src/DataProcessorUI/VectorString.cpp
src/Batch/RowLocation.cpp
src/DataSelector.cpp
src/DiagResults.cpp
src/DoubleSpinBox.cpp
......@@ -176,6 +177,7 @@ set ( MOC_FILES
inc/MantidQtWidgets/Common/SelectionNotificationService.h
inc/MantidQtWidgets/Common/AlgorithmSelectorWidget.h
inc/MantidQtWidgets/Common/CheckboxHeader.h
inc/MantidQtWidgets/Common/Batch/RowLocation.h
inc/MantidQtWidgets/Common/DataProcessorUI/AbstractTreeModel.h
inc/MantidQtWidgets/Common/DataProcessorUI/QtCommandAdapter.h
inc/MantidQtWidgets/Common/DataProcessorUI/GenericDataProcessorPresenter.h
......
#ifndef MANTIDQTMANTIDWIDGETS_ROWLOCATION_H_
#define MANTIDQTMANTIDWIDGETS_ROWLOCATION_H_
#include <vector>
#include "MantidQtWidgets/Common/DllOption.h"
namespace MantidQt {
namespace MantidWidgets {
namespace Batch {
using RowPath = std::vector<int>;
class EXPORT_OPT_MANTIDQT_COMMON RowLocation {
public:
RowLocation(RowPath path);
RowPath const &path() const;
int rowRelativeToParent() const;
bool isRoot() const;
private:
RowPath m_path;
};
}
}
}
#endif
#include "MantidQtWidgets/Common/Batch/RowLocation.h"
namespace MantidQt {
namespace MantidWidgets {
namespace Batch {
RowLocation::RowLocation(RowPath path) : m_path(std::move(path)) {}
RowPath const &RowLocation::path() const { return m_path; }
int RowLocation::rowRelativeToParent() const { return m_path.back(); }
bool RowLocation::isRoot() const { return m_path.empty(); }
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment