bool Config_FeatureReader::isInternalFeature(xmlNodePtr theNode)
{
- std::string prop = getProperty(theNode, FEATURE_INTERNAL);
+ std::string prop = getProperty(theNode, ATTRIBUTE_INTERNAL);
std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
if (prop.empty() || prop == "false" || prop == "0") {
return false;
const static char* FEATURE_TEXT = "title";
const static char* FEATURE_KEYSEQUENCE = "keysequence";
const static char* FEATURE_NESTED = "nested";
-const static char* FEATURE_INTERNAL = "internal";
-const static char* FEATURE_OBLIGATORY = "obligatory";
+
+const static char* ATTRIBUTE_INTERNAL = "internal";
+const static char* ATTRIBUTE_OBLIGATORY = "obligatory";
+const static char* ATTRIBUTE_CONCEALMENT = "concealment";
// TODO: Rename
const static char* PREVIOUS_FEATURE_PARAM = "previous_feature_param";
const static char* ANY_WDG_TOOLTIP = FEATURE_TOOLTIP;
activate="true"
shape_types="face"
use_subshapes="true"
+ concealment="true"
/>
<doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="1" icon=":icons/dimension_v.png" tooltip="Set size of extrusion">
<validator id="GeomValidators_Positive"/>
return true;
}
-void Model_ValidatorsFactory::registerNotObligatory(
- std::string theFeature, std::string theAttribute)
+void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, std::string theAttribute)
{
std::map<std::string, ModelAPI_Validator*>::const_iterator it = myIDs.find(kDefaultId);
if (it != myIDs.end()) {
}
}
}
+
+void Model_ValidatorsFactory::registerConcealment(std::string theFeature, std::string theAttribute)
+{
+
+}
+
+
/// so, it is not needed for the standard validation mechanism
virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
+ /// register that this attribute conceals in the object browser
+ /// all referenced features after execution
+ virtual void registerConcealment(std::string theFeature, std::string theAttribute);
+
protected:
void addDefaultValidators(std::list<ModelAPI_Validator*>& theValidators) const;
/// Get instance from Session
/// so, it is not needed for the standard validation mechanism
virtual void registerNotObligatory(std::string theFeature, std::string theAttribute) = 0;
+ /// register that this attribute conceals in the object browser
+ /// all referenced features after execution
+ virtual void registerConcealment(std::string theFeature, std::string theAttribute) = 0;
+
protected:
/// Get instance from Session
ModelAPI_ValidatorsFactory()
myParentId(theParentId)
{
myIsComputedDefault = false;
- myIsObligatory = theData ? theData->getBooleanAttribute(FEATURE_OBLIGATORY, true) : true;
myAttributeID = theData ? theData->widgetId() : "";
}
/// on operation's execute, like radius for circle's constraint (can not be zero)
bool isComputedDefault() { return myIsComputedDefault; }
- /// Returns false for non-obligatory widgets which are
- /// valid even if they are not initialized
- bool isObligatory() { return myIsObligatory; }
-
/// Defines if it is supposed that the widget should interact with the viewer.
virtual bool isViewerSelector() { return false; }
FeaturePtr myFeature;
bool myIsComputedDefault; /// Value should be computed on execute,
- /// like radius for circle's constraint (can not be zero)
- bool myIsObligatory; /// Non-obligatory widget is valid even if it is not initialized
+ /// like radius for circle's constraint (can not be zero)
};
#endif
//Create a widget (doublevalue, groupbox, toolbox, etc.
QWidget* aWidget = createWidgetByType(aWdgType, theParent);
if (aWidget) {
- if (!myWidgetApi->getBooleanAttribute(FEATURE_INTERNAL, false)) {
+ if (!myWidgetApi->getBooleanAttribute(ATTRIBUTE_INTERNAL, false)) {
aWidgetLay->addWidget(aWidget);
} else {
aWidget->setVisible(false);
return result;
}
+void ModuleBase_WidgetFactory::processAttributes()
+{
+ // register that this attribute in feature is not obligatory for the feature execution
+ // so, it is not needed for the standard validation mechanism
+ bool isObligatory = true;
+ bool isConcealment = false;
+ if( myWidgetApi ){
+ isObligatory = myWidgetApi->getBooleanAttribute(ATTRIBUTE_OBLIGATORY, true);
+ isConcealment = myWidgetApi->getBooleanAttribute(ATTRIBUTE_CONCEALMENT, false);
+ }
+ boost::shared_ptr<ModelAPI_Session> aSession = ModelAPI_Session::get();
+ if (!isObligatory) {
+ aSession->validators()->registerNotObligatory(myParentId, myWidgetApi->widgetId());
+ }
+ if(isConcealment) {
+ aSession->validators()->registerConcealment(myParentId, myWidgetApi->widgetId());
+ }
+}
+
QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType,
QWidget* theParent)
{
#endif
}
if (result) {
- // register that this attribute in feature is not obligatory for the feature execution
- // so, it is not needed for the standard validation mechanism
- bool isObligatory =
- myWidgetApi ? myWidgetApi->getBooleanAttribute(FEATURE_OBLIGATORY, true) : true;
- if (!isObligatory) {
- ModelAPI_Session::get()->validators()->registerNotObligatory(
- myParentId, myWidgetApi->widgetId());
- }
+ processAttributes();
}
return result;
QString qs(const std::string& theStdString) const;
+ void processAttributes();
private:
Config_WidgetAPI* myWidgetApi;