Class MatrixDataHelper
- java.lang.Object
-
- com.nomagic.magicdraw.dependencymatrix.configuration.MatrixDataHelper
-
@OpenApiAll public class MatrixDataHelper extends java.lang.Object
Helper used to get and manage Dependency Matrix Data from external plugins. Please pay attention, that if the Dependency Matrix diagram is not opened, its data is not collected and dependency matrix component needs to be built.
-
-
Constructor Summary
Constructors Constructor Description MatrixDataHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MatrixData
buildMatrix(Diagram matrix)
Collects all data for provided matrix data component.static MatrixData
getMatrixData(Diagram matrix)
Gets the matrix diagram data object.static boolean
isEditable(Diagram matrix, ElementNode rowNode, ElementNode columnNode)
Checks whether the relation can be created/deleted between row node and column node depending on matrix dependency criteria.static boolean
isRebuildNeeded(Diagram matrix)
Checks if the current Dependency Matrix data is up to date or even are collected.static void
refreshMatrix(Diagram matrix)
Immediately rebuilds dependency matrix
-
-
-
Method Detail
-
getMatrixData
@CheckForNull public static MatrixData getMatrixData(Diagram matrix)
Gets the matrix diagram data object. Pleas note, that if the matrix is not already opened, it will be witout data. If you need to manage not opened matrices useMatrixDataHelper.buildMatrix()
method- Parameters:
matrix
- diagram of the dependency matrix- Returns:
- Dependency Matrix data component for specified diagram or
null
if this dependency matrix was not found. Before using data make sure if the matrix data is up to date and does not need to be rebuilt
-
buildMatrix
@CheckForNull public static MatrixData buildMatrix(Diagram matrix)
Collects all data for provided matrix data component. This may be CPU/Time intensive task, so use it only in cases, when not opened matrix diagrams have to be used- Parameters:
matrix
- Dependency Matrix diagram instance- Returns:
- Dependency Matrix data component for specified diagram or
null
if this dependency matrix was not found
-
isRebuildNeeded
public static boolean isRebuildNeeded(Diagram matrix)
Checks if the current Dependency Matrix data is up to date or even are collected. If this method returnstrue
you need to callMatrixDataHelper.buildMatrix()
in order to get correct data- Parameters:
matrix
- Dependency Matrix diagram instance- Returns:
true
if rebuild is required
-
refreshMatrix
public static void refreshMatrix(Diagram matrix)
Immediately rebuilds dependency matrix- Parameters:
matrix
- diagram element of dependency matrix to rebuild
-
isEditable
public static boolean isEditable(Diagram matrix, ElementNode rowNode, ElementNode columnNode)
Checks whether the relation can be created/deleted between row node and column node depending on matrix dependency criteria.- Parameters:
matrix
- diagram element of dependency matrixrowNode
- row node that needs to be checkedcolumnNode
- column node that needs to be checked- Returns:
- whether the relation can be created/deleted between given row/column nodes
-
-