From 84d6fdb7ec249916cec6038941e095526feac668 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=9F=E6=AD=A3=E6=88=90=E5=9B=A0:=20XNameWi?= =?UTF-8?q?degt=E6=BC=8F=E5=8A=A0setEnable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 ++------- .../java/com/fr/design/designer/creator/XNameWidget.java | 4 +++- .../main/java/com/fr/design/mainframe/FormParaPane.java | 2 +- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index d57875e38..40490702d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,19 +9,14 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; - private Widget widget; - public UserDefinedWidgetOption(String name, Widget widget) { + public UserDefinedWidgetOption(String name) { this.widgetConfigName = name; - this.widget = widget; } @Override public Widget createWidget() { - Widget widget = new NameWidget(widgetConfigName); - widget.setEnabled(this.widget.isEnabled()); - widget.setVisible(this.widget.isVisible()); - return widget; + return new NameWidget(widgetConfigName); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java index b886ad6c4..267101787 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java @@ -68,7 +68,9 @@ public class XNameWidget extends XWidgetCreator { Widget widget; if (wc != null && (widget= wc.toWidget()) != null) { editor = XCreatorUtils.createXCreator(widget); - toData().setVisible(widget.isVisible()); + Widget currentWidget = toData(); + currentWidget.setVisible(widget.isVisible()); + currentWidget.setEnabled(widget.isEnabled()); this.setBorder(null); } else { this.setBorder(DEFALUTBORDER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 1d990aeb6..9de248420 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -157,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 76cf26439..1958056b3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } }