+void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
+{
+ // Invalid feature case on abort of the operation
+ if (theFeature.get() == NULL)
+ return;
+ if (theFeature->isAction() || !theFeature->data())
+ return;
+ foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
+ if (!eachWidget->feature().get())
+ eachWidget->setFeature(theFeature);
+ eachWidget->restoreValue();
+ }
+ // the repaint is used here to immediately react in GUI to the values change.
+ repaint();
+}
+
+void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature)
+{
+ // Invalid feature case on abort of the operation
+ if (theFeature.get() == NULL)
+ return;
+ if (theFeature->isAction() || !theFeature->data())
+ return;
+
+ if (myWidgets.empty()) {
+ ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
+ QString aXmlRepr = anOperation->getDescription()->xmlRepresentation();
+
+ ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myOperationMgr->workshop());
+ aFactory.createPanel(contentWidget(), theFeature);
+ /// Apply button should be update if the feature was modified by the panel
+ myOperationMgr->onValidateOperation();
+ }
+ std::shared_ptr<Config_FeatureMessage> aFeatureInfo =
+ myOperationMgr->workshop()->featureInfo(theFeature->getKind().c_str());
+ if (aFeatureInfo.get())
+ findButton(PROP_PANEL_OK_PLUS)->setVisible(aFeatureInfo->isApplyContinue());
+}
+
+ModuleBase_ModelWidget* XGUI_PropertyPanel::activeWidget(const bool isUseCustomWidget) const
+{
+ if (isUseCustomWidget && myInternalActiveWidget)
+ return myInternalActiveWidget;
+
+ return myActiveWidget;
+}
+
+void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget)
+{
+ // it is possible that the property panel widgets have not been visualized
+ // (e.g. on start operation), so it is strictly important to do not check visualized state
+ activateNextWidget(theWidget, false);
+}
+
+void XGUI_PropertyPanel::onFocusInWidget(ModuleBase_ModelWidget* theWidget)
+{
+#ifdef DEBUG_ACTIVE_WIDGET
+ std::cout << "onFocusInWidget" << std::endl;
+#endif
+ if (theWidget->canAcceptFocus())
+ activateWidget(theWidget);
+}
+
+void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget)
+{
+ // this slot happens when some widget lost focus, the next widget which accepts the focus
+ // should be shown, so the second parameter is true
+ // it is important for features where in cases the same attributes are used, isCase for this
+ // attribute returns true, however it can be placed in hidden stack widget(extrusion: elements,
+ // sketch multi rotation -> single/full point)
+ // it is important to check the widget visibility to do not check of the next widget visible
+ // state if the current is not shown. (example: sketch circle re-entrant operation after mouse
+ // release in the viewer, next, radius,
+ // widget should be activated but the first is not visualized)
+ bool isVisible = theWidget->isVisible();
+ activateNextWidget(theWidget, isVisible);
+}
+
+
+void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget,
+ const bool isCheckVisibility)
+{
+ // TO CHECK: Editing operation does not have automatical activation of widgets
+ if (isEditingMode()) {
+ activateWidget(NULL);
+ return;
+ }
+ ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+
+ QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(), aLast = myWidgets.end();
+ bool isFoundWidget = false;
+ ModuleBase_Tools::activateWindow(this, "XGUI_PropertyPanel::activateNextWidget()");