Browse Source

REPORT-53130 npe判断

feature/10.0
kuangshuai 3 years ago
parent
commit
21bbf8147c
  1. 9
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  2. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

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

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

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

@ -1477,10 +1477,13 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
editingMouseListener.stopEditing(); editingMouseListener.stopEditing();
editingMouseListener.stopEditTopLayout(comp); editingMouseListener.stopEditTopLayout(comp);
if (!StringUtils.equals(editingMouseListener.getSelectionModel().getSelection().getSelectedCreator().toData().getWidgetName(), comp.toData().getWidgetName())) { XCreator selectXCreator = editingMouseListener.getSelectionModel().getSelection().getSelectedCreator();
editingMouseListener.getSelectionModel().reset(); if (selectXCreator != null && comp != null) {
if (StringUtils.equals(selectXCreator.toData().getWidgetName(), comp.toData().getWidgetName())) {
return;
}
} }
editingMouseListener.getSelectionModel().reset();
editingMouseListener.getSelectionModel().selectACreator(comp); editingMouseListener.getSelectionModel().selectACreator(comp);
} }

Loading…
Cancel
Save