1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: CollectionPlugin_Field.cpp
4 // Created: 08 Oct 2014
5 // Author: Sergey BELASH
7 #include "CollectionPlugin_Field.h"
9 #include <ModelAPI_Data.h>
10 #include <ModelAPI_Document.h>
11 #include <ModelAPI_AttributeStringArray.h>
12 #include <ModelAPI_AttributeSelectionList.h>
13 #include <ModelAPI_AttributeIntArray.h>
14 #include <ModelAPI_AttributeTables.h>
15 #include <ModelAPI_ResultField.h>
16 #include <ModelAPI_Session.h>
17 #include <ModelAPI_Validator.h>
19 CollectionPlugin_Field::CollectionPlugin_Field()
23 void CollectionPlugin_Field::initAttributes()
25 data()->addAttribute(SELECTED_ID(), ModelAPI_AttributeSelectionList::typeId());
26 // for the whole part result it is not obligatory
27 ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SELECTED_ID());
29 data()->addAttribute(COMPONENTS_NAMES_ID(), ModelAPI_AttributeStringArray::typeId());
30 data()->addAttribute(STAMPS_ID(), ModelAPI_AttributeIntArray::typeId());
31 data()->addAttribute(VALUES_ID(), ModelAPI_AttributeTables::typeId());
34 void CollectionPlugin_Field::execute()
36 if (results().empty() || firstResult()->isDisabled()) { // just create result if not exists
37 ResultPtr aField = document()->createField(data());