Browse Source

Pull request #4940: REPORT-53130 避免组件配置面板界面在点击当前组件的时候被重置到属性面板

Merge in DESIGN/design from ~TOMMY/design:feature/10.0 to feature/10.0

* commit '21bbf8147c1678f7e6bc1316ac0f636eaec0443f':
  REPORT-53130 npe判断
  REPORT-53130 避免组件配置面板界面在点击当前组件的时候被重置到属性面板
feature/10.0
Tommy 4 years ago
parent
commit
955adc1a40
  1. 8
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  2. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

8
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -30,6 +30,7 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import java.awt.LayoutManager;
import java.awt.Rectangle;
@ -83,7 +84,14 @@ public class SelectionModel {
XCreator comp = designer.getComponentAt(e);
if (e.getButton() == MouseEvent.BUTTON3 || (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown())) {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
XCreator selectXCreator = selection.getSelectedCreator();
if (selectXCreator != null && comp != null) {
if (StringUtils.equals(selectXCreator.toData().getWidgetName(), comp.toData().getWidgetName())) {
return;
}
}
selection.reset();
} else {
//按下Ctrl或者shift键时鼠标可以进行多选,两次点击同一控件就取消选中
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(comp).getTopLayout();

7
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -68,6 +68,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.third.javax.annotation.Nullable;
@ -1476,6 +1477,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
editingMouseListener.stopEditing();
editingMouseListener.stopEditTopLayout(comp);
XCreator selectXCreator = editingMouseListener.getSelectionModel().getSelection().getSelectedCreator();
if (selectXCreator != null && comp != null) {
if (StringUtils.equals(selectXCreator.toData().getWidgetName(), comp.toData().getWidgetName())) {
return;
}
}
editingMouseListener.getSelectionModel().reset();
editingMouseListener.getSelectionModel().selectACreator(comp);
}

Loading…
Cancel
Save