diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index d24e79c5a..bffc4b11d 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -49,6 +49,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable private JTableHeader header;//把表头单独get出来作为一个组件 private UIHeadGroup tabsHeaderIconPane; + private XComponent lastAffectedCreator; public static WidgetPropertyPane getInstance() { @@ -132,9 +133,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope */ private void createPropertyTable() { formWidgetCardPane = new FormWidgetCardPane(designer); - designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane)); - psp = new UIScrollPane(formWidgetCardPane); // 用来装载属性表table psp.setBorder(null); } @@ -318,6 +317,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope private class WidgetPropertyDesignerAdapter implements DesignerEditListener { FormWidgetCardPane formWidgetCardPane; + WidgetPropertyDesignerAdapter(FormWidgetCardPane formWidgetCardPane) { this.formWidgetCardPane = formWidgetCardPane; } @@ -329,14 +329,20 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { formWidgetCardPane.populate(); }else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED){ - formWidgetCardPane = new FormWidgetCardPane(designer); + // 防止多次触发 + if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) { + formWidgetCardPane.populate(); + return; + } + lastAffectedCreator = evt.getAffectedCreator(); + refreshDockingView(); formWidgetCardPane.populate(); } } @Override public boolean equals(Object o) { - return o instanceof WidgetPropertyDesignerAdapter && ((WidgetPropertyDesignerAdapter) o).formWidgetCardPane == this.formWidgetCardPane; + return o instanceof WidgetPropertyDesignerAdapter; } } @@ -345,7 +351,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope */ private class EventPropertyDesignerAdapter implements DesignerEditListener { EventPropertyTable propertyTable; - private XComponent lastAffectedCreator; EventPropertyDesignerAdapter(EventPropertyTable eventTable) { this.propertyTable = eventTable; diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 2a8e1de2b..29327fa1e 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -27,7 +27,7 @@ import java.awt.*; * Created by ibm on 2017/7/25. */ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { - private AttributeChangeListener listener2; + private AttributeChangeListener listener; private FormDesigner designer; //当前的编辑器属性定义面板 private DataModify currentEditorDefinePane; @@ -81,7 +81,6 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } else { return null; } - } /** @@ -138,7 +137,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { jPanel.add(attriCardPane, BorderLayout.CENTER); - this.listener2 = new AttributeChangeListener() { + this.listener = new AttributeChangeListener() { @Override public void attributeChange() { updateCreator(); @@ -196,7 +195,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } widgetPropertyPane.populate(cellWidget); reinitAllListeners(); - this.addAttributeChangeListener(listener2); + this.addAttributeChangeListener(listener); }